From 5048554de024a19e26161bd5bdf5f4a9e70a5390 Mon Sep 17 00:00:00 2001 From: Fabio Bas Date: Sun, 17 Nov 2024 22:57:23 +0100 Subject: [PATCH] KviShortcut: add new ctor to support QKeySequence::StandardKey with more than one QKeySequence --- src/kvilib/core/KviShortcut.cpp | 8 ++++++++ src/kvilib/core/KviShortcut.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/kvilib/core/KviShortcut.cpp b/src/kvilib/core/KviShortcut.cpp index 5e032f5b3..a12905ffd 100644 --- a/src/kvilib/core/KviShortcut.cpp +++ b/src/kvilib/core/KviShortcut.cpp @@ -46,6 +46,14 @@ QShortcut * KviShortcut::create(const QKeySequence & key, QObject * parent, cons return new QShortcut(key, parent, member, ambiguousMember, context); } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) +QShortcut * KviShortcut::create(const QKeySequence::StandardKey & key, QObject * parent, const char * member, const char * ambiguousMember, Qt::ShortcutContext context) +{ + //qDebug("New StdKey Shortcut %s\n", key.toString().toUtf8().data()); + return new QShortcut(key, parent, member, ambiguousMember, context); +} +#endif + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) QShortcut * KviShortcut::create(Qt::KeyboardModifier mod, Qt::Key key, QWidget * parent, const char * member, const char * ambiguousMember, Qt::ShortcutContext context) #else diff --git a/src/kvilib/core/KviShortcut.h b/src/kvilib/core/KviShortcut.h index 90b0be676..ab5693e5c 100644 --- a/src/kvilib/core/KviShortcut.h +++ b/src/kvilib/core/KviShortcut.h @@ -48,6 +48,7 @@ class KVILIB_API KviShortcut #else static QShortcut * create(const char * key, QObject * parent, const char * member = nullptr, const char * ambiguousMember = nullptr, Qt::ShortcutContext context = Qt::WindowShortcut); static QShortcut * create(const QKeySequence & key, QObject * parent, const char * member = nullptr, const char * ambiguousMember = nullptr, Qt::ShortcutContext context = Qt::WindowShortcut); + static QShortcut * create(const QKeySequence::StandardKey & key, QObject * parent, const char * member = nullptr, const char * ambiguousMember = nullptr, Qt::ShortcutContext context = Qt::WindowShortcut); static QShortcut * create(Qt::KeyboardModifier mod, Qt::Key key, QObject * parent, const char * member = nullptr, const char * ambiguousMember = nullptr, Qt::ShortcutContext context = Qt::WindowShortcut); #endif };