mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-05 05:14:51 +02:00
Merge bitcoin-core/gui#281: set shortcuts for console's resize buttons
2a45134b56qt: Add shortcuts for console font resize buttons (Hennadii Stepanov)a2e122f0feqt: Add GUIUtil::AddButtonShortcut (Hennadii Stepanov)4ee9ee7236qt: Use native presentation of shortcut (Hennadii Stepanov) Pull request description: On `master` the only way to resize the console font is to manually move your mouse and click the resize buttons. This PR introduces convenient keyboard shortcuts to resize the console font. The common resize shortcuts for applications are `Ctrl+=`/`Ctrl++` and `Ctrl+-`/`Ctrl+_`. This means that the resize QPushButtons need two shortcuts each, but you cannot assign multiple shortcuts to a QPushButton. See: https://doc.qt.io/qt-5/qabstractbutton.html#shortcut-prop To get around this, we introduce a new function in `guiutil`, which connects a supplied `QKeySequence` shortcut to a `QAbstractButton`. This function can be reused in other situations where more than one shortcut is needed for a button. | PR on macOS | PR on Linux | | ---------------- | ------------ | |  |  | ACKs for top commit: hebasto: re-ACK2a45134b56Talkless: tACK2a45134b56, tested on Debian Sid with Qt 5.15.2, shortcuts still work. Tree-SHA512: e894ccb7e5c695ba83998c21a474d6c587c9c849f12ced665c5e0034feb6b143e41b32ba135cab6cfab22cbf153d5a52b1083b2a278e6dfca3f5ad14c0f6c573
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include <shlwapi.h>
|
||||
#endif
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QAbstractItemView>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
@@ -121,6 +122,11 @@ void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent)
|
||||
widget->setCheckValidator(new BitcoinAddressCheckValidator(parent));
|
||||
}
|
||||
|
||||
void AddButtonShortcut(QAbstractButton* button, const QKeySequence& shortcut)
|
||||
{
|
||||
QObject::connect(new QShortcut(shortcut, button), &QShortcut::activated, [button]() { button->animateClick(); });
|
||||
}
|
||||
|
||||
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
{
|
||||
// return if URI is not valid or is no bitcoin: URI
|
||||
|
||||
Reference in New Issue
Block a user