Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Move shortcuts to Qt StandardKeys constants #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions pv/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,15 +547,11 @@ void MainWindow::setup_ui()
session_selector_.setCornerWidget(static_tab_widget_, Qt::TopLeftCorner);
session_selector_.setTabsClosable(true);

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this, SLOT(close()));
close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this, SLOT(on_close_current_tab()));
#else
close_application_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this, SLOT(close()));
close_current_tab_shortcut_ = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this, SLOT(on_close_current_tab()));
#endif
close_application_shortcut_ = new QShortcut(QKeySequence::Quit, this, SLOT(close()));
close_application_shortcut_->setAutoRepeat(false);

close_current_tab_shortcut_ = new QShortcut(QKeySequence::Close, this, SLOT(on_close_current_tab()));

connect(new_session_button_, SIGNAL(clicked(bool)),
this, SLOT(on_new_session_clicked()));
connect(run_stop_button_, SIGNAL(clicked(bool)),
Expand Down
12 changes: 2 additions & 10 deletions pv/toolbars/mainbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ MainBar::MainBar(Session &session, QWidget *parent, pv::views::trace::View *view
action_open_->setText(tr("&Open..."));
action_open_->setIcon(QIcon::fromTheme("document-open",
QIcon(":/icons/document-open.png")));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
action_open_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_O));
#else
action_open_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_O));
#endif
action_open_->setShortcut(QKeySequence::Open);
connect(action_open_, SIGNAL(triggered(bool)),
this, SLOT(on_actionOpen_triggered()));

Expand All @@ -145,11 +141,7 @@ MainBar::MainBar(Session &session, QWidget *parent, pv::views::trace::View *view
action_save_->setText(tr("&Save..."));
action_save_->setIcon(QIcon::fromTheme("document-save-as",
QIcon(":/icons/document-save-as.png")));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
action_save_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_S));
#else
action_save_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
#endif
action_save_->setShortcut(QKeySequence::Save);
connect(action_save_, SIGNAL(triggered(bool)),
this, SLOT(on_actionSave_triggered()));

Expand Down