File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 263
263
<property name =" text" >
264
264
<string >Show</string >
265
265
</property >
266
+ <property name =" enabled" >
267
+ <bool >false</bool >
268
+ </property >
266
269
<property name =" icon" >
267
270
<iconset resource =" ../bitcoin.qrc" >
268
271
<normaloff >:/icons/edit</normaloff >:/icons/edit</iconset >
277
280
<property name =" text" >
278
281
<string >Remove</string >
279
282
</property >
283
+ <property name =" enabled" >
284
+ <bool >false</bool >
285
+ </property >
280
286
<property name =" icon" >
281
287
<iconset resource =" ../bitcoin.qrc" >
282
288
<normaloff >:/icons/remove</normaloff >:/icons/remove</iconset >
Original file line number Diff line number Diff line change 19
19
#include < QMessageBox>
20
20
#include < QTextDocument>
21
21
#include < QScrollBar>
22
+ #include < QItemSelection>
22
23
23
24
ReceiveCoinsDialog::ReceiveCoinsDialog (QWidget *parent) :
24
25
QDialog(parent),
@@ -77,6 +78,11 @@ void ReceiveCoinsDialog::setModel(WalletModel *model)
77
78
ui->recentRequestsView ->horizontalHeader ()->resizeSection (RecentRequestsTableModel::Amount, 100 );
78
79
79
80
model->getRecentRequestsTableModel ()->sort (RecentRequestsTableModel::Date, Qt::DescendingOrder);
81
+
82
+ connect (ui->recentRequestsView ->selectionModel (),
83
+ SIGNAL (selectionChanged (QItemSelection, QItemSelection)),
84
+ this ,
85
+ SLOT (on_recentRequestsView_selectionChanged (QItemSelection, QItemSelection)));
80
86
}
81
87
}
82
88
@@ -161,6 +167,15 @@ void ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex &
161
167
dialog->show ();
162
168
}
163
169
170
+ void ReceiveCoinsDialog::on_recentRequestsView_selectionChanged (const QItemSelection &selected,
171
+ const QItemSelection &deselected)
172
+ {
173
+ // Enable Show/Remove buttons only if anything is selected.
174
+ bool enable = !ui->recentRequestsView ->selectionModel ()->selectedRows ().isEmpty ();
175
+ ui->showRequestButton ->setEnabled (enable);
176
+ ui->removeRequestButton ->setEnabled (enable);
177
+ }
178
+
164
179
void ReceiveCoinsDialog::on_showRequestButton_clicked ()
165
180
{
166
181
if (!model || !model->getRecentRequestsTableModel () || !ui->recentRequestsView ->selectionModel ())
Original file line number Diff line number Diff line change 10
10
#include < QMenu>
11
11
#include < QPoint>
12
12
#include < QVariant>
13
+ #include < QItemSelection>
13
14
14
15
namespace Ui {
15
16
class ReceiveCoinsDialog ;
@@ -51,6 +52,7 @@ private slots:
51
52
void on_showRequestButton_clicked ();
52
53
void on_removeRequestButton_clicked ();
53
54
void on_recentRequestsView_doubleClicked (const QModelIndex &index);
55
+ void on_recentRequestsView_selectionChanged (const QItemSelection &, const QItemSelection &);
54
56
void updateDisplayUnit ();
55
57
void showMenu (const QPoint &);
56
58
void copyLabel ();
You can’t perform that action at this time.
0 commit comments