Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use QgsProjectVersion to compare versions
  • Loading branch information
YoannQDQ authored and nyalldawson committed Mar 29, 2023
1 parent c5e1ca5 commit 288346e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/gui/qgsconfigureshortcutsdialog.cpp
Expand Up @@ -20,6 +20,7 @@
#include "qgslogger.h"
#include "qgssettings.h"
#include "qgsgui.h"
#include "qgsprojectversion.h"

#include <QKeyEvent>
#include <QKeySequence>
Expand Down Expand Up @@ -268,11 +269,12 @@ void QgsConfigureShortcutsDialog::loadShortcuts()
currentLocale = QLocale().name();
}

const QString version = root.attribute( QStringLiteral( "version" ) );
const QString versionStr = root.attribute( QStringLiteral( "version" ) );
const QgsProjectVersion version( versionStr );

if ( root.attribute( QStringLiteral( "locale" ) ) != currentLocale )
{
if ( version < "1.1" )
if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
{
QMessageBox::information( this, tr( "Loading Shortcuts" ),
tr( "The file contains shortcuts created with different locale, so you can't use it." ) );
Expand All @@ -293,7 +295,7 @@ void QgsConfigureShortcutsDialog::loadShortcuts()
while ( !child.isNull() )
{
actionShortcut = child.attribute( QStringLiteral( "shortcut" ) );
if ( version < "1.1" )
if ( version < QgsProjectVersion( QStringLiteral( "1.1" ) ) )
{
actionName = child.attribute( QStringLiteral( "name" ) );
mManager->setKeySequence( actionName, actionShortcut );
Expand Down

0 comments on commit 288346e

Please sign in to comment.