list view: Allow for styling the viewport differently than scroll view

... as is needed by M3
This commit is contained in:
Peter Hartmann 2023-07-07 18:23:55 +02:00
parent 737dc28313
commit 17d746fad6
3 changed files with 7 additions and 4 deletions

View File

@ -1153,13 +1153,14 @@ void Editor::setupListView()
{ {
using Q = QskListView; 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 } ); 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 ); setBoxBorderColors( Q::Cell, m_pal.outline );
setColor( Q::Cell, m_pal.surface );
setColor( Q::Cell | Q::Selected, m_pal.primary12 ); setColor( Q::Cell | Q::Selected, m_pal.primary12 );
setColor( Q::Text, m_pal.onSurfaceVariant ); setColor( Q::Text, m_pal.onSurface );
} }
void Editor::setupSubWindow() void Editor::setupSubWindow()

View File

@ -13,6 +13,7 @@
#include <qmath.h> #include <qmath.h>
QSK_SUBCONTROL( QskListView, Viewport )
QSK_SUBCONTROL( QskListView, Cell ) QSK_SUBCONTROL( QskListView, Cell )
QSK_SUBCONTROL( QskListView, Text ) QSK_SUBCONTROL( QskListView, Text )
@ -38,6 +39,7 @@ QskListView::QskListView( QQuickItem* parent )
: QskScrollView( parent ) : QskScrollView( parent )
, m_data( new PrivateData() ) , m_data( new PrivateData() )
{ {
setSubcontrolProxy( Inherited::Viewport, Viewport );
} }
QskListView::~QskListView() QskListView::~QskListView()

View File

@ -33,7 +33,7 @@ class QSK_EXPORT QskListView : public QskScrollView
using Inherited = QskScrollView; using Inherited = QskScrollView;
public: public:
QSK_SUBCONTROLS( Cell, Text ) QSK_SUBCONTROLS( Viewport, Cell, Text )
QSK_STATES( Selected ) QSK_STATES( Selected )
enum SelectionMode enum SelectionMode