From a16d148dfd076c4a9f1367f4eed12912de3ed0b4 Mon Sep 17 00:00:00 2001 From: kornes <28986062+kornes@users.noreply.github.com> Date: Wed, 7 Dec 2022 18:21:04 +0000 Subject: [PATCH] Fix selection clearing not working in Reply window (#4218) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + src/widgets/dialogs/ReplyThreadPopup.cpp | 16 ++++++++++++++++ src/widgets/splits/Split.cpp | 9 +++++++++ src/widgets/splits/SplitInput.cpp | 4 ++-- src/widgets/splits/SplitInput.hpp | 1 + 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72c9c49f1..0ede644f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Bugfix: Fixed CTRL + C not working in reply thread popups. (#4209) - Bugfix: Fixed message input showing as red after removing a message that was more than 500 characters. (#4204) - Bugfix: Fixed unnecessary saving of windows layout. (#4201) +- Bugfix: Fixed Reply window missing selection clear behaviour between chat and input box. (#4218) - Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) ## 2.4.0 diff --git a/src/widgets/dialogs/ReplyThreadPopup.cpp b/src/widgets/dialogs/ReplyThreadPopup.cpp index 59fe4a5c5..c6cb92f39 100644 --- a/src/widgets/dialogs/ReplyThreadPopup.cpp +++ b/src/widgets/dialogs/ReplyThreadPopup.cpp @@ -89,6 +89,22 @@ ReplyThreadPopup::ReplyThreadPopup(bool closeAutomatically, QWidget *parent, this->updateInputUI(); })); + // clear SplitInput selection when selecting in ChannelView + this->ui_.threadView->selectionChanged.connect([this]() { + if (this->ui_.replyInput->hasSelection()) + { + this->ui_.replyInput->clearSelection(); + } + }); + + // clear ChannelView selection when selecting in SplitInput + this->ui_.replyInput->selectionChanged.connect([this]() { + if (this->ui_.threadView->hasSelection()) + { + this->ui_.threadView->clearSelection(); + } + }); + layout->setSpacing(0); // provide draggable margin if frameless auto marginPx = closeAutomatically ? 15 : 1; diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 4c218ac52..7258b92ce 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -115,6 +115,7 @@ Split::Split(QWidget *parent) }); this->updateInputPlaceholder(); + // clear SplitInput selection when selecting in ChannelView this->view_->selectionChanged.connect([this]() { if (this->input_->hasSelection()) { @@ -122,6 +123,14 @@ Split::Split(QWidget *parent) } }); + // clear ChannelView selection when selecting in SplitInput + this->input_->selectionChanged.connect([this]() { + if (this->view_->hasSelection()) + { + this->view_->clearSelection(); + } + }); + this->view_->openChannelIn.connect([this]( QString twitchChannel, FromTwitchLinkOpenChannelIn openIn) { diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 9c5b5ee40..c2bd517aa 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -155,12 +155,12 @@ void SplitInput::initLayout() this->clearInput(); }); - // clear channelview selection when selecting in the input + // Forward selection change signal QObject::connect(this->ui_.textEdit, &QTextEdit::copyAvailable, [this](bool available) { if (available) { - this->split_->view_->clearSelection(); + this->selectionChanged.invoke(); } }); diff --git a/src/widgets/splits/SplitInput.hpp b/src/widgets/splits/SplitInput.hpp index 81a6b8afe..23d6a4a80 100644 --- a/src/widgets/splits/SplitInput.hpp +++ b/src/widgets/splits/SplitInput.hpp @@ -81,6 +81,7 @@ public: bool isHidden() const; pajlada::Signals::Signal textChanged; + pajlada::Signals::NoArgSignal selectionChanged; protected: void scaleChangedEvent(float scale_) override;