-
Notifications
You must be signed in to change notification settings - Fork 129
qt: Copy txid by clicking bubbles in block view #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 29.x-knots
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,8 @@ | |
| #include <cmath> | ||
| #include <numbers> | ||
|
|
||
| #include <QApplication> | ||
| #include <QClipboard> | ||
| #include <QColor> | ||
| #include <QComboBox> | ||
| #include <QLabel> | ||
|
|
@@ -105,6 +107,28 @@ bool ScalingGraphicsView::viewportEvent(QEvent * const event) | |
| return QGraphicsView::viewportEvent(event); | ||
| } | ||
|
|
||
| void ScalingGraphicsView::mousePressEvent(QMouseEvent * const event) | ||
| { | ||
| if (event->button() == Qt::LeftButton) { | ||
| auto * const gi = itemAt(event->pos()); | ||
| const auto tx = gi ? gi->data(0).value<CTransactionRef>() : CTransactionRef(); | ||
| if (tx) { | ||
| QString txid = QString::fromStdString(tx->GetHash().ToString()); | ||
| QApplication::clipboard()->setText(txid); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should use For reference: |
||
|
|
||
| #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) | ||
| const QPoint event_global_pos = event->globalPosition().toPoint(); | ||
| #else | ||
| const QPoint event_global_pos = event->globalPos(); | ||
| #endif | ||
| QToolTip::showText(event_global_pos, tr("Copied: %1").arg(txid), this, {}, -1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the intended behavior for the Consider using a timed duration (such as 2000ms) for better tooltip timeout UX. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. -1 is default and I tried other values from 2000 to 100000 but they didn't work as expected. |
||
|
|
||
| return; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
| } | ||
| } | ||
| QGraphicsView::mousePressEvent(event); | ||
| } | ||
|
|
||
| class BlockViewValidationInterface final : public CValidationInterface | ||
| { | ||
| private: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left-click behavior is inconsistent with rest of the UI
transactionview.cpp:155uses right-click context menu: "Copy transaction &ID"Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not using bubbles anywhere else in the UI. It is a better UX to just click and copy the transaction id.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only thing is whether there is an indicator for the user to know this functionality exists (click and copy the transaction id).