From 8e71e41bc901beec1aedabe8c9bc6c94df2e295a Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Fri, 13 Apr 2018 06:45:20 +0200 Subject: iOS: Be more explicit about how to get access to the native image picker Change-Id: I24c265698d118544a470ac91c54d57895544a5ac Reviewed-by: Richard Moe Gustavsen --- src/dialogs/qquickplatformfiledialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 */ -- cgit v1.2.1 From 71beceb772dedfcaa30eda8ce2ed146e835b59f9 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 12 Mar 2018 12:32:00 +0100 Subject: Stop incrementing if the mouse is no longer over the button Change-Id: Ibc95b14faaa77f200cf6ea5e05cb227e6a3628ca Reviewed-by: Mitch Curtis --- src/controls/SpinBox.qml | 6 +++-- tests/auto/controls/data/tst_spinbox.qml | 38 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) 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/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) + } } } -- cgit v1.2.1 From 0689a8256c0a21087c01fff3998fd3b606a5ac4c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 30 Nov 2017 10:48:18 +0100 Subject: Slider: don't break the binding on value when using the mouse wheel When the wheel was used it could cause any binding on value to be broken since it was updated directly. Going via range.position ensures this is not the case. Change-Id: Ic041ea911cee68de34f5c4e184cf8460f5e002da Reviewed-by: Mitch Curtis --- src/controls/Slider.qml | 4 ++-- tests/auto/controls/data/tst_slider.qml | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 2 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/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) + } } } -- cgit v1.2.1