Improve right click and renaming

This commit is contained in:
Thomas Wilshaw
2021-10-22 22:15:54 +01:00
parent f3e025c729
commit 8432b10c84
+9 -2
View File
@@ -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);
}