From 8a22a2f7bbc198fa9c7d76b554d3a8fa8f523842 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 15 Jun 2022 15:20:46 +0200 Subject: [PATCH] Add shadow to menus and move shadows to palette --- skins/material/QskMaterialSkin.cpp | 11 ++++++----- skins/material/QskMaterialSkin.h | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/skins/material/QskMaterialSkin.cpp b/skins/material/QskMaterialSkin.cpp index 44e06f3c..f84bf9ff 100644 --- a/skins/material/QskMaterialSkin.cpp +++ b/skins/material/QskMaterialSkin.cpp @@ -215,9 +215,8 @@ void Editor::setupMenu() QColor panel = flattenedColor( m_pal.primary, m_pal.background, 0.08 ); setGradient( Q::Panel, panel ); - QskShadowMetrics elevationLight1( 106, 20 ); - setShadowMetrics( Q::Panel | Q::Hovered, elevationLight1 ); - setShadowColor( Q::Panel | Q::Hovered, m_pal.shadow ); + setShadowMetrics( Q::Panel, m_pal.elevationLight2 ); + setShadowColor( Q::Panel, m_pal.shadow ); setMetric( Q::Separator | A::Size, qskDpiScaled( 1 ) ); setBoxShape( Q::Separator, 0 ); @@ -462,8 +461,7 @@ void Editor::setupPushButton() c2.setAlphaF( 0.38 ); setColor( Q::Text | Q::Disabled, c2 ); - QskShadowMetrics elevationLight1( -6, 20 ); - setShadowMetrics( Q::Panel | Q::Hovered, elevationLight1 ); + setShadowMetrics( Q::Panel | Q::Hovered, m_pal.elevationLight1 ); setShadowColor( Q::Panel | Q::Hovered, m_pal.shadow ); // Outlined and Text: @@ -928,6 +926,9 @@ QskMaterialTheme::QskMaterialTheme( Lightness lightness, shadow = m_palettes[ Neutral ].rgb( Q::W0 ); } + + elevationLight1 = QskShadowMetrics( -6, 20 ); + elevationLight2 = QskShadowMetrics( -5, 20 ); } QskMaterialSkin::QskMaterialSkin( const QskMaterialTheme& palette, QObject* parent ) diff --git a/skins/material/QskMaterialSkin.h b/skins/material/QskMaterialSkin.h index 91b5eefd..10e5b947 100644 --- a/skins/material/QskMaterialSkin.h +++ b/skins/material/QskMaterialSkin.h @@ -9,6 +9,7 @@ #include "QskMaterialGlobal.h" #include #include +#include #include @@ -67,6 +68,9 @@ class QSK_MATERIAL_EXPORT QskMaterialTheme QRgb shadow; + QskShadowMetrics elevationLight1; + QskShadowMetrics elevationLight2; + const qreal hoverOpacity = 0.08; const qreal focusOpacity = 0.12; const qreal pressedOpacity = 0.12;