commit f6197bdff38089c4beff670b33293973eab5dcdb
Author: Scott Kostyshak <skost...@lyx.org>
Date:   Sun Mar 2 15:16:20 2025 +0100

    Fix combo box shortcut key sequence for Qt 5.15.13
    
    The previous code worked for Qt 6, but for me with Qt 5.15.13, I
    received the following (with -Werror):
    
      
/home/scott/lyxbuilds/master-master/repo/src/frontends/qt/GuiPrefs.cpp:1047:46: 
error: arithmetic between different enumeration types ('Qt::Modifier' and 
'Qt::Key') is deprecated
      [-Werror,-Wdeprecated-enum-enum-conversion]
       1047 |                 new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), 
this);
            |                                            ~~~~~~~~ ^ ~~~~~~~~~
    
    If I changed the guard condition to be < 5.15.0 (so that the Qt 6
    code path is triggered with Qt 5.15.13), I then get the following
    different failure:
    
      
/home/scott/lyxbuilds/master-master/repo/src/frontends/qt/GuiPrefs.cpp:1050:46: 
error: bitwise operation between different enumeration types ('Qt::Modifier' 
and 'Qt::Key') is deprecated
      [-Werror,-Wdeprecated-enum-enum-conversion]
        1050 |                 new QShortcut(QKeySequence(Qt::CTRL | 
Qt::Key_L), this);
             |                                            ~~~~~~~~ ^ ~~~~~~~~~
    
    This commit fixes it by using an alternative form documented here:
    
      https://doc.qt.io/qtforpython-5/PySide2/QtGui/QKeySequence.html
---
 src/frontends/qt/GuiPrefs.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index df43a199b4..b2904bda00 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1044,7 +1044,7 @@ PrefColors::PrefColors(GuiPreferences * form)
        // give a shortcut to the combobox
 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
        QShortcut* sc_load_theme =
-               new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this);
+               new QShortcut(QKeySequence(tr("Ctrl+l")), this);
 #else
        QShortcut* sc_load_theme =
                new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_L), this);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to