From d1c014519f25521b583f9098a521d8058898aba2 Mon Sep 17 00:00:00 2001 From: Brian Potchik Date: Sat, 26 Mar 2022 15:36:10 -0400 Subject: Fix context menu in SettingsView. --- ui/clickablelabel.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/clickablelabel.h b/ui/clickablelabel.h index a1116f0b..6b7d8744 100644 --- a/ui/clickablelabel.h +++ b/ui/clickablelabel.h @@ -22,14 +22,20 @@ class BINARYNINJAUIAPI ClickableLabel : public QLabel { Q_OBJECT + bool m_passThroughMousePressEvent = false; + public: ClickableLabel(QWidget* parent = nullptr, const QString& name = "") : QLabel(parent) { setText(name); } + // FIXME: The new UI header in the pane system has some keyboard focus issues; so consuming mousePressEvent seems to resolve them + // Since I can't repro the exact issues this allows the mouse event to pass through when needed. + void passThroughMousePressEvent(bool enable) { m_passThroughMousePressEvent = enable; } + Q_SIGNALS: void clicked(); protected: - void mousePressEvent(QMouseEvent*) override {} + void mousePressEvent(QMouseEvent* event) override { if (m_passThroughMousePressEvent) { QLabel::mousePressEvent(event); } } void mouseReleaseEvent(QMouseEvent* event) override { if (event->button() == Qt::LeftButton) -- cgit v1.3.1