aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
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/Tumbler.qml10
-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/fusion/BusyIndicator.qml6
-rw-r--r--src/imports/controls/fusion/ComboBox.qml5
-rw-r--r--src/imports/controls/fusion/DelayButton.qml58
-rw-r--r--src/imports/controls/fusion/ProgressBar.qml3
-rw-r--r--src/imports/controls/fusion/RoundButton.qml12
-rw-r--r--src/imports/controls/fusion/ScrollBar.qml6
-rw-r--r--src/imports/controls/fusion/ScrollIndicator.qml6
-rw-r--r--src/imports/controls/fusion/TabButton.qml27
-rw-r--r--src/imports/controls/fusion/Tumbler.qml10
-rw-r--r--src/imports/controls/fusion/qquickfusionbusyindicator.cpp21
-rw-r--r--src/imports/controls/fusion/qquickfusionbusyindicator_p.h7
-rw-r--r--src/imports/controls/imagine/ComboBox.qml8
-rw-r--r--src/imports/controls/imagine/Tumbler.qml9
-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/Tumbler.qml10
-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/controls/universal/Tumbler.qml9
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp26
-rw-r--r--src/imports/templates/templates.pro4
-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.cpp45
-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/qquickmenuitem.cpp40
-rw-r--r--src/quicktemplates2/qquickmenuitem_p.h3
-rw-r--r--src/quicktemplates2/qquickmenuitem_p_p.h5
-rw-r--r--src/quicktemplates2/qquickpagelayout.cpp13
-rw-r--r--src/quicktemplates2/qquickpaletteprovider.cpp (renamed from src/imports/templates/qquicktemplates2valuetypeprovider.cpp)32
-rw-r--r--src/quicktemplates2/qquickpaletteprovider_p.h (renamed from src/imports/templates/qquicktemplates2valuetypeprovider_p.h)10
-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
-rw-r--r--src/quicktemplates2/quicktemplates2.pri2
103 files changed, 1104 insertions, 350 deletions
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index bff591c7..bde5fa7c 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 defbff29..2bb26967 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 e879c73f..b34caed6 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 6b96187a..f4132611 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 1a481e22..a594869b 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 b67a2564..2f8826bf 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 0025d489..6616d6c6 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 d0816c50..827c9cd6 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/Tumbler.qml b/src/imports/controls/Tumbler.qml
index 25c00162..8d5546c9 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -45,7 +45,6 @@ T.Tumbler {
implicitHeight: 200
delegate: Text {
- id: label
text: modelData
color: control.visualFocus ? control.palette.highlight : control.palette.text
font: control.font
@@ -55,15 +54,14 @@ T.Tumbler {
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/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/fusion/BusyIndicator.qml b/src/imports/controls/fusion/BusyIndicator.qml
index 1de0e973..cba5fc2e 100644
--- a/src/imports/controls/fusion/BusyIndicator.qml
+++ b/src/imports/controls/fusion/BusyIndicator.qml
@@ -54,12 +54,12 @@ T.BusyIndicator {
implicitHeight: 28
color: control.palette.text
+ running: control.running
opacity: control.running ? 1 : 0
- visible: control.running || opacityAnimator.running
- Behavior on opacity { OpacityAnimator { id: opacityAnimator; duration: 250 } }
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
RotationAnimator on rotation {
- running: control.running || opacityAnimator.running
+ running: control.running || contentItem.visible
from: 0
to: 360
duration: 1000
diff --git a/src/imports/controls/fusion/ComboBox.qml b/src/imports/controls/fusion/ComboBox.qml
index c4d49e0f..bc232759 100644
--- a/src/imports/controls/fusion/ComboBox.qml
+++ b/src/imports/controls/fusion/ComboBox.qml
@@ -81,7 +81,7 @@ T.ComboBox {
enabled: control.editable
autoScroll: control.editable
- readOnly: control.popup.visible
+ readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
@@ -140,7 +140,6 @@ T.ComboBox {
}
popup: T.Popup {
- id: popup
width: control.width
height: Math.min(contentItem.implicitHeight + 2, control.Window.height - topMargin - bottomMargin)
topMargin: 6
@@ -151,7 +150,7 @@ T.ComboBox {
contentItem: ListView {
clip: true
implicitHeight: contentHeight
- model: control.popup.visible ? control.delegateModel : null
+ model: control.delegateModel
currentIndex: control.highlightedIndex
highlightRangeMode: ListView.ApplyRange
highlightMoveDuration: 0
diff --git a/src/imports/controls/fusion/DelayButton.qml b/src/imports/controls/fusion/DelayButton.qml
index 2c8006be..261db320 100644
--- a/src/imports/controls/fusion/DelayButton.qml
+++ b/src/imports/controls/fusion/DelayButton.qml
@@ -58,53 +58,33 @@ T.DelayButton {
}
}
- contentItem: Item {
- implicitWidth: label.implicitWidth
- implicitHeight: label.implicitHeight
-
- Item {
- x: -control.leftPadding + (control.mirrored ? 0 : control.progress * control.width)
- width: control.width
- height: parent.height
-
+ contentItem: ItemGroup {
+ ClippedText {
clip: control.progress > 0
+ clipX: -control.leftPadding + (control.mirrored ? 0 : control.progress * control.width)
+ clipWidth: control.width
visible: control.mirrored ? control.progress > 0 : control.progress < 1
- Text {
- id: label
- x: -parent.x
- width: control.availableWidth
- height: parent.height
-
- text: control.text
- font: control.font
- color: control.mirrored ? control.palette.brightText : control.palette.buttonText
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- elide: Text.ElideRight
- }
+ text: control.text
+ font: control.font
+ color: control.mirrored ? control.palette.brightText : control.palette.buttonText
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
}
- Item {
- x: -control.leftPadding
- width: (control.mirrored ? 1.0 - control.progress : control.progress) * control.width
- height: parent.height
-
+ ClippedText {
clip: control.progress > 0
+ clipX: -control.leftPadding
+ clipWidth: (control.mirrored ? 1.0 - control.progress : control.progress) * control.width
visible: control.mirrored ? control.progress < 1 : control.progress > 0
- Text {
- x: -parent.x
- width: control.availableWidth
- height: parent.height
-
- text: control.text
- font: control.font
- color: control.mirrored ? control.palette.buttonText : control.palette.brightText
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- elide: Text.ElideRight
- }
+ text: control.text
+ font: control.font
+ color: control.mirrored ? control.palette.buttonText : control.palette.brightText
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
}
}
diff --git a/src/imports/controls/fusion/ProgressBar.qml b/src/imports/controls/fusion/ProgressBar.qml
index 2b4edd3d..547d5f7c 100644
--- a/src/imports/controls/fusion/ProgressBar.qml
+++ b/src/imports/controls/fusion/ProgressBar.qml
@@ -80,7 +80,6 @@ T.ProgressBar {
clip: true
ColorImage {
- id: mask
width: Math.ceil(parent.width / implicitWidth + 1) * implicitWidth
height: parent.height
@@ -92,7 +91,7 @@ T.ProgressBar {
visible: control.indeterminate
NumberAnimation on x {
running: control.indeterminate && control.visible
- from: -mask.implicitWidth
+ from: -31 // progressmask.png width
to: 0
loops: Animation.Infinite
duration: 750
diff --git a/src/imports/controls/fusion/RoundButton.qml b/src/imports/controls/fusion/RoundButton.qml
index 9ebc74dd..5d28b52c 100644
--- a/src/imports/controls/fusion/RoundButton.qml
+++ b/src/imports/controls/fusion/RoundButton.qml
@@ -72,18 +72,16 @@ T.RoundButton {
implicitHeight: 32
visible: !control.flat || control.down || control.checked
- color: Fusion.buttonColor(control.palette, control.highlighted, control.down || control.checked, control.hovered)
- gradient: control.down || control.checked ? null : buttonGradient
-
- Gradient {
- id: buttonGradient
+ gradient: Gradient {
GradientStop {
position: 0
- color: Fusion.gradientStart(Fusion.buttonColor(control.palette, control.highlighted, control.down, control.hovered))
+ color: control.down || control.checked ? Fusion.buttonColor(control.palette, control.highlighted, control.down || control.checked, control.hovered)
+ : Fusion.gradientStart(Fusion.buttonColor(control.palette, control.highlighted, control.down, control.hovered))
}
GradientStop {
position: 1
- color: Fusion.gradientStop(Fusion.buttonColor(control.palette, control.highlighted, control.down, control.hovered))
+ color: control.down || control.checked ? Fusion.buttonColor(control.palette, control.highlighted, control.down || control.checked, control.hovered)
+ : Fusion.gradientStop(Fusion.buttonColor(control.palette, control.highlighted, control.down, control.hovered))
}
}
diff --git a/src/imports/controls/fusion/ScrollBar.qml b/src/imports/controls/fusion/ScrollBar.qml
index 0de27b22..25881d2d 100644
--- a/src/imports/controls/fusion/ScrollBar.qml
+++ b/src/imports/controls/fusion/ScrollBar.qml
@@ -53,8 +53,6 @@ T.ScrollBar {
visible: control.policy !== T.ScrollBar.AlwaysOff
contentItem: Rectangle {
- id: handle
-
implicitWidth: control.interactive ? 6 : 2
implicitHeight: control.interactive ? 6 : 2
@@ -65,14 +63,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/fusion/ScrollIndicator.qml b/src/imports/controls/fusion/ScrollIndicator.qml
index f80514d6..7d6372a3 100644
--- a/src/imports/controls/fusion/ScrollIndicator.qml
+++ b/src/imports/controls/fusion/ScrollIndicator.qml
@@ -52,8 +52,6 @@ T.ScrollIndicator {
padding: 2
contentItem: Rectangle {
- id: indicator
-
implicitWidth: 2
implicitHeight: 2
@@ -64,7 +62,7 @@ T.ScrollIndicator {
states: State {
name: "active"
when: control.active
- PropertyChanges { target: indicator; opacity: 0.75 }
+ PropertyChanges { target: control.contentItem; opacity: 0.75 }
}
transitions: [
@@ -72,7 +70,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/fusion/TabButton.qml b/src/imports/controls/fusion/TabButton.qml
index 0875f327..bdcee759 100644
--- a/src/imports/controls/fusion/TabButton.qml
+++ b/src/imports/controls/fusion/TabButton.qml
@@ -77,33 +77,22 @@ T.TabButton {
height: control.height - (control.checked ? 0 : 2)
border.color: Qt.lighter(Fusion.outline(control.palette), 1.1)
- gradient: control.checked ? selectedGradient : normalGradient
- Gradient {
- id: selectedGradient
+ gradient: Gradient {
GradientStop {
position: 0
- color: Qt.lighter(Fusion.tabFrameColor(control.palette), 1.04)
+ color: control.checked ? Qt.lighter(Fusion.tabFrameColor(control.palette), 1.04)
+ : Qt.darker(Fusion.tabFrameColor(control.palette), 1.08)
}
GradientStop {
- position: 1
- color: Fusion.tabFrameColor(control.palette)
- }
- }
-
- Gradient {
- id: normalGradient
- GradientStop {
- position: 0
- color: Qt.darker(Fusion.tabFrameColor(control.palette), 1.08)
- }
- GradientStop {
- position: 0.85
- color: Qt.darker(Fusion.tabFrameColor(control.palette), 1.08)
+ position: control.checked ? 0 : 0.85
+ color: control.checked ? Qt.lighter(Fusion.tabFrameColor(control.palette), 1.04)
+ : Qt.darker(Fusion.tabFrameColor(control.palette), 1.08)
}
GradientStop {
position: 1
- color: Qt.darker(Fusion.tabFrameColor(control.palette), 1.16)
+ color: control.checked ? Fusion.tabFrameColor(control.palette)
+ : Qt.darker(Fusion.tabFrameColor(control.palette), 1.16)
}
}
}
diff --git a/src/imports/controls/fusion/Tumbler.qml b/src/imports/controls/fusion/Tumbler.qml
index d4a8cc7e..75815f15 100644
--- a/src/imports/controls/fusion/Tumbler.qml
+++ b/src/imports/controls/fusion/Tumbler.qml
@@ -47,7 +47,6 @@ T.Tumbler {
implicitHeight: 200
delegate: Text {
- id: label
text: modelData
color: control.palette.windowText
font: control.font
@@ -57,15 +56,14 @@ T.Tumbler {
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/fusion/qquickfusionbusyindicator.cpp b/src/imports/controls/fusion/qquickfusionbusyindicator.cpp
index 7254b7b7..f5c92010 100644
--- a/src/imports/controls/fusion/qquickfusionbusyindicator.cpp
+++ b/src/imports/controls/fusion/qquickfusionbusyindicator.cpp
@@ -59,11 +59,22 @@ void QQuickFusionBusyIndicator::setColor(const QColor &color)
update();
}
+bool QQuickFusionBusyIndicator::isRunning() const
+{
+ return isVisible();
+}
+
+void QQuickFusionBusyIndicator::setRunning(bool running)
+{
+ if (running)
+ setVisible(true);
+}
+
void QQuickFusionBusyIndicator::paint(QPainter *painter)
{
const qreal w = width();
const qreal h = height();
- if (w <= 0 || h <= 0 || !isVisible())
+ if (w <= 0 || h <= 0 || !isRunning())
return;
const qreal sz = qMin(w, h);
@@ -87,4 +98,12 @@ void QQuickFusionBusyIndicator::paint(QPainter *painter)
painter->drawArc(bounds, 0, 20 * 16);
}
+void QQuickFusionBusyIndicator::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ QQuickPaintedItem::itemChange(change, data);
+
+ if (change == ItemOpacityHasChanged && qFuzzyIsNull(data.realValue))
+ setVisible(false);
+}
+
QT_END_NAMESPACE
diff --git a/src/imports/controls/fusion/qquickfusionbusyindicator_p.h b/src/imports/controls/fusion/qquickfusionbusyindicator_p.h
index c8af3311..77487ec8 100644
--- a/src/imports/controls/fusion/qquickfusionbusyindicator_p.h
+++ b/src/imports/controls/fusion/qquickfusionbusyindicator_p.h
@@ -57,6 +57,7 @@ class QQuickFusionBusyIndicator : public QQuickPaintedItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning)
public:
explicit QQuickFusionBusyIndicator(QQuickItem *parent = nullptr);
@@ -64,8 +65,14 @@ public:
QColor color() const;
void setColor(const QColor &color);
+ bool isRunning() const;
+ void setRunning(bool running);
+
void paint(QPainter *painter) override;
+protected:
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+
private:
QColor m_color;
};
diff --git a/src/imports/controls/imagine/ComboBox.qml b/src/imports/controls/imagine/ComboBox.qml
index eae8569e..fa22ab90 100644
--- a/src/imports/controls/imagine/ComboBox.qml
+++ b/src/imports/controls/imagine/ComboBox.qml
@@ -71,7 +71,7 @@ T.ComboBox {
{"disabled": !control.enabled},
{"pressed": control.pressed},
{"editable": control.editable},
- {"open": control.popup.visible},
+ {"open": control.down},
{"focused": control.visualFocus},
{"mirrored": control.mirrored},
{"hovered": control.hovered},
@@ -90,7 +90,7 @@ T.ComboBox {
enabled: control.editable
autoScroll: control.editable
- readOnly: control.popup.visible
+ readOnly: control.down
inputMethodHints: control.inputMethodHints
validator: control.validator
@@ -112,7 +112,7 @@ T.ComboBox {
{"disabled": !control.enabled},
{"pressed": control.pressed},
{"editable": control.editable},
- {"open": control.popup.visible},
+ {"open": control.down},
{"focused": control.visualFocus || (control.editable && control.activeFocus)},
{"mirrored": control.mirrored},
{"hovered": control.hovered},
@@ -142,7 +142,7 @@ T.ComboBox {
contentItem: ListView {
clip: true
implicitHeight: contentHeight
- model: control.popup.visible ? control.delegateModel : null
+ model: control.delegateModel
currentIndex: control.highlightedIndex
highlightMoveDuration: 0
diff --git a/src/imports/controls/imagine/Tumbler.qml b/src/imports/controls/imagine/Tumbler.qml
index 7cd2b6a9..0fa8c137 100644
--- a/src/imports/controls/imagine/Tumbler.qml
+++ b/src/imports/controls/imagine/Tumbler.qml
@@ -56,15 +56,14 @@ T.Tumbler {
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml
index 8fc64029..5e53bdb9 100644
--- a/src/imports/controls/material/BusyIndicator.qml
+++ b/src/imports/controls/material/BusyIndicator.qml
@@ -52,8 +52,8 @@ T.BusyIndicator {
implicitHeight: 48
color: control.Material.accentColor
+ running: control.running
opacity: control.running ? 1 : 0
- visible: control.running || animator.running
- Behavior on opacity { OpacityAnimator { id: animator; duration: 250 } }
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
}
}
diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml
index 2a4d4e7c..1f818e6e 100644
--- a/src/imports/controls/material/CheckBox.qml
+++ b/src/imports/controls/material/CheckBox.qml
@@ -80,8 +80,6 @@ T.CheckBox {
font: control.font
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index a58f1a37..3dd3cf30 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -92,7 +92,6 @@ T.ComboBox {
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
selectionColor: control.Material.accentColor
selectedTextColor: control.Material.primaryHighlightedTextColor
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
cursorDelegate: CursorDelegate { }
diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml
index eec16838..3d94df18 100644
--- a/src/imports/controls/material/Dial.qml
+++ b/src/imports/controls/material/Dial.qml
@@ -57,8 +57,6 @@ T.Dial {
}
handle: SliderHandle {
- id: handleItem
-
x: background.x + background.width / 2 - handle.width / 2
y: background.y + background.height / 2 - handle.height / 2
transform: [
diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml
index 5b1e7813..cc2ab0f0 100644
--- a/src/imports/controls/material/GroupBox.qml
+++ b/src/imports/controls/material/GroupBox.qml
@@ -62,7 +62,6 @@ T.GroupBox {
font: control.font
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
diff --git a/src/imports/controls/material/LICENSE_ANGULARJS.txt b/src/imports/controls/material/LICENSE_ANGULARJS.txt
new file mode 100644
index 00000000..c1f2a826
--- /dev/null
+++ b/src/imports/controls/material/LICENSE_ANGULARJS.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2014-2016 Google, Inc. http://angularjs.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index 573dfd70..2a95f989 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -80,8 +80,6 @@ T.RadioButton {
font: control.font
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml
index 2b5fa12f..2ff925af 100644
--- a/src/imports/controls/material/ScrollBar.qml
+++ b/src/imports/controls/material/ScrollBar.qml
@@ -50,8 +50,6 @@ T.ScrollBar {
visible: control.policy !== T.ScrollBar.AlwaysOff
contentItem: Rectangle {
- id: handle
-
implicitWidth: control.interactive ? 13 : 4
implicitHeight: control.interactive ? 13 : 4
diff --git a/src/imports/controls/material/ScrollIndicator.qml b/src/imports/controls/material/ScrollIndicator.qml
index 37a8429b..92727822 100644
--- a/src/imports/controls/material/ScrollIndicator.qml
+++ b/src/imports/controls/material/ScrollIndicator.qml
@@ -49,8 +49,6 @@ T.ScrollIndicator {
padding: 2
contentItem: Rectangle {
- id: indicator
-
implicitWidth: 4
implicitHeight: 4
@@ -61,7 +59,7 @@ T.ScrollIndicator {
states: State {
name: "active"
when: control.active
- PropertyChanges { target: indicator; opacity: 0.75 }
+ PropertyChanges { target: control.contentItem; opacity: 0.75 }
}
transitions: [
@@ -69,7 +67,7 @@ T.ScrollIndicator {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 450 }
- NumberAnimation { target: indicator; duration: 200; property: "opacity"; to: 0.0 }
+ NumberAnimation { target: control.contentItem; duration: 200; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml
index d5915d9f..eb753579 100644
--- a/src/imports/controls/material/SwipeView.qml
+++ b/src/imports/controls/material/SwipeView.qml
@@ -60,5 +60,6 @@ T.SwipeView {
preferredHighlightBegin: 0
preferredHighlightEnd: 0
highlightMoveDuration: 250
+ maximumFlickVelocity: 4 * (control.orientation === Qt.Horizontal ? width : height)
}
}
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index 0434fb7f..d44a9f2c 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -75,8 +75,6 @@ T.Switch {
font: control.font
color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
- visible: control.text
- horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml
index 369c7f3b..86a9f5c0 100644
--- a/src/imports/controls/material/ToolButton.qml
+++ b/src/imports/controls/material/ToolButton.qml
@@ -73,7 +73,7 @@ T.ToolButton {
implicitWidth: 48
implicitHeight: 48
- readonly property bool square: control.contentItem.implicitWidth <= control.contentItem.implicitHeight
+ readonly property bool square: control.contentItem.width <= control.contentItem.height
x: (parent.width - width) / 2
y: (parent.height - height) / 2
diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml
index e3fdd869..eff1ff47 100644
--- a/src/imports/controls/material/Tumbler.qml
+++ b/src/imports/controls/material/Tumbler.qml
@@ -46,7 +46,6 @@ T.Tumbler {
implicitHeight: 200
delegate: Text {
- id: label
text: modelData
color: control.Material.foreground
font: control.font
@@ -56,15 +55,14 @@ T.Tumbler {
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator.cpp b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
index 9df8f5d2..bd15390b 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator.cpp
+++ b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
@@ -197,6 +197,17 @@ void QQuickMaterialBusyIndicator::setColor(QColor color)
update();
}
+bool QQuickMaterialBusyIndicator::isRunning() const
+{
+ return isVisible();
+}
+
+void QQuickMaterialBusyIndicator::setRunning(bool running)
+{
+ if (running)
+ setVisible(true);
+}
+
int QQuickMaterialBusyIndicator::elapsed() const
{
return m_elapsed;
@@ -205,14 +216,23 @@ int QQuickMaterialBusyIndicator::elapsed() const
void QQuickMaterialBusyIndicator::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
{
QQuickItem::itemChange(change, data);
- if (change == ItemVisibleHasChanged)
+ switch (change) {
+ case ItemOpacityHasChanged:
+ if (qFuzzyIsNull(data.realValue))
+ setVisible(false);
+ break;
+ case ItemVisibleHasChanged:
update();
+ break;
+ default:
+ break;
+ }
}
QSGNode *QQuickMaterialBusyIndicator::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
QQuickMaterialBusyIndicatorNode *node = static_cast<QQuickMaterialBusyIndicatorNode *>(oldNode);
- if (isVisible() && width() > 0 && height() > 0) {
+ if (isRunning() && width() > 0 && height() > 0) {
if (!node) {
node = new QQuickMaterialBusyIndicatorNode(this);
node->start();
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator_p.h b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
index da84c7b1..6c6d2445 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator_p.h
+++ b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
@@ -57,6 +57,7 @@ class QQuickMaterialBusyIndicator : public QQuickItem
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning FINAL)
public:
explicit QQuickMaterialBusyIndicator(QQuickItem *parent = nullptr);
@@ -64,6 +65,9 @@ public:
QColor color() const;
void setColor(QColor color);
+ bool isRunning() const;
+ void setRunning(bool running);
+
int elapsed() const;
protected:
diff --git a/src/imports/controls/material/qt_attribution.json b/src/imports/controls/material/qt_attribution.json
new file mode 100644
index 00000000..01b45e9f
--- /dev/null
+++ b/src/imports/controls/material/qt_attribution.json
@@ -0,0 +1,13 @@
+{
+ "Id": "shadow_angular_material",
+ "Name": "Shadow values from Angular Material",
+ "QDocModule": "qtquickcontrols2",
+ "QtUsage": "Used in the Material Style of Qt Quick Controls 2.",
+ "Files": "ElevationEffect.qml",
+ "Description": "Shadow values for the elevation effect.",
+ "Homepage": "https://angularjs.org/",
+ "License": "MIT License",
+ "LicenseId": "MIT",
+ "LicenseFile": "LICENSE_ANGULARJS.txt",
+ "Copyright": "Copyright (c) 2014-2016 Google, Inc"
+}
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 0da8b6ac..7566c33a 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 2a5a4f3f..f8ea2874 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 39af8cc0..f6b0b271 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 ef095db5..763725b6 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 029efe4c..f09124db 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 7682c3ed..b0d1923b 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/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
index 5b5a0744..09ca5d9b 100644
--- a/src/imports/controls/universal/Tumbler.qml
+++ b/src/imports/controls/universal/Tumbler.qml
@@ -56,15 +56,14 @@ T.Tumbler {
}
contentItem: TumblerView {
- id: tumblerView
model: control.model
delegate: control.delegate
path: Path {
- startX: tumblerView.width / 2
- startY: -tumblerView.delegateHeight / 2
+ startX: contentItem.width / 2
+ startY: -contentItem.delegateHeight / 2
PathLine {
- x: tumblerView.width / 2
- y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
+ x: contentItem.width / 2
+ y: (control.visibleItemCount + 1) * contentItem.delegateHeight - contentItem.delegateHeight / 2
}
}
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index a491c031..d8df7d98 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -67,6 +67,7 @@
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
#include <QtQuickTemplates2/private/qquickpage_p.h>
#include <QtQuickTemplates2/private/qquickpageindicator_p.h>
+#include <QtQuickTemplates2/private/qquickpaletteprovider_p.h>
#include <QtQuickTemplates2/private/qquickpane_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
#include <QtQuickTemplates2/private/qquickprogressbar_p.h>
@@ -98,8 +99,6 @@
#include <QtQuickTemplates2/private/qquicktumbler_p.h>
#endif
-#include "qquicktemplates2valuetypeprovider_p.h"
-
static inline void initResources()
{
#ifdef QT_STATIC
@@ -116,20 +115,14 @@ extern void qt_quick_set_shortcut_context_matcher(ShortcutContextMatcher matcher
QT_BEGIN_NAMESPACE
-static QQmlValueTypeProvider *valueTypeProvider()
-{
- static QQuickTemplates2ValueTypeProvider provider;
- return &provider;
-}
-
static void initProviders()
{
- QQml_addValueTypeProvider(valueTypeProvider());
+ QQuickPaletteProvider::init();
}
static void cleanupProviders()
{
- QQml_removeValueTypeProvider(valueTypeProvider());
+ QQuickPaletteProvider::cleanup();
}
class QtQuickTemplates2Plugin: public QQmlExtensionPlugin
@@ -144,15 +137,16 @@ public:
void registerTypes(const char *uri) override;
private:
+ bool registered;
#if QT_CONFIG(shortcut)
ShortcutContextMatcher originalContextMatcher;
#endif
};
-QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensionPlugin(parent)
+QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent)
+ : QQmlExtensionPlugin(parent), registered(false)
{
initResources();
- initProviders();
#if QT_CONFIG(shortcut)
originalContextMatcher = qt_quick_shortcut_context_matcher();
@@ -162,7 +156,8 @@ QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensio
QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin()
{
- cleanupProviders();
+ if (registered)
+ cleanupProviders();
#if QT_CONFIG(shortcut)
qt_quick_set_shortcut_context_matcher(originalContextMatcher);
@@ -171,6 +166,9 @@ QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin()
void QtQuickTemplates2Plugin::registerTypes(const char *uri)
{
+ registered = true;
+ initProviders();
+
qmlRegisterModule(uri, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2...
// QtQuick.Templates 2.0 (originally introduced in Qt 5.7)
@@ -253,7 +251,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/imports/templates/templates.pro b/src/imports/templates/templates.pro
index 4ff0a76e..9a95812b 100644
--- a/src/imports/templates/templates.pro
+++ b/src/imports/templates/templates.pro
@@ -10,11 +10,7 @@ DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
OTHER_FILES += \
qmldir
-HEADERS += \
- $$PWD/qquicktemplates2valuetypeprovider_p.h
-
SOURCES += \
- $$PWD/qquicktemplates2valuetypeprovider.cpp \
$$PWD/qtquicktemplates2plugin.cpp
CONFIG += no_cxx_module
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 b8c6eb84..238669c6 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -355,13 +355,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);
@@ -682,6 +688,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 d5afc4cf..1c493cd8 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -100,6 +100,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 950ec384..9bb122fe 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -52,7 +52,6 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformtheme.h>
-#include <QtQml/private/qqmlincubator_p.h>
#if QT_CONFIG(accessibility)
#include <QtQuick/private/qquickaccessibleattached_p.h>
@@ -291,6 +290,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 +651,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,40 +671,24 @@ 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);
}
-/*
- Cancels incubation recursively to avoid "Object destroyed during incubation" (QTBUG-50992)
-*/
-static void cancelIncubation(QObject *object, QQmlContext *context)
-{
- const auto children = object->children();
- for (QObject *child : children)
- cancelIncubation(child, context);
- QQmlIncubatorPrivate::cancel(object, context);
-}
-
-void QQuickControlPrivate::destroyDelegate(QObject *delegate, QObject *parent)
-{
- if (!delegate)
- return;
-
- QQmlContext *context = parent ? qmlContext(parent) : nullptr;
- if (context)
- cancelIncubation(delegate, context);
- delete delegate;
-}
-
QQuickControl::QQuickControl(QQuickItem *parent)
: QQuickItem(*(new QQuickControlPrivate), parent)
{
@@ -1313,6 +1305,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..7d040ded 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -140,10 +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);
- static void destroyDelegate(QObject *object, QObject *parent);
+ virtual void cancelBackground();
+ virtual void executeBackground(bool complete = false);
struct ExtraData {
ExtraData();
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/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
index f71b9c35..6693d4f8 100644
--- a/src/quicktemplates2/qquickmenuitem.cpp
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -37,6 +37,7 @@
#include "qquickmenuitem_p.h"
#include "qquickmenuitem_p_p.h"
#include "qquickmenu_p.h"
+#include "qquickdeferredexecute_p_p.h"
#include <QtGui/qpa/qplatformtheme.h>
#include <QtQuick/private/qquickevents_p_p.h>
@@ -134,6 +135,26 @@ void QQuickMenuItemPrivate::updateEnabled()
q->setEnabled(subMenu && subMenu->isEnabled());
}
+static inline QString arrowName() { return QStringLiteral("arrow"); }
+
+void QQuickMenuItemPrivate::cancelArrow()
+{
+ Q_Q(QQuickAbstractButton);
+ quickCancelDeferred(q, arrowName());
+}
+
+void QQuickMenuItemPrivate::executeArrow(bool complete)
+{
+ Q_Q(QQuickMenuItem);
+ if (arrow.wasExecuted())
+ return;
+
+ if (!arrow || complete)
+ quickBeginDeferred(q, arrowName(), arrow);
+ if (complete)
+ quickCompleteDeferred(q, arrowName(), arrow);
+}
+
/*!
\qmlsignal void QtQuick.Controls::MenuItem::triggered()
@@ -183,7 +204,9 @@ void QQuickMenuItem::setHighlighted(bool highlighted)
*/
QQuickItem *QQuickMenuItem::arrow() const
{
- Q_D(const QQuickMenuItem);
+ QQuickMenuItemPrivate *d = const_cast<QQuickMenuItemPrivate *>(d_func());
+ if (!d->arrow)
+ d->executeArrow();
return d->arrow;
}
@@ -193,11 +216,15 @@ void QQuickMenuItem::setArrow(QQuickItem *arrow)
if (d->arrow == arrow)
return;
- QQuickControlPrivate::destroyDelegate(d->arrow, this);
+ if (!d->arrow.isExecuting())
+ d->cancelArrow();
+
+ delete d->arrow;
d->arrow = arrow;
if (arrow && !arrow->parentItem())
arrow->setParentItem(this);
- emit arrowChanged();
+ if (!d->arrow.isExecuting())
+ emit arrowChanged();
}
/*!
@@ -228,6 +255,13 @@ QQuickMenu *QQuickMenuItem::subMenu() const
return d->subMenu;
}
+void QQuickMenuItem::componentComplete()
+{
+ Q_D(QQuickMenuItem);
+ d->executeArrow(true);
+ QQuickAbstractButton::componentComplete();
+}
+
QFont QQuickMenuItem::defaultFont() const
{
return QQuickControlPrivate::themeFont(QPlatformTheme::MenuItemFont);
diff --git a/src/quicktemplates2/qquickmenuitem_p.h b/src/quicktemplates2/qquickmenuitem_p.h
index 8af3cbd1..7cffd97b 100644
--- a/src/quicktemplates2/qquickmenuitem_p.h
+++ b/src/quicktemplates2/qquickmenuitem_p.h
@@ -63,6 +63,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuItem : public QQuickAbstractBut
Q_PROPERTY(QQuickItem *arrow READ arrow WRITE setArrow NOTIFY arrowChanged FINAL REVISION 3)
Q_PROPERTY(QQuickMenu *menu READ menu NOTIFY menuChanged FINAL REVISION 3)
Q_PROPERTY(QQuickMenu *subMenu READ subMenu NOTIFY subMenuChanged FINAL REVISION 3)
+ Q_CLASSINFO("DeferredPropertyNames", "arrow,background,contentItem,indicator")
public:
explicit QQuickMenuItem(QQuickItem *parent = nullptr);
@@ -86,6 +87,8 @@ Q_SIGNALS:
Q_REVISION(3) void subMenuChanged();
protected:
+ void componentComplete() override;
+
QFont defaultFont() const override;
QPalette defaultPalette() const override;
diff --git a/src/quicktemplates2/qquickmenuitem_p_p.h b/src/quicktemplates2/qquickmenuitem_p_p.h
index e0e90ff1..5deea6e3 100644
--- a/src/quicktemplates2/qquickmenuitem_p_p.h
+++ b/src/quicktemplates2/qquickmenuitem_p_p.h
@@ -72,8 +72,11 @@ public:
void updateEnabled();
+ void cancelArrow();
+ void executeArrow(bool complete = false);
+
bool highlighted;
- QQuickItem *arrow;
+ QQuickDeferredPointer<QQuickItem> arrow;
QQuickMenu *menu;
QQuickMenu *subMenu;
};
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/imports/templates/qquicktemplates2valuetypeprovider.cpp b/src/quicktemplates2/qquickpaletteprovider.cpp
index 6debdbc4..d925fcae 100644
--- a/src/imports/templates/qquicktemplates2valuetypeprovider.cpp
+++ b/src/quicktemplates2/qquickpaletteprovider.cpp
@@ -34,20 +34,36 @@
**
****************************************************************************/
-#include "qquicktemplates2valuetypeprovider_p.h"
+#include "qquickpaletteprovider_p.h"
+#include "qquickpalette_p.h"
#include <QtQml/private/qqmlvaluetype_p.h>
-#include <QtQuickTemplates2/private/qquickpalette_p.h>
QT_BEGIN_NAMESPACE
+static QQmlValueTypeProvider *instance()
+{
+ static QQuickPaletteProvider provider;
+ return &provider;
+}
+
+void QQuickPaletteProvider::init()
+{
+ QQml_addValueTypeProvider(instance());
+}
+
+void QQuickPaletteProvider::cleanup()
+{
+ QQml_removeValueTypeProvider(instance());
+}
+
#if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS)
#define ASSERT_VALID_SIZE(size, min) Q_UNUSED(size)
#else
#define ASSERT_VALID_SIZE(size, min) Q_ASSERT(size >= min)
#endif
-const QMetaObject *QQuickTemplates2ValueTypeProvider::getMetaObjectForMetaType(int type)
+const QMetaObject *QQuickPaletteProvider::getMetaObjectForMetaType(int type)
{
switch (type) {
case QMetaType::QPalette:
@@ -59,7 +75,7 @@ const QMetaObject *QQuickTemplates2ValueTypeProvider::getMetaObjectForMetaType(i
return nullptr;
}
-bool QQuickTemplates2ValueTypeProvider::init(int type, QVariant& dst)
+bool QQuickPaletteProvider::init(int type, QVariant& dst)
{
switch (type) {
case QMetaType::QPalette:
@@ -77,7 +93,7 @@ bool typedEqual(const void *lhs, const QVariant& rhs)
return (*(reinterpret_cast<const T *>(lhs)) == rhs.value<T>());
}
-bool QQuickTemplates2ValueTypeProvider::equal(int type, const void *lhs, const QVariant &rhs)
+bool QQuickPaletteProvider::equal(int type, const void *lhs, const QVariant &rhs)
{
switch (type) {
case QMetaType::QPalette:
@@ -98,7 +114,7 @@ bool typedStore(const void *src, void *dst, size_t dstSize)
return true;
}
-bool QQuickTemplates2ValueTypeProvider::store(int type, const void *src, void *dst, size_t dstSize)
+bool QQuickPaletteProvider::store(int type, const void *src, void *dst, size_t dstSize)
{
switch (type) {
case QMetaType::QPalette:
@@ -121,7 +137,7 @@ bool typedRead(const QVariant& src, int dstType, void *dst)
return true;
}
-bool QQuickTemplates2ValueTypeProvider::read(const QVariant &src, void *dst, int dstType)
+bool QQuickPaletteProvider::read(const QVariant &src, void *dst, int dstType)
{
switch (dstType) {
case QMetaType::QPalette:
@@ -143,7 +159,7 @@ bool typedWrite(const void *src, QVariant& dst)
return false;
}
-bool QQuickTemplates2ValueTypeProvider::write(int type, const void *src, QVariant& dst)
+bool QQuickPaletteProvider::write(int type, const void *src, QVariant& dst)
{
switch (type) {
case QMetaType::QPalette:
diff --git a/src/imports/templates/qquicktemplates2valuetypeprovider_p.h b/src/quicktemplates2/qquickpaletteprovider_p.h
index 6b072029..5b6e3796 100644
--- a/src/imports/templates/qquicktemplates2valuetypeprovider_p.h
+++ b/src/quicktemplates2/qquickpaletteprovider_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKTEMPLATES2VALUETYPEPROVIDER_P_H
-#define QQUICKTEMPLATES2VALUETYPEPROVIDER_P_H
+#ifndef QQUICKPALETTEPROVIDER_P_H
+#define QQUICKPALETTEPROVIDER_P_H
//
// W A R N I N G
@@ -48,13 +48,17 @@
// We mean it.
//
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
#include <QtQml/private/qqmlglobal_p.h>
QT_BEGIN_NAMESPACE
-class QQuickTemplates2ValueTypeProvider : public QQmlValueTypeProvider
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPaletteProvider : public QQmlValueTypeProvider
{
public:
+ static void init();
+ static void cleanup();
+
const QMetaObject *getMetaObjectForMetaType(int type) override;
bool init(int type, QVariant& dst) override;
bool equal(int type, const void *lhs, const QVariant &rhs) override;
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 f7af2015..5e74f6ef 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -184,6 +184,7 @@ public:
return button->d_func();
}
+ void cancelIndicator();
void executeIndicator(bool complete = false);
bool pressed;
@@ -1048,13 +1049,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);
@@ -1095,6 +1102,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)
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index ee51f995..b2193ec0 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -50,6 +50,7 @@ HEADERS += \
$$PWD/qquickpageindicator_p.h \
$$PWD/qquickpagelayout_p_p.h \
$$PWD/qquickpalette_p.h \
+ $$PWD/qquickpaletteprovider_p.h \
$$PWD/qquickpane_p.h \
$$PWD/qquickpane_p_p.h \
$$PWD/qquickpopup_p.h \
@@ -125,6 +126,7 @@ SOURCES += \
$$PWD/qquickpageindicator.cpp \
$$PWD/qquickpagelayout.cpp \
$$PWD/qquickpalette.cpp \
+ $$PWD/qquickpaletteprovider.cpp \
$$PWD/qquickpane.cpp \
$$PWD/qquickpopup.cpp \
$$PWD/qquickpopupitem.cpp \