From 9c40092395c4cb43936d89094450229eed7fbf11 Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 26 Apr 2014 06:23:12 +0000 Subject: [PATCH] Fixed double click not doing anything. --- qt/lc_qglwidget.cpp | 20 ++++++++++++++++++++ qt/lc_qglwidget.h | 1 + 2 files changed, 21 insertions(+) diff --git a/qt/lc_qglwidget.cpp b/qt/lc_qglwidget.cpp index cb6bfdaf..162ca6c3 100644 --- a/qt/lc_qglwidget.cpp +++ b/qt/lc_qglwidget.cpp @@ -248,6 +248,26 @@ void lcQGLWidget::mouseReleaseEvent(QMouseEvent *event) } } +void lcQGLWidget::mouseDoubleClickEvent(QMouseEvent *event) +{ + float scale = deviceScale(); + + widget->mInputState.x = event->x() * scale; + widget->mInputState.y = widget->mHeight - event->y() * scale - 1; + widget->mInputState.Control = (event->modifiers() & Qt::ControlModifier) != 0; + widget->mInputState.Shift = (event->modifiers() & Qt::ShiftModifier) != 0; + widget->mInputState.Alt = (event->modifiers() & Qt::AltModifier) != 0; + + switch (event->button()) + { + case Qt::LeftButton: + widget->OnLeftButtonDoubleClick(); + break; + default: + break; + } +} + void lcQGLWidget::mouseMoveEvent(QMouseEvent *event) { float scale = deviceScale(); diff --git a/qt/lc_qglwidget.h b/qt/lc_qglwidget.h index 62082473..2bb24b24 100644 --- a/qt/lc_qglwidget.h +++ b/qt/lc_qglwidget.h @@ -33,6 +33,7 @@ protected: void keyReleaseEvent(QKeyEvent *event); void mousePressEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event); void wheelEvent(QWheelEvent *event); void dragEnterEvent(QDragEnterEvent *event);