From b7fe24602cacf6366b5b04f3200ed3eb271d8c78 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 15 May 2023 12:22:55 +0200 Subject: [PATCH] wip --- src/controls/QskMenu.cpp | 8 ++++++-- src/controls/QskMenuSkinlet.cpp | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/controls/QskMenu.cpp b/src/controls/QskMenu.cpp index c9d3fd45..8570c813 100644 --- a/src/controls/QskMenu.cpp +++ b/src/controls/QskMenu.cpp @@ -432,8 +432,10 @@ QRectF QskMenu::focusIndicatorRect() const if( currentIndex() >= 0 ) { + auto actionIndex = qskActionIndex( m_data->actions, currentIndex() ); + return effectiveSkinlet()->sampleRect( this, - contentsRect(), Segment, currentIndex() ); + contentsRect(), Segment, actionIndex ); } return Inherited::focusIndicatorRect(); @@ -441,8 +443,10 @@ QRectF QskMenu::focusIndicatorRect() const QRectF QskMenu::cellRect( int index ) const { + const auto actionIndex = qskActionIndex( m_data->actions, index ); + return effectiveSkinlet()->sampleRect( - this, contentsRect(), QskMenu::Segment, index ); + this, contentsRect(), QskMenu::Segment, actionIndex ); } int QskMenu::indexAtPosition( const QPointF& pos ) const diff --git a/src/controls/QskMenuSkinlet.cpp b/src/controls/QskMenuSkinlet.cpp index fdf4e50f..0e6cea43 100644 --- a/src/controls/QskMenuSkinlet.cpp +++ b/src/controls/QskMenuSkinlet.cpp @@ -211,7 +211,7 @@ QRectF QskMenuSkinlet::cursorRect( const auto count = sampleCount( skinnable, QskMenu::Segment ); auto rect = sampleRect( skinnable, contentsRect, - QskMenu::Segment, qBound( 0, index, count ) ); + QskMenu::Segment, qBound( 0, index, count - 1 ) ); if ( index < 0 ) rect.setBottom( rect.top() ); @@ -375,7 +375,8 @@ QskAspect::States QskMenuSkinlet::sampleStates( if ( subControl == Q::Segment || subControl == Q::Icon || subControl == Q::Text ) { const auto menu = static_cast< const QskMenu* >( skinnable ); - if ( menu->currentIndex() == index ) + + if ( menu->currentIndex() == menu->actions()[ index ] ) states |= QskMenu::Selected; }