Click onion address in status bar to copy to clipboard

Shows "Copied!" tooltip on click. Changed cursor to pointing hand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 22:59:22 -07:00
parent 97dbc13b62
commit 9acff4bb43
2 changed files with 18 additions and 4 deletions
+3 -3
View File
@@ -1422,16 +1422,16 @@ QLabel {
</font>
</property>
<property name="cursor">
<cursorShape>IBeamCursor</cursorShape>
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>This wallet's Tor .onion address</string>
<string>Click to copy .onion address</string>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="textInteractionFlags">
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
<set>Qt::NoTextInteraction</set>
</property>
</widget>
</item>
+15 -1
View File
@@ -68,6 +68,8 @@
#include <QFileDialog>
#include <QStandardPaths>
#include <QTimer>
#include <QClipboard>
#include <QToolTip>
#include <QDragEnterEvent>
#if QT_VERSION < 0x050000
#include <QUrl>
@@ -338,9 +340,11 @@ TrianglesGUI::TrianglesGUI(bool fIsTestnet, QWidget *parent):
updateStakingIcon();
}
// Onion address in status bar (hidden until populated)
// Onion address in status bar (hidden until populated, click to copy)
labelOnionAddress = ui->label_onion;
labelOnionAddress->setVisible(false);
labelOnionAddress->setCursor(Qt::PointingHandCursor);
labelOnionAddress->installEventFilter(this);
// V3 indicator next to staking icon (hidden until onion is active)
labelV3Icon = ui->label_v3;
@@ -1307,6 +1311,16 @@ bool TrianglesGUI::eventFilter(QObject *object, QEvent *event)
}
if (object == ui->pushButton_Overview && event->type() == QEvent::MouseButtonPress)
gotoOverviewPage();
if (object == labelOnionAddress && event->type() == QEvent::MouseButtonPress)
{
QString addr = labelOnionAddress->text();
if (!addr.isEmpty())
{
QApplication::clipboard()->setText(addr);
QToolTip::showText(QCursor::pos(), tr("Copied!"), labelOnionAddress);
}
return true;
}
return QMainWindow::eventFilter(object, event);
}