From 41d7942f631f1da4720fdd376bdb7a10ff27c698 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Tue, 13 Dec 2016 09:30:52 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- desktop-widgets/divepicturewidget.cpp | 7 ++++--- 1 file 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(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(); QString filename = model()->data(indexAt(event->pos()), Qt::DisplayPropertyRole).toString(); -- cgit v1.2.3-70-g09d2