From 8acedaed61da9a64f4602015e6c063e2cd673211 Mon Sep 17 00:00:00 2001 From: Yoann Quenach de Quivillic Date: Wed, 18 Dec 2024 18:26:59 +0100 Subject: [PATCH] Apply suggestion from review --- src/gui/qgsshortcutsmanager.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/gui/qgsshortcutsmanager.cpp b/src/gui/qgsshortcutsmanager.cpp index 7001e4bc3d0c..8fa1ce733ced 100644 --- a/src/gui/qgsshortcutsmanager.cpp +++ b/src/gui/qgsshortcutsmanager.cpp @@ -375,16 +375,8 @@ void QgsShortcutsManager::updateActionToolTip( QAction *action, const QString &s if ( current.lastIndexOf( rx, -1, &match ) != -1 ) { // Check if it is a valid QKeySequence - bool validSequence = true; - for ( const QString &part : QKeySequence( match.captured( 1 ) ).toString().split( "," ) ) - { - if ( part.trimmed().isEmpty() ) - { - validSequence = false; - break; - } - } - if ( validSequence ) + const QStringList parts = QKeySequence( match.captured( 1 ) ).toString().split( "," ); + if ( std::all_of( parts.constBegin(), parts.constEnd(), []( const QString &part ) { return !part.trimmed().isEmpty(); } ) ) { current = current.remove( match.capturedStart( 0 ), match.capturedLength( 0 ) ); }