summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/divepicturewidget.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2016-12-13 09:30:52 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-12-26 13:09:01 -0800
commit41d7942f631f1da4720fdd376bdb7a10ff27c698 (patch)
tree1799fffadf67cc0d0cbc2a7d8fdbcdea6a3ab546 /desktop-widgets/divepicturewidget.cpp
parentc8c4f8f0b9fdf7a5cc315b130795a37ffcf6e074 (diff)
downloadsubsurface-41d7942f631f1da4720fdd376bdb7a10ff27c698.tar.gz
Don't trust event->timestamp()
It seems the timestampt of QMouseEvents are not reliable on Linux. So we better use currentDateTime to detect a double click. Fixes #1103 Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/divepicturewidget.cpp')
-rw-r--r--desktop-widgets/divepicturewidget.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/desktop-widgets/divepicturewidget.cpp b/desktop-widgets/divepicturewidget.cpp
index 04ae76e23..ac3c03ea3 100644
--- a/desktop-widgets/divepicturewidget.cpp
+++ b/desktop-widgets/divepicturewidget.cpp
@@ -31,12 +31,13 @@ void DivePictureWidget::doubleClicked(const QModelIndex &index)
void DivePictureWidget::mousePressEvent(QMouseEvent *event)
{
ulong doubleClickInterval = static_cast<ulong>(qApp->styleHints()->mouseDoubleClickInterval());
- static ulong lasttime = 0L;
+ static qint64 lasttime = 0L;
+ qint64 timestamp = QDateTime::currentDateTime().toMSecsSinceEpoch();
- if (event->timestamp() - lasttime <= doubleClickInterval) {
+ if (timestamp - lasttime <= doubleClickInterval) {
doubleClicked(indexAt(event->pos()));
} else {
- lasttime = event->timestamp();
+ lasttime = timestamp;
QPixmap pixmap = model()->data(indexAt(event->pos()), Qt::DecorationRole).value<QPixmap>();
QString filename = model()->data(indexAt(event->pos()), Qt::DisplayPropertyRole).toString();