mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
gui: Add close window shortcut
CMD+W/CTRL+W is the standard shortcut to close a window without exiting the program.
This commit is contained in:
parent
a064e005fa
commit
f5a3a5b9ab
15 changed files with 41 additions and 0 deletions
|
@ -136,6 +136,8 @@ AddressBookPage::AddressBookPage(const PlatformStyle *platformStyle, Mode _mode,
|
|||
connect(ui->tableView, &QWidget::customContextMenuRequested, this, &AddressBookPage::contextualMenu);
|
||||
|
||||
connect(ui->closeButton, &QPushButton::clicked, this, &QDialog::accept);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
AddressBookPage::~AddressBookPage()
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <qt/forms/ui_askpassphrasedialog.h>
|
||||
|
||||
#include <qt/guiconstants.h>
|
||||
#include <qt/guiutil.h>
|
||||
#include <qt/walletmodel.h>
|
||||
|
||||
#include <support/allocators/secure.h>
|
||||
|
@ -75,6 +76,8 @@ AskPassphraseDialog::AskPassphraseDialog(Mode _mode, QWidget *parent, SecureStri
|
|||
connect(ui->passEdit1, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged);
|
||||
connect(ui->passEdit2, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged);
|
||||
connect(ui->passEdit3, &QLineEdit::textChanged, this, &AskPassphraseDialog::textChanged);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
AskPassphraseDialog::~AskPassphraseDialog()
|
||||
|
|
|
@ -211,6 +211,8 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||
#ifdef Q_OS_MAC
|
||||
m_app_nap_inhibitor = new CAppNapInhibitor;
|
||||
#endif
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
BitcoinGUI::~BitcoinGUI()
|
||||
|
|
|
@ -134,6 +134,8 @@ CoinControlDialog::CoinControlDialog(const PlatformStyle *_platformStyle, QWidge
|
|||
ui->radioTreeMode->click();
|
||||
if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder"))
|
||||
sortView(settings.value("nCoinControlSortColumn").toInt(), (static_cast<Qt::SortOrder>(settings.value("nCoinControlSortOrder").toInt())));
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
CoinControlDialog::~CoinControlDialog()
|
||||
|
|
|
@ -43,6 +43,8 @@ EditAddressDialog::EditAddressDialog(Mode _mode, QWidget *parent) :
|
|||
GUIUtil::ItemDelegate* delegate = new GUIUtil::ItemDelegate(mapper);
|
||||
connect(delegate, &GUIUtil::ItemDelegate::keyEscapePressed, this, &EditAddressDialog::reject);
|
||||
mapper->setItemDelegate(delegate);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
EditAddressDialog::~EditAddressDialog()
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include <QSettings>
|
||||
#include <QSize>
|
||||
#include <QString>
|
||||
#include <QShortcut>
|
||||
#include <QTextDocument> // for Qt::mightBeRichText
|
||||
#include <QThread>
|
||||
#include <QUrlQuery>
|
||||
|
@ -378,6 +379,11 @@ void bringToFront(QWidget* w)
|
|||
}
|
||||
}
|
||||
|
||||
void handleCloseWindowShortcut(QWidget* w)
|
||||
{
|
||||
QObject::connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), w), &QShortcut::activated, w, &QWidget::close);
|
||||
}
|
||||
|
||||
void openDebugLogfile()
|
||||
{
|
||||
fs::path pathDebug = GetDataDir() / "debug.log";
|
||||
|
|
|
@ -124,6 +124,9 @@ namespace GUIUtil
|
|||
// Activate, show and raise the widget
|
||||
void bringToFront(QWidget* w);
|
||||
|
||||
// Set shortcut to close window
|
||||
void handleCloseWindowShortcut(QWidget* w);
|
||||
|
||||
// Open debug.log
|
||||
void openDebugLogfile();
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@ OpenURIDialog::OpenURIDialog(QWidget *parent) :
|
|||
ui(new Ui::OpenURIDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
OpenURIDialog::~OpenURIDialog()
|
||||
|
|
|
@ -135,6 +135,8 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
|
|||
ui->minimizeToTray->setChecked(false);
|
||||
ui->minimizeToTray->setEnabled(false);
|
||||
}
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
OptionsDialog::~OptionsDialog()
|
||||
|
|
|
@ -30,6 +30,8 @@ ReceiveRequestDialog::ReceiveRequestDialog(QWidget *parent) :
|
|||
#endif
|
||||
|
||||
connect(ui->btnSaveAs, &QPushButton::clicked, ui->lblQRCode, &QRImageWidget::saveImage);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
ReceiveRequestDialog::~ReceiveRequestDialog()
|
||||
|
|
|
@ -498,6 +498,8 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
|
|||
|
||||
consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt();
|
||||
clear();
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
RPCConsole::~RPCConsole()
|
||||
|
|
|
@ -47,6 +47,8 @@ SignVerifyMessageDialog::SignVerifyMessageDialog(const PlatformStyle *_platformS
|
|||
|
||||
ui->signatureOut_SM->setFont(GUIUtil::fixedPitchFont());
|
||||
ui->signatureIn_VM->setFont(GUIUtil::fixedPitchFont());
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
SignVerifyMessageDialog::~SignVerifyMessageDialog()
|
||||
|
|
|
@ -127,6 +127,8 @@ SplashScreen::SplashScreen(interfaces::Node& node, Qt::WindowFlags f, const Netw
|
|||
|
||||
subscribeToCoreSignals();
|
||||
installEventFilter(this);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
SplashScreen::~SplashScreen()
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <qt/transactiondescdialog.h>
|
||||
#include <qt/forms/ui_transactiondescdialog.h>
|
||||
|
||||
#include <qt/guiutil.h>
|
||||
#include <qt/transactiontablemodel.h>
|
||||
|
||||
#include <QModelIndex>
|
||||
|
@ -17,6 +18,8 @@ TransactionDescDialog::TransactionDescDialog(const QModelIndex &idx, QWidget *pa
|
|||
setWindowTitle(tr("Details for %1").arg(idx.data(TransactionTableModel::TxHashRole).toString()));
|
||||
QString desc = idx.data(TransactionTableModel::LongDescriptionRole).toString();
|
||||
ui->detailText->setHtml(desc);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
TransactionDescDialog::~TransactionDescDialog()
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <qt/forms/ui_helpmessagedialog.h>
|
||||
|
||||
#include <qt/guiutil.h>
|
||||
|
||||
#include <clientversion.h>
|
||||
#include <init.h>
|
||||
#include <util/system.h>
|
||||
|
@ -102,6 +104,8 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bo
|
|||
ui->scrollArea->setVisible(false);
|
||||
ui->aboutLogo->setVisible(false);
|
||||
}
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
HelpMessageDialog::~HelpMessageDialog()
|
||||
|
@ -141,6 +145,8 @@ ShutdownWindow::ShutdownWindow(QWidget *parent, Qt::WindowFlags f):
|
|||
tr("%1 is shutting down...").arg(PACKAGE_NAME) + "<br /><br />" +
|
||||
tr("Do not shut down the computer until this window disappears.")));
|
||||
setLayout(layout);
|
||||
|
||||
GUIUtil::handleCloseWindowShortcut(this);
|
||||
}
|
||||
|
||||
QWidget* ShutdownWindow::showShutdownWindow(QMainWindow* window)
|
||||
|
|
Loading…
Reference in a new issue