diff options
Diffstat (limited to 'src/qt/transactionview.cpp')
-rw-r--r-- | src/qt/transactionview.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index d4d29416ca..98914fc2d0 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -123,6 +123,8 @@ TransactionView::TransactionView(QWidget *parent) : view->setTabKeyNavigation(false); view->setContextMenuPolicy(Qt::CustomContextMenu); + view->installEventFilter(this); + transactionView = view; // Actions @@ -480,3 +482,22 @@ void TransactionView::resizeEvent(QResizeEvent* event) QWidget::resizeEvent(event); columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); } + +// Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text +bool TransactionView::eventFilter(QObject *obj, QEvent *event) +{ + if (event->type() == QEvent::KeyPress) + { + QKeyEvent *ke = static_cast<QKeyEvent *>(event); + if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier)) + { + QModelIndex i = this->transactionView->currentIndex(); + if (i.isValid() && i.column() == TransactionTableModel::Amount) + { + GUIUtil::setClipboard(i.data(TransactionTableModel::FormattedAmountRole).toString()); + return true; + } + } + } + return QWidget::eventFilter(obj, event); +} |