aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.qmake.conf2
-rw-r--r--examples/controls/gallery/gallery.qml12
-rw-r--r--examples/controls/gallery/pages/BusyIndicatorPage.qml2
-rw-r--r--examples/controls/gallery/pages/ComboBoxPage.qml4
-rw-r--r--examples/controls/gallery/pages/GroupBoxPage.qml2
-rw-r--r--examples/controls/gallery/pages/StackViewPage.qml4
-rw-r--r--examples/controls/gallery/pages/SwipeViewPage.qml3
-rw-r--r--examples/controls/gallery/pages/TabBarPage.qml3
-rw-r--r--src/controls/controls.pri2
-rw-r--r--src/controls/qquickcolorimageprovider.cpp (renamed from src/imports/controls/universal/qquickuniversalimageprovider.cpp)11
-rw-r--r--src/controls/qquickcolorimageprovider_p.h (renamed from src/imports/controls/universal/qquickuniversalimageprovider_p.h)15
-rw-r--r--src/controls/qquickpaddedrectangle_p.h4
-rw-r--r--src/controls/qquickproxytheme_p.h30
-rw-r--r--src/controls/qquickstyle.cpp21
-rw-r--r--src/controls/qquickstyle_p.h4
-rw-r--r--src/controls/qquickstyleselector.cpp5
-rw-r--r--src/imports/calendar/qquickcalendar_p.h2
-rw-r--r--src/imports/calendar/qquickcalendarmodel_p.h12
-rw-r--r--src/imports/calendar/qquickdayofweekmodel_p.h8
-rw-r--r--src/imports/calendar/qquickdayofweekrow.cpp5
-rw-r--r--src/imports/calendar/qquickdayofweekrow_p.h10
-rw-r--r--src/imports/calendar/qquickmonthgrid.cpp12
-rw-r--r--src/imports/calendar/qquickmonthgrid_p.h24
-rw-r--r--src/imports/calendar/qquickmonthmodel_p.h8
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn.cpp5
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn_p.h10
-rw-r--r--src/imports/calendar/qquickweeknumbermodel_p.h8
-rw-r--r--src/imports/calendar/qtlabscalendarplugin.cpp13
-rw-r--r--src/imports/controls/Button.qml16
-rw-r--r--src/imports/controls/CheckBox.qml20
-rw-r--r--src/imports/controls/ComboBox.qml1
-rw-r--r--src/imports/controls/Frame.qml9
-rw-r--r--src/imports/controls/GroupBox.qml6
-rw-r--r--src/imports/controls/ItemDelegate.qml20
-rw-r--r--src/imports/controls/MenuItem.qml24
-rw-r--r--src/imports/controls/RadioButton.qml20
-rw-r--r--src/imports/controls/Switch.qml20
-rw-r--r--src/imports/controls/TabButton.qml17
-rw-r--r--src/imports/controls/TextArea.qml2
-rw-r--r--src/imports/controls/TextField.qml2
-rw-r--r--src/imports/controls/ToolButton.qml17
-rw-r--r--src/imports/controls/controls.pri4
-rw-r--r--src/imports/controls/controls.pro6
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-contentItem.png (renamed from src/imports/controls/doc/images/qtlabscontrols-button-label.png)bin1550 -> 1550 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-contentItem.png (renamed from src/imports/controls/doc/images/qtlabscontrols-checkbox-label.png)bin2582 -> 2582 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-frame-frame.pngbin341 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-groupbox-frame.pngbin2653 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-itemdelegate-contentItem.png (renamed from src/imports/controls/doc/images/qtlabscontrols-itemdelegate-label.png)bin3441 -> 3441 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-contentItem.png (renamed from src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.png)bin3435 -> 3435 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-contentItem.png (renamed from src/imports/controls/doc/images/qtlabscontrols-switch-label.png)bin2605 -> 2605 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbar-frame.pngbin217 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbutton-contentItem.png (renamed from src/imports/controls/doc/images/qtlabscontrols-toolbutton-label.png)bin1682 -> 1682 bytes
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-contentItem.qml (renamed from src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml)2
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-contentItem.qml (renamed from src/imports/controls/doc/snippets/qtlabscontrols-checkbox-label.qml)2
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-frame-frame.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox-frame.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-contentItem.qml (renamed from src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-label.qml)2
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-contentItem.qml (renamed from src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-label.qml)2
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-contentItem.qml (renamed from src/imports/controls/doc/snippets/qtlabscontrols-switch-label.qml)2
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbar-frame.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-contentItem.qml (renamed from src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-label.qml)2
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-customize.qdoc74
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-differences.qdoc2
-rw-r--r--src/imports/controls/material/Button.qml17
-rw-r--r--src/imports/controls/material/CheckBox.qml21
-rw-r--r--src/imports/controls/material/ComboBox.qml1
-rw-r--r--src/imports/controls/material/Frame.qml9
-rw-r--r--src/imports/controls/material/GroupBox.qml6
-rw-r--r--src/imports/controls/material/ItemDelegate.qml21
-rw-r--r--src/imports/controls/material/MenuItem.qml21
-rw-r--r--src/imports/controls/material/RadioButton.qml21
-rw-r--r--src/imports/controls/material/RangeSlider.qml1
-rw-r--r--src/imports/controls/material/Slider.qml1
-rw-r--r--src/imports/controls/material/Switch.qml21
-rw-r--r--src/imports/controls/material/TabButton.qml17
-rw-r--r--src/imports/controls/material/TextArea.qml2
-rw-r--r--src/imports/controls/material/TextField.qml2
-rw-r--r--src/imports/controls/material/ToolButton.qml17
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring.cpp18
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring_p.h10
-rw-r--r--src/imports/controls/material/qquickmaterialprogressstrip.cpp14
-rw-r--r--src/imports/controls/material/qquickmaterialprogressstrip_p.h10
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp9
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h4
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h2
-rw-r--r--src/imports/controls/material/qtlabsmaterialstyleplugin.cpp18
-rw-r--r--src/imports/controls/plugins.qmltypes1
-rw-r--r--src/imports/controls/qquickbusyindicatorring.cpp14
-rw-r--r--src/imports/controls/qquickbusyindicatorring_p.h10
-rw-r--r--src/imports/controls/qquickprogressstrip.cpp14
-rw-r--r--src/imports/controls/qquickprogressstrip_p.h10
-rw-r--r--src/imports/controls/qtlabscontrolsplugin.cpp16
-rw-r--r--src/imports/controls/universal/Button.qml17
-rw-r--r--src/imports/controls/universal/CheckBox.qml20
-rw-r--r--src/imports/controls/universal/ComboBox.qml1
-rw-r--r--src/imports/controls/universal/Frame.qml9
-rw-r--r--src/imports/controls/universal/GroupBox.qml6
-rw-r--r--src/imports/controls/universal/ItemDelegate.qml20
-rw-r--r--src/imports/controls/universal/MenuItem.qml24
-rw-r--r--src/imports/controls/universal/RadioButton.qml20
-rw-r--r--src/imports/controls/universal/Switch.qml20
-rw-r--r--src/imports/controls/universal/TabButton.qml17
-rw-r--r--src/imports/controls/universal/TextArea.qml2
-rw-r--r--src/imports/controls/universal/TextField.qml2
-rw-r--r--src/imports/controls/universal/ToolButton.qml17
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle_p.h4
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring.cpp14
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring_p.h10
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip.cpp14
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip_p.h10
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp6
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle_p.h4
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme_p.h2
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp18
-rw-r--r--src/imports/controls/universal/universal.pri2
-rw-r--r--src/imports/templates/plugins.qmltypes1
-rw-r--r--src/imports/templates/qtlabstemplatesplugin.cpp13
-rw-r--r--src/templates/qquickabstractbutton.cpp139
-rw-r--r--src/templates/qquickabstractbutton_p.h29
-rw-r--r--src/templates/qquickabstractbutton_p_p.h1
-rw-r--r--src/templates/qquickapplicationwindow.cpp108
-rw-r--r--src/templates/qquickapplicationwindow_p.h10
-rw-r--r--src/templates/qquickbusyindicator.cpp11
-rw-r--r--src/templates/qquickbusyindicator_p.h4
-rw-r--r--src/templates/qquickbutton.cpp2
-rw-r--r--src/templates/qquickbutton_p.h4
-rw-r--r--src/templates/qquickbuttongroup.cpp50
-rw-r--r--src/templates/qquickbuttongroup_p.h4
-rw-r--r--src/templates/qquickcheckbox.cpp29
-rw-r--r--src/templates/qquickcheckbox_p.h10
-rw-r--r--src/templates/qquickcombobox.cpp123
-rw-r--r--src/templates/qquickcombobox_p.h20
-rw-r--r--src/templates/qquickcontainer.cpp27
-rw-r--r--src/templates/qquickcontainer_p.h6
-rw-r--r--src/templates/qquickcontainer_p_p.h8
-rw-r--r--src/templates/qquickcontrol.cpp65
-rw-r--r--src/templates/qquickcontrol_p.h18
-rw-r--r--src/templates/qquickcontrol_p_p.h6
-rw-r--r--src/templates/qquickdial.cpp98
-rw-r--r--src/templates/qquickdial_p.h22
-rw-r--r--src/templates/qquickdrawer.cpp76
-rw-r--r--src/templates/qquickdrawer_p.h16
-rw-r--r--src/templates/qquickframe.cpp31
-rw-r--r--src/templates/qquickframe_p.h9
-rw-r--r--src/templates/qquickframe_p_p.h6
-rw-r--r--src/templates/qquickgroupbox.cpp28
-rw-r--r--src/templates/qquickgroupbox_p.h4
-rw-r--r--src/templates/qquickitemdelegate.cpp2
-rw-r--r--src/templates/qquickitemdelegate_p.h6
-rw-r--r--src/templates/qquicklabel.cpp23
-rw-r--r--src/templates/qquicklabel_p.h8
-rw-r--r--src/templates/qquicklabel_p_p.h4
-rw-r--r--src/templates/qquickmenu.cpp22
-rw-r--r--src/templates/qquickmenu_p.h8
-rw-r--r--src/templates/qquickmenu_p_p.h10
-rw-r--r--src/templates/qquickmenuitem_p.h6
-rw-r--r--src/templates/qquickoverlay.cpp41
-rw-r--r--src/templates/qquickoverlay_p.h20
-rw-r--r--src/templates/qquickpage.cpp94
-rw-r--r--src/templates/qquickpage_p.h10
-rw-r--r--src/templates/qquickpageindicator.cpp51
-rw-r--r--src/templates/qquickpageindicator_p.h14
-rw-r--r--src/templates/qquickpane.cpp24
-rw-r--r--src/templates/qquickpane_p.h6
-rw-r--r--src/templates/qquickpopup.cpp105
-rw-r--r--src/templates/qquickpopup_p.h10
-rw-r--r--src/templates/qquickpopup_p_p.h32
-rw-r--r--src/templates/qquickpressandholdhelper.cpp6
-rw-r--r--src/templates/qquickprogressbar.cpp75
-rw-r--r--src/templates/qquickprogressbar_p.h8
-rw-r--r--src/templates/qquickradiobutton.cpp2
-rw-r--r--src/templates/qquickradiobutton_p.h6
-rw-r--r--src/templates/qquickrangeslider.cpp124
-rw-r--r--src/templates/qquickrangeslider_p.h20
-rw-r--r--src/templates/qquickscrollbar.cpp206
-rw-r--r--src/templates/qquickscrollbar_p.h12
-rw-r--r--src/templates/qquickscrollindicator.cpp185
-rw-r--r--src/templates/qquickscrollindicator_p.h4
-rw-r--r--src/templates/qquickslider.cpp124
-rw-r--r--src/templates/qquickslider_p.h22
-rw-r--r--src/templates/qquickspinbox.cpp87
-rw-r--r--src/templates/qquickspinbox_p.h26
-rw-r--r--src/templates/qquickstackview.cpp96
-rw-r--r--src/templates/qquickstackview_p.cpp89
-rw-r--r--src/templates/qquickstackview_p.h10
-rw-r--r--src/templates/qquickstackview_p_p.h6
-rw-r--r--src/templates/qquickswipeview.cpp38
-rw-r--r--src/templates/qquickswipeview_p.h6
-rw-r--r--src/templates/qquickswitch.cpp13
-rw-r--r--src/templates/qquickswitch_p.h6
-rw-r--r--src/templates/qquicktabbar.cpp44
-rw-r--r--src/templates/qquicktabbar_p.h29
-rw-r--r--src/templates/qquicktabbutton.cpp2
-rw-r--r--src/templates/qquicktabbutton_p.h6
-rw-r--r--src/templates/qquicktextarea.cpp47
-rw-r--r--src/templates/qquicktextarea_p.h26
-rw-r--r--src/templates/qquicktextarea_p_p.h12
-rw-r--r--src/templates/qquicktextfield.cpp49
-rw-r--r--src/templates/qquicktextfield_p.h26
-rw-r--r--src/templates/qquicktextfield_p_p.h12
-rw-r--r--src/templates/qquicktoolbar.cpp45
-rw-r--r--src/templates/qquicktoolbar_p.h23
-rw-r--r--src/templates/qquicktoolbutton.cpp2
-rw-r--r--src/templates/qquicktoolbutton_p.h4
-rw-r--r--src/templates/qquicktumbler.cpp64
-rw-r--r--src/templates/qquicktumbler_p.h10
-rw-r--r--tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp14
-rw-r--r--tests/auto/applicationwindow/tst_applicationwindow.cpp6
-rw-r--r--tests/auto/controls/data/tst_button.qml2
-rw-r--r--tests/auto/controls/data/tst_checkbox.qml2
-rw-r--r--tests/auto/controls/data/tst_itemdelegate.qml2
-rw-r--r--tests/auto/controls/data/tst_menuitem.qml2
-rw-r--r--tests/auto/controls/data/tst_radiobutton.qml2
-rw-r--r--tests/auto/controls/data/tst_switch.qml2
-rw-r--r--tests/auto/controls/data/tst_tabbutton.qml2
-rw-r--r--tests/auto/controls/data/tst_toolbutton.qml2
-rw-r--r--tests/auto/pressandhold/data/dependencies.qml4
-rw-r--r--tests/auto/sanity/data/dependencies.qml4
-rw-r--r--tests/auto/sanity/tst_sanity.cpp18
-rw-r--r--tests/auto/snippets/data/dependencies.qml6
-rw-r--r--tests/auto/styles/data/dependencies.qml7
-rw-r--r--tests/benchmarks/creationtime/data/dependencies.qml7
-rw-r--r--tests/benchmarks/creationtime/tst_creationtime.cpp16
-rw-r--r--tests/benchmarks/objectcount/data/dependencies.qml7
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp18
-rw-r--r--tests/manual/gifs/eventcapturer.cpp2
-rw-r--r--tests/manual/gifs/eventcapturer.h2
-rw-r--r--tests/manual/gifs/gifrecorder.cpp4
-rw-r--r--tests/manual/viewinqwidget/main.cpp2
230 files changed, 2242 insertions, 2157 deletions
diff --git a/.gitignore b/.gitignore
index 8a6be8b6..b377694e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,6 +95,7 @@ app_process
qtc-debugging-helper
android-*.so-deployment-settings.json
*.directory
+*_plugin_import.cpp
*_wrapper.sh
*_wrapper.bat
*.mak
diff --git a/.qmake.conf b/.qmake.conf
index c55a429d..12ab0814 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -3,4 +3,4 @@ CONFIG += warning_clean
QQC2_SOURCE_TREE = $$PWD
-MODULE_VERSION = 5.6.1
+MODULE_VERSION = 5.7.0
diff --git a/examples/controls/gallery/gallery.qml b/examples/controls/gallery/gallery.qml
index ac808649..fd019c65 100644
--- a/examples/controls/gallery/gallery.qml
+++ b/examples/controls/gallery/gallery.qml
@@ -63,8 +63,10 @@ ApplicationWindow {
anchors.fill: parent
ToolButton {
- label: Image {
- anchors.centerIn: parent
+ contentItem: Image {
+ fillMode: Image.Pad
+ horizontalAlignment: Image.AlignHCenter
+ verticalAlignment: Image.AlignVCenter
source: "qrc:/images/drawer.png"
}
onClicked: drawer.open()
@@ -81,8 +83,10 @@ ApplicationWindow {
}
ToolButton {
- label: Image {
- anchors.centerIn: parent
+ contentItem: Image {
+ fillMode: Image.Pad
+ horizontalAlignment: Image.AlignHCenter
+ verticalAlignment: Image.AlignVCenter
source: "qrc:/images/menu.png"
}
onClicked: optionsMenu.open()
diff --git a/examples/controls/gallery/pages/BusyIndicatorPage.qml b/examples/controls/gallery/pages/BusyIndicatorPage.qml
index 2d538216..5aed6e59 100644
--- a/examples/controls/gallery/pages/BusyIndicatorPage.qml
+++ b/examples/controls/gallery/pages/BusyIndicatorPage.qml
@@ -53,7 +53,7 @@ Pane {
wrapMode: Label.Wrap
horizontalAlignment: Qt.AlignHCenter
text: "BusyIndicator is used to indicate activity while content is being loaded,"
- + " or the UI is blocked waiting for a resource to become available."
+ + " or when the UI is blocked waiting for a resource to become available."
}
BusyIndicator {
diff --git a/examples/controls/gallery/pages/ComboBoxPage.qml b/examples/controls/gallery/pages/ComboBoxPage.qml
index 3c497c48..4400612f 100644
--- a/examples/controls/gallery/pages/ComboBoxPage.qml
+++ b/examples/controls/gallery/pages/ComboBoxPage.qml
@@ -52,8 +52,8 @@ Pane {
width: parent.width
wrapMode: Label.Wrap
horizontalAlignment: Qt.AlignHCenter
- text: "ComboBox is a combined button and popup list. It provides means of presenting a "
- + "list of options to the user in a way that takes up the minimum amount of screen space."
+ text: "ComboBox is a combined button and popup list. It presents "
+ + "a list of options to the user that occupies minimal screen space."
}
ComboBox {
diff --git a/examples/controls/gallery/pages/GroupBoxPage.qml b/examples/controls/gallery/pages/GroupBoxPage.qml
index e9d67849..996e65d2 100644
--- a/examples/controls/gallery/pages/GroupBoxPage.qml
+++ b/examples/controls/gallery/pages/GroupBoxPage.qml
@@ -54,7 +54,7 @@ Pane {
width: parent.width
wrapMode: Label.Wrap
horizontalAlignment: Qt.AlignHCenter
- text: "GroupBox is used to layout a logical group of controls together, within a titled visual frame."
+ text: "A GroupBox provides a frame, a title on top of it, and a logical group of controls within that frame."
}
GroupBox {
diff --git a/examples/controls/gallery/pages/StackViewPage.qml b/examples/controls/gallery/pages/StackViewPage.qml
index 42e1df43..19416aa6 100644
--- a/examples/controls/gallery/pages/StackViewPage.qml
+++ b/examples/controls/gallery/pages/StackViewPage.qml
@@ -60,7 +60,9 @@ StackView {
width: parent.width
wrapMode: Label.Wrap
horizontalAlignment: Qt.AlignHCenter
- text: "StackView provides a stack-based navigation model."
+ text: "StackView provides a stack-based navigation model which can be used with a set of interlinked pages. "
+ + "Items are pushed onto the stack as the user navigates deeper into the material, and popped off again "
+ + "when he chooses to go back."
}
Button {
diff --git a/examples/controls/gallery/pages/SwipeViewPage.qml b/examples/controls/gallery/pages/SwipeViewPage.qml
index 29739451..aded5d73 100644
--- a/examples/controls/gallery/pages/SwipeViewPage.qml
+++ b/examples/controls/gallery/pages/SwipeViewPage.qml
@@ -64,7 +64,8 @@ Pane {
width: parent.width
wrapMode: Label.Wrap
horizontalAlignment: Qt.AlignHCenter
- text: "SwipeView provides a swipe-based navigation model."
+ text: "SwipeView provides a navigation model that simplifies horizontal paged scrolling. "
+ + "The page indicator on the bottom shows which is the presently active page."
}
Image {
diff --git a/examples/controls/gallery/pages/TabBarPage.qml b/examples/controls/gallery/pages/TabBarPage.qml
index 0ab4a100..ba170f2c 100644
--- a/examples/controls/gallery/pages/TabBarPage.qml
+++ b/examples/controls/gallery/pages/TabBarPage.qml
@@ -66,7 +66,8 @@ Pane {
width: parent.width
wrapMode: Label.Wrap
horizontalAlignment: Qt.AlignHCenter
- text: "TabBar provides a tab-based navigation model."
+ text: "TabBar is a bar with icons or text which allows the user"
+ + "to switch between different subtasks, views, or modes."
}
Image {
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
index 005ee839..7aa9447f 100644
--- a/src/controls/controls.pri
+++ b/src/controls/controls.pri
@@ -1,4 +1,5 @@
HEADERS += \
+ $$PWD/qquickcolorimageprovider_p.h \
$$PWD/qquickproxytheme_p.h \
$$PWD/qquickstyle_p.h \
$$PWD/qquickstyleselector_p.h \
@@ -6,6 +7,7 @@ HEADERS += \
$$PWD/qquickpaddedrectangle_p.h
SOURCES += \
+ $$PWD/qquickcolorimageprovider.cpp \
$$PWD/qquickproxytheme.cpp \
$$PWD/qquickstyle.cpp \
$$PWD/qquickstyleselector.cpp \
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider.cpp b/src/controls/qquickcolorimageprovider.cpp
index 7cb7b926..582b73ed 100644
--- a/src/imports/controls/universal/qquickuniversalimageprovider.cpp
+++ b/src/controls/qquickcolorimageprovider.cpp
@@ -34,7 +34,7 @@
**
****************************************************************************/
-#include "qquickuniversalimageprovider_p.h"
+#include "qquickcolorimageprovider_p.h"
#include <QtCore/qdebug.h>
#include <QtGui/qpainter.h>
@@ -44,11 +44,12 @@
QT_BEGIN_NAMESPACE
-QQuickUniversalImageProvider::QQuickUniversalImageProvider() : QQuickImageProvider(Image)
+QQuickColorImageProvider::QQuickColorImageProvider(const QString &path)
+ : QQuickImageProvider(Image), m_path(path)
{
}
-QImage QQuickUniversalImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
+QImage QQuickColorImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
{
Q_UNUSED(requestedSize);
@@ -56,11 +57,11 @@ QImage QQuickUniversalImageProvider::requestImage(const QString &id, QSize *size
QString name = id.left(sep);
QString color = id.mid(sep + 1);
qreal dpr = qApp->primaryScreen()->devicePixelRatio();
- QString file = qt_findAtNxFile(QStringLiteral(":/qt-project.org/imports/Qt/labs/controls/universal/images/") + name + QStringLiteral(".png"), dpr);
+ QString file = qt_findAtNxFile(m_path + QLatin1Char('/') + name + QStringLiteral(".png"), dpr);
QImage image(file);
if (image.isNull()) {
- qWarning() << "QQuickUniversalImageProvider: unknown id:" << id;
+ qWarning() << "QQuickColorImageProvider: unknown id:" << id;
return QImage();
}
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider_p.h b/src/controls/qquickcolorimageprovider_p.h
index 15648157..6f55f75f 100644
--- a/src/imports/controls/universal/qquickuniversalimageprovider_p.h
+++ b/src/controls/qquickcolorimageprovider_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKUNIVERSALIMAGEPROVIDER_P_H
-#define QQUICKUNIVERSALIMAGEPROVIDER_P_H
+#ifndef QQUICKCOLORIMAGEPROVIDER_P_H
+#define QQUICKCOLORIMAGEPROVIDER_P_H
//
// W A R N I N G
@@ -52,14 +52,17 @@
QT_BEGIN_NAMESPACE
-class QQuickUniversalImageProvider : public QQuickImageProvider
+class QQuickColorImageProvider : public QQuickImageProvider
{
public:
- QQuickUniversalImageProvider();
+ QQuickColorImageProvider(const QString &path);
- QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) Q_DECL_OVERRIDE;
+ QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
+
+private:
+ QString m_path;
};
QT_END_NAMESPACE
-#endif // QQUICKUNIVERSALIMAGEPROVIDER_P_H
+#endif // QQUICKOCOLORIMAGEPROVIDER_P_H
diff --git a/src/controls/qquickpaddedrectangle_p.h b/src/controls/qquickpaddedrectangle_p.h
index 5c0a8919..690448d6 100644
--- a/src/controls/qquickpaddedrectangle_p.h
+++ b/src/controls/qquickpaddedrectangle_p.h
@@ -62,7 +62,7 @@ class QQuickPaddedRectangle : public QQuickRectangle
Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
public:
- QQuickPaddedRectangle(QQuickItem *parent = Q_NULLPTR);
+ QQuickPaddedRectangle(QQuickItem *parent = nullptr);
qreal padding() const;
void setPadding(qreal padding);
@@ -92,7 +92,7 @@ Q_SIGNALS:
void bottomPaddingChanged();
protected:
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
private:
void setTopPadding(qreal padding, bool has);
diff --git a/src/controls/qquickproxytheme_p.h b/src/controls/qquickproxytheme_p.h
index 47f931b5..6d7040e5 100644
--- a/src/controls/qquickproxytheme_p.h
+++ b/src/controls/qquickproxytheme_p.h
@@ -61,33 +61,33 @@ public:
QPlatformTheme* theme() const;
- QPlatformMenuItem* createPlatformMenuItem() const Q_DECL_OVERRIDE;
- QPlatformMenu* createPlatformMenu() const Q_DECL_OVERRIDE;
- QPlatformMenuBar* createPlatformMenuBar() const Q_DECL_OVERRIDE;
- void showPlatformMenuBar() Q_DECL_OVERRIDE;
+ QPlatformMenuItem* createPlatformMenuItem() const override;
+ QPlatformMenu* createPlatformMenu() const override;
+ QPlatformMenuBar* createPlatformMenuBar() const override;
+ void showPlatformMenuBar() override;
- bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE;
+ bool usePlatformNativeDialog(DialogType type) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
#ifndef QT_NO_SYSTEMTRAYICON
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
#endif
- const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
+ const QPalette *palette(Palette type = SystemPalette) const override;
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type = SystemFont) const override;
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ QVariant themeHint(ThemeHint hint) const override;
- QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const Q_DECL_OVERRIDE;
+ QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions = 0) const Q_DECL_OVERRIDE;
+ QPlatformTheme::IconOptions iconOptions = 0) const override;
- QIconEngine *createIconEngine(const QString &iconName) const Q_DECL_OVERRIDE;
+ QIconEngine *createIconEngine(const QString &iconName) const override;
- QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const Q_DECL_OVERRIDE;
+ QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const override;
- QString standardButtonText(int button) const Q_DECL_OVERRIDE;
+ QString standardButtonText(int button) const override;
private:
QPlatformTheme *m_theme;
diff --git a/src/controls/qquickstyle.cpp b/src/controls/qquickstyle.cpp
index 0ca6558e..320148c3 100644
--- a/src/controls/qquickstyle.cpp
+++ b/src/controls/qquickstyle.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
static QQuickStyle *attachedStyle(const QMetaObject *type, QObject *object, bool create = false)
{
if (!object)
- return Q_NULLPTR;
+ return nullptr;
int idx = -1;
return qobject_cast<QQuickStyle *>(qmlAttachedPropertiesObject(&idx, object, type, create));
}
@@ -55,7 +55,7 @@ static QQuickStyle *attachedStyle(const QMetaObject *type, QObject *object, bool
static QQuickStyle *findParentStyle(const QMetaObject *type, QObject *parent)
{
if (!parent)
- return Q_NULLPTR;
+ return nullptr;
QQuickStyle *style = attachedStyle(type, parent);
if (style)
@@ -97,7 +97,7 @@ static QQuickStyle *findParentStyle(const QMetaObject *type, QObject *parent)
return style;
}
- return Q_NULLPTR;
+ return nullptr;
}
static QList<QQuickStyle *> findChildStyles(const QMetaObject *type, QObject *object)
@@ -109,7 +109,8 @@ static QList<QQuickStyle *> findChildStyles(const QMetaObject *type, QObject *ob
if (QQuickWindow *window = qobject_cast<QQuickWindow *>(object)) {
item = window->contentItem();
- foreach (QObject *child, window->children()) {
+ const auto windowChildren = window->children();
+ for (QObject *child : windowChildren) {
QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child);
if (childWindow) {
QQuickStyle *style = attachedStyle(type, childWindow);
@@ -127,7 +128,8 @@ static QList<QQuickStyle *> findChildStyles(const QMetaObject *type, QObject *ob
}
if (item) {
- foreach (QQuickItem *child, item->childItems()) {
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
QQuickStyle *style = attachedStyle(type, child);
if (style)
children += style;
@@ -135,7 +137,8 @@ static QList<QQuickStyle *> findChildStyles(const QMetaObject *type, QObject *ob
children += findChildStyles(type, child);
}
- foreach (QObject *child, item->children()) {
+ const auto itemChildren = item->children();
+ for (QObject *child : itemChildren) {
if (!qobject_cast<QQuickItem *>(child)) {
QQuickStyle *style = attachedStyle(type, child);
if (style)
@@ -162,7 +165,7 @@ QQuickStyle::~QQuickStyle()
if (item)
QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
- setParentStyle(Q_NULLPTR);
+ setParentStyle(nullptr);
}
QSharedPointer<QSettings> QQuickStyle::settings(const QString &group)
@@ -214,8 +217,8 @@ void QQuickStyle::init()
if (parentStyle)
setParentStyle(parentStyle);
- QList<QQuickStyle *> children = findChildStyles(metaObject(), parent);
- foreach (QQuickStyle *child, children)
+ const QList<QQuickStyle *> children = findChildStyles(metaObject(), parent);
+ for (QQuickStyle *child : children)
child->setParentStyle(this);
}
diff --git a/src/controls/qquickstyle_p.h b/src/controls/qquickstyle_p.h
index 02ee667a..36a2320c 100644
--- a/src/controls/qquickstyle_p.h
+++ b/src/controls/qquickstyle_p.h
@@ -64,7 +64,7 @@ class QQuickStyle : public QObject, public QQuickItemChangeListener
Q_OBJECT
public:
- explicit QQuickStyle(QObject *parent = Q_NULLPTR);
+ explicit QQuickStyle(QObject *parent = nullptr);
~QQuickStyle();
static QSharedPointer<QSettings> settings(const QString &group = QString());
@@ -79,7 +79,7 @@ protected:
virtual void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent);
- void itemParentChanged(QQuickItem *item, QQuickItem *parent) Q_DECL_OVERRIDE;
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
private:
QList<QQuickStyle *> m_childStyles;
diff --git a/src/controls/qquickstyleselector.cpp b/src/controls/qquickstyleselector.cpp
index b8a15ee9..0f0fb3b0 100644
--- a/src/controls/qquickstyleselector.cpp
+++ b/src/controls/qquickstyleselector.cpp
@@ -35,7 +35,6 @@
#include "qquickstyleselector_p.h"
#include "qquickstyleselector_p_p.h"
-#include <QtCore/QFile>
#include <QtCore/QDir>
#include <QtCore/QMutex>
#include <QtCore/QMutexLocker>
@@ -107,7 +106,7 @@ static QString selectionHelper(const QString &path, const QString &fileName, con
*/
Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/')));
- foreach (const QString &s, selectors) {
+ for (const QString &s : selectors) {
QString prospectiveBase = path + s + QLatin1Char('/');
QStringList remainingSelectors = selectors;
remainingSelectors.removeAll(s);
@@ -120,7 +119,7 @@ static QString selectionHelper(const QString &path, const QString &fileName, con
// If we reach here there were no successful files found at a lower level in this branch, so we
// should check this level as a potential result.
- if (!QFile::exists(path + fileName))
+ if (!QFileInfo::exists(path + fileName))
return QString();
return path + fileName;
}
diff --git a/src/imports/calendar/qquickcalendar_p.h b/src/imports/calendar/qquickcalendar_p.h
index c44a6a1c..cdc9cc94 100644
--- a/src/imports/calendar/qquickcalendar_p.h
+++ b/src/imports/calendar/qquickcalendar_p.h
@@ -59,7 +59,7 @@ class QQuickCalendar : public QObject
Q_OBJECT
public:
- explicit QQuickCalendar(QObject *parent = Q_NULLPTR);
+ explicit QQuickCalendar(QObject *parent = nullptr);
enum Month {
January,
diff --git a/src/imports/calendar/qquickcalendarmodel_p.h b/src/imports/calendar/qquickcalendarmodel_p.h
index 4f17980a..fa7717ed 100644
--- a/src/imports/calendar/qquickcalendarmodel_p.h
+++ b/src/imports/calendar/qquickcalendarmodel_p.h
@@ -66,7 +66,7 @@ class QQuickCalendarModel : public QAbstractListModel, public QQmlParserStatus
Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
public:
- explicit QQuickCalendarModel(QObject *parent = Q_NULLPTR);
+ explicit QQuickCalendarModel(QObject *parent = nullptr);
QDate from() const;
void setFrom(const QDate &from);
@@ -84,9 +84,9 @@ public:
YearRole
};
- QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QHash<int, QByteArray> roleNames() const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Q_SIGNALS:
void fromChanged();
@@ -94,8 +94,8 @@ Q_SIGNALS:
void countChanged();
protected:
- void classBegin() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ void classBegin() override;
+ void componentComplete() override;
private:
Q_DISABLE_COPY(QQuickCalendarModel)
diff --git a/src/imports/calendar/qquickdayofweekmodel_p.h b/src/imports/calendar/qquickdayofweekmodel_p.h
index 90ebdc6c..9e76b961 100644
--- a/src/imports/calendar/qquickdayofweekmodel_p.h
+++ b/src/imports/calendar/qquickdayofweekmodel_p.h
@@ -63,7 +63,7 @@ class QQuickDayOfWeekModel : public QAbstractListModel
Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
public:
- explicit QQuickDayOfWeekModel(QObject *parent = Q_NULLPTR);
+ explicit QQuickDayOfWeekModel(QObject *parent = nullptr);
QLocale locale() const;
void setLocale(const QLocale &locale);
@@ -77,9 +77,9 @@ public:
NarrowNameRole
};
- QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QHash<int, QByteArray> roleNames() const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Q_SIGNALS:
void localeChanged();
diff --git a/src/imports/calendar/qquickdayofweekrow.cpp b/src/imports/calendar/qquickdayofweekrow.cpp
index 76bcf5df..1f5e4387 100644
--- a/src/imports/calendar/qquickdayofweekrow.cpp
+++ b/src/imports/calendar/qquickdayofweekrow.cpp
@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE
class QQuickDayOfWeekRowPrivate : public QQuickControlPrivate
{
public:
- QQuickDayOfWeekRowPrivate() : delegate(Q_NULLPTR), model(Q_NULLPTR) { }
+ QQuickDayOfWeekRowPrivate() : delegate(nullptr), model(nullptr) { }
void resizeItems();
@@ -90,7 +90,8 @@ void QQuickDayOfWeekRowPrivate::resizeItems()
itemSize.setWidth((contentItem->width() - 6 * spacing) / 7);
itemSize.setHeight(contentItem->height());
- foreach (QQuickItem *item, contentItem->childItems())
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *item : childItems)
item->setSize(itemSize);
}
diff --git a/src/imports/calendar/qquickdayofweekrow_p.h b/src/imports/calendar/qquickdayofweekrow_p.h
index d1e5e16f..b0c4ead9 100644
--- a/src/imports/calendar/qquickdayofweekrow_p.h
+++ b/src/imports/calendar/qquickdayofweekrow_p.h
@@ -62,7 +62,7 @@ class QQuickDayOfWeekRow : public QQuickControl
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
public:
- explicit QQuickDayOfWeekRow(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickDayOfWeekRow(QQuickItem *parent = nullptr);
QVariant source() const;
void setSource(const QVariant &source);
@@ -75,10 +75,10 @@ Q_SIGNALS:
void delegateChanged();
protected:
- void componentComplete() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void localeChange(const QLocale &newLocale, const QLocale &oldLocale) Q_DECL_OVERRIDE;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
private:
Q_DISABLE_COPY(QQuickDayOfWeekRow)
diff --git a/src/imports/calendar/qquickmonthgrid.cpp b/src/imports/calendar/qquickmonthgrid.cpp
index fd2909f8..8fe9ad63 100644
--- a/src/imports/calendar/qquickmonthgrid.cpp
+++ b/src/imports/calendar/qquickmonthgrid.cpp
@@ -78,7 +78,7 @@ class QQuickMonthGridPrivate : public QQuickControlPrivate
Q_DECLARE_PUBLIC(QQuickMonthGrid)
public:
- QQuickMonthGridPrivate() : pressTimer(0), pressedItem(Q_NULLPTR), model(Q_NULLPTR), delegate(Q_NULLPTR) { }
+ QQuickMonthGridPrivate() : pressTimer(0), pressedItem(nullptr), model(nullptr), delegate(nullptr) { }
void resizeItems();
@@ -108,7 +108,8 @@ void QQuickMonthGridPrivate::resizeItems()
itemSize.setWidth((contentItem->width() - 6 * spacing) / 7);
itemSize.setHeight((contentItem->height() - 5 * spacing) / 6);
- foreach (QQuickItem *item, contentItem->childItems())
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *item : childItems)
item->setSize(itemSize);
}
@@ -119,7 +120,7 @@ QQuickItem *QQuickMonthGridPrivate::cellAt(const QPoint &pos) const
QPointF mapped = q->mapToItem(contentItem, pos);
return contentItem->childAt(mapped.x(), mapped.y());
}
- return Q_NULLPTR;
+ return nullptr;
}
QDate QQuickMonthGridPrivate::dateOf(QQuickItem *cell) const
@@ -150,7 +151,7 @@ void QQuickMonthGridPrivate::clearPress(bool clicked)
emit q->clicked(pressedDate);
}
pressedDate = QDate();
- pressedItem = Q_NULLPTR;
+ pressedItem = nullptr;
}
void QQuickMonthGridPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
@@ -335,7 +336,8 @@ void QQuickMonthGrid::componentComplete()
Q_D(QQuickMonthGrid);
QQuickControl::componentComplete();
if (d->contentItem) {
- foreach (QQuickItem *child, d->contentItem->childItems()) {
+ const auto childItems = d->contentItem->childItems();
+ for (QQuickItem *child : childItems) {
if (!QQuickItemPrivate::get(child)->isTransparentForPositioner())
d->setContextProperty(child, QStringLiteral("pressed"), false);
}
diff --git a/src/imports/calendar/qquickmonthgrid_p.h b/src/imports/calendar/qquickmonthgrid_p.h
index b2d8124a..93ba3900 100644
--- a/src/imports/calendar/qquickmonthgrid_p.h
+++ b/src/imports/calendar/qquickmonthgrid_p.h
@@ -65,7 +65,7 @@ class QQuickMonthGrid : public QQuickControl
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
public:
- explicit QQuickMonthGrid(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickMonthGrid(QQuickItem *parent = nullptr);
int month() const;
void setMonth(int month);
@@ -95,17 +95,17 @@ Q_SIGNALS:
void pressAndHold(const QDate &date);
protected:
- void componentComplete() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void localeChange(const QLocale &newLocale, const QLocale &oldLocale) Q_DECL_OVERRIDE;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
- void updatePolish() Q_DECL_OVERRIDE;
-
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
+ void updatePolish() override;
+
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void timerEvent(QTimerEvent *event) override;
private:
Q_DISABLE_COPY(QQuickMonthGrid)
diff --git a/src/imports/calendar/qquickmonthmodel_p.h b/src/imports/calendar/qquickmonthmodel_p.h
index 0f8347b5..578fe620 100644
--- a/src/imports/calendar/qquickmonthmodel_p.h
+++ b/src/imports/calendar/qquickmonthmodel_p.h
@@ -67,7 +67,7 @@ class QQuickMonthModel : public QAbstractListModel
Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
public:
- explicit QQuickMonthModel(QObject *parent = Q_NULLPTR);
+ explicit QQuickMonthModel(QObject *parent = nullptr);
int month() const;
void setMonth(int month);
@@ -93,9 +93,9 @@ public:
YearRole
};
- QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QHash<int, QByteArray> roleNames() const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Q_SIGNALS:
void monthChanged();
diff --git a/src/imports/calendar/qquickweeknumbercolumn.cpp b/src/imports/calendar/qquickweeknumbercolumn.cpp
index 3e8f1a6b..031b0555 100644
--- a/src/imports/calendar/qquickweeknumbercolumn.cpp
+++ b/src/imports/calendar/qquickweeknumbercolumn.cpp
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
class QQuickWeekNumberColumnPrivate : public QQuickControlPrivate
{
public:
- QQuickWeekNumberColumnPrivate() : delegate(Q_NULLPTR), model(Q_NULLPTR) { }
+ QQuickWeekNumberColumnPrivate() : delegate(nullptr), model(nullptr) { }
void resizeItems();
@@ -92,7 +92,8 @@ void QQuickWeekNumberColumnPrivate::resizeItems()
itemSize.setWidth(contentItem->width());
itemSize.setHeight((contentItem->height() - 5 * spacing) / 6);
- foreach (QQuickItem *item, contentItem->childItems())
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *item : childItems)
item->setSize(itemSize);
}
diff --git a/src/imports/calendar/qquickweeknumbercolumn_p.h b/src/imports/calendar/qquickweeknumbercolumn_p.h
index 2cacdeac..f2e0e1cc 100644
--- a/src/imports/calendar/qquickweeknumbercolumn_p.h
+++ b/src/imports/calendar/qquickweeknumbercolumn_p.h
@@ -64,7 +64,7 @@ class QQuickWeekNumberColumn : public QQuickControl
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
public:
- explicit QQuickWeekNumberColumn(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickWeekNumberColumn(QQuickItem *parent = nullptr);
int month() const;
void setMonth(int month);
@@ -85,10 +85,10 @@ Q_SIGNALS:
void delegateChanged();
protected:
- void componentComplete() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void localeChange(const QLocale &newLocale, const QLocale &oldLocale) Q_DECL_OVERRIDE;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
private:
Q_DISABLE_COPY(QQuickWeekNumberColumn)
diff --git a/src/imports/calendar/qquickweeknumbermodel_p.h b/src/imports/calendar/qquickweeknumbermodel_p.h
index 2c8b484f..74f2550f 100644
--- a/src/imports/calendar/qquickweeknumbermodel_p.h
+++ b/src/imports/calendar/qquickweeknumbermodel_p.h
@@ -65,7 +65,7 @@ class QQuickWeekNumberModel : public QAbstractListModel
Q_PROPERTY(int count READ rowCount CONSTANT FINAL)
public:
- explicit QQuickWeekNumberModel(QObject *parent = Q_NULLPTR);
+ explicit QQuickWeekNumberModel(QObject *parent = nullptr);
int month() const;
void setMonth(int month);
@@ -83,9 +83,9 @@ public:
WeekNumberRole = Qt::UserRole + 1
};
- QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE;
- QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE;
- int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
+ QHash<int, QByteArray> roleNames() const override;
+ QVariant data(const QModelIndex &index, int role) const override;
+ int rowCount(const QModelIndex &parent = QModelIndex()) const override;
Q_SIGNALS:
void monthChanged();
diff --git a/src/imports/calendar/qtlabscalendarplugin.cpp b/src/imports/calendar/qtlabscalendarplugin.cpp
index 8d7d563d..4ecd5ddb 100644
--- a/src/imports/calendar/qtlabscalendarplugin.cpp
+++ b/src/imports/calendar/qtlabscalendarplugin.cpp
@@ -42,6 +42,13 @@
#include "qquickcalendarmodel_p.h"
#include "qquickcalendar_p.h"
+static inline void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt_labs_calendar);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class QtLabsCalendarPlugin: public QQmlExtensionPlugin
@@ -50,9 +57,15 @@ class QtLabsCalendarPlugin: public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtLabsCalendarPlugin(QObject *parent = nullptr);
void registerTypes(const char *uri);
};
+QtLabsCalendarPlugin::QtLabsCalendarPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+}
+
static QObject *calendarSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine);
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
index 290f4ce4..67e9bffe 100644
--- a/src/imports/controls/Button.qml
+++ b/src/imports/controls/Button.qml
@@ -41,21 +41,17 @@ T.Button {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
leftPadding: 8
rightPadding: 8
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
opacity: enabled || highlighted ? 1 : 0.3
@@ -64,7 +60,7 @@ T.Button {
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index 4b7af3b1..52061681 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -41,13 +41,11 @@ T.CheckBox {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
spacing: 6
@@ -81,12 +79,10 @@ T.CheckBox {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -96,5 +92,5 @@ T.CheckBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 189eed92..30f45af3 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -36,6 +36,7 @@
import QtQuick 2.6
import QtQuick.Window 2.2
+import Qt.labs.controls 1.0
import Qt.labs.templates 1.0 as T
T.ComboBox {
diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml
index 3c9326e1..1f1bfac6 100644
--- a/src/imports/controls/Frame.qml
+++ b/src/imports/controls/Frame.qml
@@ -52,13 +52,10 @@ T.Frame {
contentItem: Item { }
//! [contentItem]
- //! [frame]
- frame: Rectangle {
- width: parent.width
- height: parent.height
-
+ //! [background]
+ background: Rectangle {
color: "transparent"
border.color: "#bdbebf"
}
- //! [frame]
+ //! [background]
}
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index bc1801c2..7ae14c24 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -70,8 +70,8 @@ T.GroupBox {
}
//! [label]
- //! [frame]
- frame: Rectangle {
+ //! [background]
+ background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
height: parent.height - control.topPadding + control.padding
@@ -79,5 +79,5 @@ T.GroupBox {
color: "transparent"
border.color: "#bdbebf"
}
- //! [frame]
+ //! [background]
}
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index b5dfb4b6..13a13e1e 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -41,23 +41,19 @@ T.ItemDelegate {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 12
spacing: 12
- //! [label]
- label: Text {
- x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -67,7 +63,7 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [indicator]
indicator: Image {
diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml
index ae5a8e38..75866fbe 100644
--- a/src/imports/controls/MenuItem.qml
+++ b/src/imports/controls/MenuItem.qml
@@ -40,21 +40,19 @@ import Qt.labs.templates 1.0 as T
T.MenuItem {
id: control
- implicitWidth: background ? background.implicitWidth
- : (label ? label.implicitWidth : 0) + (indicator ? indicator.implicitWidth : 0)
- + (label && indicator ? spacing : 0) + leftPadding + rightPadding
- implicitHeight: background ? background.implicitHeight
- : (label ? label.implicitHeight : 0) + (indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -64,7 +62,7 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [indicator]
indicator: Image {
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 8e1e0bce..f1e10a6c 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -42,13 +42,11 @@ T.RadioButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
spacing: 6
@@ -78,12 +76,10 @@ T.RadioButton {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -93,5 +89,5 @@ T.RadioButton {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 51348e77..01f561a1 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -41,13 +41,11 @@ T.Switch {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
spacing: 6
@@ -87,12 +85,10 @@ T.Switch {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -102,5 +98,5 @@ T.Switch {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index 178a0a7f..63a88b10 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -41,20 +41,15 @@ T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.contentWidth + leftPadding + rightPadding : 0)
+ contentItem.contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.contentHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.contentHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
elide: Text.ElideRight
@@ -63,7 +58,7 @@ T.TabButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml
index 8326fc89..46b6bc6c 100644
--- a/src/imports/controls/TextArea.qml
+++ b/src/imports/controls/TextArea.qml
@@ -67,7 +67,7 @@ T.TextArea {
color: "#c2c2c2"
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
- visible: !control.length && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
}
}
diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml
index d9f31b2f..7abf540b 100644
--- a/src/imports/controls/TextField.qml
+++ b/src/imports/controls/TextField.qml
@@ -66,7 +66,7 @@ T.TextField {
color: "#bdbebf"
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
- visible: !control.displayText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
}
diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml
index 314ce966..a610dc2b 100644
--- a/src/imports/controls/ToolButton.qml
+++ b/src/imports/controls/ToolButton.qml
@@ -41,20 +41,15 @@ T.ToolButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
color: control.enabled ? "#26282a" : "#c2c2c2"
@@ -62,7 +57,7 @@ T.ToolButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index c3391929..32e86f3a 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -1,4 +1,4 @@
-QML_FILES = \
+QML_CONTROLS = \
ApplicationWindow.qml \
BusyIndicator.qml \
Button.qml \
@@ -33,3 +33,5 @@ QML_FILES = \
ToolBar.qml \
ToolButton.qml \
Tumbler.qml
+
+!qtquickcompiler: QML_FILES += $$QML_CONTROLS
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index 30f8e223..0ccdf5a0 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -27,5 +27,11 @@ RESOURCES += \
include(controls.pri)
include(designer/designer.pri)
+qtquickcompiler {
+ qmlfiles.prefix = /qt-project.org/imports/Qt/labs/controls
+ qmlfiles.files += $$QML_CONTROLS
+ RESOURCES += qmlfiles
+}
+
CONFIG += no_cxx_module
load(qml_plugin)
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-label.png b/src/imports/controls/doc/images/qtlabscontrols-button-contentItem.png
index 73d8f2fb..73d8f2fb 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-button-label.png
+++ b/src/imports/controls/doc/images/qtlabscontrols-button-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-label.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-contentItem.png
index d5a1ef2e..d5a1ef2e 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-label.png
+++ b/src/imports/controls/doc/images/qtlabscontrols-checkbox-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-frame-frame.png b/src/imports/controls/doc/images/qtlabscontrols-frame-frame.png
deleted file mode 100644
index a379d915..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-frame-frame.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-groupbox-frame.png b/src/imports/controls/doc/images/qtlabscontrols-groupbox-frame.png
deleted file mode 100644
index 2ed75011..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-groupbox-frame.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-label.png b/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-contentItem.png
index 89f094c6..89f094c6 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-label.png
+++ b/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-contentItem.png
index 457555b7..457555b7 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.png
+++ b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-label.png b/src/imports/controls/doc/images/qtlabscontrols-switch-contentItem.png
index 50f608ab..50f608ab 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-label.png
+++ b/src/imports/controls/doc/images/qtlabscontrols-switch-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-toolbar-frame.png b/src/imports/controls/doc/images/qtlabscontrols-toolbar-frame.png
deleted file mode 100644
index 12b4c348..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbar-frame.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-toolbutton-label.png b/src/imports/controls/doc/images/qtlabscontrols-toolbutton-contentItem.png
index f4797098..f4797098 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbutton-label.png
+++ b/src/imports/controls/doc/images/qtlabscontrols-toolbutton-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-contentItem.qml
index 4fbeab08..ee59ab7f 100644
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-button-contentItem.qml
@@ -32,7 +32,7 @@ Button {
width: 80
text: "Button"
Rectangle {
- anchors.fill: label
+ anchors.fill: contentItem
color: 'transparent'
border.color: 'red'
}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-contentItem.qml
index fcb3a49d..bef150a3 100644
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-label.qml
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-contentItem.qml
@@ -31,7 +31,7 @@ import Qt.labs.controls 1.0
CheckBox {
text: "CheckBox"
Rectangle {
- anchors.fill: label
+ anchors.fill: contentItem
color: "transparent"
border.color: "red"
}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-frame-frame.qml b/src/imports/controls/doc/snippets/qtlabscontrols-frame-frame.qml
deleted file mode 100644
index e4c9e32b..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-frame-frame.qml
+++ /dev/null
@@ -1,40 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import Qt.labs.controls 1.0
-
-Frame {
- width: 100
- height: 100
- Rectangle {
- parent: frame
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-frame.qml b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-frame.qml
deleted file mode 100644
index 49ecc00d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-frame.qml
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import Qt.labs.controls 1.0
-
-GroupBox {
- width: 100
- height: 100
- title: "GroupBox"
- Rectangle {
- parent: frame
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-contentItem.qml
index 696560a5..43e6f85e 100644
--- a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-label.qml
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-contentItem.qml
@@ -33,7 +33,7 @@ ItemDelegate {
checked: true
checkable: true
Rectangle {
- anchors.fill: label
+ anchors.fill: contentItem
color: "transparent"
border.color: "red"
}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-contentItem.qml
index eab52fbe..14bb7c47 100644
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-label.qml
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-contentItem.qml
@@ -31,7 +31,7 @@ import Qt.labs.controls 1.0
RadioButton {
text: "RadioButton"
Rectangle {
- anchors.fill: label
+ anchors.fill: contentItem
color: "transparent"
border.color: "red"
}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-contentItem.qml
index c739bf57..99f2af7e 100644
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-label.qml
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-switch-contentItem.qml
@@ -31,7 +31,7 @@ import Qt.labs.controls 1.0
Switch {
text: "Switch"
Rectangle {
- anchors.fill: label
+ anchors.fill: contentItem
color: "transparent"
border.color: "red"
}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-toolbar-frame.qml b/src/imports/controls/doc/snippets/qtlabscontrols-toolbar-frame.qml
deleted file mode 100644
index b887d464..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbar-frame.qml
+++ /dev/null
@@ -1,38 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** 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 Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import Qt.labs.controls 1.0
-
-ToolBar {
- width: 100
- frame: Rectangle {
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-contentItem.qml
index 5a8c3a50..9a25d130 100644
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-label.qml
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-contentItem.qml
@@ -31,7 +31,7 @@ import Qt.labs.controls 1.0
ToolButton {
text: "ToolButton"
Rectangle {
- anchors.fill: label
+ anchors.fill: contentItem
color: 'transparent'
border.color: 'red'
}
diff --git a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
index 4aff46a4..1811d638 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
@@ -57,7 +57,7 @@
\section1 Customizing Button
Button consists of two visual items: \l {Control::background}{background}
- and \l {AbstractButton::label}{label}.
+ and \l {Control::contentItem}{content item}.
\section3 Background
@@ -65,17 +65,17 @@
\snippet Button.qml background
- \section3 Label
+ \section3 Content item
- \image qtlabscontrols-button-label.png
+ \image qtlabscontrols-button-contentItem.png
- \snippet Button.qml label
+ \snippet Button.qml contentItem
\section1 Customizing CheckBox
CheckBox consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
+ \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
\section3 Background
@@ -83,11 +83,11 @@
CheckBox has no background item by default.
- \section3 Label
+ \section3 Content item
- \image qtlabscontrols-checkbox-label.png
+ \image qtlabscontrols-checkbox-contentItem.png
- \snippet CheckBox.qml label
+ \snippet CheckBox.qml contentItem
\section3 Indicator
@@ -162,38 +162,25 @@
\section1 Customizing Frame
- Frame consists of two visual items: \l {Control::background}{background}
- and \l {Frame::frame}{frame}.
+ Frame consists of one visual item: \l {Control::background}{background}.
\section3 Background
\image qtlabscontrols-frame-background.png
- Frame has no background item by default.
-
- \section3 Frame
-
- \image qtlabscontrols-frame-frame.png
-
- \snippet Frame.qml frame
+ \snippet Frame.qml background
\section1 Customizing GroupBox
- GroupBox consists of three visual items: \l {Control::background}{background},
- \l {Frame::frame}{frame} and \l {GroupBox::label}{label}.
+ GroupBox consists of two visual items: \l {Control::background}{background}
+ and \l {GroupBox::label}{label}.
\section3 Background
\image qtlabscontrols-groupbox-background.png
- GroupBox has no background item by default.
-
- \section3 Frame
-
- \image qtlabscontrols-groupbox-frame.png
-
- \snippet GroupBox.qml frame
+ \snippet GroupBox.qml background
\section3 Label
@@ -205,7 +192,7 @@
\section1 Customizing ItemDelegate
ItemDelegate consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
+ \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
The indicator is only visible for \l {AbstractButton::checkable}{checkable} items.
\section3 Background
@@ -214,11 +201,11 @@
\snippet ItemDelegate.qml background
- \section3 Label
+ \section3 Content item
- \image qtlabscontrols-itemdelegate-label.png
+ \image qtlabscontrols-itemdelegate-contentItem.png
- \snippet ItemDelegate.qml label
+ \snippet ItemDelegate.qml contentItem
\section3 Indicator
@@ -292,7 +279,7 @@
\section1 Customizing RadioButton
RadioButton consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
+ \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
\section3 Background
@@ -300,11 +287,11 @@
RadioButton has no background item by default.
- \section3 Label
+ \section3 Content item
- \image qtlabscontrols-radiobutton-label.png
+ \image qtlabscontrols-radiobutton-contentItem.png
- \snippet RadioButton.qml label
+ \snippet RadioButton.qml contentItem
\section3 Indicator
@@ -484,7 +471,7 @@
\section1 Customizing Switch
Switch consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
+ \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
\section3 Background
@@ -492,11 +479,11 @@
Switch has no background item by default.
- \section3 Label
+ \section3 Content item
- \image qtlabscontrols-switch-label.png
+ \image qtlabscontrols-switch-contentItem.png
- \snippet Switch.qml label
+ \snippet Switch.qml contentItem
\section3 Indicator
@@ -533,8 +520,7 @@
\section1 Customizing ToolBar
- ToolBar consists of two visual items: \l {Control::background}{background} and
- \l {Frame::frame}{frame}.
+ ToolBar consists of one visual item: \l {Control::background}{background}.
\section3 Background
@@ -552,7 +538,7 @@
\section1 Customizing ToolButton
ToolButton consists of two visual items: \l {Control::background}{background}
- and \l {AbstractButton::label}{label}.
+ and \l {Control::contentItem}{content item}.
\section3 Background
@@ -560,11 +546,11 @@
\snippet ToolButton.qml background
- \section3 Label
+ \section3 Content item
- \image qtlabscontrols-toolbutton-label.png
+ \image qtlabscontrols-toolbutton-contentItem.png
- \snippet ToolButton.qml label
+ \snippet ToolButton.qml contentItem
\section1 Customizing Tumbler
diff --git a/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc b/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
index 7fcce7a3..87bf152d 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
@@ -155,7 +155,7 @@
\qml
Button {
- label: Label {
+ contentItem: Label {
// ...
}
}
diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml
index 77128861..d0b05b2c 100644
--- a/src/imports/controls/material/Button.qml
+++ b/src/imports/controls/material/Button.qml
@@ -43,23 +43,18 @@ T.Button {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
// external vertical padding is 6 (to increase touch area)
padding: 12
leftPadding: 8
rightPadding: 8
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
color: !control.enabled ? control.Material.hintTextColor :
@@ -68,7 +63,7 @@ T.Button {
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml
index 5becfc5c..abaf571d 100644
--- a/src/imports/controls/material/CheckBox.qml
+++ b/src/imports/controls/material/CheckBox.qml
@@ -37,18 +37,17 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
T.CheckBox {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 8
topPadding: 14
@@ -143,12 +142,10 @@ T.CheckBox {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -158,5 +155,5 @@ T.CheckBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index eb637ef2..5529c546 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -36,6 +36,7 @@
import QtQuick 2.6
import QtQuick.Window 2.2
+import Qt.labs.controls 1.0
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
import QtGraphicalEffects 1.0
diff --git a/src/imports/controls/material/Frame.qml b/src/imports/controls/material/Frame.qml
index 9336850d..4c21e40b 100644
--- a/src/imports/controls/material/Frame.qml
+++ b/src/imports/controls/material/Frame.qml
@@ -53,14 +53,11 @@ T.Frame {
contentItem: Item { }
//! [contentItem]
- //! [frame]
- frame: Rectangle {
- width: parent.width
- height: parent.height
-
+ //! [background]
+ background: Rectangle {
radius: 3
color: "transparent"
border.color: control.Material.frameColor
}
- //! [frame]
+ //! [background]
}
diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml
index 3461cb6e..ef54ea7c 100644
--- a/src/imports/controls/material/GroupBox.qml
+++ b/src/imports/controls/material/GroupBox.qml
@@ -71,8 +71,8 @@ T.GroupBox {
}
//! [label]
- //! [frame]
- frame: Rectangle {
+ //! [background]
+ background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
height: parent.height - control.topPadding + control.padding
@@ -81,5 +81,5 @@ T.GroupBox {
color: "transparent"
border.color: control.Material.frameColor
}
- //! [frame]
+ //! [background]
}
diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml
index acfbfb98..132cce3d 100644
--- a/src/imports/controls/material/ItemDelegate.qml
+++ b/src/imports/controls/material/ItemDelegate.qml
@@ -37,18 +37,17 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
T.ItemDelegate {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 16
spacing: 16
@@ -128,12 +127,10 @@ T.ItemDelegate {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -143,7 +140,7 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml
index 89867e15..e2042894 100644
--- a/src/imports/controls/material/MenuItem.qml
+++ b/src/imports/controls/material/MenuItem.qml
@@ -37,18 +37,17 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
T.MenuItem {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 16
spacing: 16
@@ -128,12 +127,10 @@ T.MenuItem {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -143,7 +140,7 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index 25d91a5c..429e4f80 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -37,18 +37,17 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
T.RadioButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 8
topPadding: 14
@@ -87,12 +86,10 @@ T.RadioButton {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -102,5 +99,5 @@ T.RadioButton {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml
index bf8c16ef..617f9ac7 100644
--- a/src/imports/controls/material/RangeSlider.qml
+++ b/src/imports/controls/material/RangeSlider.qml
@@ -37,6 +37,7 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
T.RangeSlider {
id: control
diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml
index 139c9151..c121c10b 100644
--- a/src/imports/controls/material/Slider.qml
+++ b/src/imports/controls/material/Slider.qml
@@ -37,6 +37,7 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
T.Slider {
id: control
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index f44fb31a..a38a643c 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -36,6 +36,7 @@
import QtQuick 2.6
import Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
import Qt.labs.templates 1.0 as T
import QtGraphicalEffects 1.0
@@ -43,13 +44,11 @@ T.Switch {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 8
spacing: 8
@@ -107,12 +106,10 @@ T.Switch {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -122,5 +119,5 @@ T.Switch {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml
index 27b27e3b..496513dd 100644
--- a/src/imports/controls/material/TabButton.qml
+++ b/src/imports/controls/material/TabButton.qml
@@ -42,20 +42,15 @@ T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.contentWidth + leftPadding + rightPadding : 0)
+ contentItem.contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.contentHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.contentHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 12
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
elide: Text.ElideRight
@@ -63,7 +58,7 @@ T.TabButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Item {
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index a5423727..b6f614c0 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -92,7 +92,7 @@ T.TextArea {
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
elide: Text.ElideRight
- visible: !control.length && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
}
//! [placeholder]
diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml
index 6a0010f7..eaea710e 100644
--- a/src/imports/controls/material/TextField.qml
+++ b/src/imports/controls/material/TextField.qml
@@ -91,7 +91,7 @@ T.TextField {
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
elide: Text.ElideRight
- visible: !control.displayText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
}
//! [placeholder]
diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml
index ebdc36f2..34a745c1 100644
--- a/src/imports/controls/material/ToolButton.qml
+++ b/src/imports/controls/material/ToolButton.qml
@@ -42,20 +42,15 @@ T.ToolButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
@@ -63,7 +58,7 @@ T.ToolButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp
index c11a347f..dc96fe03 100644
--- a/src/imports/controls/material/qquickmaterialprogressring.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressring.cpp
@@ -67,11 +67,11 @@ public:
QQuickMaterialRingAnimatorJob();
~QQuickMaterialRingAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
+ void afterNodeSync() override;
private:
qreal m_devicePixelRatio;
@@ -167,8 +167,8 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const
QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() :
m_devicePixelRatio(1.0),
- m_containerNode(Q_NULLPTR),
- m_window(Q_NULLPTR)
+ m_containerNode(nullptr),
+ m_window(nullptr)
{
}
@@ -258,8 +258,8 @@ void QQuickMaterialRingAnimatorJob::writeBack()
void QQuickMaterialRingAnimatorJob::nodeWasDestroyed()
{
- m_containerNode = Q_NULLPTR;
- m_window = Q_NULLPTR;
+ m_containerNode = nullptr;
+ m_window = nullptr;
}
void QQuickMaterialRingAnimatorJob::afterNodeSync()
diff --git a/src/imports/controls/material/qquickmaterialprogressring_p.h b/src/imports/controls/material/qquickmaterialprogressring_p.h
index 6f4ebc6b..a829f948 100644
--- a/src/imports/controls/material/qquickmaterialprogressring_p.h
+++ b/src/imports/controls/material/qquickmaterialprogressring_p.h
@@ -60,7 +60,7 @@ class QQuickMaterialProgressRing : public QQuickItem
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
public:
- explicit QQuickMaterialProgressRing(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickMaterialProgressRing(QQuickItem *parent = nullptr);
~QQuickMaterialProgressRing();
QColor color() const;
@@ -70,7 +70,7 @@ Q_SIGNALS:
void colorChanged();
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
QColor m_color;
@@ -79,11 +79,11 @@ private:
class QQuickMaterialRingAnimator : public QQuickAnimator
{
public:
- QQuickMaterialRingAnimator(QObject *parent = Q_NULLPTR);
+ QQuickMaterialRingAnimator(QObject *parent = nullptr);
protected:
- QString propertyName() const Q_DECL_OVERRIDE;
- QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialprogressstrip.cpp b/src/imports/controls/material/qquickmaterialprogressstrip.cpp
index 3ac09e24..a3ff6c9b 100644
--- a/src/imports/controls/material/qquickmaterialprogressstrip.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressstrip.cpp
@@ -54,11 +54,11 @@ class QQuickMaterialProgressStripAnimatorJob : public QQuickAnimatorJob
public:
QQuickMaterialProgressStripAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
+ void afterNodeSync() override;
void moveNode(QSGTransformNode *node, const QRectF &geometry, qreal progress);
@@ -66,7 +66,7 @@ private:
QSGNode *m_node;
};
-QQuickMaterialProgressStripAnimatorJob::QQuickMaterialProgressStripAnimatorJob() : m_node(Q_NULLPTR)
+QQuickMaterialProgressStripAnimatorJob::QQuickMaterialProgressStripAnimatorJob() : m_node(nullptr)
{
}
@@ -111,7 +111,7 @@ void QQuickMaterialProgressStripAnimatorJob::writeBack()
void QQuickMaterialProgressStripAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
void QQuickMaterialProgressStripAnimatorJob::afterNodeSync()
diff --git a/src/imports/controls/material/qquickmaterialprogressstrip_p.h b/src/imports/controls/material/qquickmaterialprogressstrip_p.h
index d0618af6..38333ee5 100644
--- a/src/imports/controls/material/qquickmaterialprogressstrip_p.h
+++ b/src/imports/controls/material/qquickmaterialprogressstrip_p.h
@@ -61,7 +61,7 @@ class QQuickMaterialProgressStrip : public QQuickItem
Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate FINAL)
public:
- QQuickMaterialProgressStrip(QQuickItem *parent = Q_NULLPTR);
+ QQuickMaterialProgressStrip(QQuickItem *parent = nullptr);
QColor color() const;
void setColor(const QColor &color);
@@ -73,7 +73,7 @@ public:
void setIndeterminate(bool indeterminate);
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
QColor m_color;
@@ -86,11 +86,11 @@ class QQuickMaterialStripAnimator : public QQuickAnimator
Q_OBJECT
public:
- QQuickMaterialStripAnimator(QObject *parent = Q_NULLPTR);
+ QQuickMaterialStripAnimator(QObject *parent = nullptr);
protected:
- QString propertyName() const Q_DECL_OVERRIDE;
- QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index c2e43254..29ff2c48 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -451,7 +451,8 @@ void QQuickMaterialStyle::inheritTheme(Theme theme)
void QQuickMaterialStyle::propagateTheme()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyle *child : styles) {
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
if (material)
material->inheritTheme(m_theme);
@@ -520,7 +521,8 @@ void QQuickMaterialStyle::inheritPrimary(uint primary, bool custom)
void QQuickMaterialStyle::propagatePrimary()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyle *child : styles) {
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
if (material)
material->inheritPrimary(m_primary, m_customPrimary);
@@ -590,7 +592,8 @@ void QQuickMaterialStyle::inheritAccent(uint accent, bool custom)
void QQuickMaterialStyle::propagateAccent()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyle *child : styles) {
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
if (material)
material->inheritAccent(m_accent, m_customAccent);
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index f92bfe9d..9f3dbbbd 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -146,7 +146,7 @@ public:
Q_ENUM(Color)
Q_ENUM(Shade)
- explicit QQuickMaterialStyle(QObject *parent = Q_NULLPTR);
+ explicit QQuickMaterialStyle(QObject *parent = nullptr);
static QQuickMaterialStyle *qmlAttachedProperties(QObject *object);
@@ -214,7 +214,7 @@ Q_SIGNALS:
void paletteChanged();
protected:
- void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) Q_DECL_OVERRIDE;
+ void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) override;
private:
void init();
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index e0279bf6..27ffdddc 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -61,7 +61,7 @@ public:
~QQuickMaterialTheme();
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type = SystemFont) const override;
private:
QFont systemFont;
diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
index 11df4464..e4b44890 100644
--- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
+++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
@@ -47,6 +47,9 @@
static inline void initResources()
{
Q_INIT_RESOURCE(qtlabsmaterialstyleplugin);
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt_labs_controls_material);
+#endif
}
QT_BEGIN_NAMESPACE
@@ -57,14 +60,20 @@ class QtLabsMaterialStylePlugin : public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtLabsMaterialStylePlugin(QObject *parent = nullptr);
~QtLabsMaterialStylePlugin();
- void registerTypes(const char *uri) Q_DECL_OVERRIDE;
- void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE;
+ void registerTypes(const char *uri) override;
+ void initializeEngine(QQmlEngine *engine, const char *uri) override;
private:
QQuickProxyTheme *theme;
};
+QtLabsMaterialStylePlugin::QtLabsMaterialStylePlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+}
+
QtLabsMaterialStylePlugin::~QtLabsMaterialStylePlugin()
{
if (theme) {
@@ -82,7 +91,6 @@ void QtLabsMaterialStylePlugin::registerTypes(const char *uri)
void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
Q_UNUSED(engine);
- Q_UNUSED(uri);
QQuickStyleSelector selector;
if (selector.style() == QLatin1String("material")) {
@@ -93,13 +101,13 @@ void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char
}
}
- initResources();
-
QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterType<QQuickMaterialProgressRing>(import, 1, 0, "ProgressRing");
qmlRegisterType<QQuickMaterialProgressStrip>(import, 1, 0, "ProgressStrip");
qmlRegisterType<QQuickMaterialRingAnimator>(import, 1, 0, "RingAnimator");
qmlRegisterType<QQuickMaterialStripAnimator>(import, 1, 0, "StripAnimator");
+ qmlRegisterType(QUrl(baseUrl().toString() + QStringLiteral("/Ripple.qml")), import, 1, 0, "Ripple");
+ qmlRegisterType(QUrl(baseUrl().toString() + QStringLiteral("/SliderHandle.qml")), import, 1, 0, "SliderHandle");
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes
index e9f0cff2..91553625 100644
--- a/src/imports/controls/plugins.qmltypes
+++ b/src/imports/controls/plugins.qmltypes
@@ -28,7 +28,6 @@ Module {
Property { name: "autoExclusive"; type: "bool" }
Property { name: "autoRepeat"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
- Property { name: "label"; type: "QQuickItem"; isPointer: true }
Signal { name: "pressed" }
Signal { name: "released" }
Signal { name: "canceled" }
diff --git a/src/imports/controls/qquickbusyindicatorring.cpp b/src/imports/controls/qquickbusyindicatorring.cpp
index 96213fa4..06e62c16 100644
--- a/src/imports/controls/qquickbusyindicatorring.cpp
+++ b/src/imports/controls/qquickbusyindicatorring.cpp
@@ -50,11 +50,11 @@ public:
QQuickBusyIndicatorAnimatorJob();
~QQuickBusyIndicatorAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
+ void afterNodeSync() override;
private:
QSGNode *m_node;
@@ -159,7 +159,7 @@ QQuickAnimatorJob *QQuickBusyIndicatorAnimator::createJob() const
return new QQuickBusyIndicatorAnimatorJob;
}
-QQuickBusyIndicatorAnimatorJob::QQuickBusyIndicatorAnimatorJob() : m_node(Q_NULLPTR)
+QQuickBusyIndicatorAnimatorJob::QQuickBusyIndicatorAnimatorJob() : m_node(nullptr)
{
}
@@ -217,7 +217,7 @@ void QQuickBusyIndicatorAnimatorJob::writeBack()
void QQuickBusyIndicatorAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
void QQuickBusyIndicatorAnimatorJob::afterNodeSync()
diff --git a/src/imports/controls/qquickbusyindicatorring_p.h b/src/imports/controls/qquickbusyindicatorring_p.h
index 4697628d..cd1e70ad 100644
--- a/src/imports/controls/qquickbusyindicatorring_p.h
+++ b/src/imports/controls/qquickbusyindicatorring_p.h
@@ -58,21 +58,21 @@ class QQuickBusyIndicatorRing : public QQuickItem
Q_OBJECT
public:
- explicit QQuickBusyIndicatorRing(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickBusyIndicatorRing(QQuickItem *parent = nullptr);
~QQuickBusyIndicatorRing();
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
};
class QQuickBusyIndicatorAnimator : public QQuickAnimator
{
public:
- QQuickBusyIndicatorAnimator(QObject *parent = Q_NULLPTR);
+ QQuickBusyIndicatorAnimator(QObject *parent = nullptr);
protected:
- QString propertyName() const Q_DECL_OVERRIDE;
- QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/qquickprogressstrip.cpp b/src/imports/controls/qquickprogressstrip.cpp
index e9480ff1..0fc72087 100644
--- a/src/imports/controls/qquickprogressstrip.cpp
+++ b/src/imports/controls/qquickprogressstrip.cpp
@@ -47,11 +47,11 @@ public:
QQuickProgressAnimatorJob();
~QQuickProgressAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void afterNodeSync() override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
private:
QSGNode *m_node;
@@ -210,7 +210,7 @@ QQuickAnimatorJob *QQuickProgressAnimator::createJob() const
}
QQuickProgressAnimatorJob::QQuickProgressAnimatorJob() :
- m_node(Q_NULLPTR)
+ m_node(nullptr)
{
}
@@ -308,7 +308,7 @@ void QQuickProgressAnimatorJob::writeBack()
void QQuickProgressAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/qquickprogressstrip_p.h b/src/imports/controls/qquickprogressstrip_p.h
index c34698dc..105c6a29 100644
--- a/src/imports/controls/qquickprogressstrip_p.h
+++ b/src/imports/controls/qquickprogressstrip_p.h
@@ -60,7 +60,7 @@ class QQuickProgressStrip : public QQuickItem
Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged FINAL)
public:
- explicit QQuickProgressStrip(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickProgressStrip(QQuickItem *parent = nullptr);
~QQuickProgressStrip();
bool isIndeterminate() const;
@@ -74,7 +74,7 @@ Q_SIGNALS:
void indeterminateChanged();
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
qreal m_progress;
@@ -84,11 +84,11 @@ private:
class QQuickProgressAnimator : public QQuickAnimator
{
public:
- QQuickProgressAnimator(QObject *parent = Q_NULLPTR);
+ QQuickProgressAnimator(QObject *parent = nullptr);
protected:
- QString propertyName() const Q_DECL_OVERRIDE;
- QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/qtlabscontrolsplugin.cpp b/src/imports/controls/qtlabscontrolsplugin.cpp
index 4258fb9c..008d13a7 100644
--- a/src/imports/controls/qtlabscontrolsplugin.cpp
+++ b/src/imports/controls/qtlabscontrolsplugin.cpp
@@ -36,6 +36,7 @@
#include <QtQml/qqmlextensionplugin.h>
#include <QtCore/qurl.h>
+#include <QtCore/qfile.h>
#include <QtCore/qcoreapplication.h>
#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
@@ -51,6 +52,9 @@
static inline void initResources()
{
Q_INIT_RESOURCE(qtlabscontrolsplugin);
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt_labs_controls);
+#endif
}
QT_BEGIN_NAMESPACE
@@ -61,10 +65,16 @@ class QtLabsControlsPlugin: public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtLabsControlsPlugin(QObject *parent = nullptr);
void registerTypes(const char *uri);
void initializeEngine(QQmlEngine *engine, const char *uri);
};
+QtLabsControlsPlugin::QtLabsControlsPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+}
+
void QtLabsControlsPlugin::registerTypes(const char *uri)
{
qmlRegisterType<QQuickAbstractButton>(uri, 1, 0, "AbstractButton");
@@ -74,7 +84,10 @@ void QtLabsControlsPlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickControl>(uri, 1, 0, "Control");
QQuickStyleSelector selector;
- selector.setBaseUrl(baseUrl());
+ if (QFile::exists(QLatin1String(":/qt-project.org/imports/Qt/labs/controls/ApplicationWindow.qml")))
+ selector.setBaseUrl(QUrl(QLatin1String("qrc:/qt-project.org/imports/Qt/labs/controls")));\
+ else
+ selector.setBaseUrl(baseUrl());
qmlRegisterType(selector.select(QStringLiteral("/ApplicationWindow.qml")), uri, 1, 0, "ApplicationWindow");
qmlRegisterType(selector.select(QStringLiteral("/BusyIndicator.qml")), uri, 1, 0, "BusyIndicator");
@@ -116,7 +129,6 @@ void QtLabsControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
Q_UNUSED(engine);
Q_UNUSED(uri);
- initResources();
const QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterType<QQuickBusyIndicatorRing>(import, 1, 0, "BusyRing");
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml
index c43d8d67..18b242ca 100644
--- a/src/imports/controls/universal/Button.qml
+++ b/src/imports/controls/universal/Button.qml
@@ -42,10 +42,10 @@ T.Button {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
topPadding: 4
leftPadding: 8
@@ -54,13 +54,8 @@ T.Button {
property bool useSystemFocusVisuals: true
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
elide: Text.ElideRight
@@ -70,7 +65,7 @@ T.Button {
color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index 07321a9c..b5442c57 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -42,13 +42,11 @@ T.CheckBox {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
spacing: 8
@@ -92,12 +90,10 @@ T.CheckBox {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -109,5 +105,5 @@ T.CheckBox {
color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index 5c0f1004..f736ef96 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -36,6 +36,7 @@
import QtQuick 2.6
import QtQuick.Window 2.2
+import Qt.labs.controls 1.0
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.universal 1.0
diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml
index 9427dc2f..70f1647d 100644
--- a/src/imports/controls/universal/Frame.qml
+++ b/src/imports/controls/universal/Frame.qml
@@ -53,13 +53,10 @@ T.Frame {
contentItem: Item { }
//! [contentItem]
- //! [frame]
- frame: Rectangle {
- width: parent.width
- height: parent.height
-
+ //! [background]
+ background: Rectangle {
color: "transparent"
border.color: control.Universal.chromeDisabledLowColor
}
- //! [frame]
+ //! [background]
}
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
index 9b21a17f..5b25fc75 100644
--- a/src/imports/controls/universal/GroupBox.qml
+++ b/src/imports/controls/universal/GroupBox.qml
@@ -72,8 +72,8 @@ T.GroupBox {
}
//! [label]
- //! [frame]
- frame: Rectangle {
+ //! [background]
+ background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
height: parent.height - control.topPadding + control.padding
@@ -81,5 +81,5 @@ T.GroupBox {
color: "transparent"
border.color: control.Universal.chromeDisabledLowColor
}
- //! [frame]
+ //! [background]
}
diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml
index d2c9a4f3..406bdb42 100644
--- a/src/imports/controls/universal/ItemDelegate.qml
+++ b/src/imports/controls/universal/ItemDelegate.qml
@@ -42,13 +42,11 @@ T.ItemDelegate {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 12
@@ -67,12 +65,10 @@ T.ItemDelegate {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -84,7 +80,7 @@ T.ItemDelegate {
color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml
index fee5d886..cc8cb75d 100644
--- a/src/imports/controls/universal/MenuItem.qml
+++ b/src/imports/controls/universal/MenuItem.qml
@@ -41,12 +41,12 @@ import Qt.labs.controls.universal 1.0
T.MenuItem {
id: control
- implicitWidth: background ? background.implicitWidth
- : (label ? label.implicitWidth : 0) + (indicator ? indicator.implicitWidth : 0)
- + (label && indicator ? spacing : 0) + leftPadding + rightPadding
- implicitHeight: background ? background.implicitHeight
- : (label ? label.implicitHeight : 0) + (indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
topPadding: 11
leftPadding: 12
@@ -54,12 +54,10 @@ T.MenuItem {
bottomPadding: 13
spacing: 12
- //! [label]
- label: Text {
- x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -69,7 +67,7 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
+ //! [contentItem]
//! [indicator]
indicator: Image {
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 04cd3dcc..45e77ac1 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -42,13 +42,11 @@ T.RadioButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
spacing: 8
@@ -98,12 +96,10 @@ T.RadioButton {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -115,5 +111,5 @@ T.RadioButton {
color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index ca33e121..f37c1054 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -42,13 +42,11 @@ T.Switch {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 5
spacing: 8
@@ -90,12 +88,10 @@ T.Switch {
}
//! [indicator]
- //! [label]
- label: Text {
- x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
- y: control.topPadding
- width: control.availableWidth - indicator.width - control.spacing
- height: control.availableHeight
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -107,5 +103,5 @@ T.Switch {
color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/universal/TabButton.qml b/src/imports/controls/universal/TabButton.qml
index 3b9fc60c..b332160b 100644
--- a/src/imports/controls/universal/TabButton.qml
+++ b/src/imports/controls/universal/TabButton.qml
@@ -42,20 +42,15 @@ T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 12 // PivotItemMargin
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
elide: Text.ElideRight
@@ -64,5 +59,5 @@ T.TabButton {
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
- //! [label]
+ //! [contentItem]
}
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
index 72b69cb9..4f3f8a34 100644
--- a/src/imports/controls/universal/TextArea.qml
+++ b/src/imports/controls/universal/TextArea.qml
@@ -73,7 +73,7 @@ T.TextArea {
font: control.font
color: !control.enabled ? control.Universal.chromeDisabledLowColor :
control.activeFocus ? control.Universal.chromeBlackMediumLowColor : control.Universal.baseMediumColor
- visible: !control.length && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
renderType: Text.NativeRendering
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index 1f066220..a0c854b2 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -74,7 +74,7 @@ T.TextField {
font: control.font
color: !control.enabled ? control.Universal.chromeDisabledLowColor :
control.activeFocus ? control.Universal.chromeBlackMediumLowColor : control.Universal.baseMediumColor
- visible: !control.displayText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
+ visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
renderType: Text.NativeRendering
diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml
index f3fe80d4..f5fd5c88 100644
--- a/src/imports/controls/universal/ToolButton.qml
+++ b/src/imports/controls/universal/ToolButton.qml
@@ -42,22 +42,17 @@ T.ToolButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
property bool useSystemFocusVisuals: true
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ //! [contentItem]
+ contentItem: Text {
text: control.text
font: control.font
color: control.enabled ? control.Universal.baseHighColor : control.Universal.baseLowColor
@@ -66,7 +61,7 @@ T.ToolButton {
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
- //! [label]
+ //! [contentItem]
//! [background]
background: Rectangle {
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h b/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
index 6b15bc8d..628db5b2 100644
--- a/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
+++ b/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
@@ -57,9 +57,9 @@ class QQuickUniversalFocusRectangle : public QQuickPaintedItem
Q_OBJECT
public:
- QQuickUniversalFocusRectangle(QQuickItem *parent = Q_NULLPTR);
+ QQuickUniversalFocusRectangle(QQuickItem *parent = nullptr);
- void paint(QPainter *painter) Q_DECL_OVERRIDE;
+ void paint(QPainter *painter) override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp
index 2fe66047..9b95341d 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp
@@ -53,11 +53,11 @@ class QQuickUniversalProgressRingAnimatorJob : public QQuickAnimatorJob
public:
QQuickUniversalProgressRingAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
+ void afterNodeSync() override;
private:
struct Phase {
@@ -73,7 +73,7 @@ private:
Phase m_phases[PhaseCount];
};
-QQuickUniversalProgressRingAnimatorJob::QQuickUniversalProgressRingAnimatorJob() : m_node(Q_NULLPTR)
+QQuickUniversalProgressRingAnimatorJob::QQuickUniversalProgressRingAnimatorJob() : m_node(nullptr)
{
m_phases[0] = Phase(433, -110, 10, QEasingCurve::BezierSpline);
m_phases[1] = Phase(767, 10, 93, QEasingCurve::Linear );
@@ -153,7 +153,7 @@ void QQuickUniversalProgressRingAnimatorJob::writeBack()
void QQuickUniversalProgressRingAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
void QQuickUniversalProgressRingAnimatorJob::afterNodeSync()
diff --git a/src/imports/controls/universal/qquickuniversalprogressring_p.h b/src/imports/controls/universal/qquickuniversalprogressring_p.h
index 1d484e3a..f32beb54 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring_p.h
+++ b/src/imports/controls/universal/qquickuniversalprogressring_p.h
@@ -60,7 +60,7 @@ class QQuickUniversalProgressRing : public QQuickItem
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
public:
- QQuickUniversalProgressRing(QQuickItem *parent = Q_NULLPTR);
+ QQuickUniversalProgressRing(QQuickItem *parent = nullptr);
int count() const;
void setCount(int count);
@@ -73,7 +73,7 @@ Q_SIGNALS:
void colorChanged();
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
int m_count;
@@ -85,11 +85,11 @@ class QQuickUniversalProgressRingAnimator : public QQuickAnimator
Q_OBJECT
public:
- QQuickUniversalProgressRingAnimator(QObject *parent = Q_NULLPTR);
+ QQuickUniversalProgressRingAnimator(QObject *parent = nullptr);
protected:
- QString propertyName() const Q_DECL_OVERRIDE;
- QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
index 39ce1b5c..c4fab7ae 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
@@ -62,11 +62,11 @@ class QQuickUniversalProgressStripAnimatorJob : public QQuickAnimatorJob
public:
QQuickUniversalProgressStripAnimatorJob();
- void initialize(QQuickAnimatorController *controller) Q_DECL_OVERRIDE;
- void updateCurrentTime(int time) Q_DECL_OVERRIDE;
- void writeBack() Q_DECL_OVERRIDE;
- void nodeWasDestroyed() Q_DECL_OVERRIDE;
- void afterNodeSync() Q_DECL_OVERRIDE;
+ void initialize(QQuickAnimatorController *controller) override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
+ void afterNodeSync() override;
private:
struct Phase {
@@ -82,7 +82,7 @@ private:
Phase m_ellipsePhases[PhaseCount];
};
-QQuickUniversalProgressStripAnimatorJob::QQuickUniversalProgressStripAnimatorJob() : m_node(Q_NULLPTR)
+QQuickUniversalProgressStripAnimatorJob::QQuickUniversalProgressStripAnimatorJob() : m_node(nullptr)
{
m_borderPhases[0] = Phase( 500, -50, 0);
m_borderPhases[1] = Phase(1500, 0, 0);
@@ -203,7 +203,7 @@ void QQuickUniversalProgressStripAnimatorJob::writeBack()
void QQuickUniversalProgressStripAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
void QQuickUniversalProgressStripAnimatorJob::afterNodeSync()
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
index b61e73c6..1b2c729d 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
@@ -59,7 +59,7 @@ class QQuickUniversalProgressStrip : public QQuickItem
Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
public:
- QQuickUniversalProgressStrip(QQuickItem *parent = Q_NULLPTR);
+ QQuickUniversalProgressStrip(QQuickItem *parent = nullptr);
QColor color() const;
void setColor(const QColor &color);
@@ -68,7 +68,7 @@ Q_SIGNALS:
void colorChanged();
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
QColor m_color;
@@ -79,11 +79,11 @@ class QQuickUniversalProgressStripAnimator : public QQuickAnimator
Q_OBJECT
public:
- QQuickUniversalProgressStripAnimator(QObject *parent = Q_NULLPTR);
+ QQuickUniversalProgressStripAnimator(QObject *parent = nullptr);
protected:
- QString propertyName() const Q_DECL_OVERRIDE;
- QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
index 2f9c86cb..49b2d9f7 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -174,7 +174,8 @@ void QQuickUniversalStyle::inheritTheme(Theme theme)
void QQuickUniversalStyle::propagateTheme()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyle *child : styles) {
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(child);
if (universal)
universal->inheritTheme(m_theme);
@@ -238,7 +239,8 @@ void QQuickUniversalStyle::inheritAccent(QRgb accent)
void QQuickUniversalStyle::propagateAccent()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyle *child : styles) {
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(child);
if (universal)
universal->inheritAccent(m_accent);
diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h
index 00a04c65..bba1876d 100644
--- a/src/imports/controls/universal/qquickuniversalstyle_p.h
+++ b/src/imports/controls/universal/qquickuniversalstyle_p.h
@@ -87,7 +87,7 @@ class QQuickUniversalStyle : public QQuickStyle
Q_PROPERTY(QColor listMediumColor READ listMediumColor NOTIFY paletteChanged FINAL)
public:
- explicit QQuickUniversalStyle(QObject *parent = Q_NULLPTR);
+ explicit QQuickUniversalStyle(QObject *parent = nullptr);
static QQuickUniversalStyle *qmlAttachedProperties(QObject *object);
@@ -190,7 +190,7 @@ Q_SIGNALS:
void paletteChanged();
protected:
- void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) Q_DECL_OVERRIDE;
+ void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) override;
private:
void init();
diff --git a/src/imports/controls/universal/qquickuniversaltheme_p.h b/src/imports/controls/universal/qquickuniversaltheme_p.h
index 20243917..809d7a89 100644
--- a/src/imports/controls/universal/qquickuniversaltheme_p.h
+++ b/src/imports/controls/universal/qquickuniversaltheme_p.h
@@ -61,7 +61,7 @@ public:
~QQuickUniversalTheme();
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type = SystemFont) const override;
private:
QFont systemFont;
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
index b3a82781..51a71ea1 100644
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
@@ -36,18 +36,21 @@
#include <QtQml/qqmlextensionplugin.h>
#include "qquickuniversalfocusrectangle_p.h"
-#include "qquickuniversalimageprovider_p.h"
#include "qquickuniversalprogressring_p.h"
#include "qquickuniversalprogressstrip_p.h"
#include "qquickuniversalstyle_p.h"
#include "qquickuniversaltheme_p.h"
#include <QtGui/private/qguiapplication_p.h>
+#include <QtLabsControls/private/qquickcolorimageprovider_p.h>
#include <QtLabsControls/private/qquickstyleselector_p.h>
static inline void initResources()
{
Q_INIT_RESOURCE(qtlabsuniversalstyleplugin);
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt_labs_controls_universal);
+#endif
}
QT_BEGIN_NAMESPACE
@@ -58,14 +61,20 @@ class QtLabsUniversalStylePlugin: public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtLabsUniversalStylePlugin(QObject *parent = nullptr);
~QtLabsUniversalStylePlugin();
- void registerTypes(const char *uri) Q_DECL_OVERRIDE;
- void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE;
+ void registerTypes(const char *uri) override;
+ void initializeEngine(QQmlEngine *engine, const char *uri) override;
private:
QQuickProxyTheme *theme;
};
+QtLabsUniversalStylePlugin::QtLabsUniversalStylePlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+}
+
QtLabsUniversalStylePlugin::~QtLabsUniversalStylePlugin()
{
if (theme) {
@@ -91,8 +100,7 @@ void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char
}
}
- initResources();
- engine->addImageProvider(QStringLiteral("universal"), new QQuickUniversalImageProvider);
+ engine->addImageProvider(QStringLiteral("universal"), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/Qt/labs/controls/universal/images")));
QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterType<QQuickUniversalFocusRectangle>(import, 1, 0, "FocusRectangle");
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index c7717d78..965228cb 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -34,7 +34,6 @@ QML_FILES += \
HEADERS += \
$$PWD/qquickuniversalfocusrectangle_p.h \
- $$PWD/qquickuniversalimageprovider_p.h \
$$PWD/qquickuniversalprogressring_p.h \
$$PWD/qquickuniversalprogressstrip_p.h \
$$PWD/qquickuniversalstyle_p.h \
@@ -42,7 +41,6 @@ HEADERS += \
SOURCES += \
$$PWD/qquickuniversalfocusrectangle.cpp \
- $$PWD/qquickuniversalimageprovider.cpp \
$$PWD/qquickuniversalprogressring.cpp \
$$PWD/qquickuniversalprogressstrip.cpp \
$$PWD/qquickuniversalstyle.cpp \
diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes
index 05491643..1879dc6c 100644
--- a/src/imports/templates/plugins.qmltypes
+++ b/src/imports/templates/plugins.qmltypes
@@ -22,7 +22,6 @@ Module {
Property { name: "autoExclusive"; type: "bool" }
Property { name: "autoRepeat"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
- Property { name: "label"; type: "QQuickItem"; isPointer: true }
Signal { name: "pressed" }
Signal { name: "released" }
Signal { name: "canceled" }
diff --git a/src/imports/templates/qtlabstemplatesplugin.cpp b/src/imports/templates/qtlabstemplatesplugin.cpp
index 635a2006..be7882c4 100644
--- a/src/imports/templates/qtlabstemplatesplugin.cpp
+++ b/src/imports/templates/qtlabstemplatesplugin.cpp
@@ -75,6 +75,13 @@
#include <QtLabsTemplates/private/qquicktoolbutton_p.h>
#include <QtLabsTemplates/private/qquicktumbler_p.h>
+static inline void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt_labs_templates);
+#endif
+}
+
QT_BEGIN_NAMESPACE
class QtLabsTemplatesPlugin: public QQmlExtensionPlugin
@@ -83,9 +90,15 @@ class QtLabsTemplatesPlugin: public QQmlExtensionPlugin
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
+ QtLabsTemplatesPlugin(QObject *parent = nullptr);
void registerTypes(const char *uri);
};
+QtLabsTemplatesPlugin::QtLabsTemplatesPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+}
+
void QtLabsTemplatesPlugin::registerTypes(const char *uri)
{
qmlRegisterType<QQuickAbstractButton>(uri, 1, 0, "AbstractButton");
diff --git a/src/templates/qquickabstractbutton.cpp b/src/templates/qquickabstractbutton.cpp
index 95afc09d..8e5b59d2 100644
--- a/src/templates/qquickabstractbutton.cpp
+++ b/src/templates/qquickabstractbutton.cpp
@@ -55,7 +55,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
\instantiates QQuickAbstractButton
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief The base of all button controls.
+ \brief Base type of all button controls.
AbstractButton provides the interface for controls with button-like
behavior; for example, push buttons and checkable controls like
@@ -107,8 +107,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() :
pressed(false), checked(false), checkable(false), highlighted(false), autoExclusive(false), autoRepeat(false), wasHeld(false),
- holdTimer(0), delayTimer(0), repeatTimer(0), repeatButton(Qt::NoButton),
- label(Q_NULLPTR), indicator(Q_NULLPTR), group(Q_NULLPTR)
+ holdTimer(0), delayTimer(0), repeatTimer(0), repeatButton(Qt::NoButton), indicator(nullptr), group(nullptr)
{
}
@@ -169,7 +168,7 @@ QQuickAbstractButton *QQuickAbstractButtonPrivate::findCheckedButton() const
if (group)
return qobject_cast<QQuickAbstractButton *>(group->checkedButton());
- QList<QQuickAbstractButton *> buttons = findExclusiveButtons();
+ const QList<QQuickAbstractButton *> buttons = findExclusiveButtons();
// TODO: A singular QRadioButton can be unchecked, which seems logical,
// because there's nothing to be exclusive with. However, a RadioButton
// from QtQuick.Controls 1.x can never be unchecked, which is the behavior
@@ -177,13 +176,13 @@ QQuickAbstractButton *QQuickAbstractButtonPrivate::findCheckedButton() const
// gives the QRadioButton behavior. Notice that tst_radiobutton.qml needs
// to be updated.
if (!autoExclusive /*|| buttons.count() == 1*/)
- return Q_NULLPTR;
+ return nullptr;
- foreach (QQuickAbstractButton *button, buttons) {
+ for (QQuickAbstractButton *button : buttons) {
if (button->isChecked() && button != q)
return button;
}
- return checked ? const_cast<QQuickAbstractButton *>(q) : Q_NULLPTR;
+ return checked ? const_cast<QQuickAbstractButton *>(q) : nullptr;
}
QList<QQuickAbstractButton *> QQuickAbstractButtonPrivate::findExclusiveButtons() const
@@ -198,7 +197,8 @@ QList<QQuickAbstractButton *> QQuickAbstractButtonPrivate::findExclusiveButtons(
buttons += button;
}
} else if (parentItem) {
- foreach (QQuickItem *child, parentItem->childItems()) {
+ const auto childItems = parentItem->childItems();
+ for (QQuickItem *child : childItems) {
QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(child);
if (button && button->autoExclusive() && !QQuickAbstractButtonPrivate::get(button)->group)
buttons += button;
@@ -234,9 +234,9 @@ QQuickAbstractButton::~QQuickAbstractButton()
This property holds a textual description of the button.
\note The text is used for accessibility purposes, so it makes sense to
- set a textual description even if the label item is an image.
+ set a textual description even if the content item is an image.
- \sa label
+ \sa contentItem
*/
QString QQuickAbstractButton::text() const
{
@@ -247,11 +247,12 @@ QString QQuickAbstractButton::text() const
void QQuickAbstractButton::setText(const QString &text)
{
Q_D(QQuickAbstractButton);
- if (d->text != text) {
- d->text = text;
- setAccessibleName(text);
- emit textChanged();
- }
+ if (d->text == text)
+ return;
+
+ d->text = text;
+ setAccessibleName(text);
+ emit textChanged();
}
/*!
@@ -268,11 +269,12 @@ bool QQuickAbstractButton::isPressed() const
void QQuickAbstractButton::setPressed(bool isPressed)
{
Q_D(QQuickAbstractButton);
- if (d->pressed != isPressed) {
- d->pressed = isPressed;
- setAccessibleProperty("pressed", isPressed);
- emit pressedChanged();
- }
+ if (d->pressed == isPressed)
+ return;
+
+ d->pressed = isPressed;
+ setAccessibleProperty("pressed", isPressed);
+ emit pressedChanged();
}
/*!
@@ -289,15 +291,16 @@ bool QQuickAbstractButton::isChecked() const
void QQuickAbstractButton::setChecked(bool checked)
{
Q_D(QQuickAbstractButton);
+ if (d->checked == checked)
+ return;
+
if (checked && !d->checkable)
setCheckable(true);
- if (d->checked != checked) {
- d->checked = checked;
- setAccessibleProperty("checked", checked);
- checkStateSet();
- emit checkedChanged();
- }
+ d->checked = checked;
+ setAccessibleProperty("checked", checked);
+ checkStateSet();
+ emit checkedChanged();
}
/*!
@@ -314,11 +317,12 @@ bool QQuickAbstractButton::isCheckable() const
void QQuickAbstractButton::setCheckable(bool checkable)
{
Q_D(QQuickAbstractButton);
- if (d->checkable != checkable) {
- d->checkable = checkable;
- setAccessibleProperty("checkable", checkable);
- emit checkableChanged();
- }
+ if (d->checkable == checkable)
+ return;
+
+ d->checkable = checkable;
+ setAccessibleProperty("checkable", checkable);
+ emit checkableChanged();
}
/*!
@@ -340,10 +344,11 @@ bool QQuickAbstractButton::isHighlighted() const
void QQuickAbstractButton::setHighlighted(bool highlighted)
{
Q_D(QQuickAbstractButton);
- if (highlighted != d->highlighted) {
- d->highlighted = highlighted;
- emit highlightedChanged();
- }
+ if (highlighted == d->highlighted)
+ return;
+
+ d->highlighted = highlighted;
+ emit highlightedChanged();
}
/*!
@@ -369,10 +374,11 @@ bool QQuickAbstractButton::autoExclusive() const
void QQuickAbstractButton::setAutoExclusive(bool exclusive)
{
Q_D(QQuickAbstractButton);
- if (d->autoExclusive != exclusive) {
- d->autoExclusive = exclusive;
- emit autoExclusiveChanged();
- }
+ if (d->autoExclusive == exclusive)
+ return;
+
+ d->autoExclusive = exclusive;
+ emit autoExclusiveChanged();
}
/*!
@@ -392,11 +398,12 @@ bool QQuickAbstractButton::autoRepeat() const
void QQuickAbstractButton::setAutoRepeat(bool repeat)
{
Q_D(QQuickAbstractButton);
- if (d->autoRepeat != repeat) {
- d->stopPressRepeat();
- d->autoRepeat = repeat;
- emit autoRepeatChanged();
- }
+ if (d->autoRepeat == repeat)
+ return;
+
+ d->stopPressRepeat();
+ d->autoRepeat = repeat;
+ emit autoRepeatChanged();
}
/*!
@@ -413,41 +420,17 @@ QQuickItem *QQuickAbstractButton::indicator() const
void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
{
Q_D(QQuickAbstractButton);
- if (d->indicator != indicator) {
- delete d->indicator;
- d->indicator = indicator;
- if (indicator) {
- if (!indicator->parentItem())
- indicator->setParentItem(this);
- indicator->setAcceptedMouseButtons(Qt::LeftButton);
- }
- emit indicatorChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::AbstractButton::label
-
- This property holds the label item.
-
- \sa text
-*/
-QQuickItem *QQuickAbstractButton::label() const
-{
- Q_D(const QQuickAbstractButton);
- return d->label;
-}
-
-void QQuickAbstractButton::setLabel(QQuickItem *label)
-{
- Q_D(QQuickAbstractButton);
- if (d->label != label) {
- delete d->label;
- d->label = label;
- if (label && !label->parentItem())
- label->setParentItem(this);
- emit labelChanged();
+ if (d->indicator == indicator)
+ return;
+
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator) {
+ if (!indicator->parentItem())
+ indicator->setParentItem(this);
+ indicator->setAcceptedMouseButtons(Qt::LeftButton);
}
+ emit indicatorChanged();
}
/*!
diff --git a/src/templates/qquickabstractbutton_p.h b/src/templates/qquickabstractbutton_p.h
index f3020bc3..9469e706 100644
--- a/src/templates/qquickabstractbutton_p.h
+++ b/src/templates/qquickabstractbutton_p.h
@@ -65,10 +65,9 @@ class Q_LABSTEMPLATES_EXPORT QQuickAbstractButton : public QQuickControl
Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
- Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
public:
- explicit QQuickAbstractButton(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickAbstractButton(QQuickItem *parent = nullptr);
~QQuickAbstractButton();
QString text() const;
@@ -95,9 +94,6 @@ public:
QQuickItem *indicator() const;
void setIndicator(QQuickItem *indicator);
- QQuickItem *label() const;
- void setLabel(QQuickItem *label);
-
public Q_SLOTS:
void toggle();
@@ -116,27 +112,26 @@ Q_SIGNALS:
void autoExclusiveChanged();
void autoRepeatChanged();
void indicatorChanged();
- void labelChanged();
protected:
QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent);
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void timerEvent(QTimerEvent *event) override;
virtual void checkStateSet();
virtual void nextCheckState();
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickabstractbutton_p_p.h b/src/templates/qquickabstractbutton_p_p.h
index cdc77f19..409fd52e 100644
--- a/src/templates/qquickabstractbutton_p_p.h
+++ b/src/templates/qquickabstractbutton_p_p.h
@@ -91,7 +91,6 @@ public:
int repeatTimer;
QPointF pressPoint;
Qt::MouseButton repeatButton;
- QQuickItem *label;
QQuickItem *indicator;
QQuickButtonGroup *group;
};
diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp
index 9a9e5460..7756a7bf 100644
--- a/src/templates/qquickapplicationwindow.cpp
+++ b/src/templates/qquickapplicationwindow.cpp
@@ -39,6 +39,8 @@
#include "qquickcontrol_p_p.h"
#include "qquicktextarea_p.h"
#include "qquicktextfield_p.h"
+#include "qquicktoolbar_p.h"
+#include "qquicktabbar_p.h"
#include <QtCore/private/qobject_p.h>
#include <QtQuick/private/qquickitem_p.h>
@@ -97,17 +99,17 @@ class QQuickApplicationWindowPrivate : public QQuickItemChangeListener
public:
QQuickApplicationWindowPrivate()
: complete(false)
- , contentItem(Q_NULLPTR)
- , header(Q_NULLPTR)
- , footer(Q_NULLPTR)
- , overlay(Q_NULLPTR)
- , activeFocusControl(Q_NULLPTR)
+ , contentItem(nullptr)
+ , header(nullptr)
+ , footer(nullptr)
+ , overlay(nullptr)
+ , activeFocusControl(nullptr)
{ }
void relayout();
- void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
void updateFont(const QFont &);
inline void setFont_helper(const QFont &f) {
@@ -234,6 +236,9 @@ QQuickApplicationWindow::~QQuickApplicationWindow()
This property holds the window header item. The header item is positioned to
the top, and resized to the width of the window. The default value is \c null.
+ \note Assigning a ToolBar or TabBar as a window header sets the respective
+ \l ToolBar::position or \l TabBar::position property automatically to \c Header.
+
\sa footer, Page::header
*/
QQuickItem *QQuickApplicationWindow::header() const
@@ -245,23 +250,28 @@ QQuickItem *QQuickApplicationWindow::header() const
void QQuickApplicationWindow::setHeader(QQuickItem *header)
{
Q_D(QQuickApplicationWindow);
- if (d->header != header) {
- if (d->header) {
- QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- d->header->setParentItem(Q_NULLPTR);
- }
- d->header = header;
- if (header) {
- header->setParentItem(contentItem());
- QQuickItemPrivate *p = QQuickItemPrivate::get(header);
- p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- if (qFuzzyIsNull(header->z()))
- header->setZ(1);
- if (isComponentComplete())
- d->relayout();
- }
- emit headerChanged();
+ if (d->header == header)
+ return;
+
+ if (d->header) {
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ d->header->setParentItem(nullptr);
+ }
+ d->header = header;
+ if (header) {
+ header->setParentItem(contentItem());
+ QQuickItemPrivate *p = QQuickItemPrivate::get(header);
+ p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (qFuzzyIsNull(header->z()))
+ header->setZ(1);
+ if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(header))
+ toolBar->setPosition(QQuickToolBar::Header);
+ else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(header))
+ tabBar->setPosition(QQuickTabBar::Header);
+ if (isComponentComplete())
+ d->relayout();
}
+ emit headerChanged();
}
/*!
@@ -270,6 +280,9 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header)
This property holds the window footer item. The footer item is positioned to
the bottom, and resized to the width of the window. The default value is \c null.
+ \note Assigning a ToolBar or TabBar as a window footer sets the respective
+ \l ToolBar::position or \l TabBar::position property automatically to \c Footer.
+
\sa header, Page::footer
*/
QQuickItem *QQuickApplicationWindow::footer() const
@@ -281,23 +294,28 @@ QQuickItem *QQuickApplicationWindow::footer() const
void QQuickApplicationWindow::setFooter(QQuickItem *footer)
{
Q_D(QQuickApplicationWindow);
- if (d->footer != footer) {
- if (d->footer) {
- QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- d->footer->setParentItem(Q_NULLPTR);
- }
- d->footer = footer;
- if (footer) {
- footer->setParentItem(contentItem());
- QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
- p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- if (qFuzzyIsNull(footer->z()))
- footer->setZ(1);
- if (isComponentComplete())
- d->relayout();
- }
- emit footerChanged();
+ if (d->footer == footer)
+ return;
+
+ if (d->footer) {
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ d->footer->setParentItem(nullptr);
+ }
+ d->footer = footer;
+ if (footer) {
+ footer->setParentItem(contentItem());
+ QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
+ p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (qFuzzyIsNull(footer->z()))
+ footer->setZ(1);
+ if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(footer))
+ toolBar->setPosition(QQuickToolBar::Footer);
+ else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(footer))
+ tabBar->setPosition(QQuickTabBar::Footer);
+ if (isComponentComplete())
+ d->relayout();
}
+ emit footerChanged();
}
/*!
@@ -483,7 +501,7 @@ class QQuickApplicationWindowAttachedPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QQuickApplicationWindowAttached)
public:
- QQuickApplicationWindowAttachedPrivate() : window(Q_NULLPTR) { }
+ QQuickApplicationWindowAttachedPrivate() : window(nullptr) { }
void windowChange(QQuickWindow *wnd);
@@ -561,7 +579,7 @@ QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const
QQuickItem *QQuickApplicationWindowAttached::contentItem() const
{
Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->contentItem() : Q_NULLPTR;
+ return d->window ? d->window->contentItem() : nullptr;
}
/*!
@@ -578,7 +596,7 @@ QQuickItem *QQuickApplicationWindowAttached::contentItem() const
QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
{
Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->activeFocusControl() : Q_NULLPTR;
+ return d->window ? d->window->activeFocusControl() : nullptr;
}
/*!
@@ -592,7 +610,7 @@ QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
QQuickItem *QQuickApplicationWindowAttached::header() const
{
Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->header() : Q_NULLPTR;
+ return d->window ? d->window->header() : nullptr;
}
/*!
@@ -606,7 +624,7 @@ QQuickItem *QQuickApplicationWindowAttached::header() const
QQuickItem *QQuickApplicationWindowAttached::footer() const
{
Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->footer() : Q_NULLPTR;
+ return d->window ? d->window->footer() : nullptr;
}
/*!
@@ -619,7 +637,7 @@ QQuickItem *QQuickApplicationWindowAttached::footer() const
QQuickOverlay *QQuickApplicationWindowAttached::overlay() const
{
Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->overlay() : Q_NULLPTR;
+ return d->window ? d->window->overlay() : nullptr;
}
QT_END_NAMESPACE
diff --git a/src/templates/qquickapplicationwindow_p.h b/src/templates/qquickapplicationwindow_p.h
index f62ddee3..960e5714 100644
--- a/src/templates/qquickapplicationwindow_p.h
+++ b/src/templates/qquickapplicationwindow_p.h
@@ -74,7 +74,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImp
Q_CLASSINFO("DefaultProperty", "data")
public:
- explicit QQuickApplicationWindow(QWindow *parent = Q_NULLPTR);
+ explicit QQuickApplicationWindow(QWindow *parent = nullptr);
~QQuickApplicationWindow();
QQuickItem *contentItem() const;
@@ -109,9 +109,9 @@ Q_SIGNALS:
protected:
bool isComponentComplete() const;
- void classBegin() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
+ void classBegin() override;
+ void componentComplete() override;
+ void resizeEvent(QResizeEvent *event) override;
private:
Q_DISABLE_COPY(QQuickApplicationWindow)
@@ -131,7 +131,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindowAttached : public QObject
Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL)
public:
- explicit QQuickApplicationWindowAttached(QObject *parent = Q_NULLPTR);
+ explicit QQuickApplicationWindowAttached(QObject *parent = nullptr);
QQuickApplicationWindow *window() const;
QQuickItem *contentItem() const;
diff --git a/src/templates/qquickbusyindicator.cpp b/src/templates/qquickbusyindicator.cpp
index 381ac5c7..3cfd96cb 100644
--- a/src/templates/qquickbusyindicator.cpp
+++ b/src/templates/qquickbusyindicator.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickBusyIndicator
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-indicators
- \brief A busy indicator.
+ \brief Indicates activity while content is being loaded.
\image qtlabscontrols-busyindicator.gif
@@ -98,10 +98,11 @@ bool QQuickBusyIndicator::isRunning() const
void QQuickBusyIndicator::setRunning(bool running)
{
Q_D(QQuickBusyIndicator);
- if (d->running != running) {
- d->running = running;
- emit runningChanged();
- }
+ if (d->running == running)
+ return;
+
+ d->running = running;
+ emit runningChanged();
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/templates/qquickbusyindicator_p.h b/src/templates/qquickbusyindicator_p.h
index 8be19d5c..e5e72044 100644
--- a/src/templates/qquickbusyindicator_p.h
+++ b/src/templates/qquickbusyindicator_p.h
@@ -60,7 +60,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickBusyIndicator : public QQuickControl
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged FINAL)
public:
- explicit QQuickBusyIndicator(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickBusyIndicator(QQuickItem *parent = nullptr);
bool isRunning() const;
void setRunning(bool running);
@@ -70,7 +70,7 @@ Q_SIGNALS:
protected:
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickbutton.cpp b/src/templates/qquickbutton.cpp
index 1e40ec05..d193e68d 100644
--- a/src/templates/qquickbutton.cpp
+++ b/src/templates/qquickbutton.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickButton
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief A button control.
+ \brief A push-button control that can be clicked by the user.
\image qtlabscontrols-button.gif
diff --git a/src/templates/qquickbutton_p.h b/src/templates/qquickbutton_p.h
index 83d22fb8..12c3667c 100644
--- a/src/templates/qquickbutton_p.h
+++ b/src/templates/qquickbutton_p.h
@@ -57,10 +57,10 @@ class Q_LABSTEMPLATES_EXPORT QQuickButton : public QQuickAbstractButton
Q_OBJECT
public:
- explicit QQuickButton(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickButton(QQuickItem *parent = nullptr);
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
};
QT_END_NAMESPACE
diff --git a/src/templates/qquickbuttongroup.cpp b/src/templates/qquickbuttongroup.cpp
index 0865277e..5f0ec6b1 100644
--- a/src/templates/qquickbuttongroup.cpp
+++ b/src/templates/qquickbuttongroup.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickButtonGroup
\inqmlmodule Qt.labs.controls
\ingroup utilities
- \brief An exclusive group of checkable controls.
+ \brief A mutually-exclusive group of checkable controls.
ButtonGroup is a non-visual, mutually exclusive group of buttons.
It is used with controls such as RadioButton, where only one of the options
@@ -129,7 +129,7 @@ class QQuickButtonGroupPrivate : public QObjectPrivate
Q_DECLARE_PUBLIC(QQuickButtonGroup)
public:
- QQuickButtonGroupPrivate() : checkedButton(Q_NULLPTR) { }
+ QQuickButtonGroupPrivate() : checkedButton(nullptr) { }
void clear();
void updateCurrent();
@@ -145,8 +145,8 @@ public:
void QQuickButtonGroupPrivate::clear()
{
- foreach (QQuickAbstractButton *button, buttons) {
- QQuickAbstractButtonPrivate::get(button)->group = Q_NULLPTR;
+ for (QQuickAbstractButton *button : qAsConst(buttons)) {
+ QQuickAbstractButtonPrivate::get(button)->group = nullptr;
QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, this, &QQuickButtonGroupPrivate::updateCurrent);
}
buttons.clear();
@@ -184,7 +184,7 @@ void QQuickButtonGroupPrivate::buttons_clear(QQmlListProperty<QQuickAbstractButt
if (!p->buttons.isEmpty()) {
p->clear();
QQuickButtonGroup *q = static_cast<QQuickButtonGroup *>(prop->object);
- q->setCheckedButton(Q_NULLPTR);
+ q->setCheckedButton(nullptr);
emit q->buttonsChanged();
}
}
@@ -221,14 +221,15 @@ QQuickAbstractButton *QQuickButtonGroup::checkedButton() const
void QQuickButtonGroup::setCheckedButton(QQuickAbstractButton *checkedButton)
{
Q_D(QQuickButtonGroup);
- if (d->checkedButton != checkedButton) {
- if (d->checkedButton)
- d->checkedButton->setChecked(false);
- d->checkedButton = checkedButton;
- if (checkedButton)
- checkedButton->setChecked(true);
- emit checkedButtonChanged();
- }
+ if (d->checkedButton == checkedButton)
+ return;
+
+ if (d->checkedButton)
+ d->checkedButton->setChecked(false);
+ d->checkedButton = checkedButton;
+ if (checkedButton)
+ checkedButton->setChecked(true);
+ emit checkedButtonChanged();
}
/*!
@@ -312,11 +313,11 @@ void QQuickButtonGroup::removeButton(QQuickAbstractButton *button)
if (!button || !d->buttons.contains(button))
return;
- QQuickAbstractButtonPrivate::get(button)->group = Q_NULLPTR;
+ QQuickAbstractButtonPrivate::get(button)->group = nullptr;
QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::updateCurrent);
if (d->checkedButton == button)
- setCheckedButton(Q_NULLPTR);
+ setCheckedButton(nullptr);
d->buttons.removeOne(button);
emit buttonsChanged();
@@ -325,7 +326,7 @@ void QQuickButtonGroup::removeButton(QQuickAbstractButton *button)
class QQuickButtonGroupAttachedPrivate : public QObjectPrivate
{
public:
- QQuickButtonGroupAttachedPrivate() : group(Q_NULLPTR) { }
+ QQuickButtonGroupAttachedPrivate() : group(nullptr) { }
QQuickButtonGroup *group;
};
@@ -366,14 +367,15 @@ QQuickButtonGroup *QQuickButtonGroupAttached::group() const
void QQuickButtonGroupAttached::setGroup(QQuickButtonGroup *group)
{
Q_D(QQuickButtonGroupAttached);
- if (d->group != group) {
- if (d->group)
- d->group->removeButton(qobject_cast<QQuickAbstractButton*>(parent()));
- d->group = group;
- if (group)
- group->addButton(qobject_cast<QQuickAbstractButton*>(parent()));
- emit groupChanged();
- }
+ if (d->group == group)
+ return;
+
+ if (d->group)
+ d->group->removeButton(qobject_cast<QQuickAbstractButton*>(parent()));
+ d->group = group;
+ if (group)
+ group->addButton(qobject_cast<QQuickAbstractButton*>(parent()));
+ emit groupChanged();
}
QT_END_NAMESPACE
diff --git a/src/templates/qquickbuttongroup_p.h b/src/templates/qquickbuttongroup_p.h
index 6210079d..5863e70b 100644
--- a/src/templates/qquickbuttongroup_p.h
+++ b/src/templates/qquickbuttongroup_p.h
@@ -66,7 +66,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickButtonGroup : public QObject
Q_PROPERTY(QQmlListProperty<QQuickAbstractButton> buttons READ buttons NOTIFY buttonsChanged FINAL)
public:
- explicit QQuickButtonGroup(QObject *parent = Q_NULLPTR);
+ explicit QQuickButtonGroup(QObject *parent = nullptr);
~QQuickButtonGroup();
static QQuickButtonGroupAttached *qmlAttachedProperties(QObject *object);
@@ -95,7 +95,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickButtonGroupAttached : public QObject
Q_PROPERTY(QQuickButtonGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL)
public:
- explicit QQuickButtonGroupAttached(QObject *parent = Q_NULLPTR);
+ explicit QQuickButtonGroupAttached(QObject *parent = nullptr);
QQuickButtonGroup *group() const;
void setGroup(QQuickButtonGroup *group);
diff --git a/src/templates/qquickcheckbox.cpp b/src/templates/qquickcheckbox.cpp
index 644e151e..945fbc42 100644
--- a/src/templates/qquickcheckbox.cpp
+++ b/src/templates/qquickcheckbox.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickCheckBox
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief A check box control.
+ \brief An option button that can be checked or unchecked.
CheckBox presents an option button that can be toggled on (checked) or
off (unchecked). Check boxes are typically used to select one or more
@@ -121,10 +121,11 @@ bool QQuickCheckBox::isTristate() const
void QQuickCheckBox::setTristate(bool tristate)
{
Q_D(QQuickCheckBox);
- if (d->tristate != tristate) {
- d->tristate = tristate;
- emit tristateChanged();
- }
+ if (d->tristate == tristate)
+ return;
+
+ d->tristate = tristate;
+ emit tristateChanged();
}
/*!
@@ -148,16 +149,18 @@ Qt::CheckState QQuickCheckBox::checkState() const
void QQuickCheckBox::setCheckState(Qt::CheckState state)
{
Q_D(QQuickCheckBox);
+ if (d->checkState == state)
+ return;
+
if (!d->tristate && state == Qt::PartiallyChecked)
setTristate(true);
- if (d->checkState != state) {
- bool wasChecked = isChecked();
- d->checked = state != Qt::Unchecked;
- d->checkState = state;
- emit checkStateChanged();
- if (d->checked != wasChecked)
- emit checkedChanged();
- }
+
+ bool wasChecked = isChecked();
+ d->checked = state != Qt::Unchecked;
+ d->checkState = state;
+ emit checkStateChanged();
+ if (d->checked != wasChecked)
+ emit checkedChanged();
}
QFont QQuickCheckBox::defaultFont() const
diff --git a/src/templates/qquickcheckbox_p.h b/src/templates/qquickcheckbox_p.h
index 4c0d505f..e3dcf76e 100644
--- a/src/templates/qquickcheckbox_p.h
+++ b/src/templates/qquickcheckbox_p.h
@@ -61,7 +61,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickCheckBox : public QQuickAbstractButton
Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL)
public:
- explicit QQuickCheckBox(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickCheckBox(QQuickItem *parent = nullptr);
bool isTristate() const;
void setTristate(bool tristate);
@@ -74,13 +74,13 @@ Q_SIGNALS:
void checkStateChanged();
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
- void checkStateSet() Q_DECL_OVERRIDE;
- void nextCheckState() Q_DECL_OVERRIDE;
+ void checkStateSet() override;
+ void nextCheckState() override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp
index 229201c5..210239b0 100644
--- a/src/templates/qquickcombobox.cpp
+++ b/src/templates/qquickcombobox.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickComboBox
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-input
- \brief A combo box control.
+ \brief A combined button and popup list taking minimal space.
\image qtlabscontrols-combobox.png
@@ -123,7 +123,7 @@ class QQuickComboBoxDelegateModel : public QQmlDelegateModel
{
public:
explicit QQuickComboBoxDelegateModel(QQuickComboBox *combo);
- QString stringValue(int index, const QString &role) Q_DECL_OVERRIDE;
+ QString stringValue(int index, const QString &role) override;
private:
QQuickComboBox *combo;
@@ -155,8 +155,8 @@ class QQuickComboBoxPrivate : public QQuickControlPrivate
public:
QQuickComboBoxPrivate() : pressed(false), ownModel(false), hasDisplayText(false),
- highlightedIndex(-1), currentIndex(-1), delegateModel(Q_NULLPTR),
- delegate(Q_NULLPTR), popup(Q_NULLPTR) { }
+ highlightedIndex(-1), currentIndex(-1), delegateModel(nullptr),
+ delegate(nullptr), popup(nullptr) { }
bool isPopupVisible() const;
void showPopup();
@@ -227,7 +227,7 @@ void QQuickComboBoxPrivate::togglePopup(bool accept)
void QQuickComboBoxPrivate::itemClicked()
{
Q_Q(QQuickComboBox);
- int index = delegateModel->indexOf(q->sender(), Q_NULLPTR);
+ int index = delegateModel->indexOf(q->sender(), nullptr);
if (index != -1) {
setHighlightedIndex(index);
emit q->highlighted(index);
@@ -302,10 +302,11 @@ void QQuickComboBoxPrivate::decrease()
void QQuickComboBoxPrivate::setHighlightedIndex(int index)
{
Q_Q(QQuickComboBox);
- if (highlightedIndex != index) {
- highlightedIndex = index;
- emit q->highlightedIndexChanged();
- }
+ if (highlightedIndex == index)
+ return;
+
+ highlightedIndex = index;
+ emit q->highlightedIndexChanged();
}
void QQuickComboBoxPrivate::createDelegateModel()
@@ -357,7 +358,7 @@ QQuickComboBox::~QQuickComboBox()
{
Q_D(QQuickComboBox);
delete d->popup;
- d->popup = Q_NULLPTR;
+ d->popup = nullptr;
}
/*!
@@ -403,15 +404,16 @@ void QQuickComboBox::setModel(const QVariant& m)
if (model.userType() == qMetaTypeId<QJSValue>())
model = model.value<QJSValue>().toVariant();
- if (d->model != model) {
- d->model = model;
- d->createDelegateModel();
- if (isComponentComplete()) {
- setCurrentIndex(count() > 0 ? 0 : -1);
- d->updateCurrentText();
- }
- emit modelChanged();
+ if (d->model == model)
+ return;
+
+ d->model = model;
+ d->createDelegateModel();
+ if (isComponentComplete()) {
+ setCurrentIndex(count() > 0 ? 0 : -1);
+ d->updateCurrentText();
}
+ emit modelChanged();
}
/*!
@@ -440,10 +442,11 @@ bool QQuickComboBox::isPressed() const
void QQuickComboBox::setPressed(bool pressed)
{
Q_D(QQuickComboBox);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- emit pressedChanged();
- }
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ emit pressedChanged();
}
/*!
@@ -476,12 +479,13 @@ int QQuickComboBox::currentIndex() const
void QQuickComboBox::setCurrentIndex(int index)
{
Q_D(QQuickComboBox);
- if (d->currentIndex != index) {
- d->currentIndex = index;
- emit currentIndexChanged();
- if (isComponentComplete())
- d->updateCurrentText();
- }
+ if (d->currentIndex == index)
+ return;
+
+ d->currentIndex = index;
+ emit currentIndexChanged();
+ if (isComponentComplete())
+ d->updateCurrentText();
}
/*!
@@ -527,19 +531,21 @@ void QQuickComboBox::setDisplayText(const QString &text)
{
Q_D(QQuickComboBox);
d->hasDisplayText = true;
- if (d->displayText != text) {
- d->displayText = text;
- emit displayTextChanged();
- }
+ if (d->displayText == text)
+ return;
+
+ d->displayText = text;
+ emit displayTextChanged();
}
void QQuickComboBox::resetDisplayText()
{
Q_D(QQuickComboBox);
- if (d->hasDisplayText) {
- d->hasDisplayText = false;
- d->updateCurrentText();
- }
+ if (!d->hasDisplayText)
+ return;
+
+ d->hasDisplayText = false;
+ d->updateCurrentText();
}
/*!
@@ -558,12 +564,13 @@ QString QQuickComboBox::textRole() const
void QQuickComboBox::setTextRole(const QString &role)
{
Q_D(QQuickComboBox);
- if (d->textRole != role) {
- d->textRole = role;
- if (isComponentComplete())
- d->updateCurrentText();
- emit textRoleChanged();
- }
+ if (d->textRole == role)
+ return;
+
+ d->textRole = role;
+ if (isComponentComplete())
+ d->updateCurrentText();
+ emit textRoleChanged();
}
/*!
@@ -582,14 +589,15 @@ QQmlComponent *QQuickComboBox::delegate() const
void QQuickComboBox::setDelegate(QQmlComponent* delegate)
{
Q_D(QQuickComboBox);
- if (d->delegate != delegate) {
- delete d->delegate;
- d->delegate = delegate;
- QQmlDelegateModel *delegateModel = qobject_cast<QQmlDelegateModel*>(d->delegateModel);
- if (delegateModel)
- delegateModel->setDelegate(d->delegate);
- emit delegateChanged();
- }
+ if (d->delegate == delegate)
+ return;
+
+ delete d->delegate;
+ d->delegate = delegate;
+ QQmlDelegateModel *delegateModel = qobject_cast<QQmlDelegateModel*>(d->delegateModel);
+ if (delegateModel)
+ delegateModel->setDelegate(d->delegate);
+ emit delegateChanged();
}
/*!
@@ -608,13 +616,14 @@ QQuickPopup *QQuickComboBox::popup() const
void QQuickComboBox::setPopup(QQuickPopup *popup)
{
Q_D(QQuickComboBox);
- if (d->popup != popup) {
- delete d->popup;
- if (popup)
- popup->setClosePolicy(QQuickPopup::OnEscape | QQuickPopup::OnPressOutsideParent);
- d->popup = popup;
- emit popupChanged();
- }
+ if (d->popup == popup)
+ return;
+
+ delete d->popup;
+ if (popup)
+ popup->setClosePolicy(QQuickPopup::OnEscape | QQuickPopup::OnPressOutsideParent);
+ d->popup = popup;
+ emit popupChanged();
}
/*!
diff --git a/src/templates/qquickcombobox_p.h b/src/templates/qquickcombobox_p.h
index 1d8f498a..431dccb0 100644
--- a/src/templates/qquickcombobox_p.h
+++ b/src/templates/qquickcombobox_p.h
@@ -72,7 +72,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickComboBox : public QQuickControl
Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
public:
- explicit QQuickComboBox(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickComboBox(QQuickItem *parent = nullptr);
~QQuickComboBox();
int count() const;
@@ -124,17 +124,17 @@ Q_SIGNALS:
void highlighted(int index);
protected:
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
- void componentComplete() Q_DECL_OVERRIDE;
+ void componentComplete() override;
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
private:
Q_DISABLE_COPY(QQuickComboBox)
diff --git a/src/templates/qquickcontainer.cpp b/src/templates/qquickcontainer.cpp
index 841eae8a..12b330f6 100644
--- a/src/templates/qquickcontainer.cpp
+++ b/src/templates/qquickcontainer.cpp
@@ -64,7 +64,7 @@ static QQuickItem *effectiveContentItem(QQuickItem *item)
return item;
}
-QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(Q_NULLPTR), currentIndex(-1), updatingCurrent(false)
+QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(nullptr), currentIndex(-1), updatingCurrent(false)
{
}
@@ -155,7 +155,7 @@ void QQuickContainerPrivate::removeItem(int index, QQuickItem *item)
}
QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
- item->setParentItem(Q_NULLPTR);
+ item->setParentItem(nullptr);
contentModel->remove(index);
q->itemRemoved(index, item);
@@ -184,7 +184,7 @@ void QQuickContainerPrivate::itemParentChanged(QQuickItem *item, QQuickItem *par
{
// remove dynamically unparented items (eg. by a Repeater)
if (!parent)
- removeItem(contentModel->indexOf(item, Q_NULLPTR), item);
+ removeItem(contentModel->indexOf(item, nullptr), item);
}
void QQuickContainerPrivate::itemSiblingOrderChanged(QQuickItem *)
@@ -194,14 +194,14 @@ void QQuickContainerPrivate::itemSiblingOrderChanged(QQuickItem *)
QList<QQuickItem *> siblings = effectiveContentItem(contentItem)->childItems();
for (int i = 0; i < siblings.count(); ++i) {
QQuickItem* sibling = siblings.at(i);
- int index = contentModel->indexOf(sibling, Q_NULLPTR);
+ int index = contentModel->indexOf(sibling, nullptr);
q->moveItem(index, i);
}
}
void QQuickContainerPrivate::itemDestroyed(QQuickItem *item)
{
- int index = contentModel->indexOf(item, Q_NULLPTR);
+ int index = contentModel->indexOf(item, nullptr);
if (index != -1)
removeItem(index, item);
}
@@ -215,7 +215,7 @@ void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop,
if (QQuickItemPrivate::get(item)->isTransparentForPositioner()) {
QQuickItemPrivate::get(item)->addItemChangeListener(p, QQuickItemPrivate::SiblingOrder);
item->setParentItem(effectiveContentItem(p->contentItem));
- } else if (p->contentModel->indexOf(item, Q_NULLPTR) == -1) {
+ } else if (p->contentModel->indexOf(item, nullptr) == -1) {
q->addItem(item);
}
} else {
@@ -333,7 +333,7 @@ void QQuickContainer::insertItem(int index, QQuickItem *item)
if (index < 0 || index > count)
index = count;
- int oldIndex = d->contentModel->indexOf(item, Q_NULLPTR);
+ int oldIndex = d->contentModel->indexOf(item, nullptr);
if (oldIndex != -1) {
if (oldIndex < index)
--index;
@@ -442,11 +442,12 @@ int QQuickContainer::currentIndex() const
void QQuickContainer::setCurrentIndex(int index)
{
Q_D(QQuickContainer);
- if (d->currentIndex != index) {
- d->currentIndex = index;
- emit currentIndexChanged();
- emit currentItemChanged();
- }
+ if (d->currentIndex == index)
+ return;
+
+ d->currentIndex = index;
+ emit currentIndexChanged();
+ emit currentItemChanged();
}
/*!
@@ -465,7 +466,7 @@ void QQuickContainer::itemChange(ItemChange change, const ItemChangeData &data)
Q_D(QQuickContainer);
QQuickControl::itemChange(change, data);
if (change == QQuickItem::ItemChildAddedChange && isComponentComplete() && data.item != d->background && data.item != d->contentItem) {
- if (!QQuickItemPrivate::get(data.item)->isTransparentForPositioner() && d->contentModel->indexOf(data.item, Q_NULLPTR) == -1)
+ if (!QQuickItemPrivate::get(data.item)->isTransparentForPositioner() && d->contentModel->indexOf(data.item, nullptr) == -1)
addItem(data.item);
}
}
diff --git a/src/templates/qquickcontainer_p.h b/src/templates/qquickcontainer_p.h
index 83476f66..e11d5716 100644
--- a/src/templates/qquickcontainer_p.h
+++ b/src/templates/qquickcontainer_p.h
@@ -67,7 +67,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickContainer : public QQuickControl
Q_CLASSINFO("DefaultProperty", "contentData")
public:
- explicit QQuickContainer(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickContainer(QQuickItem *parent = nullptr);
~QQuickContainer();
int count() const;
@@ -96,8 +96,8 @@ Q_SIGNALS:
protected:
QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent);
- void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE;
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
virtual bool isContent(QQuickItem *item) const;
virtual void itemAdded(int index, QQuickItem *item);
diff --git a/src/templates/qquickcontainer_p_p.h b/src/templates/qquickcontainer_p_p.h
index 6eb79c88..8c1d470c 100644
--- a/src/templates/qquickcontainer_p_p.h
+++ b/src/templates/qquickcontainer_p_p.h
@@ -71,10 +71,10 @@ public:
void _q_currentIndexChanged();
- void itemChildAdded(QQuickItem *item, QQuickItem *child) Q_DECL_OVERRIDE;
- void itemSiblingOrderChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemParentChanged(QQuickItem *item, QQuickItem *parent) Q_DECL_OVERRIDE;
- void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemChildAdded(QQuickItem *item, QQuickItem *child) override;
+ void itemSiblingOrderChanged(QQuickItem *item) override;
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
+ void itemDestroyed(QQuickItem *item) override;
static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
static int contentData_count(QQmlListProperty<QObject> *prop);
diff --git a/src/templates/qquickcontrol.cpp b/src/templates/qquickcontrol.cpp
index 5636d84f..6ec9b4a4 100644
--- a/src/templates/qquickcontrol.cpp
+++ b/src/templates/qquickcontrol.cpp
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
\inherits Item
\instantiates QQuickControl
\inqmlmodule Qt.labs.controls
- \brief A user interface control.
+ \brief The base type of user interface controls.
Control is the base type of user interface controls.
@@ -72,7 +72,7 @@ QT_BEGIN_NAMESPACE
QQuickControlPrivate::QQuickControlPrivate() :
hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false), hasLocale(false),
padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0), spacing(0), focusReason(Qt::OtherFocusReason),
- background(Q_NULLPTR), contentItem(Q_NULLPTR), accessibleAttached(Q_NULLPTR)
+ background(nullptr), contentItem(nullptr), accessibleAttached(nullptr)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -291,7 +291,8 @@ void QQuickControlPrivate::updateFont(const QFont &f)
void QQuickControlPrivate::updateFontRecur(QQuickItem *item, const QFont &f)
{
- foreach (QQuickItem *child, item->childItems()) {
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
QQuickControlPrivate::get(control)->resolveFont();
else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(child))
@@ -705,7 +706,8 @@ void QQuickControlPrivate::updateLocale(const QLocale &l, bool e)
void QQuickControlPrivate::updateLocaleRecur(QQuickItem *item, const QLocale &l)
{
- foreach (QQuickItem *child, item->childItems()) {
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
QQuickControlPrivate::get(control)->updateLocale(l, false);
else
@@ -766,10 +768,11 @@ Qt::FocusReason QQuickControl::focusReason() const
void QQuickControl::setFocusReason(Qt::FocusReason reason)
{
Q_D(QQuickControl);
- if (d->focusReason != reason) {
- d->focusReason = reason;
- emit focusReasonChanged();
- }
+ if (d->focusReason == reason)
+ return;
+
+ d->focusReason = reason;
+ emit focusReasonChanged();
}
/*!
@@ -790,18 +793,19 @@ QQuickItem *QQuickControl::background() const
void QQuickControl::setBackground(QQuickItem *background)
{
Q_D(QQuickControl);
- if (d->background != background) {
- delete d->background;
- d->background = background;
- if (background) {
- background->setParentItem(this);
- if (qFuzzyIsNull(background->z()))
- background->setZ(-1);
- if (isComponentComplete())
- d->resizeBackground();
- }
- emit backgroundChanged();
+ if (d->background == background)
+ return;
+
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
}
+ emit backgroundChanged();
}
/*!
@@ -820,18 +824,19 @@ QQuickItem *QQuickControl::contentItem() const
void QQuickControl::setContentItem(QQuickItem *item)
{
Q_D(QQuickControl);
- if (d->contentItem != item) {
- contentItemChange(item, d->contentItem);
- delete d->contentItem;
- d->contentItem = item;
- if (item) {
- if (!item->parentItem())
- item->setParentItem(this);
- if (isComponentComplete())
- d->resizeContent();
- }
- emit contentItemChanged();
+ if (d->contentItem == item)
+ return;
+
+ contentItemChange(item, d->contentItem);
+ delete d->contentItem;
+ d->contentItem = item;
+ if (item) {
+ if (!item->parentItem())
+ item->setParentItem(this);
+ if (isComponentComplete())
+ d->resizeContent();
}
+ emit contentItemChanged();
}
void QQuickControl::componentComplete()
diff --git a/src/templates/qquickcontrol_p.h b/src/templates/qquickcontrol_p.h
index 413fb7f4..c658ff74 100644
--- a/src/templates/qquickcontrol_p.h
+++ b/src/templates/qquickcontrol_p.h
@@ -75,7 +75,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickControl : public QQuickItem
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
public:
- explicit QQuickControl(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickControl(QQuickItem *parent = nullptr);
QFont font() const;
void setFont(const QFont &);
@@ -144,17 +144,17 @@ protected:
QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent);
- void componentComplete() Q_DECL_OVERRIDE;
+ void componentComplete() override;
- void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
virtual void mirrorChange();
virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
diff --git a/src/templates/qquickcontrol_p_p.h b/src/templates/qquickcontrol_p_p.h
index d7821ec7..e32af257 100644
--- a/src/templates/qquickcontrol_p_p.h
+++ b/src/templates/qquickcontrol_p_p.h
@@ -77,7 +77,7 @@ public:
return control->d_func();
}
- void mirrorChange() Q_DECL_OVERRIDE;
+ void mirrorChange() override;
void setTopPadding(qreal value, bool reset = false);
void setLeftPadding(qreal value, bool reset = false);
@@ -88,8 +88,8 @@ public:
void resizeContent();
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
void updateFont(const QFont &);
diff --git a/src/templates/qquickdial.cpp b/src/templates/qquickdial.cpp
index 8d6e655a..e1083b35 100644
--- a/src/templates/qquickdial.cpp
+++ b/src/templates/qquickdial.cpp
@@ -92,7 +92,7 @@ public:
stepSize(0),
pressed(false),
snapMode(QQuickDial::NoSnap),
- handle(Q_NULLPTR)
+ handle(nullptr)
{
}
@@ -143,14 +143,15 @@ void QQuickDialPrivate::setPosition(qreal pos)
{
Q_Q(QQuickDial);
pos = qBound<qreal>(0.0, pos, 1.0);
- if (!qFuzzyCompare(position, pos)) {
- position = pos;
+ if (qFuzzyCompare(position, pos))
+ return;
- angle = startAngle + position * qAbs(endAngle - startAngle);
+ position = pos;
- emit q->positionChanged();
- emit q->angleChanged();
- }
+ angle = startAngle + position * qAbs(endAngle - startAngle);
+
+ emit q->positionChanged();
+ emit q->angleChanged();
}
void QQuickDialPrivate::updatePosition()
@@ -184,13 +185,14 @@ qreal QQuickDial::from() const
void QQuickDial::setFrom(qreal from)
{
Q_D(QQuickDial);
- if (!qFuzzyCompare(d->from, from)) {
- d->from = from;
- emit fromChanged();
- if (isComponentComplete()) {
- setValue(d->value);
- d->updatePosition();
- }
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
}
}
@@ -211,13 +213,14 @@ qreal QQuickDial::to() const
void QQuickDial::setTo(qreal to)
{
Q_D(QQuickDial);
- if (!qFuzzyCompare(d->to, to)) {
- d->to = to;
- emit toChanged();
- if (isComponentComplete()) {
- setValue(d->value);
- d->updatePosition();
- }
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
}
}
@@ -245,11 +248,12 @@ void QQuickDial::setValue(qreal value)
if (isComponentComplete())
value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
- if (!qFuzzyCompare(d->value, value)) {
- d->value = value;
- d->updatePosition();
- emit valueChanged();
- }
+ if (qFuzzyCompare(d->value, value))
+ return;
+
+ d->value = value;
+ d->updatePosition();
+ emit valueChanged();
}
/*!
@@ -304,10 +308,11 @@ qreal QQuickDial::stepSize() const
void QQuickDial::setStepSize(qreal step)
{
Q_D(QQuickDial);
- if (!qFuzzyCompare(d->stepSize, step)) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
}
/*!
@@ -334,10 +339,11 @@ QQuickDial::SnapMode QQuickDial::snapMode() const
void QQuickDial::setSnapMode(SnapMode mode)
{
Q_D(QQuickDial);
- if (d->snapMode != mode) {
- d->snapMode = mode;
- emit snapModeChanged();
- }
+ if (d->snapMode == mode)
+ return;
+
+ d->snapMode = mode;
+ emit snapModeChanged();
}
/*!
@@ -367,11 +373,12 @@ bool QQuickDial::isPressed() const
void QQuickDial::setPressed(bool pressed)
{
Q_D(QQuickDial);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- setAccessibleProperty("pressed", pressed);
- emit pressedChanged();
- }
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ setAccessibleProperty("pressed", pressed);
+ emit pressedChanged();
}
/*!
@@ -420,12 +427,13 @@ QQuickItem *QQuickDial::handle() const
void QQuickDial::setHandle(QQuickItem *handle)
{
Q_D(QQuickDial);
- if (handle != d->handle) {
- d->handle = handle;
- if (d->handle && !d->handle->parentItem())
- d->handle->setParentItem(this);
- emit handleChanged();
- }
+ if (handle == d->handle)
+ return;
+
+ d->handle = handle;
+ if (d->handle && !d->handle->parentItem())
+ d->handle->setParentItem(this);
+ emit handleChanged();
}
void QQuickDial::keyPressEvent(QKeyEvent *event)
diff --git a/src/templates/qquickdial_p.h b/src/templates/qquickdial_p.h
index 19d37547..2fd2f649 100644
--- a/src/templates/qquickdial_p.h
+++ b/src/templates/qquickdial_p.h
@@ -71,7 +71,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickDial : public QQuickControl
Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
public:
- explicit QQuickDial(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickDial(QQuickItem *parent = nullptr);
qreal from() const;
void setFrom(qreal from);
@@ -121,18 +121,18 @@ Q_SIGNALS:
void handleChanged();
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void mirrorChange() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void mirrorChange() override;
+ void componentComplete() override;
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickdrawer.cpp b/src/templates/qquickdrawer.cpp
index 5f3d95c9..a28d11a6 100644
--- a/src/templates/qquickdrawer.cpp
+++ b/src/templates/qquickdrawer.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-navigation
\ingroup qtlabscontrols-containers
- \brief A side panel control.
+ \brief Provides a swipe-based side panel.
Drawer provides a swipe-based side panel, similar to those often used in
touch interfaces to provide a central location for navigation.
@@ -97,14 +97,14 @@ class QQuickDrawerPrivate : public QQuickControlPrivate, public QQuickItemChange
public:
QQuickDrawerPrivate() : edge(Qt::LeftEdge), offset(0), position(0),
- content(Q_NULLPTR), animation(Q_NULLPTR) { }
+ content(nullptr), animation(nullptr) { }
void updateContent();
bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event);
bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) override;
Qt::Edge edge;
qreal offset;
@@ -290,12 +290,13 @@ Qt::Edge QQuickDrawer::edge() const
void QQuickDrawer::setEdge(Qt::Edge edge)
{
Q_D(QQuickDrawer);
- if (d->edge != edge) {
- d->edge = edge;
- if (isComponentComplete())
- d->updateContent();
- emit edgeChanged();
- }
+ if (d->edge == edge)
+ return;
+
+ d->edge = edge;
+ if (isComponentComplete())
+ d->updateContent();
+ emit edgeChanged();
}
/*!
@@ -315,12 +316,13 @@ void QQuickDrawer::setPosition(qreal position)
{
Q_D(QQuickDrawer);
position = qBound<qreal>(0.0, position, 1.0);
- if (!qFuzzyCompare(d->position, position)) {
- d->position = position;
- if (isComponentComplete())
- d->updateContent();
- emit positionChanged();
- }
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ if (isComponentComplete())
+ d->updateContent();
+ emit positionChanged();
}
@@ -338,20 +340,21 @@ QQuickItem *QQuickDrawer::contentItem() const
void QQuickDrawer::setContentItem(QQuickItem *item)
{
Q_D(QQuickDrawer);
- if (d->content != item) {
- if (d->content) {
- QQuickItemPrivate::get(d->content)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- delete d->content;
- }
- d->content = item;
- if (item) {
- item->setParentItem(this);
- QQuickItemPrivate::get(item)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
- if (isComponentComplete())
- d->updateContent();
- }
- emit contentItemChanged();
+ if (d->content == item)
+ return;
+
+ if (d->content) {
+ QQuickItemPrivate::get(d->content)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ delete d->content;
}
+ d->content = item;
+ if (item) {
+ item->setParentItem(this);
+ QQuickItemPrivate::get(item)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ if (isComponentComplete())
+ d->updateContent();
+ }
+ emit contentItemChanged();
}
/*!
@@ -371,15 +374,16 @@ QQuickPropertyAnimation *QQuickDrawer::animation() const
void QQuickDrawer::setAnimation(QQuickPropertyAnimation *animation)
{
Q_D(QQuickDrawer);
- if (d->animation != animation) {
- delete d->animation;
- d->animation = animation;
- if (animation) {
- animation->setTargetObject(this);
- animation->setProperty(QStringLiteral("position"));
- }
- emit animationChanged();
+ if (d->animation == animation)
+ return;
+
+ delete d->animation;
+ d->animation = animation;
+ if (animation) {
+ animation->setTargetObject(this);
+ animation->setProperty(QStringLiteral("position"));
}
+ emit animationChanged();
}
/*!
diff --git a/src/templates/qquickdrawer_p.h b/src/templates/qquickdrawer_p.h
index f953b0fd..39f1802a 100644
--- a/src/templates/qquickdrawer_p.h
+++ b/src/templates/qquickdrawer_p.h
@@ -66,7 +66,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickDrawer : public QQuickControl
Q_CLASSINFO("DefaultProperty", "contentItem")
public:
- explicit QQuickDrawer(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickDrawer(QQuickItem *parent = nullptr);
Qt::Edge edge() const;
void setEdge(Qt::Edge edge);
@@ -92,13 +92,13 @@ Q_SIGNALS:
void animationChanged();
protected:
- bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void componentComplete() override;
virtual qreal positionAt(const QPointF &point) const;
diff --git a/src/templates/qquickframe.cpp b/src/templates/qquickframe.cpp
index 67dfe256..6b0a08ac 100644
--- a/src/templates/qquickframe.cpp
+++ b/src/templates/qquickframe.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickFrame
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
- \brief A frame control.
+ \brief A logical group of controls within a visual frame.
Frame is used to layout a logical group of controls together, within a
visual frame. Frame does not provide a layout of its own, but requires
@@ -65,10 +65,6 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Frame}, {Container Controls}
*/
-QQuickFramePrivate::QQuickFramePrivate() : frame(Q_NULLPTR)
-{
-}
-
QQuickFrame::QQuickFrame(QQuickItem *parent) :
QQuickPane(*(new QQuickFramePrivate), parent)
{
@@ -79,29 +75,4 @@ QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
{
}
-/*!
- \qmlproperty Item Qt.labs.controls::Frame::frame
-
- This property holds the visual frame item.
-
- \sa {Customizing Frame}
-*/
-QQuickItem *QQuickFrame::frame() const
-{
- Q_D(const QQuickFrame);
- return d->frame;
-}
-
-void QQuickFrame::setFrame(QQuickItem *frame)
-{
- Q_D(QQuickFrame);
- if (d->frame != frame) {
- delete d->frame;
- d->frame = frame;
- if (frame && !frame->parentItem())
- frame->setParentItem(this);
- emit frameChanged();
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/templates/qquickframe_p.h b/src/templates/qquickframe_p.h
index 0bfd63e8..8c35b859 100644
--- a/src/templates/qquickframe_p.h
+++ b/src/templates/qquickframe_p.h
@@ -57,16 +57,9 @@ class QQuickFramePrivate;
class Q_LABSTEMPLATES_EXPORT QQuickFrame : public QQuickPane
{
Q_OBJECT
- Q_PROPERTY(QQuickItem *frame READ frame WRITE setFrame NOTIFY frameChanged FINAL)
public:
- explicit QQuickFrame(QQuickItem *parent = Q_NULLPTR);
-
- QQuickItem *frame() const;
- void setFrame(QQuickItem *frame);
-
-Q_SIGNALS:
- void frameChanged();
+ explicit QQuickFrame(QQuickItem *parent = nullptr);
protected:
QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
diff --git a/src/templates/qquickframe_p_p.h b/src/templates/qquickframe_p_p.h
index 3d570572..4e0f16f6 100644
--- a/src/templates/qquickframe_p_p.h
+++ b/src/templates/qquickframe_p_p.h
@@ -56,12 +56,6 @@ class QQuickFrame;
class Q_LABSTEMPLATES_EXPORT QQuickFramePrivate : public QQuickPanePrivate
{
- Q_DECLARE_PUBLIC(QQuickFrame)
-
-public:
- QQuickFramePrivate();
-
- QQuickItem *frame;
};
QT_END_NAMESPACE
diff --git a/src/templates/qquickgroupbox.cpp b/src/templates/qquickgroupbox.cpp
index 84944987..33f7c672 100644
--- a/src/templates/qquickgroupbox.cpp
+++ b/src/templates/qquickgroupbox.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickGroupBox
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
- \brief A group box control.
+ \brief A frame with a logical group of controls.
GroupBox is used to layout a logical group of controls together, within
a titled visual frame. GroupBox does not provide a layout of its own, but
@@ -83,7 +83,7 @@ QT_BEGIN_NAMESPACE
class QQuickGroupBoxPrivate : public QQuickFramePrivate
{
public:
- QQuickGroupBoxPrivate() : label(Q_NULLPTR) { }
+ QQuickGroupBoxPrivate() : label(nullptr) { }
QString title;
QQuickItem *label;
@@ -108,10 +108,11 @@ QString QQuickGroupBox::title() const
void QQuickGroupBox::setTitle(const QString &title)
{
Q_D(QQuickGroupBox);
- if (d->title != title) {
- d->title = title;
- emit titleChanged();
- }
+ if (d->title == title)
+ return;
+
+ d->title = title;
+ emit titleChanged();
}
/*!
@@ -130,13 +131,14 @@ QQuickItem *QQuickGroupBox::label() const
void QQuickGroupBox::setLabel(QQuickItem *label)
{
Q_D(QQuickGroupBox);
- if (d->label != label) {
- delete d->label;
- d->label = label;
- if (label && !label->parentItem())
- label->setParentItem(this);
- emit labelChanged();
- }
+ if (d->label == label)
+ return;
+
+ delete d->label;
+ d->label = label;
+ if (label && !label->parentItem())
+ label->setParentItem(this);
+ emit labelChanged();
}
QFont QQuickGroupBox::defaultFont() const
diff --git a/src/templates/qquickgroupbox_p.h b/src/templates/qquickgroupbox_p.h
index b81d6534..81ba58ab 100644
--- a/src/templates/qquickgroupbox_p.h
+++ b/src/templates/qquickgroupbox_p.h
@@ -61,7 +61,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickGroupBox : public QQuickFrame
Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
public:
- explicit QQuickGroupBox(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickGroupBox(QQuickItem *parent = nullptr);
QString title() const;
void setTitle(const QString &title);
@@ -74,7 +74,7 @@ Q_SIGNALS:
void labelChanged();
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
private:
Q_DISABLE_COPY(QQuickGroupBox)
diff --git a/src/templates/qquickitemdelegate.cpp b/src/templates/qquickitemdelegate.cpp
index 98364fad..ab5e1925 100644
--- a/src/templates/qquickitemdelegate.cpp
+++ b/src/templates/qquickitemdelegate.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\inherits AbstractButton
\instantiates QQuickItemDelegate
\inqmlmodule Qt.labs.controls
- \brief An item delegate.
+ \brief A standard view item that can be used in various views and controls.
ItemDelegate presents a standard view item. It can be used as a delegate
in various views and controls, such as \l ListView and \l ComboBox.
diff --git a/src/templates/qquickitemdelegate_p.h b/src/templates/qquickitemdelegate_p.h
index 1be909d7..24d90c20 100644
--- a/src/templates/qquickitemdelegate_p.h
+++ b/src/templates/qquickitemdelegate_p.h
@@ -59,13 +59,13 @@ class Q_LABSTEMPLATES_EXPORT QQuickItemDelegate : public QQuickAbstractButton
Q_OBJECT
public:
- explicit QQuickItemDelegate(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickItemDelegate(QQuickItem *parent = nullptr);
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquicklabel.cpp b/src/templates/qquicklabel.cpp
index 13ff3a6e..e9fb274d 100644
--- a/src/templates/qquicklabel.cpp
+++ b/src/templates/qquicklabel.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickLabel
\inqmlmodule Qt.labs.controls
\ingroup text
- \brief A text label.
+ \brief A text label with inherited styling and font.
Label extends \l Text with styling and \l {Control::font}{font}
inheritance. The default colors and font are style specific. Label
@@ -83,7 +83,7 @@ QQuickLabel::~QQuickLabel()
}
QQuickLabelPrivate::QQuickLabelPrivate()
- : background(Q_NULLPTR), accessibleAttached(Q_NULLPTR)
+ : background(nullptr), accessibleAttached(nullptr)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -195,16 +195,17 @@ QQuickItem *QQuickLabel::background() const
void QQuickLabel::setBackground(QQuickItem *background)
{
Q_D(QQuickLabel);
- if (d->background != background) {
- delete d->background;
- d->background = background;
- if (background) {
- background->setParentItem(this);
- if (qFuzzyIsNull(background->z()))
- background->setZ(-1);
- }
- emit backgroundChanged();
+ if (d->background == background)
+ return;
+
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
}
+ emit backgroundChanged();
}
void QQuickLabel::classBegin()
diff --git a/src/templates/qquicklabel_p.h b/src/templates/qquicklabel_p.h
index 26f72840..7bb09d1b 100644
--- a/src/templates/qquicklabel_p.h
+++ b/src/templates/qquicklabel_p.h
@@ -62,7 +62,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickLabel : public QQuickText
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
public:
- explicit QQuickLabel(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickLabel(QQuickItem *parent = nullptr);
~QQuickLabel();
QFont font() const;
@@ -76,10 +76,10 @@ Q_SIGNALS:
void backgroundChanged();
protected:
- void classBegin() Q_DECL_OVERRIDE;
+ void classBegin() override;
- void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
private:
Q_DISABLE_COPY(QQuickLabel)
diff --git a/src/templates/qquicklabel_p_p.h b/src/templates/qquicklabel_p_p.h
index a4e9f4e5..9d0ff05c 100644
--- a/src/templates/qquicklabel_p_p.h
+++ b/src/templates/qquicklabel_p_p.h
@@ -78,8 +78,8 @@ public:
void _q_textChanged(const QString &text);
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
QQuickItem *background;
diff --git a/src/templates/qquickmenu.cpp b/src/templates/qquickmenu.cpp
index b61985d5..2a45b6df 100644
--- a/src/templates/qquickmenu.cpp
+++ b/src/templates/qquickmenu.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickMenu
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-menus
- \brief A menu control.
+ \brief A menu control that can be used as a context menu or popup menu.
\image qtlabscontrols-menu.png
@@ -92,8 +92,8 @@ QT_BEGIN_NAMESPACE
*/
QQuickMenuPrivate::QQuickMenuPrivate() :
- contentModel(Q_NULLPTR),
- dummyFocusItem(Q_NULLPTR),
+ contentModel(nullptr),
+ dummyFocusItem(nullptr),
ignoreActiveFocusChanges(false)
{
Q_Q(QQuickMenu);
@@ -125,7 +125,7 @@ void QQuickMenuPrivate::removeItem(int index, QQuickItem *item)
contentData.removeOne(item);
QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
- item->setParentItem(Q_NULLPTR);
+ item->setParentItem(nullptr);
contentModel->remove(index);
}
@@ -161,7 +161,7 @@ void QQuickMenuPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
{
// remove dynamically unparented items (eg. by a Repeater)
if (!parent)
- removeItem(contentModel->indexOf(item, Q_NULLPTR), item);
+ removeItem(contentModel->indexOf(item, nullptr), item);
}
void QQuickMenuPrivate::itemSiblingOrderChanged(QQuickItem *)
@@ -171,14 +171,14 @@ void QQuickMenuPrivate::itemSiblingOrderChanged(QQuickItem *)
QList<QQuickItem *> siblings = contentItem->childItems();
for (int i = 0; i < siblings.count(); ++i) {
QQuickItem* sibling = siblings.at(i);
- int index = contentModel->indexOf(sibling, Q_NULLPTR);
+ int index = contentModel->indexOf(sibling, nullptr);
q->moveItem(index, i);
}
}
void QQuickMenuPrivate::itemDestroyed(QQuickItem *item)
{
- int index = contentModel->indexOf(item, Q_NULLPTR);
+ int index = contentModel->indexOf(item, nullptr);
if (index != -1)
removeItem(index, item);
}
@@ -193,7 +193,7 @@ void QQuickMenuPrivate::onItemPressed()
{
Q_Q(QQuickMenu);
QQuickItem *item = qobject_cast<QQuickItem*>(q->sender());
- int itemIndex = contentModel->indexOf(item, Q_NULLPTR);
+ int itemIndex = contentModel->indexOf(item, nullptr);
Q_ASSERT(itemIndex != -1);
if (!contentItem->property("currentIndex").isValid())
@@ -215,7 +215,7 @@ void QQuickMenuPrivate::onItemActiveFocusChanged()
if (!contentItem->property("currentIndex").isValid())
return;
- int indexOfItem = contentModel->indexOf(item, Q_NULLPTR);
+ int indexOfItem = contentModel->indexOf(item, nullptr);
contentItem->setProperty("currentIndex", indexOfItem);
}
@@ -265,7 +265,7 @@ void QQuickMenuPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObj
if (QQuickItemPrivate::get(item)->isTransparentForPositioner()) {
QQuickItemPrivate::get(item)->addItemChangeListener(p, QQuickItemPrivate::SiblingOrder);
item->setParentItem(p->contentItem);
- } else if (p->contentModel->indexOf(item, Q_NULLPTR) == -1) {
+ } else if (p->contentModel->indexOf(item, nullptr) == -1) {
q->addItem(item);
QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(item);
@@ -342,7 +342,7 @@ void QQuickMenu::insertItem(int index, QQuickItem *item)
if (index < 0 || index > count)
index = count;
- int oldIndex = d->contentModel->indexOf(item, Q_NULLPTR);
+ int oldIndex = d->contentModel->indexOf(item, nullptr);
if (oldIndex != -1) {
if (oldIndex < index)
--index;
diff --git a/src/templates/qquickmenu_p.h b/src/templates/qquickmenu_p.h
index 065ee1d7..ec417d16 100644
--- a/src/templates/qquickmenu_p.h
+++ b/src/templates/qquickmenu_p.h
@@ -67,7 +67,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickMenu : public QQuickPopup
Q_CLASSINFO("DefaultProperty", "contentData")
public:
- explicit QQuickMenu(QObject *parent = Q_NULLPTR);
+ explicit QQuickMenu(QObject *parent = nullptr);
Q_INVOKABLE QQuickItem *itemAt(int index) const;
Q_INVOKABLE void addItem(QQuickItem *item);
@@ -82,9 +82,9 @@ public:
void setTitle(QString &title);
protected:
- void componentComplete() Q_DECL_OVERRIDE;
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ bool eventFilter(QObject *object, QEvent *event) override;
Q_SIGNALS:
void titleChanged();
diff --git a/src/templates/qquickmenu_p_p.h b/src/templates/qquickmenu_p_p.h
index 4c2aed16..366dbc35 100644
--- a/src/templates/qquickmenu_p_p.h
+++ b/src/templates/qquickmenu_p_p.h
@@ -73,11 +73,11 @@ public:
void resizeItem(QQuickItem *item);
void resizeItems();
- void itemChildAdded(QQuickItem *item, QQuickItem *child) Q_DECL_OVERRIDE;
- void itemSiblingOrderChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemParentChanged(QQuickItem *item, QQuickItem *parent) Q_DECL_OVERRIDE;
- void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemChildAdded(QQuickItem *item, QQuickItem *child) override;
+ void itemSiblingOrderChanged(QQuickItem *item) override;
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
+ void itemDestroyed(QQuickItem *item) override;
+ void itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &oldGeometry) override;
void onItemPressed();
void onItemActiveFocusChanged();
diff --git a/src/templates/qquickmenuitem_p.h b/src/templates/qquickmenuitem_p.h
index 91d1e91e..812597be 100644
--- a/src/templates/qquickmenuitem_p.h
+++ b/src/templates/qquickmenuitem_p.h
@@ -59,16 +59,16 @@ class Q_LABSTEMPLATES_EXPORT QQuickMenuItem : public QQuickAbstractButton
Q_OBJECT
public:
- explicit QQuickMenuItem(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickMenuItem(QQuickItem *parent = nullptr);
Q_SIGNALS:
void triggered();
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickoverlay.cpp b/src/templates/qquickoverlay.cpp
index dd9d2c5d..b20088ba 100644
--- a/src/templates/qquickoverlay.cpp
+++ b/src/templates/qquickoverlay.cpp
@@ -109,7 +109,7 @@ void QQuickOverlayPrivate::resizeBackground()
}
QQuickOverlayPrivate::QQuickOverlayPrivate() :
- background(Q_NULLPTR),
+ background(nullptr),
modalPopups(0)
{
}
@@ -132,19 +132,20 @@ QQuickItem *QQuickOverlay::background() const
void QQuickOverlay::setBackground(QQuickItem *background)
{
Q_D(QQuickOverlay);
- if (d->background != background) {
- delete d->background;
- d->background = background;
- if (background) {
- background->setOpacity(0.0);
- background->setParentItem(this);
- if (qFuzzyIsNull(background->z()))
- background->setZ(-1);
- if (isComponentComplete())
- d->resizeBackground();
- }
- emit backgroundChanged();
+ if (d->background == background)
+ return;
+
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setOpacity(0.0);
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
}
+ emit backgroundChanged();
}
void QQuickOverlay::itemChange(ItemChange change, const ItemChangeData &data)
@@ -152,7 +153,7 @@ void QQuickOverlay::itemChange(ItemChange change, const ItemChangeData &data)
Q_D(QQuickOverlay);
QQuickItem::itemChange(change, data);
- QQuickPopup *popup = Q_NULLPTR;
+ QQuickPopup *popup = nullptr;
if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
QQuickDrawer *drawer = qobject_cast<QQuickDrawer *>(data.item);
if (drawer) {
@@ -214,8 +215,8 @@ void QQuickOverlay::mousePressEvent(QMouseEvent *event)
event->setAccepted(d->modalPopups > 0);
emit pressed();
- for (int i = d->popups.count() - 1; i >= 0; --i) {
- if (QQuickPopupPrivate::get(d->popups.at(i))->tryClose(this, event))
+ for (auto it = d->popups.rbegin(), end = d->popups.rend(); it != end; ++it) {
+ if (QQuickPopupPrivate::get(*it)->tryClose(this, event))
break;
}
}
@@ -232,8 +233,8 @@ void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event)
event->setAccepted(d->modalPopups > 0);
emit released();
- for (int i = d->popups.count() - 1; i >= 0; --i) {
- if (QQuickPopupPrivate::get(d->popups.at(i))->tryClose(this, event))
+ for (auto it = d->popups.rbegin(), end = d->popups.rend(); it != end; ++it) {
+ if (QQuickPopupPrivate::get(*it)->tryClose(this, event))
break;
}
}
@@ -258,8 +259,8 @@ bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event)
bool modalBlocked = false;
const QQuickItemPrivate *priv = QQuickItemPrivate::get(this);
const QList<QQuickItem *> &sortedChildren = priv->paintOrderChildItems();
- for (int i = sortedChildren.count() - 1; i >= 0; --i) {
- QQuickItem *popupItem = sortedChildren[i];
+ for (auto it = sortedChildren.rbegin(), end = sortedChildren.rend(); it != end; ++it) {
+ QQuickItem *popupItem = *it;
if (popupItem == item)
break;
diff --git a/src/templates/qquickoverlay_p.h b/src/templates/qquickoverlay_p.h
index 6a4d56b3..f5ce54f6 100644
--- a/src/templates/qquickoverlay_p.h
+++ b/src/templates/qquickoverlay_p.h
@@ -61,7 +61,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickOverlay : public QQuickItem
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
public:
- explicit QQuickOverlay(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickOverlay(QQuickItem *parent = nullptr);
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -72,16 +72,16 @@ Q_SIGNALS:
void released();
protected:
- void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &oldGeometry, const QRectF &newGeometry) Q_DECL_OVERRIDE;
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void geometryChanged(const QRectF &oldGeometry, const QRectF &newGeometry) override;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
- bool childMouseEventFilter(QQuickItem *item, QEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void wheelEvent(QWheelEvent *event) override;
+ bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
private:
Q_DISABLE_COPY(QQuickOverlay)
diff --git a/src/templates/qquickpage.cpp b/src/templates/qquickpage.cpp
index 6a65e7c4..a4225028 100644
--- a/src/templates/qquickpage.cpp
+++ b/src/templates/qquickpage.cpp
@@ -36,6 +36,8 @@
#include "qquickpage_p.h"
#include "qquickcontrol_p_p.h"
+#include "qquicktoolbar_p.h"
+#include "qquicktabbar_p.h"
#include <QtQuick/private/qquickitemchangelistener_p.h>
@@ -47,7 +49,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickPage
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
- \brief A page control.
+ \brief A control that makes it convenient to add a header and footer to a page.
Page is a container control which makes it convenient to add
a \l header and \l footer item to a page.
@@ -91,14 +93,14 @@ public:
void relayout();
- void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
QQuickItem *header;
QQuickItem *footer;
};
-QQuickPagePrivate::QQuickPagePrivate() : header(Q_NULLPTR), footer(Q_NULLPTR)
+QQuickPagePrivate::QQuickPagePrivate() : header(nullptr), footer(nullptr)
{
}
@@ -148,6 +150,9 @@ QQuickPage::QQuickPage(QQuickItem *parent) :
This property holds the page header item. The header item is positioned to
the top, and resized to the width of the page. The default value is \c null.
+ \note Assigning a ToolBar or TabBar as a page header sets the respective
+ \l ToolBar::position or \l TabBar::position property automatically to \c Header.
+
\sa footer, ApplicationWindow::header
*/
QQuickItem *QQuickPage::header() const
@@ -159,23 +164,28 @@ QQuickItem *QQuickPage::header() const
void QQuickPage::setHeader(QQuickItem *header)
{
Q_D(QQuickPage);
- if (d->header != header) {
- if (d->header) {
- QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- d->header->setParentItem(Q_NULLPTR);
- }
- d->header = header;
- if (header) {
- header->setParentItem(this);
- QQuickItemPrivate *p = QQuickItemPrivate::get(header);
- p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- if (qFuzzyIsNull(header->z()))
- header->setZ(1);
- if (isComponentComplete())
- d->relayout();
- }
- emit headerChanged();
+ if (d->header == header)
+ return;
+
+ if (d->header) {
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ d->header->setParentItem(nullptr);
+ }
+ d->header = header;
+ if (header) {
+ header->setParentItem(this);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(header);
+ p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (qFuzzyIsNull(header->z()))
+ header->setZ(1);
+ if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(header))
+ toolBar->setPosition(QQuickToolBar::Header);
+ else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(header))
+ tabBar->setPosition(QQuickTabBar::Header);
+ if (isComponentComplete())
+ d->relayout();
}
+ emit headerChanged();
}
/*!
@@ -184,6 +194,9 @@ void QQuickPage::setHeader(QQuickItem *header)
This property holds the page footer item. The footer item is positioned to
the bottom, and resized to the width of the page. The default value is \c null.
+ \note Assigning a ToolBar or TabBar as a page footer sets the respective
+ \l ToolBar::position or \l TabBar::position property automatically to \c Footer.
+
\sa header, ApplicationWindow::footer
*/
QQuickItem *QQuickPage::footer() const
@@ -195,23 +208,28 @@ QQuickItem *QQuickPage::footer() const
void QQuickPage::setFooter(QQuickItem *footer)
{
Q_D(QQuickPage);
- if (d->footer != footer) {
- if (d->footer) {
- QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- d->footer->setParentItem(Q_NULLPTR);
- }
- d->footer = footer;
- if (footer) {
- footer->setParentItem(this);
- QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
- p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- if (qFuzzyIsNull(footer->z()))
- footer->setZ(1);
- if (isComponentComplete())
- d->relayout();
- }
- emit footerChanged();
+ if (d->footer == footer)
+ return;
+
+ if (d->footer) {
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ d->footer->setParentItem(nullptr);
+ }
+ d->footer = footer;
+ if (footer) {
+ footer->setParentItem(this);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
+ p->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (qFuzzyIsNull(footer->z()))
+ footer->setZ(1);
+ if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(footer))
+ toolBar->setPosition(QQuickToolBar::Footer);
+ else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(footer))
+ tabBar->setPosition(QQuickTabBar::Footer);
+ if (isComponentComplete())
+ d->relayout();
}
+ emit footerChanged();
}
/*!
@@ -225,7 +243,7 @@ void QQuickPage::setFooter(QQuickItem *footer)
QQmlListProperty<QObject> QQuickPage::contentData()
{
Q_D(QQuickPage);
- return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR,
+ return QQmlListProperty<QObject>(d->contentItem, nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -242,7 +260,7 @@ QQmlListProperty<QObject> QQuickPage::contentData()
QQmlListProperty<QQuickItem> QQuickPage::contentChildren()
{
Q_D(QQuickPage);
- return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
+ return QQmlListProperty<QQuickItem>(d->contentItem, nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
diff --git a/src/templates/qquickpage_p.h b/src/templates/qquickpage_p.h
index 157f0507..c21bb0ac 100644
--- a/src/templates/qquickpage_p.h
+++ b/src/templates/qquickpage_p.h
@@ -65,7 +65,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickPage : public QQuickControl
Q_CLASSINFO("DefaultProperty", "contentData")
public:
- explicit QQuickPage(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickPage(QQuickItem *parent = nullptr);
QQuickItem *header() const;
void setHeader(QQuickItem *header);
@@ -82,12 +82,12 @@ Q_SIGNALS:
void contentChildrenChanged();
protected:
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickpageindicator.cpp b/src/templates/qquickpageindicator.cpp
index a360627e..1035085e 100644
--- a/src/templates/qquickpageindicator.cpp
+++ b/src/templates/qquickpageindicator.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickPageIndicator
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-indicators
- \brief A page indicator control.
+ \brief Indicates the currently active page.
PageIndicator is used to indicate the currently active page
in a container of multiple pages. PageIndicator consists of
@@ -70,7 +70,7 @@ class QQuickPageIndicatorPrivate : public QQuickControlPrivate, public QQuickIte
public:
QQuickPageIndicatorPrivate() : count(0), currentIndex(0),
- interactive(false), delegate(Q_NULLPTR), pressedItem(Q_NULLPTR)
+ interactive(false), delegate(nullptr), pressedItem(nullptr)
{
}
@@ -91,7 +91,7 @@ QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
{
Q_Q(const QQuickPageIndicator);
if (!contentItem || !q->contains(pos))
- return Q_NULLPTR;
+ return nullptr;
QPointF contentPos = q->mapToItem(contentItem, pos);
QQuickItem *item = contentItem->childAt(contentPos.x(), contentPos.y());
@@ -102,8 +102,9 @@ QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
// find the nearest
qreal distance = qInf();
- QQuickItem *nearest = Q_NULLPTR;
- foreach (QQuickItem *child, contentItem->childItems()) {
+ QQuickItem *nearest = nullptr;
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *child : childItems) {
if (QQuickItemPrivate::get(child)->isTransparentForPositioner())
continue;
@@ -122,7 +123,7 @@ QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
void QQuickPageIndicatorPrivate::updatePressed(bool pressed, const QPoint &pos)
{
QQuickItem *prevItem = pressedItem;
- pressedItem = pressed ? itemAt(pos) : Q_NULLPTR;
+ pressedItem = pressed ? itemAt(pos) : nullptr;
if (prevItem != pressedItem) {
setContextProperty(prevItem, QStringLiteral("pressed"), false);
setContextProperty(pressedItem, QStringLiteral("pressed"), pressed);
@@ -164,10 +165,11 @@ int QQuickPageIndicator::count() const
void QQuickPageIndicator::setCount(int count)
{
Q_D(QQuickPageIndicator);
- if (d->count != count) {
- d->count = count;
- emit countChanged();
- }
+ if (d->count == count)
+ return;
+
+ d->count = count;
+ emit countChanged();
}
/*!
@@ -184,10 +186,11 @@ int QQuickPageIndicator::currentIndex() const
void QQuickPageIndicator::setCurrentIndex(int index)
{
Q_D(QQuickPageIndicator);
- if (d->currentIndex != index) {
- d->currentIndex = index;
- emit currentIndexChanged();
- }
+ if (d->currentIndex == index)
+ return;
+
+ d->currentIndex = index;
+ emit currentIndexChanged();
}
/*!
@@ -208,11 +211,12 @@ bool QQuickPageIndicator::isInteractive() const
void QQuickPageIndicator::setInteractive(bool interactive)
{
Q_D(QQuickPageIndicator);
- if (d->interactive != interactive) {
- d->interactive = interactive;
- setAcceptedMouseButtons(interactive ? Qt::LeftButton : Qt::NoButton);
- emit interactiveChanged();
- }
+ if (d->interactive == interactive)
+ return;
+
+ d->interactive = interactive;
+ setAcceptedMouseButtons(interactive ? Qt::LeftButton : Qt::NoButton);
+ emit interactiveChanged();
}
/*!
@@ -235,10 +239,11 @@ QQmlComponent *QQuickPageIndicator::delegate() const
void QQuickPageIndicator::setDelegate(QQmlComponent *delegate)
{
Q_D(QQuickPageIndicator);
- if (d->delegate != delegate) {
- d->delegate = delegate;
- emit delegateChanged();
- }
+ if (d->delegate == delegate)
+ return;
+
+ d->delegate = delegate;
+ emit delegateChanged();
}
void QQuickPageIndicator::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
diff --git a/src/templates/qquickpageindicator_p.h b/src/templates/qquickpageindicator_p.h
index 487b4d6e..b776cbb6 100644
--- a/src/templates/qquickpageindicator_p.h
+++ b/src/templates/qquickpageindicator_p.h
@@ -64,7 +64,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickPageIndicator : public QQuickControl
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
public:
- explicit QQuickPageIndicator(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickPageIndicator(QQuickItem *parent = nullptr);
int count() const;
void setCount(int count);
@@ -85,15 +85,15 @@ Q_SIGNALS:
void delegateChanged();
protected:
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickpane.cpp b/src/templates/qquickpane.cpp
index 9bedb150..e8eeccdb 100644
--- a/src/templates/qquickpane.cpp
+++ b/src/templates/qquickpane.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickPane
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
- \brief A pane control.
+ \brief Provides a background matching with the application style and theme.
Pane provides a background color that matches with the application style
and theme. Pane does not provide a layout of its own, but requires you to
@@ -101,10 +101,11 @@ qreal QQuickPane::contentWidth() const
void QQuickPane::setContentWidth(qreal width)
{
Q_D(QQuickPane);
- if (d->contentWidth != width) {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
}
/*!
@@ -125,10 +126,11 @@ qreal QQuickPane::contentHeight() const
void QQuickPane::setContentHeight(qreal height)
{
Q_D(QQuickPane);
- if (d->contentHeight != height) {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
}
/*!
@@ -142,7 +144,7 @@ void QQuickPane::setContentHeight(qreal height)
QQmlListProperty<QObject> QQuickPane::contentData()
{
Q_D(QQuickPane);
- return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR,
+ return QQmlListProperty<QObject>(d->contentItem, nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -159,7 +161,7 @@ QQmlListProperty<QObject> QQuickPane::contentData()
QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
{
Q_D(QQuickPane);
- return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
+ return QQmlListProperty<QQuickItem>(d->contentItem, nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
diff --git a/src/templates/qquickpane_p.h b/src/templates/qquickpane_p.h
index e599f55f..51039f32 100644
--- a/src/templates/qquickpane_p.h
+++ b/src/templates/qquickpane_p.h
@@ -65,7 +65,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickPane : public QQuickControl
Q_CLASSINFO("DefaultProperty", "contentData")
public:
- explicit QQuickPane(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickPane(QQuickItem *parent = nullptr);
qreal contentWidth() const;
void setContentWidth(qreal width);
@@ -84,10 +84,10 @@ Q_SIGNALS:
protected:
QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent);
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp
index 18a11208..4b953fc6 100644
--- a/src/templates/qquickpopup.cpp
+++ b/src/templates/qquickpopup.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickPopup
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-popups
- \brief A popup control.
+ \brief The base type of popup-like user interface controls.
Popup is the base type of popup-like user interface controls. It can be
used with Window or ApplicationWindow.
@@ -117,10 +117,10 @@ QQuickPopupPrivate::QQuickPopupPrivate()
, contentWidth(0)
, contentHeight(0)
, closePolicy(QQuickPopup::OnEscape)
- , parentItem(Q_NULLPTR)
- , enter(Q_NULLPTR)
- , exit(Q_NULLPTR)
- , popupItem(Q_NULLPTR)
+ , parentItem(nullptr)
+ , enter(nullptr)
+ , exit(nullptr)
+ , popupItem(nullptr)
, positioner(this)
, transitionManager(this)
{
@@ -165,8 +165,8 @@ void QQuickPopupPrivate::finalizeEnterTransition()
void QQuickPopupPrivate::finalizeExitTransition()
{
- positioner.setParentItem(Q_NULLPTR);
- popupItem->setParentItem(Q_NULLPTR);
+ positioner.setParentItem(nullptr);
+ popupItem->setParentItem(nullptr);
popupItem->setVisible(false);
}
@@ -235,8 +235,8 @@ class QQuickPopupItemPrivate : public QQuickControlPrivate
public:
QQuickPopupItemPrivate(QQuickPopup *popup);
- void implicitWidthChanged() Q_DECL_OVERRIDE;
- void implicitHeightChanged() Q_DECL_OVERRIDE;
+ void implicitWidthChanged() override;
+ void implicitHeightChanged() override;
QQuickPopup *popup;
};
@@ -259,7 +259,7 @@ void QQuickPopupItemPrivate::implicitHeightChanged()
}
QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup) :
- QQuickControl(*(new QQuickPopupItemPrivate(popup)), Q_NULLPTR)
+ QQuickControl(*(new QQuickPopupItemPrivate(popup)), nullptr)
{
setParent(popup);
setVisible(false);
@@ -370,7 +370,7 @@ void QQuickPopupItem::paddingChange(const QMarginsF &newPadding, const QMarginsF
QQuickPopupPositioner::QQuickPopupPositioner(QQuickPopupPrivate *popup) :
m_x(0),
m_y(0),
- m_parentItem(Q_NULLPTR),
+ m_parentItem(nullptr),
m_popup(popup)
{
}
@@ -390,11 +390,12 @@ qreal QQuickPopupPositioner::x() const
void QQuickPopupPositioner::setX(qreal x)
{
- if (m_x != x) {
- m_x = x;
- if (m_popup->popupItem->isVisible())
- repositionPopup();
- }
+ if (m_x == x)
+ return;
+
+ m_x = x;
+ if (m_popup->popupItem->isVisible())
+ repositionPopup();
}
qreal QQuickPopupPositioner::y() const
@@ -404,11 +405,12 @@ qreal QQuickPopupPositioner::y() const
void QQuickPopupPositioner::setY(qreal y)
{
- if (m_y != y) {
- m_y = y;
- if (m_popup->popupItem->isVisible())
- repositionPopup();
- }
+ if (m_y == y)
+ return;
+
+ m_y = y;
+ if (m_popup->popupItem->isVisible())
+ repositionPopup();
}
QQuickItem *QQuickPopupPositioner::parentItem() const
@@ -459,7 +461,7 @@ void QQuickPopupPositioner::itemDestroyed(QQuickItem *item)
{
Q_ASSERT(m_parentItem == item);
- m_parentItem = Q_NULLPTR;
+ m_parentItem = nullptr;
QQuickItemPrivate::get(item)->removeItemChangeListener(this, ItemChangeTypes);
removeAncestorListeners(item->parentItem());
}
@@ -597,7 +599,7 @@ QQuickPopup::QQuickPopup(QQuickPopupPrivate &dd, QObject *parent)
QQuickPopup::~QQuickPopup()
{
Q_D(QQuickPopup);
- d->positioner.setParentItem(Q_NULLPTR);
+ d->positioner.setParentItem(nullptr);
delete d->popupItem;
}
@@ -612,7 +614,7 @@ void QQuickPopup::open()
if (d->popupItem->isVisible())
return;
- QQuickWindow *window = Q_NULLPTR;
+ QQuickWindow *window = nullptr;
if (d->parentItem)
window = d->parentItem->window();
if (!window) {
@@ -811,10 +813,11 @@ qreal QQuickPopup::contentWidth() const
void QQuickPopup::setContentWidth(qreal width)
{
Q_D(QQuickPopup);
- if (d->contentWidth != width) {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
}
/*!
@@ -835,10 +838,11 @@ qreal QQuickPopup::contentHeight() const
void QQuickPopup::setContentHeight(qreal height)
{
Q_D(QQuickPopup);
- if (d->contentHeight != height) {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
}
/*!
@@ -1160,16 +1164,17 @@ QQuickItem *QQuickPopup::parentItem() const
void QQuickPopup::setParentItem(QQuickItem *parent)
{
Q_D(QQuickPopup);
- if (d->parentItem != parent) {
- d->parentItem = parent;
- if (d->positioner.parentItem())
- d->positioner.setParentItem(parent);
- if (d->popupItem) {
- QQuickControlPrivate::updateFontRecur(d->popupItem, QQuickControlPrivate::naturalControlFont(parent));
- QQuickControlPrivate::updateLocaleRecur(d->popupItem, QQuickControlPrivate::calcLocale(parent));
- }
- emit parentChanged();
+ if (d->parentItem == parent)
+ return;
+
+ d->parentItem = parent;
+ if (d->positioner.parentItem())
+ d->positioner.setParentItem(parent);
+ if (d->popupItem) {
+ QQuickControlPrivate::updateFontRecur(d->popupItem, QQuickControlPrivate::naturalControlFont(parent));
+ QQuickControlPrivate::updateLocaleRecur(d->popupItem, QQuickControlPrivate::calcLocale(parent));
}
+ emit parentChanged();
}
/*!
@@ -1230,7 +1235,7 @@ void QQuickPopup::setContentItem(QQuickItem *item)
QQmlListProperty<QObject> QQuickPopup::contentData()
{
Q_D(QQuickPopup);
- return QQmlListProperty<QObject>(d->popupItem->contentItem(), Q_NULLPTR,
+ return QQmlListProperty<QObject>(d->popupItem->contentItem(), nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -1247,7 +1252,7 @@ QQmlListProperty<QObject> QQuickPopup::contentData()
QQmlListProperty<QQuickItem> QQuickPopup::contentChildren()
{
Q_D(QQuickPopup);
- return QQmlListProperty<QQuickItem>(d->popupItem->contentItem(), Q_NULLPTR,
+ return QQmlListProperty<QQuickItem>(d->popupItem->contentItem(), nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
@@ -1480,20 +1485,6 @@ void QQuickPopup::setExit(QQuickTransition *transition)
emit exitChanged();
}
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Popup::data
- \default
-
- This property holds the list of data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickPopup::data()
-{
- Q_D(QQuickPopup);
- return QQuickItemPrivate::get(d->popupItem)->data();
-}
-
void QQuickPopup::classBegin()
{
}
diff --git a/src/templates/qquickpopup_p.h b/src/templates/qquickpopup_p.h
index eb52882c..4b5d3e72 100644
--- a/src/templates/qquickpopup_p.h
+++ b/src/templates/qquickpopup_p.h
@@ -107,7 +107,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickPopup : public QObject, public QQmlParserStat
Q_CLASSINFO("DefaultProperty", "contentData")
public:
- explicit QQuickPopup(QObject *parent = Q_NULLPTR);
+ explicit QQuickPopup(QObject *parent = nullptr);
~QQuickPopup();
qreal x() const;
@@ -247,8 +247,6 @@ public:
QQuickTransition *exit() const;
void setExit(QQuickTransition *transition);
- QQmlListProperty<QObject> data();
-
public Q_SLOTS:
void open();
void close();
@@ -296,11 +294,11 @@ Q_SIGNALS:
protected:
QQuickPopup(QQuickPopupPrivate &dd, QObject *parent);
- void classBegin() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ void classBegin() override;
+ void componentComplete() override;
bool isComponentComplete() const;
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
virtual void focusInEvent(QFocusEvent *event);
virtual void focusOutEvent(QFocusEvent *event);
virtual void keyPressEvent(QKeyEvent *event);
diff --git a/src/templates/qquickpopup_p_p.h b/src/templates/qquickpopup_p_p.h
index 45dd7fd9..ba1e90a8 100644
--- a/src/templates/qquickpopup_p_p.h
+++ b/src/templates/qquickpopup_p_p.h
@@ -73,7 +73,7 @@ public:
void transitionExit();
protected:
- void finished() Q_DECL_OVERRIDE;
+ void finished() override;
private:
enum TransitionState {
@@ -92,21 +92,21 @@ public:
explicit QQuickPopupItem(QQuickPopup *popup);
protected:
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE;
-
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseDoubleClickEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void wheelEvent(QWheelEvent *event) override;
+
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
private:
Q_DECLARE_PRIVATE(QQuickPopupItem)
diff --git a/src/templates/qquickpressandholdhelper.cpp b/src/templates/qquickpressandholdhelper.cpp
index 29b3bb0a..6f3ddcbc 100644
--- a/src/templates/qquickpressandholdhelper.cpp
+++ b/src/templates/qquickpressandholdhelper.cpp
@@ -45,10 +45,10 @@
QT_BEGIN_NAMESPACE
QQuickPressAndHoldHelper::QQuickPressAndHoldHelper()
- : control(Q_NULLPTR)
+ : control(nullptr)
, longPress(false)
, pressAndHoldSignalIndex(-1)
- , delayedMousePressEvent(Q_NULLPTR)
+ , delayedMousePressEvent(nullptr)
{ }
void QQuickPressAndHoldHelper::mousePressEvent(QMouseEvent *event)
@@ -91,7 +91,7 @@ void QQuickPressAndHoldHelper::timerEvent(QTimerEvent *)
mev.setAccepted(true);
// Use fast signal invocation since we already got its index
QQuickMouseEvent *mevPtr = &mev;
- void *args[] = { Q_NULLPTR, &mevPtr };
+ void *args[] = { nullptr, &mevPtr };
QMetaObject::metacall(control, QMetaObject::InvokeMetaMethod, pressAndHoldSignalIndex, args);
if (!mev.isAccepted())
longPress = false;
diff --git a/src/templates/qquickprogressbar.cpp b/src/templates/qquickprogressbar.cpp
index 972654ad..8596128f 100644
--- a/src/templates/qquickprogressbar.cpp
+++ b/src/templates/qquickprogressbar.cpp
@@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickProgressBar
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-indicators
- \brief A progress bar control.
+ \brief Indicates the progress of an operation.
ProgressBar indicates the progress of an operation.
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
class QQuickProgressBarPrivate : public QQuickControlPrivate
{
public:
- QQuickProgressBarPrivate() : from(0), to(1.0), value(0), indeterminate(false), indicator(Q_NULLPTR)
+ QQuickProgressBarPrivate() : from(0), to(1.0), value(0), indeterminate(false), indicator(nullptr)
{
}
@@ -102,14 +102,15 @@ qreal QQuickProgressBar::from() const
void QQuickProgressBar::setFrom(qreal from)
{
Q_D(QQuickProgressBar);
- if (!qFuzzyCompare(d->from, from)) {
- d->from = from;
- emit fromChanged();
- emit positionChanged();
- emit visualPositionChanged();
- if (isComponentComplete())
- setValue(d->value);
- }
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ emit positionChanged();
+ emit visualPositionChanged();
+ if (isComponentComplete())
+ setValue(d->value);
}
/*!
@@ -128,14 +129,15 @@ qreal QQuickProgressBar::to() const
void QQuickProgressBar::setTo(qreal to)
{
Q_D(QQuickProgressBar);
- if (!qFuzzyCompare(d->to, to)) {
- d->to = to;
- emit toChanged();
- emit positionChanged();
- emit visualPositionChanged();
- if (isComponentComplete())
- setValue(d->value);
- }
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+ emit positionChanged();
+ emit visualPositionChanged();
+ if (isComponentComplete())
+ setValue(d->value);
}
/*!
@@ -157,12 +159,13 @@ void QQuickProgressBar::setValue(qreal value)
if (isComponentComplete())
value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
- if (!qFuzzyCompare(d->value, value)) {
- d->value = value;
- emit valueChanged();
- emit positionChanged();
- emit visualPositionChanged();
- }
+ if (qFuzzyCompare(d->value, value))
+ return;
+
+ d->value = value;
+ emit valueChanged();
+ emit positionChanged();
+ emit visualPositionChanged();
}
/*!
@@ -219,10 +222,11 @@ bool QQuickProgressBar::isIndeterminate() const
void QQuickProgressBar::setIndeterminate(bool indeterminate)
{
Q_D(QQuickProgressBar);
- if (d->indeterminate != indeterminate) {
- d->indeterminate = indeterminate;
- emit indeterminateChanged();
- }
+ if (d->indeterminate == indeterminate)
+ return;
+
+ d->indeterminate = indeterminate;
+ emit indeterminateChanged();
}
/*!
@@ -241,13 +245,14 @@ QQuickItem *QQuickProgressBar::indicator() const
void QQuickProgressBar::setIndicator(QQuickItem *indicator)
{
Q_D(QQuickProgressBar);
- if (d->indicator != indicator) {
- delete d->indicator;
- d->indicator = indicator;
- if (indicator && !indicator->parentItem())
- indicator->setParentItem(this);
- emit indicatorChanged();
- }
+ if (d->indicator == indicator)
+ return;
+
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator && !indicator->parentItem())
+ indicator->setParentItem(this);
+ emit indicatorChanged();
}
void QQuickProgressBar::mirrorChange()
diff --git a/src/templates/qquickprogressbar_p.h b/src/templates/qquickprogressbar_p.h
index f94c718e..1bf21b41 100644
--- a/src/templates/qquickprogressbar_p.h
+++ b/src/templates/qquickprogressbar_p.h
@@ -66,7 +66,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickProgressBar : public QQuickControl
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
public:
- explicit QQuickProgressBar(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickProgressBar(QQuickItem *parent = nullptr);
qreal from() const;
void setFrom(qreal from);
@@ -96,11 +96,11 @@ Q_SIGNALS:
void indicatorChanged();
protected:
- void mirrorChange() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ void mirrorChange() override;
+ void componentComplete() override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickradiobutton.cpp b/src/templates/qquickradiobutton.cpp
index 7d7a64aa..e14427f9 100644
--- a/src/templates/qquickradiobutton.cpp
+++ b/src/templates/qquickradiobutton.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickRadioButton
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief A radio button control.
+ \brief An option button that can be toggled on or off.
RadioButton presents an option button that can be toggled on (checked) or
off (unchecked). Radio buttons are typically used to select one option
diff --git a/src/templates/qquickradiobutton_p.h b/src/templates/qquickradiobutton_p.h
index 7d664864..2b9821aa 100644
--- a/src/templates/qquickradiobutton_p.h
+++ b/src/templates/qquickradiobutton_p.h
@@ -57,13 +57,13 @@ class Q_LABSTEMPLATES_EXPORT QQuickRadioButton : public QQuickAbstractButton
Q_OBJECT
public:
- explicit QQuickRadioButton(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickRadioButton(QQuickItem *parent = nullptr);
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
};
diff --git a/src/templates/qquickrangeslider.cpp b/src/templates/qquickrangeslider.cpp
index 55b5bd8c..1ca4fbed 100644
--- a/src/templates/qquickrangeslider.cpp
+++ b/src/templates/qquickrangeslider.cpp
@@ -87,7 +87,7 @@ public:
isPendingValue(false),
pendingValue(0),
position(0),
- handle(Q_NULLPTR),
+ handle(nullptr),
slider(slider),
pressed(false)
{
@@ -224,35 +224,36 @@ QQuickItem *QQuickRangeSliderNode::handle() const
void QQuickRangeSliderNode::setHandle(QQuickItem *handle)
{
Q_D(QQuickRangeSliderNode);
- if (d->handle != handle) {
- 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();
- if (firstHandle && secondHandle) {
- // The order of property assignments in QML is undefined,
- // but we need the first handle to be before the second due
- // to focus order constraints, so check for that here.
- const QList<QQuickItem *> childItems = d->slider->childItems();
- const int firstIndex = childItems.indexOf(firstHandle);
- const int secondIndex = childItems.indexOf(secondHandle);
- if (firstIndex != -1 && secondIndex != -1 && firstIndex > secondIndex) {
- firstHandle->stackBefore(secondHandle);
- // Ensure we have some way of knowing which handle is above
- // the other when it comes to mouse presses, and also that
- // they are rendered in the correct order.
- secondHandle->setZ(secondHandle->z() + 1);
- }
- }
+ if (d->handle == handle)
+ return;
- handle->setActiveFocusOnTab(true);
+ 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();
+ if (firstHandle && secondHandle) {
+ // The order of property assignments in QML is undefined,
+ // but we need the first handle to be before the second due
+ // to focus order constraints, so check for that here.
+ const QList<QQuickItem *> childItems = d->slider->childItems();
+ const int firstIndex = childItems.indexOf(firstHandle);
+ const int secondIndex = childItems.indexOf(secondHandle);
+ if (firstIndex != -1 && secondIndex != -1 && firstIndex > secondIndex) {
+ firstHandle->stackBefore(secondHandle);
+ // Ensure we have some way of knowing which handle is above
+ // the other when it comes to mouse presses, and also that
+ // they are rendered in the correct order.
+ secondHandle->setZ(secondHandle->z() + 1);
+ }
}
- emit handleChanged();
+
+ handle->setActiveFocusOnTab(true);
}
+ emit handleChanged();
}
bool QQuickRangeSliderNode::isPressed() const
@@ -264,11 +265,12 @@ bool QQuickRangeSliderNode::isPressed() const
void QQuickRangeSliderNode::setPressed(bool pressed)
{
Q_D(QQuickRangeSliderNode);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- d->slider->setAccessibleProperty("pressed", pressed || d->slider->second()->isPressed());
- emit pressedChanged();
- }
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ d->slider->setAccessibleProperty("pressed", pressed || d->slider->second()->isPressed());
+ emit pressedChanged();
}
void QQuickRangeSliderNode::increase()
@@ -297,11 +299,11 @@ public:
from(defaultFrom),
to(defaultTo),
stepSize(0),
- first(Q_NULLPTR),
- second(Q_NULLPTR),
+ first(nullptr),
+ second(nullptr),
orientation(Qt::Horizontal),
snapMode(QQuickRangeSlider::NoSnap),
- track(Q_NULLPTR)
+ track(nullptr)
{
}
@@ -552,10 +554,11 @@ qreal QQuickRangeSlider::stepSize() const
void QQuickRangeSlider::setStepSize(qreal step)
{
Q_D(QQuickRangeSlider);
- if (!qFuzzyCompare(d->stepSize, step)) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
}
/*!
@@ -579,10 +582,11 @@ QQuickRangeSlider::SnapMode QQuickRangeSlider::snapMode() const
void QQuickRangeSlider::setSnapMode(SnapMode mode)
{
Q_D(QQuickRangeSlider);
- if (d->snapMode != mode) {
- d->snapMode = mode;
- emit snapModeChanged();
- }
+ if (d->snapMode == mode)
+ return;
+
+ d->snapMode = mode;
+ emit snapModeChanged();
}
/*!
@@ -603,10 +607,11 @@ Qt::Orientation QQuickRangeSlider::orientation() const
void QQuickRangeSlider::setOrientation(Qt::Orientation orientation)
{
Q_D(QQuickRangeSlider);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
}
/*!
@@ -625,13 +630,14 @@ QQuickItem *QQuickRangeSlider::track() const
void QQuickRangeSlider::setTrack(QQuickItem *track)
{
Q_D(QQuickRangeSlider);
- if (d->track != track) {
- delete d->track;
- d->track = track;
- if (track && !track->parentItem())
- track->setParentItem(this);
- emit trackChanged();
- }
+ if (d->track == track)
+ return;
+
+ delete d->track;
+ d->track = track;
+ if (track && !track->parentItem())
+ track->setParentItem(this);
+ emit trackChanged();
}
/*!
@@ -697,7 +703,7 @@ void QQuickRangeSlider::keyPressEvent(QKeyEvent *event)
QQuickControl::keyPressEvent(event);
QQuickRangeSliderNode *focusNode = d->first->handle()->hasActiveFocus()
- ? d->first : (d->second->handle()->hasActiveFocus() ? d->second : Q_NULLPTR);
+ ? d->first : (d->second->handle()->hasActiveFocus() ? d->second : nullptr);
if (!focusNode)
return;
@@ -748,8 +754,8 @@ void QQuickRangeSlider::mousePressEvent(QMouseEvent *event)
QQuickItem *secondHandle = d->second->handle();
const bool firstHit = firstHandle && firstHandle->contains(mapToItem(firstHandle, d->pressPoint));
const bool secondHit = secondHandle && secondHandle->contains(mapToItem(secondHandle, d->pressPoint));
- QQuickRangeSliderNode *hitNode = Q_NULLPTR;
- QQuickRangeSliderNode *otherNode = Q_NULLPTR;
+ QQuickRangeSliderNode *hitNode = nullptr;
+ QQuickRangeSliderNode *otherNode = nullptr;
if (firstHit && secondHit) {
// choose highest
@@ -807,7 +813,7 @@ void QQuickRangeSlider::mouseMoveEvent(QMouseEvent *event)
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().y() - d->pressPoint.y(), Qt::YAxis, event));
}
if (keepMouseGrab()) {
- QQuickRangeSliderNode *pressedNode = d->first->isPressed() ? d->first : (d->second->isPressed() ? d->second : Q_NULLPTR);
+ QQuickRangeSliderNode *pressedNode = d->first->isPressed() ? d->first : (d->second->isPressed() ? d->second : nullptr);
if (pressedNode) {
qreal pos = positionAt(this, pressedNode->handle(), event->pos());
if (d->snapMode == SnapAlways)
@@ -826,7 +832,7 @@ void QQuickRangeSlider::mouseReleaseEvent(QMouseEvent *event)
if (!keepMouseGrab())
return;
- QQuickRangeSliderNode *pressedNode = d->first->isPressed() ? d->first : (d->second->isPressed() ? d->second : Q_NULLPTR);
+ QQuickRangeSliderNode *pressedNode = d->first->isPressed() ? d->first : (d->second->isPressed() ? d->second : nullptr);
if (!pressedNode)
return;
diff --git a/src/templates/qquickrangeslider_p.h b/src/templates/qquickrangeslider_p.h
index 604666c8..24653b0e 100644
--- a/src/templates/qquickrangeslider_p.h
+++ b/src/templates/qquickrangeslider_p.h
@@ -68,7 +68,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickRangeSlider : public QQuickControl
Q_PROPERTY(QQuickItem *track READ track WRITE setTrack NOTIFY trackChanged FINAL)
public:
- explicit QQuickRangeSlider(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickRangeSlider(QQuickItem *parent = nullptr);
qreal from() const;
void setFrom(qreal from);
@@ -109,17 +109,17 @@ Q_SIGNALS:
void trackChanged();
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void mirrorChange() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void mirrorChange() override;
+ void componentComplete() override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickscrollbar.cpp b/src/templates/qquickscrollbar.cpp
index 86d4e290..a99a409e 100644
--- a/src/templates/qquickscrollbar.cpp
+++ b/src/templates/qquickscrollbar.cpp
@@ -83,7 +83,7 @@ class QQuickScrollBarPrivate : public QQuickControlPrivate
public:
QQuickScrollBarPrivate() : size(0), position(0), offset(0),
active(false), pressed(false), moving(false),
- orientation(Qt::Vertical), handle(Q_NULLPTR)
+ orientation(Qt::Vertical), handle(nullptr)
{
}
@@ -116,7 +116,7 @@ QQuickScrollBarAttached *QQuickScrollBar::qmlAttachedProperties(QObject *object)
return new QQuickScrollBarAttached(flickable);
qWarning() << "ScrollBar must be attached to a Flickable" << object;
- return Q_NULLPTR;
+ return nullptr;
}
/*!
@@ -135,10 +135,11 @@ qreal QQuickScrollBar::size() const
void QQuickScrollBar::setSize(qreal size)
{
Q_D(QQuickScrollBar);
- if (!qFuzzyCompare(d->size, size)) {
- d->size = size;
- emit sizeChanged();
- }
+ if (qFuzzyCompare(d->size, size))
+ return;
+
+ d->size = size;
+ emit sizeChanged();
}
/*!
@@ -157,10 +158,11 @@ qreal QQuickScrollBar::position() const
void QQuickScrollBar::setPosition(qreal position)
{
Q_D(QQuickScrollBar);
- if (!qFuzzyCompare(d->position, position)) {
- d->position = position;
- emit positionChanged();
- }
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ emit positionChanged();
}
/*!
@@ -178,10 +180,11 @@ bool QQuickScrollBar::isActive() const
void QQuickScrollBar::setActive(bool active)
{
Q_D(QQuickScrollBar);
- if (d->active != active) {
- d->active = active;
- emit activeChanged();
- }
+ if (d->active == active)
+ return;
+
+ d->active = active;
+ emit activeChanged();
}
/*!
@@ -198,12 +201,13 @@ bool QQuickScrollBar::isPressed() const
void QQuickScrollBar::setPressed(bool pressed)
{
Q_D(QQuickScrollBar);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- setAccessibleProperty("pressed", pressed);
- setActive(d->pressed || d->moving);
- emit pressedChanged();
- }
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ setAccessibleProperty("pressed", pressed);
+ setActive(d->pressed || d->moving);
+ emit pressedChanged();
}
/*!
@@ -224,10 +228,11 @@ Qt::Orientation QQuickScrollBar::orientation() const
void QQuickScrollBar::setOrientation(Qt::Orientation orientation)
{
Q_D(QQuickScrollBar);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
}
/*!
@@ -246,13 +251,14 @@ QQuickItem *QQuickScrollBar::handle() const
void QQuickScrollBar::setHandle(QQuickItem *handle)
{
Q_D(QQuickScrollBar);
- if (d->handle != handle) {
- delete d->handle;
- d->handle = handle;
- if (handle && !handle->parentItem())
- handle->setParentItem(this);
- emit handleChanged();
- }
+ if (d->handle == handle)
+ return;
+
+ delete d->handle;
+ d->handle = handle;
+ if (handle && !handle->parentItem())
+ handle->setParentItem(this);
+ emit handleChanged();
}
void QQuickScrollBar::mousePressEvent(QMouseEvent *event)
@@ -309,7 +315,7 @@ QAccessible::Role QQuickScrollBar::accessibleRole() const
class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
{
public:
- QQuickScrollBarAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(Q_NULLPTR), vertical(Q_NULLPTR) { }
+ QQuickScrollBarAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(nullptr), vertical(nullptr) { }
void activateHorizontal();
void activateVertical();
@@ -319,7 +325,7 @@ public:
void layoutHorizontal(bool move = true);
void layoutVertical(bool move = true);
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
QQuickFlickable *flickable;
QQuickScrollBar *horizontal;
@@ -436,40 +442,41 @@ QQuickScrollBar *QQuickScrollBarAttached::horizontal() const
void QQuickScrollBarAttached::setHorizontal(QQuickScrollBar *horizontal)
{
Q_D(QQuickScrollBarAttached);
- if (d->horizontal != horizontal) {
- if (d->horizontal) {
- QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- QObjectPrivate::disconnect(d->horizontal, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
- QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- disconnect(area, SIGNAL(widthRatioChanged(qreal)), d->horizontal, SLOT(setSize(qreal)));
- disconnect(area, SIGNAL(xPositionChanged(qreal)), d->horizontal, SLOT(setPosition(qreal)));
- }
-
- d->horizontal = horizontal;
-
- if (horizontal) {
- if (!horizontal->parentItem())
- horizontal->setParentItem(d->flickable);
- horizontal->setOrientation(Qt::Horizontal);
-
- QQuickItemPrivate::get(horizontal)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
- QObjectPrivate::connect(horizontal, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
- QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
- connect(area, SIGNAL(xPositionChanged(qreal)), horizontal, SLOT(setPosition(qreal)));
-
- d->layoutHorizontal();
- horizontal->setSize(area->property("widthRatio").toReal());
- horizontal->setPosition(area->property("xPosition").toReal());
- }
- emit horizontalChanged();
+ if (d->horizontal == horizontal)
+ return;
+
+ if (d->horizontal) {
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ QObjectPrivate::disconnect(d->horizontal, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(widthRatioChanged(qreal)), d->horizontal, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(xPositionChanged(qreal)), d->horizontal, SLOT(setPosition(qreal)));
}
+
+ d->horizontal = horizontal;
+
+ if (horizontal) {
+ if (!horizontal->parentItem())
+ horizontal->setParentItem(d->flickable);
+ horizontal->setOrientation(Qt::Horizontal);
+
+ QQuickItemPrivate::get(horizontal)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ QObjectPrivate::connect(horizontal, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(xPositionChanged(qreal)), horizontal, SLOT(setPosition(qreal)));
+
+ d->layoutHorizontal();
+ horizontal->setSize(area->property("widthRatio").toReal());
+ horizontal->setPosition(area->property("xPosition").toReal());
+ }
+ emit horizontalChanged();
}
/*!
@@ -493,40 +500,41 @@ QQuickScrollBar *QQuickScrollBarAttached::vertical() const
void QQuickScrollBarAttached::setVertical(QQuickScrollBar *vertical)
{
Q_D(QQuickScrollBarAttached);
- if (d->vertical != vertical) {
- if (d->vertical) {
- QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- QObjectPrivate::disconnect(d->vertical, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
- QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- disconnect(area, SIGNAL(heightRatioChanged(qreal)), d->vertical, SLOT(setSize(qreal)));
- disconnect(area, SIGNAL(yPositionChanged(qreal)), d->vertical, SLOT(setPosition(qreal)));
- }
-
- d->vertical = vertical;
-
- if (vertical) {
- if (!vertical->parentItem())
- vertical->setParentItem(d->flickable);
- vertical->setOrientation(Qt::Vertical);
-
- QQuickItemPrivate::get(vertical)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
- QObjectPrivate::connect(vertical, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
- QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
- connect(area, SIGNAL(yPositionChanged(qreal)), vertical, SLOT(setPosition(qreal)));
-
- d->layoutVertical();
- vertical->setSize(area->property("heightRatio").toReal());
- vertical->setPosition(area->property("yPosition").toReal());
- }
- emit verticalChanged();
+ if (d->vertical == vertical)
+ return;
+
+ if (d->vertical) {
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ QObjectPrivate::disconnect(d->vertical, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(heightRatioChanged(qreal)), d->vertical, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(yPositionChanged(qreal)), d->vertical, SLOT(setPosition(qreal)));
+ }
+
+ d->vertical = vertical;
+
+ if (vertical) {
+ if (!vertical->parentItem())
+ vertical->setParentItem(d->flickable);
+ vertical->setOrientation(Qt::Vertical);
+
+ QQuickItemPrivate::get(vertical)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ QObjectPrivate::connect(vertical, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(yPositionChanged(qreal)), vertical, SLOT(setPosition(qreal)));
+
+ d->layoutVertical();
+ vertical->setSize(area->property("heightRatio").toReal());
+ vertical->setPosition(area->property("yPosition").toReal());
}
+ emit verticalChanged();
}
QT_END_NAMESPACE
diff --git a/src/templates/qquickscrollbar_p.h b/src/templates/qquickscrollbar_p.h
index b944f92a..6eb8b798 100644
--- a/src/templates/qquickscrollbar_p.h
+++ b/src/templates/qquickscrollbar_p.h
@@ -67,7 +67,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickScrollBar : public QQuickControl
Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
public:
- explicit QQuickScrollBar(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickScrollBar(QQuickItem *parent = nullptr);
static QQuickScrollBarAttached *qmlAttachedProperties(QObject *object);
@@ -99,15 +99,15 @@ Q_SIGNALS:
void handleChanged();
protected:
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
virtual qreal positionAt(const QPoint &point) const;
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickscrollindicator.cpp b/src/templates/qquickscrollindicator.cpp
index 4dc04141..2aba3c89 100644
--- a/src/templates/qquickscrollindicator.cpp
+++ b/src/templates/qquickscrollindicator.cpp
@@ -82,7 +82,7 @@ class QQuickScrollIndicatorPrivate : public QQuickControlPrivate
{
public:
QQuickScrollIndicatorPrivate() : size(0), position(0),
- active(false), orientation(Qt::Vertical), indicator(Q_NULLPTR)
+ active(false), orientation(Qt::Vertical), indicator(nullptr)
{
}
@@ -105,7 +105,7 @@ QQuickScrollIndicatorAttached *QQuickScrollIndicator::qmlAttachedProperties(QObj
return new QQuickScrollIndicatorAttached(flickable);
qWarning() << "ScrollIndicator must be attached to a Flickable" << object;
- return Q_NULLPTR;
+ return nullptr;
}
/*!
@@ -124,10 +124,11 @@ qreal QQuickScrollIndicator::size() const
void QQuickScrollIndicator::setSize(qreal size)
{
Q_D(QQuickScrollIndicator);
- if (!qFuzzyCompare(d->size, size)) {
- d->size = size;
- emit sizeChanged();
- }
+ if (qFuzzyCompare(d->size, size))
+ return;
+
+ d->size = size;
+ emit sizeChanged();
}
/*!
@@ -146,10 +147,11 @@ qreal QQuickScrollIndicator::position() const
void QQuickScrollIndicator::setPosition(qreal position)
{
Q_D(QQuickScrollIndicator);
- if (!qFuzzyCompare(d->position, position)) {
- d->position = position;
- emit positionChanged();
- }
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ emit positionChanged();
}
/*!
@@ -167,10 +169,11 @@ bool QQuickScrollIndicator::isActive() const
void QQuickScrollIndicator::setActive(bool active)
{
Q_D(QQuickScrollIndicator);
- if (d->active != active) {
- d->active = active;
- emit activeChanged();
- }
+ if (d->active == active)
+ return;
+
+ d->active = active;
+ emit activeChanged();
}
/*!
@@ -191,10 +194,11 @@ Qt::Orientation QQuickScrollIndicator::orientation() const
void QQuickScrollIndicator::setOrientation(Qt::Orientation orientation)
{
Q_D(QQuickScrollIndicator);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
}
/*!
@@ -213,19 +217,20 @@ QQuickItem *QQuickScrollIndicator::indicator() const
void QQuickScrollIndicator::setIndicator(QQuickItem *indicator)
{
Q_D(QQuickScrollIndicator);
- if (d->indicator != indicator) {
- delete d->indicator;
- d->indicator = indicator;
- if (indicator && !indicator->parentItem())
- indicator->setParentItem(this);
- emit indicatorChanged();
- }
+ if (d->indicator == indicator)
+ return;
+
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator && !indicator->parentItem())
+ indicator->setParentItem(this);
+ emit indicatorChanged();
}
class QQuickScrollIndicatorAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
{
public:
- QQuickScrollIndicatorAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(Q_NULLPTR), vertical(Q_NULLPTR) { }
+ QQuickScrollIndicatorAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(nullptr), vertical(nullptr) { }
void activateHorizontal();
void activateVertical();
@@ -233,7 +238,7 @@ public:
void layoutHorizontal(bool move = true);
void layoutVertical(bool move = true);
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
QQuickFlickable *flickable;
QQuickScrollIndicator *horizontal;
@@ -318,38 +323,39 @@ QQuickScrollIndicator *QQuickScrollIndicatorAttached::horizontal() const
void QQuickScrollIndicatorAttached::setHorizontal(QQuickScrollIndicator *horizontal)
{
Q_D(QQuickScrollIndicatorAttached);
- if (d->horizontal != horizontal) {
- if (d->horizontal) {
- QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- disconnect(area, SIGNAL(widthRatioChanged(qreal)), d->horizontal, SLOT(setSize(qreal)));
- disconnect(area, SIGNAL(xPositionChanged(qreal)), d->horizontal, SLOT(setPosition(qreal)));
- }
-
- d->horizontal = horizontal;
-
- if (horizontal) {
- if (!horizontal->parentItem())
- horizontal->setParentItem(d->flickable);
- horizontal->setOrientation(Qt::Horizontal);
-
- QQuickItemPrivate::get(horizontal)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
- QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
- connect(area, SIGNAL(xPositionChanged(qreal)), horizontal, SLOT(setPosition(qreal)));
-
- d->layoutHorizontal();
- horizontal->setSize(area->property("widthRatio").toReal());
- horizontal->setPosition(area->property("xPosition").toReal());
- }
- emit horizontalChanged();
+ if (d->horizontal == horizontal)
+ return;
+
+ if (d->horizontal) {
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(widthRatioChanged(qreal)), d->horizontal, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(xPositionChanged(qreal)), d->horizontal, SLOT(setPosition(qreal)));
}
+
+ d->horizontal = horizontal;
+
+ if (horizontal) {
+ if (!horizontal->parentItem())
+ horizontal->setParentItem(d->flickable);
+ horizontal->setOrientation(Qt::Horizontal);
+
+ QQuickItemPrivate::get(horizontal)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(widthRatioChanged(qreal)), horizontal, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(xPositionChanged(qreal)), horizontal, SLOT(setPosition(qreal)));
+
+ d->layoutHorizontal();
+ horizontal->setSize(area->property("widthRatio").toReal());
+ horizontal->setPosition(area->property("xPosition").toReal());
+ }
+ emit horizontalChanged();
}
/*!
@@ -373,38 +379,39 @@ QQuickScrollIndicator *QQuickScrollIndicatorAttached::vertical() const
void QQuickScrollIndicatorAttached::setVertical(QQuickScrollIndicator *vertical)
{
Q_D(QQuickScrollIndicatorAttached);
- if (d->vertical != vertical) {
- if (d->vertical) {
- QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- disconnect(area, SIGNAL(heightRatioChanged(qreal)), d->vertical, SLOT(setSize(qreal)));
- disconnect(area, SIGNAL(yPositionChanged(qreal)), d->vertical, SLOT(setPosition(qreal)));
- }
-
- d->vertical = vertical;
-
- if (vertical) {
- if (!vertical->parentItem())
- vertical->setParentItem(d->flickable);
- vertical->setOrientation(Qt::Vertical);
-
- QQuickItemPrivate::get(vertical)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
- QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
-
- // TODO: export QQuickFlickableVisibleArea
- QObject *area = d->flickable->property("visibleArea").value<QObject *>();
- connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
- connect(area, SIGNAL(yPositionChanged(qreal)), vertical, SLOT(setPosition(qreal)));
-
- d->layoutVertical();
- vertical->setSize(area->property("heightRatio").toReal());
- vertical->setPosition(area->property("yPosition").toReal());
- }
- emit verticalChanged();
+ if (d->vertical == vertical)
+ return;
+
+ if (d->vertical) {
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ disconnect(area, SIGNAL(heightRatioChanged(qreal)), d->vertical, SLOT(setSize(qreal)));
+ disconnect(area, SIGNAL(yPositionChanged(qreal)), d->vertical, SLOT(setPosition(qreal)));
+ }
+
+ d->vertical = vertical;
+
+ if (vertical) {
+ if (!vertical->parentItem())
+ vertical->setParentItem(d->flickable);
+ vertical->setOrientation(Qt::Vertical);
+
+ QQuickItemPrivate::get(vertical)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
+
+ // TODO: export QQuickFlickableVisibleArea
+ QObject *area = d->flickable->property("visibleArea").value<QObject *>();
+ connect(area, SIGNAL(heightRatioChanged(qreal)), vertical, SLOT(setSize(qreal)));
+ connect(area, SIGNAL(yPositionChanged(qreal)), vertical, SLOT(setPosition(qreal)));
+
+ d->layoutVertical();
+ vertical->setSize(area->property("heightRatio").toReal());
+ vertical->setPosition(area->property("yPosition").toReal());
}
+ emit verticalChanged();
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/templates/qquickscrollindicator_p.h b/src/templates/qquickscrollindicator_p.h
index 1f5f07b7..15002700 100644
--- a/src/templates/qquickscrollindicator_p.h
+++ b/src/templates/qquickscrollindicator_p.h
@@ -66,7 +66,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickScrollIndicator : public QQuickControl
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
public:
- explicit QQuickScrollIndicator(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickScrollIndicator(QQuickItem *parent = nullptr);
static QQuickScrollIndicatorAttached *qmlAttachedProperties(QObject *object);
@@ -95,7 +95,7 @@ Q_SIGNALS:
protected:
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickslider.cpp b/src/templates/qquickslider.cpp
index fac8fb50..261c1577 100644
--- a/src/templates/qquickslider.cpp
+++ b/src/templates/qquickslider.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickSlider
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-input
- \brief A slider control.
+ \brief Selects a value by sliding a handle along a track.
\image qtlabscontrols-slider.gif
@@ -80,7 +80,7 @@ class QQuickSliderPrivate : public QQuickControlPrivate
public:
QQuickSliderPrivate() : from(0), to(1), value(0), position(0), stepSize(0), pressed(false),
orientation(Qt::Horizontal), snapMode(QQuickSlider::NoSnap),
- handle(Q_NULLPTR), track(Q_NULLPTR)
+ handle(nullptr), track(nullptr)
{
}
@@ -147,11 +147,12 @@ void QQuickSliderPrivate::setPosition(qreal pos)
{
Q_Q(QQuickSlider);
pos = qBound<qreal>(0.0, pos, 1.0);
- if (!qFuzzyCompare(position, pos)) {
- position = pos;
- emit q->positionChanged();
- emit q->visualPositionChanged();
- }
+ if (qFuzzyCompare(position, pos))
+ return;
+
+ position = pos;
+ emit q->positionChanged();
+ emit q->visualPositionChanged();
}
void QQuickSliderPrivate::updatePosition()
@@ -185,13 +186,14 @@ qreal QQuickSlider::from() const
void QQuickSlider::setFrom(qreal from)
{
Q_D(QQuickSlider);
- if (!qFuzzyCompare(d->from, from)) {
- d->from = from;
- emit fromChanged();
- if (isComponentComplete()) {
- setValue(d->value);
- d->updatePosition();
- }
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
}
}
@@ -211,13 +213,14 @@ qreal QQuickSlider::to() const
void QQuickSlider::setTo(qreal to)
{
Q_D(QQuickSlider);
- if (!qFuzzyCompare(d->to, to)) {
- d->to = to;
- emit toChanged();
- if (isComponentComplete()) {
- setValue(d->value);
- d->updatePosition();
- }
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
}
}
@@ -244,11 +247,12 @@ void QQuickSlider::setValue(qreal value)
if (isComponentComplete())
value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
- if (!qFuzzyCompare(d->value, value)) {
- d->value = value;
- d->updatePosition();
- emit valueChanged();
- }
+ if (qFuzzyCompare(d->value, value))
+ return;
+
+ d->value = value;
+ d->updatePosition();
+ emit valueChanged();
}
/*!
@@ -307,10 +311,11 @@ qreal QQuickSlider::stepSize() const
void QQuickSlider::setStepSize(qreal step)
{
Q_D(QQuickSlider);
- if (!qFuzzyCompare(d->stepSize, step)) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
}
/*!
@@ -334,10 +339,11 @@ QQuickSlider::SnapMode QQuickSlider::snapMode() const
void QQuickSlider::setSnapMode(SnapMode mode)
{
Q_D(QQuickSlider);
- if (d->snapMode != mode) {
- d->snapMode = mode;
- emit snapModeChanged();
- }
+ if (d->snapMode == mode)
+ return;
+
+ d->snapMode = mode;
+ emit snapModeChanged();
}
/*!
@@ -354,11 +360,12 @@ bool QQuickSlider::isPressed() const
void QQuickSlider::setPressed(bool pressed)
{
Q_D(QQuickSlider);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- setAccessibleProperty("pressed", pressed);
- emit pressedChanged();
- }
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ setAccessibleProperty("pressed", pressed);
+ emit pressedChanged();
}
/*!
@@ -379,10 +386,11 @@ Qt::Orientation QQuickSlider::orientation() const
void QQuickSlider::setOrientation(Qt::Orientation orientation)
{
Q_D(QQuickSlider);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
}
/*!
@@ -401,13 +409,14 @@ QQuickItem *QQuickSlider::handle() const
void QQuickSlider::setHandle(QQuickItem *handle)
{
Q_D(QQuickSlider);
- if (d->handle != handle) {
- delete d->handle;
- d->handle = handle;
- if (handle && !handle->parentItem())
- handle->setParentItem(this);
- emit handleChanged();
- }
+ if (d->handle == handle)
+ return;
+
+ delete d->handle;
+ d->handle = handle;
+ if (handle && !handle->parentItem())
+ handle->setParentItem(this);
+ emit handleChanged();
}
/*!
@@ -426,13 +435,14 @@ QQuickItem *QQuickSlider::track() const
void QQuickSlider::setTrack(QQuickItem *track)
{
Q_D(QQuickSlider);
- if (d->track != track) {
- delete d->track;
- d->track = track;
- if (track && !track->parentItem())
- track->setParentItem(this);
- emit trackChanged();
- }
+ if (d->track == track)
+ return;
+
+ delete d->track;
+ d->track = track;
+ if (track && !track->parentItem())
+ track->setParentItem(this);
+ emit trackChanged();
}
/*!
diff --git a/src/templates/qquickslider_p.h b/src/templates/qquickslider_p.h
index 663ad684..b348baa9 100644
--- a/src/templates/qquickslider_p.h
+++ b/src/templates/qquickslider_p.h
@@ -70,7 +70,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickSlider : public QQuickControl
Q_PROPERTY(QQuickItem *track READ track WRITE setTrack NOTIFY trackChanged FINAL)
public:
- explicit QQuickSlider(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickSlider(QQuickItem *parent = nullptr);
qreal from() const;
void setFrom(qreal from);
@@ -127,18 +127,18 @@ Q_SIGNALS:
void trackChanged();
protected:
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void mirrorChange() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void mirrorChange() override;
+ void componentComplete() override;
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickspinbox.cpp b/src/templates/qquickspinbox.cpp
index 255715e1..a0c94101 100644
--- a/src/templates/qquickspinbox.cpp
+++ b/src/templates/qquickspinbox.cpp
@@ -56,7 +56,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
\instantiates QQuickSpinBox
\inqmlmodule Qt.labs.controls
\ingroup input
- \brief A spinbox control.
+ \brief A spinbox control that allows the user from a set of preset values.
\image qtlabscontrols-spinbox.png
@@ -91,7 +91,7 @@ class QQuickSpinBoxPrivate : public QQuickControlPrivate
public:
QQuickSpinBoxPrivate() : from(0), to(99), value(0), stepSize(1),
- delayTimer(0), repeatTimer(0), up(Q_NULLPTR), down(Q_NULLPTR), validator(Q_NULLPTR) { }
+ delayTimer(0), repeatTimer(0), up(nullptr), down(nullptr), validator(nullptr) { }
int boundValue(int value) const;
void updateValue();
@@ -260,12 +260,13 @@ int QQuickSpinBox::from() const
void QQuickSpinBox::setFrom(int from)
{
Q_D(QQuickSpinBox);
- if (d->from != from) {
- d->from = from;
- emit fromChanged();
- if (isComponentComplete())
- setValue(d->value);
- }
+ if (d->from == from)
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ if (isComponentComplete())
+ setValue(d->value);
}
/*!
@@ -284,12 +285,13 @@ int QQuickSpinBox::to() const
void QQuickSpinBox::setTo(int to)
{
Q_D(QQuickSpinBox);
- if (d->to != to) {
- d->to = to;
- emit toChanged();
- if (isComponentComplete())
- setValue(d->value);
- }
+ if (d->to == to)
+ return;
+
+ d->to = to;
+ emit toChanged();
+ if (isComponentComplete())
+ setValue(d->value);
}
/*!
@@ -309,10 +311,11 @@ void QQuickSpinBox::setValue(int value)
if (isComponentComplete())
value = d->boundValue(value);
- if (d->value != value) {
- d->value = value;
- emit valueChanged();
- }
+ if (d->value == value)
+ return;
+
+ d->value = value;
+ emit valueChanged();
}
/*!
@@ -331,10 +334,11 @@ int QQuickSpinBox::stepSize() const
void QQuickSpinBox::setStepSize(int step)
{
Q_D(QQuickSpinBox);
- if (d->stepSize != step) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
+ if (d->stepSize == step)
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
}
/*!
@@ -356,10 +360,11 @@ QValidator *QQuickSpinBox::validator() const
void QQuickSpinBox::setValidator(QValidator *validator)
{
Q_D(QQuickSpinBox);
- if (d->validator != validator) {
- d->validator = validator;
- emit validatorChanged();
- }
+ if (d->validator == validator)
+ return;
+
+ d->validator = validator;
+ emit validatorChanged();
}
/*!
@@ -622,7 +627,7 @@ QAccessible::Role QQuickSpinBox::accessibleRole() const
class QQuickSpinButtonPrivate : public QObjectPrivate
{
public:
- QQuickSpinButtonPrivate() : pressed(false), indicator(Q_NULLPTR) { }
+ QQuickSpinButtonPrivate() : pressed(false), indicator(nullptr) { }
bool pressed;
QQuickItem *indicator;
};
@@ -641,10 +646,11 @@ bool QQuickSpinButton::isPressed() const
void QQuickSpinButton::setPressed(bool pressed)
{
Q_D(QQuickSpinButton);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- emit pressedChanged();
- }
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ emit pressedChanged();
}
QQuickItem *QQuickSpinButton::indicator() const
@@ -656,16 +662,17 @@ QQuickItem *QQuickSpinButton::indicator() const
void QQuickSpinButton::setIndicator(QQuickItem *indicator)
{
Q_D(QQuickSpinButton);
- if (d->indicator != indicator) {
- delete d->indicator;
- d->indicator = indicator;
- if (indicator) {
- if (!indicator->parentItem())
- indicator->setParentItem(static_cast<QQuickItem *>(parent()));
- indicator->setAcceptedMouseButtons(Qt::LeftButton);
- }
- emit indicatorChanged();
+ if (d->indicator == indicator)
+ return;
+
+ delete d->indicator;
+ d->indicator = indicator;
+ if (indicator) {
+ if (!indicator->parentItem())
+ indicator->setParentItem(static_cast<QQuickItem *>(parent()));
+ indicator->setAcceptedMouseButtons(Qt::LeftButton);
}
+ emit indicatorChanged();
}
QT_END_NAMESPACE
diff --git a/src/templates/qquickspinbox_p.h b/src/templates/qquickspinbox_p.h
index c7d1f6c6..831c73c2 100644
--- a/src/templates/qquickspinbox_p.h
+++ b/src/templates/qquickspinbox_p.h
@@ -72,7 +72,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickSpinBox : public QQuickControl
Q_PROPERTY(QQuickSpinButton *down READ down CONSTANT FINAL)
public:
- explicit QQuickSpinBox(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickSpinBox(QQuickItem *parent = nullptr);
int from() const;
void setFrom(int from);
@@ -112,20 +112,20 @@ Q_SIGNALS:
void valueFromTextChanged();
protected:
- bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
-
- void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
+ void keyPressEvent(QKeyEvent *event) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void mouseUngrabEvent() override;
+ void timerEvent(QTimerEvent *event) override;
+
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp
index bfa01e72..70194257 100644
--- a/src/templates/qquickstackview.cpp
+++ b/src/templates/qquickstackview.cpp
@@ -278,7 +278,7 @@ QQuickStackView::~QQuickStackView()
{
Q_D(QQuickStackView);
if (d->transitioner) {
- d->transitioner->setChangeListener(Q_NULLPTR);
+ d->transitioner->setChangeListener(nullptr);
delete d->transitioner;
}
qDeleteAll(d->removals);
@@ -290,7 +290,7 @@ QQuickStackAttached *QQuickStackView::qmlAttachedProperties(QObject *object)
QQuickItem *item = qobject_cast<QQuickItem *>(object);
if (!item) {
qmlInfo(object) << "StackView must be attached to an Item";
- return Q_NULLPTR;
+ return nullptr;
}
return new QQuickStackAttached(item);
}
@@ -347,7 +347,7 @@ QQuickItem *QQuickStackView::get(int index, LoadBehavior behavior)
element->load(this);
return element->item;
}
- return Q_NULLPTR;
+ return nullptr;
}
/*!
@@ -373,7 +373,7 @@ QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavio
QJSValue func(callback);
QQmlEngine *engine = qmlEngine(this);
if (!engine || !func.isCallable()) // TODO: warning?
- return Q_NULLPTR;
+ return nullptr;
for (int i = d->elements.count() - 1; i >= 0; --i) {
QQuickStackElement *element = d->elements.at(i);
@@ -386,7 +386,7 @@ QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavio
}
}
- return Q_NULLPTR;
+ return nullptr;
}
/*!
@@ -457,7 +457,7 @@ void QQuickStackView::push(QQmlV4Function *args)
return;
}
- QQuickStackElement *exit = Q_NULLPTR;
+ QQuickStackElement *exit = nullptr;
if (!d->elements.isEmpty())
exit = d->elements.top();
@@ -541,7 +541,7 @@ void QQuickStackView::pop(QQmlV4Function *args)
operation = static_cast<Operation>(lastArg->toInt32());
}
- QQuickItem *previousItem = Q_NULLPTR;
+ QQuickItem *previousItem = nullptr;
if (d->popElements(enter)) {
if (exit)
@@ -624,7 +624,7 @@ void QQuickStackView::replace(QQmlV4Function *args)
if (lastArg->isInt32())
operation = static_cast<Operation>(lastArg->toInt32());
- QQuickStackElement *target = Q_NULLPTR;
+ QQuickStackElement *target = nullptr;
QV4::ScopedValue firstArg(scope, (*args)[0]);
if (firstArg->isNull())
target = d->elements.value(0);
@@ -639,7 +639,7 @@ void QQuickStackView::replace(QQmlV4Function *args)
}
int depth = d->elements.count();
- QQuickStackElement* exit = Q_NULLPTR;
+ QQuickStackElement* exit = nullptr;
if (!d->elements.isEmpty())
exit = d->elements.pop();
@@ -667,7 +667,7 @@ void QQuickStackView::replace(QQmlV4Function *args)
void QQuickStackView::clear()
{
Q_D(QQuickStackView);
- d->setCurrentItem(Q_NULLPTR);
+ d->setCurrentItem(nullptr);
qDeleteAll(d->elements);
d->elements.clear();
emit depthChanged();
@@ -710,17 +710,18 @@ QQuickTransition *QQuickStackView::popEnter() const
Q_D(const QQuickStackView);
if (d->transitioner)
return d->transitioner->removeDisplacedTransition;
- return Q_NULLPTR;
+ return nullptr;
}
void QQuickStackView::setPopEnter(QQuickTransition *enter)
{
Q_D(QQuickStackView);
d->ensureTransitioner();
- if (d->transitioner->removeDisplacedTransition != enter) {
- d->transitioner->removeDisplacedTransition = enter;
- emit popEnterChanged();
- }
+ if (d->transitioner->removeDisplacedTransition == enter)
+ return;
+
+ d->transitioner->removeDisplacedTransition = enter;
+ emit popEnterChanged();
}
/*!
@@ -736,17 +737,18 @@ QQuickTransition *QQuickStackView::popExit() const
Q_D(const QQuickStackView);
if (d->transitioner)
return d->transitioner->removeTransition;
- return Q_NULLPTR;
+ return nullptr;
}
void QQuickStackView::setPopExit(QQuickTransition *exit)
{
Q_D(QQuickStackView);
d->ensureTransitioner();
- if (d->transitioner->removeTransition != exit) {
- d->transitioner->removeTransition = exit;
- emit popExitChanged();
- }
+ if (d->transitioner->removeTransition == exit)
+ return;
+
+ d->transitioner->removeTransition = exit;
+ emit popExitChanged();
}
/*!
@@ -762,17 +764,18 @@ QQuickTransition *QQuickStackView::pushEnter() const
Q_D(const QQuickStackView);
if (d->transitioner)
return d->transitioner->addTransition;
- return Q_NULLPTR;
+ return nullptr;
}
void QQuickStackView::setPushEnter(QQuickTransition *enter)
{
Q_D(QQuickStackView);
d->ensureTransitioner();
- if (d->transitioner->addTransition != enter) {
- d->transitioner->addTransition = enter;
- emit pushEnterChanged();
- }
+ if (d->transitioner->addTransition == enter)
+ return;
+
+ d->transitioner->addTransition = enter;
+ emit pushEnterChanged();
}
/*!
@@ -788,17 +791,18 @@ QQuickTransition *QQuickStackView::pushExit() const
Q_D(const QQuickStackView);
if (d->transitioner)
return d->transitioner->addDisplacedTransition;
- return Q_NULLPTR;
+ return nullptr;
}
void QQuickStackView::setPushExit(QQuickTransition *exit)
{
Q_D(QQuickStackView);
d->ensureTransitioner();
- if (d->transitioner->addDisplacedTransition != exit) {
- d->transitioner->addDisplacedTransition = exit;
- emit pushExitChanged();
- }
+ if (d->transitioner->addDisplacedTransition == exit)
+ return;
+
+ d->transitioner->addDisplacedTransition = exit;
+ emit pushExitChanged();
}
/*!
@@ -814,17 +818,18 @@ QQuickTransition *QQuickStackView::replaceEnter() const
Q_D(const QQuickStackView);
if (d->transitioner)
return d->transitioner->moveTransition;
- return Q_NULLPTR;
+ return nullptr;
}
void QQuickStackView::setReplaceEnter(QQuickTransition *enter)
{
Q_D(QQuickStackView);
d->ensureTransitioner();
- if (d->transitioner->moveTransition != enter) {
- d->transitioner->moveTransition = enter;
- emit replaceEnterChanged();
- }
+ if (d->transitioner->moveTransition == enter)
+ return;
+
+ d->transitioner->moveTransition = enter;
+ emit replaceEnterChanged();
}
/*!
@@ -840,17 +845,18 @@ QQuickTransition *QQuickStackView::replaceExit() const
Q_D(const QQuickStackView);
if (d->transitioner)
return d->transitioner->moveDisplacedTransition;
- return Q_NULLPTR;
+ return nullptr;
}
void QQuickStackView::setReplaceExit(QQuickTransition *exit)
{
Q_D(QQuickStackView);
d->ensureTransitioner();
- if (d->transitioner->moveDisplacedTransition != exit) {
- d->transitioner->moveDisplacedTransition = exit;
- emit replaceExitChanged();
- }
+ if (d->transitioner->moveDisplacedTransition == exit)
+ return;
+
+ d->transitioner->moveDisplacedTransition = exit;
+ emit replaceExitChanged();
}
void QQuickStackView::componentComplete()
@@ -858,7 +864,7 @@ void QQuickStackView::componentComplete()
QQuickControl::componentComplete();
Q_D(QQuickStackView);
- QQuickStackElement *element = Q_NULLPTR;
+ QQuickStackElement *element = nullptr;
if (QObject *o = d->initialItem.value<QObject *>())
element = QQuickStackElement::fromObject(o, this);
else if (d->initialItem.canConvert<QString>())
@@ -875,7 +881,7 @@ void QQuickStackView::geometryChanged(const QRectF &newGeometry, const QRectF &o
QQuickControl::geometryChanged(newGeometry, oldGeometry);
Q_D(QQuickStackView);
- foreach (QQuickStackElement *element, d->elements) {
+ for (QQuickStackElement *element : qAsConst(d->elements)) {
if (element->item) {
if (!element->widthValid)
element->item->setWidth(newGeometry.width());
@@ -903,11 +909,11 @@ void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem
{
Q_Q(QQuickStackAttached);
int oldIndex = element ? element->index : -1;
- QQuickStackView *oldView = element ? element->view : Q_NULLPTR;
+ QQuickStackView *oldView = element ? element->view : nullptr;
QQuickStackView::Status oldStatus = element ? element->status : QQuickStackView::Inactive;
QQuickStackView *newView = qobject_cast<QQuickStackView *>(parent);
- element = newView ? QQuickStackViewPrivate::get(newView)->findElement(item) : Q_NULLPTR;
+ element = newView ? QQuickStackViewPrivate::get(newView)->findElement(item) : nullptr;
int newIndex = element ? element->index : -1;
QQuickStackView::Status newStatus = element ? element->status : QQuickStackView::Inactive;
@@ -958,7 +964,7 @@ int QQuickStackAttached::index() const
QQuickStackView *QQuickStackAttached::view() const
{
Q_D(const QQuickStackAttached);
- return d->element ? d->element->view : Q_NULLPTR;
+ return d->element ? d->element->view : nullptr;
}
/*!
diff --git a/src/templates/qquickstackview_p.cpp b/src/templates/qquickstackview_p.cpp
index 101f1f68..f03ff7fc 100644
--- a/src/templates/qquickstackview_p.cpp
+++ b/src/templates/qquickstackview_p.cpp
@@ -63,15 +63,15 @@ public:
QQuickStackIncubator(QQuickStackElement *element) : QQmlIncubator(Synchronous), element(element) { }
protected:
- void setInitialState(QObject *object) Q_DECL_OVERRIDE { element->incubate(object); }
+ void setInitialState(QObject *object) override { element->incubate(object); }
private:
QQuickStackElement *element;
};
-QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(Q_NULLPTR),
+QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(nullptr),
index(-1), init(false), removal(false), ownItem(false), ownComponent(false), widthValid(false), heightValid(false),
- context(Q_NULLPTR), component(Q_NULLPTR), incubator(Q_NULLPTR), view(Q_NULLPTR),
+ context(nullptr), component(nullptr), incubator(nullptr), view(nullptr),
status(QQuickStackView::Inactive)
{
}
@@ -86,9 +86,9 @@ QQuickStackElement::~QQuickStackElement()
if (item) {
if (ownItem) {
- item->setParentItem(Q_NULLPTR);
+ item->setParentItem(nullptr);
item->deleteLater();
- item = Q_NULLPTR;
+ item = nullptr;
} else {
item->setVisible(false);
if (item->parentItem() != originalParent) {
@@ -96,7 +96,7 @@ QQuickStackElement::~QQuickStackElement()
} else {
QQuickStackAttached *attached = attachedStackObject(this);
if (attached)
- QQuickStackAttachedPrivate::get(attached)->itemParentChanged(item, Q_NULLPTR);
+ QQuickStackAttachedPrivate::get(attached)->itemParentChanged(item, nullptr);
}
}
}
@@ -188,32 +188,35 @@ void QQuickStackElement::initialize()
void QQuickStackElement::setIndex(int value)
{
- if (index != value) {
- index = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->indexChanged();
- }
+ if (index == value)
+ return;
+
+ index = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->indexChanged();
}
void QQuickStackElement::setView(QQuickStackView *value)
{
- if (view != value) {
- view = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->viewChanged();
- }
+ if (view == value)
+ return;
+
+ view = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->viewChanged();
}
void QQuickStackElement::setStatus(QQuickStackView::Status value)
{
- if (status != value) {
- status = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->statusChanged();
- }
+ if (status == value)
+ return;
+
+ status = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->statusChanged();
}
void QQuickStackElement::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget)
@@ -249,22 +252,23 @@ void QQuickStackElement::startTransition(QQuickItemViewTransitioner *transitione
void QQuickStackElement::itemDestroyed(QQuickItem *)
{
- item = Q_NULLPTR;
+ item = nullptr;
}
-QQuickStackViewPrivate::QQuickStackViewPrivate() : busy(false), currentItem(Q_NULLPTR), transitioner(Q_NULLPTR)
+QQuickStackViewPrivate::QQuickStackViewPrivate() : busy(false), currentItem(nullptr), transitioner(nullptr)
{
}
void QQuickStackViewPrivate::setCurrentItem(QQuickItem *item)
{
Q_Q(QQuickStackView);
- if (currentItem != item) {
- currentItem = item;
- if (item)
- item->setVisible(true);
- emit q->currentItemChanged();
- }
+ if (currentItem == item)
+ return;
+
+ currentItem = item;
+ if (item)
+ item->setVisible(true);
+ emit q->currentItemChanged();
}
static bool initProperties(QQuickStackElement *element, const QV4::Value &props, QQmlV4Function *args)
@@ -322,19 +326,19 @@ QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function
QQuickStackElement *QQuickStackViewPrivate::findElement(QQuickItem *item) const
{
if (item) {
- foreach (QQuickStackElement *e, elements) {
+ for (QQuickStackElement *e : qAsConst(elements)) {
if (e->item == item)
return e;
}
}
- return Q_NULLPTR;
+ return nullptr;
}
QQuickStackElement *QQuickStackViewPrivate::findElement(const QV4::Value &value) const
{
if (const QV4::QObjectWrapper *o = value.as<QV4::QObjectWrapper>())
return findElement(qobject_cast<QQuickItem *>(o->object()));
- return Q_NULLPTR;
+ return nullptr;
}
QQuickStackElement *QQuickStackViewPrivate::createElement(const QV4::Value &value)
@@ -344,14 +348,14 @@ QQuickStackElement *QQuickStackViewPrivate::createElement(const QV4::Value &valu
return QQuickStackElement::fromString(s->toQString(), q);
if (const QV4::QObjectWrapper *o = value.as<QV4::QObjectWrapper>())
return QQuickStackElement::fromObject(o->object(), q);
- return Q_NULLPTR;
+ return nullptr;
}
bool QQuickStackViewPrivate::pushElements(const QList<QQuickStackElement *> &elems)
{
Q_Q(QQuickStackView);
if (!elems.isEmpty()) {
- foreach (QQuickStackElement *e, elems) {
+ for (QQuickStackElement *e : elems) {
e->setIndex(elements.count());
elements += e;
}
@@ -536,11 +540,12 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
void QQuickStackViewPrivate::setBusy(bool b)
{
Q_Q(QQuickStackView);
- if (busy != b) {
- busy = b;
- q->setFiltersChildMouseEvents(busy);
- emit q->busyChanged();
- }
+ if (busy == b)
+ return;
+
+ busy = b;
+ q->setFiltersChildMouseEvents(busy);
+ emit q->busyChanged();
}
QT_END_NAMESPACE
diff --git a/src/templates/qquickstackview_p.h b/src/templates/qquickstackview_p.h
index 6b78b50a..34a430e7 100644
--- a/src/templates/qquickstackview_p.h
+++ b/src/templates/qquickstackview_p.h
@@ -73,7 +73,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickStackView : public QQuickControl
Q_PROPERTY(QQuickTransition *replaceExit READ replaceExit WRITE setReplaceExit NOTIFY replaceExitChanged FINAL)
public:
- explicit QQuickStackView(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickStackView(QQuickItem *parent = nullptr);
~QQuickStackView();
static QQuickStackAttached *qmlAttachedProperties(QObject *object);
@@ -145,9 +145,9 @@ Q_SIGNALS:
void replaceExitChanged();
protected:
- void componentComplete() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- bool childMouseEventFilter(QQuickItem *, QEvent *) Q_DECL_OVERRIDE;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ bool childMouseEventFilter(QQuickItem *, QEvent *) override;
private:
Q_DISABLE_COPY(QQuickStackView)
@@ -164,7 +164,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickStackAttached : public QObject
Q_PROPERTY(QQuickStackView::Status status READ status NOTIFY statusChanged FINAL)
public:
- explicit QQuickStackAttached(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickStackAttached(QQuickItem *parent = nullptr);
~QQuickStackAttached();
int index() const;
diff --git a/src/templates/qquickstackview_p_p.h b/src/templates/qquickstackview_p_p.h
index d14c6326..93d08034 100644
--- a/src/templates/qquickstackview_p_p.h
+++ b/src/templates/qquickstackview_p_p.h
@@ -82,7 +82,7 @@ public:
bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds);
void startTransition(QQuickItemViewTransitioner *transitioner);
- void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
+ void itemDestroyed(QQuickItem *item) override;
int index;
bool init;
@@ -129,7 +129,7 @@ public:
void replaceTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate);
void completeTransition(QQuickStackElement *element, QQuickTransition *transition);
- void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) Q_DECL_OVERRIDE;
+ void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) override;
void setBusy(bool busy);
bool busy;
@@ -145,7 +145,7 @@ class QQuickStackAttachedPrivate : public QObjectPrivate, public QQuickItemChang
Q_DECLARE_PUBLIC(QQuickStackAttached)
public:
- QQuickStackAttachedPrivate() : element(Q_NULLPTR) { }
+ QQuickStackAttachedPrivate() : element(nullptr) { }
static QQuickStackAttachedPrivate *get(QQuickStackAttached *attached)
{
diff --git a/src/templates/qquickswipeview.cpp b/src/templates/qquickswipeview.cpp
index c33163fe..ec51da49 100644
--- a/src/templates/qquickswipeview.cpp
+++ b/src/templates/qquickswipeview.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-navigation
\ingroup qtlabscontrols-containers
- \brief A swipe view control.
+ \brief Enables the user to navigate pages by swiping sideways.
SwipeView provides a swipe-based navigation model.
@@ -126,7 +126,7 @@ QQuickSwipeViewAttached *QQuickSwipeView::qmlAttachedProperties(QObject *object)
QQuickItem *item = qobject_cast<QQuickItem *>(object);
if (!item) {
qWarning() << "SwipeView: attached properties must be accessed from within a child item";
- return Q_NULLPTR;
+ return nullptr;
}
return new QQuickSwipeViewAttached(item);
@@ -179,7 +179,7 @@ class QQuickSwipeViewAttachedPrivate : public QObjectPrivate, public QQuickItemC
public:
QQuickSwipeViewAttachedPrivate(QQuickItem *item) :
item(item),
- swipeView(Q_NULLPTR),
+ swipeView(nullptr),
index(-1),
isCurrent(false)
{
@@ -190,9 +190,9 @@ public:
void updateView(QQuickItem *parent);
- void itemChildAdded(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
- void itemChildRemoved(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
- void itemParentChanged(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
+ void itemParentChanged(QQuickItem *, QQuickItem *) override;
void updateIndex();
void updateIsCurrent();
@@ -212,7 +212,7 @@ public:
void QQuickSwipeViewAttachedPrivate::updateIndex()
{
- setIndex(swipeView ? QQuickSwipeViewPrivate::get(swipeView)->contentModel->indexOf(item, Q_NULLPTR) : -1);
+ setIndex(swipeView ? QQuickSwipeViewPrivate::get(swipeView)->contentModel->indexOf(item, nullptr) : -1);
}
void QQuickSwipeViewAttachedPrivate::updateIsCurrent()
@@ -256,20 +256,22 @@ void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
void QQuickSwipeViewAttachedPrivate::setIsCurrent(bool current)
{
- if (current != isCurrent) {
- isCurrent = current;
- Q_Q(QQuickSwipeViewAttached);
- emit q->isCurrentItemChanged();
- }
+ if (current == isCurrent)
+ return;
+
+ isCurrent = current;
+ Q_Q(QQuickSwipeViewAttached);
+ emit q->isCurrentItemChanged();
}
void QQuickSwipeViewAttachedPrivate::setIndex(int i)
{
- if (i != index) {
- index = i;
- Q_Q(QQuickSwipeViewAttached);
- emit q->indexChanged();
- }
+ if (i == index)
+ return;
+
+ index = i;
+ Q_Q(QQuickSwipeViewAttached);
+ emit q->indexChanged();
}
void QQuickSwipeViewAttachedPrivate::updateView(QQuickItem *parent)
@@ -279,7 +281,7 @@ void QQuickSwipeViewAttachedPrivate::updateView(QQuickItem *parent)
// - A non-visual or weird type like TestCase, when child items are created from components
// wherein the attached properties are used
// - null, when the item was removed with removeItem()
- QQuickSwipeView *view = Q_NULLPTR;
+ QQuickSwipeView *view = nullptr;
if (parent) {
view = qobject_cast<QQuickSwipeView*>(parent);
if (!view) {
diff --git a/src/templates/qquickswipeview_p.h b/src/templates/qquickswipeview_p.h
index bf733c7b..7a649300 100644
--- a/src/templates/qquickswipeview_p.h
+++ b/src/templates/qquickswipeview_p.h
@@ -60,13 +60,13 @@ class Q_LABSTEMPLATES_EXPORT QQuickSwipeView : public QQuickContainer
Q_OBJECT
public:
- explicit QQuickSwipeView(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickSwipeView(QQuickItem *parent = nullptr);
static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object);
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void itemAdded(int index, QQuickItem *item) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemAdded(int index, QQuickItem *item) override;
private:
Q_DISABLE_COPY(QQuickSwipeView)
diff --git a/src/templates/qquickswitch.cpp b/src/templates/qquickswitch.cpp
index 05422d8d..79d9735c 100644
--- a/src/templates/qquickswitch.cpp
+++ b/src/templates/qquickswitch.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickSwitch
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief A switch control.
+ \brief An option button that can be toggled on or off.
\image qtlabscontrols-switch.gif
@@ -188,11 +188,12 @@ void QQuickSwitch::setPosition(qreal position)
{
Q_D(QQuickSwitch);
position = qBound<qreal>(0.0, position, 1.0);
- if (d->position != position) {
- d->position = position;
- emit positionChanged();
- emit visualPositionChanged();
- }
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ emit positionChanged();
+ emit visualPositionChanged();
}
/*!
diff --git a/src/templates/qquickswitch_p.h b/src/templates/qquickswitch_p.h
index 94d0d601..ee8f49f8 100644
--- a/src/templates/qquickswitch_p.h
+++ b/src/templates/qquickswitch_p.h
@@ -61,7 +61,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickSwitch : public QQuickAbstractButton
Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
public:
- explicit QQuickSwitch(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickSwitch(QQuickItem *parent = nullptr);
qreal position() const;
void setPosition(qreal position);
@@ -73,8 +73,8 @@ Q_SIGNALS:
void visualPositionChanged();
protected:
- void mirrorChange() Q_DECL_OVERRIDE;
- bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
+ void mirrorChange() override;
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
virtual qreal positionAt(const QPoint &point) const;
diff --git a/src/templates/qquicktabbar.cpp b/src/templates/qquicktabbar.cpp
index 58d68058..00567019 100644
--- a/src/templates/qquicktabbar.cpp
+++ b/src/templates/qquicktabbar.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-navigation
\ingroup qtlabscontrols-containers
- \brief A tab bar control.
+ \brief A bar with icons allowing to switch between different views or subtasks.
TabBar provides a tab-based navigation model.
@@ -69,11 +69,19 @@ class QQuickTabBarPrivate : public QQuickContainerPrivate
Q_DECLARE_PUBLIC(QQuickTabBar)
public:
+ QQuickTabBarPrivate();
+
void updateCurrentItem();
void updateCurrentIndex();
void updateLayout();
+
+ QQuickTabBar::Position position;
};
+QQuickTabBarPrivate::QQuickTabBarPrivate() : position(QQuickTabBar::Header)
+{
+}
+
void QQuickTabBarPrivate::updateCurrentItem()
{
QQuickTabButton *button = qobject_cast<QQuickTabButton *>(contentModel->get(currentIndex));
@@ -86,7 +94,7 @@ void QQuickTabBarPrivate::updateCurrentIndex()
Q_Q(QQuickTabBar);
QQuickTabButton *button = qobject_cast<QQuickTabButton *>(q->sender());
if (button && button->isChecked())
- q->setCurrentIndex(contentModel->indexOf(button, Q_NULLPTR));
+ q->setCurrentIndex(contentModel->indexOf(button, nullptr));
}
void QQuickTabBarPrivate::updateLayout()
@@ -117,6 +125,38 @@ QQuickTabBar::QQuickTabBar(QQuickItem *parent) :
QObjectPrivate::connect(this, &QQuickTabBar::currentIndexChanged, d, &QQuickTabBarPrivate::updateCurrentItem);
}
+/*!
+ \qmlproperty enumeration Qt.labs.controls::TabBar::position
+
+ This property holds the position of the tab bar.
+
+ \note If the tab bar is assigned as a header or footer of ApplicationWindow
+ or Page, the appropriate position is set automatically.
+
+ Possible values:
+ \value TabBar.Header The tab bar is at the top, as a window or page header.
+ \value TabBar.Footer The tab bar is at the bottom, as a window or page footer.
+
+ The default value is style-specific.
+
+ \sa ApplicationWindow::header, ApplicationWindow::footer, Page::header, Page::footer
+*/
+QQuickTabBar::Position QQuickTabBar::position() const
+{
+ Q_D(const QQuickTabBar);
+ return d->position;
+}
+
+void QQuickTabBar::setPosition(Position position)
+{
+ Q_D(QQuickTabBar);
+ if (d->position == position)
+ return;
+
+ d->position = position;
+ emit positionChanged();
+}
+
void QQuickTabBar::updatePolish()
{
Q_D(QQuickTabBar);
diff --git a/src/templates/qquicktabbar_p.h b/src/templates/qquicktabbar_p.h
index 7d6f674c..abfd4dc9 100644
--- a/src/templates/qquicktabbar_p.h
+++ b/src/templates/qquicktabbar_p.h
@@ -57,20 +57,33 @@ class QQuickTabBarPrivate;
class Q_LABSTEMPLATES_EXPORT QQuickTabBar : public QQuickContainer
{
Q_OBJECT
+ Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
public:
- explicit QQuickTabBar(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickTabBar(QQuickItem *parent = nullptr);
+
+ enum Position {
+ Header,
+ Footer
+ };
+ Q_ENUM(Position)
+
+ Position position() const;
+ void setPosition(Position position);
+
+Q_SIGNALS:
+ void positionChanged();
protected:
- void updatePolish() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- bool isContent(QQuickItem *item) const Q_DECL_OVERRIDE;
- void itemAdded(int index, QQuickItem *item) Q_DECL_OVERRIDE;
- void itemRemoved(int index, QQuickItem *item) Q_DECL_OVERRIDE;
+ void updatePolish() override;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ bool isContent(QQuickItem *item) const override;
+ void itemAdded(int index, QQuickItem *item) override;
+ void itemRemoved(int index, QQuickItem *item) override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
private:
diff --git a/src/templates/qquicktabbutton.cpp b/src/templates/qquicktabbutton.cpp
index a70dcbe1..58eb9b85 100644
--- a/src/templates/qquicktabbutton.cpp
+++ b/src/templates/qquicktabbutton.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickTabButton
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-navigation
- \brief A tab button control.
+ \brief A tab button control that can be found on a TabBar.
\image qtlabscontrols-tabbutton.png
diff --git a/src/templates/qquicktabbutton_p.h b/src/templates/qquicktabbutton_p.h
index c02a206f..07a020e5 100644
--- a/src/templates/qquicktabbutton_p.h
+++ b/src/templates/qquicktabbutton_p.h
@@ -57,13 +57,13 @@ class Q_LABSTEMPLATES_EXPORT QQuickTabButton : public QQuickAbstractButton
Q_OBJECT
public:
- explicit QQuickTabButton(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickTabButton(QQuickItem *parent = nullptr);
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
};
diff --git a/src/templates/qquicktextarea.cpp b/src/templates/qquicktextarea.cpp
index 05b1b9a7..85e1a9ec 100644
--- a/src/templates/qquicktextarea.cpp
+++ b/src/templates/qquicktextarea.cpp
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
*/
QQuickTextAreaPrivate::QQuickTextAreaPrivate()
- : background(Q_NULLPTR), focusReason(Qt::OtherFocusReason), accessibleAttached(Q_NULLPTR)
+ : background(nullptr), focusReason(Qt::OtherFocusReason), accessibleAttached(nullptr)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -249,18 +249,19 @@ QQuickItem *QQuickTextArea::background() const
void QQuickTextArea::setBackground(QQuickItem *background)
{
Q_D(QQuickTextArea);
- if (d->background != background) {
- delete d->background;
- d->background = background;
- if (background) {
- background->setParentItem(this);
- if (qFuzzyIsNull(background->z()))
- background->setZ(-1);
- if (isComponentComplete())
- d->resizeBackground();
- }
- emit backgroundChanged();
+ if (d->background == background)
+ return;
+
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
}
+ emit backgroundChanged();
}
/*!
@@ -277,14 +278,15 @@ QString QQuickTextArea::placeholderText() const
void QQuickTextArea::setPlaceholderText(const QString &text)
{
Q_D(QQuickTextArea);
- if (d->placeholder != text) {
- d->placeholder = text;
+ if (d->placeholder == text)
+ return;
+
+ d->placeholder = text;
#ifndef QT_NO_ACCESSIBILITY
- if (d->accessibleAttached)
- d->accessibleAttached->setDescription(text);
+ if (d->accessibleAttached)
+ d->accessibleAttached->setDescription(text);
#endif
- emit placeholderTextChanged();
- }
+ emit placeholderTextChanged();
}
/*!
@@ -315,10 +317,11 @@ Qt::FocusReason QQuickTextArea::focusReason() const
void QQuickTextArea::setFocusReason(Qt::FocusReason reason)
{
Q_D(QQuickTextArea);
- if (d->focusReason != reason) {
- d->focusReason = reason;
- emit focusReasonChanged();
- }
+ if (d->focusReason == reason)
+ return;
+
+ d->focusReason = reason;
+ emit focusReasonChanged();
}
void QQuickTextArea::classBegin()
diff --git a/src/templates/qquicktextarea_p.h b/src/templates/qquicktextarea_p.h
index acf67359..623dc952 100644
--- a/src/templates/qquicktextarea_p.h
+++ b/src/templates/qquicktextarea_p.h
@@ -68,7 +68,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickTextArea : public QQuickTextEdit
Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
public:
- explicit QQuickTextArea(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickTextArea(QQuickItem *parent = nullptr);
~QQuickTextArea();
QFont font() const;
@@ -93,18 +93,18 @@ Q_SIGNALS:
void pressAndHold(QQuickMouseEvent *event);
protected:
- void classBegin() Q_DECL_OVERRIDE;
-
- void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
-
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void classBegin() override;
+
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
+
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
private:
Q_DISABLE_COPY(QQuickTextArea)
diff --git a/src/templates/qquicktextarea_p_p.h b/src/templates/qquicktextarea_p_p.h
index 2a16e5cc..35dd704d 100644
--- a/src/templates/qquicktextarea_p_p.h
+++ b/src/templates/qquicktextarea_p_p.h
@@ -78,17 +78,17 @@ public:
void resizeBackground();
void resolveFont();
- qreal getImplicitWidth() const Q_DECL_OVERRIDE;
- qreal getImplicitHeight() const Q_DECL_OVERRIDE;
+ qreal getImplicitWidth() const override;
+ qreal getImplicitHeight() const override;
- void implicitWidthChanged() Q_DECL_OVERRIDE;
- void implicitHeightChanged() Q_DECL_OVERRIDE;
+ void implicitWidthChanged() override;
+ void implicitHeightChanged() override;
void _q_readOnlyChanged(bool isReadOnly);
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
QQuickItem *background;
diff --git a/src/templates/qquicktextfield.cpp b/src/templates/qquicktextfield.cpp
index c3070614..6efc0a66 100644
--- a/src/templates/qquicktextfield.cpp
+++ b/src/templates/qquicktextfield.cpp
@@ -91,9 +91,9 @@ QT_BEGIN_NAMESPACE
*/
QQuickTextFieldPrivate::QQuickTextFieldPrivate()
- : background(Q_NULLPTR)
+ : background(nullptr)
, focusReason(Qt::OtherFocusReason)
- , accessibleAttached(Q_NULLPTR)
+ , accessibleAttached(nullptr)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -274,18 +274,19 @@ QQuickItem *QQuickTextField::background() const
void QQuickTextField::setBackground(QQuickItem *background)
{
Q_D(QQuickTextField);
- if (d->background != background) {
- delete d->background;
- d->background = background;
- if (background) {
- background->setParentItem(this);
- if (qFuzzyIsNull(background->z()))
- background->setZ(-1);
- if (isComponentComplete())
- d->resizeBackground();
- }
- emit backgroundChanged();
+ if (d->background == background)
+ return;
+
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
}
+ emit backgroundChanged();
}
/*!
@@ -302,14 +303,15 @@ QString QQuickTextField::placeholderText() const
void QQuickTextField::setPlaceholderText(const QString &text)
{
Q_D(QQuickTextField);
- if (d->placeholder != text) {
- d->placeholder = text;
+ if (d->placeholder == text)
+ return;
+
+ d->placeholder = text;
#ifndef QT_NO_ACCESSIBILITY
- if (d->accessibleAttached)
- d->accessibleAttached->setDescription(text);
+ if (d->accessibleAttached)
+ d->accessibleAttached->setDescription(text);
#endif
- emit placeholderTextChanged();
- }
+ emit placeholderTextChanged();
}
/*!
@@ -340,10 +342,11 @@ Qt::FocusReason QQuickTextField::focusReason() const
void QQuickTextField::setFocusReason(Qt::FocusReason reason)
{
Q_D(QQuickTextField);
- if (d->focusReason != reason) {
- d->focusReason = reason;
- emit focusReasonChanged();
- }
+ if (d->focusReason == reason)
+ return;
+
+ d->focusReason = reason;
+ emit focusReasonChanged();
}
void QQuickTextField::classBegin()
diff --git a/src/templates/qquicktextfield_p.h b/src/templates/qquicktextfield_p.h
index 23658cc6..ee5f3470 100644
--- a/src/templates/qquicktextfield_p.h
+++ b/src/templates/qquicktextfield_p.h
@@ -68,7 +68,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickTextField : public QQuickTextInput
Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
public:
- explicit QQuickTextField(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickTextField(QQuickItem *parent = nullptr);
~QQuickTextField();
QFont font() const;
@@ -93,18 +93,18 @@ Q_SIGNALS:
void pressAndHold(QQuickMouseEvent *mouse);
protected:
- void classBegin() Q_DECL_OVERRIDE;
-
- void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
-
- void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+ void classBegin() override;
+
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
+
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
private:
Q_DISABLE_COPY(QQuickTextField)
diff --git a/src/templates/qquicktextfield_p_p.h b/src/templates/qquicktextfield_p_p.h
index 29b01f15..3f799a5f 100644
--- a/src/templates/qquicktextfield_p_p.h
+++ b/src/templates/qquicktextfield_p_p.h
@@ -78,18 +78,18 @@ public:
void resizeBackground();
void resolveFont();
- qreal getImplicitWidth() const Q_DECL_OVERRIDE;
- qreal getImplicitHeight() const Q_DECL_OVERRIDE;
+ qreal getImplicitWidth() const override;
+ qreal getImplicitHeight() const override;
- void implicitWidthChanged() Q_DECL_OVERRIDE;
- void implicitHeightChanged() Q_DECL_OVERRIDE;
+ void implicitWidthChanged() override;
+ void implicitHeightChanged() override;
void _q_readOnlyChanged(bool isReadOnly);
void _q_echoModeChanged(QQuickTextField::EchoMode echoMode);
#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
#endif
QQuickItem *background;
diff --git a/src/templates/qquicktoolbar.cpp b/src/templates/qquicktoolbar.cpp
index 882834e3..6bc8f4d9 100644
--- a/src/templates/qquicktoolbar.cpp
+++ b/src/templates/qquicktoolbar.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qquicktoolbar_p.h"
+#include "qquickframe_p_p.h"
QT_BEGIN_NAMESPACE
@@ -44,7 +45,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickToolBar
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
- \brief A tool bar control.
+ \brief A container with context-sensitive controls.
ToolBar is a container of application-wide and context sensitive
actions and controls, such as navigation buttons and search fields.
@@ -91,11 +92,51 @@ QT_BEGIN_NAMESPACE
\sa ApplicationWindow, ToolButton, {Customizing ToolBar}, {Container Controls}
*/
+class QQuickToolBarPrivate : public QQuickFramePrivate
+{
+public:
+ QQuickToolBarPrivate() : position(QQuickToolBar::Header) { }
+
+ QQuickToolBar::Position position;
+};
+
QQuickToolBar::QQuickToolBar(QQuickItem *parent) :
- QQuickFrame(parent)
+ QQuickFrame(*(new QQuickToolBarPrivate), parent)
{
}
+/*!
+ \qmlproperty enumeration Qt.labs.controls::ToolBar::position
+
+ This property holds the position of the toolbar.
+
+ \note If the toolbar is assigned as a header or footer of ApplicationWindow
+ or Page, the appropriate position is set automatically.
+
+ Possible values:
+ \value ToolBar.Header The toolbar is at the top, as a window or page header.
+ \value ToolBar.Footer The toolbar is at the bottom, as a window or page footer.
+
+ The default value is style-specific.
+
+ \sa ApplicationWindow::header, ApplicationWindow::footer, Page::header, Page::footer
+*/
+QQuickToolBar::Position QQuickToolBar::position() const
+{
+ Q_D(const QQuickToolBar);
+ return d->position;
+}
+
+void QQuickToolBar::setPosition(Position position)
+{
+ Q_D(QQuickToolBar);
+ if (d->position == position)
+ return;
+
+ d->position = position;
+ emit positionChanged();
+}
+
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role QQuickToolBar::accessibleRole() const
{
diff --git a/src/templates/qquicktoolbar_p.h b/src/templates/qquicktoolbar_p.h
index 501f74c7..f6625847 100644
--- a/src/templates/qquicktoolbar_p.h
+++ b/src/templates/qquicktoolbar_p.h
@@ -52,17 +52,36 @@
QT_BEGIN_NAMESPACE
+class QQuickToolBarPrivate;
+
class Q_LABSTEMPLATES_EXPORT QQuickToolBar : public QQuickFrame
{
Q_OBJECT
+ Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
public:
- explicit QQuickToolBar(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickToolBar(QQuickItem *parent = nullptr);
+
+ enum Position {
+ Header,
+ Footer
+ };
+ Q_ENUM(Position)
+
+ Position position() const;
+ void setPosition(Position position);
+
+Q_SIGNALS:
+ void positionChanged();
protected:
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+ QAccessible::Role accessibleRole() const override;
#endif
+
+private:
+ Q_DISABLE_COPY(QQuickToolBar)
+ Q_DECLARE_PRIVATE(QQuickToolBar)
};
QT_END_NAMESPACE
diff --git a/src/templates/qquicktoolbutton.cpp b/src/templates/qquicktoolbutton.cpp
index 775eedd1..d04358f5 100644
--- a/src/templates/qquicktoolbutton.cpp
+++ b/src/templates/qquicktoolbutton.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickToolButton
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-buttons
- \brief A tool button control.
+ \brief A button with a layout suitable for a ToolBar.
ToolButton is functionally similar to \l Button, but provides a look that
is more suitable within a \l ToolBar.
diff --git a/src/templates/qquicktoolbutton_p.h b/src/templates/qquicktoolbutton_p.h
index 25f2134d..a4b4d227 100644
--- a/src/templates/qquicktoolbutton_p.h
+++ b/src/templates/qquicktoolbutton_p.h
@@ -57,10 +57,10 @@ class Q_LABSTEMPLATES_EXPORT QQuickToolButton : public QQuickButton
Q_OBJECT
public:
- explicit QQuickToolButton(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickToolButton(QQuickItem *parent = nullptr);
protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
+ QFont defaultFont() const override;
};
QT_END_NAMESPACE
diff --git a/src/templates/qquicktumbler.cpp b/src/templates/qquicktumbler.cpp
index c5b3f676..38447f6b 100644
--- a/src/templates/qquicktumbler.cpp
+++ b/src/templates/qquicktumbler.cpp
@@ -77,7 +77,7 @@ class QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChang
public:
QQuickTumblerPrivate() :
- delegate(Q_NULLPTR),
+ delegate(nullptr),
visibleItemCount(3)
{
}
@@ -93,8 +93,8 @@ public:
void _q_updateItemHeights();
void _q_updateItemWidths();
- void itemChildAdded(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
- void itemChildRemoved(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
};
static QList<QQuickItem *> contentItemChildItems(QQuickItem *contentItem)
@@ -126,7 +126,7 @@ namespace {
else if (contentType == ListViewContentItem)
return qobject_cast<QQuickFlickable*>(rootContentItem)->contentItem();
- return Q_NULLPTR;
+ return nullptr;
}
static inline ContentItemType contentItemType(QQuickItem *rootContentItem)
@@ -158,7 +158,8 @@ void QQuickTumblerPrivate::_q_updateItemHeights()
// which doesn't affect them, only their getters.
Q_Q(const QQuickTumbler);
const qreal itemHeight = delegateHeight(q);
- foreach (QQuickItem *childItem, contentItemChildItems(contentItem))
+ const auto items = contentItemChildItems(contentItem);
+ for (QQuickItem *childItem : items)
childItem->setHeight(itemHeight);
}
@@ -166,7 +167,8 @@ void QQuickTumblerPrivate::_q_updateItemWidths()
{
Q_Q(const QQuickTumbler);
const qreal availableWidth = q->availableWidth();
- foreach (QQuickItem *childItem, contentItemChildItems(contentItem))
+ const auto items = contentItemChildItems(contentItem);
+ for (QQuickItem *childItem : items)
childItem->setWidth(availableWidth);
}
@@ -211,10 +213,11 @@ QVariant QQuickTumbler::model() const
void QQuickTumbler::setModel(const QVariant &model)
{
Q_D(QQuickTumbler);
- if (model != d->model) {
- d->model = model;
- emit modelChanged();
- }
+ if (model == d->model)
+ return;
+
+ d->model = model;
+ emit modelChanged();
}
/*!
@@ -255,7 +258,7 @@ void QQuickTumbler::setCurrentIndex(int currentIndex)
QQuickItem *QQuickTumbler::currentItem() const
{
Q_D(const QQuickTumbler);
- return d->contentItem ? d->contentItem->property("currentItem").value<QQuickItem*>() : Q_NULLPTR;
+ return d->contentItem ? d->contentItem->property("currentItem").value<QQuickItem*>() : nullptr;
}
/*!
@@ -272,10 +275,11 @@ QQmlComponent *QQuickTumbler::delegate() const
void QQuickTumbler::setDelegate(QQmlComponent *delegate)
{
Q_D(QQuickTumbler);
- if (delegate != d->delegate) {
- d->delegate = delegate;
- emit delegateChanged();
- }
+ if (delegate == d->delegate)
+ return;
+
+ d->delegate = delegate;
+ emit delegateChanged();
}
/*!
@@ -293,11 +297,12 @@ int QQuickTumbler::visibleItemCount() const
void QQuickTumbler::setVisibleItemCount(int visibleItemCount)
{
Q_D(QQuickTumbler);
- if (visibleItemCount != d->visibleItemCount) {
- d->visibleItemCount = visibleItemCount;
- d->_q_updateItemHeights();
- emit visibleItemCountChanged();
- }
+ if (visibleItemCount == d->visibleItemCount)
+ return;
+
+ d->visibleItemCount = visibleItemCount;
+ d->_q_updateItemHeights();
+ emit visibleItemCountChanged();
}
QQuickTumblerAttached *QQuickTumbler::qmlAttachedProperties(QObject *object)
@@ -305,7 +310,7 @@ QQuickTumblerAttached *QQuickTumbler::qmlAttachedProperties(QObject *object)
QQuickItem *delegateItem = qobject_cast<QQuickItem *>(object);
if (!delegateItem) {
qWarning() << "Tumbler: attached properties of Tumbler must be accessed from within a delegate item";
- return Q_NULLPTR;
+ return nullptr;
}
return new QQuickTumblerAttached(delegateItem);
@@ -398,7 +403,7 @@ class QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemCha
Q_DECLARE_PUBLIC(QQuickTumblerAttached)
public:
QQuickTumblerAttachedPrivate(QQuickItem *delegateItem) :
- tumbler(Q_NULLPTR),
+ tumbler(nullptr),
index(-1),
displacement(1)
{
@@ -427,9 +432,9 @@ public:
~QQuickTumblerAttachedPrivate() {
}
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void itemChildAdded(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
- void itemChildRemoved(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
void _q_calculateDisplacement();
@@ -472,8 +477,9 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
const int previousDisplacement = displacement;
displacement = 0;
+ const int count = tumbler->count();
// This can happen in tests, so it may happen in normal usage too.
- if (tumbler->count() == 0)
+ if (count == 0)
return;
ContentItemType contentType = contentItemType(tumbler->contentItem());
@@ -485,12 +491,12 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
if (contentType == PathViewContentItem) {
offset = tumbler->contentItem()->property("offset").toReal();
- displacement = tumbler->count() - index - offset;
+ displacement = count - index - offset;
int halfVisibleItems = tumbler->visibleItemCount() / 2 + 1;
if (displacement > halfVisibleItems)
- displacement -= tumbler->count();
+ displacement -= count;
else if (displacement < -halfVisibleItems)
- displacement += tumbler->count();
+ displacement += count;
} else {
const qreal contentY = tumbler->contentItem()->property("contentY").toReal();
const qreal delegateH = delegateHeight(tumbler);
diff --git a/src/templates/qquicktumbler_p.h b/src/templates/qquicktumbler_p.h
index ad57acbb..6c329496 100644
--- a/src/templates/qquicktumbler_p.h
+++ b/src/templates/qquicktumbler_p.h
@@ -68,7 +68,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickTumbler : public QQuickControl
Q_PROPERTY(int visibleItemCount READ visibleItemCount WRITE setVisibleItemCount NOTIFY visibleItemCountChanged FINAL)
public:
- explicit QQuickTumbler(QQuickItem *parent = Q_NULLPTR);
+ explicit QQuickTumbler(QQuickItem *parent = nullptr);
~QQuickTumbler();
QVariant model() const;
@@ -97,10 +97,10 @@ Q_SIGNALS:
void visibleItemCountChanged();
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
- void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void componentComplete() override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ void keyPressEvent(QKeyEvent *event) override;
private:
Q_DISABLE_COPY(QQuickTumbler)
diff --git a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp
index c618a2d5..951611f2 100644
--- a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp
+++ b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp
@@ -60,11 +60,9 @@ private slots:
void allControls();
void textControls();
+
private:
QQmlEngine engine;
- bool qt_tab_all_controls() {
- return QGuiApplication::styleHints()->tabFocusBehavior() == Qt::TabFocusAllControls;
- }
};
tst_activeFocusOnTab::tst_activeFocusOnTab()
@@ -82,8 +80,7 @@ void tst_activeFocusOnTab::cleanup()
void tst_activeFocusOnTab::allControls()
{
- if (!qt_tab_all_controls())
- QSKIP("This platform iterates only text controls. Cannot test iterating all controls.");
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusAllControls);
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -428,12 +425,13 @@ void tst_activeFocusOnTab::allControls()
QVERIFY(item->hasActiveFocus());
delete window;
+
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusBehavior(-1));
}
void tst_activeFocusOnTab::textControls()
{
- if (qt_tab_all_controls())
- QSKIP("This platform iterates all controls. Cannot test iterating text controls only.");
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusTextControls);
QQuickView *window = new QQuickView(0);
window->setBaseSize(QSize(800,600));
@@ -487,6 +485,8 @@ void tst_activeFocusOnTab::textControls()
QVERIFY(item->hasActiveFocus());
delete window;
+
+ QGuiApplication::styleHints()->setTabFocusBehavior(Qt::TabFocusBehavior(-1));
}
QTEST_MAIN(tst_activeFocusOnTab)
diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/applicationwindow/tst_applicationwindow.cpp
index d2937a6d..f78d1f66 100644
--- a/tests/auto/applicationwindow/tst_applicationwindow.cpp
+++ b/tests/auto/applicationwindow/tst_applicationwindow.cpp
@@ -420,7 +420,7 @@ void tst_applicationwindow::attachedProperties()
QCOMPARE(childItem->property("attached_footer").value<QQuickItem *>(), childAppWindow->footer());
QCOMPARE(childItem->property("attached_overlay").value<QQuickItem *>(), childAppWindow->overlay());
- childControl->setParentItem(Q_NULLPTR);
+ childControl->setParentItem(nullptr);
QVERIFY(!childControl->window());
QVERIFY(!childControl->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childControl->property("attached_contentItem").value<QQuickItem *>());
@@ -429,7 +429,7 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(!childControl->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childControl->property("attached_overlay").value<QQuickItem *>());
- childItem->setParentItem(Q_NULLPTR);
+ childItem->setParentItem(nullptr);
QVERIFY(!childItem->window());
QVERIFY(!childItem->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childItem->property("attached_contentItem").value<QQuickItem *>());
@@ -507,7 +507,7 @@ public:
{ QGuiApplicationPrivate::platform_theme = this; }
~TestTheme() { QGuiApplicationPrivate::platform_theme = theme(); }
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE
+ const QFont *font(Font type = SystemFont) const override
{
Q_UNUSED(type);
return &m_font;
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index 45fad8cb..4127fbf2 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -228,7 +228,7 @@ TestCase {
function test_baseline() {
var control = button.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_checkbox.qml b/tests/auto/controls/data/tst_checkbox.qml
index 4efc7223..7e0c88e4 100644
--- a/tests/auto/controls/data/tst_checkbox.qml
+++ b/tests/auto/controls/data/tst_checkbox.qml
@@ -421,7 +421,7 @@ TestCase {
function test_baseline() {
var control = checkBox.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_itemdelegate.qml b/tests/auto/controls/data/tst_itemdelegate.qml
index e2f78ac5..f2fd3794 100644
--- a/tests/auto/controls/data/tst_itemdelegate.qml
+++ b/tests/auto/controls/data/tst_itemdelegate.qml
@@ -58,7 +58,7 @@ TestCase {
function test_baseline() {
var control = itemDelegate.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_menuitem.qml b/tests/auto/controls/data/tst_menuitem.qml
index 8581a43f..8c9bc71b 100644
--- a/tests/auto/controls/data/tst_menuitem.qml
+++ b/tests/auto/controls/data/tst_menuitem.qml
@@ -58,7 +58,7 @@ TestCase {
function test_baseline() {
var control = menuItem.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_radiobutton.qml b/tests/auto/controls/data/tst_radiobutton.qml
index d4cdf0ad..1b105f08 100644
--- a/tests/auto/controls/data/tst_radiobutton.qml
+++ b/tests/auto/controls/data/tst_radiobutton.qml
@@ -312,7 +312,7 @@ TestCase {
function test_baseline() {
var control = radioButton.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_switch.qml b/tests/auto/controls/data/tst_switch.qml
index 13924ed0..7443f330 100644
--- a/tests/auto/controls/data/tst_switch.qml
+++ b/tests/auto/controls/data/tst_switch.qml
@@ -260,7 +260,7 @@ TestCase {
function test_baseline() {
var control = swtch.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_tabbutton.qml b/tests/auto/controls/data/tst_tabbutton.qml
index 3a817cfd..f755c081 100644
--- a/tests/auto/controls/data/tst_tabbutton.qml
+++ b/tests/auto/controls/data/tst_tabbutton.qml
@@ -85,7 +85,7 @@ TestCase {
function test_baseline() {
var control = tabButton.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml
index 63a87ec2..6c03f18c 100644
--- a/tests/auto/controls/data/tst_toolbutton.qml
+++ b/tests/auto/controls/data/tst_toolbutton.qml
@@ -173,7 +173,7 @@ TestCase {
function test_baseline() {
var control = toolButton.createObject(testCase)
verify(control)
- compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
control.destroy()
}
}
diff --git a/tests/auto/pressandhold/data/dependencies.qml b/tests/auto/pressandhold/data/dependencies.qml
new file mode 100644
index 00000000..13690bbc
--- /dev/null
+++ b/tests/auto/pressandhold/data/dependencies.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Control { }
diff --git a/tests/auto/sanity/data/dependencies.qml b/tests/auto/sanity/data/dependencies.qml
new file mode 100644
index 00000000..13690bbc
--- /dev/null
+++ b/tests/auto/sanity/data/dependencies.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Control { }
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index bc114d62..7f438721 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -267,14 +267,18 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt
// the engine's import path. This way we can use QQmlComponent to load each QML file
// for benchmarking.
- QFileInfoList entries = QDir(QQC2_IMPORT_PATH + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
foreach (const QFileInfo &entry, entries) {
QString name = entry.baseName();
if (!skiplist.contains(name)) {
foreach (const QString &importPath, engine->importPathList()) {
- QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName());
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName();
if (QFile::exists(filePath)) {
- QTest::newRow(qPrintable(entry.dir().dirName() + "/" + entry.fileName())) << QUrl::fromLocalFile(filePath);
+ QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
+ break;
+ } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) {
+ QTest::newRow(qPrintable(name)) << QUrl(filePath);
break;
}
}
@@ -305,10 +309,10 @@ void tst_Sanity::attachedObjects()
void tst_Sanity::attachedObjects_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/calendar");
- addTestRows(&engine, "/controls");
- addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle");
- addTestRows(&engine, "/controls/universal");
+ addTestRows(&engine, "calendar");
+ addTestRows(&engine, "controls");
+ addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle");
+ addTestRows(&engine, "controls/universal");
}
QTEST_MAIN(tst_Sanity)
diff --git a/tests/auto/snippets/data/dependencies.qml b/tests/auto/snippets/data/dependencies.qml
new file mode 100644
index 00000000..15fa1a9a
--- /dev/null
+++ b/tests/auto/snippets/data/dependencies.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.calendar 1.0
+
+Control { }
diff --git a/tests/auto/styles/data/dependencies.qml b/tests/auto/styles/data/dependencies.qml
new file mode 100644
index 00000000..310fbf40
--- /dev/null
+++ b/tests/auto/styles/data/dependencies.qml
@@ -0,0 +1,7 @@
+import QtTest 1.0
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+
+Control { }
diff --git a/tests/benchmarks/creationtime/data/dependencies.qml b/tests/benchmarks/creationtime/data/dependencies.qml
new file mode 100644
index 00000000..65fb0414
--- /dev/null
+++ b/tests/benchmarks/creationtime/data/dependencies.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.calendar 1.0
+
+Control { }
diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp
index 2a61b0ea..927dd17d 100644
--- a/tests/benchmarks/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/creationtime/tst_creationtime.cpp
@@ -78,15 +78,19 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt
// the engine's import path. This way we can use QQmlComponent to load each QML file
// for benchmarking.
- QFileInfoList entries = QDir(QQC2_IMPORT_PATH + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
foreach (const QFileInfo &entry, entries) {
QString name = entry.baseName();
if (!skiplist.contains(name)) {
foreach (const QString &importPath, engine->importPathList()) {
- QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName());
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName();
if (QFile::exists(filePath)) {
QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
break;
+ } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) {
+ QTest::newRow(qPrintable(name)) << QUrl(filePath);
+ break;
}
}
}
@@ -117,7 +121,7 @@ void tst_CreationTime::controls()
void tst_CreationTime::controls_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls");
+ addTestRows(&engine, "controls");
}
void tst_CreationTime::material()
@@ -129,7 +133,7 @@ void tst_CreationTime::material()
void tst_CreationTime::material_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle");
+ addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle");
}
void tst_CreationTime::universal()
@@ -141,7 +145,7 @@ void tst_CreationTime::universal()
void tst_CreationTime::universal_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/universal");
+ addTestRows(&engine, "controls/universal");
}
void tst_CreationTime::calendar()
@@ -153,7 +157,7 @@ void tst_CreationTime::calendar()
void tst_CreationTime::calendar_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/calendar");
+ addTestRows(&engine, "calendar");
}
QTEST_MAIN(tst_CreationTime)
diff --git a/tests/benchmarks/objectcount/data/dependencies.qml b/tests/benchmarks/objectcount/data/dependencies.qml
new file mode 100644
index 00000000..65fb0414
--- /dev/null
+++ b/tests/benchmarks/objectcount/data/dependencies.qml
@@ -0,0 +1,7 @@
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.calendar 1.0
+
+Control { }
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index b479b0e2..51a968d0 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -84,7 +84,7 @@ void tst_ObjectCount::init()
// warmup
QQmlComponent component(&engine);
- component.setData("import QtQuick 2.0; import QtQuick.Controls 1.3 as C1; import Qt.labs.controls 1.0 as C2; Row { C1.Button {} C2.Button {} }", QUrl());
+ component.setData("import QtQuick 2.0; import Qt.labs.controls 1.0; Item { Button {} }", QUrl());
delete component.create();
}
@@ -118,15 +118,19 @@ static void addTestRows(QQmlEngine *engine, const QString &targetPath, const QSt
// the engine's import path. This way we can use QQmlComponent to load each QML file
// for benchmarking.
- QFileInfoList entries = QDir(QQC2_IMPORT_PATH + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + targetPath).entryInfoList(QStringList("*.qml"), QDir::Files);
foreach (const QFileInfo &entry, entries) {
QString name = entry.baseName();
if (!skiplist.contains(name)) {
foreach (const QString &importPath, engine->importPathList()) {
- QString filePath = QDir(importPath + "/Qt/labs/" + targetPath).absoluteFilePath(entry.fileName());
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/Qt/labs/" + targetPath + "/" + entry.fileName();
if (QFile::exists(filePath)) {
QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
break;
+ } else if (QFile::exists(QQmlFile::urlToLocalFileOrQrc(filePath))) {
+ QTest::newRow(qPrintable(name)) << QUrl(filePath);
+ break;
}
}
}
@@ -161,7 +165,7 @@ void tst_ObjectCount::calendar()
void tst_ObjectCount::calendar_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/calendar");
+ addTestRows(&engine, "calendar");
}
void tst_ObjectCount::controls()
@@ -173,7 +177,7 @@ void tst_ObjectCount::controls()
void tst_ObjectCount::controls_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls");
+ addTestRows(&engine, "controls");
}
void tst_ObjectCount::material()
@@ -185,7 +189,7 @@ void tst_ObjectCount::material()
void tst_ObjectCount::material_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/material", QStringList() << "Ripple" << "SliderHandle");
+ addTestRows(&engine, "controls/material", QStringList() << "Ripple" << "SliderHandle");
}
void tst_ObjectCount::universal()
@@ -197,7 +201,7 @@ void tst_ObjectCount::universal()
void tst_ObjectCount::universal_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "/controls/universal");
+ addTestRows(&engine, "controls/universal");
}
QTEST_MAIN(tst_ObjectCount)
diff --git a/tests/manual/gifs/eventcapturer.cpp b/tests/manual/gifs/eventcapturer.cpp
index 5b5905cd..83e1c76b 100644
--- a/tests/manual/gifs/eventcapturer.cpp
+++ b/tests/manual/gifs/eventcapturer.cpp
@@ -69,7 +69,7 @@
EventCapturer::EventCapturer(QObject *parent) :
QObject(parent),
- mEventSource(Q_NULLPTR),
+ mEventSource(nullptr),
mStopCaptureKey(Qt::Key_Escape),
mMoveEventTrimFlags(TrimNone),
mDuration(0),
diff --git a/tests/manual/gifs/eventcapturer.h b/tests/manual/gifs/eventcapturer.h
index b1f2b4ff..7982d6e9 100644
--- a/tests/manual/gifs/eventcapturer.h
+++ b/tests/manual/gifs/eventcapturer.h
@@ -74,7 +74,7 @@ public:
QVector<CapturedEvent> capturedEvents() const;
protected:
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
+ bool eventFilter(QObject *object, QEvent *event) override;
private slots:
void stopCapturing();
diff --git a/tests/manual/gifs/gifrecorder.cpp b/tests/manual/gifs/gifrecorder.cpp
index 3ba33552..8082b736 100644
--- a/tests/manual/gifs/gifrecorder.cpp
+++ b/tests/manual/gifs/gifrecorder.cpp
@@ -64,8 +64,8 @@ namespace {
}
GifRecorder::GifRecorder() :
- QObject(Q_NULLPTR),
- mWindow(Q_NULLPTR),
+ QObject(nullptr),
+ mWindow(nullptr),
mHighQuality(false),
mRecordingDuration(0),
mRecordCursor(false),
diff --git a/tests/manual/viewinqwidget/main.cpp b/tests/manual/viewinqwidget/main.cpp
index ff949544..3611e071 100644
--- a/tests/manual/viewinqwidget/main.cpp
+++ b/tests/manual/viewinqwidget/main.cpp
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
const QUrl gallerySource(QLatin1String("qrc:/gallery.qml"));
QQmlApplicationEngine engine(gallerySource);
- QObject *root = engine.rootObjects().value(0, Q_NULLPTR);
+ QObject *root = engine.rootObjects().value(0, nullptr);
if (!root || !root->isWindowType()) {
qWarning() << "Load error" << gallerySource;
return 1;