Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/qt/blockview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <cmath>
#include <numbers>

#include <QApplication>
#include <QClipboard>
#include <QColor>
#include <QComboBox>
#include <QLabel>
Expand Down Expand Up @@ -105,6 +107,28 @@ bool ScalingGraphicsView::viewportEvent(QEvent * const event)
return QGraphicsView::viewportEvent(event);
}

void ScalingGraphicsView::mousePressEvent(QMouseEvent * const event)

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

  • For reference, transactionview.cpp:155 uses right-click context menu: "Copy transaction &ID"
  • @luke-jr suggestion about existing UX patterns
    • (right-click for actions, left-click for selection)

Copy link
Author

@1440000bytes 1440000bytes Oct 18, 2025

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.

Copy link

@kwsantiago kwsantiago Oct 18, 2025

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).

{
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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use GUIUtil::setClipboard() instead of direct clipboard access using the helper in guiutil.cpp:904 since this current implementation doesn't support X11 Selection clipboard (the helper handles both modes)

For reference: transactionview.cpp:467 uses GUIUtil::copyEntryData() which calls setClipboard()


#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);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the intended behavior for the -1 value? Permanent until mouse moves?

Consider using a timed duration (such as 2000ms) for better tooltip timeout UX.

Copy link
Author

@1440000bytes 1440000bytes Oct 18, 2025

Choose a reason for hiding this comment

The 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.

https://doc.qt.io/archives/qt-5.15/qtooltip.html#showText-2


return;
Copy link

@kwsantiago kwsantiago Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return skips QGraphicsView::mousePressEvent(event) (line 107) which could break panning/selection/other interactions when clicking on the transaction bubbles. Consider only returning if you don't want other mouse handling.

}
}
QGraphicsView::mousePressEvent(event);
}

class BlockViewValidationInterface final : public CValidationInterface
{
private:
Expand Down
1 change: 1 addition & 0 deletions src/qt/blockview.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class ScalingGraphicsView : public QGraphicsView
void mouseMoveEvent(QMouseEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
bool viewportEvent(QEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;

GuiBlockView *m_bv;
};
Expand Down