summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2014-02-27 16:48:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-10 09:56:13 +0100
commitca280bfe3bc551f814d59d25079e098798fbdad7 (patch)
tree3e7a9b357a1218343d456834ae2c17e612532e02 /src/gui
parentd87ddcf56ff3bc46f468d8da276f1afc28b6ac26 (diff)
Android: Support double click event
It's impossible to get the distance between two touch events down to 5 pixels on e.g. my Nexus 5. This patch makes it possible to tweak the distance through the platform theme, and sets the distance to 15% of an inch on Android. Also provides a way to override the default minimum of 5 pixels by using an environment variable. [ChangeLog][Android] Fixed double click events Task-number: QTBUG-36974 Change-Id: I23d94020c531747d6638b645133611614a2a0703 Reviewed-by: BogDan Vatra <bogdan@kde.org>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qguiapplication.cpp4
-rw-r--r--src/gui/kernel/qplatformtheme.cpp2
-rw-r--r--src/gui/kernel/qplatformtheme.h3
3 files changed, 7 insertions, 2 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 1347f309e5..b2d774b40d 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -145,7 +145,7 @@ ulong QGuiApplicationPrivate::mousePressTime = 0;
Qt::MouseButton QGuiApplicationPrivate::mousePressButton = Qt::NoButton;
int QGuiApplicationPrivate::mousePressX = 0;
int QGuiApplicationPrivate::mousePressY = 0;
-int QGuiApplicationPrivate::mouse_double_click_distance = 5;
+int QGuiApplicationPrivate::mouse_double_click_distance = -1;
static Qt::LayoutDirection layout_direction = Qt::LeftToRight;
static bool force_reverse = false;
@@ -1255,6 +1255,8 @@ void QGuiApplicationPrivate::init()
initPalette();
QFont::initialize();
+ mouse_double_click_distance = platformTheme()->themeHint(QPlatformTheme::MouseDoubleClickDistance).toInt();
+
#ifndef QT_NO_CURSOR
QCursorData::initialize();
#endif
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index e12eb318dc..05ab2f15ba 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -499,6 +499,8 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint)
return QVariant(false);
case MousePressAndHoldInterval:
return QVariant(800);
+ case MouseDoubleClickDistance:
+ return QVariant(5);
}
return QVariant();
}
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 205a5bab69..073eda8d07 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -108,7 +108,8 @@ public:
PasswordMaskCharacter,
DialogSnapToDefaultButton,
ContextMenuOnMouseRelease,
- MousePressAndHoldInterval
+ MousePressAndHoldInterval,
+ MouseDoubleClickDistance
};
enum DialogType {