ListView: alternating row colors removed. Adding sample variations bits

for animations makes the code too messy for the value of this feature.
This commit is contained in:
Uwe Rathmann 2023-08-02 09:01:06 +02:00
parent 946bac677d
commit 95a8809979
2 changed files with 3 additions and 14 deletions

View File

@ -1054,18 +1054,11 @@ void Editor::setupListView()
setPadding( Q::Cell, QskMargins( 4, 8 ) ); setPadding( Q::Cell, QskMargins( 4, 8 ) );
setColor( Q::Text, m_pal.themeForeground ); setColor( Q::Text, m_pal.themeForeground );
setColor( Q::Cell, Qt::white );
// alternating row colors
setColor( Q::Cell | A::Lower, Qt::white );
setColor( Q::Cell | A::Upper, m_pal.contrasted );
for ( auto state : { A::NoState, Q::Hovered, Q::Pressed } ) for ( auto state : { A::NoState, Q::Hovered, Q::Pressed } )
{ {
const auto aspect = Q::Cell | state | Q::Selected; setColor( Q::Cell | state | Q::Selected, m_pal.highlighted );
setColor( aspect | A::Lower, m_pal.highlighted );
setColor( aspect | A::Upper, m_pal.highlighted );
setColor( Q::Text | state | Q::Selected, m_pal.highlightedText ); setColor( Q::Text | state | Q::Selected, m_pal.highlightedText );
} }
} }

View File

@ -196,7 +196,6 @@ void QskListViewSkinlet::updateBackgroundNodes(
const QskListView* listView, QSGNode* backgroundNode ) const const QskListView* listView, QSGNode* backgroundNode ) const
{ {
using Q = QskListView; using Q = QskListView;
using A = QskAspect;
auto listViewNode = static_cast< const ListViewNode* >( backgroundNode->parent() ); auto listViewNode = static_cast< const ListViewNode* >( backgroundNode->parent() );
@ -209,10 +208,7 @@ void QskListViewSkinlet::updateBackgroundNodes(
const auto rect = sampleRect( listView, listView->contentsRect(), Q::Cell, row ); const auto rect = sampleRect( listView, listView->contentsRect(), Q::Cell, row );
const QskAspect aspect = Q::Cell | ( ( row % 2 ) ? A::Upper : A::Lower ); auto newNode = updateBoxNode( listView, rowNode, rect, Q::Cell );
const auto boxHints = listView->boxHints( aspect );
auto newNode = updateBoxNode( listView, rowNode, rect, boxHints );
if ( newNode ) if ( newNode )
{ {
if ( newNode->parent() != backgroundNode ) if ( newNode->parent() != backgroundNode )