mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-01 00:34:01 +02:00
[qt] navigate to transaction history page after send
The transaction will be selected. When sending to multiple destinations, all will be selected (thanks @promag).
This commit is contained in:
@@ -263,8 +263,7 @@ void TransactionView::setModel(WalletModel *_model)
|
||||
|
||||
void TransactionView::chooseDate(int idx)
|
||||
{
|
||||
if(!transactionProxyModel)
|
||||
return;
|
||||
if (!transactionProxyModel) return;
|
||||
QDate current = QDate::currentDate();
|
||||
dateRangeWidget->setVisible(false);
|
||||
switch(dateWidget->itemData(idx).toInt())
|
||||
@@ -592,6 +591,32 @@ void TransactionView::focusTransaction(const QModelIndex &idx)
|
||||
transactionView->setFocus();
|
||||
}
|
||||
|
||||
void TransactionView::focusTransaction(const uint256& txid)
|
||||
{
|
||||
if (!transactionProxyModel)
|
||||
return;
|
||||
|
||||
const QModelIndexList results = this->model->getTransactionTableModel()->match(
|
||||
this->model->getTransactionTableModel()->index(0,0),
|
||||
TransactionTableModel::TxHashRole,
|
||||
QString::fromStdString(txid.ToString()), -1);
|
||||
|
||||
transactionView->setFocus();
|
||||
transactionView->selectionModel()->clearSelection();
|
||||
for (const QModelIndex& index : results) {
|
||||
const QModelIndex targetIndex = transactionProxyModel->mapFromSource(index);
|
||||
transactionView->selectionModel()->select(
|
||||
targetIndex,
|
||||
QItemSelectionModel::Rows | QItemSelectionModel::Select);
|
||||
// Called once per destination to ensure all results are in view, unless
|
||||
// transactions are not ordered by (ascending or descending) date.
|
||||
transactionView->scrollTo(targetIndex);
|
||||
// scrollTo() does not scroll far enough the first time when transactions
|
||||
// are ordered by ascending date.
|
||||
if (index == results[0]) transactionView->scrollTo(targetIndex);
|
||||
}
|
||||
}
|
||||
|
||||
// We override the virtual resizeEvent of the QWidget to adjust tables column
|
||||
// sizes as the tables width is proportional to the dialogs width.
|
||||
void TransactionView::resizeEvent(QResizeEvent* event)
|
||||
|
||||
Reference in New Issue
Block a user