Skip to content

Commit

Permalink
KviShortcut: add new ctor to support QKeySequence::StandardKey with m…
Browse files Browse the repository at this point in the history
…ore than one QKeySequence
  • Loading branch information
ctrlaltca committed Nov 17, 2024
1 parent 51f3abb commit 5048554
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/kvilib/core/KviShortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/kvilib/core/KviShortcut.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down

0 comments on commit 5048554

Please sign in to comment.