From 1e985e46476398bf75118480edc4d15547764f7e Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Wed, 5 Nov 2014 15:26:21 +0100 Subject: Doc: add a note about the tickmarksEnabled property Change-Id: I61e6029c813fd0258a24c6ea547190808f42edc9 Reviewed-by: J-P Nurmi --- src/controls/Slider.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/controls/Slider.qml b/src/controls/Slider.qml index b06fcf3a..459fe54c 100644 --- a/src/controls/Slider.qml +++ b/src/controls/Slider.qml @@ -167,6 +167,8 @@ Control { \l stepSize property. The default value is \c false. + + \note This property may be ignored on some platforms when using the native style (e.g. Android). */ property bool tickmarksEnabled: false -- cgit v1.2.1 From 6c9ba0eb17e28719c50eef00c69f812aa2deba0a Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 9 Nov 2014 13:12:21 +0100 Subject: Android/SwitchStyle: use TextMetrics instead of FontMetrics Ensures that the thumb text width is correctly calculated regardless of QML's arbitrary binding evaluation order. Change-Id: I71526db963fec6d54ad717f46382537591268e37 Reviewed-by: Mitch Curtis Reviewed-by: Caroline Chao --- src/controls/Styles/Android/SwitchStyle.qml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/controls/Styles/Android/SwitchStyle.qml b/src/controls/Styles/Android/SwitchStyle.qml index 4c36c918..8401d353 100644 --- a/src/controls/Styles/Android/SwitchStyle.qml +++ b/src/controls/Styles/Android/SwitchStyle.qml @@ -81,16 +81,22 @@ SwitchStyle { x: control.checked ? max : min - FontMetrics { - id: metrics + TextMetrics { + id: onMetrics font: label.font + text: panel.styleDef.Switch_textOn } - readonly property real maxTextWidth: Math.max(metrics.boundingRect(panel.styleDef.Switch_textOn).width, - metrics.boundingRect(panel.styleDef.Switch_textOff).width) + TextMetrics { + id: offMetrics + font: label.font + text: panel.styleDef.Switch_textOff + } + + readonly property real maxTextWidth: Math.max(onMetrics.width, offMetrics.width) implicitWidth: Math.max(loader.implicitWidth, maxTextWidth + 2 * panel.styleDef.Switch_thumbTextPadding) - implicitHeight: Math.max(loader.implicitHeight, metrics.height) + implicitHeight: Math.max(loader.implicitHeight, onMetrics.height, offMetrics.height) anchors.top: parent.top anchors.bottom: parent.bottom -- cgit v1.2.1 From 09a56c4fe9999b5e1ab8921d37ae8f9a000f6ad6 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 9 Nov 2014 13:10:50 +0100 Subject: Android/SwitchStyle: hide thumb text on Android 5.0 Change-Id: Ied63a5bd58a88f097ac9e20f30c21d45f45a2f46 Reviewed-by: Caroline Chao --- src/controls/Styles/Android/SwitchStyle.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controls/Styles/Android/SwitchStyle.qml b/src/controls/Styles/Android/SwitchStyle.qml index 8401d353..6e9260c3 100644 --- a/src/controls/Styles/Android/SwitchStyle.qml +++ b/src/controls/Styles/Android/SwitchStyle.qml @@ -79,6 +79,8 @@ SwitchStyle { Item { id: thumb + readonly property bool hideText: AndroidStyle.styleDef.switchStyle.Switch_showText === false + x: control.checked ? max : min TextMetrics { @@ -126,6 +128,7 @@ SwitchStyle { LabelStyle { id: label + visible: !thumb.hideText text: control.checked ? panel.styleDef.Switch_textOn : panel.styleDef.Switch_textOff pressed: control.pressed -- cgit v1.2.1 From 27987d0b6ab181205e446e392d7c099c7ea81e94 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Sun, 9 Nov 2014 16:19:46 +0100 Subject: Android 5.0: apply tint color Without this change checkboxes, radio buttons, slider handle etc. are black on Android 5.0. This change applies the tint color so that the controls become green/cyan as appropriate. Task-number: QTBUG-42520 Change-Id: Ib8bd9d279f34e0f7951b311f398bc1fb11f7b1ba Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../Styles/Android/drawables/ImageDrawable.qml | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/controls/Styles/Android/drawables/ImageDrawable.qml b/src/controls/Styles/Android/drawables/ImageDrawable.qml index 1e71a389..4b41b2f2 100644 --- a/src/controls/Styles/Android/drawables/ImageDrawable.qml +++ b/src/controls/Styles/Android/drawables/ImageDrawable.qml @@ -52,5 +52,33 @@ Drawable { anchors.fill: parent fillMode: Image.TileHorizontally source: AndroidStyle.filePath(styleDef.path) + + layer.enabled: !!styleDef && !!styleDef.tintList + layer.effect: ShaderEffect { + property variant source: image + property color color: AndroidStyle.colorValue(styleDef.tintList[state]) + state: { + var states = [] + if (pressed) states.push("PRESSED") + if (enabled) states.push("ENABLED") + if (focused) states.push("FOCUSED") + if (selected) states.push("SELECTED") + if (window_focused) states.push("WINDOW_FOCUSED") + if (!states.length) + states.push("EMPTY") + return states.join("_") + "_STATE_SET" + } + // QtGraphicalEffects/ColorOverlay: + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec4 color; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } } } -- cgit v1.2.1 From 86dacdcbbdcfc503715fb077a4b32ec2d62b5227 Mon Sep 17 00:00:00 2001 From: Caroline Chao Date: Thu, 6 Nov 2014 08:45:38 +0100 Subject: Doc: Update gallery screenshots To match the updated example. Display a screenshot for both Android and OS X in the gallery example documentation. Change-Id: I37e56437bb54248a4d500810c56ce8a8ba15b4d2 Reviewed-by: J-P Nurmi Reviewed-by: Venugopal Shivashankar Reviewed-by: Martin Smith --- src/controls/doc/images/qtquickcontrols-android.png | Bin 21393 -> 0 bytes .../images/qtquickcontrols-example-gallery-android.png | Bin 0 -> 26306 bytes .../doc/images/qtquickcontrols-example-gallery-osx.png | Bin 0 -> 24118 bytes .../doc/images/qtquickcontrols-example-gallery.png | Bin 34070 -> 0 bytes src/controls/doc/src/qtquickcontrols-examples.qdoc | 17 ++++++++++++++++- .../doc/src/qtquickcontrols-platformnotes.qdoc | 2 +- 6 files changed, 17 insertions(+), 2 deletions(-) delete mode 100644 src/controls/doc/images/qtquickcontrols-android.png create mode 100644 src/controls/doc/images/qtquickcontrols-example-gallery-android.png create mode 100644 src/controls/doc/images/qtquickcontrols-example-gallery-osx.png delete mode 100644 src/controls/doc/images/qtquickcontrols-example-gallery.png diff --git a/src/controls/doc/images/qtquickcontrols-android.png b/src/controls/doc/images/qtquickcontrols-android.png deleted file mode 100644 index 8877c09c..00000000 Binary files a/src/controls/doc/images/qtquickcontrols-android.png and /dev/null differ diff --git a/src/controls/doc/images/qtquickcontrols-example-gallery-android.png b/src/controls/doc/images/qtquickcontrols-example-gallery-android.png new file mode 100644 index 00000000..11ba2cc0 Binary files /dev/null and b/src/controls/doc/images/qtquickcontrols-example-gallery-android.png differ diff --git a/src/controls/doc/images/qtquickcontrols-example-gallery-osx.png b/src/controls/doc/images/qtquickcontrols-example-gallery-osx.png new file mode 100644 index 00000000..492dc36e Binary files /dev/null and b/src/controls/doc/images/qtquickcontrols-example-gallery-osx.png differ diff --git a/src/controls/doc/images/qtquickcontrols-example-gallery.png b/src/controls/doc/images/qtquickcontrols-example-gallery.png deleted file mode 100644 index a88eab79..00000000 Binary files a/src/controls/doc/images/qtquickcontrols-example-gallery.png and /dev/null differ diff --git a/src/controls/doc/src/qtquickcontrols-examples.qdoc b/src/controls/doc/src/qtquickcontrols-examples.qdoc index 8b8c1469..5ff2b27b 100644 --- a/src/controls/doc/src/qtquickcontrols-examples.qdoc +++ b/src/controls/doc/src/qtquickcontrols-examples.qdoc @@ -40,7 +40,22 @@ \title Qt Quick Controls - Gallery \ingroup qtquickcontrols_examples \brief A collection of components for a classic desktop-style UI. - \image qtquickcontrols-example-gallery.png + + \raw HTML +
+ +
+ \endraw + \image qtquickcontrols-example-gallery-osx.png + \caption OS X + \raw HTML + + \endraw + \image qtquickcontrols-example-gallery-android.png + \caption Android - Nexus 5 + \raw HTML +
+ \endraw This example project demonstrates the various UI components provided by \l{Qt Quick Controls}. diff --git a/src/controls/doc/src/qtquickcontrols-platformnotes.qdoc b/src/controls/doc/src/qtquickcontrols-platformnotes.qdoc index 70f1a1bb..092dc45d 100644 --- a/src/controls/doc/src/qtquickcontrols-platformnotes.qdoc +++ b/src/controls/doc/src/qtquickcontrols-platformnotes.qdoc @@ -37,7 +37,7 @@ Qt 5.4 introduced a native Android style for Qt Quick Controls. - \image qtquickcontrols-android.png + \image qtquickcontrols-example-gallery-android.png \note The Android style requires Android 3.0 (API level 11) or later. -- cgit v1.2.1 From 313ae1c3b581a3e3a44f86793e158ba9e8eae9ab Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 10 Nov 2014 16:40:02 +0100 Subject: Fix text selection on desktop So far, text selection handles were only provided by mobile specific styles. The new Flat style is an exception that provides text selection handles for mobile, but is still intended to be usable on desktop too. The text selection handling code thus needs not only to check whether the text selection handles exist, but also whether it's a mobile platform. This fixes text selection on desktop. Change-Id: Ibda2045ca42970e7db692d2e8370ac0dba21625a Reviewed-by: Mitch Curtis --- src/controls/Private/TextInputWithHandles.qml | 6 +++--- src/controls/TextArea.qml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/controls/Private/TextInputWithHandles.qml b/src/controls/Private/TextInputWithHandles.qml index ceb63084..d19dda31 100644 --- a/src/controls/Private/TextInputWithHandles.qml +++ b/src/controls/Private/TextInputWithHandles.qml @@ -54,7 +54,7 @@ TextInput { property alias editMenu: editMenu cursorDelegate: __style && __style.__cursorDelegate ? __style.__cursorDelegate : null - selectByMouse: control.selectByMouse && (!cursorHandle.delegate || !selectionHandle.delegate) + selectByMouse: control.selectByMouse && (!Settings.isMobile || !cursorHandle.delegate || !selectionHandle.delegate) // force re-evaluation when selection moves: // - cursorRectangle changes => content scrolled @@ -137,7 +137,7 @@ TextInput { editor: input parent: control control: input.control - active: control.selectByMouse + active: control.selectByMouse && Settings.isMobile maximum: cursorHandle.position - 1 property var mappedPos: parent.mapFromItem(editor, editor.selectionRectangle.x, editor.selectionRectangle.y) @@ -163,7 +163,7 @@ TextInput { editor: input parent: control control: input.control - active: control.selectByMouse + active: control.selectByMouse && Settings.isMobile minimum: input.hasSelection ? selectionHandle.position + 1 : -1 property var mappedPos: parent.mapFromItem(editor, editor.cursorRectangle.x, editor.cursorRectangle.y) diff --git a/src/controls/TextArea.qml b/src/controls/TextArea.qml index 8cfb6dfd..b8ed0ba2 100644 --- a/src/controls/TextArea.qml +++ b/src/controls/TextArea.qml @@ -770,7 +770,7 @@ ScrollView { wrapMode: TextEdit.WordWrap textMargin: __style && __style.textMargin !== undefined ? __style.textMargin : 4 - selectByMouse: area.selectByMouse && (!cursorHandle.delegate || !selectionHandle.delegate) + selectByMouse: area.selectByMouse && (!Settings.isMobile || !cursorHandle.delegate || !selectionHandle.delegate) readOnly: false Keys.forwardTo: area @@ -885,7 +885,7 @@ ScrollView { control: area z: 1 // above scrollbars parent: Qt.platform.os === "ios" ? editor : __scroller // no clip - active: area.selectByMouse + active: area.selectByMouse && Settings.isMobile delegate: __style.__selectionHandle maximum: cursorHandle.position - 1 @@ -921,7 +921,7 @@ ScrollView { control: area z: 1 // above scrollbars parent: Qt.platform.os === "ios" ? editor : __scroller // no clip - active: area.selectByMouse + active: area.selectByMouse && Settings.isMobile delegate: __style.__cursorHandle minimum: edit.hasSelection ? selectionHandle.position + 1 : -1 -- cgit v1.2.1 From 0c2e7232d779faffbebef504ce3328293f2c1033 Mon Sep 17 00:00:00 2001 From: Venu Date: Thu, 13 Nov 2014 17:41:04 +0100 Subject: Doc: Fixed the \image reference An earlier commit renamed the image that was referred but this reference was not updated. Change-Id: Ic4b6e9d6d1e01835e53a4fd4640ae45b105898fd Reviewed-by: J-P Nurmi --- src/controls/doc/src/qtquickcontrols-overview.qdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controls/doc/src/qtquickcontrols-overview.qdoc b/src/controls/doc/src/qtquickcontrols-overview.qdoc index 09f5318d..651edc66 100644 --- a/src/controls/doc/src/qtquickcontrols-overview.qdoc +++ b/src/controls/doc/src/qtquickcontrols-overview.qdoc @@ -61,7 +61,7 @@ For an overview of the controls provided by \l{Qt Quick Controls}, you can look at the \l{Qt Quick Controls - Gallery}{Gallery} example. - \image qtquickcontrols-example-gallery.png + \image qtquickcontrols-example-gallery-osx.png \section1 Setting Up Controls from C++ -- cgit v1.2.1 From 45f4aaf0b7170bd56ed982394f4e0f39d7d4ad92 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 14 Nov 2014 14:48:40 +0100 Subject: Doc: Corrected brief statements for overview pages Task-number: QTBUG-42682 Change-Id: I14b60415f5a1bfdc0874013de707560a944c0824 Reviewed-by: Martin Smith --- src/controls/doc/src/applicationwindow.qdoc | 1 + src/controls/doc/src/controls.qdoc | 1 + src/controls/doc/src/qtquickcontrolsstyles-index.qdoc | 1 + src/dialogs/doc/src/qtquickdialogs-index.qdoc | 1 + 4 files changed, 4 insertions(+) diff --git a/src/controls/doc/src/applicationwindow.qdoc b/src/controls/doc/src/applicationwindow.qdoc index f9e2d97f..45b66e30 100644 --- a/src/controls/doc/src/applicationwindow.qdoc +++ b/src/controls/doc/src/applicationwindow.qdoc @@ -27,5 +27,6 @@ /*! \group applicationwindow + \brief A window adding convenience for positioning items. \title Application Window */ diff --git a/src/controls/doc/src/controls.qdoc b/src/controls/doc/src/controls.qdoc index d1e4d052..fa2a800c 100644 --- a/src/controls/doc/src/controls.qdoc +++ b/src/controls/doc/src/controls.qdoc @@ -27,5 +27,6 @@ /*! \group controls + \brief Buttons and UI Controls. \title Buttons and Controls */ diff --git a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc index 74c750a5..7548d742 100644 --- a/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc +++ b/src/controls/doc/src/qtquickcontrolsstyles-index.qdoc @@ -40,6 +40,7 @@ /*! \group controlsstyling + \brief Provides custom styling for Buttons and UI Controls. \title Styling Controls */ diff --git a/src/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/dialogs/doc/src/qtquickdialogs-index.qdoc index 5a1223b0..ab0bc31a 100644 --- a/src/dialogs/doc/src/qtquickdialogs-index.qdoc +++ b/src/dialogs/doc/src/qtquickdialogs-index.qdoc @@ -27,6 +27,7 @@ /*! \group dialogs + \brief Dialog components \title Dialogs */ -- cgit v1.2.1 From 1550e3e4104ef5568a6259c7abd0af0b9e5a0484 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 17 Nov 2014 15:13:06 +0100 Subject: 5.4.0 changelog Change-Id: I759db84f29216844a043df4712d9858b6a251490 Reviewed-by: Mitch Curtis --- dist/changes-5.4.0 | 191 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 dist/changes-5.4.0 diff --git a/dist/changes-5.4.0 b/dist/changes-5.4.0 new file mode 100644 index 00000000..abbd5281 --- /dev/null +++ b/dist/changes-5.4.0 @@ -0,0 +1,191 @@ +Qt 5.4 introduces many new features and improvements as well as bugfixes +over the 5.3.x series. For more details, refer to the online documentation +included in this distribution. The documentation is also available online: + + http://qt-project.org/doc/qt-5.4 + +The Qt version 5.4 series is binary compatible with the 5.3.x series. +Applications compiled for 5.3 will continue to run with 5.4. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + + http://bugreports.qt-project.org/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* General * +**************************************************************************** + + - Introduced a native Android style + - Added text selection handles to all editable controls on Android and iOS + - Added translation support to dialogs + - Made all controls and dialogs use native text rendering on mobile + platforms + +**************************************************************************** +* Examples * +**************************************************************************** + + - Revised the Qt Quick Controls Gallery and Table View examples to be more + mobile friendly + - Removed the Split View example - a similar snippet is available in the + detailed description section of SplitView documentation + - Made the Styles tab of the former Gallery example a standalone example + +**************************************************************************** +* Controls * +**************************************************************************** + + - ApplicationWindow: + * Introduced ApplicationWindowStyle for styling the window background + + - Button: + * Added support for mnemonics + + - Calendar: + * Added navigationBarVisible property + * Added pressAndHold(date) signal + + - CheckBox: + * Added support for mnemonics + + - ComboBox: + * Added inputMethodComposing property + + - Menu: + * Fixed key navigation on Windows + + - RadioButton: + * Added support for mnemonics + + - ScrollView: + * Added horizontalScrollBarPolicy and verticalScrollBarPolicy properties + + - Slider: + * [QTBUG-39099] Fixed the step size used on increase/decrease key press + * Made the hovered property follow the hovered state of the handle + instead of the whole groove + + - SpinBox: + * Added inputMethodComposing property + + - SplitView: + * [QTBUG-35281] Added addItem() method + + - StackView: + * Changed the linear slide with a smooth animation + + - Switch: + * Added pressed property + * Added clicked() signal + + - TableView: + * Added pressAndHold(int row) signal + * Fixed support for Keys-attached property + * [QTBUG-41444] Fixed leaking of key events + * Made focused and selected rows to be raised above other rows + + - TabView: + * [QTBUG-38425] Added contentItem property + + - TextArea: + * [QTBUG-38324] Added contentWidth and contentHeight properties + * Added cursorRectangle property + * Added inputMethodComposing property + * Made selection persistent + + - TextField: + * Added cursorRectangle property + * Added selectByMouse property + * Added inputMethodComposing property + * [QTBUG-38282] Added support for sticky VKB with Qt.ImhMultiLine + + - ToolButton: + * Added support for mnemonics + +**************************************************************************** +* Dialogs * +**************************************************************************** + + - Fixed deployment dependencies + - [QTBUG-41844] Fixed centering of dialogs over parent windows + - [QTBUG-41734] Fixed several sizing problems + - [QTBUG-38578] Fixed dynamically created dialogs + + - I18n: + * Added translation support + + - ColorDialog: + * Fixed rendering on non-windowing platforms + + - FileDialog: + * Fixed array key navigation to always navigate the file list + * Replaced icons with scalable ones from an icon font + * [QTBUG-39231] Added sideBarVisible property and button + * [QTBUG-39435] Fixed Save As and directory-choosing scenarios + + - FontDialog: + * [QTBUG-39365] Added support for key navigation + + - Dialog: + * Focus is given to the contentItem automatically + +**************************************************************************** +* Layouts * +**************************************************************************** + + - Increased the default spacing on mobile platforms + - [QTBUG-39045] Fixed a crash when removing children from hidden layouts + +**************************************************************************** +* Styles * +**************************************************************************** + + - Introduced ApplicationWindowStyle + + - ComboBoxStyle: + * Added font property + * Added textColor, selectionColor and selectedTextColor properties + + - MenuBarStyle: + * Added font property + + - MenuStyle: + * Added font property + * Added styleData.pressed context property + + - SpinBoxStyle: + * Added font property + + - TableViewStyle: + * Added styleData.pressed context property for itemDelegate & rowDelegate + * Added styleData.hasActiveFocus context property for itemDelegate + + - TabViewStyle: + * Added styleData.pressed context property for tab + + - ToolBarStyle: + * Added menuButton property + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Android +------- + - Introduced a native Android style + - [QTBUG-38934] Added text selection handles to all editable controls + +iOS +--- + - [QTBUG-38934] Added text selection handles to all editable controls + - Made ComboBox open a native selection menu + - Added edit menu (cut, copy, paste) support to all editable controls + - Added text cursor and scroll bar styling + +Windows +------- + - Fixed Menu key navigation -- cgit v1.2.1 From 331c10d457b4dd7a9e4aa7d9c8724e0790cfebe0 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Tue, 18 Nov 2014 14:41:14 +0100 Subject: Doc: added brief statement for group menus Task-number: QTBUG-40362 Change-Id: I94d869e9d38c5d958df4abd1e17f219cfa3ce16a Reviewed-by: Martin Smith --- src/controls/doc/src/menus.qdoc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controls/doc/src/menus.qdoc b/src/controls/doc/src/menus.qdoc index 75f5ba2c..8a6a8032 100644 --- a/src/controls/doc/src/menus.qdoc +++ b/src/controls/doc/src/menus.qdoc @@ -27,5 +27,6 @@ /*! \group menus + \brief How to create a menu bar. \title Menus */ -- cgit v1.2.1 From 5cb56a1adae19e608787cb39b6d90e0a09258871 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 14 Nov 2014 20:24:09 +0100 Subject: Android 5.0: add missing state transitions Android 5.0 introduced control state change transitions. Without this change, CheckBoxes and RadioButtons don't transition between checked and unchecked states as appropriate. Task-number: QTBUG-42520 Change-Id: If2aa70898e72b78f105732cc4ee5c9674cc6082c Reviewed-by: BogDan Vatra Reviewed-by: Caroline Chao Reviewed-by: Shawn Rutledge --- .../Styles/Android/drawables/AnimationDrawable.qml | 5 +- .../Styles/Android/drawables/StateDrawable.qml | 76 ++++++++++++++++++++-- 2 files changed, 76 insertions(+), 5 deletions(-) diff --git a/src/controls/Styles/Android/drawables/AnimationDrawable.qml b/src/controls/Styles/Android/drawables/AnimationDrawable.qml index a522bfa7..12d576ff 100644 --- a/src/controls/Styles/Android/drawables/AnimationDrawable.qml +++ b/src/controls/Styles/Android/drawables/AnimationDrawable.qml @@ -49,14 +49,17 @@ Drawable { property int currentFrame: 0 readonly property int frameCount: styleDef.frames ? styleDef.frames.length : 0 readonly property var frameDef: styleDef.frames ? styleDef.frames[currentFrame] : undefined + readonly property alias running: timer.running + property bool oneshot: styleDef.oneshot Timer { + id: timer repeat: true running: root.frameCount && root.visible && Qt.application.active interval: root.frameDef ? root.frameDef.duration : 0 onTriggered: { var frame = root.currentFrame + 1 - repeat = !root.styleDef.oneshot || frame < root.frameCount - 1 + repeat = !root.oneshot || frame < root.frameCount - 1 root.currentFrame = frame % root.frameCount } } diff --git a/src/controls/Styles/Android/drawables/StateDrawable.qml b/src/controls/Styles/Android/drawables/StateDrawable.qml index d446542d..862ab9ae 100644 --- a/src/controls/Styles/Android/drawables/StateDrawable.qml +++ b/src/controls/Styles/Android/drawables/StateDrawable.qml @@ -46,10 +46,12 @@ Drawable { implicitWidth: Math.max(loader.implicitWidth, styleDef.width || 0) implicitHeight: Math.max(loader.implicitHeight, styleDef.height || 0) + property int prevMatch: 0 + DrawableLoader { id: loader anchors.fill: parent - styleDef: bestStateMatch() + visible: !animation.active focused: root.focused pressed: root.pressed checked: root.checked @@ -65,17 +67,70 @@ Drawable { clippables: root.clippables } - function bestStateMatch () { + Loader { + id: animation + property var animDef + active: false + anchors.fill: parent + sourceComponent: AnimationDrawable { + anchors.fill: parent + styleDef: animDef + focused: root.focused + pressed: root.pressed + checked: root.checked + selected: root.selected + accelerated: root.accelerated + window_focused: root.window_focused + index: root.index + level: root.level + levelId: root.levelId + orientations: root.orientations + duration: root.duration + excludes: root.excludes + clippables: root.clippables + + oneshot: true + onRunningChanged: if (!running) animation.active = false + } + } + + onStyleDefChanged: resolveState() + Component.onCompleted: resolveState() + + // In order to be able to find appropriate transition paths between + // various states, the following states must be allowed to change in + // batches. For example, button-like controls could have a transition + // path from pressed+checked to unpressed+unchecked. We must let both + // properties change before we try to find the transition path. + onEnabledChanged: resolver.start() + onFocusedChanged: resolver.start() + onPressedChanged: resolver.start() + onCheckedChanged: resolver.start() + onSelectedChanged: resolver.start() + onAcceleratedChanged: resolver.start() + onWindow_focusedChanged: resolver.start() + + Timer { + id: resolver + interval: 15 + onTriggered: resolveState() + } + + function resolveState () { if (styleDef && styleDef.stateslist) { var bestMatch = 0 var highestScore = -1 var stateslist = styleDef.stateslist + var transitions = [] for (var i = 0; i < stateslist.length; ++i) { var score = 0 var state = stateslist[i] + if (state.transition) + transitions.push(i) + for (var s in state.states) { if (s === "pressed") score += (pressed === state.states[s]) ? 1 : -10 @@ -98,8 +153,21 @@ Drawable { highestScore = score } } - return stateslist[bestMatch].drawable + + if (prevMatch != bestMatch) { + for (var t = 0; t < transitions.length; ++t) { + var transition = stateslist[transitions[t]].transition + if ((transition.from == prevMatch && transition.to == bestMatch) || + (transition.reverse && transition.from == bestMatch && transition.to == prevMatch)) { + animation.animDef = stateslist[transitions[t]].drawable + animation.active = true + break + } + } + prevMatch = bestMatch + } + + loader.styleDef = stateslist[bestMatch].drawable } - return undefined } } -- cgit v1.2.1 From 23c6bb1b65357df1010d9801abffd03cd7747938 Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Fri, 21 Nov 2014 12:56:51 +0100 Subject: Only make scrollbars non-interactive on mobile devices. Before this patch, I could not adjust the scrollbars in a ScrollArea on a Windows 8.1 desktop computer just because it had a touch screen. The same problem was observed on Linux (with touch screen). Task-number: QTBUG-42806 Change-Id: I6f35c40b0362820d7c1685e1b6fc8474432237eb Reviewed-by: J-P Nurmi Reviewed-by: Shawn Rutledge --- src/controls/Private/ScrollBar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controls/Private/ScrollBar.qml b/src/controls/Private/ScrollBar.qml index 82750412..3bd0a164 100644 --- a/src/controls/Private/ScrollBar.qml +++ b/src/controls/Private/ScrollBar.qml @@ -102,7 +102,7 @@ Item { onExited: if (!pressed) __panel.activeControl = "none" onMouseXChanged: if (!pressed) __panel.activeControl = __panel.hitTest(mouseX, mouseY) hoverEnabled: !Settings.hasTouchScreen - enabled: !Settings.hasTouchScreen // TODO: touch on desktop? + enabled: !Settings.isMobile || !Settings.hasTouchScreen // ### Not ideal, but will usually behave as expected... preventStealing: true property var pressedX property var pressedY -- cgit v1.2.1 From ea099e341b5f8845be56f81b22e44a8b6cb227a2 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 24 Nov 2014 11:35:29 +0100 Subject: Take all offsets into account also with PlatformMenu Task-number: QTBUG-42314 Change-Id: I7e63d744bbed4a5c254d6cffdc8aba4c5e37d5c3 Reviewed-by: Gabriel de Dietrich --- src/controls/qquickmenu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp index c2e7bc30..1a125135 100644 --- a/src/controls/qquickmenu.cpp +++ b/src/controls/qquickmenu.cpp @@ -414,6 +414,7 @@ void QQuickMenu::__popup(const QRectF &targetRect, int atItemIndex, MenuType men } globalTargetRect = visualItem()->mapRectToScene(globalTargetRect); } + globalTargetRect.translate(renderOffset); m_platformMenu->setMenuType(QPlatformMenu::MenuType(menuType)); m_platformMenu->showPopup(parentWindow, globalTargetRect.toRect(), atItem ? atItem->platformItem() : 0); } else { -- cgit v1.2.1