Skip to content

Commit

Permalink
Add different code for Qt5.
Browse files Browse the repository at this point in the history
Signed-off-by: Melvin Li <[email protected]>
  • Loading branch information
Zalafina committed Aug 6, 2023
1 parent c146247 commit a4e59ab
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions QKeyMapper/qkeymapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static const char *REMOVESETTINGBUTTON_CHINESE = "移除";
static const char *DISABLEWINKEYCHECKBOX_CHINESE = "禁用WIN按键";
static const char *AUTOSTARTMAPPINGCHECKBOX_CHINESE = "自动开始映射";
static const char *AUTOSTARTUPCHECKBOX_CHINESE = "开机自动启动";
static const char *MAPPINGSWITCHKEYLABEL_CHINESE = "映射切换快捷键";
static const char *MAPPINGSWITCHKEYLABEL_CHINESE = "映射开关快捷键";
static const char *PROCESSINFOTABLE_COL1_CHINESE = "文件名";
static const char *PROCESSINFOTABLE_COL2_CHINESE = "进程号";
static const char *PROCESSINFOTABLE_COL3_CHINESE = "标题";
Expand Down Expand Up @@ -3171,15 +3171,26 @@ void KeySequenceEditOnlyOne::keyPressEvent(QKeyEvent* pEvent)
return;
}

QKeyCombination keyComb = keySeq[0];
QKeySequence setKeySeq;
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QKeyCombination keyComb = keySeq[0];
if (keyComb.key() == Qt::Key_Backspace || keyComb.key() == Qt::Key_Delete)
{
setKeySeq = QKeySequence(MAPPINGSWITCH_KEYSEQ_DEFAULT);
}
else {
setKeySeq = QKeySequence(keyComb);
}
#else
int keyComb = keySeq[0];
if (keyComb == Qt::Key_Backspace || keyComb == Qt::Key_Delete)
{
setKeySeq = QKeySequence(MAPPINGSWITCH_KEYSEQ_DEFAULT);
}
else {
setKeySeq = QKeySequence(keyComb);
}
#endif

QString keyseqEditStr = setKeySeq.toString();
if (false == keyseqEditStr.isEmpty()) {
Expand Down

0 comments on commit a4e59ab

Please sign in to comment.