From df610752c78b7994ca848b8ae8ea7d5f037fa4db Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 8 Feb 2022 11:24:53 -0800 Subject: [PATCH] cleanup: don't add QKeySequence values These should be handled as logical OR operations as they are bits. Signed-off-by: Dirk Hohndel --- desktop-widgets/about.cpp | 4 ++-- desktop-widgets/btdeviceselectiondialog.cpp | 2 +- desktop-widgets/divelogexportdialog.cpp | 4 ++-- desktop-widgets/divelogimportdialog.cpp | 4 ++-- desktop-widgets/divesiteimportdialog.cpp | 4 ++-- desktop-widgets/downloadfromdivecomputer.cpp | 4 ++-- desktop-widgets/mainwindow.cpp | 12 ++++++------ desktop-widgets/simplewidgets.cpp | 20 ++++++++++---------- desktop-widgets/subsurfacewebservices.cpp | 4 ++-- desktop-widgets/tripselectiondialog.cpp | 4 ++-- 10 files changed, 31 insertions(+), 31 deletions(-) diff --git a/desktop-widgets/about.cpp b/desktop-widgets/about.cpp index faece6656..503bb5e69 100644 --- a/desktop-widgets/about.cpp +++ b/desktop-widgets/about.cpp @@ -19,9 +19,9 @@ SubsurfaceAbout::SubsurfaceAbout(QWidget *parent) : QDialog(parent, QFlag(0)) "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger, and others, 2011-2022" "").arg(versionString)); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } diff --git a/desktop-widgets/btdeviceselectiondialog.cpp b/desktop-widgets/btdeviceselectiondialog.cpp index 4eef0dfe9..e54e78e20 100644 --- a/desktop-widgets/btdeviceselectiondialog.cpp +++ b/desktop-widgets/btdeviceselectiondialog.cpp @@ -18,7 +18,7 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) : ui->setupUi(this); // Quit button callbacks - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), this, SLOT(reject())); connect(ui->quit, SIGNAL(clicked()), this, SLOT(reject())); diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp index 391960c12..1381f2767 100644 --- a/desktop-widgets/divelogexportdialog.cpp +++ b/desktop-widgets/divelogexportdialog.cpp @@ -37,9 +37,9 @@ DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent), { ui->setupUi(this); showExplanation(); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), MainWindow::instance(), SLOT(close())); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); /* the names are not the actual values exported to the json files,The font-family property should hold several diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp index bb6c7650c..d10b9d5f7 100644 --- a/desktop-widgets/divelogimportdialog.cpp +++ b/desktop-widgets/divelogimportdialog.cpp @@ -380,9 +380,9 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia loadFileContents(-1, INITIAL); /* manually import CSV file */ - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(ui->CSVSeparator, SIGNAL(currentIndexChanged(int)), this, SLOT(loadFileContentsSeperatorSelected(int))); diff --git a/desktop-widgets/divesiteimportdialog.cpp b/desktop-widgets/divesiteimportdialog.cpp index f440d6edb..c16918809 100644 --- a/desktop-widgets/divesiteimportdialog.cpp +++ b/desktop-widgets/divesiteimportdialog.cpp @@ -16,8 +16,8 @@ DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent), importedSource(source) { - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); divesiteImportedModel = new DivesiteImportedModel(this); diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp index 6b6e9f5f1..c11260905 100644 --- a/desktop-widgets/downloadfromdivecomputer.cpp +++ b/desktop-widgets/downloadfromdivecomputer.cpp @@ -31,8 +31,8 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent) : QDialog(parent, QF { diveImportedModel = new DiveImportedModel(this); vendorModel.setStringList(vendorList); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); int startingWidth = defaultModelFont().pointSize(); diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 2ece1975f..1a695eb7a 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -210,8 +210,8 @@ MainWindow::MainWindow() : QMainWindow(), updateManager = new UpdateManager(this); undoAction = Command::undoAction(this); redoAction = Command::redoAction(this); - undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); - redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); + undoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z)); + redoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Z)); ui.menu_Edit->addActions({ undoAction, redoAction }); #ifndef NO_PRINTING @@ -570,8 +570,8 @@ void MainWindow::enableShortcuts() redoAction->setEnabled(true); ui.actionPreviousDC->setShortcut(Qt::Key_Left); ui.actionNextDC->setShortcut(Qt::Key_Right); - ui.copy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); - ui.paste->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); + ui.copy->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C)); + ui.paste->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V)); } void MainWindow::showProfile() @@ -724,9 +724,9 @@ void MainWindow::on_actionYearlyStatistics_triggered() l->addWidget(view); d.resize(lrint(width() * .8), height() / 2); d.move(lrint(width() * .1), height() / 4); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), &d); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), &d); connect(close, SIGNAL(activated()), &d, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), &d); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), &d); connect(quit, SIGNAL(activated()), this, SLOT(close())); d.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint); diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index ddfb331fc..ff6d27655 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -45,9 +45,9 @@ RenumberDialog::RenumberDialog(bool selectedOnlyIn, QWidget *parent) : QDialog(p { ui.setupUi(this); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); if (selectedOnly && amount_selected == 1) @@ -72,9 +72,9 @@ SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDia { ui.setupUi(this); connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, &QShortcut::activated, this, &QDialog::close); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, &QShortcut::activated, MainWindow::instance(), &QWidget::close); } @@ -116,9 +116,9 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent), connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.timeEdit, SIGNAL(timeChanged(const QTime)), this, SLOT(changeTime())); connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(changeTime())); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } @@ -271,9 +271,9 @@ void ShiftImageTimesDialog::backwardsChanged(bool) URLDialog::URLDialog(QWidget *parent) : QDialog(parent) { ui.setupUi(this); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } @@ -317,9 +317,9 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar UI_FROM_COMPONENT(number); UI_FROM_COMPONENT(when); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp index 34efd098e..b66202dbb 100644 --- a/desktop-widgets/subsurfacewebservices.cpp +++ b/desktop-widgets/subsurfacewebservices.cpp @@ -259,9 +259,9 @@ DivelogsDeWebServices::DivelogsDeWebServices(QWidget *parent) : WebServices(pare ui.password->setText(qPrefCloudStorage::divelogde_pass()); ui.saveUidLocal->hide(); hideUpload(); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, SIGNAL(activated()), this, SLOT(close())); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, SIGNAL(activated()), parent, SLOT(close())); } diff --git a/desktop-widgets/tripselectiondialog.cpp b/desktop-widgets/tripselectiondialog.cpp index 5b336b1b8..e7e87c724 100644 --- a/desktop-widgets/tripselectiondialog.cpp +++ b/desktop-widgets/tripselectiondialog.cpp @@ -10,9 +10,9 @@ TripSelectionDialog::TripSelectionDialog(QWidget *parent) : QDialog(parent) ui.setupUi(this); connect(ui.trips, &QListWidget::itemSelectionChanged, this, &TripSelectionDialog::selectionChanged); - QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); + QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this); connect(close, &QShortcut::activated, this, &QDialog::close); - QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); + QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this); connect(quit, &QShortcut::activated, parent, &QWidget::close); // We could use a model, but it seems barely worth the hassle.