diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-12-04 14:14:10 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2011-12-23 12:07:23 +0100 |
commit | c58e7d4e013f21e38fb1501d896d32e8407a9c3c (patch) | |
tree | 8e24786b335c0316bb9929864407b9fa7303c98a /src/qt/guiutil.cpp | |
parent | c4a4a4b886b3bd8933cf96c0d66d647a2b32a68b (diff) |
Copy amount to clipboard (implements #657)
- Also, unify similar code related to copying transaction fields to clipboard
Diffstat (limited to 'src/qt/guiutil.cpp')
-rw-r--r-- | src/qt/guiutil.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index f72fe1ef4b..22d9cc7384 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -12,6 +12,9 @@ #include <QLineEdit> #include <QUrl> #include <QTextDocument> // For Qt::escape +#include <QAbstractItemView> +#include <QApplication> +#include <QClipboard> QString GUIUtil::dateTimeStr(qint64 nTime) { @@ -88,3 +91,16 @@ QString GUIUtil::HtmlEscape(const std::string& str, bool fMultiLine) { return HtmlEscape(QString::fromStdString(str), fMultiLine); } + +void GUIUtil::copyEntryData(QAbstractItemView *view, int column, int role) +{ + if(!view || !view->selectionModel()) + return; + QModelIndexList selection = view->selectionModel()->selectedRows(column); + + if(!selection.isEmpty()) + { + // Copy first item + QApplication::clipboard()->setText(selection.at(0).data(role).toString()); + } +} |