mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 20:03:34 -03:00
qt: Add GUIUtil::AddButtonShortcut
Co-authored-by: Jarol Rodriguez <jarolrod@tutanota.com>
This commit is contained in:
parent
4ee9ee7236
commit
a2e122f0fe
2 changed files with 16 additions and 0 deletions
|
@ -29,6 +29,7 @@
|
|||
#include <shlwapi.h>
|
||||
#endif
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QAbstractItemView>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
|
@ -119,6 +120,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
|
||||
|
|
|
@ -31,10 +31,12 @@ namespace interfaces
|
|||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractButton;
|
||||
class QAbstractItemView;
|
||||
class QAction;
|
||||
class QDateTime;
|
||||
class QFont;
|
||||
class QKeySequence;
|
||||
class QLineEdit;
|
||||
class QMenu;
|
||||
class QPoint;
|
||||
|
@ -60,6 +62,14 @@ namespace GUIUtil
|
|||
// Set up widget for address
|
||||
void setupAddressWidget(QValidatedLineEdit *widget, QWidget *parent);
|
||||
|
||||
/**
|
||||
* Connects an additional shortcut to a QAbstractButton. Works around the
|
||||
* one shortcut limitation of the button's shortcut property.
|
||||
* @param[in] button QAbstractButton to assign shortcut to
|
||||
* @param[in] shortcut QKeySequence to use as shortcut
|
||||
*/
|
||||
void AddButtonShortcut(QAbstractButton* button, const QKeySequence& shortcut);
|
||||
|
||||
// Parse "bitcoin:" URI into recipient object, return true on successful parsing
|
||||
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out);
|
||||
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out);
|
||||
|
|
Loading…
Reference in a new issue