From 254f89f935804e4f4decad7e06798a99c3c82b5b Mon Sep 17 00:00:00 2001 From: nerix Date: Mon, 21 Nov 2022 19:27:56 +0100 Subject: [PATCH] fix: don't ignore `mousePressEvent` in `SplitInput` (#4177) Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com> Co-authored-by: pajlada Fixes https://github.com/Chatterino/chatterino2/issues/3844 --- CHANGELOG.md | 1 + src/widgets/splits/SplitInput.cpp | 10 ++++++++++ src/widgets/splits/SplitInput.hpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fbe436bb8..3777a74ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Unversioned - Bugfix: Fixed being unable to see the usercard of VIPs who have Asian language display names. (#4174) +- Bugfix: Fixed the wrong right-click menu showing in the chat input box. (#4177) ## 2.4.0-beta diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index cfc5a3fd9..053d75911 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -648,6 +648,16 @@ void SplitInput::installKeyPressedEvent() }); } +void SplitInput::mousePressEvent(QMouseEvent *event) +{ + if (this->hidden) + { + BaseWidget::mousePressEvent(event); + } + // else, don't call QWidget::mousePressEvent, + // which will call event->ignore() +} + void SplitInput::onTextChanged() { this->updateCompletionPopup(); diff --git a/src/widgets/splits/SplitInput.hpp b/src/widgets/splits/SplitInput.hpp index 164d8de1b..1cba4140b 100644 --- a/src/widgets/splits/SplitInput.hpp +++ b/src/widgets/splits/SplitInput.hpp @@ -87,6 +87,8 @@ protected: void paintEvent(QPaintEvent * /*event*/) override; void resizeEvent(QResizeEvent * /*event*/) override; + void mousePressEvent(QMouseEvent *event) override; + virtual void giveFocus(Qt::FocusReason reason); QString handleSendMessage(std::vector &arguments);