diff --git a/src/widgets/channelview.cpp b/src/widgets/channelview.cpp index 7d5c9257f..c0b93387f 100644 --- a/src/widgets/channelview.cpp +++ b/src/widgets/channelview.cpp @@ -681,6 +681,8 @@ void ChannelView::mousePressEvent(QMouseEvent *event) QPoint relativePos; int messageIndex; + this->mouseDown(event); + if (!tryGetMessageAt(event->pos(), message, relativePos, messageIndex)) { setCursor(Qt::ArrowCursor); diff --git a/src/widgets/channelview.hpp b/src/widgets/channelview.hpp index 0f760243d..a98405920 100644 --- a/src/widgets/channelview.hpp +++ b/src/widgets/channelview.hpp @@ -96,6 +96,8 @@ public: void clearMessages(); + boost::signals2::signal mouseDown; + protected: virtual void resizeEvent(QResizeEvent *) override; diff --git a/src/widgets/chatwidget.cpp b/src/widgets/chatwidget.cpp index bea488dae..3d2622043 100644 --- a/src/widgets/chatwidget.cpp +++ b/src/widgets/chatwidget.cpp @@ -82,9 +82,7 @@ ChatWidget::ChatWidget(ChannelManager &_channelManager, NotebookPage *parent) this->input.textInput.installEventFilter(parent); - connect(&view, &this->view.mousePressEvent, this, [&](QMouseEvent *) { - QTimer::singleShot(10, [this] { this->giveFocus(Qt::MouseFocusReason); }); - }); + this->view.mouseDown.connect([this](QMouseEvent *) { this->giveFocus(Qt::MouseFocusReason); }); } ChatWidget::~ChatWidget() diff --git a/src/widgets/chatwidgetinput.hpp b/src/widgets/chatwidgetinput.hpp index ab500c715..a12a983e2 100644 --- a/src/widgets/chatwidgetinput.hpp +++ b/src/widgets/chatwidgetinput.hpp @@ -3,8 +3,8 @@ #include "emotemanager.hpp" #include "resizingtextedit.hpp" #include "widgets/basewidget.hpp" -#include "widgets/rippleeffectlabel.hpp" #include "widgets/emotepopup.hpp" +#include "widgets/rippleeffectlabel.hpp" #include #include