summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-18 06:44:45 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-04-18 06:44:45 +0200
commit5ab01d7dc4b5a5d180885e3bc2a82267f9fcf3ae (patch)
tree6f2b46092fb6909e486864924f15e3c629a53123
parent4cda4427b6a2e07dd406362cf7b643b971706b2c (diff)
parent0689a8256c0a21087c01fff3998fd3b606a5ac4c (diff)
downloadqtquickcontrols-5ab01d7dc4b5a5d180885e3bc2a82267f9fcf3ae.tar.gz
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I00b66b03717563bb700f8a73c3bc295a55ac8c6a
-rw-r--r--src/controls/Slider.qml4
-rw-r--r--src/controls/SpinBox.qml6
-rw-r--r--src/dialogs/qquickplatformfiledialog.cpp4
-rw-r--r--tests/auto/controls/data/tst_slider.qml33
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml38
5 files changed, 80 insertions, 5 deletions
diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml
index e290640e..07ad74c4 100644
--- a/src/controls/Slider.qml
+++ b/src/controls/Slider.qml
@@ -331,14 +331,14 @@ Control {
onVerticalWheelMoved: {
if (verticalDelta !== 0) {
var delta = Math.abs(verticalDelta)*step > stepSize ? verticalDelta*step : verticalDelta/Math.abs(verticalDelta)*stepSize
- value -= delta * (inverted ? 1 : -1)
+ range.position = range.positionForValue(value - delta * (inverted ? 1 : -1))
}
}
onHorizontalWheelMoved: {
if (horizontalDelta !== 0) {
var delta = Math.abs(horizontalDelta)*step > stepSize ? horizontalDelta*step : horizontalDelta/Math.abs(horizontalDelta)*stepSize
- value += delta * (inverted ? 1 : -1)
+ range.position = range.positionForValue(value + delta * (inverted ? 1 : -1))
}
}
}
diff --git a/src/controls/SpinBox.qml b/src/controls/SpinBox.qml
index a742abd6..b7ec6a8f 100644
--- a/src/controls/SpinBox.qml
+++ b/src/controls/SpinBox.qml
@@ -359,8 +359,9 @@ Control {
property bool autoincrement: false;
onReleased: autoincrement = false
+ onExited: autoincrement = false
Timer { running: mouseUp.pressed; interval: 350 ; onTriggered: mouseUp.autoincrement = true }
- Timer { running: mouseUp.autoincrement; interval: 60 ; repeat: true ; onTriggered: __increment() }
+ Timer { running: mouseUp.autoincrement && mouseUp.containsMouse; interval: 60 ; repeat: true ; onTriggered: __increment() }
}
// Spinbox decrement button
@@ -386,8 +387,9 @@ Control {
property bool autoincrement: false;
onReleased: autoincrement = false
+ onExited: autoincrement = false
Timer { running: mouseDown.pressed; interval: 350 ; onTriggered: mouseDown.autoincrement = true }
- Timer { running: mouseDown.autoincrement; interval: 60 ; repeat: true ; onTriggered: __decrement() }
+ Timer { running: mouseDown.autoincrement && mouseDown.containsMouse; interval: 60 ; repeat: true ; onTriggered: __decrement() }
}
Keys.onUpPressed: __increment()
diff --git a/src/dialogs/qquickplatformfiledialog.cpp b/src/dialogs/qquickplatformfiledialog.cpp
index aaf15197..1a969e15 100644
--- a/src/dialogs/qquickplatformfiledialog.cpp
+++ b/src/dialogs/qquickplatformfiledialog.cpp
@@ -318,7 +318,9 @@ void QQuickPlatformFileDialog1::accept()
{shortcuts.pictures},
a native image picker dialog will be used for accessing the user's photo album.
The URL returned can be set as \l{Image::source}{source} for \l{Image}.
- This feature was added in Qt 5.5.
+ For this to be enabled, the Info.plist assigned to QMAKE_INFO_PLIST in the project file must
+ contain the key, NSPhotoLibraryUsageDescription. See Info.plist documentation from Apple for
+ more information regarding this key. This feature was added in Qt 5.5.
\sa shortcuts
*/
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index e95d26d9..f6435314 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -439,5 +439,38 @@ Item {
control.destroy();
}
+
+ Component {
+ id: mouseWheelSlider
+ Slider {
+ property real boundValue: 10
+ width: 300
+ height: 50
+ minimumValue: 0
+ maximumValue: 200
+ stepSize: 2
+ value: boundValue
+ }
+ }
+
+ function test_mouseWheelWithValueBinding() {
+ var slider = createTemporaryObject(mouseWheelSlider, container)
+ slider.forceActiveFocus()
+
+ var defaultScrollSpeed = 20.0
+ var mouseStep = 15.0
+ var deltatUnit = 8.0
+ var mouseRatio = deltatUnit * mouseStep / defaultScrollSpeed;
+ var sliderDeltaRatio = 1; //(slider.maximumValue - slider.minimumValue)/slider.width
+ var ratio = mouseRatio / sliderDeltaRatio
+
+ compare(slider.value, 10)
+
+ mouseWheel(slider, 5, 5, -20 * ratio, 0)
+ compare(slider.value, 24)
+
+ slider.boundValue = 50
+ compare(slider.value, 50)
+ }
}
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 587d2be0..d42a2551 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -49,6 +49,7 @@
****************************************************************************/
import QtQuick 2.2
+import QtQuick.Controls 1.2
import QtQuick.Controls.Private 1.0
import QtTest 1.0
@@ -702,6 +703,43 @@ Item {
test.destroy()
}
+
+ Component {
+ id: moveMouseFlickable
+ Flickable {
+ property alias spinbox: _spinbox
+ width: 100
+ height: 200
+ contentHeight: 500
+ contentWidth: 200
+ SpinBox {
+ id: _spinbox
+ x: 20
+ y: 100
+ minimumValue: 0
+ maximumValue: 12500
+ }
+ }
+ }
+
+ function test_moveMouseInFlickable() {
+ var control = createTemporaryObject(moveMouseFlickable, container)
+ var spinbox = control.spinbox
+ spinbox.forceActiveFocus()
+ setCoordinates(spinbox)
+ mousePress(spinbox, upCoord.x, upCoord.y, Qt.LeftButton)
+ mouseMove(spinbox.parent, mainCoord.x, mainCoord.y - 50, 500)
+ compare(spinbox.hovered, false)
+ compare(spinbox.__styleData.upHovered, false)
+ compare(spinbox.__styleData.downHovered, false)
+ mouseRelease(spinbox.parent, mainCoord.x, mainCoord.y - 50, Qt.LeftButton)
+ var currentVal = spinbox.value
+ mouseMove(spinbox.parent, upCoord.x, upCoord.y)
+ compare(spinbox.hovered, true)
+ compare(spinbox.__styleData.upHovered, true)
+ compare(spinbox.__styleData.downHovered, false)
+ compare(spinbox.value, currentVal)
+ }
}
}