aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-01-08 11:41:56 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-01-10 13:43:39 +0100
commit5d9736653e49f697be3ea514af5b3ec69e747e2d (patch)
tree79aaa11e92d9fe2e7476e37f187e4ff6707454e5 /src
parent10b8f6af42a1cd80273d0a2d36e75b79078b5994 (diff)
parent55522df46edd295a65edd32e0ca7d32408ab6de4 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: src/imports/controls/BusyIndicator.qml src/imports/controls/CheckBox.qml src/imports/controls/CheckDelegate.qml src/imports/controls/ComboBox.qml src/imports/controls/DelayButton.qml src/imports/controls/Dial.qml src/imports/controls/ItemDelegate.qml src/imports/controls/MenuItem.qml src/imports/controls/RadioButton.qml src/imports/controls/RadioDelegate.qml src/imports/controls/SwipeDelegate.qml src/imports/controls/Switch.qml src/imports/controls/SwitchDelegate.qml src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc src/imports/controls/material/CheckDelegate.qml src/imports/controls/material/ItemDelegate.qml src/imports/controls/material/MenuItem.qml src/imports/controls/material/RadioDelegate.qml src/imports/controls/material/SwipeDelegate.qml src/imports/controls/material/SwitchDelegate.qml src/imports/controls/qquickdefaultbusyindicator.cpp src/imports/controls/qquickdefaultbusyindicator_p.h src/imports/controls/qtquickcontrols2plugin.cpp src/imports/controls/universal/CheckDelegate.qml src/imports/controls/universal/ItemDelegate.qml src/imports/controls/universal/MenuItem.qml src/imports/controls/universal/RadioDelegate.qml src/imports/controls/universal/SwipeDelegate.qml src/imports/controls/universal/SwitchDelegate.qml src/quickcontrols2/quickcontrols2.pri src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickmenu.cpp src/quicktemplates2/qquickpopup_p.h Change-Id: Ib25c8b4a7fe018b7c0ade9b02bfaaa6980118c15
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/BusyIndicator.qml5
-rw-r--r--src/imports/controls/ComboBox.qml1
-rw-r--r--src/imports/controls/DelayButton.qml62
-rw-r--r--src/imports/controls/Dial.qml1
-rw-r--r--src/imports/controls/GroupBox.qml1
-rw-r--r--src/imports/controls/ScrollBar.qml6
-rw-r--r--src/imports/controls/ScrollIndicator.qml6
-rw-r--r--src/imports/controls/SwipeView.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml1
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc27
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc13
-rw-r--r--src/imports/controls/material/BusyIndicator.qml4
-rw-r--r--src/imports/controls/material/CheckBox.qml2
-rw-r--r--src/imports/controls/material/ComboBox.qml1
-rw-r--r--src/imports/controls/material/Dial.qml2
-rw-r--r--src/imports/controls/material/GroupBox.qml1
-rw-r--r--src/imports/controls/material/LICENSE_ANGULARJS.txt19
-rw-r--r--src/imports/controls/material/RadioButton.qml2
-rw-r--r--src/imports/controls/material/ScrollBar.qml2
-rw-r--r--src/imports/controls/material/ScrollIndicator.qml6
-rw-r--r--src/imports/controls/material/SwipeView.qml1
-rw-r--r--src/imports/controls/material/Switch.qml2
-rw-r--r--src/imports/controls/material/ToolButton.qml2
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator.cpp24
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator_p.h4
-rw-r--r--src/imports/controls/material/qt_attribution.json13
-rw-r--r--src/imports/controls/qquickdefaultbusyindicator.cpp24
-rw-r--r--src/imports/controls/qquickdefaultbusyindicator_p.h4
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp12
-rw-r--r--src/imports/controls/universal/CheckBox.qml2
-rw-r--r--src/imports/controls/universal/ComboBox.qml1
-rw-r--r--src/imports/controls/universal/GroupBox.qml1
-rw-r--r--src/imports/controls/universal/RadioButton.qml2
-rw-r--r--src/imports/controls/universal/ScrollIndicator.qml6
-rw-r--r--src/imports/controls/universal/Switch.qml2
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp2
-rw-r--r--src/quickcontrols2/qquickclippedtext.cpp122
-rw-r--r--src/quickcontrols2/qquickclippedtext_p.h96
-rw-r--r--src/quickcontrols2/qquickitemgroup.cpp122
-rw-r--r--src/quickcontrols2/qquickitemgroup_p.h83
-rw-r--r--src/quickcontrols2/qquickstyle.cpp4
-rw-r--r--src/quickcontrols2/qquickstyleselector.cpp30
-rw-r--r--src/quickcontrols2/qquickstyleselector_p.h30
-rw-r--r--src/quickcontrols2/qquickstyleselector_p_p.h30
-rw-r--r--src/quickcontrols2/quickcontrols2.pri4
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp13
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h1
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp12
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp25
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp22
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h7
-rw-r--r--src/quicktemplates2/qquickdeferredexecute.cpp32
-rw-r--r--src/quicktemplates2/qquickdeferredexecute_p_p.h9
-rw-r--r--src/quicktemplates2/qquickdial.cpp12
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp5
-rw-r--r--src/quicktemplates2/qquickgroupbox.cpp12
-rw-r--r--src/quicktemplates2/qquicklabel.cpp11
-rw-r--r--src/quicktemplates2/qquicklabel_p_p.h1
-rw-r--r--src/quicktemplates2/qquickmenu.cpp3
-rw-r--r--src/quicktemplates2/qquickpagelayout.cpp13
-rw-r--r--src/quicktemplates2/qquickpopup.cpp11
-rw-r--r--src/quicktemplates2/qquickpopup_p.h1
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp43
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp16
-rw-r--r--src/quicktemplates2/qquickslider.cpp12
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp12
-rw-r--r--src/quicktemplates2/qquickstackview.cpp7
-rw-r--r--src/quicktemplates2/qquickstackview_p.h4
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp11
-rw-r--r--src/quicktemplates2/qquicktextarea_p_p.h1
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp11
-rw-r--r--src/quicktemplates2/qquicktextfield_p_p.h1
80 files changed, 924 insertions, 180 deletions
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index 06be00ec..82255407 100644
--- a/src/imports/controls/BusyIndicator.qml
+++ b/src/imports/controls/BusyIndicator.qml
@@ -53,8 +53,9 @@ T.BusyIndicator {
pen: control.palette.dark
fill: control.palette.dark
+
+ 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/ComboBox.qml b/src/imports/controls/ComboBox.qml
index bc7ad9b9..26f02f2e 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -88,7 +88,6 @@ T.ComboBox {
color: control.editable ? control.palette.text : control.palette.buttonText
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
background: Rectangle {
diff --git a/src/imports/controls/DelayButton.qml b/src/imports/controls/DelayButton.qml
index 461f4195..e6a1a2d9 100644
--- a/src/imports/controls/DelayButton.qml
+++ b/src/imports/controls/DelayButton.qml
@@ -58,55 +58,35 @@ T.DelayButton {
}
}
- contentItem: Item {
- implicitWidth: label.implicitWidth
- implicitHeight: label.implicitHeight
-
- Item {
- x: -control.leftPadding + (control.progress * control.width)
- width: (1.0 - control.progress) * control.width
- height: parent.height
-
+ contentItem: ItemGroup {
+ ClippedText {
clip: control.progress > 0
+ clipX: -control.leftPadding + control.progress * control.width
+ clipWidth: (1.0 - control.progress) * control.width
visible: control.progress < 1
- Text {
- id: label
- x: -parent.x
- width: control.availableWidth
- height: parent.height
-
- text: control.text
- font: control.font
- opacity: enabled ? 1 : 0.3
- color: control.palette.buttonText
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- elide: Text.ElideRight
- }
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1 : 0.3
+ color: control.palette.buttonText
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
}
- Item {
- x: -control.leftPadding
- width: control.progress * control.width
- height: parent.height
-
+ ClippedText {
clip: control.progress > 0
+ clipX: -control.leftPadding
+ clipWidth: control.progress * control.width
visible: control.progress > 0
- Text {
- x: control.leftPadding
- width: control.availableWidth
- height: parent.height
-
- text: control.text
- font: control.font
- opacity: enabled ? 1 : 0.3
- color: control.palette.brightText
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- elide: Text.ElideRight
- }
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1 : 0.3
+ color: control.palette.brightText
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
}
}
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index f3706fa3..67d55d2b 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -54,7 +54,6 @@ T.Dial {
}
handle: ColorImage {
- id: handleItem
x: background.x + background.width / 2 - handle.width / 2
y: background.y + background.height / 2 - handle.height / 2
width: 14
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index 967f591d..1bcb4fc0 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -62,7 +62,6 @@ T.GroupBox {
font: control.font
color: control.palette.windowText
elide: Text.ElideRight
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
index cf6d7da6..ccdf9cf4 100644
--- a/src/imports/controls/ScrollBar.qml
+++ b/src/imports/controls/ScrollBar.qml
@@ -51,8 +51,6 @@ T.ScrollBar {
visible: control.policy !== T.ScrollBar.AlwaysOff
contentItem: Rectangle {
- id: handle
-
implicitWidth: control.interactive ? 6 : 2
implicitHeight: control.interactive ? 6 : 2
@@ -63,14 +61,14 @@ T.ScrollBar {
states: State {
name: "active"
when: control.policy === T.ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
- PropertyChanges { target: handle; opacity: 0.75 }
+ PropertyChanges { target: control.contentItem; opacity: 0.75 }
}
transitions: Transition {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 450 }
- NumberAnimation { target: handle; duration: 200; property: "opacity"; to: 0.0 }
+ NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
}
}
}
diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml
index ee6a321e..1636aa62 100644
--- a/src/imports/controls/ScrollIndicator.qml
+++ b/src/imports/controls/ScrollIndicator.qml
@@ -50,8 +50,6 @@ T.ScrollIndicator {
padding: 2
contentItem: Rectangle {
- id: indicator
-
implicitWidth: 2
implicitHeight: 2
@@ -62,7 +60,7 @@ T.ScrollIndicator {
states: State {
name: "active"
when: control.active
- PropertyChanges { target: indicator; opacity: 0.75 }
+ PropertyChanges { target: control.contentItem; opacity: 0.75 }
}
transitions: [
@@ -70,7 +68,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/SwipeView.qml b/src/imports/controls/SwipeView.qml
index 2b4e9c2e..41ab3147 100644
--- a/src/imports/controls/SwipeView.qml
+++ b/src/imports/controls/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/doc/snippets/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml
index e86f1393..ed2a6621 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml
@@ -58,7 +58,6 @@ CheckBox {
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#17a81a" : "#21be2b"
- horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml
index 2815aa25..aa19ff14 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml
@@ -41,7 +41,6 @@ CheckDelegate {
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#17a81a" : "#21be2b"
elide: Text.ElideRight
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml
index eb5f832c..68e7ddad 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml
@@ -76,7 +76,6 @@ ComboBox {
text: control.displayText
font: control.font
color: control.pressed ? "#17a81a" : "#21be2b"
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml
index 8ce86d61..e19d28f3 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml
@@ -39,8 +39,6 @@ ItemDelegate {
font: control.font
color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml
index 3b3e8d4a..6d77772d 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml
@@ -58,7 +58,6 @@ RadioButton {
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#17a81a" : "#21be2b"
- horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml
index 1033befd..d486943d 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml
@@ -41,7 +41,6 @@ RadioDelegate {
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#17a81a" : "#21be2b"
elide: Text.ElideRight
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml
index f8b8f7af..4159e7f7 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml
@@ -58,8 +58,6 @@ SwipeDelegate {
font: control.font
color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
Behavior on x {
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml
index f1ec0797..51e6b0c2 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml
@@ -57,7 +57,6 @@ Switch {
font: control.font
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#17a81a" : "#21be2b"
- horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
leftPadding: control.indicator.width + control.spacing
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml
index 00b82f79..726614d8 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml
@@ -41,7 +41,6 @@ SwitchDelegate {
opacity: enabled ? 1.0 : 0.3
color: control.down ? "#17a81a" : "#21be2b"
elide: Text.ElideRight
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
index 33cfcdc8..9d356686 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
@@ -53,21 +53,42 @@
Primary=BlueGrey
\endcode
- \section1 Imagine Style Configuration
+ \section1 Controls Section
+
+ The following values can be specified in a \c Controls section of the
+ configuration file:
+
+ \table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c Style
+ \li Specifies the style to run the application with.
+ The value can be the name of one of the \l {Available Styles}{built-in styles}
+ or a \l {Creating a Custom Style}{custom style}.
+ \row
+ \li \c FallbackStyle
+ \li Specifies the style to use for controls that are not implemented.
+ The style must be one of the \l {Available Styles}{built-in styles}.
+ By default, the \l {Default Style}{Default} style is used.
+ \endtable
+
+ \section1 Imagine Section
The following table lists values that can be used to configure the
\l {Imagine style} in an \c Imagine section of the configuration file:
\include qquickimaginestyle.qdocinc conf
- \section1 Material Style Configuration
+ \section1 Material Section
The following table lists values that can be used to configure the
\l {Material style} in a \c Material section of the configuration file:
\include qquickmaterialstyle.qdocinc conf
- \section1 Universal Style Configuration
+ \section1 Universal Section
The following table lists values that can be used to configure the
\l {Universal style} in a \c Universal section of the configuration file:
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
index 43c38745..2ce0eb92 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -108,6 +108,19 @@
\li ...
\endtable
+ \section1 License and Attributions
+
+ Qt Quick Controls 2 is available under commercial licenses from \l{The Qt Company}.
+ In addition, it is available under the
+ \l{GNU Lesser General Public License, version 3}, or
+ the \l{GNU General Public License, version 2}.
+ See \l{Qt Licensing} for further details.
+
+ Furthermore Qt Quick Controls 2 potentially contains third party
+ modules under following permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtquickcontrols2}
+
\section1 Topics
\list
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml
index d32b7299..a483e13e 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 64a89756..d5e65255 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 79fbda4f..dd319ebc 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 9d6969cf..cb0c3acc 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 55bcd71f..12f7eac4 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 b16c4d99..9d2aaac8 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 c782e6f7..2153cadc 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 7664500a..f0889782 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 78e25aab..7fc8b915 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 d41c8579..9183f8c8 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 c67523ae..b8f7a4ef 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/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"
+}
diff --git a/src/imports/controls/qquickdefaultbusyindicator.cpp b/src/imports/controls/qquickdefaultbusyindicator.cpp
index 138e94e8..c02d8128 100644
--- a/src/imports/controls/qquickdefaultbusyindicator.cpp
+++ b/src/imports/controls/qquickdefaultbusyindicator.cpp
@@ -171,6 +171,17 @@ void QQuickDefaultBusyIndicator::setFill(const QColor &fill)
update();
}
+bool QQuickDefaultBusyIndicator::isRunning() const
+{
+ return isVisible();
+}
+
+void QQuickDefaultBusyIndicator::setRunning(bool running)
+{
+ if (running)
+ setVisible(true);
+}
+
int QQuickDefaultBusyIndicator::elapsed() const
{
return m_elapsed;
@@ -179,14 +190,23 @@ int QQuickDefaultBusyIndicator::elapsed() const
void QQuickDefaultBusyIndicator::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 *QQuickDefaultBusyIndicator::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *)
{
QQuickDefaultBusyIndicatorNode *node = static_cast<QQuickDefaultBusyIndicatorNode *>(oldNode);
- if (isVisible() && width() > 0 && height() > 0) {
+ if (isRunning() && width() > 0 && height() > 0) {
if (!node) {
node = new QQuickDefaultBusyIndicatorNode(this);
node->start();
diff --git a/src/imports/controls/qquickdefaultbusyindicator_p.h b/src/imports/controls/qquickdefaultbusyindicator_p.h
index f327c8de..1beeb0c9 100644
--- a/src/imports/controls/qquickdefaultbusyindicator_p.h
+++ b/src/imports/controls/qquickdefaultbusyindicator_p.h
@@ -58,6 +58,7 @@ class QQuickDefaultBusyIndicator : public QQuickItem
Q_OBJECT
Q_PROPERTY(QColor pen READ pen WRITE setPen FINAL)
Q_PROPERTY(QColor fill READ fill WRITE setFill FINAL)
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning)
public:
explicit QQuickDefaultBusyIndicator(QQuickItem *parent = nullptr);
@@ -68,6 +69,9 @@ public:
QColor fill() const;
void setFill(const QColor &fill);
+ bool isRunning() const;
+ void setRunning(bool running);
+
int elapsed() const;
protected:
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 4ac5b7e0..464bbbdf 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -51,6 +51,8 @@
#include <QtQuickControls2/private/qquicktumblerview_p.h>
#endif
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
+#include <QtQuickControls2/private/qquickclippedtext_p.h>
+#include <QtQuickControls2/private/qquickitemgroup_p.h>
#include "qquickdefaultbusyindicator_p.h"
#include "qquickdefaultdial_p.h"
@@ -186,16 +188,24 @@ void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *ur
const QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterModule(import, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2...
+ // QtQuick.Controls.impl 2.0 (Qt 5.7)
qmlRegisterType<QQuickDefaultBusyIndicator>(import, 2, 0, "BusyIndicatorImpl");
qmlRegisterType<QQuickDefaultDial>(import, 2, 0, "DialImpl");
qmlRegisterType<QQuickPaddedRectangle>(import, 2, 0, "PaddedRectangle");
qmlRegisterType<QQuickDefaultProgressBar>(import, 2, 0, "ProgressBarImpl");
- qmlRegisterType<QQuickPlaceholderText>(import, 2, 2, "PlaceholderText");
+
+ // QtQuick.Controls.impl 2.1 (Qt 5.8)
#if QT_CONFIG(quick_listview) && QT_CONFIG(quick_pathview)
qmlRegisterType<QQuickTumblerView>(import, 2, 1, "TumblerView");
#endif
qmlRegisterSingletonType<QQuickDefaultStyle>(import, 2, 1, "Default", styleSingleton);
+ // QtQuick.Controls.impl 2.2 (Qt 5.9)
+ qmlRegisterType<QQuickClippedText>(import, 2, 2, "ClippedText");
+ qmlRegisterType<QQuickItemGroup>(import, 2, 2, "ItemGroup");
+ qmlRegisterType<QQuickPlaceholderText>(import, 2, 2, "PlaceholderText");
+
+ // QtQuick.Controls.impl 2.3 (Qt 5.10)
qmlRegisterType<QQuickColorImage>(import, 2, 3, "ColorImage");
qmlRegisterType<QQuickIconImage>(import, 2, 3, "IconImage");
qmlRegisterSingletonType<QQuickColor>(import, 2, 3, "Color", colorSingleton);
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index a0ed3da5..fa42a7e5 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -67,8 +67,6 @@ T.CheckBox {
text: control.text
font: control.font
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
opacity: enabled ? 1.0 : 0.2
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index 28c9e4cc..3d01ab84 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -100,7 +100,6 @@ T.ComboBox {
control.editable && control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.foreground
selectionColor: control.Universal.accent
selectedTextColor: control.Universal.chromeWhiteColor
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
index 75d6ba02..8a74f024 100644
--- a/src/imports/controls/universal/GroupBox.qml
+++ b/src/imports/controls/universal/GroupBox.qml
@@ -60,7 +60,6 @@ T.GroupBox {
text: control.title
font: control.font
elide: Text.ElideRight
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
opacity: enabled ? 1.0 : 0.2
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 18cb8e92..f124ffd9 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -67,8 +67,6 @@ T.RadioButton {
text: control.text
font: control.font
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
opacity: enabled ? 1.0 : 0.2
diff --git a/src/imports/controls/universal/ScrollIndicator.qml b/src/imports/controls/universal/ScrollIndicator.qml
index 3f0390f3..bdfc7e0e 100644
--- a/src/imports/controls/universal/ScrollIndicator.qml
+++ b/src/imports/controls/universal/ScrollIndicator.qml
@@ -47,8 +47,6 @@ T.ScrollIndicator {
contentItem.implicitHeight + topPadding + bottomPadding)
contentItem: Rectangle {
- id: indicator
-
implicitWidth: 6
implicitHeight: 6
@@ -66,13 +64,13 @@ T.ScrollIndicator {
transitions: [
Transition {
to: "active"
- NumberAnimation { target: indicator; property: "opacity"; to: 1.0 }
+ NumberAnimation { target: control.contentItem; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 5000 }
- NumberAnimation { target: indicator; property: "opacity"; to: 0.0 }
+ NumberAnimation { target: control.contentItem; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index 3d97f60d..db0bcc43 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -67,8 +67,6 @@ T.Switch {
text: control.text
font: control.font
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
opacity: enabled ? 1.0 : 0.2
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index ebd30bdc..d77cd74a 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -253,7 +253,7 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickPage, 1>(uri, 2, 1, "Page");
qmlRegisterType<QQuickPopup, 1>(uri, 2, 1, "Popup");
qmlRegisterType<QQuickRangeSlider, 1>(uri, 2, 1, "RangeSlider");
- qmlRegisterType<QQuickRoundButton, 1>(uri, 2, 1, "RoundButton");
+ qmlRegisterType<QQuickRoundButton>(uri, 2, 1, "RoundButton");
qmlRegisterType<QQuickSlider, 1>(uri, 2, 1, "Slider");
qmlRegisterType<QQuickSpinBox, 1>(uri, 2, 1, "SpinBox");
qmlRegisterType<QQuickStackView, 1>(uri, 2, 1, "StackView");
diff --git a/src/quickcontrols2/qquickclippedtext.cpp b/src/quickcontrols2/qquickclippedtext.cpp
new file mode 100644
index 00000000..7f113592
--- /dev/null
+++ b/src/quickcontrols2/qquickclippedtext.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickclippedtext_p.h"
+
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickClippedText::QQuickClippedText(QQuickItem *parent)
+ : QQuickText(parent),
+ m_hasClipWidth(false),
+ m_hasClipHeight(false),
+ m_clipX(0),
+ m_clipY(0),
+ m_clipWidth(0),
+ m_clipHeight(0)
+{
+}
+
+qreal QQuickClippedText::clipX() const
+{
+ return m_clipX;
+}
+
+void QQuickClippedText::setClipX(qreal x)
+{
+ if (qFuzzyCompare(x, m_clipX))
+ return;
+
+ m_clipX = x;
+ markClipDirty();
+}
+
+qreal QQuickClippedText::clipY() const
+{
+ return m_clipY;
+}
+
+void QQuickClippedText::setClipY(qreal y)
+{
+ if (qFuzzyCompare(y, m_clipY))
+ return;
+
+ m_clipY = y;
+ markClipDirty();
+}
+
+qreal QQuickClippedText::clipWidth() const
+{
+ return m_clipWidth ? m_clipWidth : width();
+}
+
+void QQuickClippedText::setClipWidth(qreal width)
+{
+ m_hasClipWidth = true;
+ if (qFuzzyCompare(width, m_clipWidth))
+ return;
+
+ m_clipWidth = width;
+ markClipDirty();
+}
+
+qreal QQuickClippedText::clipHeight() const
+{
+ return m_clipHeight ? m_clipHeight : height();
+}
+
+void QQuickClippedText::setClipHeight(qreal height)
+{
+ m_hasClipHeight = true;
+ if (qFuzzyCompare(height, m_clipHeight))
+ return;
+
+ m_clipHeight = height;
+ markClipDirty();
+}
+
+QRectF QQuickClippedText::clipRect() const
+{
+ return QRectF(clipX(), clipY(), clipWidth(), clipHeight());
+}
+
+void QQuickClippedText::markClipDirty()
+{
+ QQuickItemPrivate::get(this)->dirty(QQuickItemPrivate::Size);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickclippedtext_p.h b/src/quickcontrols2/qquickclippedtext_p.h
new file mode 100644
index 00000000..7521525f
--- /dev/null
+++ b/src/quickcontrols2/qquickclippedtext_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCLIPPEDTEXT_P_H
+#define QQUICKCLIPPEDTEXT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickClippedText : public QQuickText
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal clipX READ clipX WRITE setClipX FINAL)
+ Q_PROPERTY(qreal clipY READ clipY WRITE setClipY FINAL)
+ Q_PROPERTY(qreal clipWidth READ clipWidth WRITE setClipWidth FINAL)
+ Q_PROPERTY(qreal clipHeight READ clipHeight WRITE setClipHeight FINAL)
+
+public:
+ explicit QQuickClippedText(QQuickItem *parent = nullptr);
+
+ qreal clipX() const;
+ void setClipX(qreal x);
+
+ qreal clipY() const;
+ void setClipY(qreal y);
+
+ qreal clipWidth() const;
+ void setClipWidth(qreal width);
+
+ qreal clipHeight() const;
+ void setClipHeight(qreal height);
+
+ QRectF clipRect() const override;
+
+private:
+ void markClipDirty();
+
+ bool m_hasClipWidth;
+ bool m_hasClipHeight;
+ qreal m_clipX;
+ qreal m_clipY;
+ qreal m_clipWidth;
+ qreal m_clipHeight;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickClippedText)
+
+#endif // QQUICKCLIPPEDTEXT_P_H
diff --git a/src/quickcontrols2/qquickitemgroup.cpp b/src/quickcontrols2/qquickitemgroup.cpp
new file mode 100644
index 00000000..1396a871
--- /dev/null
+++ b/src/quickcontrols2/qquickitemgroup.cpp
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickitemgroup_p.h"
+
+#include <QtQuick/private/qquickimplicitsizeitem_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickItemGroup::QQuickItemGroup(QQuickItem *parent)
+ : QQuickImplicitSizeItem(*(new QQuickImplicitSizeItemPrivate), parent)
+{
+}
+
+QQuickItemGroup::~QQuickItemGroup()
+{
+ const auto children = childItems();
+ for (QQuickItem *child : children)
+ unwatch(child);
+}
+
+void QQuickItemGroup::watch(QQuickItem *item)
+{
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+}
+
+void QQuickItemGroup::unwatch(QQuickItem *item)
+{
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+}
+
+QSizeF QQuickItemGroup::calculateImplicitSize() const
+{
+ qreal width = 0;
+ qreal height = 0;
+ const auto children = childItems();
+ for (QQuickItem *child : children) {
+ width = qMax(width, child->implicitWidth());
+ height = qMax(height, child->implicitHeight());
+ }
+ return QSizeF(width, height);
+}
+
+void QQuickItemGroup::updateImplicitSize()
+{
+ QSizeF size = calculateImplicitSize();
+ setImplicitSize(size.width(), size.height());
+}
+
+void QQuickItemGroup::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ QQuickImplicitSizeItem::itemChange(change, data);
+ switch (change) {
+ case ItemChildAddedChange:
+ watch(data.item);
+ data.item->setSize(QSizeF(width(), height()));
+ updateImplicitSize();
+ break;
+ case ItemChildRemovedChange:
+ unwatch(data.item);
+ updateImplicitSize();
+ break;
+ default:
+ break;
+ }
+}
+
+void QQuickItemGroup::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ QQuickImplicitSizeItem::geometryChanged(newGeometry, oldGeometry);
+
+ if (newGeometry.size() != oldGeometry.size()) {
+ const auto children = childItems();
+ for (QQuickItem *child : children)
+ child->setSize(newGeometry.size());
+ }
+}
+
+void QQuickItemGroup::itemImplicitWidthChanged(QQuickItem *)
+{
+ setImplicitWidth(calculateImplicitSize().width());
+}
+
+void QQuickItemGroup::itemImplicitHeightChanged(QQuickItem *)
+{
+ setImplicitHeight(calculateImplicitSize().height());
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickitemgroup_p.h b/src/quickcontrols2/qquickitemgroup_p.h
new file mode 100644
index 00000000..af062d57
--- /dev/null
+++ b/src/quickcontrols2/qquickitemgroup_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKITEMGROUP_P_H
+#define QQUICKITEMGROUP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquickimplicitsizeitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickItemGroup : public QQuickImplicitSizeItem, protected QQuickItemChangeListener
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickItemGroup(QQuickItem *parent = nullptr);
+ ~QQuickItemGroup();
+
+protected:
+ void watch(QQuickItem *item);
+ void unwatch(QQuickItem *item);
+
+ QSizeF calculateImplicitSize() const;
+ void updateImplicitSize();
+
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickItemGroup)
+
+#endif // QQUICKITEMGROUP_P_H
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index c9c5ba54..800341d7 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -379,6 +379,8 @@ QString QQuickStyle::path()
\note The style must be configured \b before loading QML that imports Qt Quick Controls 2.
It is not possible to change the style after the QML types have been registered.
+
+ \sa setFallbackStyle(), {Using Styles in Qt Quick Controls 2}
*/
void QQuickStyle::setStyle(const QString &style)
{
@@ -401,6 +403,8 @@ void QQuickStyle::setStyle(const QString &style)
The fallback style can be also specified by setting the \c QT_QUICK_CONTROLS_FALLBACK_STYLE
\l {Supported Environment Variables in Qt Quick Controls 2}{environment variable}.
+
+ \sa setStyle(), {Using Styles in Qt Quick Controls 2}
*/
void QQuickStyle::setFallbackStyle(const QString &style)
{
diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp
index 0e403dc1..d5543c17 100644
--- a/src/quickcontrols2/qquickstyleselector.cpp
+++ b/src/quickcontrols2/qquickstyleselector.cpp
@@ -6,27 +6,33 @@
**
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quickcontrols2/qquickstyleselector_p.h b/src/quickcontrols2/qquickstyleselector_p.h
index 086157dc..29dba836 100644
--- a/src/quickcontrols2/qquickstyleselector_p.h
+++ b/src/quickcontrols2/qquickstyleselector_p.h
@@ -6,27 +6,33 @@
**
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quickcontrols2/qquickstyleselector_p_p.h b/src/quickcontrols2/qquickstyleselector_p_p.h
index b8f717c8..e940cd87 100644
--- a/src/quickcontrols2/qquickstyleselector_p_p.h
+++ b/src/quickcontrols2/qquickstyleselector_p_p.h
@@ -6,27 +6,33 @@
**
** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
diff --git a/src/quickcontrols2/quickcontrols2.pri b/src/quickcontrols2/quickcontrols2.pri
index 6537a599..ac20b78d 100644
--- a/src/quickcontrols2/quickcontrols2.pri
+++ b/src/quickcontrols2/quickcontrols2.pri
@@ -2,12 +2,14 @@ HEADERS += \
$$PWD/qquickanimatednode_p.h \
$$PWD/qquickattachedobject_p.h \
$$PWD/qquickchecklabel_p.h \
+ $$PWD/qquickclippedtext_p.h \
$$PWD/qquickcolor_p.h \
$$PWD/qquickcolorimage_p.h \
$$PWD/qquickiconimage_p.h \
$$PWD/qquickiconimage_p_p.h \
$$PWD/qquickiconlabel_p.h \
$$PWD/qquickiconlabel_p_p.h \
+ $$PWD/qquickitemgroup_p.h \
$$PWD/qquickmnemoniclabel_p.h \
$$PWD/qquickpaddedrectangle_p.h \
$$PWD/qquickplaceholdertext_p.h \
@@ -23,10 +25,12 @@ SOURCES += \
$$PWD/qquickanimatednode.cpp \
$$PWD/qquickattachedobject.cpp \
$$PWD/qquickchecklabel.cpp \
+ $$PWD/qquickclippedtext.cpp \
$$PWD/qquickcolor.cpp \
$$PWD/qquickcolorimage.cpp \
$$PWD/qquickiconimage.cpp \
$$PWD/qquickiconlabel.cpp \
+ $$PWD/qquickitemgroup.cpp \
$$PWD/qquickmnemoniclabel.cpp \
$$PWD/qquickpaddedrectangle.cpp \
$$PWD/qquickplaceholdertext.cpp \
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index be7d35a2..b1522995 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -333,13 +333,19 @@ void QQuickAbstractButtonPrivate::toggle(bool value)
static inline QString indicatorName() { return QStringLiteral("indicator"); }
+void QQuickAbstractButtonPrivate::cancelIndicator()
+{
+ Q_Q(QQuickAbstractButton);
+ quickCancelDeferred(q, indicatorName());
+}
+
void QQuickAbstractButtonPrivate::executeIndicator(bool complete)
{
- Q_Q(QQuickControl);
+ Q_Q(QQuickAbstractButton);
if (indicator.wasExecuted())
return;
- if (!indicator)
+ if (!indicator || complete)
quickBeginDeferred(q, indicatorName(), indicator);
if (complete)
quickCompleteDeferred(q, indicatorName(), indicator);
@@ -649,6 +655,9 @@ void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
if (d->indicator == indicator)
return;
+ if (!d->indicator.isExecuting())
+ d->cancelIndicator();
+
delete d->indicator;
d->indicator = indicator;
if (indicator) {
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index cdf7419e..3b2a87f2 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -97,6 +97,7 @@ public:
void trigger();
void toggle(bool value);
+ void cancelIndicator();
void executeIndicator(bool complete = false);
QString text;
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 94b0de98..687b4233 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -166,6 +166,7 @@ public:
static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
+ void cancelBackground();
void executeBackground(bool complete = false);
bool complete;
@@ -334,13 +335,19 @@ void QQuickApplicationWindowPrivate::contentData_append(QQmlListProperty<QObject
static inline QString backgroundName() { return QStringLiteral("background"); }
+void QQuickApplicationWindowPrivate::cancelBackground()
+{
+ Q_Q(QQuickApplicationWindow);
+ quickCancelDeferred(q, backgroundName());
+}
+
void QQuickApplicationWindowPrivate::executeBackground(bool complete)
{
Q_Q(QQuickApplicationWindow);
if (background.wasExecuted())
return;
- if (!background)
+ if (!background || complete)
quickBeginDeferred(q, backgroundName(), background);
if (complete)
quickCompleteDeferred(q, backgroundName(), background);
@@ -404,6 +411,9 @@ void QQuickApplicationWindow::setBackground(QQuickItem *background)
if (d->background == background)
return;
+ if (!d->background.isExecuting())
+ d->cancelBackground();
+
delete d->background;
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 3b37900d..f1e05b7e 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -256,7 +256,10 @@ public:
void handleRelease(const QPointF &point) override;
void handleUngrab() override;
+ void cancelIndicator();
void executeIndicator(bool complete = false);
+
+ void cancelPopup();
void executePopup(bool complete = false);
bool flat;
@@ -704,13 +707,19 @@ void QQuickComboBoxPrivate::handleUngrab()
static inline QString indicatorName() { return QStringLiteral("indicator"); }
+void QQuickComboBoxPrivate::cancelIndicator()
+{
+ Q_Q(QQuickComboBox);
+ quickCancelDeferred(q, indicatorName());
+}
+
void QQuickComboBoxPrivate::executeIndicator(bool complete)
{
Q_Q(QQuickComboBox);
if (indicator.wasExecuted())
return;
- if (!indicator)
+ if (!indicator || complete)
quickBeginDeferred(q, indicatorName(), indicator);
if (complete)
quickCompleteDeferred(q, indicatorName(), indicator);
@@ -718,13 +727,19 @@ void QQuickComboBoxPrivate::executeIndicator(bool complete)
static inline QString popupName() { return QStringLiteral("popup"); }
+void QQuickComboBoxPrivate::cancelPopup()
+{
+ Q_Q(QQuickComboBox);
+ quickCancelDeferred(q, popupName());
+}
+
void QQuickComboBoxPrivate::executePopup(bool complete)
{
Q_Q(QQuickComboBox);
if (popup.wasExecuted())
return;
- if (!popup)
+ if (!popup || complete)
quickBeginDeferred(q, popupName(), popup);
if (complete)
quickCompleteDeferred(q, popupName(), popup);
@@ -1048,6 +1063,9 @@ void QQuickComboBox::setIndicator(QQuickItem *indicator)
if (d->indicator == indicator)
return;
+ if (!d->indicator.isExecuting())
+ d->cancelIndicator();
+
delete d->indicator;
d->indicator = indicator;
if (indicator) {
@@ -1085,6 +1103,9 @@ void QQuickComboBox::setPopup(QQuickPopup *popup)
if (d->popup == popup)
return;
+ if (!d->popup.isExecuting())
+ d->cancelPopup();
+
if (d->popup) {
QObjectPrivate::disconnect(d->popup.data(), &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::popupVisibleChanged);
delete d->popup;
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 76d6a688..f860bcad 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -291,6 +291,9 @@ void QQuickControlPrivate::setContentItem_helper(QQuickItem *item, bool notify)
if (contentItem == item)
return;
+ if (!contentItem.isExecuting())
+ cancelContentItem();
+
q->contentItemChange(item, contentItem);
delete contentItem;
contentItem = item;
@@ -649,13 +652,19 @@ bool QQuickControlPrivate::calcHoverEnabled(const QQuickItem *item)
static inline QString contentItemName() { return QStringLiteral("contentItem"); }
+void QQuickControlPrivate::cancelContentItem()
+{
+ Q_Q(QQuickControl);
+ quickCancelDeferred(q, contentItemName());
+}
+
void QQuickControlPrivate::executeContentItem(bool complete)
{
Q_Q(QQuickControl);
if (contentItem.wasExecuted())
return;
- if (!contentItem)
+ if (!contentItem || complete)
quickBeginDeferred(q, contentItemName(), contentItem);
if (complete)
quickCompleteDeferred(q, contentItemName(), contentItem);
@@ -663,13 +672,19 @@ void QQuickControlPrivate::executeContentItem(bool complete)
static inline QString backgroundName() { return QStringLiteral("background"); }
+void QQuickControlPrivate::cancelBackground()
+{
+ Q_Q(QQuickControl);
+ quickCancelDeferred(q, backgroundName());
+}
+
void QQuickControlPrivate::executeBackground(bool complete)
{
Q_Q(QQuickControl);
if (background.wasExecuted())
return;
- if (!background)
+ if (!background || complete)
quickBeginDeferred(q, backgroundName(), background);
if (complete)
quickCompleteDeferred(q, backgroundName(), background);
@@ -1313,6 +1328,9 @@ void QQuickControl::setBackground(QQuickItem *background)
if (d->background == background)
return;
+ if (!d->background.isExecuting())
+ d->cancelBackground();
+
delete d->background;
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
index f159c96d..3fe0a65b 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -140,8 +140,11 @@ public:
static bool calcHoverEnabled(const QQuickItem *item);
#endif
- void executeContentItem(bool complete = false);
- void executeBackground(bool complete = false);
+ virtual void cancelContentItem();
+ virtual void executeContentItem(bool complete = false);
+
+ virtual void cancelBackground();
+ virtual void executeBackground(bool complete = false);
static void destroyDelegate(QObject *object, QObject *parent);
diff --git a/src/quicktemplates2/qquickdeferredexecute.cpp b/src/quicktemplates2/qquickdeferredexecute.cpp
index 802ed3d0..ca6953bc 100644
--- a/src/quicktemplates2/qquickdeferredexecute.cpp
+++ b/src/quicktemplates2/qquickdeferredexecute.cpp
@@ -55,13 +55,24 @@ static inline uint qHash(QObject *object, const QString &propertyName)
Q_GLOBAL_STATIC(DeferredStates, deferredStates)
-static void beginDeferred(QQmlEnginePrivate *enginePriv, const QQmlProperty &property, QQmlComponentPrivate::DeferredState *deferredState)
+static void cancelDeferred(QObject *object, int propertyIndex)
+{
+ QQmlData *ddata = QQmlData::get(object);
+ auto dit = ddata->deferredData.rbegin();
+ while (dit != ddata->deferredData.rend()) {
+ (*dit)->bindings.remove(propertyIndex);
+ ++dit;
+ }
+}
+
+static bool beginDeferred(QQmlEnginePrivate *enginePriv, const QQmlProperty &property, QQmlComponentPrivate::DeferredState *deferredState)
{
QObject *object = property.object();
QQmlData *ddata = QQmlData::get(object);
Q_ASSERT(!ddata->deferredData.isEmpty());
int propertyIndex = property.index();
+ int wasInProgress = enginePriv->inProgressCreations;
for (auto dit = ddata->deferredData.rbegin(); dit != ddata->deferredData.rend(); ++dit) {
QQmlData::DeferredData *deferData = *dit;
@@ -91,12 +102,11 @@ static void beginDeferred(QQmlEnginePrivate *enginePriv, const QQmlProperty &pro
// Cleanup any remaining deferred bindings for this property, also in inner contexts,
// to avoid executing them later and overriding the property that was just populated.
- while (dit != ddata->deferredData.rend()) {
- (*dit)->bindings.remove(propertyIndex);
- ++dit;
- }
+ cancelDeferred(object, propertyIndex);
break;
}
+
+ return enginePriv->inProgressCreations > wasInProgress;
}
void beginDeferred(QObject *object, const QString &property)
@@ -106,15 +116,21 @@ void beginDeferred(QObject *object, const QString &property)
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(data->context->engine);
QQmlComponentPrivate::DeferredState *state = new QQmlComponentPrivate::DeferredState;
- beginDeferred(ep, QQmlProperty(object, property), state);
+ if (beginDeferred(ep, QQmlProperty(object, property), state))
+ deferredStates()->insert(qHash(object, property), state);
+ else
+ delete state;
// Release deferred data for those compilation units that no longer have deferred bindings
data->releaseDeferredData();
-
- deferredStates()->insert(qHash(object, property), state);
}
}
+void cancelDeferred(QObject *object, const QString &property)
+{
+ cancelDeferred(object, QQmlProperty(object, property).index());
+}
+
void completeDeferred(QObject *object, const QString &property)
{
QQmlData *data = QQmlData::get(object);
diff --git a/src/quicktemplates2/qquickdeferredexecute_p_p.h b/src/quicktemplates2/qquickdeferredexecute_p_p.h
index 87124e48..400c5734 100644
--- a/src/quicktemplates2/qquickdeferredexecute_p_p.h
+++ b/src/quicktemplates2/qquickdeferredexecute_p_p.h
@@ -58,25 +58,28 @@ class QObject;
namespace QtQuickPrivate {
void beginDeferred(QObject *object, const QString &property);
+ void cancelDeferred(QObject *object, const QString &property);
void completeDeferred(QObject *object, const QString &property);
}
template<typename T>
void quickBeginDeferred(QObject *object, const QString &property, QQuickDeferredPointer<T> &delegate)
{
- Q_ASSERT(delegate.isNull());
delegate.setExecuting(true);
QtQuickPrivate::beginDeferred(object, property);
delegate.setExecuting(false);
}
+inline void quickCancelDeferred(QObject *object, const QString &property)
+{
+ QtQuickPrivate::cancelDeferred(object, property);
+}
+
template<typename T>
void quickCompleteDeferred(QObject *object, const QString &property, QQuickDeferredPointer<T> &delegate)
{
Q_ASSERT(!delegate.wasExecuted());
- delegate.setExecuting(true);
QtQuickPrivate::completeDeferred(object, property);
- delegate.setExecuting(false);
delegate.setExecuted();
}
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index 964cefe1..b5957069 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -123,6 +123,7 @@ public:
void handleRelease(const QPointF &point) override;
void handleUngrab() override;
+ void cancelHandle();
void executeHandle(bool complete = false);
qreal from;
@@ -258,13 +259,19 @@ void QQuickDialPrivate::handleUngrab()
static inline QString handleName() { return QStringLiteral("handle"); }
+void QQuickDialPrivate::cancelHandle()
+{
+ Q_Q(QQuickDial);
+ quickCancelDeferred(q, handleName());
+}
+
void QQuickDialPrivate::executeHandle(bool complete)
{
Q_Q(QQuickDial);
if (handle.wasExecuted())
return;
- if (!handle)
+ if (!handle || complete)
quickBeginDeferred(q, handleName(), handle);
if (complete)
quickCompleteDeferred(q, handleName(), handle);
@@ -553,6 +560,9 @@ void QQuickDial::setHandle(QQuickItem *handle)
if (handle == d->handle)
return;
+ if (!d->handle.isExecuting())
+ d->cancelHandle();
+
delete d->handle;
d->handle = handle;
if (d->handle && !d->handle->parentItem())
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 022c9dbf..202d02d1 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -79,6 +79,11 @@ QT_BEGIN_NAMESPACE
id: drawer
width: 0.66 * window.width
height: window.height
+
+ Label {
+ text: "Content goes here!"
+ anchors.centerIn: parent
+ }
}
}
\endcode
diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp
index c127192c..4f4c5eed 100644
--- a/src/quicktemplates2/qquickgroupbox.cpp
+++ b/src/quicktemplates2/qquickgroupbox.cpp
@@ -91,6 +91,7 @@ class QQuickGroupBoxPrivate : public QQuickFramePrivate
public:
QQuickGroupBoxPrivate() : label(nullptr) { }
+ void cancelLabel();
void executeLabel(bool complete = false);
QString title;
@@ -99,13 +100,19 @@ public:
static inline QString labelName() { return QStringLiteral("label"); }
+void QQuickGroupBoxPrivate::cancelLabel()
+{
+ Q_Q(QQuickGroupBox);
+ quickCancelDeferred(q, labelName());
+}
+
void QQuickGroupBoxPrivate::executeLabel(bool complete)
{
Q_Q(QQuickGroupBox);
if (label.wasExecuted())
return;
- if (!label)
+ if (!label || complete)
quickBeginDeferred(q, labelName(), label);
if (complete)
quickCompleteDeferred(q, labelName(), label);
@@ -162,6 +169,9 @@ void QQuickGroupBox::setLabel(QQuickItem *label)
if (d->label == label)
return;
+ if (!d->label.isExecuting())
+ d->cancelLabel();
+
delete d->label;
d->label = label;
if (label && !label->parentItem())
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index d27393ae..41b2d93a 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -205,13 +205,19 @@ QAccessible::Role QQuickLabelPrivate::accessibleRole() const
static inline QString backgroundName() { return QStringLiteral("background"); }
+void QQuickLabelPrivate::cancelBackground()
+{
+ Q_Q(QQuickLabel);
+ quickCancelDeferred(q, backgroundName());
+}
+
void QQuickLabelPrivate::executeBackground(bool complete)
{
Q_Q(QQuickLabel);
if (background.wasExecuted())
return;
- if (!background)
+ if (!background || complete)
quickBeginDeferred(q, backgroundName(), background);
if (complete)
quickCompleteDeferred(q, backgroundName(), background);
@@ -264,6 +270,9 @@ void QQuickLabel::setBackground(QQuickItem *background)
if (d->background == background)
return;
+ if (!d->background.isExecuting())
+ d->cancelBackground();
+
delete d->background;
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquicklabel_p_p.h b/src/quicktemplates2/qquicklabel_p_p.h
index 5f432a22..bcd1aca6 100644
--- a/src/quicktemplates2/qquicklabel_p_p.h
+++ b/src/quicktemplates2/qquicklabel_p_p.h
@@ -99,6 +99,7 @@ public:
QAccessible::Role accessibleRole() const override;
#endif
+ void cancelBackground();
void executeBackground(bool complete = false);
struct ExtraData {
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 7ebeb344..5dbfe3d9 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -1013,6 +1013,9 @@ QVariant QQuickMenu::contentModel() const
*/
QQmlListProperty<QObject> QQuickMenu::contentData()
{
+ Q_D(QQuickMenu);
+ if (!d->contentItem)
+ QQuickControlPrivate::get(d->popupItem)->executeContentItem();
return QQmlListProperty<QObject>(this, nullptr,
QQuickMenuPrivate::contentData_append,
QQuickMenuPrivate::contentData_count,
diff --git a/src/quicktemplates2/qquickpagelayout.cpp b/src/quicktemplates2/qquickpagelayout.cpp
index 99d4fe23..595db560 100644
--- a/src/quicktemplates2/qquickpagelayout.cpp
+++ b/src/quicktemplates2/qquickpagelayout.cpp
@@ -36,6 +36,7 @@
#include "qquickpagelayout_p_p.h"
#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
#include "qquicktoolbar_p.h"
#include "qquicktabbar_p.h"
#include "qquickdialogbuttonbox_p.h"
@@ -140,17 +141,19 @@ bool QQuickPageLayout::setFooter(QQuickItem *footer)
void QQuickPageLayout::update()
{
- QQuickItem *content = m_control->contentItem();
+ QQuickItem *content = QQuickControlPrivate::get(m_control)->contentItem;
const qreal hh = m_header && m_header->isVisible() ? m_header->height() : 0;
const qreal fh = m_footer && m_footer->isVisible() ? m_footer->height() : 0;
const qreal hsp = hh > 0 ? m_control->spacing() : 0;
const qreal fsp = fh > 0 ? m_control->spacing() : 0;
- content->setY(m_control->topPadding() + hh + hsp);
- content->setX(m_control->leftPadding());
- content->setWidth(m_control->availableWidth());
- content->setHeight(m_control->availableHeight() - hh - fh - hsp - fsp);
+ if (content) {
+ content->setY(m_control->topPadding() + hh + hsp);
+ content->setX(m_control->leftPadding());
+ content->setWidth(m_control->availableWidth());
+ content->setHeight(m_control->availableHeight() - hh - fh - hsp - fsp);
+ }
if (m_header)
m_header->setWidth(m_control->width());
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 472d2124..1a4c90a4 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -265,6 +265,7 @@ void QQuickPopupPrivate::init()
q->setParentItem(qobject_cast<QQuickItem *>(parent));
QObject::connect(popupItem, &QQuickItem::enabledChanged, q, &QQuickPopup::enabledChanged);
QObject::connect(popupItem, &QQuickControl::paddingChanged, q, &QQuickPopup::paddingChanged);
+ QObject::connect(popupItem, &QQuickControl::backgroundChanged, q, &QQuickPopup::backgroundChanged);
QObject::connect(popupItem, &QQuickControl::contentItemChanged, q, &QQuickPopup::contentItemChanged);
positioner = new QQuickPopupPositioner(q);
}
@@ -1605,11 +1606,7 @@ QQuickItem *QQuickPopup::background() const
void QQuickPopup::setBackground(QQuickItem *background)
{
Q_D(QQuickPopup);
- if (d->popupItem->background() == background)
- return;
-
d->popupItem->setBackground(background);
- emit backgroundChanged();
}
/*!
@@ -1662,6 +1659,9 @@ void QQuickPopup::setContentItem(QQuickItem *item)
QQmlListProperty<QObject> QQuickPopup::contentData()
{
Q_D(QQuickPopup);
+ QQuickControlPrivate *p = QQuickControlPrivate::get(d->popupItem);
+ if (!p->contentItem)
+ p->executeContentItem();
return QQmlListProperty<QObject>(d->popupItem->contentItem(), nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
@@ -2110,6 +2110,9 @@ void QQuickPopup::classBegin()
{
Q_D(QQuickPopup);
d->complete = false;
+ QQmlContext *context = qmlContext(this);
+ if (context)
+ QQmlEngine::setContextForObject(d->popupItem, context);
d->popupItem->classBegin();
}
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index ada4b649..2a42ff27 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -121,6 +121,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL REVISION 3)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL REVISION 3)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
+ Q_CLASSINFO("DeferredPropertyNames", "background,contentItem")
Q_CLASSINFO("DefaultProperty", "contentData")
public:
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index af4d03a4..566a5245 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -39,6 +39,7 @@
#include "qquickshortcutcontext_p_p.h"
#include "qquickcontrol_p_p.h"
#include "qquickpopup_p_p.h"
+#include "qquickdeferredexecute_p_p.h"
#include <QtGui/private/qshortcutmap_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -60,6 +61,12 @@ public:
QQuickItem *getContentItem() override;
+ void cancelContentItem() override;
+ void executeContentItem(bool complete = false) override;
+
+ void cancelBackground() override;
+ void executeBackground(bool complete = false) override;
+
int backId;
int escapeId;
QQuickPopup *popup;
@@ -109,6 +116,42 @@ QQuickItem *QQuickPopupItemPrivate::getContentItem()
return new QQuickItem(q);
}
+static inline QString contentItemName() { return QStringLiteral("contentItem"); }
+
+void QQuickPopupItemPrivate::cancelContentItem()
+{
+ quickCancelDeferred(popup, contentItemName());
+}
+
+void QQuickPopupItemPrivate::executeContentItem(bool complete)
+{
+ if (contentItem.wasExecuted())
+ return;
+
+ if (!contentItem || complete)
+ quickBeginDeferred(popup, contentItemName(), contentItem);
+ if (complete)
+ quickCompleteDeferred(popup, contentItemName(), contentItem);
+}
+
+static inline QString backgroundName() { return QStringLiteral("background"); }
+
+void QQuickPopupItemPrivate::cancelBackground()
+{
+ quickCancelDeferred(popup, backgroundName());
+}
+
+void QQuickPopupItemPrivate::executeBackground(bool complete)
+{
+ if (background.wasExecuted())
+ return;
+
+ if (!background || complete)
+ quickBeginDeferred(popup, backgroundName(), background);
+ if (complete)
+ quickCompleteDeferred(popup, backgroundName(), background);
+}
+
QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup)
: QQuickControl(*(new QQuickPopupItemPrivate(popup)), nullptr)
{
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 937de9c9..075306cf 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -110,6 +110,7 @@ public:
void setPosition(qreal position, bool ignoreOtherPosition = false);
void updatePosition(bool ignoreOtherPosition = false);
+ void cancelHandle();
void executeHandle(bool complete = false);
static QQuickRangeSliderNodePrivate *get(QQuickRangeSliderNode *node);
@@ -154,13 +155,19 @@ void QQuickRangeSliderNodePrivate::updatePosition(bool ignoreOtherPosition)
static inline QString handleName() { return QStringLiteral("handle"); }
+void QQuickRangeSliderNodePrivate::cancelHandle()
+{
+ Q_Q(QQuickRangeSliderNode);
+ quickCancelDeferred(q, handleName());
+}
+
void QQuickRangeSliderNodePrivate::executeHandle(bool complete)
{
Q_Q(QQuickRangeSliderNode);
if (handle.wasExecuted())
return;
- if (!handle)
+ if (!handle || complete)
quickBeginDeferred(q, handleName(), handle);
if (complete)
quickCompleteDeferred(q, handleName(), handle);
@@ -256,14 +263,17 @@ void QQuickRangeSliderNode::setHandle(QQuickItem *handle)
if (d->handle == handle)
return;
+ if (!d->handle.isExecuting())
+ d->cancelHandle();
+
delete d->handle;
d->handle = handle;
if (handle) {
if (!handle->parentItem())
handle->setParentItem(d->slider);
- QQuickItem *firstHandle = d->slider->first()->handle();
- QQuickItem *secondHandle = d->slider->second()->handle();
+ QQuickItem *firstHandle = QQuickRangeSliderNodePrivate::get(d->slider->first())->handle;
+ QQuickItem *secondHandle = QQuickRangeSliderNodePrivate::get(d->slider->second())->handle;
if (firstHandle && secondHandle) {
// The order of property assignments in QML is undefined,
// but we need the first handle to be before the second due
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 21aeda39..ef2077af 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -113,6 +113,7 @@ public:
void handleRelease(const QPointF &point) override;
void handleUngrab() override;
+ void cancelHandle();
void executeHandle(bool complete = false);
qreal from;
@@ -240,13 +241,19 @@ void QQuickSliderPrivate::handleUngrab()
static inline QString handleName() { return QStringLiteral("handle"); }
+void QQuickSliderPrivate::cancelHandle()
+{
+ Q_Q(QQuickSlider);
+ quickCancelDeferred(q, handleName());
+}
+
void QQuickSliderPrivate::executeHandle(bool complete)
{
Q_Q(QQuickSlider);
if (handle.wasExecuted())
return;
- if (!handle)
+ if (!handle || complete)
quickBeginDeferred(q, handleName(), handle);
if (complete)
quickCompleteDeferred(q, handleName(), handle);
@@ -546,6 +553,9 @@ void QQuickSlider::setHandle(QQuickItem *handle)
if (d->handle == handle)
return;
+ if (!d->handle.isExecuting())
+ d->cancelHandle();
+
delete d->handle;
d->handle = handle;
if (handle && !handle->parentItem())
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index 27dd0d5e..4b998325 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -180,6 +180,7 @@ public:
return button->d_func();
}
+ void cancelIndicator();
void executeIndicator(bool complete = false);
bool pressed;
@@ -986,13 +987,19 @@ void QQuickSpinBox::accessibilityActiveChanged(bool active)
static inline QString indicatorName() { return QStringLiteral("indicator"); }
+void QQuickSpinButtonPrivate::cancelIndicator()
+{
+ Q_Q(QQuickSpinButton);
+ quickCancelDeferred(q, indicatorName());
+}
+
void QQuickSpinButtonPrivate::executeIndicator(bool complete)
{
Q_Q(QQuickSpinButton);
if (indicator.wasExecuted())
return;
- if (!indicator)
+ if (!indicator || complete)
quickBeginDeferred(q, indicatorName(), indicator);
if (complete)
quickCompleteDeferred(q, indicatorName(), indicator);
@@ -1033,6 +1040,9 @@ void QQuickSpinButton::setIndicator(QQuickItem *indicator)
if (d->indicator == indicator)
return;
+ if (!d->indicator.isExecuting())
+ d->cancelIndicator();
+
delete d->indicator;
d->indicator = indicator;
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index 2f13b1a1..2aa41c0d 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -1068,6 +1068,13 @@ bool QQuickStackView::childMouseEventFilter(QQuickItem *item, QEvent *event)
return window && !window->mouseGrabberItem();
}
+#if QT_CONFIG(quicktemplates2_multitouch)
+void QQuickStackView::touchEvent(QTouchEvent *event)
+{
+ event->ignore(); // QTBUG-65084
+}
+#endif
+
#if QT_CONFIG(accessibility)
QAccessible::Role QQuickStackView::accessibleRole() const
{
diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h
index 2cddb800..e347ba9d 100644
--- a/src/quicktemplates2/qquickstackview_p.h
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -160,6 +160,10 @@ protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
bool childMouseEventFilter(QQuickItem *, QEvent *) override;
+#if QT_CONFIG(quicktemplates2_multitouch)
+ void touchEvent(QTouchEvent *event) override;
+#endif
+
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
#endif
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index d2458c24..319f7bbe 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -440,13 +440,19 @@ QAccessible::Role QQuickTextAreaPrivate::accessibleRole() const
static inline QString backgroundName() { return QStringLiteral("background"); }
+void QQuickTextAreaPrivate::cancelBackground()
+{
+ Q_Q(QQuickTextArea);
+ quickCancelDeferred(q, backgroundName());
+}
+
void QQuickTextAreaPrivate::executeBackground(bool complete)
{
Q_Q(QQuickTextArea);
if (background.wasExecuted())
return;
- if (!background)
+ if (!background || complete)
quickBeginDeferred(q, backgroundName(), background);
if (complete)
quickCompleteDeferred(q, backgroundName(), background);
@@ -517,6 +523,9 @@ void QQuickTextArea::setBackground(QQuickItem *background)
if (d->background == background)
return;
+ if (!d->background.isExecuting())
+ d->cancelBackground();
+
delete d->background;
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h
index d27af8f6..8621c61c 100644
--- a/src/quicktemplates2/qquicktextarea_p_p.h
+++ b/src/quicktemplates2/qquicktextarea_p_p.h
@@ -125,6 +125,7 @@ public:
QAccessible::Role accessibleRole() const override;
#endif
+ void cancelBackground();
void executeBackground(bool complete = false);
#if QT_CONFIG(quicktemplates2_hover)
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index 03da9323..49f9b4c8 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -314,13 +314,19 @@ QAccessible::Role QQuickTextFieldPrivate::accessibleRole() const
static inline QString backgroundName() { return QStringLiteral("background"); }
+void QQuickTextFieldPrivate::cancelBackground()
+{
+ Q_Q(QQuickTextField);
+ quickCancelDeferred(q, backgroundName());
+}
+
void QQuickTextFieldPrivate::executeBackground(bool complete)
{
Q_Q(QQuickTextField);
if (background.wasExecuted())
return;
- if (!background)
+ if (!background || complete)
quickBeginDeferred(q, backgroundName(), background);
if (complete)
quickCompleteDeferred(q, backgroundName(), background);
@@ -379,6 +385,9 @@ void QQuickTextField::setBackground(QQuickItem *background)
if (d->background == background)
return;
+ if (!d->background.isExecuting())
+ d->cancelBackground();
+
delete d->background;
d->background = background;
if (background) {
diff --git a/src/quicktemplates2/qquicktextfield_p_p.h b/src/quicktemplates2/qquicktextfield_p_p.h
index 5ae79b7f..41843370 100644
--- a/src/quicktemplates2/qquicktextfield_p_p.h
+++ b/src/quicktemplates2/qquicktextfield_p_p.h
@@ -113,6 +113,7 @@ public:
QAccessible::Role accessibleRole() const override;
#endif
+ void cancelBackground();
void executeBackground(bool complete = false);
#if QT_CONFIG(quicktemplates2_hover)