From 8432b10c84b83adcdd75682190a1e73c265b9793 Mon Sep 17 00:00:00 2001 From: Thomas Wilshaw Date: Tue, 19 Oct 2021 14:24:28 +0100 Subject: [PATCH] Improve right click and renaming --- app/widget/marker/marker.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/widget/marker/marker.cpp b/app/widget/marker/marker.cpp index 2ab2b7306..1e3bb1269 100644 --- a/app/widget/marker/marker.cpp +++ b/app/widget/marker/marker.cpp @@ -131,7 +131,14 @@ void Marker::mousePressEvent(QMouseEvent* e) } } -void Marker::ShowContextMenu() { +void Marker::ShowContextMenu() +{ + // Only show context menu if we clicked on the icon and not the label + QRect marker_icon(0, 0, 7, 14); + if (!marker_icon.contains(this->mapFromGlobal(QCursor::pos()))) { + return; + } + Menu m(this); // Color menu @@ -154,7 +161,7 @@ void Marker::ShowContextMenu() { void Marker::Rename() { bool ok; - QString marker_name = QInputDialog::getText(this, tr("Set Marker"), tr("Marker name:"), QLineEdit::Normal, QString(), &ok); + QString marker_name = QInputDialog::getText(this, tr("Set Marker"), tr("Marker name:"), QLineEdit::Normal, name_, &ok); if (ok) { emit NameChanged(marker_name); }