diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 1a85a9132..2abeb6b42 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -899,6 +899,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) if (wordStart < this->selection_.start.charIndex && !this->dCSelection_.selectingRight) { this->dCSelection_.selectingLeft = true; + // Ensure that the original word stays selected(Edge case) if (wordStart > this->dCSelection_.originalEnd) { this->setSelection(this->dCSelection_.origStartItem, newEnd); @@ -909,6 +910,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event) } else if (wordEnd > this->selection_.end.charIndex && !this->dCSelection_.selectingLeft) { this->dCSelection_.selectingRight = true; + // Ensure that the original word stays selected(Edge case) if (wordEnd < this->dCSelection_.originalStart) { this->setSelection(newStart, this->dCSelection_.origEndItem); @@ -1068,15 +1070,21 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event) { // check if mouse was pressed if (event->button() == Qt::LeftButton) { - this->isDoubleClick_ = this->dCSelection_.selectingLeft = - this->dCSelection_.selectingRight = false; - if (this->isMouseDown_) { + this->dCSelection_.selectingLeft = this->dCSelection_.selectingRight = + false; + if (this->isMouseDown_ || this->isDoubleClick_) { this->isMouseDown_ = false; + this->isDoubleClick_ = false; if (fabsf(distanceBetweenPoints(this->lastPressPosition_, event->screenPos())) > 15.f) { return; } + // Was actually not a wanted triple-click + if (fabsf(distanceBetweenPoints(this->lastDClickPosition_, + event->screenPos())) > 10.f) { + return; + } } else { return; } @@ -1286,6 +1294,7 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event) const MessageLayoutElement *hoverLayoutElement = layout->getElementAt(relativePos); + this->lastDClickPosition_ = event->screenPos(); if (hoverLayoutElement == nullptr) { // Possibility for triple click which doesn't have to be over an diff --git a/src/widgets/helper/ChannelView.hpp b/src/widgets/helper/ChannelView.hpp index f68835b09..512439e38 100644 --- a/src/widgets/helper/ChannelView.hpp +++ b/src/widgets/helper/ChannelView.hpp @@ -155,6 +155,7 @@ private: DoubleClickSelection dCSelection_; QPointF lastPressPosition_; QPointF lastRightPressPosition_; + QPointF lastDClickPosition_; QTimer *clickTimer_; Selection selection_;