Material: Fix Header and Footer boxes

At some later point, we can introduce an application window class.
Also, move tabs to bottom.
Also, add some tinted surface colors.
This commit is contained in:
Peter Hartmann 2022-07-12 15:10:09 +02:00
parent a6017a30e6
commit eeaf681366
3 changed files with 30 additions and 7 deletions

View File

@ -40,9 +40,9 @@ namespace
TabView( QQuickItem* parent = nullptr )
: QskTabView( parent )
{
setMargins( 10 );
setTabBarEdge( Qt::LeftEdge );
setTabBarEdge( Qt::BottomEdge );
setAutoFitTabs( true );
setSection( QskAspect::Footer );
}
void setTabsEnabled( bool on )
@ -162,12 +162,10 @@ namespace
: QskLinearBox( Qt::Horizontal, parent )
{
initSizePolicy( QskSizePolicy::Ignored, QskSizePolicy::Fixed );
setPanel( true );
setSection( QskAspect::Header );
setMargins( 10 );
setBackgroundColor( Qt::lightGray );
new FileButton( "File", this );
new SkinButton( "Skin", this );
@ -194,6 +192,8 @@ namespace
ApplicationView( QQuickItem* parent = nullptr )
: QskLinearBox( Qt::Vertical, parent )
{
setSpacing( 0 );
auto header = new Header( this );
auto tabView = new TabView( this );

View File

@ -191,10 +191,11 @@ void Editor::setupCheckBox()
void Editor::setupBox()
{
using Q = QskBox;
using A = QskAspect;
setGradient( Q::Panel, m_pal.background );
setBoxShape( Q::Panel, 14 );
setBoxBorderMetrics( Q::Panel, 0 );
setGradient( Q::Panel | A::Header, m_pal.surface2 );
setGradient( Q::Panel | A::Footer, m_pal.surface2 );
}
void Editor::setupPopup()
@ -635,6 +636,7 @@ void Editor::setupTabButton()
setGradient( Q::Panel, m_pal.surface );
setColor( Q::Text, m_pal.onSurfaceVariant );
setColor( Q::Text | A::Footer, m_pal.onSecondaryContainer );
setColor( Q::Text | Q::Disabled, m_pal.onSurface38 );
setColor( Q::Text | Q::Checked, m_pal.primary );
@ -687,6 +689,15 @@ void Editor::setupTabButton()
c.setAlphaF( m_pal.pressedOpacity );
setGradient( Q::Panel | Q::Pressed, c );
setGradient( Q::Panel | A::Footer, m_pal.surface2 );
setGradient( Q::Panel | A::Footer | Q::Checked, m_pal.secondaryContainer );
setGradient( Q::Panel | A::Footer | Q::Hovered, stateLayerColor( m_pal.onSurfaceVariant, m_pal.hoverOpacity ) );
setGradient( Q::Panel | A::Footer | Q::Hovered | Q::Checked, stateLayerColor( m_pal.onSurface, m_pal.hoverOpacity ) );
setGradient( Q::Panel | A::Footer | Q::Focused, stateLayerColor( m_pal.onSurfaceVariant, m_pal.focusOpacity ) );
setGradient( Q::Panel | A::Footer | Q::Focused | Q::Checked, stateLayerColor( m_pal.onSurface, m_pal.focusOpacity ) );
setGradient( Q::Panel | A::Footer | Q::Pressed, stateLayerColor( m_pal.onSurfaceVariant, m_pal.pressedOpacity ) );
setGradient( Q::Panel | A::Footer | Q::Pressed | Q::Checked, stateLayerColor( m_pal.onSurface, m_pal.pressedOpacity ) );
setAnimation( Q::Panel | A::Color, qskDuration );
setFontRole( Q::Text, QskMaterial3Skin::M3LabelLarge );
@ -916,6 +927,12 @@ QskMaterial3Theme::QskMaterial3Theme(Lightness lightness,
primary12 = primary;
primary12.setAlphaF( 0.12 );
surface1 = flattenedColor( primary, background, 0.05 );
surface2 = flattenedColor( primary, background, 0.08 );
surface3 = flattenedColor( primary, background, 0.11 );
surface4 = flattenedColor( primary, background, 0.12 );
surface5 = flattenedColor( primary, background, 0.14 );
onSurface12 = onSurface;
onSurface12.setAlphaF( 0.12 );

View File

@ -62,6 +62,12 @@ class QSK_MATERIAL3_EXPORT QskMaterial3Theme
QRgb background;
QRgb onBackground;
QRgb surface;
QColor surface1;
QColor surface2;
QColor surface3;
QColor surface4;
QColor surface5;
QRgb onSurface;
QColor onSurface12;
QColor onSurface38;