marker: create color menu on the stack

This commit is contained in:
Thomas Wilshaw
2021-10-22 22:15:49 +01:00
parent 9a2b669c9f
commit 6fdfcb38d7
2 changed files with 4 additions and 5 deletions
+4 -4
View File
@@ -38,9 +38,6 @@ Marker::Marker(QWidget *parent) :
setContextMenuPolicy(Qt::CustomContextMenu);
connect(this, &Marker::customContextMenuRequested, this, &Marker::ShowContextMenu);
color_coding_menu_ = new ColorLabelMenu();
connect(color_coding_menu_, &ColorLabelMenu::ColorSelected, this, &Marker::SetColor);
}
void Marker::paintEvent(QPaintEvent *event)
@@ -85,7 +82,10 @@ void Marker::paintEvent(QPaintEvent *event)
void Marker::ShowContextMenu() {
Menu m(this);
m.addMenu(color_coding_menu_);
// Color menu
ColorLabelMenu color_coding_menu;
connect(&color_coding_menu, &ColorLabelMenu::ColorSelected, this, &Marker::SetColor);
m.addMenu(&color_coding_menu);
m.exec(QCursor::pos());
}
-1
View File
@@ -44,7 +44,6 @@ class Marker : public QWidget {
//void MouseDoubleClicked();
private:
ColorLabelMenu* color_coding_menu_;
int marker_color_;