Skip to content

Commit

Permalink
merge bitcoin#24624: Avoid potential -Wdeprecated-enum-enum-conversio…
Browse files Browse the repository at this point in the history
…n warnings
  • Loading branch information
kwvg committed Apr 23, 2024
1 parent 65585e6 commit 3265b54
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <QComboBox>
#include <QDateTime>
#include <QDragEnterEvent>
#include <QKeySequence>
#include <QListWidget>
#include <QMenu>
#include <QMenuBar>
Expand Down Expand Up @@ -373,7 +374,7 @@ void BitcoinGUI::createActions()

quitAction = new QAction(tr("E&xit"), this);
quitAction->setStatusTip(tr("Quit application"));
quitAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
quitAction->setShortcut(QKeySequence(tr("Ctrl+Q")));
quitAction->setMenuRole(QAction::QuitRole);
aboutAction = new QAction(tr("&About %1").arg(PACKAGE_NAME), this);
aboutAction->setStatusTip(tr("Show information about %1").arg(PACKAGE_NAME));
Expand Down Expand Up @@ -463,7 +464,7 @@ void BitcoinGUI::createActions()
showCoinJoinHelpAction->setStatusTip(tr("Show the %1 basic information").arg(strCoinJoinName));

m_mask_values_action = new QAction(tr("&Discreet mode"), this);
m_mask_values_action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D));
m_mask_values_action->setShortcut(QKeySequence(tr("Ctrl+Shift+D")));
m_mask_values_action->setStatusTip(tr("Mask the values in the Overview tab"));
m_mask_values_action->setCheckable(true);

Expand Down Expand Up @@ -606,7 +607,7 @@ void BitcoinGUI::createMenuBar()
QMenu* window_menu = appMenuBar->addMenu(tr("&Window"));

QAction* minimize_action = window_menu->addAction(tr("Minimize"));
minimize_action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
minimize_action->setShortcut(QKeySequence(tr("Ctrl+M")));
connect(minimize_action, &QAction::triggered, [] {
QApplication::activeWindow()->showMinimized();
});
Expand Down
5 changes: 3 additions & 2 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
#include <QGuiApplication>
#include <QJsonObject>
#include <QKeyEvent>
#include <QKeySequence>
#include <QLatin1String>
#include <QLineEdit>
#include <QList>
Expand Down Expand Up @@ -613,7 +614,7 @@ void bringToFront(QWidget* w)

void handleCloseWindowShortcut(QWidget* w)
{
QObject::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), w), &QShortcut::activated, w, &QWidget::close);
QObject::connect(new QShortcut(QKeySequence(QObject::tr("Ctrl+W")), w), &QShortcut::activated, w, &QWidget::close);
}

void openDebugLogfile()
Expand Down Expand Up @@ -1618,7 +1619,7 @@ void updateButtonGroupShortcuts(QButtonGroup* buttonGroup)
int nKey = 0;
for (auto button : buttonGroup->buttons()) {
if (button->isVisible()) {
button->setShortcut(QKeySequence(modifier + Qt::Key_1 + nKey++));
button->setShortcut(QKeySequence(static_cast<int>(modifier) | static_cast<int>(Qt::Key_1) | nKey++));
} else {
button->setShortcut(QKeySequence());
}
Expand Down
11 changes: 6 additions & 5 deletions src/qt/rpcconsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include <QFontDatabase>
#include <QDateTime>
#include <QKeyEvent>
#include <QKeySequence>
#include <QMenu>
#include <QMessageBox>
#include <QScreen>
Expand Down Expand Up @@ -1459,11 +1460,11 @@ QString RPCConsole::tabTitle(TabTypes tab_type) const
QKeySequence RPCConsole::tabShortcut(TabTypes tab_type) const
{
switch (tab_type) {
case TabTypes::INFO: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I);
case TabTypes::CONSOLE: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C);
case TabTypes::GRAPH: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_G);
case TabTypes::PEERS: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_P);
case TabTypes::REPAIR: return QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R);
case TabTypes::INFO: return QKeySequence(tr("Ctrl+Shift+I"));
case TabTypes::CONSOLE: return QKeySequence(tr("Ctrl+Shift+C"));
case TabTypes::GRAPH: return QKeySequence(tr("Ctrl+Shift+G"));
case TabTypes::PEERS: return QKeySequence(tr("Ctrl+Shift+P"));
case TabTypes::REPAIR: return QKeySequence(tr("Ctrl+Shift+R"));
} // no default case, so the compiler can warn about missing cases

assert(false);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactionview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ QWidget *TransactionView::createDateRangeWidget()
QSettings settings;

dateRangeWidget = new QFrame();
dateRangeWidget->setFrameStyle(QFrame::Panel | QFrame::Raised);
dateRangeWidget->setFrameStyle(static_cast<int>(QFrame::Panel) | static_cast<int>(QFrame::Raised));
dateRangeWidget->setContentsMargins(1,1,1,1);
QHBoxLayout *layout = new QHBoxLayout(dateRangeWidget);
layout->setContentsMargins(0,0,0,0);
Expand Down

0 comments on commit 3265b54

Please sign in to comment.