Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(chatform): mark message with triple click
Browse files Browse the repository at this point in the history
Fixes #5211. Only trigger on triple clicks that are caused by the same
mouse button clicked successively.
  • Loading branch information
ezavod committed Jul 9, 2018
1 parent 2a8ab03 commit 2cdff7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/chatlog/chatlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,14 @@ void ChatLog::mousePressEvent(QMouseEvent* ev)
clearSelection();
}

// Counts only single clicks and first click of doule click
clickCount++;
if (lastClickButton == ev->button()) {
// Counts only single clicks and first click of doule click
clickCount++;
}
else {
clickCount = 1; // restarting counter
lastClickButton = ev->button();
}
lastClickPos = ev->pos();

// Triggers on odd click counts
Expand Down Expand Up @@ -477,8 +483,14 @@ void ChatLog::mouseDoubleClickEvent(QMouseEvent* ev)
emit selectionChanged();
}

// Counts the second click of double click
clickCount++;
if (lastClickButton == ev->button()) {
// Counts the second click of double click
clickCount++;
}
else {
clickCount = 1; // restarting counter
lastClickButton = ev->button();
}
lastClickPos = ev->pos();

// Triggers on even click counts
Expand Down
1 change: 1 addition & 0 deletions src/chatlog/chatlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private slots:
AutoScrollDirection selectionScrollDir = NoDirection;
int clickCount = 0;
QPoint lastClickPos;
Qt::MouseButton lastClickButton;

// worker vars
int workerLastIndex = 0;
Expand Down

0 comments on commit 2cdff7e

Please sign in to comment.