Skip to content

Commit 483cb49

Browse files
hebastoPiRK
authored andcommitted
Add visual accenting for the 'Create new receiving address' button
Summary: > qt: Make "Create new receiving address" default unconditionally > > This change makes this button visually accented, and gives to users a > hint about the primary action. > This commit does not change behavior. > qt: Leverage the default "Create new receiving address" button > > When Enter or Return is pressed the default button will be always > clicked. All buttons can always be clicked from the keyboard by pressing > spacebar when the button has focus. This is basically a simplification of the way pressing return in the "Receive" tab of bitcoin-qt submits the form, doing it the standard Qt way without additional code. This is a backport of [[bitcoin-core/gui#39 | core-gui#39]] Test Plan: `ninja && src/qt/bitcoin-qt` In the Receive tab of the main window, verify that pressing Return still submits the form and creates a new address. Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D10135
1 parent f13fc65 commit 483cb49

File tree

3 files changed

+6
-17
lines changed

3 files changed

+6
-17
lines changed

src/qt/forms/receivecoinsdialog.ui

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@
127127
<iconset resource="../bitcoin.qrc">
128128
<normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset>
129129
</property>
130+
<property name="autoDefault">
131+
<bool>false</bool>
132+
</property>
133+
<property name="default">
134+
<bool>true</bool>
135+
</property>
130136
</widget>
131137
</item>
132138
<item>

src/qt/receivecoinsdialog.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -248,20 +248,6 @@ void ReceiveCoinsDialog::resizeEvent(QResizeEvent *event) {
248248
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
249249
}
250250

251-
void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event) {
252-
if (event->key() == Qt::Key_Return) {
253-
// press return -> submit form
254-
if (ui->reqLabel->hasFocus() || ui->reqAmount->hasFocus() ||
255-
ui->reqMessage->hasFocus()) {
256-
event->ignore();
257-
on_receiveButton_clicked();
258-
return;
259-
}
260-
}
261-
262-
this->QDialog::keyPressEvent(event);
263-
}
264-
265251
QModelIndex ReceiveCoinsDialog::selectedRow() {
266252
if (!model || !model->getRecentRequestsTableModel() ||
267253
!ui->recentRequestsView->selectionModel()) {

src/qt/receivecoinsdialog.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ public Q_SLOTS:
4949
void reject() override;
5050
void accept() override;
5151

52-
protected:
53-
virtual void keyPressEvent(QKeyEvent *event) override;
54-
5552
private:
5653
Ui::ReceiveCoinsDialog *ui;
5754
GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer;

0 commit comments

Comments
 (0)