1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(chatform): mark message with triple click

Fixes #5211. Only trigger on triple clicks that are caused by the same
mouse button clicked successively.
This commit is contained in:
ezavod 2018-07-09 16:33:30 +02:00
parent 2a8ab03e46
commit 2cdff7e9ed
No known key found for this signature in database
GPG Key ID: E9FDE71887B4D083
2 changed files with 17 additions and 4 deletions

View File

@ -197,8 +197,14 @@ void ChatLog::mousePressEvent(QMouseEvent* ev)
clearSelection(); clearSelection();
} }
if (lastClickButton == ev->button()) {
// Counts only single clicks and first click of doule click // Counts only single clicks and first click of doule click
clickCount++; clickCount++;
}
else {
clickCount = 1; // restarting counter
lastClickButton = ev->button();
}
lastClickPos = ev->pos(); lastClickPos = ev->pos();
// Triggers on odd click counts // Triggers on odd click counts
@ -477,8 +483,14 @@ void ChatLog::mouseDoubleClickEvent(QMouseEvent* ev)
emit selectionChanged(); emit selectionChanged();
} }
if (lastClickButton == ev->button()) {
// Counts the second click of double click // Counts the second click of double click
clickCount++; clickCount++;
}
else {
clickCount = 1; // restarting counter
lastClickButton = ev->button();
}
lastClickPos = ev->pos(); lastClickPos = ev->pos();
// Triggers on even click counts // Triggers on even click counts

View File

@ -154,6 +154,7 @@ private:
AutoScrollDirection selectionScrollDir = NoDirection; AutoScrollDirection selectionScrollDir = NoDirection;
int clickCount = 0; int clickCount = 0;
QPoint lastClickPos; QPoint lastClickPos;
Qt::MouseButton lastClickButton;
// worker vars // worker vars
int workerLastIndex = 0; int workerLastIndex = 0;