From 3df0786fb0a73b589bd5b1cd231b9f93762d8f69 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Sun, 11 Oct 2020 17:23:13 +0200 Subject: [PATCH] Receive: always copy full address --- src/model/SubaddressView.cpp | 20 ++++++++++++++++++++ src/model/SubaddressView.h | 19 +++++++++++++++++++ src/receivewidget.ui | 7 ++++++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/model/SubaddressView.cpp create mode 100644 src/model/SubaddressView.h diff --git a/src/model/SubaddressView.cpp b/src/model/SubaddressView.cpp new file mode 100644 index 0000000..21203ef --- /dev/null +++ b/src/model/SubaddressView.cpp @@ -0,0 +1,20 @@ +#include "SubaddressView.h" + +#include "model/ModelUtils.h" + +SubaddressView::SubaddressView(QWidget *parent) : QTreeView(parent) { + +} + +void SubaddressView::keyPressEvent(QKeyEvent *event){ + QModelIndexList selectedRows = selectionModel()->selectedRows(); + + if(!selectedIndexes().isEmpty()){ + if(event->matches(QKeySequence::Copy)){ + QModelIndex index = this->currentIndex(); + ModelUtils::copyColumn(&index, index.column()); + } + else + QTreeView::keyPressEvent(event); + } +} diff --git a/src/model/SubaddressView.h b/src/model/SubaddressView.h new file mode 100644 index 0000000..e36d0ee --- /dev/null +++ b/src/model/SubaddressView.h @@ -0,0 +1,19 @@ +#ifndef FEATHER_SUBADDRESSVIEW_H +#define FEATHER_SUBADDRESSVIEW_H + +#include +#include +#include +#include + +class SubaddressView : public QTreeView +{ + +public: + SubaddressView(QWidget* parent = nullptr); + +protected: + void keyPressEvent(QKeyEvent *event); +}; + +#endif //FEATHER_SUBADDRESSVIEW_H diff --git a/src/receivewidget.ui b/src/receivewidget.ui index 4061f43..eaa3b37 100644 --- a/src/receivewidget.ui +++ b/src/receivewidget.ui @@ -42,7 +42,7 @@ - + Qt::ScrollBarAsNeeded @@ -101,6 +101,11 @@ QLabel
components.h
+ + SubaddressView + QTreeView +
model/SubaddressView.h
+