Skip to content

Commit 0f9f79d

Browse files
committed
Suppress the crash when opening the context menu on a text field in the chart editor
1 parent ad7dc6a commit 0f9f79d

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

qrgui/editor/labels/label.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,13 @@ bool Label::isReadOnly() const
350350
return mProperties->isReadOnly();
351351
}
352352

353+
void Label::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
354+
{
355+
// TODO: https://qt-project.atlassian.net/browse/QTBUG-88309#icft=QTBUG-88309
356+
// Just remove this Label::contextMenuEvent override when upgrading to Qt >= 5.15.3
357+
event->accept();
358+
}
359+
353360
void Label::focusOutEvent(QFocusEvent *event)
354361
{
355362
if (event->reason() != Qt::PopupFocusReason) {

qrgui/editor/labels/label.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Label : public QGraphicsTextItem, public LabelInterface
7979
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
8080
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
8181
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
82-
82+
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
8383
void focusOutEvent(QFocusEvent *event) override;
8484
void keyPressEvent(QKeyEvent *event) override;
8585

0 commit comments

Comments
 (0)