Skip to content

Commit 8c8de2f

Browse files
Fix Qt 5 compatibility (#782)
1 parent fef9321 commit 8c8de2f

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,14 @@ CMakeLists.txt.user*
4848
*.pyc
4949

5050
/build
51+
/build*
5152
/icon/*.png
5253
/icon/ImageMagick
54+
55+
# JetBrains IDE prefs
56+
.idea/
57+
58+
# macOS annoyances
59+
.DS_Store
60+
*DS_Store
61+
._*

src/NotepadNext/dialogs/MainWindow.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,16 @@ void MainWindow::applyCustomShortcuts()
865865
for (const QString &shortcutString : value.toStringList()) {
866866
auto sequence = QKeySequence(shortcutString);
867867

868-
if (sequence.count() > 0 && sequence[0].key() != Qt::Key_unknown) {
869-
shortcuts.append(sequence);
870-
}
871-
else {
872-
qWarning() << "CustomShortcut: Cannot create QKeySequence(" << shortcutString << ") for " << actionName;
873-
}
868+
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
869+
if (sequence.count() > 0 && sequence[0].key() != Qt::Key_unknown) {
870+
#else
871+
if (sequence.count() > 0 && (sequence[0] & ~Qt::KeyboardModifierMask) != Qt::Key_unknown) {
872+
#endif
873+
shortcuts.append(sequence);
874+
}
875+
else {
876+
qWarning() << "CustomShortcut: Cannot create QKeySequence(" << shortcutString << ") for " << actionName;
877+
}
874878
}
875879

876880
if (!shortcuts.empty()) {

0 commit comments

Comments
 (0)