Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionview.cpp
Show First 20 Lines • Show All 597 Lines • ▼ Show 20 Lines | void TransactionView::focusTransaction(const QModelIndex &idx) { | ||||
} | } | ||||
QModelIndex targetIdx = transactionProxyModel->mapFromSource(idx); | QModelIndex targetIdx = transactionProxyModel->mapFromSource(idx); | ||||
transactionView->scrollTo(targetIdx); | transactionView->scrollTo(targetIdx); | ||||
transactionView->setCurrentIndex(targetIdx); | transactionView->setCurrentIndex(targetIdx); | ||||
transactionView->setFocus(); | 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 | // We override the virtual resizeEvent of the QWidget to adjust tables column | ||||
// sizes as the tables width is proportional to the dialogs width. | // sizes as the tables width is proportional to the dialogs width. | ||||
void TransactionView::resizeEvent(QResizeEvent *event) { | void TransactionView::resizeEvent(QResizeEvent *event) { | ||||
QWidget::resizeEvent(event); | QWidget::resizeEvent(event); | ||||
columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); | columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); | ||||
} | } | ||||
// Need to override default Ctrl+C action for amount as default behaviour is | // Need to override default Ctrl+C action for amount as default behaviour is | ||||
Show All 20 Lines |