From b3ed7f90e402e6e5fba38fb3a5f6394e21f4e0bc Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Mon, 15 May 2023 10:51:25 +0200 Subject: [PATCH] wip --- src/controls/QskMenu.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/controls/QskMenu.cpp b/src/controls/QskMenu.cpp index cce9f471..c9d3fd45 100644 --- a/src/controls/QskMenu.cpp +++ b/src/controls/QskMenu.cpp @@ -347,17 +347,23 @@ void QskMenu::traverse( int steps ) int action2 = action1 + steps; // when cycling we want to slide in + int index1; + if ( action2 < 0 ) - action1 = count; + index1 = m_data->options.count(); else if ( action2 >= count ) - action1 = -1; + index1 = -1; + else + index1 = actions[ action1 ]; action2 %= count; if ( action2 < 0 ) action2 += count; - movePositionHint( Cursor, actions[ action1 ], actions[ action2 ] ); - setCurrentIndex( actions[ action2 ] ); + const auto index2 = actions[ action2 ]; + + movePositionHint( Cursor, index1, index2 ); + setCurrentIndex( index2 ); } void QskMenu::mousePressEvent( QMouseEvent* event )