Skip to content

Commit

Permalink
QKeySequence where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
YakoYakoYokuYoku committed Dec 20, 2024
1 parent 876a222 commit b374089
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 28 deletions.
4 changes: 4 additions & 0 deletions Gui/ActionShortcuts.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,11 @@ extractKeySequence(const QKeySequence & seq,
///The nativeSeqStr now contains only the symbol
QKeySequence newSeq(nativeSeqStr, QKeySequence::NativeText);
if (newSeq.count() > 0) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
symbol = newSeq[0].key();
#else
symbol = (Qt::Key)newSeq[0];
#endif
} else {
symbol = (Qt::Key)0;
}
Expand Down
6 changes: 3 additions & 3 deletions Gui/CurveWidgetPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,20 +189,20 @@ CurveWidgetPrivate::createMenu()

QAction* copyKeyFramesAction = new ActionWithShortcut(kShortcutGroupCurveEditor, kShortcutIDActionCurveEditorCopy,
kShortcutDescActionCurveEditorCopy, editMenu);
copyKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_C) );
copyKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_C) );

QObject::connect( copyKeyFramesAction, SIGNAL(triggered()), _widget, SLOT(copySelectedKeyFramesToClipBoard()) );
editMenu->addAction(copyKeyFramesAction);

QAction* pasteKeyFramesAction = new ActionWithShortcut(kShortcutGroupCurveEditor, kShortcutIDActionCurveEditorPaste,
kShortcutDescActionCurveEditorPaste, editMenu);
pasteKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_V) );
pasteKeyFramesAction->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_V) );
QObject::connect( pasteKeyFramesAction, SIGNAL(triggered()), _widget, SLOT(pasteKeyFramesFromClipBoardToSelectedCurve()) );
editMenu->addAction(pasteKeyFramesAction);

QAction* selectAllAction = new ActionWithShortcut(kShortcutGroupCurveEditor, kShortcutIDActionCurveEditorSelectAll,
kShortcutDescActionCurveEditorSelectAll, editMenu);
selectAllAction->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_A) );
selectAllAction->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_A) );
QObject::connect( selectAllAction, SIGNAL(triggered()), _widget, SLOT(selectAllKeyFrames()) );
editMenu->addAction(selectAllAction);

Expand Down
24 changes: 12 additions & 12 deletions Gui/Gui15.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,43 +147,43 @@ Gui::keySequenceForView(ViewIdx v)
switch ( static_cast<int>(v) ) {
case 0:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_1);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_1);
break;
case 1:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_2);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_2);
break;
case 2:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_3);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_3);
break;
case 3:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_4);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_4);
break;
case 4:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_5);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_5);
break;
case 5:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_6);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_6);
break;
case 6:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_7);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_7);
break;
case 7:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_8);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_8);
break;
case 8:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_9);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_9);
break;
case 9:

return QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_0);
return QKeySequence(Qt::CTRL | Qt::ALT | Qt::Key_0);
break;
default:

Expand Down Expand Up @@ -250,13 +250,13 @@ Gui::updateViewsActions(int viewsCount)
if (viewsCount == 2) {
QAction* left = new QAction(this);
left->setCheckable(false);
left->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_1) );
left->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_1) );
_imp->viewersViewMenu->addAction(left);
left->setText( tr("Display Left View") );
QObject::connect( left, SIGNAL(triggered()), this, SLOT(showView0()) );
QAction* right = new QAction(this);
right->setCheckable(false);
right->setShortcut( QKeySequence(Qt::CTRL + Qt::Key_2) );
right->setShortcut( QKeySequence(Qt::CTRL | Qt::Key_2) );
_imp->viewersViewMenu->addAction(right);
right->setText( tr("Display Right View") );
QObject::connect( right, SIGNAL(triggered()), this, SLOT(showView1()) );
Expand Down
2 changes: 1 addition & 1 deletion Gui/KnobGuiString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ KnobGuiString::updateToolTip()
tt += tr("This text area supports html encoding. "
"Please check <a href=http://qt-project.org/doc/qt-5/richtext-html-subset.html>Qt website</a> for more info.");
}
QKeySequence seq(Qt::CTRL + Qt::Key_Return);
QKeySequence seq(Qt::CTRL | Qt::Key_Return);
tt += tr("Use %1 to validate changes made to the text.").arg( seq.toString(QKeySequence::NativeText) );
_textEdit->setToolTip(tt);
} else if (_lineEdit) {
Expand Down
8 changes: 4 additions & 4 deletions Gui/RotoPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2247,17 +2247,17 @@ RotoPanel::showItemMenu(QTreeWidgetItem* item,
deleteAct->setShortcut( QKeySequence(Qt::Key_Backspace) );
QObject::connect( deleteAct, SIGNAL(triggered()), this, SLOT(onDeleteItemActionTriggered()) );
QAction* cutAct = menu.addAction( tr("Cut") );
cutAct->setShortcut( QKeySequence(Qt::Key_X + Qt::CTRL) );
cutAct->setShortcut( QKeySequence(Qt::Key_X | Qt::CTRL) );
QObject::connect( cutAct, SIGNAL(triggered()), this, SLOT(onCutItemActionTriggered()) );
QAction* copyAct = menu.addAction( tr("Copy") );
copyAct->setShortcut( QKeySequence(Qt::Key_C + Qt::CTRL) );
copyAct->setShortcut( QKeySequence(Qt::Key_C | Qt::CTRL) );
QObject::connect( copyAct, SIGNAL(triggered()), this, SLOT(onCopyItemActionTriggered()) );
QAction* pasteAct = menu.addAction( tr("Paste") );
pasteAct->setShortcut( QKeySequence(Qt::Key_V + Qt::CTRL) );
pasteAct->setShortcut( QKeySequence(Qt::Key_V | Qt::CTRL) );
QObject::connect( pasteAct, SIGNAL(triggered()), this, SLOT(onPasteItemActionTriggered()) );
pasteAct->setEnabled( !_imp->clipBoard.empty() );
QAction* duplicateAct = menu.addAction( tr("Duplicate") );
duplicateAct->setShortcut( QKeySequence(Qt::Key_C + Qt::ALT) );
duplicateAct->setShortcut( QKeySequence(Qt::Key_C | Qt::ALT) );
QObject::connect( duplicateAct, SIGNAL(triggered()), this, SLOT(onDuplicateItemActionTriggered()) );

///The base layer cannot be duplicated
Expand Down
8 changes: 4 additions & 4 deletions Gui/ScriptEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ ScriptEditor::ScriptEditor(Gui* gui)
appPTR->getIcon(NATRON_PIXMAP_SCRIPT_SAVE_SCRIPT, NATRON_MEDIUM_BUTTON_ICON_SIZE, &saveScriptPix);

_imp->undoB = new Button(QIcon(undoPix), QString(), _imp->buttonsContainer);
QKeySequence undoSeq(Qt::CTRL + Qt::Key_BracketLeft);
QKeySequence undoSeq(Qt::CTRL | Qt::Key_BracketLeft);
_imp->undoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
_imp->undoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
_imp->undoB->setFocusPolicy(Qt::NoFocus);
Expand All @@ -141,7 +141,7 @@ ScriptEditor::ScriptEditor(Gui* gui)
QObject::connect( _imp->undoB, SIGNAL(clicked(bool)), this, SLOT(onUndoClicked()) );

_imp->redoB = new Button(QIcon(redoPix), QString(), _imp->buttonsContainer);
QKeySequence redoSeq(Qt::CTRL + Qt::Key_BracketRight);
QKeySequence redoSeq(Qt::CTRL | Qt::Key_BracketRight);
_imp->redoB->setFocusPolicy(Qt::NoFocus);
_imp->redoB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
_imp->redoB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
Expand Down Expand Up @@ -180,7 +180,7 @@ ScriptEditor::ScriptEditor(Gui* gui)
QObject::connect( _imp->saveScriptB, SIGNAL(clicked(bool)), this, SLOT(onSaveScriptClicked()) );

_imp->execScriptB = new Button(QIcon(execScriptPix), QString(), _imp->buttonsContainer);
QKeySequence execSeq(Qt::CTRL + Qt::Key_Return);
QKeySequence execSeq(Qt::CTRL | Qt::Key_Return);
_imp->execScriptB->setFocusPolicy(Qt::NoFocus);
_imp->execScriptB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
_imp->execScriptB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
Expand All @@ -201,7 +201,7 @@ ScriptEditor::ScriptEditor(Gui* gui)
QObject::connect( _imp->showHideOutputB, SIGNAL(clicked(bool)), this, SLOT(onShowHideOutputClicked(bool)) );

_imp->clearOutputB = new Button(QIcon(clearOutpoutPix), QString(), _imp->buttonsContainer);
QKeySequence clearSeq(Qt::CTRL + Qt::Key_Backspace);
QKeySequence clearSeq(Qt::CTRL | Qt::Key_Backspace);
_imp->clearOutputB->setFocusPolicy(Qt::NoFocus);
_imp->clearOutputB->setFixedSize(NATRON_MEDIUM_BUTTON_SIZE, NATRON_MEDIUM_BUTTON_SIZE);
_imp->clearOutputB->setIconSize( QSize(NATRON_MEDIUM_BUTTON_ICON_SIZE, NATRON_MEDIUM_BUTTON_ICON_SIZE) );
Expand Down
4 changes: 2 additions & 2 deletions Gui/SequenceFileDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,13 +783,13 @@ SequenceFileDialog::createMenuActions()
{
QAction *goHomeAction = new QAction(this);

goHomeAction->setShortcut(Qt::CTRL + Qt::Key_H + Qt::SHIFT);
goHomeAction->setShortcut(QKeySequence(Qt::CTRL, Qt::SHIFT, Qt::Key_H));
QObject::connect( goHomeAction, SIGNAL(triggered()), this, SLOT(goHome()) );
addAction(goHomeAction);


QAction *goToParent = new QAction(this);
goToParent->setShortcut(Qt::CTRL + Qt::UpArrow);
goToParent->setShortcut(QKeySequence(Qt::CTRL, Qt::Key_Up));
QObject::connect( goToParent, SIGNAL(triggered()), this, SLOT(parentFolder()) );
addAction(goToParent);

Expand Down
4 changes: 2 additions & 2 deletions Gui/ViewerTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ ViewerTab::ViewerTab(const std::list<NodeGuiPtr> & existingNodesContext,
_imp->refreshButton->setFixedSize(buttonSize);
_imp->refreshButton->setIconSize(buttonIconSize);
{
QKeySequence seq(Qt::CTRL + Qt::SHIFT);
QKeySequence seq(Qt::CTRL | Qt::SHIFT);
std::list<std::string> refreshActions;
refreshActions.push_back(kShortcutIDActionRefresh);
refreshActions.push_back(kShortcutIDActionRefreshWithStats);
Expand All @@ -338,7 +338,7 @@ ViewerTab::ViewerTab(const std::list<NodeGuiPtr> & existingNodesContext,
_imp->pauseButton->setChecked(false);
_imp->pauseButton->setDown(false);
{
QKeySequence seq(Qt::CTRL + Qt::SHIFT);
QKeySequence seq(Qt::CTRL | Qt::SHIFT);
std::list<std::string> actions;
actions.push_back(kShortcutIDActionPauseViewerInputA);
actions.push_back(kShortcutIDActionPauseViewer);
Expand Down

0 comments on commit b374089

Please sign in to comment.