From 17d746fad606904d72c83286aa9f29217ba21ed0 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 7 Jul 2023 18:23:55 +0200 Subject: [PATCH] list view: Allow for styling the viewport differently than scroll view ... as is needed by M3 --- skins/material3/QskMaterial3Skin.cpp | 7 ++++--- src/controls/QskListView.cpp | 2 ++ src/controls/QskListView.h | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/skins/material3/QskMaterial3Skin.cpp b/skins/material3/QskMaterial3Skin.cpp index c59f83fd..88c51314 100644 --- a/skins/material3/QskMaterial3Skin.cpp +++ b/skins/material3/QskMaterial3Skin.cpp @@ -1153,13 +1153,14 @@ void Editor::setupListView() { using Q = QskListView; + setGradient( Q::Viewport, m_pal.surface ); + + setStrutSize( Q::Cell, { -1, 56 } ); setPadding( Q::Cell, { 16_dp, 12_dp, 16_dp, 12_dp } ); - setBoxBorderMetrics( Q::Cell, { 0, 0, 0, 1_dp } ); setBoxBorderColors( Q::Cell, m_pal.outline ); - setColor( Q::Cell, m_pal.surface ); setColor( Q::Cell | Q::Selected, m_pal.primary12 ); - setColor( Q::Text, m_pal.onSurfaceVariant ); + setColor( Q::Text, m_pal.onSurface ); } void Editor::setupSubWindow() diff --git a/src/controls/QskListView.cpp b/src/controls/QskListView.cpp index ad23e8ca..952805c6 100644 --- a/src/controls/QskListView.cpp +++ b/src/controls/QskListView.cpp @@ -13,6 +13,7 @@ #include +QSK_SUBCONTROL( QskListView, Viewport ) QSK_SUBCONTROL( QskListView, Cell ) QSK_SUBCONTROL( QskListView, Text ) @@ -38,6 +39,7 @@ QskListView::QskListView( QQuickItem* parent ) : QskScrollView( parent ) , m_data( new PrivateData() ) { + setSubcontrolProxy( Inherited::Viewport, Viewport ); } QskListView::~QskListView() diff --git a/src/controls/QskListView.h b/src/controls/QskListView.h index b05f7736..b6a9eb15 100644 --- a/src/controls/QskListView.h +++ b/src/controls/QskListView.h @@ -33,7 +33,7 @@ class QSK_EXPORT QskListView : public QskScrollView using Inherited = QskScrollView; public: - QSK_SUBCONTROLS( Cell, Text ) + QSK_SUBCONTROLS( Viewport, Cell, Text ) QSK_STATES( Selected ) enum SelectionMode