summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-03 12:16:29 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-04 14:11:28 +0000
commit5f7f27759e23fb1e5f3779a580adcf5bb6d5ecd6 (patch)
tree46c6dc99752ea4492c43758f0e49cd971653e09f
parent31803eb51bb2dde55776317b678d48d76f0e27fe (diff)
downloadqtquickcontrols-5f7f27759e23fb1e5f3779a580adcf5bb6d5ecd6.tar.gz
Disable hover on touch
Task-number: QTBUG-44267 Change-Id: I467f08ae6c5264b7e858022af9ff293117434018 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
-rw-r--r--src/controls/ComboBox.qml2
-rw-r--r--src/controls/MenuBar.qml2
-rw-r--r--src/controls/Private/AbstractCheckable.qml3
-rw-r--r--src/controls/Private/BasicButton.qml2
-rw-r--r--src/controls/Private/ColumnMenuContent.qml3
-rw-r--r--src/controls/Private/HoverButton.qml4
-rw-r--r--src/controls/Private/MenuContentScroller.qml3
-rw-r--r--src/controls/Private/ScrollBar.qml2
-rw-r--r--src/controls/Private/TabBar.qml3
-rw-r--r--src/controls/Private/TextInputWithHandles.qml2
-rw-r--r--src/controls/Private/ToolMenuButton.qml2
-rw-r--r--src/controls/Private/qquickcontrolsettings.cpp5
-rw-r--r--src/controls/Private/qquickcontrolsettings_p.h2
-rw-r--r--src/controls/ProgressBar.qml2
-rw-r--r--src/controls/Slider.qml2
-rw-r--r--src/controls/SpinBox.qml6
-rw-r--r--src/controls/SplitView.qml2
-rw-r--r--src/controls/Styles/Base/CalendarStyle.qml2
-rw-r--r--src/controls/TableView.qml2
19 files changed, 32 insertions, 19 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index f2f37a0a..5ec0e1f8 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -349,7 +349,7 @@ Control {
property bool overridePressed: false
readonly property bool effectivePressed: (pressed || overridePressed) && containsMouse
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
onPressed: {
if (comboBox.activeFocusOnPress)
forceActiveFocus()
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index 5d90f91d..ce37ed6d 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -290,7 +290,7 @@ MenuBarPrivate {
MouseArea {
id: menuMouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
onPositionChanged: updateCurrentItem(mouse, false)
onPressed: {
diff --git a/src/controls/Private/AbstractCheckable.qml b/src/controls/Private/AbstractCheckable.qml
index f1dbe962..e8b75c54 100644
--- a/src/controls/Private/AbstractCheckable.qml
+++ b/src/controls/Private/AbstractCheckable.qml
@@ -40,6 +40,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
/*!
\qmltype AbstractCheckable
@@ -113,7 +114,7 @@ Control {
id: mouseArea
focus: true
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
enabled: !keyPressed
property bool keyPressed: false
diff --git a/src/controls/Private/BasicButton.qml b/src/controls/Private/BasicButton.qml
index f0c9c63e..cc70cb0a 100644
--- a/src/controls/Private/BasicButton.qml
+++ b/src/controls/Private/BasicButton.qml
@@ -186,7 +186,7 @@ Control {
property bool effectivePressed: pressed && containsMouse || keyPressed
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
enabled: !keyPressed
function toggle() {
diff --git a/src/controls/Private/ColumnMenuContent.qml b/src/controls/Private/ColumnMenuContent.qml
index 9c0b2345..6334256d 100644
--- a/src/controls/Private/ColumnMenuContent.qml
+++ b/src/controls/Private/ColumnMenuContent.qml
@@ -40,6 +40,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
Item {
id: content
@@ -193,7 +194,7 @@ Item {
width: scrollView.width - scrollView.__verticalScrollBar.width
height: parent.height
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
acceptedButtons: Qt.AllButtons
onPositionChanged: updateCurrentItem({ "x": mouse.x, "y": mouse.y })
diff --git a/src/controls/Private/HoverButton.qml b/src/controls/Private/HoverButton.qml
index 964d30d3..e01b1a26 100644
--- a/src/controls/Private/HoverButton.qml
+++ b/src/controls/Private/HoverButton.qml
@@ -39,6 +39,8 @@
****************************************************************************/
import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
Item {
id: button
@@ -73,6 +75,6 @@ Item {
id: mouse
anchors.fill: parent
onClicked: button.clicked()
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
}
}
diff --git a/src/controls/Private/MenuContentScroller.qml b/src/controls/Private/MenuContentScroller.qml
index ccbeb55b..799c8c25 100644
--- a/src/controls/Private/MenuContentScroller.qml
+++ b/src/controls/Private/MenuContentScroller.qml
@@ -40,6 +40,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
MouseArea {
id: scrollIndicator
@@ -50,7 +51,7 @@ MouseArea {
bottom: direction === Qt.DownArrow ? parent.bottom : undefined
}
- hoverEnabled: visible
+ hoverEnabled: visible && Settings.hoverEnabled
height: scrollerLoader.height
width: parent.width
diff --git a/src/controls/Private/ScrollBar.qml b/src/controls/Private/ScrollBar.qml
index 3bd0a164..538a0385 100644
--- a/src/controls/Private/ScrollBar.qml
+++ b/src/controls/Private/ScrollBar.qml
@@ -101,7 +101,7 @@ Item {
onEntered: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
onExited: if (!pressed) __panel.activeControl = "none"
onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY)
- hoverEnabled: !Settings.hasTouchScreen
+ hoverEnabled: Settings.hoverEnabled
enabled: !Settings.isMobile || !Settings.hasTouchScreen // ### Not ideal, but will usually behave as expected...
preventStealing: true
property var pressedX
diff --git a/src/controls/Private/TabBar.qml b/src/controls/Private/TabBar.qml
index 0d289e05..39a1a45f 100644
--- a/src/controls/Private/TabBar.qml
+++ b/src/controls/Private/TabBar.qml
@@ -40,6 +40,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
/*!
\qmltype TabBar
@@ -165,7 +166,7 @@ FocusScope {
delegate: MouseArea {
id: tabitem
objectName: "mousearea"
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
focus: true
enabled: modelData.enabled
diff --git a/src/controls/Private/TextInputWithHandles.qml b/src/controls/Private/TextInputWithHandles.qml
index 75ca947f..6f4abd39 100644
--- a/src/controls/Private/TextInputWithHandles.qml
+++ b/src/controls/Private/TextInputWithHandles.qml
@@ -102,7 +102,7 @@ TextInput {
MouseArea {
id: mouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
cursorShape: Qt.IBeamCursor
acceptedButtons: (input.selectByMouse ? Qt.NoButton : Qt.LeftButton) | (control.menu ? Qt.RightButton : Qt.NoButton)
onClicked: {
diff --git a/src/controls/Private/ToolMenuButton.qml b/src/controls/Private/ToolMenuButton.qml
index 111b6753..c4affe73 100644
--- a/src/controls/Private/ToolMenuButton.qml
+++ b/src/controls/Private/ToolMenuButton.qml
@@ -91,7 +91,7 @@ FocusScope {
anchors.fill: parent
enabled: !keyPressed
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
onReleased: {
if (Settings.hasTouchScreen && containsMouse && menu)
diff --git a/src/controls/Private/qquickcontrolsettings.cpp b/src/controls/Private/qquickcontrolsettings.cpp
index ca57f394..697a6879 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -96,6 +96,11 @@ bool QQuickControlSettings::isMobile() const
#endif
}
+bool QQuickControlSettings::hoverEnabled() const
+{
+ return !isMobile() || !hasTouchScreen();
+}
+
static QString styleImportPath(QQmlEngine *engine, const QString &styleName)
{
QString path = qgetenv("QT_QUICK_CONTROLS_STYLE");
diff --git a/src/controls/Private/qquickcontrolsettings_p.h b/src/controls/Private/qquickcontrolsettings_p.h
index 72a1ca6a..d7352db3 100644
--- a/src/controls/Private/qquickcontrolsettings_p.h
+++ b/src/controls/Private/qquickcontrolsettings_p.h
@@ -51,6 +51,7 @@ class QQuickControlSettings : public QObject
Q_PROPERTY(qreal dragThreshold READ dragThreshold CONSTANT)
Q_PROPERTY(bool hasTouchScreen READ hasTouchScreen CONSTANT)
Q_PROPERTY(bool isMobile READ isMobile CONSTANT)
+ Q_PROPERTY(bool hoverEnabled READ hoverEnabled CONSTANT)
public:
QQuickControlSettings(QQmlEngine *engine);
@@ -68,6 +69,7 @@ public:
bool hasTouchScreen() const;
bool isMobile() const;
+ bool hoverEnabled() const;
signals:
void styleChanged();
diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml
index 6af20e03..bad61aec 100644
--- a/src/controls/ProgressBar.qml
+++ b/src/controls/ProgressBar.qml
@@ -145,7 +145,7 @@ Control {
MouseArea {
id: hoverArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
}
/*! \internal */
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index d0644b4c..14d8566d 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -229,7 +229,7 @@ Control {
id: mouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
property int clickOffset: 0
property real pressX: 0
property real pressY: 0
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index 66a21027..3b5797c3 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -271,7 +271,7 @@ Control {
MouseArea {
id: mouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
onPressed: if (activeFocusOnPress) input.forceActiveFocus()
onWheel: {
if (wheel.angleDelta.y > 0)
@@ -334,7 +334,7 @@ Control {
MouseArea {
id: mouseUp
objectName: "mouseUp"
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
property var upRect: __panel ? __panel.upRect : null
@@ -361,7 +361,7 @@ Control {
MouseArea {
id: mouseDown
objectName: "mouseDown"
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
onClicked: __decrement()
onPressed: if (!Settings.hasTouchScreen && activeFocusOnPress) input.forceActiveFocus()
diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml
index f4360746..18289aa8 100644
--- a/src/controls/SplitView.qml
+++ b/src/controls/SplitView.qml
@@ -433,7 +433,7 @@ Item {
anchors.rightMargin: (parent.width <= 1) ? -defaultMargin : 0
anchors.topMargin: (parent.height <= 1) ? -defaultMargin : 0
anchors.bottomMargin: (parent.height <= 1) ? -defaultMargin : 0
- hoverEnabled: true
+ hoverEnabled: Private.Settings.hoverEnabled
drag.threshold: 0
drag.target: parent
drag.axis: root.orientation === Qt.Horizontal ? Drag.XAxis : Drag.YAxis
diff --git a/src/controls/Styles/Base/CalendarStyle.qml b/src/controls/Styles/Base/CalendarStyle.qml
index a25222fe..b9d2708c 100644
--- a/src/controls/Styles/Base/CalendarStyle.qml
+++ b/src/controls/Styles/Base/CalendarStyle.qml
@@ -530,7 +530,7 @@ Style {
id: mouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
function cellIndexAt(mouseX, mouseY) {
var viewContainerPos = viewContainer.mapFromItem(mouseArea, mouseX, mouseY);
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml
index 0d104b06..b3e5eef4 100644
--- a/src/controls/TableView.qml
+++ b/src/controls/TableView.qml
@@ -1062,7 +1062,7 @@ ScrollView {
MouseArea{
id: headerClickArea
drag.axis: Qt.YAxis
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
anchors.fill: parent
onClicked: {
if (sortIndicatorColumn === index)