summaryrefslogtreecommitdiff
path: root/src/controls/Private
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-12 15:53:02 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-02-12 15:53:02 +0100
commit1a5413df3d9a0602f074562e2e92751df369d016 (patch)
tree461a56ee176e873bee441fe4d899d7a683deca9d /src/controls/Private
parenta2f81b85d5dfa7fbd3b11557fe38de649a1f6914 (diff)
parent9af9dabe3c88baa87befe5a4591d7f3508888307 (diff)
downloadqtquickcontrols-1a5413df3d9a0602f074562e2e92751df369d016.tar.gz
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts: src/controls/TableView.qml tests/auto/controls/data/tst_gridlayout.qml Change-Id: I030bc50dc8fcf7b6b00e183dc3a67c3cd012f3fb
Diffstat (limited to 'src/controls/Private')
-rw-r--r--src/controls/Private/AbstractCheckable.qml3
-rw-r--r--src/controls/Private/BasicButton.qml2
-rw-r--r--src/controls/Private/BasicTableView.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
12 files changed, 23 insertions, 10 deletions
diff --git a/src/controls/Private/AbstractCheckable.qml b/src/controls/Private/AbstractCheckable.qml
index 0e685dea..42abebe5 100644
--- a/src/controls/Private/AbstractCheckable.qml
+++ b/src/controls/Private/AbstractCheckable.qml
@@ -36,6 +36,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
/*!
\qmltype AbstractCheckable
@@ -109,7 +110,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 dc503dc5..5de95aa9 100644
--- a/src/controls/Private/BasicButton.qml
+++ b/src/controls/Private/BasicButton.qml
@@ -182,7 +182,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/BasicTableView.qml b/src/controls/Private/BasicTableView.qml
index cac673eb..bc8ebdb0 100644
--- a/src/controls/Private/BasicTableView.qml
+++ b/src/controls/Private/BasicTableView.qml
@@ -682,7 +682,7 @@ ScrollView {
MouseArea{
id: headerClickArea
drag.axis: Qt.YAxis
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
anchors.fill: parent
onClicked: {
if (sortIndicatorColumn === index)
diff --git a/src/controls/Private/ColumnMenuContent.qml b/src/controls/Private/ColumnMenuContent.qml
index a5fa3dc8..8de3fcea 100644
--- a/src/controls/Private/ColumnMenuContent.qml
+++ b/src/controls/Private/ColumnMenuContent.qml
@@ -36,6 +36,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
Item {
id: content
@@ -189,7 +190,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 6825ff98..c5b39d56 100644
--- a/src/controls/Private/HoverButton.qml
+++ b/src/controls/Private/HoverButton.qml
@@ -35,6 +35,8 @@
****************************************************************************/
import QtQuick 2.2
+import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
Item {
id: button
@@ -69,6 +71,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 44c0eaa1..3efbd5ad 100644
--- a/src/controls/Private/MenuContentScroller.qml
+++ b/src/controls/Private/MenuContentScroller.qml
@@ -36,6 +36,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
MouseArea {
id: scrollIndicator
@@ -46,7 +47,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 481d766a..f6f5e26d 100644
--- a/src/controls/Private/ScrollBar.qml
+++ b/src/controls/Private/ScrollBar.qml
@@ -97,7 +97,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 e7382aa4..183d006b 100644
--- a/src/controls/Private/TabBar.qml
+++ b/src/controls/Private/TabBar.qml
@@ -36,6 +36,7 @@
import QtQuick 2.2
import QtQuick.Controls 1.2
+import QtQuick.Controls.Private 1.0
/*!
\qmltype TabBar
@@ -161,7 +162,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 9ed4468d..f931986f 100644
--- a/src/controls/Private/TextInputWithHandles.qml
+++ b/src/controls/Private/TextInputWithHandles.qml
@@ -99,7 +99,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 c93c3b14..f2c8c3e1 100644
--- a/src/controls/Private/ToolMenuButton.qml
+++ b/src/controls/Private/ToolMenuButton.qml
@@ -87,7 +87,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 d1c5b82e..017a0714 100644
--- a/src/controls/Private/qquickcontrolsettings.cpp
+++ b/src/controls/Private/qquickcontrolsettings.cpp
@@ -101,6 +101,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 f7234670..ed21101d 100644
--- a/src/controls/Private/qquickcontrolsettings_p.h
+++ b/src/controls/Private/qquickcontrolsettings_p.h
@@ -54,6 +54,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);
@@ -71,6 +72,7 @@ public:
bool hasTouchScreen() const;
bool isMobile() const;
+ bool hoverEnabled() const;
signals:
void styleChanged();