summaryrefslogtreecommitdiff
path: root/src/controls
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
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')
-rw-r--r--src/controls/ComboBox.qml2
-rw-r--r--src/controls/Menu.qml4
-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/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
-rw-r--r--src/controls/ProgressBar.qml2
-rw-r--r--src/controls/Slider.qml9
-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/qquickmenupopupwindow.cpp2
21 files changed, 40 insertions, 24 deletions
diff --git a/src/controls/ComboBox.qml b/src/controls/ComboBox.qml
index 2baa4c73..2f50dc0e 100644
--- a/src/controls/ComboBox.qml
+++ b/src/controls/ComboBox.qml
@@ -345,7 +345,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/Menu.qml b/src/controls/Menu.qml
index 7d90e19e..2ab229ab 100644
--- a/src/controls/Menu.qml
+++ b/src/controls/Menu.qml
@@ -44,8 +44,8 @@ import QtQuick.Controls.Private 1.0
\inqmlmodule QtQuick.Controls
\since 5.1
\ingroup menus
- \brief Provides a menu component for use in menu bars, as context menu,
- and other popup menus.
+ \brief Provides a menu component for use as a context menu, popup menu, or
+ as part of a menu bar.
\image menu.png
diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml
index d453e227..5f444dac 100644
--- a/src/controls/MenuBar.qml
+++ b/src/controls/MenuBar.qml
@@ -286,7 +286,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 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();
diff --git a/src/controls/ProgressBar.qml b/src/controls/ProgressBar.qml
index e988874e..7bc3bec5 100644
--- a/src/controls/ProgressBar.qml
+++ b/src/controls/ProgressBar.qml
@@ -141,7 +141,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 3f1169a2..8bce7e8f 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -171,8 +171,11 @@ Control {
/*! \internal */
property bool __horizontal: orientation === Qt.Horizontal
- /*! \internal */
- property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y)
+ /*! \internal
+ The extra arguments positionAtMinimum and positionAtMaximum are there to force
+ re-evaluation of the handle position when the constraints change (QTBUG-41255).
+ */
+ property real __handlePos: range.valueForPosition(__horizontal ? fakeHandle.x : fakeHandle.y, range.positionAtMinimum, range.positionAtMaximum)
activeFocusOnTab: true
@@ -225,7 +228,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 39caae50..95ce2b47 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -267,7 +267,7 @@ Control {
MouseArea {
id: mouseArea
anchors.fill: parent
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
onPressed: if (activeFocusOnPress) input.forceActiveFocus()
onWheel: {
if (wheel.angleDelta.y > 0)
@@ -330,7 +330,7 @@ Control {
MouseArea {
id: mouseUp
objectName: "mouseUp"
- hoverEnabled: true
+ hoverEnabled: Settings.hoverEnabled
property var upRect: __panel ? __panel.upRect : null
@@ -357,7 +357,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 15db7350..38b7f839 100644
--- a/src/controls/SplitView.qml
+++ b/src/controls/SplitView.qml
@@ -449,7 +449,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 d8af6ab1..590f67db 100644
--- a/src/controls/Styles/Base/CalendarStyle.qml
+++ b/src/controls/Styles/Base/CalendarStyle.qml
@@ -526,7 +526,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/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index 1c5f8d0b..52063979 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -96,7 +96,7 @@ void QQuickMenuPopupWindow::setGeometry(int posx, int posy, int w, int h)
pw = parentItem()->window();
if (!pw)
pw = this;
- QRect g = pw->screen()->availableVirtualGeometry();
+ QRect g = pw->screen()->virtualGeometry();
if (posx + w > g.right()) {
if (qobject_cast<QQuickMenuPopupWindow *>(transientParent())) {