diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-01-16 09:37:42 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-01-16 09:38:19 +0100 |
commit | 08e6333450bc28c61fa804101df3ae8bef4e9568 (patch) | |
tree | acb8973cbbd2319ab75e460e35a3278459d717df /src/imports/controls/material | |
parent | ef5e426bed3b1362394c7cc0c97522bb20cacff0 (diff) | |
parent | 744d14b468eb4bdd4dabf72ef7acdca1bc07ea5d (diff) |
Merge remote-tracking branch 'origin/5.10' into dev
Change-Id: Ibd1490e8d958361e55ac272dff75c9361239958b
Diffstat (limited to 'src/imports/controls/material')
-rw-r--r-- | src/imports/controls/material/BusyIndicator.qml | 4 | ||||
-rw-r--r-- | src/imports/controls/material/CheckBox.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/ComboBox.qml | 1 | ||||
-rw-r--r-- | src/imports/controls/material/Dial.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/GroupBox.qml | 1 | ||||
-rw-r--r-- | src/imports/controls/material/LICENSE_ANGULARJS.txt | 19 | ||||
-rw-r--r-- | src/imports/controls/material/RadioButton.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/ScrollBar.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/ScrollIndicator.qml | 6 | ||||
-rw-r--r-- | src/imports/controls/material/SwipeView.qml | 1 | ||||
-rw-r--r-- | src/imports/controls/material/Switch.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/ToolButton.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/material/Tumbler.qml | 10 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialbusyindicator.cpp | 24 | ||||
-rw-r--r-- | src/imports/controls/material/qquickmaterialbusyindicator_p.h | 4 | ||||
-rw-r--r-- | src/imports/controls/material/qt_attribution.json | 13 |
16 files changed, 68 insertions, 27 deletions
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml index 8fc64029..5e53bdb9 100644 --- a/src/imports/controls/material/BusyIndicator.qml +++ b/src/imports/controls/material/BusyIndicator.qml @@ -52,8 +52,8 @@ T.BusyIndicator { implicitHeight: 48 color: control.Material.accentColor + running: control.running opacity: control.running ? 1 : 0 - visible: control.running || animator.running - Behavior on opacity { OpacityAnimator { id: animator; duration: 250 } } + Behavior on opacity { OpacityAnimator { duration: 250 } } } } diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml index 2a4d4e7c..1f818e6e 100644 --- a/src/imports/controls/material/CheckBox.qml +++ b/src/imports/controls/material/CheckBox.qml @@ -80,8 +80,6 @@ T.CheckBox { font: control.font color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight - visible: control.text - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml index a58f1a37..3dd3cf30 100644 --- a/src/imports/controls/material/ComboBox.qml +++ b/src/imports/controls/material/ComboBox.qml @@ -92,7 +92,6 @@ T.ComboBox { color: control.enabled ? control.Material.foreground : control.Material.hintTextColor selectionColor: control.Material.accentColor selectedTextColor: control.Material.primaryHighlightedTextColor - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter cursorDelegate: CursorDelegate { } diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml index eec16838..3d94df18 100644 --- a/src/imports/controls/material/Dial.qml +++ b/src/imports/controls/material/Dial.qml @@ -57,8 +57,6 @@ T.Dial { } handle: SliderHandle { - id: handleItem - x: background.x + background.width / 2 - handle.width / 2 y: background.y + background.height / 2 - handle.height / 2 transform: [ diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml index 5b1e7813..cc2ab0f0 100644 --- a/src/imports/controls/material/GroupBox.qml +++ b/src/imports/controls/material/GroupBox.qml @@ -62,7 +62,6 @@ T.GroupBox { font: control.font color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } diff --git a/src/imports/controls/material/LICENSE_ANGULARJS.txt b/src/imports/controls/material/LICENSE_ANGULARJS.txt new file mode 100644 index 00000000..c1f2a826 --- /dev/null +++ b/src/imports/controls/material/LICENSE_ANGULARJS.txt @@ -0,0 +1,19 @@ +Copyright (c) 2014-2016 Google, Inc. http://angularjs.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml index 573dfd70..2a95f989 100644 --- a/src/imports/controls/material/RadioButton.qml +++ b/src/imports/controls/material/RadioButton.qml @@ -80,8 +80,6 @@ T.RadioButton { font: control.font color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight - visible: control.text - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml index 2b5fa12f..2ff925af 100644 --- a/src/imports/controls/material/ScrollBar.qml +++ b/src/imports/controls/material/ScrollBar.qml @@ -50,8 +50,6 @@ T.ScrollBar { visible: control.policy !== T.ScrollBar.AlwaysOff contentItem: Rectangle { - id: handle - implicitWidth: control.interactive ? 13 : 4 implicitHeight: control.interactive ? 13 : 4 diff --git a/src/imports/controls/material/ScrollIndicator.qml b/src/imports/controls/material/ScrollIndicator.qml index 37a8429b..92727822 100644 --- a/src/imports/controls/material/ScrollIndicator.qml +++ b/src/imports/controls/material/ScrollIndicator.qml @@ -49,8 +49,6 @@ T.ScrollIndicator { padding: 2 contentItem: Rectangle { - id: indicator - implicitWidth: 4 implicitHeight: 4 @@ -61,7 +59,7 @@ T.ScrollIndicator { states: State { name: "active" when: control.active - PropertyChanges { target: indicator; opacity: 0.75 } + PropertyChanges { target: control.contentItem; opacity: 0.75 } } transitions: [ @@ -69,7 +67,7 @@ T.ScrollIndicator { from: "active" SequentialAnimation { PauseAnimation { duration: 450 } - NumberAnimation { target: indicator; duration: 200; property: "opacity"; to: 0.0 } + NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 } } } ] diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml index d5915d9f..eb753579 100644 --- a/src/imports/controls/material/SwipeView.qml +++ b/src/imports/controls/material/SwipeView.qml @@ -60,5 +60,6 @@ T.SwipeView { preferredHighlightBegin: 0 preferredHighlightEnd: 0 highlightMoveDuration: 250 + maximumFlickVelocity: 4 * (control.orientation === Qt.Horizontal ? width : height) } } diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml index 0434fb7f..d44a9f2c 100644 --- a/src/imports/controls/material/Switch.qml +++ b/src/imports/controls/material/Switch.qml @@ -75,8 +75,6 @@ T.Switch { font: control.font color: control.enabled ? control.Material.foreground : control.Material.hintTextColor elide: Text.ElideRight - visible: control.text - horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter } } diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml index 369c7f3b..86a9f5c0 100644 --- a/src/imports/controls/material/ToolButton.qml +++ b/src/imports/controls/material/ToolButton.qml @@ -73,7 +73,7 @@ T.ToolButton { implicitWidth: 48 implicitHeight: 48 - readonly property bool square: control.contentItem.implicitWidth <= control.contentItem.implicitHeight + readonly property bool square: control.contentItem.width <= control.contentItem.height x: (parent.width - width) / 2 y: (parent.height - height) / 2 diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml index e3fdd869..eff1ff47 100644 --- a/src/imports/controls/material/Tumbler.qml +++ b/src/imports/controls/material/Tumbler.qml @@ -46,7 +46,6 @@ T.Tumbler { implicitHeight: 200 delegate: Text { - id: label text: modelData color: control.Material.foreground font: control.font @@ -56,15 +55,14 @@ T.Tumbler { } contentItem: TumblerView { - id: tumblerView model: control.model delegate: control.delegate path: Path { - startX: tumblerView.width / 2 - startY: -tumblerView.delegateHeight / 2 + startX: contentItem.width / 2 + startY: -contentItem.delegateHeight / 2 PathLine { - x: tumblerView.width / 2 - y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2 + x: contentItem.width / 2 + y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2 } } diff --git a/src/imports/controls/material/qquickmaterialbusyindicator.cpp b/src/imports/controls/material/qquickmaterialbusyindicator.cpp index 9df8f5d2..bd15390b 100644 --- a/src/imports/controls/material/qquickmaterialbusyindicator.cpp +++ b/src/imports/controls/material/qquickmaterialbusyindicator.cpp @@ -197,6 +197,17 @@ void QQuickMaterialBusyIndicator::setColor(QColor color) update(); } +bool QQuickMaterialBusyIndicator::isRunning() const +{ + return isVisible(); +} + +void QQuickMaterialBusyIndicator::setRunning(bool running) +{ + if (running) + setVisible(true); +} + int QQuickMaterialBusyIndicator::elapsed() const { return m_elapsed; @@ -205,14 +216,23 @@ int QQuickMaterialBusyIndicator::elapsed() const void QQuickMaterialBusyIndicator::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) { QQuickItem::itemChange(change, data); - if (change == ItemVisibleHasChanged) + switch (change) { + case ItemOpacityHasChanged: + if (qFuzzyIsNull(data.realValue)) + setVisible(false); + break; + case ItemVisibleHasChanged: update(); + break; + default: + break; + } } QSGNode *QQuickMaterialBusyIndicator::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { QQuickMaterialBusyIndicatorNode *node = static_cast<QQuickMaterialBusyIndicatorNode *>(oldNode); - if (isVisible() && width() > 0 && height() > 0) { + if (isRunning() && width() > 0 && height() > 0) { if (!node) { node = new QQuickMaterialBusyIndicatorNode(this); node->start(); diff --git a/src/imports/controls/material/qquickmaterialbusyindicator_p.h b/src/imports/controls/material/qquickmaterialbusyindicator_p.h index da84c7b1..6c6d2445 100644 --- a/src/imports/controls/material/qquickmaterialbusyindicator_p.h +++ b/src/imports/controls/material/qquickmaterialbusyindicator_p.h @@ -57,6 +57,7 @@ class QQuickMaterialBusyIndicator : public QQuickItem { Q_OBJECT Q_PROPERTY(QColor color READ color WRITE setColor FINAL) + Q_PROPERTY(bool running READ isRunning WRITE setRunning FINAL) public: explicit QQuickMaterialBusyIndicator(QQuickItem *parent = nullptr); @@ -64,6 +65,9 @@ public: QColor color() const; void setColor(QColor color); + bool isRunning() const; + void setRunning(bool running); + int elapsed() const; protected: diff --git a/src/imports/controls/material/qt_attribution.json b/src/imports/controls/material/qt_attribution.json new file mode 100644 index 00000000..01b45e9f --- /dev/null +++ b/src/imports/controls/material/qt_attribution.json @@ -0,0 +1,13 @@ +{ + "Id": "shadow_angular_material", + "Name": "Shadow values from Angular Material", + "QDocModule": "qtquickcontrols2", + "QtUsage": "Used in the Material Style of Qt Quick Controls 2.", + "Files": "ElevationEffect.qml", + "Description": "Shadow values for the elevation effect.", + "Homepage": "https://angularjs.org/", + "License": "MIT License", + "LicenseId": "MIT", + "LicenseFile": "LICENSE_ANGULARJS.txt", + "Copyright": "Copyright (c) 2014-2016 Google, Inc" +} |