aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/controls/controls.pri12
-rw-r--r--src/controls/controls.pro11
-rw-r--r--src/controls/qquickpaddedrectangle.cpp210
-rw-r--r--src/controls/qquickpaddedrectangle_p.h118
-rw-r--r--src/controls/qquickproxytheme.cpp181
-rw-r--r--src/controls/qquickproxytheme_p.h98
-rw-r--r--src/controls/qquickstyle.cpp229
-rw-r--r--src/controls/qquickstyle_p.h91
-rw-r--r--src/controls/qquickstyleselector.cpp227
-rw-r--r--src/controls/qquickstyleselector_p.h76
-rw-r--r--src/controls/qquickstyleselector_p_p.h81
-rw-r--r--src/imports/calendar/calendar.pro2
-rw-r--r--src/imports/calendar/plugins.qmltypes5
-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.cpp7
-rw-r--r--src/imports/calendar/qquickdayofweekrow_p.h12
-rw-r--r--src/imports/calendar/qquickmonthgrid.cpp38
-rw-r--r--src/imports/calendar/qquickmonthgrid_p.h26
-rw-r--r--src/imports/calendar/qquickmonthmodel_p.h8
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn.cpp7
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn_p.h12
-rw-r--r--src/imports/calendar/qquickweeknumbermodel_p.h8
-rw-r--r--src/imports/calendar/qtlabscalendarplugin.cpp13
-rw-r--r--src/imports/controls/AbstractButton.qml48
-rw-r--r--src/imports/controls/ApplicationWindow.qml12
-rw-r--r--src/imports/controls/BusyIndicator.qml12
-rw-r--r--src/imports/controls/Button.qml39
-rw-r--r--src/imports/controls/CheckBox.qml56
-rw-r--r--src/imports/controls/CheckDelegate.qml81
-rw-r--r--src/imports/controls/CheckIndicator.qml69
-rw-r--r--src/imports/controls/ComboBox.qml76
-rw-r--r--src/imports/controls/Container.qml47
-rw-r--r--src/imports/controls/Control.qml47
-rw-r--r--src/imports/controls/Dial.qml32
-rw-r--r--src/imports/controls/Drawer.qml39
-rw-r--r--src/imports/controls/Frame.qml17
-rw-r--r--src/imports/controls/GroupBox.qml18
-rw-r--r--src/imports/controls/ItemDelegate.qml40
-rw-r--r--src/imports/controls/Label.qml6
-rw-r--r--src/imports/controls/Menu.qml20
-rw-r--r--src/imports/controls/MenuItem.qml36
-rw-r--r--src/imports/controls/Page.qml10
-rw-r--r--src/imports/controls/PageIndicator.qml10
-rw-r--r--src/imports/controls/Pane.qml12
-rw-r--r--src/imports/controls/Popup.qml8
-rw-r--r--src/imports/controls/ProgressBar.qml25
-rw-r--r--src/imports/controls/RadioButton.qml53
-rw-r--r--src/imports/controls/RadioDelegate.qml81
-rw-r--r--src/imports/controls/RadioIndicator.qml60
-rw-r--r--src/imports/controls/RangeSlider.qml35
-rw-r--r--src/imports/controls/ScrollBar.qml20
-rw-r--r--src/imports/controls/ScrollIndicator.qml20
-rw-r--r--src/imports/controls/Slider.qml26
-rw-r--r--src/imports/controls/SpinBox.qml53
-rw-r--r--src/imports/controls/StackView.qml34
-rw-r--r--src/imports/controls/SwipeDelegate.qml85
-rw-r--r--src/imports/controls/SwipeView.qml12
-rw-r--r--src/imports/controls/Switch.qml59
-rw-r--r--src/imports/controls/SwitchDelegate.qml80
-rw-r--r--src/imports/controls/SwitchIndicator.qml70
-rw-r--r--src/imports/controls/TabBar.qml18
-rw-r--r--src/imports/controls/TabButton.qml27
-rw-r--r--src/imports/controls/TextArea.qml10
-rw-r--r--src/imports/controls/TextField.qml24
-rw-r--r--src/imports/controls/ToolBar.qml10
-rw-r--r--src/imports/controls/ToolButton.qml29
-rw-r--r--src/imports/controls/ToolTip.qml66
-rw-r--r--src/imports/controls/Tumbler.qml16
-rw-r--r--src/imports/controls/controls.pri25
-rw-r--r--src/imports/controls/controls.pro27
-rw-r--r--src/imports/controls/designer/BusyIndicatorSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ButtonSection.qml4
-rw-r--r--src/imports/controls/designer/ButtonSpecifics.qml4
-rw-r--r--src/imports/controls/designer/CheckBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/CheckDelegateSpecifics.qml56
-rw-r--r--src/imports/controls/designer/ComboBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ControlSection.qml4
-rw-r--r--src/imports/controls/designer/ControlSpecifics.qml4
-rw-r--r--src/imports/controls/designer/DialSpecifics.qml4
-rw-r--r--src/imports/controls/designer/FrameSpecifics.qml4
-rw-r--r--src/imports/controls/designer/GroupBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ItemDelegateSpecifics.qml4
-rw-r--r--src/imports/controls/designer/LabelSpecifics.qml4
-rw-r--r--src/imports/controls/designer/PaddingSection.qml4
-rw-r--r--src/imports/controls/designer/PageIndicatorSpecifics.qml4
-rw-r--r--src/imports/controls/designer/PaneSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ProgressBarSpecifics.qml4
-rw-r--r--src/imports/controls/designer/RadioButtonSpecifics.qml4
-rw-r--r--src/imports/controls/designer/RadioDelegateSpecifics.qml56
-rw-r--r--src/imports/controls/designer/SliderSpecifics.qml4
-rw-r--r--src/imports/controls/designer/SpinBoxSpecifics.qml4
-rw-r--r--src/imports/controls/designer/SwipeDelegateSpecifics.qml56
-rw-r--r--src/imports/controls/designer/SwitchDelegateSpecifics.qml56
-rw-r--r--src/imports/controls/designer/SwitchSpecifics.qml4
-rw-r--r--src/imports/controls/designer/TextAreaSpecifics.qml4
-rw-r--r--src/imports/controls/designer/TextFieldSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ToolBarSpecifics.qml4
-rw-r--r--src/imports/controls/designer/ToolButtonSpecifics.qml4
-rw-r--r--src/imports/controls/designer/TumblerSpecifics.qml4
-rw-r--r--src/imports/controls/designer/designer.pri5
-rw-r--r--src/imports/controls/designer/images/page-icon.pngbin0 -> 250 bytes
-rw-r--r--src/imports/controls/designer/images/page-icon16.pngbin0 -> 231 bytes
-rw-r--r--src/imports/controls/designer/images/page-icon16@2x.pngbin0 -> 268 bytes
-rw-r--r--src/imports/controls/designer/images/page-icon@2x.pngbin0 -> 303 bytes
-rw-r--r--src/imports/controls/designer/images/rangeslider-icon.pngbin0 -> 365 bytes
-rw-r--r--src/imports/controls/designer/images/rangeslider-icon16.pngbin0 -> 279 bytes
-rw-r--r--src/imports/controls/designer/images/rangeslider-icon16@2x.pngbin0 -> 550 bytes
-rw-r--r--src/imports/controls/designer/images/rangeslider-icon@2x.pngbin0 -> 824 bytes
-rw-r--r--src/imports/controls/designer/qtlabscontrols.metainfo310
-rw-r--r--src/imports/controls/designer/qtquickcontrols2.metainfo402
-rw-r--r--src/imports/controls/doc/doc.pri7
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-calendarmodel.pngbin6057 -> 5724 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.pngbin9176 -> 7455 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.pngbin2513 -> 2017 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.pngbin10913 -> 8876 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-monthgrid.pngbin6503 -> 3827 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.pngbin8333 -> 4986 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.pngbin1977 -> 1453 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-busyindicator-background.pngbin1594 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-busyindicator-contentItem.pngbin1583 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-busyindicator.gifbin3241 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-background.pngbin1499 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-disabled.pngbin1653 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-focused.pngbin1515 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-label.pngbin1550 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-normal.pngbin1507 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button-pressed.pngbin1949 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button.gifbin2171 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-button.pngbin1518 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-background.pngbin2607 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-checked.pngbin2687 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-disabled.pngbin2197 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-focused.pngbin2069 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-indicator.pngbin2539 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-label.pngbin2582 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox-normal.pngbin1547 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-checkbox.pngbin2573 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-background.pngbin2731 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.pngbin2752 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.pngbin4999 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-popup.pngbin4969 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox.pngbin4984 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-default.pngbin19608 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-dial-background.pngbin6563 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-dial-handle.pngbin7325 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-frame-background.pngbin345 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-frame-frame.pngbin341 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-frame.pngbin5213 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.pngbin17156 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-gallery-menu.pngbin17209 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.pngbin23502 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-groupbox-background.pngbin2685 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.pngbin8311 -> 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-groupbox-label.pngbin2673 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-groupbox.pngbin7718 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-itemdelegate-background.pngbin3499 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-itemdelegate-indicator.pngbin3456 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-itemdelegate-label.pngbin3441 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-itemdelegate.pngbin9440 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-label-background.pngbin1118 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-label.pngbin1093 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-material-button.pngbin1272 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-material.pngbin23669 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-menu-contentItem.pngbin4777 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-page-wireframe.pngbin1795 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pageindicator.pngbin689 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pane-background.pngbin341 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pane.pngbin4939 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-progressbar-background.pngbin146 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-progressbar-disabled.pngbin133 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-progressbar-indicator.pngbin133 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-progressbar-normal.pngbin133 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-background.pngbin3474 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-checked.pngbin3411 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-disabled.pngbin2897 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-focused.pngbin2771 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-indicator.pngbin3337 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.pngbin3435 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton-normal.pngbin2234 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-radiobutton.pngbin3491 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-background.pngbin1201 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-disabled.pngbin1204 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle-focused.pngbin1204 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle.pngbin1206 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-normal.pngbin1204 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle-focused.pngbin1204 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle.pngbin1365 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider-track.pngbin1162 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider.gifbin18024 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-rangeslider.pngbin1204 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-scrollbar-background.pngbin260 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-scrollbar-handle.pngbin248 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-scrollbar.pngbin680 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-scrollindicator-background.pngbin147 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-scrollindicator-indicator.pngbin121 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-scrollindicator.pngbin387 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider-background.pngbin1104 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider-disabled.pngbin1117 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider-focused.pngbin1117 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider-handle.pngbin953 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider-normal.pngbin1117 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider-track.pngbin1018 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider.gifbin16972 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-slider.pngbin1117 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-spinbox-background.pngbin1104 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-spinbox-contentItem.pngbin1178 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-spinbox-down.pngbin1130 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-spinbox-textual.pngbin1825 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-spinbox-up.pngbin1144 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-spinbox.pngbin1149 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-background.pngbin2648 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-checked.pngbin3124 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-disabled.pngbin3218 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-focused.pngbin2905 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-indicator.pngbin2522 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-label.pngbin2605 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-switch-normal.pngbin2415 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-tabbar.pngbin4725 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-tabbutton.pngbin4728 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-textarea.pngbin2113 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-textfield-background.pngbin1976 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-textfield-disabled.pngbin193 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-textfield-focused.pngbin2072 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-textfield-normal.pngbin1553 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-background.pngbin2558 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-checked.pngbin1921 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-disabled.pngbin1921 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-focused.pngbin1788 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-indicator.pngbin2450 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-label.pngbin2530 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-togglebutton-normal.pngbin1444 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbar-background.pngbin217 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbar-frame.pngbin217 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbar.pngbin4172 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbutton-background.pngbin1722 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-toolbutton-label.pngbin1682 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-tumbler-background.pngbin1289 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-tumbler-contentItem.pngbin1289 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-tumbler-delegate.pngbin1300 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-universal.pngbin18382 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-applicationwindow-wireframe.pngbin0 -> 5696 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-busyindicator-custom.pngbin0 -> 1502 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gifbin0 -> 17357 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-busyindicator.png (renamed from src/imports/controls/doc/images/qtlabscontrols-busyindicator.png)bin1713 -> 1713 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-custom.pngbin0 -> 1512 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-flat.gifbin0 -> 2388 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-focused.pngbin0 -> 1482 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gifbin0 -> 1856 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-normal.pngbin0 -> 1257 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-pressed.pngbin0 -> 1196 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button.gifbin0 -> 1863 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-custom.pngbin0 -> 2268 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gifbin0 -> 8784 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox.gifbin0 -> 6403 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-custom.pngbin0 -> 2619 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gifbin0 -> 10487 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gifbin0 -> 15290 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-combobox-custom.pngbin0 -> 1169 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-combobox-delegate.pngbin0 -> 1343 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-combobox-popup.pngbin0 -> 1343 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-combobox.gifbin0 -> 7873 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-control.pngbin0 -> 22234 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-control.svg392
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-customize-buttons.pngbin0 -> 3224 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-default.pngbin0 -> 16855 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial-custom.pngbin0 -> 6274 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial-handle.pngbin0 -> 5703 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial-no-wrap.gifbin0 -> 52372 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial-wrap.gifbin0 -> 70792 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial.png (renamed from src/imports/controls/doc/images/qtlabscontrols-dial.png)bin7204 -> 7204 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-drawer-expanded-wireframe.png (renamed from src/imports/controls/doc/images/qtlabscontrols-drawer-expanded-wireframe.png)bin3004 -> 3004 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-drawer-wireframe.png (renamed from src/imports/controls/doc/images/qtlabscontrols-drawer-wireframe.png)bin3956 -> 3956 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-drawer.gifbin0 -> 55780 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-frame-custom.pngbin0 -> 2261 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-frame.pngbin0 -> 3824 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-groupbox-checkable.pngbin0 -> 6388 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-groupbox-custom.pngbin0 -> 3885 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-groupbox-label.pngbin0 -> 2052 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-groupbox.pngbin0 -> 5682 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-itemdelegate-custom.pngbin0 -> 1812 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gifbin0 -> 16287 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.pngbin0 -> 7029 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-label-custom.pngbin0 -> 963 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-label.pngbin0 -> 946 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-accent.pngbin0 -> 1633 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-attributes.pngbin0 -> 8934 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-background.pngbin0 -> 1883 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-dark.png (renamed from src/imports/controls/doc/images/qtlabscontrols-material-dark.png)bin4981 -> 4981 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-elevation.pngbin0 -> 3087 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-foreground.pngbin0 -> 1726 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-theme.pngbin0 -> 2002 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material.pngbin0 -> 29049 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-menu-custom.pngbin0 -> 2960 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-menu.gif (renamed from src/imports/controls/doc/images/qtlabscontrols-menu.gif)bin4683 -> 4683 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-menu.png (renamed from src/imports/controls/doc/images/qtlabscontrols-menu.png)bin4821 -> 4821 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-page-wireframe.png (renamed from src/imports/controls/doc/images/qtlabscontrols-applicationwindow-wireframe.png)bin1795 -> 1795 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-pageindicator-custom.pngbin0 -> 396 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-pageindicator-delegate.pngbin0 -> 498 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-pageindicator.pngbin0 -> 416 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-pane-custom.pngbin0 -> 2244 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-pane.pngbin0 -> 3561 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup-custom.pngbin0 -> 630 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup-settings.pngbin0 -> 12440 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup-transformorigin.png (renamed from src/imports/controls/doc/images/qtlabscontrols-popup-transformorigin.png)bin8927 -> 8927 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup.pngbin0 -> 21693 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup.svg391
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar-custom.pngbin0 -> 226 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gifbin0 -> 5882 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar.gifbin0 -> 2072 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton-custom.pngbin0 -> 2868 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gifbin0 -> 7993 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiodelegate-custom.pngbin0 -> 3135 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gifbin0 -> 16859 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-rangeslider-custom.pngbin0 -> 1077 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gifbin0 -> 17402 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollbar-custom.pngbin0 -> 236 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.pngbin0 -> 5459 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollbar.gifbin0 -> 32067 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-custom.pngbin0 -> 123 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.pngbin0 -> 5280 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gifbin0 -> 42352 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-custom.pngbin0 -> 954 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-handle.pngbin0 -> 967 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gifbin0 -> 18138 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gifbin0 -> 7201 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gifbin0 -> 18377 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider.gifbin0 -> 13697 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-spinbox-custom.pngbin0 -> 1175 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-spinbox-double.pngbin0 -> 933 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-spinbox-down.pngbin0 -> 984 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-spinbox-textual.pngbin0 -> 1505 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-spinbox-up.pngbin0 -> 995 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-spinbox.pngbin0 -> 989 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-custom.pngbin0 -> 200 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gifbin0 -> 23801 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gifbin0 -> 42790 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gifbin0 -> 28882 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gifbin0 -> 23744 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-wireframe.png (renamed from src/imports/controls/doc/images/qtlabscontrols-stackview-wireframe.png)bin646 -> 646 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-behind.gifbin0 -> 248344 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-custom.pngbin0 -> 2434 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-leading-trailing.gifbin0 -> 132134 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipedelegate.gifbin0 -> 123494 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipeview-indicator.png (renamed from src/imports/controls/doc/images/qtlabscontrols-swipeview-indicator.png)bin695 -> 695 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipeview-wireframe.png (renamed from src/imports/controls/doc/images/qtlabscontrols-swipeview-wireframe.png)bin1583 -> 1583 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipeview.gifbin0 -> 35983 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch-checked.pngbin0 -> 2427 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch-custom.pngbin0 -> 2251 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch-disabled.pngbin0 -> 2633 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch-focused.pngbin0 -> 2532 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch-normal.pngbin0 -> 2249 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch.gif (renamed from src/imports/controls/doc/images/qtlabscontrols-switch.gif)bin3466 -> 3466 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switch.png (renamed from src/imports/controls/doc/images/qtlabscontrols-switch.png)bin2669 -> 2669 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switchdelegate-custom.pngbin0 -> 3567 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-switchdelegate.gifbin0 -> 38688 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbar-custom.pngbin0 -> 3568 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbar-explicit.pngbin0 -> 2701 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.pngbin0 -> 3349 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbar-wireframe.png (renamed from src/imports/controls/doc/images/qtlabscontrols-tabbar-wireframe.png)bin609 -> 609 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbar.gif (renamed from src/imports/controls/doc/images/qtlabscontrols-tabbar.gif)bin8590 -> 8590 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbar.pngbin0 -> 3882 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tabbutton.pngbin0 -> 3597 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textarea-custom.pngbin0 -> 1974 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textarea-flickable.pngbin0 -> 1942 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textarea.pngbin0 -> 2238 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textfield-custom.pngbin0 -> 2387 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textfield-disabled.pngbin0 -> 1282 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textfield-focused.pngbin0 -> 1633 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textfield-normal.pngbin0 -> 1325 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-textfield.png (renamed from src/imports/controls/doc/images/qtlabscontrols-textfield.png)bin2088 -> 2088 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolbar-custom.pngbin0 -> 1531 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolbar.pngbin0 -> 1186 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolbutton-custom.pngbin0 -> 1419 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolbutton.png (renamed from src/imports/controls/doc/images/qtlabscontrols-toolbutton.png)bin1683 -> 1683 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tooltip-delay.pngbin0 -> 1278 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tooltip-hover.pngbin0 -> 1205 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tooltip-pressandhold.pngbin0 -> 1205 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tooltip-slider.pngbin0 -> 2057 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tooltip.pngbin0 -> 6315 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tumbler-custom.pngbin0 -> 2282 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tumbler-delegate.pngbin0 -> 1176 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif (renamed from src/imports/controls/doc/images/qtlabscontrols-tumbler-wrap.gif)bin54383 -> 54383 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tumbler.png (renamed from src/imports/controls/doc/images/qtlabscontrols-tumbler.png)bin1123 -> 1123 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-accent.pngbin0 -> 1079 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-attributes.pngbin0 -> 6181 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-background.pngbin0 -> 1326 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-button.png (renamed from src/imports/controls/doc/images/qtlabscontrols-universal-button.png)bin674 -> 674 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-dark.png (renamed from src/imports/controls/doc/images/qtlabscontrols-universal-dark.png)bin2894 -> 2894 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.pngbin0 -> 1027 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-theme.pngbin0 -> 1386 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal.pngbin0 -> 25572 bytes
-rw-r--r--src/imports/controls/doc/qtlabscontrols.qdocconf64
-rw-r--r--src/imports/controls/doc/qtquickcontrols2.qdocconf98
-rw-r--r--src/imports/controls/doc/snippets/basic-example.qml2
-rw-r--r--src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml57
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-background.qml36
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-contentItem.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-busyindicator.qml32
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-background.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-disabled.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-focused.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-normal.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button-pressed.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-button.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-background.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-checked.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-indicator.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-label.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-checkbox.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml54
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml47
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-dial-background.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-dial-handle.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-dial.qml32
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-frame-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-frame-frame.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-frame.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox-background.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml48
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox-frame.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox-label.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-background.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-indicator.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-label.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate.qml46
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-label-background.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-label.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-menu-contentItem.qml58
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-menu.qml51
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pageindicator.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pane.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-progressbar-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-progressbar-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-progressbar-indicator.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-progressbar-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-background.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-checked.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-indicator.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-label.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-radiobutton.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-disabled.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle-focused.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-normal.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle-focused.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-track.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-rangeslider.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-background.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-handle.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-scrollbar.qml52
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-background.qml40
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-indicator.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator.qml52
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider-background.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider-handle.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider-track.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-slider.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-spinbox-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-spinbox-contentItem.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-spinbox-down.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-spinbox-textual.qml55
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-spinbox-up.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-spinbox.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-swipeview-indicator.qml63
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-background.qml37
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-checked.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-indicator.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-label.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-switch.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-tabbar.qml64
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-tabbutton.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-textarea.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-textfield-background.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-textfield-disabled.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-textfield-focused.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-textfield-normal.qml34
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-textfield.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbar-background.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbar-frame.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbar.qml45
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-label.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-toolbutton.qml35
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-tumbler-background.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-tumbler-contentItem.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-tumbler-delegate.qml47
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-tumbler.qml33
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml51
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml44
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml93
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml97
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml53
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml65
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml48
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml44
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml44
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml57
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml (renamed from src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml (renamed from src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml (renamed from src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml (renamed from src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml (renamed from src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml (renamed from src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml88
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml55
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml66
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml75
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml113
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml53
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml47
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml67
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml41
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml43
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml41
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml48
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml49
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml41
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml42
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml61
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml46
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml36
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml60
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml53
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml40
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml58
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml41
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml41
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml53
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml56
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml66
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml75
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml76
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml46
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml46
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml46
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml45
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml64
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml38
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml96
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml56
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml38
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml55
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml38
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml74
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml63
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml65
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml74
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml49
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-explicit.qml52
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml50
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml64
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml43
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml42
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml50
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml43
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml35
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml59
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml62
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml55
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml41
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml39
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml53
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml51
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml79
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml47
-rw-r--r--src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc4
-rw-r--r--src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc6
-rw-r--r--src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc13
-rw-r--r--src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc15
-rw-r--r--src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc63
-rw-r--r--src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc10
-rw-r--r--src/imports/controls/doc/src/includes/qquickswipedelegate-interaction.qdocinc5
-rw-r--r--src/imports/controls/doc/src/includes/qquickswitch.qdocinc28
-rw-r--r--src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc53
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-buttons.qdoc79
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-containers.qdoc97
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-customize.qdoc593
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-default.qdoc53
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-differences.qdoc283
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-examples.qdoc68
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-gettingstarted.qdoc71
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc62
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-index.qdoc64
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-indicators.qdoc67
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-input.qdoc83
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-material.qdoc200
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-menus.qdoc43
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-navigation.qdoc56
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-styles.qdoc119
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-universal.qdoc179
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols.qdoc62
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc162
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc94
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-containers.qdoc107
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-cppclasses.qdoc50
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc750
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-default.qdoc55
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc80
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-deployment.qdoc97
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc378
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc66
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-examples.qdoc35
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc141
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc71
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-guidelines.qdoc44
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-highdpi.qdoc62
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc99
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc82
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-input.qdoc114
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-material.qdoc367
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-menus.qdoc55
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc70
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc99
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc56
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc146
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc278
-rw-r--r--src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc54
-rw-r--r--src/imports/controls/doc/src/templates/qtlabstemplates.qdoc65
-rw-r--r--src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc54
-rw-r--r--src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc63
-rw-r--r--src/imports/controls/images/check@2x.pngbin766 -> 997 bytes
-rw-r--r--src/imports/controls/images/check@3x.pngbin1090 -> 1433 bytes
-rw-r--r--src/imports/controls/images/check@4x.pngbin1344 -> 1931 bytes
-rw-r--r--src/imports/controls/images/dial-indicator.pngbin185 -> 214 bytes
-rw-r--r--src/imports/controls/images/dial-indicator@2x.pngbin243 -> 306 bytes
-rw-r--r--src/imports/controls/images/dial-indicator@3x.pngbin284 -> 384 bytes
-rw-r--r--src/imports/controls/images/dial-indicator@4x.pngbin307 -> 463 bytes
-rw-r--r--src/imports/controls/images/double-arrow.pngbin0 -> 1275 bytes
-rw-r--r--src/imports/controls/images/double-arrow@2x.pngbin0 -> 1690 bytes
-rw-r--r--src/imports/controls/images/double-arrow@3x.pngbin0 -> 2059 bytes
-rw-r--r--src/imports/controls/images/double-arrow@4x.pngbin0 -> 2523 bytes
-rw-r--r--src/imports/controls/images/drop-indicator@4x.pngbin376 -> 507 bytes
-rw-r--r--src/imports/controls/material/ApplicationWindow.qml15
-rw-r--r--src/imports/controls/material/BoxShadow.qml69
-rw-r--r--src/imports/controls/material/BusyIndicator.qml12
-rw-r--r--src/imports/controls/material/Button.qml69
-rw-r--r--src/imports/controls/material/CheckBox.qml119
-rw-r--r--src/imports/controls/material/CheckDelegate.qml82
-rw-r--r--src/imports/controls/material/CheckIndicator.qml126
-rw-r--r--src/imports/controls/material/ComboBox.qml86
-rw-r--r--src/imports/controls/material/Dial.qml14
-rw-r--r--src/imports/controls/material/Drawer.qml36
-rw-r--r--src/imports/controls/material/ElevationEffect.qml279
-rw-r--r--src/imports/controls/material/Frame.qml29
-rw-r--r--src/imports/controls/material/GroupBox.qml30
-rw-r--r--src/imports/controls/material/ItemDelegate.qml109
-rw-r--r--src/imports/controls/material/Label.qml10
-rw-r--r--src/imports/controls/material/Menu.qml37
-rw-r--r--src/imports/controls/material/MenuItem.qml108
-rw-r--r--src/imports/controls/material/Page.qml12
-rw-r--r--src/imports/controls/material/PageIndicator.qml14
-rw-r--r--src/imports/controls/material/Pane.qml21
-rw-r--r--src/imports/controls/material/Popup.qml25
-rw-r--r--src/imports/controls/material/ProgressBar.qml25
-rw-r--r--src/imports/controls/material/RadioButton.qml63
-rw-r--r--src/imports/controls/material/RadioDelegate.qml81
-rw-r--r--src/imports/controls/material/RadioIndicator.qml69
-rw-r--r--src/imports/controls/material/RangeSlider.qml35
-rw-r--r--src/imports/controls/material/Ripple.qml6
-rw-r--r--src/imports/controls/material/ScrollBar.qml25
-rw-r--r--src/imports/controls/material/ScrollIndicator.qml22
-rw-r--r--src/imports/controls/material/Slider.qml37
-rw-r--r--src/imports/controls/material/SliderHandle.qml6
-rw-r--r--src/imports/controls/material/SpinBox.qml77
-rw-r--r--src/imports/controls/material/StackView.qml32
-rw-r--r--src/imports/controls/material/SwipeDelegate.qml100
-rw-r--r--src/imports/controls/material/SwipeView.qml8
-rw-r--r--src/imports/controls/material/Switch.qml79
-rw-r--r--src/imports/controls/material/SwitchDelegate.qml82
-rw-r--r--src/imports/controls/material/SwitchIndicator.qml90
-rw-r--r--src/imports/controls/material/TabBar.qml30
-rw-r--r--src/imports/controls/material/TabButton.qml27
-rw-r--r--src/imports/controls/material/TextArea.qml19
-rw-r--r--src/imports/controls/material/TextField.qml24
-rw-r--r--src/imports/controls/material/ToolBar.qml25
-rw-r--r--src/imports/controls/material/ToolButton.qml29
-rw-r--r--src/imports/controls/material/ToolTip.qml84
-rw-r--r--src/imports/controls/material/Tumbler.qml16
-rw-r--r--src/imports/controls/material/images/drop-indicator.pngbin342 -> 192 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator.svg5
-rw-r--r--src/imports/controls/material/images/drop-indicator@2x.pngbin273 -> 221 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@3x.pngbin406 -> 256 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@4x.pngbin520 -> 289 bytes
-rw-r--r--src/imports/controls/material/material.pri10
-rw-r--r--src/imports/controls/material/material.pro12
-rw-r--r--src/imports/controls/material/plugins.qmltypes92
-rw-r--r--src/imports/controls/material/qmldir8
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring.cpp57
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring_p.h14
-rw-r--r--src/imports/controls/material/qquickmaterialprogressstrip.cpp29
-rw-r--r--src/imports/controls/material/qquickmaterialprogressstrip_p.h14
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp772
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h125
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp43
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h22
-rw-r--r--src/imports/controls/material/qtlabsmaterialstyleplugin.cpp107
-rw-r--r--src/imports/controls/material/qtlabsmaterialstyleplugin.qrc12
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp112
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc12
-rw-r--r--src/imports/controls/plugins.qmltypes1534
-rw-r--r--src/imports/controls/qmldir8
-rw-r--r--src/imports/controls/qquickbusyindicatorring.cpp18
-rw-r--r--src/imports/controls/qquickbusyindicatorring_p.h20
-rw-r--r--src/imports/controls/qquickdialring.cpp126
-rw-r--r--src/imports/controls/qquickdialring_p.h84
-rw-r--r--src/imports/controls/qquickprogressstrip.cpp25
-rw-r--r--src/imports/controls/qquickprogressstrip_p.h14
-rw-r--r--src/imports/controls/qtlabscontrolsplugin.cpp130
-rw-r--r--src/imports/controls/qtlabscontrolsplugin.qrc16
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp150
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.qrc20
-rw-r--r--src/imports/controls/universal/ApplicationWindow.qml21
-rw-r--r--src/imports/controls/universal/BusyIndicator.qml12
-rw-r--r--src/imports/controls/universal/Button.qml38
-rw-r--r--src/imports/controls/universal/CheckBox.qml65
-rw-r--r--src/imports/controls/universal/CheckDelegate.qml90
-rw-r--r--src/imports/controls/universal/CheckIndicator.qml75
-rw-r--r--src/imports/controls/universal/ComboBox.qml64
-rw-r--r--src/imports/controls/universal/Dial.qml14
-rw-r--r--src/imports/controls/universal/Drawer.qml73
-rw-r--r--src/imports/controls/universal/Frame.qml17
-rw-r--r--src/imports/controls/universal/GroupBox.qml22
-rw-r--r--src/imports/controls/universal/ItemDelegate.qml54
-rw-r--r--src/imports/controls/universal/Label.qml11
-rw-r--r--src/imports/controls/universal/Menu.qml22
-rw-r--r--src/imports/controls/universal/MenuItem.qml49
-rw-r--r--src/imports/controls/universal/Page.qml14
-rw-r--r--src/imports/controls/universal/PageIndicator.qml12
-rw-r--r--src/imports/controls/universal/Pane.qml14
-rw-r--r--src/imports/controls/universal/Popup.qml8
-rw-r--r--src/imports/controls/universal/ProgressBar.qml46
-rw-r--r--src/imports/controls/universal/RadioButton.qml71
-rw-r--r--src/imports/controls/universal/RadioDelegate.qml92
-rw-r--r--src/imports/controls/universal/RadioIndicator.qml77
-rw-r--r--src/imports/controls/universal/RangeSlider.qml36
-rw-r--r--src/imports/controls/universal/ScrollBar.qml28
-rw-r--r--src/imports/controls/universal/ScrollIndicator.qml24
-rw-r--r--src/imports/controls/universal/Slider.qml20
-rw-r--r--src/imports/controls/universal/SpinBox.qml44
-rw-r--r--src/imports/controls/universal/StackView.qml28
-rw-r--r--src/imports/controls/universal/SwipeDelegate.qml105
-rw-r--r--src/imports/controls/universal/Switch.qml62
-rw-r--r--src/imports/controls/universal/SwitchDelegate.qml90
-rw-r--r--src/imports/controls/universal/SwitchIndicator.qml72
-rw-r--r--src/imports/controls/universal/TabBar.qml17
-rw-r--r--src/imports/controls/universal/TabButton.qml27
-rw-r--r--src/imports/controls/universal/TextArea.qml25
-rw-r--r--src/imports/controls/universal/TextField.qml31
-rw-r--r--src/imports/controls/universal/ToolBar.qml12
-rw-r--r--src/imports/controls/universal/ToolButton.qml31
-rw-r--r--src/imports/controls/universal/ToolTip.qml72
-rw-r--r--src/imports/controls/universal/Tumbler.qml18
-rw-r--r--src/imports/controls/universal/plugins.qmltypes61
-rw-r--r--src/imports/controls/universal/qmldir8
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle.cpp12
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle_p.h8
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider.cpp79
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider_p.h65
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring.cpp45
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring_p.h14
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip.cpp88
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip_p.h27
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp419
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle_p.h58
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme.cpp20
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme_p.h19
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp107
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc20
-rw-r--r--src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp111
-rw-r--r--src/imports/controls/universal/qtquickcontrols2universalstyleplugin.qrc20
-rw-r--r--src/imports/controls/universal/universal.pri11
-rw-r--r--src/imports/controls/universal/universal.pro12
-rw-r--r--src/imports/templates/plugins.qmltypes449
-rw-r--r--src/imports/templates/qmldir6
-rw-r--r--src/imports/templates/qtlabstemplatesplugin.cpp144
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp198
-rw-r--r--src/imports/templates/templates.pro10
-rw-r--r--src/quickcontrols2/qquickcolorimageprovider.cpp80
-rw-r--r--src/quickcontrols2/qquickcolorimageprovider_p.h69
-rw-r--r--src/quickcontrols2/qquickpaddedrectangle.cpp210
-rw-r--r--src/quickcontrols2/qquickpaddedrectangle_p.h119
-rw-r--r--src/quickcontrols2/qquickproxytheme.cpp168
-rw-r--r--src/quickcontrols2/qquickproxytheme_p.h98
-rw-r--r--src/quickcontrols2/qquickstyle.cpp220
-rw-r--r--src/quickcontrols2/qquickstyle.h56
-rw-r--r--src/quickcontrols2/qquickstyleattached.cpp259
-rw-r--r--src/quickcontrols2/qquickstyleattached_p.h94
-rw-r--r--src/quickcontrols2/qquickstyleplugin.cpp102
-rw-r--r--src/quickcontrols2/qquickstyleplugin_p.h81
-rw-r--r--src/quickcontrols2/qquickstyleselector.cpp165
-rw-r--r--src/quickcontrols2/qquickstyleselector_p.h77
-rw-r--r--src/quickcontrols2/qquickstyleselector_p_p.h65
-rw-r--r--src/quickcontrols2/qtquickcontrols2global.h56
-rw-r--r--src/quickcontrols2/qtquickcontrols2global_p.h55
-rw-r--r--src/quickcontrols2/quickcontrols2.pri18
-rw-r--r--src/quickcontrols2/quickcontrols2.pro14
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp640
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p.h146
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h102
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp871
-rw-r--r--src/quicktemplates2/qquickapplicationwindow_p.h166
-rw-r--r--src/quicktemplates2/qquickbusyindicator.cpp126
-rw-r--r--src/quicktemplates2/qquickbusyindicator_p.h85
-rw-r--r--src/quicktemplates2/qquickbutton.cpp202
-rw-r--r--src/quicktemplates2/qquickbutton_p.h95
-rw-r--r--src/quicktemplates2/qquickbuttongroup.cpp385
-rw-r--r--src/quicktemplates2/qquickbuttongroup_p.h118
-rw-r--r--src/quicktemplates2/qquickcheckbox.cpp197
-rw-r--r--src/quicktemplates2/qquickcheckbox_p.h95
-rw-r--r--src/quicktemplates2/qquickcheckdelegate.cpp194
-rw-r--r--src/quicktemplates2/qquickcheckdelegate_p.h95
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp1037
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h163
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp649
-rw-r--r--src/quicktemplates2/qquickcontainer_p.h116
-rw-r--r--src/quicktemplates2/qquickcontainer_p_p.h98
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp1226
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h215
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h148
-rw-r--r--src/quicktemplates2/qquickdial.cpp639
-rw-r--r--src/quicktemplates2/qquickdial_p.h152
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp634
-rw-r--r--src/quicktemplates2/qquickdrawer_p.h101
-rw-r--r--src/quicktemplates2/qquickdrawer_p_p.h96
-rw-r--r--src/quicktemplates2/qquickframe.cpp88
-rw-r--r--src/quicktemplates2/qquickframe_p.h80
-rw-r--r--src/quicktemplates2/qquickframe_p_p.h63
-rw-r--r--src/quicktemplates2/qquickgroupbox.cpp172
-rw-r--r--src/quicktemplates2/qquickgroupbox_p.h93
-rw-r--r--src/quicktemplates2/qquickitemdelegate.cpp135
-rw-r--r--src/quicktemplates2/qquickitemdelegate_p.h90
-rw-r--r--src/quicktemplates2/qquickitemdelegate_p_p.h67
-rw-r--r--src/quicktemplates2/qquicklabel.cpp275
-rw-r--r--src/quicktemplates2/qquicklabel_p.h94
-rw-r--r--src/quicktemplates2/qquicklabel_p_p.h99
-rw-r--r--src/quicktemplates2/qquickmenu.cpp532
-rw-r--r--src/quicktemplates2/qquickmenu_p.h107
-rw-r--r--src/quicktemplates2/qquickmenu_p_p.h101
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp167
-rw-r--r--src/quicktemplates2/qquickmenuitem_p.h91
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp433
-rw-r--r--src/quicktemplates2/qquickoverlay_p.h102
-rw-r--r--src/quicktemplates2/qquickoverlay_p_p.h98
-rw-r--r--src/quicktemplates2/qquickpage.cpp397
-rw-r--r--src/quicktemplates2/qquickpage_p.h108
-rw-r--r--src/quicktemplates2/qquickpageindicator.cpp330
-rw-r--r--src/quicktemplates2/qquickpageindicator_p.h108
-rw-r--r--src/quicktemplates2/qquickpane.cpp241
-rw-r--r--src/quicktemplates2/qquickpane_p.h102
-rw-r--r--src/quicktemplates2/qquickpane_p_p.h70
-rw-r--r--src/quicktemplates2/qquickpopup.cpp2398
-rw-r--r--src/quicktemplates2/qquickpopup_p.h384
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h238
-rw-r--r--src/quicktemplates2/qquickpresshandler.cpp114
-rw-r--r--src/quicktemplates2/qquickpresshandler_p_p.h82
-rw-r--r--src/quicktemplates2/qquickprogressbar.cpp276
-rw-r--r--src/quicktemplates2/qquickprogressbar_p.h110
-rw-r--r--src/quicktemplates2/qquickradiobutton.cpp112
-rw-r--r--src/quicktemplates2/qquickradiobutton_p.h74
-rw-r--r--src/quicktemplates2/qquickradiodelegate.cpp113
-rw-r--r--src/quicktemplates2/qquickradiodelegate_p.h76
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp932
-rw-r--r--src/quicktemplates2/qquickrangeslider_p.h175
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp717
-rw-r--r--src/quicktemplates2/qquickscrollbar_p.h150
-rw-r--r--src/quicktemplates2/qquickscrollindicator.cpp511
-rw-r--r--src/quicktemplates2/qquickscrollindicator_p.h133
-rw-r--r--src/quicktemplates2/qquickshortcutcontext.cpp83
-rw-r--r--src/quicktemplates2/qquickshortcutcontext_p_p.h65
-rw-r--r--src/quicktemplates2/qquickslider.cpp598
-rw-r--r--src/quicktemplates2/qquickslider_p.h150
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp814
-rw-r--r--src/quicktemplates2/qquickspinbox_p.h173
-rw-r--r--src/quicktemplates2/qquickstackview.cpp1041
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp557
-rw-r--r--src/quicktemplates2/qquickstackview_p.h193
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h163
-rw-r--r--src/quicktemplates2/qquickswipe_p.h117
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp930
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p.h91
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p_p.h76
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp363
-rw-r--r--src/quicktemplates2/qquickswipeview_p.h112
-rw-r--r--src/quicktemplates2/qquickswitch.cpp201
-rw-r--r--src/quicktemplates2/qquickswitch_p.h94
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp206
-rw-r--r--src/quicktemplates2/qquickswitchdelegate_p.h95
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp268
-rw-r--r--src/quicktemplates2/qquicktabbar_p.h98
-rw-r--r--src/quicktemplates2/qquicktabbutton.cpp85
-rw-r--r--src/quicktemplates2/qquicktabbutton_p.h74
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp666
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h148
-rw-r--r--src/quicktemplates2/qquicktextarea_p_p.h122
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp471
-rw-r--r--src/quicktemplates2/qquicktextfield_p.h120
-rw-r--r--src/quicktemplates2/qquicktextfield_p_p.h112
-rw-r--r--src/quicktemplates2/qquicktoolbar.cpp151
-rw-r--r--src/quicktemplates2/qquicktoolbar_p.h91
-rw-r--r--src/quicktemplates2/qquicktoolbutton.cpp77
-rw-r--r--src/quicktemplates2/qquicktoolbutton_p.h70
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp531
-rw-r--r--src/quicktemplates2/qquicktooltip_p.h149
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp603
-rw-r--r--src/quicktemplates2/qquicktumbler_p.h143
-rw-r--r--src/quicktemplates2/qquickvelocitycalculator.cpp108
-rw-r--r--src/quicktemplates2/qquickvelocitycalculator_p_p.h78
-rw-r--r--src/quicktemplates2/qtquicktemplates2global_p.h67
-rw-r--r--src/quicktemplates2/quicktemplates2.pri116
-rw-r--r--src/quicktemplates2/quicktemplates2.pro14
-rw-r--r--src/src.pro8
-rw-r--r--src/templates/qquickabstractbutton.cpp634
-rw-r--r--src/templates/qquickabstractbutton_p.h151
-rw-r--r--src/templates/qquickabstractbutton_p_p.h101
-rw-r--r--src/templates/qquickapplicationwindow.cpp638
-rw-r--r--src/templates/qquickapplicationwindow_p.h161
-rw-r--r--src/templates/qquickbusyindicator.cpp114
-rw-r--r--src/templates/qquickbusyindicator_p.h85
-rw-r--r--src/templates/qquickbutton.cpp97
-rw-r--r--src/templates/qquickbutton_p.h70
-rw-r--r--src/templates/qquickbuttongroup.cpp381
-rw-r--r--src/templates/qquickbuttongroup_p.h116
-rw-r--r--src/templates/qquickcheckbox.cpp189
-rw-r--r--src/templates/qquickcheckbox_p.h95
-rw-r--r--src/templates/qquickcombobox.cpp823
-rw-r--r--src/templates/qquickcombobox_p.h148
-rw-r--r--src/templates/qquickcontainer.cpp534
-rw-r--r--src/templates/qquickcontainer_p.h116
-rw-r--r--src/templates/qquickcontainer_p_p.h97
-rw-r--r--src/templates/qquickcontrol.cpp912
-rw-r--r--src/templates/qquickcontrol_p.h186
-rw-r--r--src/templates/qquickcontrol_p_p.h134
-rw-r--r--src/templates/qquickdial.cpp558
-rw-r--r--src/templates/qquickdial_p.h147
-rw-r--r--src/templates/qquickdrawer.cpp501
-rw-r--r--src/templates/qquickdrawer_p.h114
-rw-r--r--src/templates/qquickframe.cpp107
-rw-r--r--src/templates/qquickframe_p.h83
-rw-r--r--src/templates/qquickframe_p_p.h69
-rw-r--r--src/templates/qquickgroupbox.cpp147
-rw-r--r--src/templates/qquickgroupbox_p.h88
-rw-r--r--src/templates/qquickitemdelegate.cpp81
-rw-r--r--src/templates/qquickitemdelegate_p.h80
-rw-r--r--src/templates/qquicklabel.cpp240
-rw-r--r--src/templates/qquicklabel_p.h93
-rw-r--r--src/templates/qquicklabel_p_p.h93
-rw-r--r--src/templates/qquickmenu.cpp531
-rw-r--r--src/templates/qquickmenu_p.h106
-rw-r--r--src/templates/qquickmenu_p_p.h103
-rw-r--r--src/templates/qquickmenuitem.cpp107
-rw-r--r--src/templates/qquickmenuitem_p.h83
-rw-r--r--src/templates/qquickoverlay.cpp280
-rw-r--r--src/templates/qquickoverlay_p.h95
-rw-r--r--src/templates/qquickpage.cpp283
-rw-r--r--src/templates/qquickpage_p.h102
-rw-r--r--src/templates/qquickpageindicator.cpp297
-rw-r--r--src/templates/qquickpageindicator_p.h108
-rw-r--r--src/templates/qquickpane.cpp186
-rw-r--r--src/templates/qquickpane_p.h102
-rw-r--r--src/templates/qquickpane_p_p.h70
-rw-r--r--src/templates/qquickpopup.cpp1678
-rw-r--r--src/templates/qquickpopup_p.h340
-rw-r--r--src/templates/qquickpopup_p_p.h205
-rw-r--r--src/templates/qquickpressandholdhelper.cpp114
-rw-r--r--src/templates/qquickpressandholdhelper_p.h82
-rw-r--r--src/templates/qquickprogressbar.cpp274
-rw-r--r--src/templates/qquickprogressbar_p.h115
-rw-r--r--src/templates/qquickradiobutton.cpp111
-rw-r--r--src/templates/qquickradiobutton_p.h74
-rw-r--r--src/templates/qquickrangeslider.cpp949
-rw-r--r--src/templates/qquickrangeslider_p.h180
-rw-r--r--src/templates/qquickscrollbar.cpp532
-rw-r--r--src/templates/qquickscrollbar_p.h150
-rw-r--r--src/templates/qquickscrollindicator.cpp417
-rw-r--r--src/templates/qquickscrollindicator_p.h138
-rw-r--r--src/templates/qquickslider.cpp588
-rw-r--r--src/templates/qquickslider_p.h153
-rw-r--r--src/templates/qquickspinbox.cpp674
-rw-r--r--src/templates/qquickspinbox_p.h164
-rw-r--r--src/templates/qquickstackview.cpp983
-rw-r--r--src/templates/qquickstackview_p.cpp548
-rw-r--r--src/templates/qquickstackview_p.h189
-rw-r--r--src/templates/qquickstackview_p_p.h163
-rw-r--r--src/templates/qquickswipeview.cpp355
-rw-r--r--src/templates/qquickswipeview_p.h108
-rw-r--r--src/templates/qquickswitch.cpp255
-rw-r--r--src/templates/qquickswitch_p.h90
-rw-r--r--src/templates/qquicktabbar.cpp174
-rw-r--r--src/templates/qquicktabbar_p.h85
-rw-r--r--src/templates/qquicktabbutton.cpp82
-rw-r--r--src/templates/qquicktabbutton_p.h74
-rw-r--r--src/templates/qquicktextarea.cpp421
-rw-r--r--src/templates/qquicktextarea_p.h118
-rw-r--r--src/templates/qquicktextarea_p_p.h105
-rw-r--r--src/templates/qquicktextfield.cpp446
-rw-r--r--src/templates/qquicktextfield_p.h118
-rw-r--r--src/templates/qquicktextfield_p_p.h106
-rw-r--r--src/templates/qquicktoolbar.cpp106
-rw-r--r--src/templates/qquicktoolbar_p.h72
-rw-r--r--src/templates/qquicktoolbutton.cpp91
-rw-r--r--src/templates/qquicktoolbutton_p.h70
-rw-r--r--src/templates/qquicktumbler.cpp542
-rw-r--r--src/templates/qquicktumbler_p.h143
-rw-r--r--src/templates/qtlabstemplatesglobal_p.h67
-rw-r--r--src/templates/templates.pri97
-rw-r--r--src/templates/templates.pro14
1052 files changed, 49879 insertions, 35701 deletions
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
deleted file mode 100644
index 005ee839..00000000
--- a/src/controls/controls.pri
+++ /dev/null
@@ -1,12 +0,0 @@
-HEADERS += \
- $$PWD/qquickproxytheme_p.h \
- $$PWD/qquickstyle_p.h \
- $$PWD/qquickstyleselector_p.h \
- $$PWD/qquickstyleselector_p_p.h \
- $$PWD/qquickpaddedrectangle_p.h
-
-SOURCES += \
- $$PWD/qquickproxytheme.cpp \
- $$PWD/qquickstyle.cpp \
- $$PWD/qquickstyleselector.cpp \
- $$PWD/qquickpaddedrectangle.cpp
diff --git a/src/controls/controls.pro b/src/controls/controls.pro
deleted file mode 100644
index cb9a8683..00000000
--- a/src/controls/controls.pro
+++ /dev/null
@@ -1,11 +0,0 @@
-TARGET = QtLabsControls
-MODULE = labscontrols
-CONFIG += static internal_module
-
-QT += quick
-QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private
-
-DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
-
-include(controls.pri)
-load(qt_module)
diff --git a/src/controls/qquickpaddedrectangle.cpp b/src/controls/qquickpaddedrectangle.cpp
deleted file mode 100644
index 9542ca5f..00000000
--- a/src/controls/qquickpaddedrectangle.cpp
+++ /dev/null
@@ -1,210 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpaddedrectangle_p.h"
-
-#include <QtQuick/private/qsgadaptationlayer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QQuickPaddedRectangle::QQuickPaddedRectangle(QQuickItem *parent) :
- QQuickRectangle(parent), m_padding(0),
- m_topPadding(0), m_leftPadding(0), m_rightPadding(0), m_bottomPadding(0),
- m_hasTopPadding(false), m_hasLeftPadding(false), m_hasRightPadding(false), m_hasBottomPadding(false)
-{
-}
-
-qreal QQuickPaddedRectangle::padding() const
-{
- return m_padding;
-}
-
-void QQuickPaddedRectangle::setPadding(qreal padding)
-{
- if (!qFuzzyCompare(m_padding, padding)) {
- m_padding = padding;
- update();
- emit paddingChanged();
- if (m_hasTopPadding)
- emit topPaddingChanged();
- if (!m_hasLeftPadding)
- emit leftPaddingChanged();
- if (!m_hasRightPadding)
- emit rightPaddingChanged();
- if (!m_hasBottomPadding)
- emit bottomPaddingChanged();
- }
-}
-
-void QQuickPaddedRectangle::resetPadding()
-{
- setPadding(0);
-}
-
-qreal QQuickPaddedRectangle::topPadding() const
-{
- return m_hasTopPadding ? m_topPadding : m_padding;
-}
-
-void QQuickPaddedRectangle::setTopPadding(qreal padding)
-{
- setTopPadding(padding, true);
-}
-
-void QQuickPaddedRectangle::resetTopPadding()
-{
- setTopPadding(0, false);
-}
-
-qreal QQuickPaddedRectangle::leftPadding() const
-{
- return m_hasLeftPadding ? m_leftPadding : m_padding;
-}
-
-void QQuickPaddedRectangle::setLeftPadding(qreal padding)
-{
- setLeftPadding(padding, true);
-}
-
-void QQuickPaddedRectangle::resetLeftPadding()
-{
- setLeftPadding(0, false);
-}
-
-qreal QQuickPaddedRectangle::rightPadding() const
-{
- return m_hasRightPadding ? m_rightPadding : m_padding;
-}
-
-void QQuickPaddedRectangle::setRightPadding(qreal padding)
-{
- setRightPadding(padding, true);
-}
-
-void QQuickPaddedRectangle::resetRightPadding()
-{
- setRightPadding(0, false);
-}
-
-qreal QQuickPaddedRectangle::bottomPadding() const
-{
- return m_hasBottomPadding ? m_bottomPadding : m_padding;
-}
-
-void QQuickPaddedRectangle::setBottomPadding(qreal padding)
-{
- setBottomPadding(padding, true);
-}
-
-void QQuickPaddedRectangle::resetBottomPadding()
-{
- setBottomPadding(0, false);
-}
-
-void QQuickPaddedRectangle::setTopPadding(qreal padding, bool has)
-{
- qreal oldPadding = topPadding();
- m_hasTopPadding = has;
- m_topPadding = padding;
- if (!qFuzzyCompare(oldPadding, padding)) {
- update();
- emit topPaddingChanged();
- }
-}
-
-void QQuickPaddedRectangle::setLeftPadding(qreal padding, bool has)
-{
- qreal oldPadding = leftPadding();
- m_hasLeftPadding = has;
- m_leftPadding = padding;
- if (!qFuzzyCompare(oldPadding, padding)) {
- update();
- emit leftPaddingChanged();
- }
-}
-
-void QQuickPaddedRectangle::setRightPadding(qreal padding, bool has)
-{
- qreal oldPadding = rightPadding();
- m_hasRightPadding = has;
- m_rightPadding = padding;
- if (!qFuzzyCompare(oldPadding, padding)) {
- update();
- emit rightPaddingChanged();
- }
-}
-
-void QQuickPaddedRectangle::setBottomPadding(qreal padding, bool has)
-{
- qreal oldPadding = bottomPadding();
- m_hasBottomPadding = has;
- m_bottomPadding = padding;
- if (!qFuzzyCompare(oldPadding, padding)) {
- update();
- emit bottomPaddingChanged();
- }
-}
-
-QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
-{
- QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(node);
- if (!transformNode)
- transformNode = new QSGTransformNode;
-
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data));
-
- if (rectNode) {
- if (!transformNode->firstChild())
- transformNode->appendChildNode(rectNode);
-
- qreal top = topPadding();
- qreal left = leftPadding();
- qreal right = rightPadding();
- qreal bottom = bottomPadding();
-
- if (!qFuzzyIsNull(top) || !qFuzzyIsNull(left) || !qFuzzyIsNull(right) || !qFuzzyIsNull(bottom)) {
- QMatrix4x4 m;
- m.translate(left, top);
- transformNode->setMatrix(m);
-
- rectNode->setRect(boundingRect().adjusted(0, 0, -left-right, -top-bottom));
- rectNode->update();
- }
- }
- return transformNode;
-}
-
-QT_END_NAMESPACE
diff --git a/src/controls/qquickpaddedrectangle_p.h b/src/controls/qquickpaddedrectangle_p.h
deleted file mode 100644
index 5c0a8919..00000000
--- a/src/controls/qquickpaddedrectangle_p.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPADDEDRECTANGLE_P_H
-#define QQUICKPADDEDRECTANGLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquickrectangle_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPaddedRectangle : public QQuickRectangle
-{
- Q_OBJECT
- Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
- Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
- Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
- Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
- Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
-
-public:
- QQuickPaddedRectangle(QQuickItem *parent = Q_NULLPTR);
-
- qreal padding() const;
- void setPadding(qreal padding);
- void resetPadding();
-
- qreal topPadding() const;
- void setTopPadding(qreal padding);
- void resetTopPadding();
-
- qreal leftPadding() const;
- void setLeftPadding(qreal padding);
- void resetLeftPadding();
-
- qreal rightPadding() const;
- void setRightPadding(qreal padding);
- void resetRightPadding();
-
- qreal bottomPadding() const;
- void setBottomPadding(qreal padding);
- void resetBottomPadding();
-
-Q_SIGNALS:
- void paddingChanged();
- void topPaddingChanged();
- void leftPaddingChanged();
- void rightPaddingChanged();
- void bottomPaddingChanged();
-
-protected:
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
-
-private:
- void setTopPadding(qreal padding, bool has);
- void setLeftPadding(qreal padding, bool has);
- void setRightPadding(qreal padding, bool has);
- void setBottomPadding(qreal padding, bool has);
-
- qreal m_padding;
- qreal m_topPadding;
- qreal m_leftPadding;
- qreal m_rightPadding;
- qreal m_bottomPadding;
- bool m_hasTopPadding;
- bool m_hasLeftPadding;
- bool m_hasRightPadding;
- bool m_hasBottomPadding;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPaddedRectangle)
-
-#endif // QQUICKPADDEDRECTANGLE_P_H
diff --git a/src/controls/qquickproxytheme.cpp b/src/controls/qquickproxytheme.cpp
deleted file mode 100644
index dccd7f22..00000000
--- a/src/controls/qquickproxytheme.cpp
+++ /dev/null
@@ -1,181 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickproxytheme_p.h"
-
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qfont.h>
-
-QT_BEGIN_NAMESPACE
-
-QQuickProxyTheme::QQuickProxyTheme(QPlatformTheme *theme)
- : m_theme(theme)
-{
-}
-
-QQuickProxyTheme::~QQuickProxyTheme()
-{
-}
-
-QPlatformTheme *QQuickProxyTheme::theme() const
-{
- return m_theme;
-}
-
-QPlatformMenuItem *QQuickProxyTheme::createPlatformMenuItem() const
-{
- if (m_theme)
- return m_theme->createPlatformMenuItem();
- else
- return QPlatformTheme::createPlatformMenuItem();
-}
-
-QPlatformMenu *QQuickProxyTheme::createPlatformMenu() const
-{
- if (m_theme)
- return m_theme->createPlatformMenu();
- else
- return QPlatformTheme::createPlatformMenu();
-}
-
-QPlatformMenuBar *QQuickProxyTheme::createPlatformMenuBar() const
-{
- if (m_theme)
- return m_theme->createPlatformMenuBar();
- else
- return QPlatformTheme::createPlatformMenuBar();
-}
-
-void QQuickProxyTheme::showPlatformMenuBar()
-{
- if (m_theme)
- m_theme->showPlatformMenuBar();
- else
- QPlatformTheme::showPlatformMenuBar();
-}
-
-bool QQuickProxyTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
-{
- if (m_theme)
- return m_theme->usePlatformNativeDialog(type);
- else
- return QPlatformTheme::usePlatformNativeDialog(type);
-}
-
-QPlatformDialogHelper *QQuickProxyTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const
-{
- if (m_theme)
- return m_theme->createPlatformDialogHelper(type);
- else
- return QPlatformTheme::createPlatformDialogHelper(type);
-}
-
-#ifndef QT_NO_SYSTEMTRAYICON
-QPlatformSystemTrayIcon *QQuickProxyTheme::createPlatformSystemTrayIcon() const
-{
- if (m_theme)
- return m_theme->createPlatformSystemTrayIcon();
- else
- return QPlatformTheme::createPlatformSystemTrayIcon();
-}
-#endif
-
-const QPalette *QQuickProxyTheme::palette(QPlatformTheme::Palette type) const
-{
- if (m_theme)
- return m_theme->palette(type);
- else
- return QPlatformTheme::palette(type);
-}
-
-const QFont *QQuickProxyTheme::font(QPlatformTheme::Font type) const
-{
- if (m_theme)
- return m_theme->font(type);
- else
- return QPlatformTheme::font(type);
-}
-
-QVariant QQuickProxyTheme::themeHint(QPlatformTheme::ThemeHint hint) const
-{
- if (m_theme)
- return m_theme->themeHint(hint);
- else
- return QPlatformTheme::themeHint(hint);
-}
-
-QPixmap QQuickProxyTheme::standardPixmap(QPlatformTheme::StandardPixmap sp, const QSizeF &size) const
-{
- if (m_theme)
- return m_theme->standardPixmap(sp, size);
- else
- return QPlatformTheme::standardPixmap(sp, size);
-}
-
-QPixmap QQuickProxyTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, QPlatformTheme::IconOptions iconOptions) const
-{
- if (m_theme)
- return m_theme->fileIconPixmap(fileInfo, size, iconOptions);
- else
- return QPlatformTheme::fileIconPixmap(fileInfo, size, iconOptions);
-}
-
-QIconEngine *QQuickProxyTheme::createIconEngine(const QString &iconName) const
-{
- if (m_theme)
- return m_theme->createIconEngine(iconName);
- else
- return QPlatformTheme::createIconEngine(iconName);
-}
-
-QList<QKeySequence> QQuickProxyTheme::keyBindings(QKeySequence::StandardKey key) const
-{
- if (m_theme)
- return m_theme->keyBindings(key);
- else
- return QPlatformTheme::keyBindings(key);
-}
-
-QString QQuickProxyTheme::standardButtonText(int button) const
-{
- if (m_theme)
- return m_theme->standardButtonText(button);
- else
- return QPlatformTheme::standardButtonText(button);
-}
-
-QT_END_NAMESPACE
diff --git a/src/controls/qquickproxytheme_p.h b/src/controls/qquickproxytheme_p.h
deleted file mode 100644
index 47f931b5..00000000
--- a/src/controls/qquickproxytheme_p.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPROXYTHEME_H
-#define QQUICKPROXYTHEME_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickProxyTheme : public QPlatformTheme
-{
-public:
- QQuickProxyTheme(QPlatformTheme *theme);
-
- ~QQuickProxyTheme();
-
- 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;
-
- bool usePlatformNativeDialog(DialogType type) const Q_DECL_OVERRIDE;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_SYSTEMTRAYICON
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const Q_DECL_OVERRIDE;
-#endif
-
- const QPalette *palette(Palette type = SystemPalette) const Q_DECL_OVERRIDE;
-
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
-
- QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
-
- QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const Q_DECL_OVERRIDE;
- QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
- QPlatformTheme::IconOptions iconOptions = 0) const Q_DECL_OVERRIDE;
-
- QIconEngine *createIconEngine(const QString &iconName) const Q_DECL_OVERRIDE;
-
- QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const Q_DECL_OVERRIDE;
-
- QString standardButtonText(int button) const Q_DECL_OVERRIDE;
-
-private:
- QPlatformTheme *m_theme;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKPROXYTHEME_H
diff --git a/src/controls/qquickstyle.cpp b/src/controls/qquickstyle.cpp
deleted file mode 100644
index 76cb24cc..00000000
--- a/src/controls/qquickstyle.cpp
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickstyle_p.h"
-
-#include <QtCore/qfile.h>
-#include <QtCore/qsettings.h>
-#include <QtCore/qfileselector.h>
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtLabsTemplates/private/qquickpopup_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static QQuickStyle *attachedStyle(const QMetaObject *type, QObject *object, bool create = false)
-{
- if (!object)
- return Q_NULLPTR;
- int idx = -1;
- return qobject_cast<QQuickStyle *>(qmlAttachedPropertiesObject(&idx, object, type, create));
-}
-
-static QQuickStyle *findParentStyle(const QMetaObject *type, QObject *object)
-{
- QQuickItem *item = qobject_cast<QQuickItem *>(object);
- if (item) {
- // lookup parent items and popups
- QQuickItem *parent = item->parentItem();
- while (parent) {
- QQuickStyle *style = attachedStyle(type, parent);
- if (style)
- return style;
-
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent->parent());
- if (popup)
- return attachedStyle(type, popup);
-
- parent = parent->parentItem();
- }
-
- // fallback to item's window
- QQuickStyle *style = attachedStyle(type, item->window());
- if (style)
- return style;
- } else {
- // lookup popup's window
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(object);
- if (popup)
- return attachedStyle(type, popup->popupItem()->window());
- }
-
- // lookup parent window
- QQuickWindow *window = qobject_cast<QQuickWindow *>(object);
- if (window) {
- QQuickWindow *parentWindow = qobject_cast<QQuickWindow *>(window->parent());
- if (parentWindow) {
- QQuickStyle *style = attachedStyle(type, window);
- if (style)
- return style;
- }
- }
-
- // fallback to engine (global)
- if (object) {
- QQmlEngine *engine = qmlEngine(object);
- if (engine) {
- QByteArray name = QByteArray("_q_") + type->className();
- QQuickStyle *style = engine->property(name).value<QQuickStyle*>();
- if (!style) {
- style = attachedStyle(type, engine, true);
- engine->setProperty(name, QVariant::fromValue(style));
- }
- return style;
- }
- }
-
- return Q_NULLPTR;
-}
-
-static QList<QQuickStyle *> findChildStyles(const QMetaObject *type, QObject *object)
-{
- QList<QQuickStyle *> children;
-
- QQuickItem *item = qobject_cast<QQuickItem *>(object);
- if (!item) {
- QQuickWindow *window = qobject_cast<QQuickWindow *>(object);
- if (window) {
- item = window->contentItem();
-
- foreach (QObject *child, window->children()) {
- QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child);
- if (childWindow) {
- QQuickStyle *style = attachedStyle(type, childWindow);
- if (style)
- children += style;
- }
- }
- }
- }
-
- if (item) {
- foreach (QQuickItem *child, item->childItems()) {
- QQuickStyle *style = attachedStyle(type, child);
- if (style)
- children += style;
- else
- children += findChildStyles(type, child);
- }
- }
-
- return children;
-}
-
-QQuickStyle::QQuickStyle(QObject *parent) : QObject(parent)
-{
- QQuickItem *item = qobject_cast<QQuickItem *>(parent);
- if (!item) {
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent);
- if (popup)
- item = popup->popupItem();
- }
-
- if (item)
- QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
-}
-
-QQuickStyle::~QQuickStyle()
-{
- QQuickItem *item = qobject_cast<QQuickItem *>(parent());
- if (item)
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
-
- setParentStyle(Q_NULLPTR);
-}
-
-QSharedPointer<QSettings> QQuickStyle::settings(const QString &group)
-{
-#ifndef QT_NO_SETTINGS
- const QString filePath = QStringLiteral(":/qtlabscontrols.conf");
- if (QFile::exists(filePath)) {
- QFileSelector selector;
- QSettings *settings = new QSettings(selector.select(filePath), QSettings::IniFormat);
- if (!group.isEmpty())
- settings->beginGroup(group);
- return QSharedPointer<QSettings>(settings);
- }
-#endif // QT_NO_SETTINGS
- return QSharedPointer<QSettings>();
-}
-
-QList<QQuickStyle *> QQuickStyle::childStyles() const
-{
- return m_childStyles;
-}
-
-QQuickStyle *QQuickStyle::parentStyle() const
-{
- return m_parentStyle;
-}
-
-void QQuickStyle::setParentStyle(QQuickStyle *style)
-{
- if (m_parentStyle != style) {
- QQuickStyle *oldParent = m_parentStyle;
- if (m_parentStyle)
- m_parentStyle->m_childStyles.removeOne(this);
- m_parentStyle = style;
- if (style)
- style->m_childStyles.append(this);
- parentStyleChange(style, oldParent);
- }
-}
-
-void QQuickStyle::init()
-{
- QQuickStyle *parentStyle = findParentStyle(metaObject(), parent());
- if (parentStyle)
- setParentStyle(parentStyle);
-
- QList<QQuickStyle *> children = findChildStyles(metaObject(), parent());
- foreach (QQuickStyle *child, children)
- child->setParentStyle(this);
-}
-
-void QQuickStyle::parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent)
-{
- Q_UNUSED(newParent);
- Q_UNUSED(oldParent);
-}
-
-void QQuickStyle::itemParentChanged(QQuickItem *item, QQuickItem *parent)
-{
- Q_UNUSED(parent);
- setParentStyle(findParentStyle(metaObject(), item));
-}
-
-QT_END_NAMESPACE
diff --git a/src/controls/qquickstyle_p.h b/src/controls/qquickstyle_p.h
deleted file mode 100644
index 02ee667a..00000000
--- a/src/controls/qquickstyle_p.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSTYLE_P_H
-#define QQUICKSTYLE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml/qqml.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qsharedpointer.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QSettings;
-
-class QQuickStyle : public QObject, public QQuickItemChangeListener
-{
- Q_OBJECT
-
-public:
- explicit QQuickStyle(QObject *parent = Q_NULLPTR);
- ~QQuickStyle();
-
- static QSharedPointer<QSettings> settings(const QString &group = QString());
-
-protected:
- void init();
-
- QList<QQuickStyle *> childStyles() const;
-
- QQuickStyle *parentStyle() const;
- void setParentStyle(QQuickStyle *style);
-
- virtual void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent);
-
- void itemParentChanged(QQuickItem *item, QQuickItem *parent) Q_DECL_OVERRIDE;
-
-private:
- QList<QQuickStyle *> m_childStyles;
- QPointer<QQuickStyle> m_parentStyle;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSTYLE_P_H
diff --git a/src/controls/qquickstyleselector.cpp b/src/controls/qquickstyleselector.cpp
deleted file mode 100644
index b8a15ee9..00000000
--- a/src/controls/qquickstyleselector.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickstyleselector_p.h"
-#include "qquickstyleselector_p_p.h"
-
-#include <QtCore/QFile>
-#include <QtCore/QDir>
-#include <QtCore/QMutex>
-#include <QtCore/QMutexLocker>
-#include <QtCore/QUrl>
-#include <QtCore/QFileInfo>
-#include <QtCore/QLocale>
-#include <QtCore/QDebug>
-#include <QtCore/QSettings>
-
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtLabsControls/private/qquickstyle_p.h>
-
-QT_BEGIN_NAMESPACE
-
-Q_GLOBAL_STATIC(QQuickStyleSelectorSharedData, sharedData);
-static QBasicMutex sharedDataMutex;
-
-QQuickStyleSelectorPrivate::QQuickStyleSelectorPrivate()
-{
-}
-
-QQuickStyleSelector::QQuickStyleSelector() : d_ptr(new QQuickStyleSelectorPrivate)
-{
- Q_D(QQuickStyleSelector);
- d->style = QGuiApplicationPrivate::styleOverride.toLower();
- if (d->style.isEmpty())
- d->style = QString::fromLatin1(qgetenv("QT_LABS_CONTROLS_STYLE")).toLower();
- if (d->style.isEmpty()) {
- QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Controls"));
- if (settings)
- d->style = settings->value(QStringLiteral("Style")).toString().toLower();
- }
-}
-
-QQuickStyleSelector::~QQuickStyleSelector()
-{
-}
-
-static bool isLocalScheme(const QString &file)
-{
- bool local = file == QLatin1String("qrc");
-#ifdef Q_OS_ANDROID
- local |= file == QLatin1String("assets");
-#endif
- return local;
-}
-
-QString QQuickStyleSelector::select(const QString &filePath) const
-{
- Q_D(const QQuickStyleSelector);
- QUrl url(d->baseUrl.toString() + filePath);
- if (isLocalScheme(url.scheme()) || url.isLocalFile()) {
- if (isLocalScheme(url.scheme())) {
- QString equivalentPath = QLatin1Char(':') + url.path();
- QString selectedPath = d->select(equivalentPath);
- url.setPath(selectedPath.remove(0, 1));
- } else {
- url = QUrl::fromLocalFile(d->select(url.toLocalFile()));
- }
- }
- return url.toString();
-}
-
-static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors)
-{
- /* selectionHelper does a depth-first search of possible selected files. Because there is strict
- selector ordering in the API, we can stop checking as soon as we find the file in a directory
- which does not contain any other valid selector directories.
- */
- Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/')));
-
- foreach (const QString &s, selectors) {
- QString prospectiveBase = path + s + QLatin1Char('/');
- QStringList remainingSelectors = selectors;
- remainingSelectors.removeAll(s);
- if (!QDir(prospectiveBase).exists())
- continue;
- QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors);
- if (!prospectiveFile.isEmpty())
- return prospectiveFile;
- }
-
- // 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))
- return QString();
- return path + fileName;
-}
-
-QString QQuickStyleSelectorPrivate::select(const QString &filePath) const
-{
- QFileInfo fi(filePath);
- // If file doesn't exist, don't select
- if (!fi.exists())
- return filePath;
-
- QString ret = selectionHelper(fi.path().isEmpty() ? QString() : fi.path() + QLatin1Char('/'),
- fi.fileName(), allSelectors());
-
- if (!ret.isEmpty())
- return ret;
- return filePath;
-}
-
-QString QQuickStyleSelector::style() const
-{
- Q_D(const QQuickStyleSelector);
- return d->style;
-}
-
-void QQuickStyleSelector::setStyle(const QString &s)
-{
- Q_D(QQuickStyleSelector);
- d->style = s;
-}
-
-QStringList QQuickStyleSelectorPrivate::allSelectors() const
-{
- QMutexLocker locker(&sharedDataMutex);
- updateSelectors();
- QStringList selectors = sharedData->staticSelectors;
- if (!style.isEmpty())
- selectors.prepend(style);
- return selectors;
-}
-
-void QQuickStyleSelector::setBaseUrl(const QUrl &base)
-{
- Q_D(QQuickStyleSelector);
- if (d->baseUrl != base)
- d->baseUrl = base;
-}
-
-QUrl QQuickStyleSelector::baseUrl() const
-{
- Q_D(const QQuickStyleSelector);
- return d->baseUrl;
-}
-
-void QQuickStyleSelectorPrivate::updateSelectors()
-{
- if (!sharedData->staticSelectors.isEmpty())
- return; //Already loaded
-
- sharedData->staticSelectors << sharedData->preloadedStatics; //Potential for static selectors from other modules
-
- // TODO: Update on locale changed?
- sharedData->staticSelectors << QLocale().name();
-
- sharedData->staticSelectors << platformSelectors();
-}
-
-QStringList QQuickStyleSelectorPrivate::platformSelectors()
-{
- // similar, but not identical to QSysInfo::osType
- QStringList ret;
-#if defined(Q_OS_WIN)
- // can't fall back to QSysInfo because we need both "winphone" and "winrt" for the Windows Phone case
- ret << QStringLiteral("windows");
- ret << QSysInfo::kernelType(); // "wince" and "winnt"
-# if defined(Q_OS_WINRT)
- ret << QStringLiteral("winrt");
-# if defined(Q_OS_WINPHONE)
- ret << QStringLiteral("winphone");
-# endif
-# endif
-#elif defined(Q_OS_UNIX)
- ret << QStringLiteral("unix");
-# if !defined(Q_OS_ANDROID) && !defined(Q_OS_BLACKBERRY)
- // we don't want "linux" for Android or "qnx" for Blackberry here
- ret << QSysInfo::kernelType();
-# ifdef Q_OS_MAC
- ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
-# endif
-# endif
- QString productName = QSysInfo::productType();
- if (productName != QLatin1String("unknown"))
- ret << productName; // "opensuse", "fedora", "osx", "ios", "blackberry", "android"
-#endif
- return ret;
-}
-
-void QQuickStyleSelectorPrivate::addStatics(const QStringList &statics)
-{
- QMutexLocker locker(&sharedDataMutex);
- sharedData->preloadedStatics << statics;
-}
-
-QT_END_NAMESPACE
diff --git a/src/controls/qquickstyleselector_p.h b/src/controls/qquickstyleselector_p.h
deleted file mode 100644
index 2ca6ea3a..00000000
--- a/src/controls/qquickstyleselector_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSTYLESELECTOR_P_H
-#define QQUICKSTYLESELECTOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qurl.h>
-#include <QtCore/qscopedpointer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickStyleSelectorPrivate;
-class QQuickStyleSelector
-{
-public:
- explicit QQuickStyleSelector();
- ~QQuickStyleSelector();
-
- QString select(const QString &filePath) const;
-
- QString style() const;
- void setStyle(const QString &s);
-
- void setBaseUrl(const QUrl &base);
- QUrl baseUrl() const;
-
-private:
- Q_DECLARE_PRIVATE(QQuickStyleSelector)
- QScopedPointer<QQuickStyleSelectorPrivate> d_ptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSTYLESELECTOR_P_H
diff --git a/src/controls/qquickstyleselector_p_p.h b/src/controls/qquickstyleselector_p_p.h
deleted file mode 100644
index e4df1035..00000000
--- a/src/controls/qquickstyleselector_p_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/***************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL21$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSTYLESELECTOR_P_P_H
-#define QQUICKSTYLESELECTOR_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/QString>
-#include <QtCore/QUrl>
-#include <private/qobject_p.h>
-#include <QtCore/qstringlist.h>
-
-#include "qquickstyleselector_p.h"
-
-QT_BEGIN_NAMESPACE
-
-struct QQuickStyleSelectorSharedData //Not QSharedData because currently is just a global store
-{
- QStringList staticSelectors;
- QStringList preloadedStatics;
-};
-
-class QQuickStyleSelectorPrivate
-{
-public:
- static void updateSelectors();
- static QStringList platformSelectors();
- static void addStatics(const QStringList &); //For loading GUI statics from other Qt modules
- QQuickStyleSelectorPrivate();
- QString select(const QString &filePath) const;
- QStringList allSelectors() const;
-
- QString style;
- QUrl baseUrl;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSTYLESELECTOR_P_P_H
-
diff --git a/src/imports/calendar/calendar.pro b/src/imports/calendar/calendar.pro
index 0dee3cb1..8e9446cc 100644
--- a/src/imports/calendar/calendar.pro
+++ b/src/imports/calendar/calendar.pro
@@ -3,7 +3,7 @@ TARGETPATH = Qt/labs/calendar
IMPORT_VERSION = 1.0
QT += qml quick
-QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private
+QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
diff --git a/src/imports/calendar/plugins.qmltypes b/src/imports/calendar/plugins.qmltypes
index 74c407c4..2ad527f7 100644
--- a/src/imports/calendar/plugins.qmltypes
+++ b/src/imports/calendar/plugins.qmltypes
@@ -78,7 +78,12 @@ Module {
Property { name: "spacing"; type: "double" }
Property { name: "locale"; type: "QLocale" }
Property { name: "mirrored"; type: "bool"; isReadonly: true }
+ Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Property { name: "visualFocus"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; type: "bool" }
+ Property { name: "wheelEnabled"; type: "bool" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
}
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..b630adc9 100644
--- a/src/imports/calendar/qquickdayofweekrow.cpp
+++ b/src/imports/calendar/qquickdayofweekrow.cpp
@@ -37,7 +37,7 @@
#include "qquickdayofweekrow_p.h"
#include "qquickdayofweekmodel_p.h"
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
QT_BEGIN_NAMESPACE
@@ -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..51d2c329 100644
--- a/src/imports/calendar/qquickdayofweekrow_p.h
+++ b/src/imports/calendar/qquickdayofweekrow_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -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 fde4a71d..d03067ff 100644
--- a/src/imports/calendar/qquickmonthgrid.cpp
+++ b/src/imports/calendar/qquickmonthgrid.cpp
@@ -39,7 +39,7 @@
#include <QtGui/qstylehints.h>
#include <QtGui/qguiapplication.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
#include <QtQml/qqmlinfo.h>
QT_BEGIN_NAMESPACE
@@ -73,12 +73,36 @@ QT_BEGIN_NAMESPACE
\sa DayOfWeekRow, WeekNumberColumn, CalendarModel
*/
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::pressed(date date)
+
+ This signal is emitted when \a date is pressed.
+*/
+
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::released(date date)
+
+ This signal is emitted when \a date is released.
+*/
+
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::clicked(date date)
+
+ This signal is emitted when \a date is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.calendar::MonthGrid::pressAndHold(date date)
+
+ This signal is emitted when \a date is pressed and held down.
+*/
+
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 +132,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 +144,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 +175,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 +360,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..9d8d65d1 100644
--- a/src/imports/calendar/qquickmonthgrid_p.h
+++ b/src/imports/calendar/qquickmonthgrid_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -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 f31497c6..e18daf19 100644
--- a/src/imports/calendar/qquickweeknumbercolumn.cpp
+++ b/src/imports/calendar/qquickweeknumbercolumn.cpp
@@ -37,7 +37,7 @@
#include "qquickweeknumbercolumn_p.h"
#include "qquickweeknumbermodel_p.h"
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
#include <QtQml/qqmlinfo.h>
QT_BEGIN_NAMESPACE
@@ -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..bf3da66e 100644
--- a/src/imports/calendar/qquickweeknumbercolumn_p.h
+++ b/src/imports/calendar/qquickweeknumbercolumn_p.h
@@ -48,7 +48,7 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -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 074dc4a7..b42f64f2 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 QQmlExtensionInterface_iid)
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/AbstractButton.qml b/src/imports/controls/AbstractButton.qml
new file mode 100644
index 00000000..487b452b
--- /dev/null
+++ b/src/imports/controls/AbstractButton.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.AbstractButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem ? contentItem.y + contentItem.baselineOffset : 0
+}
diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml
index 5c43c956..98de8946 100644
--- a/src/imports/controls/ApplicationWindow.qml
+++ b/src/imports/controls/ApplicationWindow.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -36,14 +36,18 @@
import QtQuick 2.6
import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.ApplicationWindow {
id: window
color: "#ffffff"
- overlay.background: Rectangle {
+ overlay.modal: Rectangle {
color: "#7f28282a"
}
+
+ overlay.modeless: Rectangle {
+ color: "#1f28282a"
+ }
}
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index 1c55e75d..9be1f046 100644
--- a/src/imports/controls/BusyIndicator.qml
+++ b/src/imports/controls/BusyIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,9 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.controls.impl 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+import QtQuick.Templates 2.0 as T
T.BusyIndicator {
id: control
@@ -47,7 +47,6 @@ T.BusyIndicator {
padding: 6
- //! [contentItem]
contentItem: BusyRing {
id: ring
implicitWidth: 48
@@ -61,5 +60,4 @@ T.BusyIndicator {
running: control.visible && control.running
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
index 290f4ce4..1a974eed 100644
--- a/src/imports/controls/Button.qml
+++ b/src/imports/controls/Button.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,44 +35,39 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
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
+ leftPadding: padding + 2
+ rightPadding: padding + 2
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
+ contentItem: Text {
text: control.text
font: control.font
- opacity: enabled || highlighted ? 1 : 0.3
- color: control.highlighted ? "#ffffff" : (control.pressed ? "#26282a" : "#353637")
+ opacity: enabled || control.highlighted || control.checked ? 1 : 0.3
+ color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637"))
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
- //! [label]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
- opacity: enabled ? 1 : 0.3
- color: control.pressed ? (control.highlighted ? "#585a5c" : "#e4e4e4") : (control.highlighted ? "#353637" : "#f6f6f6")
- border.color: control.pressed ? "#26282a" : "#353637"
+ visible: !control.flat || control.down || control.checked || control.highlighted
+ color: control.checked || control.highlighted ?
+ (control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) :
+ (control.visualFocus ? (control.down ? "#cce0ff" : "#f0f6ff") : (control.down ? "#d0d0d0" : "#e0e0e0"))
+ border.color: "#0066ff"
+ border.width: control.visualFocus ? 2 : 0
}
- //! [background]
}
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index 4b7af3b1..632097b1 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,66 +35,40 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.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
padding: 6
spacing: 6
- opacity: enabled ? 1 : 0.2
- //! [indicator]
- indicator: Rectangle {
- implicitWidth: 28
- implicitHeight: 28
+ indicator: CheckIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
-
- color: control.enabled ? (control.pressed ? "#e4e4e4" : "#f6f6f6") : "#353637"
- border.color: control.enabled ? (control.pressed ? "#26282a" : "#353637") : "transparent"
-
- Image {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/check.png"
- visible: control.checkState === Qt.Checked
- }
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 16
- height: 3
- color: "#353637"
- visible: control.checkState === Qt.PartiallyChecked
- }
+ control: control
}
- //! [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: 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
- color: control.pressed ? "#26282a" : "#353637"
+ color: control.down ? "#26282a" : "#353637"
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+ opacity: enabled ? 1 : 0.3
}
- //! [label]
}
diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml
new file mode 100644
index 00000000..96cb48e0
--- /dev/null
+++ b/src/imports/controls/CheckDelegate.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+
+T.CheckDelegate {
+ id: control
+
+ 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: 12
+ spacing: 12
+
+ contentItem: Text {
+ leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? "#26282a" : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ indicator: CheckIndicator {
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ control: control
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.down || control.highlighted
+ color: control.down ? "#bdbebf" : "#eeeeee"
+ }
+}
diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml
new file mode 100644
index 00000000..5aad92ef
--- /dev/null
+++ b/src/imports/controls/CheckIndicator.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+
+Rectangle {
+ id: indicator
+
+ property Item control
+
+ implicitWidth: 28
+ implicitHeight: 28
+
+ color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : "#ffffff") : "#353637"
+ border.width: control.visualFocus ? 2 : 1
+ border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "transparent"
+ opacity: enabled ? 1 : 0.3
+
+ Image {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ source: "image://default/check/" + (control.visualFocus ? "#0066ff" : "#353637")
+ sourceSize.width: width
+ sourceSize.height: height
+ visible: control.checkState === Qt.Checked
+ }
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 16
+ height: 3
+ color: control.visualFocus ? "#0066ff" : "#353637"
+ visible: control.checkState === Qt.PartiallyChecked
+ }
+}
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 2745a0d8..31f2e5d9 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -36,7 +36,8 @@
import QtQuick 2.6
import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
T.ComboBox {
id: control
@@ -44,79 +45,77 @@ T.ComboBox {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 8
padding: 6
- leftPadding: 8
- rightPadding: 8
+ leftPadding: padding + 6
+ rightPadding: padding + 6
- //! [delegate]
delegate: ItemDelegate {
- width: control.width
+ width: control.popup.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
- checkable: true
- autoExclusive: true
- checked: control.currentIndex === index
- highlighted: control.highlightedIndex === index
- pressed: highlighted && control.pressed
+ font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
+ highlighted: control.highlightedIndex == index
+ }
+
+ indicator: Image {
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+ source: "image://default/double-arrow/" + (control.visualFocus ? "#0066ff" : "#353637")
+ sourceSize.width: width
+ sourceSize.height: height
+ opacity: enabled ? 1 : 0.3
}
- //! [delegate]
- //! [contentItem]
contentItem: Text {
+ leftPadding: control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
+ rightPadding: !control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
+
text: control.displayText
font: control.font
- color: "#ffffff"
+ color: control.visualFocus ? "#0066ff" : "#353637"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
- rightPadding: 18 + control.spacing
+ opacity: enabled ? 1 : 0.3
}
- //! [contentItem]
- //! [background]
- background: Item {
+ background: Rectangle {
implicitWidth: 120
implicitHeight: 40
- Rectangle {
- width: parent.width
- height: parent.height
- opacity: control.enabled ? 1.0 : 0.2
- color: control.pressed || popup.visible ? "#585A5C" : "#353637"
- }
-
- Image {
- x: parent.width - width - control.rightPadding
- y: (parent.height - height) / 2
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/drop-indicator.png"
- }
+ color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#f0f6ff") :
+ (control.pressed || popup.visible ? "#d0d0d0" : "#e0e0e0")
+ border.color: "#0066ff"
+ border.width: control.visualFocus ? 2 : 0
}
- //! [background]
- //! [popup]
popup: T.Popup {
- y: control.height - 1
- implicitWidth: control.width
- implicitHeight: listview.contentHeight
+ y: control.height - (control.visualFocus ? 0 : 1)
+ width: control.width
+ implicitHeight: contentItem.implicitHeight
topMargin: 6
bottomMargin: 6
contentItem: ListView {
id: listview
clip: true
+ implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
+ highlightRangeMode: ListView.ApplyRange
+ highlightMoveDuration: 0
Rectangle {
z: 10
parent: listview
width: listview.width
height: listview.height
- border.color: "#353637"
color: "transparent"
+ border.color: "#bdbebf"
}
T.ScrollIndicator.vertical: ScrollIndicator { }
@@ -124,5 +123,4 @@ T.ComboBox {
background: Rectangle { }
}
- //! [popup]
}
diff --git a/src/imports/controls/Container.qml b/src/imports/controls/Container.qml
new file mode 100644
index 00000000..9e9215f8
--- /dev/null
+++ b/src/imports/controls/Container.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.Container {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+}
diff --git a/src/imports/controls/Control.qml b/src/imports/controls/Control.qml
new file mode 100644
index 00000000..a4bb95fe
--- /dev/null
+++ b/src/imports/controls/Control.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.Control {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+}
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index b6752d55..cd4d6ba2 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+import QtQuick.Templates 2.0 as T
T.Dial {
id: control
@@ -43,29 +45,28 @@ T.Dial {
implicitWidth: 184
implicitHeight: 184
- //! [background]
- background: Rectangle {
- x: control.width / 2 - width / 2
- y: control.height / 2 - height / 2
- width: Math.max(64, Math.min(control.width, control.height))
- height: Math.max(64, Math.min(control.width, control.height))
- radius: width / 2
- border.color: "#353637"
+ background: DialRing {
+ width: control.availableWidth
+ height: control.availableHeight
+ color: control.visualFocus ? "#0066ff" : "#353637"
+ progress: control.position
+ opacity: control.enabled ? 1 : 0.3
}
- //! [background]
- //! [handle]
handle: Image {
id: handleItem
x: background.x + background.width / 2 - handle.width / 2
y: background.y + background.height / 2 - handle.height / 2
width: 14
height: 10
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/dial-indicator.png"
+ source: "image://default/dial-indicator/" + (control.visualFocus ? "#0066ff" : "#353637")
+ sourceSize.width: width
+ sourceSize.height: height
antialiasing: true
+ opacity: control.enabled ? 1 : 0.3
transform: [
Translate {
- y: -background.height * 0.4 + handle.height / 2
+ y: -Math.min(background.width, background.height) * 0.4 + handle.height / 2
},
Rotation {
angle: control.angle
@@ -74,5 +75,4 @@ T.Dial {
}
]
}
- //! [handle]
}
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml
index 60abeb0c..6e9ab71f 100644
--- a/src/imports/controls/Drawer.qml
+++ b/src/imports/controls/Drawer.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,18 +35,37 @@
****************************************************************************/
import QtQuick 2.6
-import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Drawer {
id: control
- parent: T.ApplicationWindow.overlay || Window.contentItem
- width: parent ? parent.width : 0 // TODO: Window.width
- height: parent ? parent.height : 0 // TODO: Window.height
+ parent: T.ApplicationWindow.overlay
- // TODO: make this a proper transition
- animation: SmoothedAnimation {
- velocity: 5
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
+ topPadding: control.edge === Qt.BottomEdge
+ leftPadding: control.edge === Qt.RightEdge
+ rightPadding: control.edge === Qt.LeftEdge
+ bottomPadding: control.edge === Qt.TopEdge
+
+ enter: Transition { SmoothedAnimation { velocity: 5 } }
+ exit: Transition { SmoothedAnimation { velocity: 5 } }
+
+ contentItem: Item { }
+
+ background: Rectangle {
+ Rectangle {
+ readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge
+ width: horizontal ? 1 : parent.width
+ height: horizontal ? parent.height : 1
+ color: "#353637"
+ x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0
+ y: control.edge === Qt.TopEdge ? parent.height - 1 : 0
+ }
}
}
diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml
index 3c9326e1..b7968cb4 100644
--- a/src/imports/controls/Frame.qml
+++ b/src/imports/controls/Frame.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Frame {
id: control
@@ -46,19 +46,12 @@ T.Frame {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- padding: 6
+ padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
-
- //! [frame]
- frame: Rectangle {
- width: parent.width
- height: parent.height
+ background: Rectangle {
color: "transparent"
border.color: "#bdbebf"
}
- //! [frame]
}
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index bc1801c2..31f4963f 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.GroupBox {
id: control
@@ -49,14 +49,11 @@ T.GroupBox {
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
spacing: 6
- padding: 6
- topPadding: 6 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ padding: 12
+ topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [label]
label: Text {
x: control.leftPadding
width: control.availableWidth
@@ -68,10 +65,8 @@ T.GroupBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [frame]
- frame: Rectangle {
+ background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
height: parent.height - control.topPadding + control.padding
@@ -79,5 +74,4 @@ T.GroupBox {
color: "transparent"
border.color: "#bdbebf"
}
- //! [frame]
}
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index b5dfb4b6..519ef3bf 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,29 +35,24 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
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: Text {
+ leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+ rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
text: control.text
font: control.font
@@ -67,24 +62,11 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [indicator]
- indicator: Image {
- x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
- y: control.topPadding + (control.availableHeight - height) / 2
-
- visible: control.checked
- source: control.checkable ? "qrc:/qt-project.org/imports/Qt/labs/controls/images/check.png" : ""
- }
- //! [indicator]
-
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
- visible: control.pressed || control.highlighted
- color: control.pressed ? "#bdbebf" : "#eeeeee"
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee")
}
- //! [background]
}
diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml
index 1047bfaa..d0f01613 100644
--- a/src/imports/controls/Label.qml
+++ b/src/imports/controls/Label.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Label {
id: control
diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml
index 6692ef08..d9a97cee 100644
--- a/src/imports/controls/Menu.qml
+++ b/src/imports/controls/Menu.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,18 +35,19 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
T.Menu {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.min(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight + topPadding + bottomPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+
+ margins: 0
- //! [contentItem]
contentItem: ListView {
implicitHeight: contentHeight
model: control.contentModel
@@ -58,14 +59,11 @@ T.Menu {
ScrollIndicator.vertical: ScrollIndicator {}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 200
- implicitHeight: 200
+ implicitHeight: 40
color: "#ffffff"
border.color: "#353637"
}
- //! [background]
}
diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml
index ae5a8e38..69f00900 100644
--- a/src/imports/controls/MenuItem.qml
+++ b/src/imports/controls/MenuItem.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,26 +35,23 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.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: 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,19 +61,15 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [indicator]
indicator: Image {
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
y: control.topPadding + (control.availableHeight - height) / 2
visible: control.checked
- source: control.checkable ? "qrc:/qt-project.org/imports/Qt/labs/controls/images/check.png" : ""
+ source: control.checkable ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/check.png" : ""
}
- //! [indicator]
- //! [background]
background: Item {
implicitWidth: 200
implicitHeight: 40
@@ -86,8 +79,7 @@ T.MenuItem {
y: 1
width: parent.width - 2
height: parent.height - 2
- color: control.activeFocus || control.pressed ? "#eeeeee" : "transparent"
+ color: control.visualFocus || control.down ? "#eeeeee" : "transparent"
}
}
- //! [background]
}
diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml
index 37eb57d0..4ed7efb1 100644
--- a/src/imports/controls/Page.qml
+++ b/src/imports/controls/Page.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,18 +35,14 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Page {
id: control
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: "#ffffff"
}
- //! [background]
}
diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml
index e569a0de..933bc839 100644
--- a/src/imports/controls/PageIndicator.qml
+++ b/src/imports/controls/PageIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.PageIndicator {
id: control
@@ -48,7 +48,6 @@ T.PageIndicator {
padding: 6
spacing: 6
- //! [delegate]
delegate: Rectangle {
implicitWidth: 8
implicitHeight: 8
@@ -59,9 +58,7 @@ T.PageIndicator {
opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45
Behavior on opacity { OpacityAnimator { duration: 100 } }
}
- //! [delegate]
- //! [contentItem]
contentItem: Row {
spacing: control.spacing
@@ -70,5 +67,4 @@ T.PageIndicator {
delegate: control.delegate
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml
index 7b95cd8a..feb8eb58 100644
--- a/src/imports/controls/Pane.qml
+++ b/src/imports/controls/Pane.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Pane {
id: control
@@ -46,15 +46,11 @@ T.Pane {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- padding: 6
+ padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: "#ffffff"
}
- //! [background]
}
diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml
index 309c317b..72428f23 100644
--- a/src/imports/controls/Popup.qml
+++ b/src/imports/controls/Popup.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Popup {
id: control
@@ -48,7 +48,7 @@ T.Popup {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- padding: 6
+ padding: 12
contentItem: Item { }
diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml
index 795fd231..45e990ee 100644
--- a/src/imports/controls/ProgressBar.qml
+++ b/src/imports/controls/ProgressBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,24 +35,22 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.impl 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
T.ProgressBar {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- indicator ? indicator.implicitWidth : 0) + leftPadding + rightPadding
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
+ contentItem.implicitHeight + topPadding + bottomPadding)
- //! [indicator]
- indicator: ProgressStrip {
+ contentItem: ProgressStrip {
id: strip
- x: control.leftPadding
- y: control.topPadding + (control.availableHeight - height) / 2
- width: control.availableWidth
- height: 6
+ implicitHeight: 6
+ implicitWidth: 116
scale: control.mirrored ? -1 : 1
progress: control.position
indeterminate: control.indeterminate
@@ -62,9 +60,7 @@ T.ProgressBar {
running: control.visible && control.indeterminate
}
}
- //! [indicator]
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 6
@@ -75,5 +71,4 @@ T.ProgressBar {
color: "#e4e4e4"
}
- //! [background]
}
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 8e1e0bce..1100273a 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,63 +35,40 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+import QtQuick.Templates 2.0 as T
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
- opacity: enabled ? 1 : 0.2
- //! [indicator]
- indicator: Rectangle {
- implicitWidth: 28
- implicitHeight: 28
+ indicator: RadioIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
-
- radius: width / 2
- border.width: 1
- border.color: (control.pressed ? "#26282a" : "#353637")
- color: control.pressed ? "#e4e4e4" : "#f6f6f6"
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 20
- height: 20
- radius: width / 2
- color: control.pressed ? "#26282a" : "#353637"
- visible: control.checked
- }
+ control: control
}
- //! [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: 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
- color: control.pressed ? "#26282a" : "#353637"
+ color: control.down ? "#26282a" : "#353637"
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+ opacity: enabled ? 1 : 0.3
}
- //! [label]
}
diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml
new file mode 100644
index 00000000..620417a8
--- /dev/null
+++ b/src/imports/controls/RadioDelegate.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+import QtQuick.Templates 2.0 as T
+
+T.RadioDelegate {
+ id: control
+
+ 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: 12
+ spacing: 12
+
+ contentItem: Text {
+ leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? "#26282a" : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ indicator: RadioIndicator {
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ control: control
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.down || control.highlighted
+ color: control.down ? "#bdbebf" : "#eeeeee"
+ }
+}
diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml
new file mode 100644
index 00000000..05ff6673
--- /dev/null
+++ b/src/imports/controls/RadioIndicator.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+
+Rectangle {
+ implicitWidth: 28
+ implicitHeight: 28
+
+ radius: width / 2
+ color: control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")
+ border.width: control.visualFocus ? 2 : 1
+ border.color: control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")
+ opacity: enabled ? 1 : 0.3
+
+ property Item control
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 20
+ height: 20
+ radius: width / 2
+ color: control.down ? "#26282a" : "#353637"
+ visible: control.checked
+ }
+}
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml
index 9a74d4c8..181550a4 100644
--- a/src/imports/controls/RangeSlider.qml
+++ b/src/imports/controls/RangeSlider.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,23 +35,20 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.RangeSlider {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(track ? track.implicitWidth : 0,
- first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
+ Math.max(first.handle ? first.handle.implicitWidth : 0,
+ second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(track ? track.implicitHeight : 0,
- first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ Math.max(first.handle ? first.handle.implicitHeight : 0,
+ second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
padding: 6
- //! [firstHandle]
first.handle: Rectangle {
x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
@@ -59,14 +56,12 @@ T.RangeSlider {
implicitHeight: 28
radius: width / 2
border.width: activeFocus ? 2 : 1
- border.color: "#353637"
- color: first.pressed ? "#bdbebf" : "#ffffff"
+ border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6"
+ color: control.enabled ? (first.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [firstHandle]
- //! [secondHandle]
second.handle: Rectangle {
x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height))
@@ -74,15 +69,13 @@ T.RangeSlider {
implicitHeight: 28
radius: width / 2
border.width: activeFocus ? 2 : 1
- border.color: "#353637"
- color: second.pressed ? "#bdbebf" : "#ffffff"
+ border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6"
+ color: control.enabled ? (second.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [secondHandle]
- //! [track]
- track: Rectangle {
+ background: Rectangle {
x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
implicitWidth: horizontal ? 200 : 6
@@ -90,11 +83,9 @@ T.RangeSlider {
width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight
radius: 3
- border.color: "#353637"
- color: "#ffffff"
+ color: "#e0e0e0"
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [track]
}
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
index b9ebd634..c77463aa 100644
--- a/src/imports/controls/ScrollBar.qml
+++ b/src/imports/controls/ScrollBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,20 +35,19 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.ScrollBar {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- handle.implicitWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- handle.implicitHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
padding: 2
- //! [handle]
- handle: Rectangle {
+ contentItem: Rectangle {
id: handle
implicitWidth: 6
@@ -59,12 +58,6 @@ T.ScrollBar {
visible: control.size < 1.0
opacity: 0.0
- readonly property bool horizontal: control.orientation === Qt.Horizontal
- x: control.leftPadding + (horizontal ? control.position * control.availableWidth : 0)
- y: control.topPadding + (horizontal ? 0 : control.position * control.availableHeight)
- width: horizontal ? control.size * control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.size * control.availableHeight
-
states: State {
name: "active"
when: control.active
@@ -79,5 +72,4 @@ T.ScrollBar {
}
}
}
- //! [handle]
}
diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml
index e2fc23b1..c129e5b8 100644
--- a/src/imports/controls/ScrollIndicator.qml
+++ b/src/imports/controls/ScrollIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,20 +35,19 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.ScrollIndicator {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- indicator.implicitWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- indicator.implicitHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
padding: 2
- //! [indicator]
- indicator: Rectangle {
+ contentItem: Rectangle {
id: indicator
implicitWidth: 2
@@ -58,12 +57,6 @@ T.ScrollIndicator {
visible: control.size < 1.0
opacity: 0.0
- readonly property bool horizontal: control.orientation === Qt.Horizontal
- x: control.leftPadding + (horizontal ? control.position * control.width : 0)
- y: control.topPadding + (horizontal ? 0 : control.position * control.height)
- width: horizontal ? control.size * control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.size * control.availableHeight
-
states: State {
name: "active"
when: control.active
@@ -80,5 +73,4 @@ T.ScrollIndicator {
}
]
}
- //! [indicator]
}
diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml
index 95cfc54e..5e4dc699 100644
--- a/src/imports/controls/Slider.qml
+++ b/src/imports/controls/Slider.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,36 +35,32 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.Slider {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(track ? track.implicitWidth : 0,
- handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
+ (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(track ? track.implicitHeight : 0,
- handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
padding: 6
- //! [handle]
handle: Rectangle {
x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
implicitWidth: 28
implicitHeight: 28
radius: width / 2
- border.color: "#353637"
- color: control.pressed ? "#bdbebf" : "#f6f6f6"
+ color: control.enabled ? (control.pressed ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
+ border.width: control.visualFocus ? 2 : 1
+ border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.pressed ? "#808080" : "#909090")) : "#d6d6d6"
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [handle]
- //! [track]
- track: Rectangle {
+ background: Rectangle {
x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
implicitWidth: horizontal ? 200 : 6
@@ -72,11 +68,9 @@ T.Slider {
width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight
radius: 3
- border.color: "#353637"
- color: "#ffffff"
+ color: "#e0e0e0"
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [track]
}
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
index 77f89206..dee368e2 100644
--- a/src/imports/controls/SpinBox.qml
+++ b/src/imports/controls/SpinBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.SpinBox {
id: control
@@ -51,83 +51,84 @@ T.SpinBox {
baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
- leftPadding: 6 + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
- rightPadding: 6 + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
- opacity: control.enabled ? 1 : 0.3
+ leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
+ rightPadding: padding + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
- //! [validator]
validator: IntValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
}
- //! [validator]
- //! [contentItem]
contentItem: TextInput {
+ z: 2
text: control.textFromValue(control.value, control.locale)
+ opacity: control.enabled ? 1 : 0.3
font: control.font
color: "#353637"
- selectionColor: "#fddd5c"
- selectedTextColor: color
+ selectionColor: "#0066ff"
+ selectedTextColor: "#ffffff"
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
+ readOnly: !control.editable
validator: control.validator
inputMethodHints: Qt.ImhFormattedNumbersOnly
+
+ Rectangle {
+ x: -6 - (down.indicator ? 1 : 0)
+ y: -6
+ width: control.width - (up.indicator ? up.indicator.width - 1 : 0) - (down.indicator ? down.indicator.width - 1 : 0)
+ height: control.height
+ visible: control.activeFocus
+ color: "transparent"
+ border.color: "#0066ff"
+ border.width: 2
+ }
}
- //! [contentItem]
- //! [up.indicator]
up.indicator: Rectangle {
x: control.mirrored ? 0 : parent.width - width
height: parent.height
implicitWidth: 40
implicitHeight: 40
- color: up.pressed ? "#e4e4e4" : "#f6f6f6"
- border.color: control.enabled ? "#353637" : "#bdbebf"
+ color: up.pressed ? "#d0d0d0" : "#e0e0e0"
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width / 3
height: 2
- color: control.enabled ? "#353637" : "#bdbebf"
+ color: enabled ? "#353637" : "#bdbebf"
}
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 2
height: parent.width / 3
- color: control.enabled ? "#353637" : "#bdbebf"
+ color: enabled ? "#353637" : "#bdbebf"
}
}
- //! [up.indicator]
- //! [down.indicator]
down.indicator: Rectangle {
x: control.mirrored ? parent.width - width : 0
height: parent.height
implicitWidth: 40
implicitHeight: 40
- color: down.pressed ? "#e4e4e4" : "#f6f6f6"
- border.color: control.enabled ? "#353637" : "#bdbebf"
+ color: down.pressed ? "#d0d0d0" : "#e0e0e0"
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width / 3
height: 2
- color: control.enabled ? "#353637" : "#bdbebf"
+ color: enabled ? "#353637" : "#bdbebf"
}
}
- //! [down.indicator]
- //! [background]
background: Rectangle {
implicitWidth: 140
- border.color: "#bdbebf"
+ border.color: "#e0e0e0"
}
- //! [background]
}
diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml
index f0869307..f70ecf97 100644
--- a/src/imports/controls/StackView.qml
+++ b/src/imports/controls/StackView.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,45 +35,33 @@
****************************************************************************/
import QtQuick 2.4
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
T.StackView {
- id: root
+ id: control
- //! [popEnter]
popEnter: Transition {
- XAnimator { from: (root.mirrored ? -1 : 1) * -root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ XAnimator { from: (control.mirrored ? -1 : 1) * -control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
- //! [popEnter]
- //! [popExit]
popExit: Transition {
- XAnimator { from: 0; to: (root.mirrored ? -1 : 1) * root.width; duration: 400; easing.type: Easing.OutCubic }
+ XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * control.width; duration: 400; easing.type: Easing.OutCubic }
}
- //! [popExit]
- //! [pushEnter]
pushEnter: Transition {
- XAnimator { from: (root.mirrored ? -1 : 1) * root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
- //! [pushEnter]
- //! [pushExit]
pushExit: Transition {
- XAnimator { from: 0; to: (root.mirrored ? -1 : 1) * -root.width; duration: 400; easing.type: Easing.OutCubic }
+ XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic }
}
- //! [pushExit]
- //! [replaceEnter]
replaceEnter: Transition {
- XAnimator { from: (root.mirrored ? -1 : 1) * root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
- //! [replaceEnter]
- //! [replaceExit]
replaceExit: Transition {
- XAnimator { from: 0; to: (root.mirrored ? -1 : 1) * -root.width; duration: 400; easing.type: Easing.OutCubic }
+ XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic }
}
- //! [replaceExit]
}
diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml
new file mode 100644
index 00000000..6c84dae0
--- /dev/null
+++ b/src/imports/controls/SwipeDelegate.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.SwipeDelegate {
+ id: control
+
+ 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: 12
+ spacing: 12
+
+ contentItem: Text {
+ leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+ rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? "#26282a" : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+
+ background: Rectangle {
+ color: control.visualFocus ? (control.down ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#ffffff")
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml
index 52248961..c4e5a570 100644
--- a/src/imports/controls/SwipeView.qml
+++ b/src/imports/controls/SwipeView.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
T.SwipeView {
id: control
@@ -46,9 +46,6 @@ T.SwipeView {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem.implicitHeight + topPadding + bottomPadding)
- Accessible.role: Accessible.PageTabList
-
- //! [contentItem]
contentItem: ListView {
model: control.contentModel
currentIndex: control.currentIndex
@@ -63,5 +60,4 @@ T.SwipeView {
preferredHighlightEnd: 0
highlightMoveDuration: 250
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 51348e77..b4717d05 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,64 +35,32 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
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
- //! [indicator]
- indicator: Item {
+ indicator: SwitchIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 56
- implicitHeight: 28
-
- Rectangle {
- y: parent.height / 2 - height / 2
- width: 56
- height: 16
- radius: 8
- border.width: 1
- color: control.checked ? "#353637" : "transparent"
- border.color: control.checked ? "transparent" : "#353637"
- }
-
- Rectangle {
- x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2)))
- y: (parent.height - height) / 2
- width: 28
- height: 28
- radius: 16
- color: control.pressed ? "#e4e4e4" : "#f6f6f6"
- border.width: 1
- border.color: control.pressed ? "#26282a" : "#353637"
-
- Behavior on x {
- enabled: !control.pressed
- SmoothedAnimation { velocity: 200 }
- }
- }
+ control: control
}
- //! [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: 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 +70,4 @@ T.Switch {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
}
diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml
new file mode 100644
index 00000000..f5383628
--- /dev/null
+++ b/src/imports/controls/SwitchDelegate.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+
+T.SwitchDelegate {
+ id: control
+
+ 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: 12
+ spacing: 12
+
+ indicator: SwitchIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.indicator && control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? "#26282a" : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.down || control.highlighted
+ color: control.down ? "#bdbebf" : "#eeeeee"
+ }
+}
diff --git a/src/imports/controls/SwitchIndicator.qml b/src/imports/controls/SwitchIndicator.qml
new file mode 100644
index 00000000..261d9999
--- /dev/null
+++ b/src/imports/controls/SwitchIndicator.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+
+Item {
+ implicitWidth: 56
+ implicitHeight: 28
+
+ property Item control
+
+ Rectangle {
+ y: parent.height / 2 - height / 2
+ width: 56
+ height: 16
+ radius: 8
+ color: control.checked ? (control.visualFocus ? "#0066ff" : "#353637") : "#e0e0e0"
+ border.width: control.visualFocus ? 2 : 0
+ border.color: "#0066ff"
+ }
+
+ Rectangle {
+ x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2)))
+ y: (parent.height - height) / 2
+ width: 28
+ height: 28
+ radius: 16
+ color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
+ border.width: control.visualFocus ? 2 : 1
+ border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "#d6d6d6"
+
+ Behavior on x {
+ enabled: !control.down
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+}
diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml
index f43975f2..22b5329e 100644
--- a/src/imports/controls/TabBar.qml
+++ b/src/imports/controls/TabBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick 2.7
+import QtQuick.Templates 2.0 as T
T.TabBar {
id: control
@@ -47,7 +47,6 @@ T.TabBar {
spacing: 1
- //! [contentItem]
contentItem: ListView {
implicitWidth: contentWidth
implicitHeight: 40
@@ -58,11 +57,14 @@ T.TabBar {
spacing: control.spacing
orientation: ListView.Horizontal
boundsBehavior: Flickable.StopAtBounds
+ flickableDirection: Flickable.AutoFlickIfNeeded
snapMode: ListView.SnapToItem
+
+ highlightMoveDuration: 0
+ highlightRangeMode: ListView.ApplyRange
+ preferredHighlightBegin: 40
+ preferredHighlightEnd: width - 40
}
- //! [contentItem]
- //! [background]
background: Rectangle { }
- //! [background]
}
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index 178a0a7f..2c5b2708 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,40 +35,31 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.contentWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.contentHeight + 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: Text {
text: control.text
font: control.font
elide: Text.ElideRight
opacity: enabled ? 1 : 0.3
- color: !control.checked ? "#ffffff" : control.pressed ? "#26282a" : "#353637"
+ color: !control.checked ? "#ffffff" : control.down ? "#26282a" : "#353637"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Rectangle {
implicitHeight: 40
- color: control.pressed ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637")
+ color: control.down ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637")
}
- //! [background]
}
diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml
index 8326fc89..f1ec6dfa 100644
--- a/src/imports/controls/TextArea.qml
+++ b/src/imports/controls/TextArea.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.TextArea {
id: control
@@ -48,7 +48,7 @@ T.TextArea {
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
- leftPadding: 10
+ leftPadding: padding + 4
opacity: enabled ? 1 : 0.2
color: "#353637"
@@ -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..fc07e7bb 100644
--- a/src/imports/controls/TextField.qml
+++ b/src/imports/controls/TextField.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,18 +35,20 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.TextField {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
- leftPadding: 10
+ leftPadding: padding + 4
opacity: enabled ? 1 : 0.2
color: "#353637"
@@ -66,17 +68,15 @@ 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
}
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
-// border.width: control.activeFocus ? 2 : 1
- color: control.enabled ? "transparent" : "#353637"
- border.color: control.enabled ? "#bdbebf" : "transparent"
+ border.width: control.activeFocus ? 2 : 1
+ color: control.enabled ? "#ffffff" : "#353637"
+ border.color: control.activeFocus ? "#0066ff" : (control.enabled ? "#bdbebf" : "transparent")
}
- //! [background]
}
diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml
index 7e0f80a3..02b6c6f3 100644
--- a/src/imports/controls/ToolBar.qml
+++ b/src/imports/controls/ToolBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.ToolBar {
id: control
@@ -46,14 +46,10 @@ T.ToolBar {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitHeight: 40
color: "#eeeeee"
}
- //! [background]
}
diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml
index 314ce966..1fda5ba3 100644
--- a/src/imports/controls/ToolButton.qml
+++ b/src/imports/controls/ToolButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,43 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
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: Text {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#c2c2c2"
+ color: control.enabled ? (control.visualFocus ? "#0066ff" : "#26282a") : "#c2c2c2"
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Rectangle {
implicitWidth: 40
implicitHeight: 40
color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0)
- opacity: control.pressed ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0
- visible: control.pressed || (control.enabled && (control.checked || control.highlighted))
+ opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0
+ visible: control.down || (control.enabled && (control.checked || control.highlighted))
}
- //! [background]
}
diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml
new file mode 100644
index 00000000..322757c7
--- /dev/null
+++ b/src/imports/controls/ToolTip.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
+
+T.ToolTip {
+ id: control
+
+ x: parent ? (parent.width - implicitWidth) / 2 : 0
+ y: -implicitHeight - 3
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ margins: 6
+ padding: 6
+
+ closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ // TODO: wrapMode: Label.Wrap
+ }
+
+ background: Rectangle {
+ border.color: "#353637"
+ }
+}
diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml
index 8ff310de..571d8089 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,27 +35,24 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
T.Tumbler {
id: control
implicitWidth: 60
implicitHeight: 200
- //! [delegate]
delegate: Text {
id: label
text: modelData
- color: "#666666"
+ color: control.visualFocus ? "#0066ff" : "#26282a"
font: control.font
- opacity: 0.4 + Math.max(0, 1 - Math.abs(Tumbler.displacement)) * 0.6
+ opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [delegate]
- //! [contentItem]
contentItem: PathView {
id: pathView
model: control.model
@@ -77,5 +74,4 @@ T.Tumbler {
property real delegateHeight: control.availableHeight / control.visibleItemCount
}
- //! [contentItem]
}
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index c3391929..dcbcf8e1 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -1,9 +1,24 @@
-QML_FILES = \
+HEADERS += \
+ $$PWD/qquickbusyindicatorring_p.h \
+ $$PWD/qquickprogressstrip_p.h \
+ $$PWD/qquickdialring_p.h
+
+SOURCES += \
+ $$PWD/qquickbusyindicatorring.cpp \
+ $$PWD/qquickprogressstrip.cpp \
+ $$PWD/qquickdialring.cpp
+
+QML_CONTROLS = \
+ AbstractButton.qml \
ApplicationWindow.qml \
BusyIndicator.qml \
Button.qml \
CheckBox.qml \
+ CheckDelegate.qml \
+ CheckIndicator.qml \
ComboBox.qml \
+ Container.qml \
+ Control.qml \
Dial.qml \
Drawer.qml \
Frame.qml \
@@ -18,13 +33,18 @@ QML_FILES = \
Popup.qml \
ProgressBar.qml \
RadioButton.qml \
+ RadioDelegate.qml \
+ RadioIndicator.qml \
RangeSlider.qml \
ScrollBar.qml \
ScrollIndicator.qml \
Slider.qml \
SpinBox.qml \
StackView.qml \
+ SwipeDelegate.qml \
Switch.qml \
+ SwitchIndicator.qml \
+ SwitchDelegate.qml \
SwipeView.qml \
TabBar.qml \
TabButton.qml \
@@ -32,4 +52,7 @@ QML_FILES = \
TextField.qml \
ToolBar.qml \
ToolButton.qml \
+ ToolTip.qml \
Tumbler.qml
+
+!qtquickcompiler: QML_FILES += $$QML_CONTROLS
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index a9861617..15c07cf0 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -1,31 +1,30 @@
-TARGET = qtlabscontrolsplugin
-TARGETPATH = Qt/labs/controls
-IMPORT_VERSION = 1.0
+TARGET = qtquickcontrols2plugin
+TARGETPATH = QtQuick/Controls.2
+IMPORT_VERSION = 2.0
QT += qml quick
-QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private
+QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
-QMAKE_DOCS = $$PWD/doc/qtlabscontrols.qdocconf
-
OTHER_FILES += \
qmldir
-HEADERS += \
- $$PWD/qquickbusyindicatorring_p.h \
- $$PWD/qquickprogressstrip_p.h
-
SOURCES += \
- $$PWD/qtlabscontrolsplugin.cpp \
- $$PWD/qquickbusyindicatorring.cpp \
- $$PWD/qquickprogressstrip.cpp
+ $$PWD/qtquickcontrols2plugin.cpp
RESOURCES += \
- $$PWD/qtlabscontrolsplugin.qrc
+ $$PWD/qtquickcontrols2plugin.qrc
include(controls.pri)
!static: include(designer/designer.pri)
+include(doc/doc.pri)
+
+qtquickcompiler {
+ qmlfiles.prefix = /qt-project.org/imports/QtQuick/Controls.2
+ qmlfiles.files += $$QML_CONTROLS
+ RESOURCES += qmlfiles
+}
CONFIG += no_cxx_module
load(qml_plugin)
diff --git a/src/imports/controls/designer/BusyIndicatorSpecifics.qml b/src/imports/controls/designer/BusyIndicatorSpecifics.qml
index 679377f4..c8a84759 100644
--- a/src/imports/controls/designer/BusyIndicatorSpecifics.qml
+++ b/src/imports/controls/designer/BusyIndicatorSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ButtonSection.qml b/src/imports/controls/designer/ButtonSection.qml
index 2353bad2..b14988c8 100644
--- a/src/imports/controls/designer/ButtonSection.qml
+++ b/src/imports/controls/designer/ButtonSection.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ButtonSpecifics.qml b/src/imports/controls/designer/ButtonSpecifics.qml
index 92ccefa3..5a1531a7 100644
--- a/src/imports/controls/designer/ButtonSpecifics.qml
+++ b/src/imports/controls/designer/ButtonSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/CheckBoxSpecifics.qml b/src/imports/controls/designer/CheckBoxSpecifics.qml
index e89ba1de..4daa9b30 100644
--- a/src/imports/controls/designer/CheckBoxSpecifics.qml
+++ b/src/imports/controls/designer/CheckBoxSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/CheckDelegateSpecifics.qml b/src/imports/controls/designer/CheckDelegateSpecifics.qml
new file mode 100644
index 00000000..275f83eb
--- /dev/null
+++ b/src/imports/controls/designer/CheckDelegateSpecifics.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ width: parent.width
+
+ ButtonSection {
+ caption: qsTr("Check Delegate")
+ width: parent.width
+ }
+
+ ControlSection {
+ width: parent.width
+ }
+
+ PaddingSection {
+ width: parent.width
+ }
+}
diff --git a/src/imports/controls/designer/ComboBoxSpecifics.qml b/src/imports/controls/designer/ComboBoxSpecifics.qml
index 60d76e77..507ca8ae 100644
--- a/src/imports/controls/designer/ComboBoxSpecifics.qml
+++ b/src/imports/controls/designer/ComboBoxSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ControlSection.qml b/src/imports/controls/designer/ControlSection.qml
index 0d7a07d2..f9f1014b 100644
--- a/src/imports/controls/designer/ControlSection.qml
+++ b/src/imports/controls/designer/ControlSection.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ControlSpecifics.qml b/src/imports/controls/designer/ControlSpecifics.qml
index 80e01cf2..42d24e33 100644
--- a/src/imports/controls/designer/ControlSpecifics.qml
+++ b/src/imports/controls/designer/ControlSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/DialSpecifics.qml b/src/imports/controls/designer/DialSpecifics.qml
index 98ceb6d3..a2faa170 100644
--- a/src/imports/controls/designer/DialSpecifics.qml
+++ b/src/imports/controls/designer/DialSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/FrameSpecifics.qml b/src/imports/controls/designer/FrameSpecifics.qml
index 80e01cf2..42d24e33 100644
--- a/src/imports/controls/designer/FrameSpecifics.qml
+++ b/src/imports/controls/designer/FrameSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/GroupBoxSpecifics.qml b/src/imports/controls/designer/GroupBoxSpecifics.qml
index 6e70adfa..4df2cad0 100644
--- a/src/imports/controls/designer/GroupBoxSpecifics.qml
+++ b/src/imports/controls/designer/GroupBoxSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ItemDelegateSpecifics.qml b/src/imports/controls/designer/ItemDelegateSpecifics.qml
index 29ee0a72..070af3ad 100644
--- a/src/imports/controls/designer/ItemDelegateSpecifics.qml
+++ b/src/imports/controls/designer/ItemDelegateSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/LabelSpecifics.qml b/src/imports/controls/designer/LabelSpecifics.qml
index adee2fac..43f52d90 100644
--- a/src/imports/controls/designer/LabelSpecifics.qml
+++ b/src/imports/controls/designer/LabelSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/PaddingSection.qml b/src/imports/controls/designer/PaddingSection.qml
index b2c9feb9..aca19459 100644
--- a/src/imports/controls/designer/PaddingSection.qml
+++ b/src/imports/controls/designer/PaddingSection.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/PageIndicatorSpecifics.qml b/src/imports/controls/designer/PageIndicatorSpecifics.qml
index 9ea06cd2..dd9b3d4a 100644
--- a/src/imports/controls/designer/PageIndicatorSpecifics.qml
+++ b/src/imports/controls/designer/PageIndicatorSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/PaneSpecifics.qml b/src/imports/controls/designer/PaneSpecifics.qml
index 80e01cf2..42d24e33 100644
--- a/src/imports/controls/designer/PaneSpecifics.qml
+++ b/src/imports/controls/designer/PaneSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ProgressBarSpecifics.qml b/src/imports/controls/designer/ProgressBarSpecifics.qml
index a5ad9809..ec065efc 100644
--- a/src/imports/controls/designer/ProgressBarSpecifics.qml
+++ b/src/imports/controls/designer/ProgressBarSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/RadioButtonSpecifics.qml b/src/imports/controls/designer/RadioButtonSpecifics.qml
index f10c1170..86a8cad5 100644
--- a/src/imports/controls/designer/RadioButtonSpecifics.qml
+++ b/src/imports/controls/designer/RadioButtonSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/RadioDelegateSpecifics.qml b/src/imports/controls/designer/RadioDelegateSpecifics.qml
new file mode 100644
index 00000000..248b4efd
--- /dev/null
+++ b/src/imports/controls/designer/RadioDelegateSpecifics.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ width: parent.width
+
+ ButtonSection {
+ caption: qsTr("Radio Delegate")
+ width: parent.width
+ }
+
+ ControlSection {
+ width: parent.width
+ }
+
+ PaddingSection {
+ width: parent.width
+ }
+}
diff --git a/src/imports/controls/designer/SliderSpecifics.qml b/src/imports/controls/designer/SliderSpecifics.qml
index f323539e..6c9a25f8 100644
--- a/src/imports/controls/designer/SliderSpecifics.qml
+++ b/src/imports/controls/designer/SliderSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/SpinBoxSpecifics.qml b/src/imports/controls/designer/SpinBoxSpecifics.qml
index d16f2464..3b9865ed 100644
--- a/src/imports/controls/designer/SpinBoxSpecifics.qml
+++ b/src/imports/controls/designer/SpinBoxSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/SwipeDelegateSpecifics.qml b/src/imports/controls/designer/SwipeDelegateSpecifics.qml
new file mode 100644
index 00000000..070af3ad
--- /dev/null
+++ b/src/imports/controls/designer/SwipeDelegateSpecifics.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ width: parent.width
+
+ ButtonSection {
+ caption: qsTr("Item Delegate")
+ width: parent.width
+ }
+
+ ControlSection {
+ width: parent.width
+ }
+
+ PaddingSection {
+ width: parent.width
+ }
+}
diff --git a/src/imports/controls/designer/SwitchDelegateSpecifics.qml b/src/imports/controls/designer/SwitchDelegateSpecifics.qml
new file mode 100644
index 00000000..a537d81e
--- /dev/null
+++ b/src/imports/controls/designer/SwitchDelegateSpecifics.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.1
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.0
+
+Column {
+ width: parent.width
+
+ ButtonSection {
+ caption: qsTr("Switch Delegate")
+ width: parent.width
+ }
+
+ ControlSection {
+ width: parent.width
+ }
+
+ PaddingSection {
+ width: parent.width
+ }
+}
diff --git a/src/imports/controls/designer/SwitchSpecifics.qml b/src/imports/controls/designer/SwitchSpecifics.qml
index e1626eb0..23aab0ae 100644
--- a/src/imports/controls/designer/SwitchSpecifics.qml
+++ b/src/imports/controls/designer/SwitchSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/TextAreaSpecifics.qml b/src/imports/controls/designer/TextAreaSpecifics.qml
index adee2fac..43f52d90 100644
--- a/src/imports/controls/designer/TextAreaSpecifics.qml
+++ b/src/imports/controls/designer/TextAreaSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/TextFieldSpecifics.qml b/src/imports/controls/designer/TextFieldSpecifics.qml
index ab3e2b5e..cea65fd0 100644
--- a/src/imports/controls/designer/TextFieldSpecifics.qml
+++ b/src/imports/controls/designer/TextFieldSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ToolBarSpecifics.qml b/src/imports/controls/designer/ToolBarSpecifics.qml
index 80e01cf2..42d24e33 100644
--- a/src/imports/controls/designer/ToolBarSpecifics.qml
+++ b/src/imports/controls/designer/ToolBarSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/ToolButtonSpecifics.qml b/src/imports/controls/designer/ToolButtonSpecifics.qml
index df0d831d..4b16560f 100644
--- a/src/imports/controls/designer/ToolButtonSpecifics.qml
+++ b/src/imports/controls/designer/ToolButtonSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/TumblerSpecifics.qml b/src/imports/controls/designer/TumblerSpecifics.qml
index 6dcaf27e..6c28d1c7 100644
--- a/src/imports/controls/designer/TumblerSpecifics.qml
+++ b/src/imports/controls/designer/TumblerSpecifics.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
diff --git a/src/imports/controls/designer/designer.pri b/src/imports/controls/designer/designer.pri
index 1589723c..d8ce8d8a 100644
--- a/src/imports/controls/designer/designer.pri
+++ b/src/imports/controls/designer/designer.pri
@@ -1,11 +1,12 @@
QML_FILES += \
- $$PWD/qtlabscontrols.metainfo
+ $$PWD/qtquickcontrols2.metainfo
QML_FILES += \
$$PWD/BusyIndicatorSpecifics.qml \
$$PWD/ButtonSection.qml \
$$PWD/ButtonSpecifics.qml \
$$PWD/CheckBoxSpecifics.qml \
+ $$PWD/CheckDelegateSpecifics.qml \
$$PWD/ComboBoxSpecifics.qml \
$$PWD/ControlSection.qml \
$$PWD/ControlSpecifics.qml \
@@ -19,8 +20,10 @@ QML_FILES += \
$$PWD/PaneSpecifics.qml \
$$PWD/ProgressBarSpecifics.qml \
$$PWD/RadioButtonSpecifics.qml \
+ $$PWD/RadioDelegateSpecifics.qml \
$$PWD/SliderSpecifics.qml \
$$PWD/SpinBoxSpecifics.qml \
+ $$PWD/SwipeDelegateSpecifics.qml \
$$PWD/SwitchSpecifics.qml \
$$PWD/TextAreaSpecifics.qml \
$$PWD/TextFieldSpecifics.qml \
diff --git a/src/imports/controls/designer/images/page-icon.png b/src/imports/controls/designer/images/page-icon.png
new file mode 100644
index 00000000..ecd08c6e
--- /dev/null
+++ b/src/imports/controls/designer/images/page-icon.png
Binary files differ
diff --git a/src/imports/controls/designer/images/page-icon16.png b/src/imports/controls/designer/images/page-icon16.png
new file mode 100644
index 00000000..2d761364
--- /dev/null
+++ b/src/imports/controls/designer/images/page-icon16.png
Binary files differ
diff --git a/src/imports/controls/designer/images/page-icon16@2x.png b/src/imports/controls/designer/images/page-icon16@2x.png
new file mode 100644
index 00000000..3857af28
--- /dev/null
+++ b/src/imports/controls/designer/images/page-icon16@2x.png
Binary files differ
diff --git a/src/imports/controls/designer/images/page-icon@2x.png b/src/imports/controls/designer/images/page-icon@2x.png
new file mode 100644
index 00000000..8780dfbe
--- /dev/null
+++ b/src/imports/controls/designer/images/page-icon@2x.png
Binary files differ
diff --git a/src/imports/controls/designer/images/rangeslider-icon.png b/src/imports/controls/designer/images/rangeslider-icon.png
new file mode 100644
index 00000000..b97c6942
--- /dev/null
+++ b/src/imports/controls/designer/images/rangeslider-icon.png
Binary files differ
diff --git a/src/imports/controls/designer/images/rangeslider-icon16.png b/src/imports/controls/designer/images/rangeslider-icon16.png
new file mode 100644
index 00000000..33236566
--- /dev/null
+++ b/src/imports/controls/designer/images/rangeslider-icon16.png
Binary files differ
diff --git a/src/imports/controls/designer/images/rangeslider-icon16@2x.png b/src/imports/controls/designer/images/rangeslider-icon16@2x.png
new file mode 100644
index 00000000..c613a029
--- /dev/null
+++ b/src/imports/controls/designer/images/rangeslider-icon16@2x.png
Binary files differ
diff --git a/src/imports/controls/designer/images/rangeslider-icon@2x.png b/src/imports/controls/designer/images/rangeslider-icon@2x.png
new file mode 100644
index 00000000..60c12a4a
--- /dev/null
+++ b/src/imports/controls/designer/images/rangeslider-icon@2x.png
Binary files differ
diff --git a/src/imports/controls/designer/qtlabscontrols.metainfo b/src/imports/controls/designer/qtlabscontrols.metainfo
deleted file mode 100644
index 29455ba0..00000000
--- a/src/imports/controls/designer/qtlabscontrols.metainfo
+++ /dev/null
@@ -1,310 +0,0 @@
-MetaInfo {
- Type {
- name: "Qt.labs.controls.BusyIndicator"
- icon: "images/busyindicator-icon16.png"
-
- ItemLibraryEntry {
- name: "Busy Indicator"
- category: "Qt Labs - Controls"
- libraryIcon: "images/busyindicator-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
- }
- }
-
- Type {
- name: "Qt.labs.controls.Button"
- icon: "images/button-icon16.png"
-
- ItemLibraryEntry {
- name: "Button"
- category: "Qt Labs - Controls"
- libraryIcon: "images/button-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Button\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.CheckBox"
- icon: "images/checkbox-icon16.png"
-
- ItemLibraryEntry {
- name: "Check Box"
- category: "Qt Labs - Controls"
- libraryIcon: "images/checkbox-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Check Box\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.ComboBox"
- icon: "images/combobox-icon16.png"
-
- ItemLibraryEntry {
- name: "Combo Box"
- category: "Qt Labs - Controls"
- libraryIcon: "images/combobox-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
- }
- }
-
- Type {
- name: "Qt.labs.controls.Dial"
- icon: "images/dial-icon16.png"
-
- ItemLibraryEntry {
- name: "Dial"
- category: "Qt Labs - Controls"
- libraryIcon: "images/dial-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
- }
- }
-
- Type {
- name: "Qt.labs.controls.Frame"
- icon: "images/frame-icon16.png"
-
- ItemLibraryEntry {
- name: "Frame"
- category: "Qt Labs - Controls"
- libraryIcon: "images/frame-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "width"; type: "int"; value: 200 }
- Property { name: "height"; type: "int"; value: 200 }
- }
- }
-
- Type {
- name: "Qt.labs.controls.GroupBox"
- icon: "images/groupbox-icon16.png"
-
- ItemLibraryEntry {
- name: "Group Box"
- category: "Qt Labs - Controls"
- libraryIcon: "images/groupbox-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "width"; type: "int"; value: 200 }
- Property { name: "height"; type: "int"; value: 200 }
- Property { name: "title"; type: "binding"; value: "qsTr(\"Group Box\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.ItemDelegate"
- icon: "images/itemdelegate-icon16.png"
-
- ItemLibraryEntry {
- name: "Item Delegate"
- category: "Qt Labs - Controls"
- libraryIcon: "images/itemdelegate-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Item Delegate\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.Label"
- icon: "images/label-icon16.png"
-
- ItemLibraryEntry {
- name: "Label"
- category: "Qt Labs - Controls"
- libraryIcon: "images/label-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Label\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.PageIndicator"
- icon: "images/pageindicator-icon16.png"
-
- ItemLibraryEntry {
- name: "Page Indicator"
- category: "Qt Labs - Controls"
- libraryIcon: "images/pageindicator-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "count"; type: "int"; value: 3 }
- }
- }
-
- Type {
- name: "Qt.labs.controls.Pane"
- icon: "images/pane-icon16.png"
-
- ItemLibraryEntry {
- name: "Pane"
- category: "Qt Labs - Controls"
- libraryIcon: "images/pane-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "width"; type: "int"; value: 200 }
- Property { name: "height"; type: "int"; value: 200 }
- }
- }
-
- Type {
- name: "Qt.labs.controls.ProgressBar"
- icon: "images/progressbar-icon16.png"
-
- ItemLibraryEntry {
- name: "Progress Bar"
- category: "Qt Labs - Controls"
- libraryIcon: "images/progressbar-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "value"; type: "real"; value: 0.5 }
- }
- }
-
- Type {
- name: "Qt.labs.controls.RadioButton"
- icon: "images/radiobutton-icon16.png"
-
- ItemLibraryEntry {
- name: "Radio Button"
- category: "Qt Labs - Controls"
- libraryIcon: "images/radiobutton-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Button\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.Slider"
- icon: "images/slider-icon16.png"
-
- ItemLibraryEntry {
- name: "Slider"
- category: "Qt Labs - Controls"
- libraryIcon: "images/slider-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "value"; type: "real"; value: 0.5 }
- }
- }
-
- Type {
- name: "Qt.labs.controls.SpinBox"
- icon: "images/spinbox-icon16.png"
-
- ItemLibraryEntry {
- name: "Spin Box"
- category: "Qt Labs - Controls"
- libraryIcon: "images/spinbox-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
- }
- }
-
- Type {
- name: "Qt.labs.controls.Switch"
- icon: "images/switch-icon16.png"
-
- ItemLibraryEntry {
- name: "Switch"
- category: "Qt Labs - Controls"
- libraryIcon: "images/switch-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Switch\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.TextArea"
- icon: "images/textarea-icon16.png"
-
- ItemLibraryEntry {
- name: "Text Area"
- category: "Qt Labs - Controls"
- libraryIcon: "images/textarea-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Text Area\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.TextField"
- icon: "images/textfield-icon16.png"
-
- ItemLibraryEntry {
- name: "Text Field"
- category: "Qt Labs - Controls"
- libraryIcon: "images/textfield-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Text Field\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.ToolButton"
- icon: "images/toolbutton-icon16.png"
-
- ItemLibraryEntry {
- name: "Tool Button"
- category: "Qt Labs - Controls"
- libraryIcon: "images/toolbutton-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "text"; type: "binding"; value: "qsTr(\"Tool Button\")" }
- }
- }
-
- Type {
- name: "Qt.labs.controls.ToolBar"
- icon: "images/toolbar-icon16.png"
-
- ItemLibraryEntry {
- name: "Tool Bar"
- category: "Qt Labs - Controls"
- libraryIcon: "images/toolbar-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
-
- Property { name: "width"; type: "int"; value: 360 }
- }
- }
-
- Type {
- name: "Qt.labs.controls.Tumbler"
- icon: "images/tumbler-icon16.png"
-
- ItemLibraryEntry {
- name: "Tumbler"
- category: "Qt Labs - Controls"
- libraryIcon: "images/tumbler-icon.png"
- version: "1.0"
- requiredImport: "Qt.labs.controls"
- }
- }
-}
diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo
new file mode 100644
index 00000000..81a6d914
--- /dev/null
+++ b/src/imports/controls/designer/qtquickcontrols2.metainfo
@@ -0,0 +1,402 @@
+MetaInfo {
+ Type {
+ name: "QtQuick.Controls.BusyIndicator"
+ icon: "images/busyindicator-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Busy Indicator"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/busyindicator-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Button"
+ icon: "images/button-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Button"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/button-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Button\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.CheckBox"
+ icon: "images/checkbox-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Check Box"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/checkbox-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Check Box\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.CheckDelegate"
+ icon: "images/checkbox-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Check Delegate"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/checkbox-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Check Delegate\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.ComboBox"
+ icon: "images/combobox-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Combo Box"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/combobox-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Dial"
+ icon: "images/dial-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Dial"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/dial-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Frame"
+ icon: "images/frame-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Frame"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/frame-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "width"; type: "int"; value: 200 }
+ Property { name: "height"; type: "int"; value: 200 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.GroupBox"
+ icon: "images/groupbox-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Group Box"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/groupbox-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "width"; type: "int"; value: 200 }
+ Property { name: "height"; type: "int"; value: 200 }
+ Property { name: "title"; type: "binding"; value: "qsTr(\"Group Box\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.ItemDelegate"
+ icon: "images/itemdelegate-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Item Delegate"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/itemdelegate-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Item Delegate\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Label"
+ icon: "images/label-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Label"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/label-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Label\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Page"
+ icon: "images/page-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Page"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/page-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "width"; type: "int"; value: 200 }
+ Property { name: "height"; type: "int"; value: 200 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.PageIndicator"
+ icon: "images/pageindicator-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Page Indicator"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/pageindicator-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "count"; type: "int"; value: 3 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Pane"
+ icon: "images/pane-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Pane"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/pane-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "width"; type: "int"; value: 200 }
+ Property { name: "height"; type: "int"; value: 200 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.ProgressBar"
+ icon: "images/progressbar-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Progress Bar"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/progressbar-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "value"; type: "real"; value: 0.5 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.RadioButton"
+ icon: "images/radiobutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Radio Button"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/radiobutton-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Button\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.RadioDelegate"
+ icon: "images/radiobutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Radio Delegate"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/radiobutton-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Radio Delegate\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.RangeSlider"
+ icon: "images/rangeslider-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Range Slider"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/rangeslider-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "first.value"; type: "real"; value: 0.25 }
+ Property { name: "second.value"; type: "real"; value: 0.75 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Slider"
+ icon: "images/slider-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Slider"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/slider-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "value"; type: "real"; value: 0.5 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.SpinBox"
+ icon: "images/spinbox-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Spin Box"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/spinbox-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.SwipeDelegate"
+ icon: "images/itemdelegate-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Swipe Delegate"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/itemdelegate-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Swipe Delegate\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Switch"
+ icon: "images/switch-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Switch"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/switch-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Switch\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.SwitchDelegate"
+ icon: "images/switch-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Switch Delegate"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/switch-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Switch Delegate\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.TextArea"
+ icon: "images/textarea-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Text Area"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/textarea-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text Area\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.TextField"
+ icon: "images/textfield-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Text Field"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/textfield-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Text Field\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.ToolButton"
+ icon: "images/toolbutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Tool Button"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/toolbutton-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Tool Button\")" }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.ToolBar"
+ icon: "images/toolbar-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Tool Bar"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/toolbar-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+
+ Property { name: "width"; type: "int"; value: 360 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.Tumbler"
+ icon: "images/tumbler-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Tumbler"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/tumbler-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ }
+ }
+}
diff --git a/src/imports/controls/doc/doc.pri b/src/imports/controls/doc/doc.pri
new file mode 100644
index 00000000..8eaccbed
--- /dev/null
+++ b/src/imports/controls/doc/doc.pri
@@ -0,0 +1,7 @@
+QMAKE_DOCS = $$PWD/qtquickcontrols2.qdocconf
+
+OTHER_FILES += \
+ $$files($$PWD/snippets/*.qml) \
+ $$files($$PWD/src/*.qdoc) \
+ $$files($$PWD/src/calendar/*.qdoc) \
+ $$files($$PWD/src/templates/*.qdoc)
diff --git a/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png b/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png
index 2bdff335..7a140d27 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png b/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png
index e0d7ca33..130e3757 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png b/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png
index 7b955c88..6c8424ab 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png b/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png
index ae5db0c1..dd903650 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png b/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png
index 13495d05..0c3b3c41 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png b/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png
index 09deb30e..b015a3e6 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png b/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png
index db0b94f3..65e25b29 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png
+++ b/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-busyindicator-background.png b/src/imports/controls/doc/images/qtlabscontrols-busyindicator-background.png
deleted file mode 100644
index 03cf98d0..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-busyindicator-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-busyindicator-contentItem.png b/src/imports/controls/doc/images/qtlabscontrols-busyindicator-contentItem.png
deleted file mode 100644
index fb14cb86..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-busyindicator-contentItem.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-busyindicator.gif b/src/imports/controls/doc/images/qtlabscontrols-busyindicator.gif
deleted file mode 100644
index 31ab2d1c..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-busyindicator.gif
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-background.png b/src/imports/controls/doc/images/qtlabscontrols-button-background.png
deleted file mode 100644
index c2703157..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-button-disabled.png
deleted file mode 100644
index 33638d1e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-focused.png b/src/imports/controls/doc/images/qtlabscontrols-button-focused.png
deleted file mode 100644
index 24d2cd06..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-label.png b/src/imports/controls/doc/images/qtlabscontrols-button-label.png
deleted file mode 100644
index 73d8f2fb..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-normal.png b/src/imports/controls/doc/images/qtlabscontrols-button-normal.png
deleted file mode 100644
index 9a5ea80e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button-pressed.png b/src/imports/controls/doc/images/qtlabscontrols-button-pressed.png
deleted file mode 100644
index c88d57b0..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button-pressed.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button.gif b/src/imports/controls/doc/images/qtlabscontrols-button.gif
deleted file mode 100644
index 89dcba31..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button.gif
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-button.png b/src/imports/controls/doc/images/qtlabscontrols-button.png
deleted file mode 100644
index d8a39e55..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-button.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-background.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-background.png
deleted file mode 100644
index 4d24fa2f..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-checked.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-checked.png
deleted file mode 100644
index 8620b0c2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-checked.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-disabled.png
deleted file mode 100644
index 63669b29..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-focused.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-focused.png
deleted file mode 100644
index ea49c721..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-indicator.png
deleted file mode 100644
index fe6cd7a2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-indicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-label.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-label.png
deleted file mode 100644
index d5a1ef2e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox-normal.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox-normal.png
deleted file mode 100644
index b185fc99..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-checkbox.png b/src/imports/controls/doc/images/qtlabscontrols-checkbox.png
deleted file mode 100644
index a824949c..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-checkbox.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-background.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-background.png
deleted file mode 100644
index 1930034b..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-combobox-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.png
deleted file mode 100644
index 08c7bfc8..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.png
deleted file mode 100644
index d76776cf..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-popup.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-popup.png
deleted file mode 100644
index 5cb32247..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-combobox-popup.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox.png b/src/imports/controls/doc/images/qtlabscontrols-combobox.png
deleted file mode 100644
index e687fb0e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-combobox.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-default.png b/src/imports/controls/doc/images/qtlabscontrols-default.png
deleted file mode 100644
index 144ceacb..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-default.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-dial-background.png b/src/imports/controls/doc/images/qtlabscontrols-dial-background.png
deleted file mode 100644
index ca6c9283..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-dial-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-dial-handle.png b/src/imports/controls/doc/images/qtlabscontrols-dial-handle.png
deleted file mode 100644
index b9a8e0d8..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-dial-handle.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-frame-background.png b/src/imports/controls/doc/images/qtlabscontrols-frame-background.png
deleted file mode 100644
index 75ad77bd..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-frame-background.png
+++ /dev/null
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-frame.png b/src/imports/controls/doc/images/qtlabscontrols-frame.png
deleted file mode 100644
index dc14acaf..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-frame.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.png b/src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.png
deleted file mode 100644
index 57ec1026..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-gallery-menu.png b/src/imports/controls/doc/images/qtlabscontrols-gallery-menu.png
deleted file mode 100644
index 5b34264e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-gallery-menu.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.png b/src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.png
deleted file mode 100644
index 5c2bb682..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-groupbox-background.png b/src/imports/controls/doc/images/qtlabscontrols-groupbox-background.png
deleted file mode 100644
index baec44d5..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-groupbox-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.png b/src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.png
deleted file mode 100644
index 9b3f32b1..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.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-groupbox-label.png b/src/imports/controls/doc/images/qtlabscontrols-groupbox-label.png
deleted file mode 100644
index ea4dfb32..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-groupbox-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-groupbox.png b/src/imports/controls/doc/images/qtlabscontrols-groupbox.png
deleted file mode 100644
index c0fc92c7..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-groupbox.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-background.png b/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-background.png
deleted file mode 100644
index 8a97d8ee..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-indicator.png
deleted file mode 100644
index 029abb00..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-indicator.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-label.png
deleted file mode 100644
index 89f094c6..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate.png b/src/imports/controls/doc/images/qtlabscontrols-itemdelegate.png
deleted file mode 100644
index 456a0d55..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-itemdelegate.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-label-background.png b/src/imports/controls/doc/images/qtlabscontrols-label-background.png
deleted file mode 100644
index 34a638d6..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-label-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-label.png b/src/imports/controls/doc/images/qtlabscontrols-label.png
deleted file mode 100644
index 961ce3e3..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-material-button.png b/src/imports/controls/doc/images/qtlabscontrols-material-button.png
deleted file mode 100644
index 5181d8b1..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-material-button.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-material.png b/src/imports/controls/doc/images/qtlabscontrols-material.png
deleted file mode 100644
index d7ce0e88..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-material.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-menu-contentItem.png b/src/imports/controls/doc/images/qtlabscontrols-menu-contentItem.png
deleted file mode 100644
index 4dcf1fac..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-menu-contentItem.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png b/src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png
deleted file mode 100644
index f612c243..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-page-wireframe.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pageindicator.png b/src/imports/controls/doc/images/qtlabscontrols-pageindicator.png
deleted file mode 100644
index 3f47fb9f..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-pageindicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pane-background.png b/src/imports/controls/doc/images/qtlabscontrols-pane-background.png
deleted file mode 100644
index a379d915..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-pane-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pane.png b/src/imports/controls/doc/images/qtlabscontrols-pane.png
deleted file mode 100644
index fe534424..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-pane.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-progressbar-background.png b/src/imports/controls/doc/images/qtlabscontrols-progressbar-background.png
deleted file mode 100644
index 59e81b2b..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-progressbar-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-progressbar-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-progressbar-disabled.png
deleted file mode 100644
index 9ce19e92..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-progressbar-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-progressbar-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-progressbar-indicator.png
deleted file mode 100644
index 9ce19e92..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-progressbar-indicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-progressbar-normal.png b/src/imports/controls/doc/images/qtlabscontrols-progressbar-normal.png
deleted file mode 100644
index 9ce19e92..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-progressbar-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-background.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-background.png
deleted file mode 100644
index 30295394..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-checked.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-checked.png
deleted file mode 100644
index 8f5af513..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-checked.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-disabled.png
deleted file mode 100644
index 626cd616..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-focused.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-focused.png
deleted file mode 100644
index 797e50a9..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-indicator.png
deleted file mode 100644
index 0d78a0d5..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-indicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.png
deleted file mode 100644
index 457555b7..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-normal.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton-normal.png
deleted file mode 100644
index f8d0828b..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-radiobutton.png b/src/imports/controls/doc/images/qtlabscontrols-radiobutton.png
deleted file mode 100644
index 6c217968..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-radiobutton.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-background.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-background.png
deleted file mode 100644
index c045fdbb..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-disabled.png
deleted file mode 100644
index abb033c2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle-focused.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle-focused.png
deleted file mode 100644
index abb033c2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle.png
deleted file mode 100644
index fb246db3..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-first-handle.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-normal.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-normal.png
deleted file mode 100644
index abb033c2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle-focused.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle-focused.png
deleted file mode 100644
index abb033c2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle.png
deleted file mode 100644
index a33a6de2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-second-handle.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-track.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider-track.png
deleted file mode 100644
index 63da8673..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider-track.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider.gif b/src/imports/controls/doc/images/qtlabscontrols-rangeslider.gif
deleted file mode 100644
index 394e8085..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider.gif
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-rangeslider.png b/src/imports/controls/doc/images/qtlabscontrols-rangeslider.png
deleted file mode 100644
index abb033c2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-rangeslider.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-scrollbar-background.png b/src/imports/controls/doc/images/qtlabscontrols-scrollbar-background.png
deleted file mode 100644
index 0b1aa171..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-scrollbar-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-scrollbar-handle.png b/src/imports/controls/doc/images/qtlabscontrols-scrollbar-handle.png
deleted file mode 100644
index 5d916e66..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-scrollbar-handle.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-scrollbar.png b/src/imports/controls/doc/images/qtlabscontrols-scrollbar.png
deleted file mode 100644
index b1abafb5..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-scrollbar.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-scrollindicator-background.png b/src/imports/controls/doc/images/qtlabscontrols-scrollindicator-background.png
deleted file mode 100644
index e9fa04c7..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-scrollindicator-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-scrollindicator-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-scrollindicator-indicator.png
deleted file mode 100644
index 99266362..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-scrollindicator-indicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-scrollindicator.png b/src/imports/controls/doc/images/qtlabscontrols-scrollindicator.png
deleted file mode 100644
index ea0923cc..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-scrollindicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider-background.png b/src/imports/controls/doc/images/qtlabscontrols-slider-background.png
deleted file mode 100644
index 23a754c3..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-slider-disabled.png
deleted file mode 100644
index 2e27a604..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider-focused.png b/src/imports/controls/doc/images/qtlabscontrols-slider-focused.png
deleted file mode 100644
index 2e27a604..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider-handle.png b/src/imports/controls/doc/images/qtlabscontrols-slider-handle.png
deleted file mode 100644
index 7729ef07..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider-handle.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider-normal.png b/src/imports/controls/doc/images/qtlabscontrols-slider-normal.png
deleted file mode 100644
index 2e27a604..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider-track.png b/src/imports/controls/doc/images/qtlabscontrols-slider-track.png
deleted file mode 100644
index 09869bf1..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider-track.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider.gif b/src/imports/controls/doc/images/qtlabscontrols-slider.gif
deleted file mode 100644
index 7cb84b56..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider.gif
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-slider.png b/src/imports/controls/doc/images/qtlabscontrols-slider.png
deleted file mode 100644
index 2e27a604..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-slider.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-spinbox-background.png b/src/imports/controls/doc/images/qtlabscontrols-spinbox-background.png
deleted file mode 100644
index 74fbab6e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-spinbox-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-spinbox-contentItem.png b/src/imports/controls/doc/images/qtlabscontrols-spinbox-contentItem.png
deleted file mode 100644
index 81d549c0..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-spinbox-contentItem.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-spinbox-down.png b/src/imports/controls/doc/images/qtlabscontrols-spinbox-down.png
deleted file mode 100644
index e7c43101..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-spinbox-down.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-spinbox-textual.png b/src/imports/controls/doc/images/qtlabscontrols-spinbox-textual.png
deleted file mode 100644
index 4361c492..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-spinbox-textual.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-spinbox-up.png b/src/imports/controls/doc/images/qtlabscontrols-spinbox-up.png
deleted file mode 100644
index b9992471..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-spinbox-up.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-spinbox.png b/src/imports/controls/doc/images/qtlabscontrols-spinbox.png
deleted file mode 100644
index 909fbda6..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-spinbox.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-background.png b/src/imports/controls/doc/images/qtlabscontrols-switch-background.png
deleted file mode 100644
index c3cf20f3..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-checked.png b/src/imports/controls/doc/images/qtlabscontrols-switch-checked.png
deleted file mode 100644
index 7c678417..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-checked.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-switch-disabled.png
deleted file mode 100644
index 15ff76e6..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-focused.png b/src/imports/controls/doc/images/qtlabscontrols-switch-focused.png
deleted file mode 100644
index 9e973d0e..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-switch-indicator.png
deleted file mode 100644
index 02b88dde..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-indicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-label.png b/src/imports/controls/doc/images/qtlabscontrols-switch-label.png
deleted file mode 100644
index 50f608ab..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch-normal.png b/src/imports/controls/doc/images/qtlabscontrols-switch-normal.png
deleted file mode 100644
index aac440a0..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-switch-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tabbar.png b/src/imports/controls/doc/images/qtlabscontrols-tabbar.png
deleted file mode 100644
index 44a91d63..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-tabbar.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tabbutton.png b/src/imports/controls/doc/images/qtlabscontrols-tabbutton.png
deleted file mode 100644
index 76d1e35c..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-tabbutton.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-textarea.png b/src/imports/controls/doc/images/qtlabscontrols-textarea.png
deleted file mode 100644
index f468bfd4..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-textarea.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-textfield-background.png b/src/imports/controls/doc/images/qtlabscontrols-textfield-background.png
deleted file mode 100644
index e345124d..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-textfield-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-textfield-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-textfield-disabled.png
deleted file mode 100644
index 55034be2..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-textfield-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-textfield-focused.png b/src/imports/controls/doc/images/qtlabscontrols-textfield-focused.png
deleted file mode 100644
index bf5ee32a..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-textfield-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-textfield-normal.png b/src/imports/controls/doc/images/qtlabscontrols-textfield-normal.png
deleted file mode 100644
index 02bb465a..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-textfield-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-background.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-background.png
deleted file mode 100644
index 8f390b49..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-checked.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-checked.png
deleted file mode 100644
index fa883751..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-checked.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-disabled.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-disabled.png
deleted file mode 100644
index 794692b0..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-focused.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-focused.png
deleted file mode 100644
index f52e4686..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-indicator.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-indicator.png
deleted file mode 100644
index 97e06e2c..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-indicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-label.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-label.png
deleted file mode 100644
index 3eb3ba35..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-normal.png b/src/imports/controls/doc/images/qtlabscontrols-togglebutton-normal.png
deleted file mode 100644
index b066c565..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-togglebutton-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-toolbar-background.png b/src/imports/controls/doc/images/qtlabscontrols-toolbar-background.png
deleted file mode 100644
index 12b4c348..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbar-background.png
+++ /dev/null
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-toolbar.png b/src/imports/controls/doc/images/qtlabscontrols-toolbar.png
deleted file mode 100644
index 3e64b4e4..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbar.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-toolbutton-background.png b/src/imports/controls/doc/images/qtlabscontrols-toolbutton-background.png
deleted file mode 100644
index 8dd64031..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbutton-background.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-label.png
deleted file mode 100644
index f4797098..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbutton-label.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tumbler-background.png b/src/imports/controls/doc/images/qtlabscontrols-tumbler-background.png
deleted file mode 100644
index 24c200de..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-tumbler-background.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tumbler-contentItem.png b/src/imports/controls/doc/images/qtlabscontrols-tumbler-contentItem.png
deleted file mode 100644
index 24c200de..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-tumbler-contentItem.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tumbler-delegate.png b/src/imports/controls/doc/images/qtlabscontrols-tumbler-delegate.png
deleted file mode 100644
index d274d444..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-tumbler-delegate.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-universal.png b/src/imports/controls/doc/images/qtlabscontrols-universal.png
deleted file mode 100644
index 89a0f069..00000000
--- a/src/imports/controls/doc/images/qtlabscontrols-universal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-applicationwindow-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-applicationwindow-wireframe.png
new file mode 100644
index 00000000..d9c8b261
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-applicationwindow-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-busyindicator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator-custom.png
new file mode 100644
index 00000000..89a38660
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif
new file mode 100644
index 00000000..653d200f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-busyindicator.png b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.png
index e631df32..e631df32 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-busyindicator.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png
new file mode 100644
index 00000000..e418da04
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif b/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif
new file mode 100644
index 00000000..e2bd8b6f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-button-focused.png
new file mode 100644
index 00000000..a487bd27
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-focused.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif b/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif
new file mode 100644
index 00000000..7de076d3
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-button-normal.png
new file mode 100644
index 00000000..7e7e281b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-normal.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-pressed.png b/src/imports/controls/doc/images/qtquickcontrols2-button-pressed.png
new file mode 100644
index 00000000..2dff7764
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-pressed.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button.gif b/src/imports/controls/doc/images/qtquickcontrols2-button.gif
new file mode 100644
index 00000000..7f2de718
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-custom.png
new file mode 100644
index 00000000..922e458a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif
new file mode 100644
index 00000000..56a15867
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif
new file mode 100644
index 00000000..d70c0ee4
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-custom.png
new file mode 100644
index 00000000..f565e0e7
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif
new file mode 100644
index 00000000..8d058d6c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif
new file mode 100644
index 00000000..da3fab98
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-combobox-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-combobox-custom.png
new file mode 100644
index 00000000..0b2e34bf
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-combobox-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-combobox-delegate.png b/src/imports/controls/doc/images/qtquickcontrols2-combobox-delegate.png
new file mode 100644
index 00000000..7e716b3d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-combobox-delegate.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-combobox-popup.png b/src/imports/controls/doc/images/qtquickcontrols2-combobox-popup.png
new file mode 100644
index 00000000..7e716b3d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-combobox-popup.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-combobox.gif b/src/imports/controls/doc/images/qtquickcontrols2-combobox.gif
new file mode 100644
index 00000000..966a2d4a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-combobox.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-control.png b/src/imports/controls/doc/images/qtquickcontrols2-control.png
new file mode 100644
index 00000000..26babc9f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-control.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-control.svg b/src/imports/controls/doc/images/qtquickcontrols2-control.svg
new file mode 100644
index 00000000..b0ffae7c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-control.svg
@@ -0,0 +1,392 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="679.31317"
+ height="357.84125"
+ viewBox="0 0 679.31314 357.84124"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="qtquickcontrols2-control.svg"
+ inkscape:export-filename="/home/mitch/Dropbox/qtquickcontrols2-control.png"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Mstart"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4191"
+ d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="matrix(0.4,0,0,0.4,4,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mend"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4212"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-3"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-9"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-0"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-5"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-2"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-2"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="2.8"
+ inkscape:cx="370.99138"
+ inkscape:cy="234.56612"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="3742"
+ inkscape:window-height="2124"
+ inkscape:window-x="98"
+ inkscape:window-y="36"
+ inkscape:window-maximized="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ units="px" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(91.482322,-255.11685)">
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4136"
+ width="564.41473"
+ height="248.82799"
+ x="-30.289024"
+ y="321.69858" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138"
+ style="font-style:normal;font-weight:normal;font-size:15.41801071px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(1.1690183,0,0,1.1690183,19.800223,-141.31953)"><flowRegion
+ id="flowRegion4140"><rect
+ id="rect4142"
+ width="129.78784"
+ height="31.668232"
+ x="-34.519978"
+ y="400.22751"
+ style="font-size:15.41801071px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4144"
+ style="font-size:20.55734825px;fill:#000000">Background</flowPara><flowPara
+ id="flowPara4146" /></flowRoot> <rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:27.60000038;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
+ id="rect4148"
+ width="464.22452"
+ height="165.94499"
+ x="18.895706"
+ y="364.74274" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,144.03104,146.23557)"><flowRegion
+ id="flowRegion4140-6"><rect
+ id="rect4142-6"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:40px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6">Content item</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL);marker-end:url(#TriangleOutL)"
+ d="m 27.018805,516.90108 0,-133.62042"
+ id="path4179"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93839902;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2);marker-end:url(#TriangleOutL-9)"
+ d="m 26.776662,538.68728 451.028788,0"
+ id="path4179-7"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,10.003309,144.31674)"><flowRegion
+ id="flowRegion4140-6-6"><rect
+ id="rect4142-6-1"
+ width="117.17769"
+ height="101.01524"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:20px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara9732"
+ style="font-size:17.5px;fill:#000000">Available height</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,10.811464,253.07573)"><flowRegion
+ id="flowRegion4140-6-6-4"><rect
+ id="rect4142-6-1-4"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048">Available width</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1"
+ style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,210.99354,300.96896)"><flowRegion
+ id="flowRegion4140-6-9"><rect
+ id="rect4142-6-0"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:25px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2"
+ style="font-size:17.5px">Width</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.90119678;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)"
+ d="m -26.522148,583.27143 557.292688,0"
+ id="path4179-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.9011969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)"
+ d="m -43.461661,566.30584 0,-239.7552"
+ id="path4179-9"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1-7"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-112.00353,150.83655)"><flowRegion
+ id="flowRegion4140-6-9-7"><rect
+ id="rect4142-6-0-5"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2-9"
+ style="font-size:17.5px;fill:#000000">Height</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-3"
+ style="font-style:normal;font-weight:normal;font-size:60px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,156.72375,-24.786365)"><flowRegion
+ id="flowRegion4140-6-67"><rect
+ id="rect4142-6-5"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:60px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-3">Control</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,186.57489,257.45801)"><flowRegion
+ id="flowRegion4140-6-6-4-6"><rect
+ id="rect4142-6-1-4-2"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048-9">Bottom padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,193.9747,48.798368)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2"><rect
+ id="rect4142-6-1-4-2-7"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048-9-0">Top padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,457.80767,148.11921)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3"><rect
+ id="rect4142-6-1-4-2-6"
+ width="81.109558"
+ height="93.762154"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ id="flowPara4386">Right padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-54.735211,151.06168)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5"><rect
+ id="rect4142-6-1-4-2-6-4"
+ width="81.109558"
+ height="93.762154"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ id="flowPara4386-0">Left padding</flowPara></flowRoot> </g>
+</svg>
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-customize-buttons.png b/src/imports/controls/doc/images/qtquickcontrols2-customize-buttons.png
new file mode 100644
index 00000000..f4e2454e
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-customize-buttons.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-default.png b/src/imports/controls/doc/images/qtquickcontrols2-default.png
new file mode 100644
index 00000000..67e52b84
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-default.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dial-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-dial-custom.png
new file mode 100644
index 00000000..dc5779c0
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dial-handle.png b/src/imports/controls/doc/images/qtquickcontrols2-dial-handle.png
new file mode 100644
index 00000000..49ba9d0c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial-handle.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dial-no-wrap.gif b/src/imports/controls/doc/images/qtquickcontrols2-dial-no-wrap.gif
new file mode 100644
index 00000000..24f6790b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial-no-wrap.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dial-wrap.gif b/src/imports/controls/doc/images/qtquickcontrols2-dial-wrap.gif
new file mode 100644
index 00000000..cfb1fb5b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial-wrap.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-dial.png b/src/imports/controls/doc/images/qtquickcontrols2-dial.png
index dfe37f87..dfe37f87 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-dial.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-drawer-expanded-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-drawer-expanded-wireframe.png
index 8a8078bf..8a8078bf 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-drawer-expanded-wireframe.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-drawer-expanded-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-drawer-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-drawer-wireframe.png
index d1ef1801..d1ef1801 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-drawer-wireframe.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-drawer-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif b/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif
new file mode 100644
index 00000000..736f34f6
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-frame-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-frame-custom.png
new file mode 100644
index 00000000..c9d00187
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-frame-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-frame.png b/src/imports/controls/doc/images/qtquickcontrols2-frame.png
new file mode 100644
index 00000000..3bc1a76a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-frame.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-groupbox-checkable.png b/src/imports/controls/doc/images/qtquickcontrols2-groupbox-checkable.png
new file mode 100644
index 00000000..fd36aec2
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-groupbox-checkable.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-groupbox-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-groupbox-custom.png
new file mode 100644
index 00000000..29f0a60d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-groupbox-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-groupbox-label.png b/src/imports/controls/doc/images/qtquickcontrols2-groupbox-label.png
new file mode 100644
index 00000000..4929be52
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-groupbox-label.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-groupbox.png b/src/imports/controls/doc/images/qtquickcontrols2-groupbox.png
new file mode 100644
index 00000000..ef57cc64
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-groupbox.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate-custom.png
new file mode 100644
index 00000000..ff8ba047
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif
new file mode 100644
index 00000000..dccb6efc
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.png b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.png
new file mode 100644
index 00000000..bbf49fad
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-label-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-label-custom.png
new file mode 100644
index 00000000..5d950fe6
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-label-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-label.png b/src/imports/controls/doc/images/qtquickcontrols2-label.png
new file mode 100644
index 00000000..a51912f5
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-label.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png
new file mode 100644
index 00000000..be0c8212
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-attributes.png b/src/imports/controls/doc/images/qtquickcontrols2-material-attributes.png
new file mode 100644
index 00000000..68999892
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-attributes.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-background.png b/src/imports/controls/doc/images/qtquickcontrols2-material-background.png
new file mode 100644
index 00000000..132fb538
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-material-dark.png b/src/imports/controls/doc/images/qtquickcontrols2-material-dark.png
index 8afb2cd6..8afb2cd6 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-material-dark.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-dark.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png b/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png
new file mode 100644
index 00000000..38c6dc00
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png
new file mode 100644
index 00000000..122f7f9b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png
new file mode 100644
index 00000000..7109f57f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material.png b/src/imports/controls/doc/images/qtquickcontrols2-material.png
new file mode 100644
index 00000000..4caef89e
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-menu-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-menu-custom.png
new file mode 100644
index 00000000..7121fd0a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-menu-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-menu.gif b/src/imports/controls/doc/images/qtquickcontrols2-menu.gif
index 93a873a3..93a873a3 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-menu.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-menu.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-menu.png b/src/imports/controls/doc/images/qtquickcontrols2-menu.png
index b6446d39..b6446d39 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-menu.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-menu.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-applicationwindow-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-page-wireframe.png
index f612c243..f612c243 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-applicationwindow-wireframe.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-page-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-pageindicator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-pageindicator-custom.png
new file mode 100644
index 00000000..c1f98288
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-pageindicator-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-pageindicator-delegate.png b/src/imports/controls/doc/images/qtquickcontrols2-pageindicator-delegate.png
new file mode 100644
index 00000000..a1e9a8cd
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-pageindicator-delegate.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-pageindicator.png b/src/imports/controls/doc/images/qtquickcontrols2-pageindicator.png
new file mode 100644
index 00000000..872012d0
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-pageindicator.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-pane-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-pane-custom.png
new file mode 100644
index 00000000..4c24f426
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-pane-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-pane.png b/src/imports/controls/doc/images/qtquickcontrols2-pane.png
new file mode 100644
index 00000000..b34e9488
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-pane.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-popup-custom.png
new file mode 100644
index 00000000..aa07d53a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup-settings.png b/src/imports/controls/doc/images/qtquickcontrols2-popup-settings.png
new file mode 100644
index 00000000..787de5d4
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup-settings.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-popup-transformorigin.png b/src/imports/controls/doc/images/qtquickcontrols2-popup-transformorigin.png
index 4af320fb..4af320fb 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-popup-transformorigin.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup-transformorigin.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.png b/src/imports/controls/doc/images/qtquickcontrols2-popup.png
new file mode 100644
index 00000000..4514948d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.svg b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
new file mode 100644
index 00000000..1d78addf
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="679.31317"
+ height="357.84125"
+ viewBox="0 0 679.31314 357.84124"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="qtquickcontrols2-popup.svg"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Mstart"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4191"
+ d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="matrix(0.4,0,0,0.4,4,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mend"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4212"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-3"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-9"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-0"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-5"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-2"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-2"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="359.69451"
+ inkscape:cy="143.84745"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ units="px" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(91.482322,-255.11685)">
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4136"
+ width="564.41473"
+ height="248.82799"
+ x="-30.289024"
+ y="321.69858" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138"
+ style="font-style:normal;font-weight:normal;font-size:15.41801071px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(1.1690183,0,0,1.1690183,19.800223,-141.31953)"><flowRegion
+ id="flowRegion4140"><rect
+ id="rect4142"
+ width="129.78784"
+ height="31.668232"
+ x="-34.519978"
+ y="400.22751"
+ style="font-size:15.41801071px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4144"
+ style="font-size:20.55734825px;fill:#000000">Background</flowPara><flowPara
+ id="flowPara4146" /></flowRoot> <rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:27.60000038;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
+ id="rect4148"
+ width="464.22452"
+ height="165.94499"
+ x="18.895706"
+ y="364.74274" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,144.03104,146.23557)"><flowRegion
+ id="flowRegion4140-6"><rect
+ id="rect4142-6"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:40px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6">Content item</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL);marker-end:url(#TriangleOutL)"
+ d="m 27.018805,516.90108 0,-133.62042"
+ id="path4179"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93839902;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2);marker-end:url(#TriangleOutL-9)"
+ d="m 26.776662,538.68728 451.028788,0"
+ id="path4179-7"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,10.003309,144.31674)"><flowRegion
+ id="flowRegion4140-6-6"><rect
+ id="rect4142-6-1"
+ width="117.17769"
+ height="101.01524"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:20px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara9732"
+ style="font-size:17.5px;fill:#000000">Available height</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,10.811464,253.07573)"><flowRegion
+ id="flowRegion4140-6-6-4"><rect
+ id="rect4142-6-1-4"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048">Available width</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1"
+ style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,210.99354,300.96896)"><flowRegion
+ id="flowRegion4140-6-9"><rect
+ id="rect4142-6-0"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:25px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2"
+ style="font-size:17.5px">Width</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.90119678;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)"
+ d="m -26.522148,583.27143 557.292688,0"
+ id="path4179-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.9011969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)"
+ d="m -43.461661,566.30584 0,-239.7552"
+ id="path4179-9"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1-7"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-112.00353,150.83655)"><flowRegion
+ id="flowRegion4140-6-9-7"><rect
+ id="rect4142-6-0-5"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2-9"
+ style="font-size:17.5px;fill:#000000">Height</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-3"
+ style="font-style:normal;font-weight:normal;font-size:60px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,166.31611,-24.786365)"><flowRegion
+ id="flowRegion4140-6-67"><rect
+ id="rect4142-6-5"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:60px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-3">Popup</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,186.57489,257.45801)"><flowRegion
+ id="flowRegion4140-6-6-4-6"><rect
+ id="rect4142-6-1-4-2"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048-9">Bottom padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,193.9747,48.798368)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2"><rect
+ id="rect4142-6-1-4-2-7"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048-9-0">Top padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,457.80767,148.11921)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3"><rect
+ id="rect4142-6-1-4-2-6"
+ width="81.109558"
+ height="93.762154"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ id="flowPara4386">Right padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-54.735211,151.06168)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5"><rect
+ id="rect4142-6-1-4-2-6-4"
+ width="81.109558"
+ height="93.762154"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ id="flowPara4386-0">Left padding</flowPara></flowRoot> </g>
+</svg>
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-custom.png
new file mode 100644
index 00000000..c018e5e7
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gif b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gif
new file mode 100644
index 00000000..d6756d16
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar.gif b/src/imports/controls/doc/images/qtquickcontrols2-progressbar.gif
new file mode 100644
index 00000000..49af5f45
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-progressbar.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-custom.png
new file mode 100644
index 00000000..15835a3c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif
new file mode 100644
index 00000000..4cbf3ed9
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate-custom.png
new file mode 100644
index 00000000..46245323
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif
new file mode 100644
index 00000000..b6afd6fe
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-rangeslider-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-rangeslider-custom.png
new file mode 100644
index 00000000..8508a73d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-rangeslider-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif b/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif
new file mode 100644
index 00000000..d35b1502
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-rangeslider.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-custom.png
new file mode 100644
index 00000000..f986f674
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.png
new file mode 100644
index 00000000..8817ad5c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollbar.gif b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar.gif
new file mode 100644
index 00000000..ed3ab607
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-custom.png
new file mode 100644
index 00000000..75963dc1
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.png
new file mode 100644
index 00000000..758e0451
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif
new file mode 100644
index 00000000..73007820
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-slider-custom.png
new file mode 100644
index 00000000..fc4c89d5
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-handle.png b/src/imports/controls/doc/images/qtquickcontrols2-slider-handle.png
new file mode 100644
index 00000000..093f4a96
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-handle.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gif
new file mode 100644
index 00000000..ab233c5b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gif
new file mode 100644
index 00000000..8eb4011f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gif
new file mode 100644
index 00000000..f3b1d5c7
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider.gif
new file mode 100644
index 00000000..2ee56334
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-spinbox-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-custom.png
new file mode 100644
index 00000000..5aeee0c4
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-spinbox-double.png b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-double.png
new file mode 100644
index 00000000..cdece17b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-double.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-spinbox-down.png b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-down.png
new file mode 100644
index 00000000..1f88f98d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-down.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-spinbox-textual.png b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-textual.png
new file mode 100644
index 00000000..922e59b7
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-textual.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-spinbox-up.png b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-up.png
new file mode 100644
index 00000000..7d254971
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-spinbox-up.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-spinbox.png b/src/imports/controls/doc/images/qtquickcontrols2-spinbox.png
new file mode 100644
index 00000000..6aa341bb
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-spinbox.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-stackview-custom.png
new file mode 100644
index 00000000..8890f14d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gif
new file mode 100644
index 00000000..1971c2e0
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gif
new file mode 100644
index 00000000..0218cc0f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gif
new file mode 100644
index 00000000..63a6b2b4
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gif
new file mode 100644
index 00000000..28c051d8
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-stackview-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-stackview-wireframe.png
index 65704c25..65704c25 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-stackview-wireframe.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-behind.gif b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-behind.gif
new file mode 100644
index 00000000..97d6a592
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-behind.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-custom.png
new file mode 100644
index 00000000..10c60ac3
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-leading-trailing.gif b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-leading-trailing.gif
new file mode 100644
index 00000000..0641bd14
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate-leading-trailing.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate.gif
new file mode 100644
index 00000000..86c380b7
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipedelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-swipeview-indicator.png b/src/imports/controls/doc/images/qtquickcontrols2-swipeview-indicator.png
index 91786964..91786964 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-swipeview-indicator.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipeview-indicator.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-swipeview-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-swipeview-wireframe.png
index 7e387c2d..7e387c2d 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-swipeview-wireframe.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipeview-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif b/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif
new file mode 100644
index 00000000..4af26c10
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switch-checked.png b/src/imports/controls/doc/images/qtquickcontrols2-switch-checked.png
new file mode 100644
index 00000000..f4b0320c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch-checked.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switch-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-switch-custom.png
new file mode 100644
index 00000000..737d3a09
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switch-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-switch-disabled.png
new file mode 100644
index 00000000..060d2b2a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch-disabled.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switch-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-switch-focused.png
new file mode 100644
index 00000000..2384f76a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch-focused.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switch-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-switch-normal.png
new file mode 100644
index 00000000..5f84f62a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch-normal.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch.gif b/src/imports/controls/doc/images/qtquickcontrols2-switch.gif
index 5f956304..5f956304 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-switch.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-switch.png b/src/imports/controls/doc/images/qtquickcontrols2-switch.png
index b9d0812e..b9d0812e 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-switch.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switch.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switchdelegate-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-switchdelegate-custom.png
new file mode 100644
index 00000000..3a77a480
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switchdelegate-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-switchdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-switchdelegate.gif
new file mode 100644
index 00000000..950b1073
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-switchdelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tabbar-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-custom.png
new file mode 100644
index 00000000..cadf3079
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tabbar-explicit.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-explicit.png
new file mode 100644
index 00000000..cdfee3d0
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-explicit.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png
new file mode 100644
index 00000000..ede59233
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-flickable.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tabbar-wireframe.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-wireframe.png
index 443f6757..443f6757 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-tabbar-wireframe.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar-wireframe.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tabbar.gif b/src/imports/controls/doc/images/qtquickcontrols2-tabbar.gif
index 31db1f9e..31db1f9e 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-tabbar.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tabbar.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbar.png
new file mode 100644
index 00000000..6993c8bd
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbar.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tabbutton.png b/src/imports/controls/doc/images/qtquickcontrols2-tabbutton.png
new file mode 100644
index 00000000..3cdce15e
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tabbutton.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textarea-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-textarea-custom.png
new file mode 100644
index 00000000..59777574
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textarea-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textarea-flickable.png b/src/imports/controls/doc/images/qtquickcontrols2-textarea-flickable.png
new file mode 100644
index 00000000..39578f71
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textarea-flickable.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textarea.png b/src/imports/controls/doc/images/qtquickcontrols2-textarea.png
new file mode 100644
index 00000000..924f6681
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textarea.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textfield-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-textfield-custom.png
new file mode 100644
index 00000000..a9f40c07
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textfield-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textfield-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-textfield-disabled.png
new file mode 100644
index 00000000..a027c72a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textfield-disabled.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textfield-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-textfield-focused.png
new file mode 100644
index 00000000..a63d3c85
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textfield-focused.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-textfield-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-textfield-normal.png
new file mode 100644
index 00000000..25047227
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textfield-normal.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-textfield.png b/src/imports/controls/doc/images/qtquickcontrols2-textfield.png
index 9ea62acb..9ea62acb 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-textfield.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-textfield.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolbar-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbar-custom.png
new file mode 100644
index 00000000..374cc836
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolbar-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
new file mode 100644
index 00000000..1fe353cc
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolbutton-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbutton-custom.png
new file mode 100644
index 00000000..4bd209aa
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolbutton-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-toolbutton.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbutton.png
index b350cdba..b350cdba 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-toolbutton.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolbutton.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tooltip-delay.png b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-delay.png
new file mode 100644
index 00000000..eb9499fd
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-delay.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tooltip-hover.png b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-hover.png
new file mode 100644
index 00000000..64a79839
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-hover.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tooltip-pressandhold.png b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-pressandhold.png
new file mode 100644
index 00000000..64a79839
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-pressandhold.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tooltip-slider.png b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-slider.png
new file mode 100644
index 00000000..440f6eba
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tooltip-slider.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png b/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png
new file mode 100644
index 00000000..902d6ee5
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tumbler-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-custom.png
new file mode 100644
index 00000000..0ebb9edf
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tumbler-delegate.png b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-delegate.png
new file mode 100644
index 00000000..5213bcd8
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-delegate.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tumbler-wrap.gif b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif
index 4821a4e8..4821a4e8 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-tumbler-wrap.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-tumbler.png b/src/imports/controls/doc/images/qtquickcontrols2-tumbler.png
index e22330a6..e22330a6 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-tumbler.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tumbler.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png
new file mode 100644
index 00000000..be1a4a89
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-attributes.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-attributes.png
new file mode 100644
index 00000000..96e9abeb
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-attributes.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png
new file mode 100644
index 00000000..c91ab14d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-universal-button.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-button.png
index 6c764ec9..6c764ec9 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-universal-button.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-button.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-universal-dark.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-dark.png
index ec459457..ec459457 100644
--- a/src/imports/controls/doc/images/qtlabscontrols-universal-dark.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-dark.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png
new file mode 100644
index 00000000..e06b573b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png
new file mode 100644
index 00000000..f299b853
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal.png b/src/imports/controls/doc/images/qtquickcontrols2-universal.png
new file mode 100644
index 00000000..b50d9cca
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal.png
Binary files differ
diff --git a/src/imports/controls/doc/qtlabscontrols.qdocconf b/src/imports/controls/doc/qtlabscontrols.qdocconf
deleted file mode 100644
index b2a539ae..00000000
--- a/src/imports/controls/doc/qtlabscontrols.qdocconf
+++ /dev/null
@@ -1,64 +0,0 @@
-include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
-
-project = QtLabsControls
-description = Qt Labs Controls Reference Documentation
-version = $QT_VERSION
-
-qhp.projects = QtLabsControls
-
-qhp.QtLabsControls.file = qtlabscontrols.qhp
-qhp.QtLabsControls.namespace = org.qt-project.qtlabscontrols.$QT_VERSION_TAG
-qhp.QtLabsControls.virtualFolder = qtlabscontrols
-qhp.QtLabsControls.indexTitle = Qt Labs Controls
-qhp.QtLabsControls.indexRoot =
-
-qhp.QtLabsControls.filterAttributes = qtlabscontrols $QT_VERSION qtrefdoc
-qhp.QtLabsControls.customFilters.Qt.name = QtLabsControls $QT_VERSION
-qhp.QtLabsControls.customFilters.Qt.filterAttributes = qtlabscontrols $QT_VERSION
-
-qhp.QtLabsControls.subprojects = qtlabscontrolsqmltypes
-
-qhp.QtLabsControls.subprojects.qtlabscontrolsqmltypes.title = Controls QML Types
-qhp.QtLabsControls.subprojects.qtlabscontrolsqmltypes.indexTitle = Qt Labs Controls QML Types
-qhp.QtLabsControls.subprojects.qtlabscontrolsqmltypes.selectors = qmlclass
-qhp.QtLabsControls.subprojects.qtlabscontrolsqmltypes.sortPages = true
-
-depends = qtcore qtgui qtdoc qtqml qtquick qtquicklayouts qtquickdialogs qtquickcontrols
-
-# Specify the install path under QT_INSTALL_EXAMPLES
-# Note: paths passed to \example command must contain the parent directory, e.g.
-# \example controls/tabs
-exampledirs += ../../../../examples/quickcontrols2 \
- ../ \
- ../../../templates \
- ../../calendar \
- ../../../../tests/auto/controls/data \
- snippets
-
-examplesinstallpath = quickcontrols2
-
-headerdirs += ../../../templates \
- ../../calendar \
-
-sourcedirs += ../../../templates \
- ../../calendar
-
-imagedirs += images
-
-navigation.landingpage = "Qt Labs Controls"
-navigation.qmltypespage = "Qt Labs Controls QML Types"
-
-tagfile = qtlabscontrols.tags
-
-# \styleimport {Qt.labs.controls.universal 1.0}
-macro.styleimport.HTML = "<table class=\"alignedsummary\"><tbody><tr><td class=\"memItemLeft rightAlign topAlign\"> Import Statement:</td><td class=\"memItemRight bottomAlign\"> import \1</td></tr></tbody></table>"
-
-# \styleproperty {Universal.accent} {enumeration} {html-target-id}
-# \target html-target-id
-# This property holds ...
-# (empty line)
-# \endstyleproperty
-macro.styleproperty.HTML = "<div class=\"qmlproto\"><table class=\"qmlname\"><tbody><tr valign=\"top\" class=\"odd\" id=\"\3\"><td class=\"tblQmlPropNode\"><p><span class=\"name\">\1</span> : <span class=\"type\">\2</span></p></td></tr></tbody></table></div>"
-macro.endstyleproperty = "\\br"
-
-macro.labs = "\\note \\e{Types in the Qt.labs module are not guaranteed to remain compatible in future versions.}"
diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf
new file mode 100644
index 00000000..a9a48343
--- /dev/null
+++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf
@@ -0,0 +1,98 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtQuickControls2
+description = Qt Quick Controls 2 Reference Documentation
+version = $QT_VERSION
+
+qhp.projects = QtQuickControls2
+
+qhp.QtQuickControls2.file = qtquickcontrols2.qhp
+qhp.QtQuickControls2.namespace = org.qt-project.qtquickcontrols2.$QT_VERSION_TAG
+qhp.QtQuickControls2.virtualFolder = qtquickcontrols2
+qhp.QtQuickControls2.indexTitle = Qt Quick Controls 2
+qhp.QtQuickControls2.indexRoot =
+
+qhp.QtQuickControls2.filterAttributes = qtquickcontrols2 $QT_VERSION qtrefdoc
+qhp.QtQuickControls2.customFilters.Qt.name = QtQuickControls2 $QT_VERSION
+qhp.QtQuickControls2.customFilters.Qt.filterAttributes = qtquickcontrols2 $QT_VERSION
+
+qhp.QtQuickControls2.subprojects = qmltypes classes examples
+qhp.QtQuickControls2.subprojects.qmltypes.title = QML Types
+qhp.QtQuickControls2.subprojects.qmltypes.indexTitle = Qt Quick Controls 2 QML Types
+qhp.QtQuickControls2.subprojects.qmltypes.selectors = qmlclass
+qhp.QtQuickControls2.subprojects.qmltypes.sortPages = true
+qhp.QtQuickControls2.subprojects.classes.title = C++ Classes
+qhp.QtQuickControls2.subprojects.classes.indexTitle = Qt Quick Controls 2 C++ Classes
+qhp.QtQuickControls2.subprojects.classes.selectors = class fake:headerfile
+qhp.QtQuickControls2.subprojects.classes.sortPages = true
+qhp.QtQuickControls2.subprojects.examples.title = Examples
+qhp.QtQuickControls2.subprojects.examples.indexTitle = Qt Quick Controls 2 Examples
+qhp.QtQuickControls2.subprojects.examples.selectors = fake:example
+
+depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquickextras qmake qtsql qtwidgets
+
+# Specify the install path under QT_INSTALL_EXAMPLES
+# Note: paths passed to \example command must contain the parent directory, e.g.
+# \example controls/tabs
+exampledirs += ../../../../examples/quickcontrols2 \
+ ../../../quicktemplates2 \
+ ../../calendar \
+ ../../../../tests/auto/controls/data \
+ snippets \
+ snippets/screenshots
+
+examplesinstallpath = quickcontrols2
+
+headerdirs += ../../../quicktemplates2 \
+ ../../calendar \
+ ../../../quickcontrols2
+
+sourcedirs += ../../../quicktemplates2 \
+ ../../calendar \
+ ../../../quickcontrols2 \
+ src
+
+imagedirs += images
+
+navigation.landingpage = "Qt Quick Controls 2"
+navigation.qmltypespage = "Qt Quick Controls 2 QML Types"
+navigation.cppclassespage = "Qt Quick Controls 2 C++ Classes"
+
+tagfile = qtquickcontrols2.tags
+
+# \styleimport {QtQuick.Controls.Universal 2.0}
+macro.styleimport.HTML = "<table class=\"alignedsummary\"><tbody><tr><td class=\"memItemLeft rightAlign topAlign\"> Import Statement:</td><td class=\"memItemRight bottomAlign\"> import \1</td></tr><tr><td class=\"memItemLeft rightAlign topAlign\"> Since:</td><td class=\"memItemRight bottomAlign\"> \2</td></tr></tbody></table>"
+
+# \styleproperty {Universal.accent} {enumeration} {html-target-id}
+# \target html-target-id
+# This property holds ...
+# (empty line)
+# \endstyleproperty
+macro.styleproperty.HTML = "<div class=\"qmlproto\"><table class=\"qmlname\"><tbody><tr valign=\"top\" class=\"odd\" id=\"\3\"><td class=\"tblQmlPropNode\"><p><span class=\"name\">\1</span> : <span class=\"type\">\2</span></p></td></tr></tbody></table></div>"
+macro.endstyleproperty = "\\br"
+
+# \stylemethod {returntype} {methodname} {argtype} {argname} {html-target-id}
+# \target html-target-id
+# This property holds ...
+# (empty line)
+# \endstylemethod
+macro.stylemethod.HTML = "<div class=\"qmlproto\"><table class=\"qmlname\"><tbody><tr valign=\"top\" class=\"odd\" id=\"\5\"><td class=\"tblQmlFuncNode\"><p><span class=\"type\">\1</span> <span class=\"name\">\2</span>(<span class="type">\3</span> <i>\4</i>)</p></td></tr></tbody></table></div>"
+macro.endstylemethod = "\\br"
+
+# \stylemethod2 {returntype} {methodname} {arg1type} {arg1name} {arg2type} {arg2name} {html-target-id}
+# \target html-target-id
+# This method returns ...
+# (empty line)
+# \endstylemethod2
+macro.stylemethod2.HTML = "<div class=\"qmlproto\"><table class=\"qmlname\"><tbody><tr valign=\"top\" class=\"odd\" id=\"\7\"><td class=\"tblQmlFuncNode\"><p><span class=\"type\">\1</span> <span class=\"name\">\2</span>(<span class="type">\3</span> <i>\4</i>, <span class="type">\5</span> <i>\6</i>)</p></td></tr></tbody></table></div>"
+macro.endstylemethod2 = "\\br"
+
+# \stylecolor {#6A00FF} {(default)}
+macro.stylecolor.HTML = "<div style=\"padding:10px;color:#fff;background:\1;\">\1 \2</div>"
+
+macro.nbsp.HTML = "&nbsp;"
+macro.labs = "\\note \\e{Types in Qt.labs modules are not guaranteed to remain compatible in future versions.}"
+
+#Add output suffix to the html filenames
+outputsuffixes = QML
+outputsuffixes.QML = 2
diff --git a/src/imports/controls/doc/snippets/basic-example.qml b/src/imports/controls/doc/snippets/basic-example.qml
index 11fee906..62ab2466 100644
--- a/src/imports/controls/doc/snippets/basic-example.qml
+++ b/src/imports/controls/doc/snippets/basic-example.qml
@@ -27,7 +27,7 @@
//! [0]
import QtQuick 2.6
-import Qt.labs.controls 1.0
+import QtQuick.Controls 2.0
ApplicationWindow {
title: "My Application"
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml b/src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml
deleted file mode 100644
index f0cf7203..00000000
--- a/src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml
+++ /dev/null
@@ -1,57 +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.calendar 1.0
-import Qt.labs.controls 1.0
-
-//! [1]
-ListView {
- id: listview
-
- width: 200; height: 200
- snapMode: ListView.SnapOneItem
- orientation: ListView.Horizontal
- highlightRangeMode: ListView.StrictlyEnforceRange
-
- model: CalendarModel {
- from: new Date(2015, 0, 1)
- to: new Date(2015, 11, 31)
- }
-
- delegate: MonthGrid {
- width: listview.width
- height: listview.height
-
- month: model.month
- year: model.year
- locale: Qt.locale("en_US")
- }
-
- ScrollIndicator.horizontal: ScrollIndicator { }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-background.qml
deleted file mode 100644
index 5ccd8f20..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-background.qml
+++ /dev/null
@@ -1,36 +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
-
-BusyIndicator {
- background: Rectangle {
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-contentItem.qml b/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-contentItem.qml
deleted file mode 100644
index 8f212c37..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator-contentItem.qml
+++ /dev/null
@@ -1,37 +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
-
-BusyIndicator {
- Rectangle {
- anchors.fill: contentItem
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator.qml
deleted file mode 100644
index 703161a4..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-busyindicator.qml
+++ /dev/null
@@ -1,32 +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
-
-BusyIndicator {
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-background.qml
deleted file mode 100644
index 7c0a6b50..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-background.qml
+++ /dev/null
@@ -1,39 +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
-
-Button {
- width: 80
- text: "Button"
- Rectangle {
- anchors.fill: background
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-disabled.qml
deleted file mode 100644
index 13037b8d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-disabled.qml
+++ /dev/null
@@ -1,35 +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
-
-Button {
- width: 80
- text: "Disabled"
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-focused.qml
deleted file mode 100644
index ee72caf6..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-focused.qml
+++ /dev/null
@@ -1,35 +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
-
-Button {
- width: 80
- text: "Focused"
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml
deleted file mode 100644
index 4fbeab08..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-label.qml
+++ /dev/null
@@ -1,39 +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
-
-Button {
- width: 80
- text: "Button"
- Rectangle {
- anchors.fill: label
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-normal.qml
deleted file mode 100644
index 692d9066..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-normal.qml
+++ /dev/null
@@ -1,34 +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
-
-Button {
- width: 80
- text: "Normal"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button-pressed.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button-pressed.qml
deleted file mode 100644
index b5c918db..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button-pressed.qml
+++ /dev/null
@@ -1,35 +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
-
-Button {
- width: 80
- text: "Pressed"
- pressed: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-button.qml b/src/imports/controls/doc/snippets/qtlabscontrols-button.qml
deleted file mode 100644
index 86d339b7..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-button.qml
+++ /dev/null
@@ -1,33 +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
-
-Button {
- text: "Button"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-background.qml
deleted file mode 100644
index 566202b5..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-background.qml
+++ /dev/null
@@ -1,37 +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
-
-CheckBox {
- text: "CheckBox"
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-checked.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-checked.qml
deleted file mode 100644
index 3acb9321..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-checked.qml
+++ /dev/null
@@ -1,34 +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
-
-CheckBox {
- text: "Checked"
- checked: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-disabled.qml
deleted file mode 100644
index 6069edad..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-disabled.qml
+++ /dev/null
@@ -1,34 +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
-
-CheckBox {
- text: "Disabled"
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-focused.qml
deleted file mode 100644
index a90a42d6..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-focused.qml
+++ /dev/null
@@ -1,34 +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
-
-CheckBox {
- text: "Focused"
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-indicator.qml
deleted file mode 100644
index ae9a0b0a..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-indicator.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
-
-CheckBox {
- text: "CheckBox"
- Rectangle {
- anchors.fill: indicator
- 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-label.qml
deleted file mode 100644
index fcb3a49d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-label.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
-
-CheckBox {
- text: "CheckBox"
- Rectangle {
- anchors.fill: label
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-normal.qml
deleted file mode 100644
index bc86f927..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox-normal.qml
+++ /dev/null
@@ -1,33 +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
-
-CheckBox {
- text: "Normal"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox.qml b/src/imports/controls/doc/snippets/qtlabscontrols-checkbox.qml
deleted file mode 100644
index 2bf74b42..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-checkbox.qml
+++ /dev/null
@@ -1,33 +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
-
-CheckBox {
- text: "CheckBox"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml
deleted file mode 100644
index d6715f07..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.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
-
-ComboBox {
- model: ["ComboBox"]
- Rectangle {
- anchors.fill: background
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml
deleted file mode 100644
index 08523088..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.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
-
-ComboBox {
- model: ["ComboBox"]
- Rectangle {
- anchors.fill: contentItem
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml
deleted file mode 100644
index 60f56940..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml
+++ /dev/null
@@ -1,54 +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
-
-Item {
- id: root
- width: combo.width
- height: combo.height + combo.popup.contentItem.height
- ComboBox {
- id: combo
- model: ["First", "Second", "Third"]
- popup.contentItem.parent: root
- popup.contentItem.y: combo.height
- delegate: ItemDelegate {
- width: combo.width
- text: modelData
- checkable: true
- autoExclusive: true
- checked: combo.currentIndex === index
- Rectangle {
- visible: index === 0
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
- }
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml
deleted file mode 100644
index 0fea67d1..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml
+++ /dev/null
@@ -1,47 +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
-
-Item {
- id: root
- width: combo.width
- height: combo.height + combo.popup.contentItem.height
- ComboBox {
- id: combo
- model: ["First", "Second", "Third"]
- popup.contentItem.parent: root
- popup.contentItem.y: combo.height
- }
- Rectangle {
- parent: combo.popup.contentItem
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml
deleted file mode 100644
index 4d7fe7fd..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml
+++ /dev/null
@@ -1,43 +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
-
-Item {
- id: root
- width: combo.width
- height: combo.height + combo.popup.contentItem.height
- //! [1]
- ComboBox {
- id: combo
- model: ["First", "Second", "Third"]
- popup.contentItem.parent: root
- popup.contentItem.y: combo.height
- }
- //! [1]
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-dial-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-dial-background.qml
deleted file mode 100644
index 333db1ca..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-dial-background.qml
+++ /dev/null
@@ -1,37 +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
-
-Dial {
- Rectangle {
- anchors.fill: background
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-dial-handle.qml b/src/imports/controls/doc/snippets/qtlabscontrols-dial-handle.qml
deleted file mode 100644
index 73794cc0..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-dial-handle.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
-
-Dial {
- id: dial
-
- Rectangle {
- parent: dial.handle
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- antialiasing: true
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-dial.qml b/src/imports/controls/doc/snippets/qtlabscontrols-dial.qml
deleted file mode 100644
index b42e418d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-dial.qml
+++ /dev/null
@@ -1,32 +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
-
-Dial {
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-frame-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-frame-background.qml
deleted file mode 100644
index 08084e61..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-frame-background.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
-
-Frame {
- width: 100
- height: 100
- background: Rectangle {
- 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-frame.qml b/src/imports/controls/doc/snippets/qtlabscontrols-frame.qml
deleted file mode 100644
index 7fadc9e5..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-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 QtQuick.Layouts 1.0
-import Qt.labs.controls 1.0
-
-//! [1]
-Frame {
- ColumnLayout {
- anchors.fill: parent
- CheckBox { text: qsTr("E-mail") }
- CheckBox { text: qsTr("Calendar") }
- CheckBox { text: qsTr("Contacts") }
- }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-background.qml
deleted file mode 100644
index 480aa8e6..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-background.qml
+++ /dev/null
@@ -1,39 +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"
- background: Rectangle {
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml
deleted file mode 100644
index 1c1232c7..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml
+++ /dev/null
@@ -1,48 +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 QtQuick.Layouts 1.0
-import Qt.labs.controls 1.0
-
-//! [1]
-GroupBox {
- label: CheckBox {
- id: checkBox
- checked: true
- text: qsTr("Synchronize")
- }
-
- ColumnLayout {
- anchors.fill: parent
- enabled: checkBox.checked
- CheckBox { text: qsTr("E-mail") }
- CheckBox { text: qsTr("Calendar") }
- CheckBox { text: qsTr("Contacts") }
- }
-}
-//! [1]
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-groupbox-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-label.qml
deleted file mode 100644
index 53da863b..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-label.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: label
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox.qml b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox.qml
deleted file mode 100644
index 81b234f4..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox.qml
+++ /dev/null
@@ -1,42 +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 QtQuick.Layouts 1.0
-import Qt.labs.controls 1.0
-
-//! [1]
-GroupBox {
- title: qsTr("Synchronize")
- ColumnLayout {
- anchors.fill: parent
- CheckBox { text: qsTr("E-mail") }
- CheckBox { text: qsTr("Calendar") }
- CheckBox { text: qsTr("Contacts") }
- }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-background.qml
deleted file mode 100644
index 10d5696e..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-background.qml
+++ /dev/null
@@ -1,39 +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
-
-ItemDelegate {
- text: "ItemDelegate"
- checked: true
- checkable: true
- background: Rectangle {
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-indicator.qml
deleted file mode 100644
index fb80957d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-indicator.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
-
-ItemDelegate {
- text: "ItemDelegate"
- checked: true
- checkable: true
- Rectangle {
- anchors.fill: indicator
- 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-label.qml
deleted file mode 100644
index 696560a5..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate-label.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
-
-ItemDelegate {
- text: "ItemDelegate"
- checked: true
- checkable: true
- Rectangle {
- anchors.fill: label
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate.qml b/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate.qml
deleted file mode 100644
index d02f722a..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-itemdelegate.qml
+++ /dev/null
@@ -1,46 +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
-
-//! [1]
-ListView {
- width: 160
- height: 240
-
- model: Qt.fontFamilies()
-
- delegate: ItemDelegate {
- text: modelData
- width: parent.width
- onClicked: console.log("clicked:", modelData)
- }
-
- ScrollIndicator.vertical: ScrollIndicator { }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-label-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-label-background.qml
deleted file mode 100644
index 55cbf4eb..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-label-background.qml
+++ /dev/null
@@ -1,37 +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
-
-Label {
- text: "Label"
- background: Rectangle {
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-label.qml b/src/imports/controls/doc/snippets/qtlabscontrols-label.qml
deleted file mode 100644
index cb26658d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-label.qml
+++ /dev/null
@@ -1,35 +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
-
-//! [1]
-Label {
- text: "Label"
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-menu-contentItem.qml b/src/imports/controls/doc/snippets/qtlabscontrols-menu-contentItem.qml
deleted file mode 100644
index 0c270d34..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-menu-contentItem.qml
+++ /dev/null
@@ -1,58 +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
-
-Item {
- id: window
- width: menu.contentItem.width
- height: menu.contentItem.height
- visible: true
-
- Menu {
- id: menu
- contentItem.parent: window
-
- MenuItem {
- text: "New..."
- }
- MenuItem {
- text: "Open..."
- }
- MenuItem {
- text: "Save"
- }
- }
-
- Rectangle {
- parent: menu.contentItem
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-menu.qml b/src/imports/controls/doc/snippets/qtlabscontrols-menu.qml
deleted file mode 100644
index b0f32203..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-menu.qml
+++ /dev/null
@@ -1,51 +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
-
-Item {
- id: window
- width: menu.contentItem.width
- height: menu.contentItem.height
- visible: true
-
- Menu {
- id: menu
- contentItem.parent: window
-
- MenuItem {
- text: "New..."
- }
- MenuItem {
- text: "Open..."
- }
- MenuItem {
- text: "Save"
- }
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pageindicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pageindicator.qml
deleted file mode 100644
index f13e1213..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-pageindicator.qml
+++ /dev/null
@@ -1,43 +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
-
- //! [1]
- PageIndicator {
- count: 5
- currentIndex: 2
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- }
- //! [1]
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml
deleted file mode 100644
index d1d9f22f..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.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
-
-Pane {
- width: 100
- height: 100
- background: Rectangle {
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml
deleted file mode 100644
index 09bfa6a0..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-pane.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 QtQuick.Layouts 1.0
-import Qt.labs.controls 1.0
-
-//! [1]
-Pane {
- ColumnLayout {
- anchors.fill: parent
- CheckBox { text: qsTr("E-mail") }
- CheckBox { text: qsTr("Calendar") }
- CheckBox { text: qsTr("Contacts") }
- }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-background.qml
deleted file mode 100644
index 55e71b81..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-background.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
-
-ProgressBar {
- value: 0.5
- Rectangle {
- anchors.fill: background
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-disabled.qml
deleted file mode 100644
index 0f74ea46..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-disabled.qml
+++ /dev/null
@@ -1,34 +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
-
-ProgressBar {
- value: 0.5
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-indicator.qml
deleted file mode 100644
index 28eb99bf..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-indicator.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
-
-ProgressBar {
- value: 0.5
- Rectangle {
- parent: indicator
- width: indicator.childrenRect.width
- height: indicator.height
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-normal.qml
deleted file mode 100644
index e1c200b5..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-progressbar-normal.qml
+++ /dev/null
@@ -1,33 +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
-
-ProgressBar {
- value: 0.5
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-background.qml
deleted file mode 100644
index d7c6d258..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-background.qml
+++ /dev/null
@@ -1,37 +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
-
-RadioButton {
- text: "RadioButton"
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-checked.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-checked.qml
deleted file mode 100644
index 49f82a5c..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-checked.qml
+++ /dev/null
@@ -1,34 +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
-
-RadioButton {
- text: "Checked"
- checked: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-disabled.qml
deleted file mode 100644
index 1a087593..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-disabled.qml
+++ /dev/null
@@ -1,34 +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
-
-RadioButton {
- text: "Disabled"
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-focused.qml
deleted file mode 100644
index 2ad1cbfc..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-focused.qml
+++ /dev/null
@@ -1,34 +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
-
-RadioButton {
- text: "Focused"
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-indicator.qml
deleted file mode 100644
index d36932dc..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-indicator.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
-
-RadioButton {
- text: "RadioButton"
- Rectangle {
- anchors.fill: indicator
- 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-label.qml
deleted file mode 100644
index eab52fbe..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-label.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
-
-RadioButton {
- text: "RadioButton"
- Rectangle {
- anchors.fill: label
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-normal.qml
deleted file mode 100644
index 8c746468..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton-normal.qml
+++ /dev/null
@@ -1,33 +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
-
-RadioButton {
- text: "Normal"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton.qml b/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton.qml
deleted file mode 100644
index 8f898d18..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-radiobutton.qml
+++ /dev/null
@@ -1,33 +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
-
-RadioButton {
- text: "RadioButton"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-background.qml
deleted file mode 100644
index 2b8ab5a1..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-background.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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-disabled.qml
deleted file mode 100644
index af167461..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-disabled.qml
+++ /dev/null
@@ -1,35 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle-focused.qml
deleted file mode 100644
index 04081cb8..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle-focused.qml
+++ /dev/null
@@ -1,35 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- first.handle.focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle.qml
deleted file mode 100644
index f27f904a..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-first-handle.qml
+++ /dev/null
@@ -1,39 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- Rectangle {
- anchors.fill: first.handle
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-normal.qml
deleted file mode 100644
index 343c24e9..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-normal.qml
+++ /dev/null
@@ -1,34 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle-focused.qml
deleted file mode 100644
index 15da7776..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle-focused.qml
+++ /dev/null
@@ -1,35 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- second.handle.focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle.qml
deleted file mode 100644
index dd54d2fb..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-second-handle.qml
+++ /dev/null
@@ -1,39 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- Rectangle {
- anchors.fill: second.handle
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-track.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-track.qml
deleted file mode 100644
index 858cb727..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider-track.qml
+++ /dev/null
@@ -1,39 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
- Rectangle {
- anchors.fill: track
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider.qml b/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider.qml
deleted file mode 100644
index 343c24e9..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-rangeslider.qml
+++ /dev/null
@@ -1,34 +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
-
-RangeSlider {
- first.value: 0.25
- second.value: 0.75
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-background.qml
deleted file mode 100644
index 90d341b9..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-background.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
-
-ScrollBar {
- size: 0.5
- position: 0.5
- active: true
- height: 100
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-handle.qml b/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-handle.qml
deleted file mode 100644
index 45cde698..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar-handle.qml
+++ /dev/null
@@ -1,42 +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
-
-ScrollBar {
- size: 0.5
- position: 0.5
- active: true
- height: 100
- Rectangle {
- parent: handle
- anchors.fill: parent
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar.qml b/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar.qml
deleted file mode 100644
index b677137d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-scrollbar.qml
+++ /dev/null
@@ -1,52 +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
-
- ScrollBar {
- size: 0.3
- position: 0.2
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- }
-
- ScrollBar {
- size: 0.6
- position: 0.3
- active: true
- orientation: Qt.Horizontal
- width: parent.width
- anchors.bottom: parent.bottom
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-background.qml
deleted file mode 100644
index b276e8ae..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-background.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
-
-ScrollIndicator {
- size: 0.5
- position: 0.5
- active: true
- height: 100
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-indicator.qml
deleted file mode 100644
index 68e0fb33..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator-indicator.qml
+++ /dev/null
@@ -1,42 +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
-
-ScrollIndicator {
- size: 0.5
- position: 0.5
- active: true
- height: 100
- Rectangle {
- parent: indicator
- anchors.fill: parent
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator.qml
deleted file mode 100644
index 8efa0eed..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-scrollindicator.qml
+++ /dev/null
@@ -1,52 +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
-
- ScrollIndicator {
- size: 0.3
- position: 0.2
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- }
-
- ScrollIndicator {
- size: 0.6
- position: 0.3
- active: true
- orientation: Qt.Horizontal
- width: parent.width
- anchors.bottom: parent.bottom
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider-background.qml
deleted file mode 100644
index 03f3137f..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider-background.qml
+++ /dev/null
@@ -1,37 +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
-
-Slider {
- value: 0.5
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider-disabled.qml
deleted file mode 100644
index 57429fb4..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider-disabled.qml
+++ /dev/null
@@ -1,34 +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
-
-Slider {
- value: 0.5
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider-focused.qml
deleted file mode 100644
index 69a24b1a..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider-focused.qml
+++ /dev/null
@@ -1,34 +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
-
-Slider {
- value: 0.5
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider-handle.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider-handle.qml
deleted file mode 100644
index 58bd139e..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider-handle.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
-
-Slider {
- value: 0.5
- Rectangle {
- anchors.fill: handle
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider-normal.qml
deleted file mode 100644
index 331d076a..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider-normal.qml
+++ /dev/null
@@ -1,33 +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
-
-Slider {
- value: 0.5
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider-track.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider-track.qml
deleted file mode 100644
index 7fb949b8..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider-track.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
-
-Slider {
- value: 0.5
- Rectangle {
- anchors.fill: track
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-slider.qml b/src/imports/controls/doc/snippets/qtlabscontrols-slider.qml
deleted file mode 100644
index 331d076a..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-slider.qml
+++ /dev/null
@@ -1,33 +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
-
-Slider {
- value: 0.5
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-background.qml
deleted file mode 100644
index 21d1fe92..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-background.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
-
-SpinBox {
- value: 50
- Rectangle {
- anchors.fill: parent
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-contentItem.qml b/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-contentItem.qml
deleted file mode 100644
index 5d1f66f6..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-contentItem.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
-
-SpinBox {
- value: 50
- Rectangle {
- anchors.fill: contentItem
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-down.qml b/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-down.qml
deleted file mode 100644
index 2294741c..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-down.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
-
-SpinBox {
- value: 50
- Rectangle {
- anchors.fill: down.indicator
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-textual.qml b/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-textual.qml
deleted file mode 100644
index b7d7b9b8..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-textual.qml
+++ /dev/null
@@ -1,55 +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
-
-//! [1]
-SpinBox {
- from: 0
- to: items.length - 1
- value: 1 // "Medium"
-
- property var items: ["Small", "Medium", "Large"]
-
- validator: RegExpValidator {
- regExp: new RegExp("(Small|Medium|Large)", "i")
- }
-
- textFromValue: function(value) {
- return items[value];
- }
-
- valueFromText: function(text) {
- for (var i = 0; i < items.length; ++i) {
- if (items[i].toLowerCase().indexOf(text.toLowerCase()) === 0)
- return i
- }
- return sb.value
- }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-up.qml b/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-up.qml
deleted file mode 100644
index dc6887c0..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox-up.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
-
-SpinBox {
- value: 50
- Rectangle {
- anchors.fill: up.indicator
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox.qml b/src/imports/controls/doc/snippets/qtlabscontrols-spinbox.qml
deleted file mode 100644
index a8adfbd6..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-spinbox.qml
+++ /dev/null
@@ -1,35 +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
-
-//! [1]
-SpinBox {
- value: 50
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-swipeview-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-swipeview-indicator.qml
deleted file mode 100644
index c3a38b92..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-swipeview-indicator.qml
+++ /dev/null
@@ -1,63 +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
-
-Item {
- width: 200
- height: 320
-
- //! [1]
- SwipeView {
- id: view
-
- currentIndex: 1
- anchors.fill: parent
-
- Item {
- id: firstPage
- }
- Item {
- id: secondPage
- }
- Item {
- id: thirdPage
- }
- }
-
- PageIndicator {
- id: indicator
-
- count: view.count
- currentIndex: view.currentIndex
-
- anchors.bottom: view.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- }
- //! [1]
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-background.qml
deleted file mode 100644
index 1829bb26..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-background.qml
+++ /dev/null
@@ -1,37 +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
-
-Switch {
- text: "Switch"
- background: Rectangle {
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-checked.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-checked.qml
deleted file mode 100644
index 4a2ff8f9..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-checked.qml
+++ /dev/null
@@ -1,34 +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
-
-Switch {
- text: "Checked"
- checked: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-disabled.qml
deleted file mode 100644
index c84afdb1..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-disabled.qml
+++ /dev/null
@@ -1,34 +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
-
-Switch {
- text: "Disabled"
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-focused.qml
deleted file mode 100644
index e1b5bd3f..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-focused.qml
+++ /dev/null
@@ -1,34 +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
-
-Switch {
- text: "Focused"
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-indicator.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-indicator.qml
deleted file mode 100644
index 12d4f20d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-indicator.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
-
-Switch {
- text: "Switch"
- Rectangle {
- anchors.fill: indicator
- 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-label.qml
deleted file mode 100644
index c739bf57..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-label.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
-
-Switch {
- text: "Switch"
- Rectangle {
- anchors.fill: label
- color: "transparent"
- border.color: "red"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch-normal.qml
deleted file mode 100644
index 9a766524..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch-normal.qml
+++ /dev/null
@@ -1,33 +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
-
-Switch {
- text: "Normal"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-switch.qml b/src/imports/controls/doc/snippets/qtlabscontrols-switch.qml
deleted file mode 100644
index 9e30f8d5..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-switch.qml
+++ /dev/null
@@ -1,33 +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
-
-Switch {
- text: "Switch"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-tabbar.qml b/src/imports/controls/doc/snippets/qtlabscontrols-tabbar.qml
deleted file mode 100644
index a0282d91..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-tabbar.qml
+++ /dev/null
@@ -1,64 +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 QtQuick.Layouts 1.3
-import Qt.labs.controls 1.0
-
-Column {
- width: 300
-
- //! [1]
- TabBar {
- id: bar
- width: parent.width
- TabButton {
- text: qsTr("Home")
- }
- TabButton {
- text: qsTr("Discover")
- }
- TabButton {
- text: qsTr("Activity")
- }
- }
-
- StackLayout {
- width: parent.width
- currentIndex: bar.currentIndex
- Item {
- id: homeTab
- }
- Item {
- id: discoverTab
- }
- Item {
- id: activityTab
- }
- }
- //! [1]
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-tabbutton.qml b/src/imports/controls/doc/snippets/qtlabscontrols-tabbutton.qml
deleted file mode 100644
index 5412db66..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-tabbutton.qml
+++ /dev/null
@@ -1,43 +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
-
-//! [1]
-TabBar {
- TabButton {
- text: qsTr("Home")
- }
- TabButton {
- text: qsTr("Discover")
- }
- TabButton {
- text: qsTr("Activity")
- }
-}
-//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-textarea.qml b/src/imports/controls/doc/snippets/qtlabscontrols-textarea.qml
deleted file mode 100644
index c99fdd13..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-textarea.qml
+++ /dev/null
@@ -1,33 +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
-
-TextArea {
- text: "Text\nArea..."
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-textfield-background.qml
deleted file mode 100644
index 87324b2d..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-background.qml
+++ /dev/null
@@ -1,39 +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
-
-TextField {
- width: 80
- text: "TextField"
- Rectangle {
- anchors.fill: background
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-disabled.qml b/src/imports/controls/doc/snippets/qtlabscontrols-textfield-disabled.qml
deleted file mode 100644
index e4359d57..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-disabled.qml
+++ /dev/null
@@ -1,35 +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
-
-TextField {
- width: 80
- text: "Disabled"
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-focused.qml b/src/imports/controls/doc/snippets/qtlabscontrols-textfield-focused.qml
deleted file mode 100644
index 9bbcb8ad..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-focused.qml
+++ /dev/null
@@ -1,35 +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
-
-TextField {
- width: 80
- text: "Focused"
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-normal.qml b/src/imports/controls/doc/snippets/qtlabscontrols-textfield-normal.qml
deleted file mode 100644
index de360a33..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-textfield-normal.qml
+++ /dev/null
@@ -1,34 +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
-
-TextField {
- width: 80
- text: "Normal"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-textfield.qml b/src/imports/controls/doc/snippets/qtlabscontrols-textfield.qml
deleted file mode 100644
index 838bd111..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-textfield.qml
+++ /dev/null
@@ -1,33 +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
-
-TextField {
- text: "TextField"
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-toolbar-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-toolbar-background.qml
deleted file mode 100644
index 486e841f..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbar-background.qml
+++ /dev/null
@@ -1,39 +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
- Rectangle {
- parent: background
- anchors.fill: parent
- 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-toolbar.qml b/src/imports/controls/doc/snippets/qtlabscontrols-toolbar.qml
deleted file mode 100644
index 7def9a83..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbar.qml
+++ /dev/null
@@ -1,45 +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 QtQuick.Layouts 1.0
-import Qt.labs.controls 1.0
-
-ToolBar {
- RowLayout {
- anchors.fill: parent
- ToolButton {
- text: qsTr("\u25C0 Qt")
- onClicked: stack.pop()
- }
- Item { Layout.fillWidth: true }
- Switch {
- checked: true
- text: qsTr("Notifications")
- }
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-background.qml
deleted file mode 100644
index 62338070..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-background.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
-
-ToolButton {
- text: "ToolButton"
- Rectangle {
- anchors.fill: background
- 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-label.qml
deleted file mode 100644
index 5a8c3a50..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton-label.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
-
-ToolButton {
- text: "ToolButton"
- Rectangle {
- anchors.fill: label
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton.qml b/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton.qml
deleted file mode 100644
index 0db6bfe2..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-toolbutton.qml
+++ /dev/null
@@ -1,35 +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 {
- ToolButton {
- text: "ToolButton"
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-background.qml
deleted file mode 100644
index 8a423cac..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-background.qml
+++ /dev/null
@@ -1,39 +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
-
-Tumbler {
- model: 5
-
- Rectangle {
- anchors.fill: parent
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-contentItem.qml b/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-contentItem.qml
deleted file mode 100644
index 0e26661e..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-contentItem.qml
+++ /dev/null
@@ -1,39 +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
-
-Tumbler {
- model: 5
-
- Rectangle {
- anchors.fill: parent.contentItem
- color: 'transparent'
- border.color: 'red'
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-delegate.qml b/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-delegate.qml
deleted file mode 100644
index cf18fd93..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler-delegate.qml
+++ /dev/null
@@ -1,47 +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
-
-Tumbler {
- id: tumbler
- model: 5
-
- Column {
- Repeater {
- model: 3
-
- Rectangle {
- width: tumbler.contentItem.width
- height: tumbler.contentItem.height / 3
- color: 'transparent'
- border.color: 'red'
- }
- }
- }
-}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler.qml b/src/imports/controls/doc/snippets/qtlabscontrols-tumbler.qml
deleted file mode 100644
index f96ed893..00000000
--- a/src/imports/controls/doc/snippets/qtlabscontrols-tumbler.qml
+++ /dev/null
@@ -1,33 +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
-
-Tumbler {
- model: 5
-}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml
new file mode 100644
index 00000000..5238d876
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ padding: 4
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ highlighted: true
+ Material.accent: Material.Orange
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml
new file mode 100644
index 00000000..264d5d28
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ padding: 4
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ highlighted: true
+ Material.background: Material.Teal
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml
new file mode 100644
index 00000000..3ce1a722
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ contentWidth: 120
+ contentHeight: 120
+ padding: 10
+ bottomPadding: 20
+
+//! [1]
+Pane {
+ width: 120
+ height: 120
+
+ Material.elevation: 6
+
+ Label {
+ text: qsTr("I'm a card!")
+ anchors.centerIn: parent
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml
new file mode 100644
index 00000000..1fe96121
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ padding: 4
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ Material.foreground: Material.Pink
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml
new file mode 100644
index 00000000..6bd91d5d
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Pane {
+ Material.theme: Material.Dark
+
+ Button {
+ text: qsTr("Button")
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml
new file mode 100644
index 00000000..f80ebfe2
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+
+Item {
+ width: 200
+ height: 200
+
+//! [1]
+Rectangle {
+ id: frame
+ clip: true
+ width: 160
+ height: 160
+ border.color: "black"
+ anchors.centerIn: parent
+
+ Text {
+ id: content
+ text: "ABC"
+ font.pixelSize: 160
+ x: -hbar.position * width
+ y: -vbar.position * height
+ }
+
+ ScrollBar {
+ id: vbar
+ hoverEnabled: true
+ active: hovered || pressed
+ orientation: Qt.Vertical
+ size: frame.height / content.height
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+
+ ScrollBar {
+ id: hbar
+ hoverEnabled: true
+ active: hovered || pressed
+ orientation: Qt.Horizontal
+ size: frame.width / content.width
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+}
+//! [1]
+
+Component.onCompleted: {
+ hbar.active = true
+ vbar.active = true
+}
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml
new file mode 100644
index 00000000..2734f33a
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+
+Item {
+ width: 200
+ height: 200
+
+//! [1]
+Rectangle {
+ id: frame
+ clip: true
+ width: 160
+ height: 160
+ border.color: "black"
+ anchors.centerIn: parent
+
+ Text {
+ id: content
+ text: "ABC"
+ font.pixelSize: 169
+
+ MouseArea {
+ id: mouseArea
+ drag.target: content
+ drag.minimumX: frame.width - width
+ drag.minimumY: frame.height - height
+ drag.maximumX: 0
+ drag.maximumY: 0
+ anchors.fill: content
+ }
+ }
+
+ ScrollIndicator {
+ id: verticalIndicator
+ active: mouseArea.pressed
+ orientation: Qt.Vertical
+ size: frame.height / content.height
+ position: -content.y / content.height
+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
+ }
+
+ ScrollIndicator {
+ id: horizontalIndicator
+ active: mouseArea.pressed
+ orientation: Qt.Horizontal
+ size: frame.width / content.width
+ position: -content.x / content.width
+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
+ }
+}
+//! [1]
+
+Component.onCompleted: {
+ horizontalIndicator.active = true;
+ verticalIndicator.active = true;
+}
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml
new file mode 100644
index 00000000..3e40ea2d
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+StackView {
+ id: control
+
+ popEnter: Transition {
+ XAnimator {
+ from: (control.mirrored ? -1 : 1) * -control.width
+ to: 0
+ duration: 400
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ popExit: Transition {
+ XAnimator {
+ from: 0
+ to: (control.mirrored ? -1 : 1) * control.width
+ duration: 400
+ easing.type: Easing.OutCubic
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
new file mode 100644
index 00000000..db077057
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.7
+import QtQuick.Controls 2.0
+
+//! [1]
+ListView {
+ width: 200
+ height: 300
+ clip: true
+ model: ListModel {
+ id: listModel
+ ListElement { title: "Electricity bill" }
+ ListElement { title: "Happy Birthday!" }
+ ListElement { title: "FW: Cat pictures" }
+ ListElement { title: "Hotel visit receipt" }
+ ListElement { title: "Customer service" }
+ }
+ delegate: SwipeDelegate {
+ id: swipeDelegate
+ text: title
+ width: parent.width
+
+ onClicked: if (swipe.complete) listModel.remove(index)
+
+ swipe.right: Rectangle {
+ color: swipeDelegate.swipe.complete && swipeDelegate.pressed ? "#333" : "#444"
+ width: parent.width
+ height: parent.height
+
+ Label {
+ font.pixelSize: swipeDelegate.font.pixelSize
+ text: qsTr("Remove")
+ color: "white"
+ anchors.centerIn: parent
+ }
+ }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml
new file mode 100644
index 00000000..04b12512
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+SwipeView {
+ id: control
+
+ background: Rectangle {
+ color: "#eeeeee"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml
new file mode 100644
index 00000000..94d9c12e
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Item {
+ToolTip {
+ id: control
+ text: qsTr("A descriptive tool tip of what the button does")
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ color: "#21be2b"
+ }
+
+ background: Rectangle {
+ border.color: "#21be2b"
+ }
+}
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml
new file mode 100644
index 00000000..afcfa87f
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ highlighted: true
+ Universal.accent: Universal.Orange
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml
new file mode 100644
index 00000000..32a1b43b
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Pane {
+ Universal.background: Universal.Steel
+
+ Button {
+ text: qsTr("Button")
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml
new file mode 100644
index 00000000..6ca35d74
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ Universal.foreground: Universal.Pink
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml
new file mode 100644
index 00000000..85e4a406
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Pane {
+ Universal.theme: Universal.Dark
+
+ Button {
+ text: qsTr("Button")
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml
new file mode 100644
index 00000000..dfbf4fbc
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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.calendar 1.0
+import QtQuick.Controls 2.0
+
+//! [1]
+ListView {
+ id: listview
+
+ width: 200; height: 200
+ snapMode: ListView.SnapOneItem
+ orientation: ListView.Horizontal
+ highlightRangeMode: ListView.StrictlyEnforceRange
+
+ model: CalendarModel {
+ from: new Date(2015, 0, 1)
+ to: new Date(2015, 11, 31)
+ }
+
+ delegate: MonthGrid {
+ width: listview.width
+ height: listview.height
+
+ month: model.month
+ year: model.year
+ locale: Qt.locale("en_US")
+ }
+
+ ScrollIndicator.horizontal: ScrollIndicator { }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml
index ce41d224..ce41d224 100644
--- a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml
index 5ea3714c..5ea3714c 100644
--- a/src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml
index 346e6099..346e6099 100644
--- a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml
index 16f872b8..16f872b8 100644
--- a/src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml
index d105553f..d105553f 100644
--- a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml
diff --git a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml
index e58e5c7b..e58e5c7b 100644
--- a/src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
new file mode 100644
index 00000000..82ed9cdc
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+BusyIndicator {
+ id: control
+
+ contentItem: Item {
+ implicitWidth: 64
+ implicitHeight: 64
+
+ Item {
+ id: item
+ x: parent.width / 2 - 32
+ y: parent.height / 2 - 32
+ width: 64
+ height: 64
+ opacity: control.running ? 1 : 0
+
+ Behavior on opacity {
+ OpacityAnimator {
+ duration: 250
+ }
+ }
+
+ RotationAnimator {
+ target: item
+ running: control.visible && control.running
+ from: 0
+ to: 360
+ loops: Animation.Infinite
+ duration: 1250
+ }
+
+ Repeater {
+ id: repeater
+ model: 6
+
+ Rectangle {
+ x: item.width / 2 - width / 2
+ y: item.height / 2 - height / 2
+ implicitWidth: 10
+ implicitHeight: 10
+ radius: 5
+ color: "#21be2b"
+ transform: [
+ Translate {
+ y: -Math.min(item.width, item.height) * 0.5 + 5
+ },
+ Rotation {
+ angle: index / repeater.count * 360
+ origin.x: 5
+ origin.y: 5
+ }
+ ]
+ }
+ }
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
new file mode 100644
index 00000000..eac6b831
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Button {
+ id: control
+ text: qsTr("Button")
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ opacity: enabled ? 1 : 0.3
+ border.color: control.down ? "#17a81a" : "#21be2b"
+ border.width: 1
+ radius: 2
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
new file mode 100644
index 00000000..f4555c90
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Button {
+ width: 80
+ text: "Disabled"
+ enabled: false
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
new file mode 100644
index 00000000..a99346a6
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Button {
+ width: 80
+ text: "Focused"
+ focus: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
new file mode 100644
index 00000000..f206bcec
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Button {
+ width: 80
+ text: "Normal"
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
new file mode 100644
index 00000000..8a941561
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Button {
+ width: 80
+ text: "Pressed"
+ down: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
new file mode 100644
index 00000000..075e6342
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+CheckBox {
+ text: "Checked"
+ checked: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
new file mode 100644
index 00000000..0465ec80
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+CheckBox {
+ id: control
+ text: qsTr("CheckBox")
+ checked: true
+
+ indicator: Rectangle {
+ implicitWidth: 26
+ implicitHeight: 26
+ x: control.leftPadding
+ y: parent.height / 2 - height / 2
+ radius: 3
+ border.color: control.down ? "#17a81a" : "#21be2b"
+
+ Rectangle {
+ width: 14
+ height: 14
+ x: 6
+ y: 6
+ radius: 2
+ color: control.down ? "#17a81a" : "#21be2b"
+ visible: control.checked
+ }
+ }
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ leftPadding: control.indicator.width + control.spacing
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
new file mode 100644
index 00000000..4878cf31
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+CheckBox {
+ text: "Disabled"
+ enabled: false
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
new file mode 100644
index 00000000..93f1c214
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+CheckBox {
+ text: "Focused"
+ focus: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
new file mode 100644
index 00000000..a840116e
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+CheckBox {
+ text: "Normal"
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml
new file mode 100644
index 00000000..483f9838
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+CheckDelegate {
+ id: control
+ text: qsTr("CheckDelegate")
+ checked: true
+
+ contentItem: Text {
+ rightPadding: control.indicator.width + control.spacing
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ indicator: Rectangle {
+ implicitWidth: 26
+ implicitHeight: 26
+ x: control.width - width - control.rightPadding
+ y: control.topPadding + control.availableHeight / 2 - height / 2
+ radius: 3
+ color: "transparent"
+ border.color: control.down ? "#17a81a" : "#21be2b"
+
+ Rectangle {
+ width: 14
+ height: 14
+ x: 6
+ y: 6
+ radius: 2
+ color: control.down ? "#17a81a" : "#21be2b"
+ visible: control.checked
+ }
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.down || control.highlighted
+ color: control.down ? "#bdbebf" : "#eeeeee"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
new file mode 100644
index 00000000..bd261e52
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ComboBox {
+ id: control
+ model: ["First", "Second", "Third"]
+
+ delegate: ItemDelegate {
+ width: control.width
+ contentItem: Text {
+ text: modelData
+ color: "#21be2b"
+ font: control.font
+ elide: Text.ElideRight
+ verticalAlignment: Text.AlignVCenter
+ }
+ highlighted: control.highlightedIndex == index
+ }
+
+ indicator: Canvas {
+ id: canvas
+ x: control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+ width: 12
+ height: 8
+ contextType: "2d"
+
+ Connections {
+ target: control
+ onPressedChanged: canvas.requestPaint()
+ }
+
+ onPaint: {
+ context.reset();
+ context.moveTo(0, 0);
+ context.lineTo(width, 0);
+ context.lineTo(width / 2, height);
+ context.closePath();
+ context.fillStyle = control.pressed ? "#17a81a" : "#21be2b";
+ context.fill();
+ }
+ }
+
+ contentItem: Text {
+ leftPadding: 0
+ rightPadding: control.indicator.width + control.spacing
+
+ text: control.displayText
+ font: control.font
+ color: control.pressed ? "#17a81a" : "#21be2b"
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+
+ background: Rectangle {
+ implicitWidth: 120
+ implicitHeight: 40
+ border.color: control.pressed ? "#17a81a" : "#21be2b"
+ border.width: control.visualFocus ? 2 : 1
+ radius: 2
+ }
+
+ popup: Popup {
+ y: control.height - 1
+ width: control.width
+ implicitHeight: listview.contentHeight
+ padding: 1
+
+ contentItem: ListView {
+ id: listview
+ clip: true
+ model: control.popup.visible ? control.delegateModel : null
+ currentIndex: control.highlightedIndex
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+ }
+
+ background: Rectangle {
+ border.color: "#21be2b"
+ radius: 2
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
new file mode 100644
index 00000000..d8b5d1fa
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Item {
+ id: root
+ width: combo.width
+ height: combo.height + combo.popup.contentItem.height
+ ComboBox {
+ id: combo
+ model: ["First", "Second", "Third"]
+ popup.contentItem.parent: root
+ popup.contentItem.y: combo.height
+ delegate: ItemDelegate {
+ width: combo.width
+ text: modelData
+ autoExclusive: true
+ checked: combo.currentIndex === index
+ Rectangle {
+ visible: index === 0
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
new file mode 100644
index 00000000..36569e15
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Item {
+ id: root
+ width: combo.width
+ height: combo.height + combo.popup.contentItem.height
+ ComboBox {
+ id: combo
+ model: ["First", "Second", "Third"]
+ popup.contentItem.parent: root
+ popup.contentItem.y: combo.height
+ }
+ Rectangle {
+ parent: combo.popup.contentItem
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
new file mode 100644
index 00000000..efe061d3
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Dial {
+ id: control
+ background: Rectangle {
+ x: control.width / 2 - width / 2
+ y: control.height / 2 - height / 2
+ width: Math.max(64, Math.min(control.width, control.height))
+ height: width
+ color: "transparent"
+ radius: width / 2
+ border.color: control.pressed ? "#17a81a" : "#21be2b"
+ opacity: control.enabled ? 1 : 0.3
+ }
+
+ handle: Rectangle {
+ id: handleItem
+ x: control.background.x + control.background.width / 2 - width / 2
+ y: control.background.y + control.background.height / 2 - height / 2
+ width: 16
+ height: 16
+ color: control.pressed ? "#17a81a" : "#21be2b"
+ radius: 8
+ antialiasing: true
+ opacity: control.enabled ? 1 : 0.3
+ transform: [
+ Translate {
+ y: -Math.min(control.background.width, control.background.height) * 0.4 + handleItem.height / 2
+ },
+ Rotation {
+ angle: control.angle
+ origin.x: handleItem.width / 2
+ origin.y: handleItem.height / 2
+ }
+ ]
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
new file mode 100644
index 00000000..19d943a6
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Dial {
+ id: dial
+
+ Rectangle {
+ parent: dial.handle
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ antialiasing: true
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
new file mode 100644
index 00000000..d11c431e
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Frame {
+ background: Rectangle {
+ color: "transparent"
+ border.color: "#21be2b"
+ radius: 2
+ }
+
+ Label {
+ text: qsTr("Content goes here!")
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
new file mode 100644
index 00000000..1ede733d
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+//! [1]
+Frame {
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
new file mode 100644
index 00000000..a2999925
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+//! [1]
+GroupBox {
+ label: CheckBox {
+ id: checkBox
+ checked: true
+ text: qsTr("Synchronize")
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ enabled: checkBox.checked
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
new file mode 100644
index 00000000..cb9ed049
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+GroupBox {
+ id: control
+ title: qsTr("GroupBox")
+
+ background: Rectangle {
+ y: control.topPadding - control.padding
+ width: parent.width
+ height: parent.height - control.topPadding + control.padding
+ color: "transparent"
+ border.color: "#21be2b"
+ radius: 2
+ }
+
+ Label {
+ text: qsTr("Content goes here!")
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
new file mode 100644
index 00000000..74d0ea52
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+GroupBox {
+ width: 100
+ height: 100
+ title: "GroupBox"
+ Rectangle {
+ parent: label
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
new file mode 100644
index 00000000..f79f3aef
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+//! [1]
+GroupBox {
+ title: qsTr("Synchronize")
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
new file mode 100644
index 00000000..002aae69
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ItemDelegate {
+ id: control
+ text: qsTr("ItemDelegate")
+
+ contentItem: Text {
+ rightPadding: control.spacing
+ text: control.text
+ font: control.font
+ color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ opacity: enabled ? 1 : 0.3
+ color: control.down ? "#dddedf" : "#eeeeee"
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ color: control.down ? "#17a81a" : "#21be2b"
+ anchors.bottom: parent.bottom
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
new file mode 100644
index 00000000..143b3323
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+//! [1]
+ListView {
+ width: 160
+ height: 240
+
+ model: Qt.fontFamilies()
+
+ delegate: ItemDelegate {
+ text: modelData
+ width: parent.width
+ onClicked: console.log("clicked:", modelData)
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
new file mode 100644
index 00000000..98dbdc5e
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
@@ -0,0 +1,36 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Label {
+ text: qsTr("Label")
+ color: "#21be2b"
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
new file mode 100644
index 00000000..4346c0eb
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+//! [1]
+Label {
+ text: "Label"
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
new file mode 100644
index 00000000..a6971232
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Item {
+ id: window
+ width: menu.contentItem.width
+ height: menu.contentItem.height
+ visible: true
+
+// Indent it like this so that the indenting in the generated doc is normal.
+Menu {
+ id: menu
+ contentItem.parent: window
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 200
+ color: "#ffffff"
+ border.color: "#353637"
+ }
+
+ MenuItem {
+ text: qsTr("New...")
+ }
+ MenuItem {
+ text: qsTr("Open...")
+ }
+ MenuItem {
+ text: qsTr("Save")
+ }
+}
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
new file mode 100644
index 00000000..65112ef4
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+PageIndicator {
+ id: control
+ count: 5
+ currentIndex: 2
+
+ delegate: Rectangle {
+ implicitWidth: 8
+ implicitHeight: 8
+
+ radius: width / 2
+ color: "#21be2b"
+
+ opacity: index === control.currentIndex ? 0.95 : pressed ? 0.7 : 0.45
+
+ Behavior on opacity {
+ OpacityAnimator {
+ duration: 100
+ }
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
new file mode 100644
index 00000000..4b3ccf23
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
@@ -0,0 +1,40 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+PageIndicator {
+ count: 5
+ currentIndex: 2
+ Rectangle {
+ parent: contentItem.children[0]
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml
new file mode 100644
index 00000000..88cadc27
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.Controls 2.0
+
+Pane {
+//! [1]
+SwipeView {
+ id: view
+ currentIndex: pageIndicator.currentIndex
+ anchors.fill: parent
+
+ Page {
+ title: qsTr("Home")
+ }
+ Page {
+ title: qsTr("Discover")
+ }
+ Page {
+ title: qsTr("Activity")
+ }
+}
+
+PageIndicator {
+ id: pageIndicator
+ interactive: true
+ count: view.count
+ currentIndex: view.currentIndex
+
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
new file mode 100644
index 00000000..237bc6e7
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+//! [1]
+PageIndicator {
+ count: 5
+ currentIndex: 2
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
new file mode 100644
index 00000000..80519939
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Pane {
+ background: Rectangle {
+ color: "#eeeeee"
+ }
+
+ Label {
+ text: qsTr("Content goes here!")
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
new file mode 100644
index 00000000..3d86499f
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+//! [1]
+Pane {
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml
new file mode 100644
index 00000000..6b427611
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Controls 2.0
+import QtQuick.Window 2.2
+
+Item {
+ id: root
+ width: 200
+ height: 200
+
+ Binding {
+ target: popup
+ property: "visible"
+ value: root.Window.active
+ }
+//! [1]
+Popup {
+ id: popup
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 200
+ border.color: "#444"
+ }
+ contentItem: Column {}
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
new file mode 100644
index 00000000..88faed20
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ProgressBar {
+ id: control
+ value: 0.5
+ padding: 2
+
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 6
+ color: "#e6e6e6"
+ radius: 3
+ }
+
+ contentItem: Item {
+ implicitWidth: 200
+ implicitHeight: 4
+
+ Rectangle {
+ width: control.visualPosition * parent.width
+ height: parent.height
+ radius: 2
+ color: "#17a81a"
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
new file mode 100644
index 00000000..dba262be
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+RadioButton {
+ id: control
+ text: qsTr("RadioButton")
+ checked: true
+
+ indicator: Rectangle {
+ implicitWidth: 26
+ implicitHeight: 26
+ x: control.leftPadding
+ y: parent.height / 2 - height / 2
+ radius: 13
+ border.color: control.down ? "#17a81a" : "#21be2b"
+
+ Rectangle {
+ width: 14
+ height: 14
+ x: 6
+ y: 6
+ radius: 7
+ color: control.down ? "#17a81a" : "#21be2b"
+ visible: control.checked
+ }
+ }
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ leftPadding: control.indicator.width + control.spacing
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
new file mode 100644
index 00000000..6efb7803
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+RadioDelegate {
+ id: control
+ text: qsTr("RadioDelegate")
+ checked: true
+
+ contentItem: Text {
+ rightPadding: control.indicator.width + control.spacing
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ indicator: Rectangle {
+ implicitWidth: 26
+ implicitHeight: 26
+ x: control.width - width - control.rightPadding
+ y: parent.height / 2 - height / 2
+ radius: 13
+ color: "transparent"
+ border.color: control.down ? "#17a81a" : "#21be2b"
+
+ Rectangle {
+ width: 14
+ height: 14
+ x: 6
+ y: 6
+ radius: 7
+ color: control.down ? "#17a81a" : "#21be2b"
+ visible: control.checked
+ }
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.down || control.highlighted
+ color: control.down ? "#bdbebf" : "#eeeeee"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
new file mode 100644
index 00000000..7e488d14
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+RangeSlider {
+ id: control
+ first.value: 0.25
+ second.value: 0.75
+
+ background: Rectangle {
+ x: control.leftPadding
+ y: control.topPadding + control.availableHeight / 2 - height / 2
+ implicitWidth: 200
+ implicitHeight: 4
+ width: control.availableWidth
+ height: implicitHeight
+ radius: 2
+ color: "#bdbebf"
+
+ Rectangle {
+ x: control.first.visualPosition * parent.width
+ width: control.second.visualPosition * parent.width - x
+ height: parent.height
+ color: "#21be2b"
+ radius: 2
+ }
+ }
+
+ first.handle: Rectangle {
+ x: control.leftPadding + first.visualPosition * (control.availableWidth - width)
+ y: control.topPadding + control.availableHeight / 2 - height / 2
+ implicitWidth: 26
+ implicitHeight: 26
+ radius: 13
+ color: first.pressed ? "#f0f0f0" : "#f6f6f6"
+ border.color: "#bdbebf"
+ }
+
+ second.handle: Rectangle {
+ x: control.leftPadding + second.visualPosition * (control.availableWidth - width)
+ y: control.topPadding + control.availableHeight / 2 - height / 2
+ implicitWidth: 26
+ implicitHeight: 26
+ radius: 13
+ color: second.pressed ? "#f0f0f0" : "#f6f6f6"
+ border.color: "#bdbebf"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
new file mode 100644
index 00000000..086541c8
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+
+Item {
+ width: 100
+ height: 100
+
+ //! [1]
+ Flickable {
+ anchors.fill: parent
+
+ contentWidth: parent.width * 2
+ contentHeight: parent.height * 2
+
+ ScrollBar.horizontal: ScrollBar { id: hbar; active: vbar.active }
+ ScrollBar.vertical: ScrollBar { id: vbar; active: hbar.active }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
new file mode 100644
index 00000000..0bf13b3c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ScrollBar {
+ id: control
+ size: 0.3
+ position: 0.2
+ active: true
+ orientation: Qt.Vertical
+
+ contentItem: Rectangle {
+ implicitWidth: 6
+ implicitHeight: 100
+ radius: width / 2
+ color: control.pressed ? "#81e889" : "#c2f4c6"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
new file mode 100644
index 00000000..c118c7aa
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+
+Item {
+ width: 100
+ height: 100
+
+ //! [1]
+ Flickable {
+ anchors.fill: parent
+
+ contentWidth: parent.width * 2
+ contentHeight: parent.height * 2
+
+ ScrollIndicator.horizontal: ScrollIndicator { id: hbar; active: vbar.active }
+ ScrollIndicator.vertical: ScrollIndicator { id: vbar; active: hbar.active }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
new file mode 100644
index 00000000..5720f4f7
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ScrollIndicator {
+ id: control
+ size: 0.3
+ position: 0.2
+ active: true
+ orientation: Qt.Vertical
+
+ contentItem: Rectangle {
+ implicitWidth: 2
+ implicitHeight: 100
+ color: "#c2f4c6"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
new file mode 100644
index 00000000..ebc11f46
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Slider {
+ id: control
+ value: 0.5
+
+ background: Rectangle {
+ x: control.leftPadding
+ y: control.topPadding + control.availableHeight / 2 - height / 2
+ implicitWidth: 200
+ implicitHeight: 4
+ width: control.availableWidth
+ height: implicitHeight
+ radius: 2
+ color: "#bdbebf"
+
+ Rectangle {
+ width: control.visualPosition * parent.width
+ height: parent.height
+ color: "#21be2b"
+ radius: 2
+ }
+ }
+
+ handle: Rectangle {
+ x: control.leftPadding + control.visualPosition * (control.availableWidth - width)
+ y: control.topPadding + control.availableHeight / 2 - height / 2
+ implicitWidth: 26
+ implicitHeight: 26
+ radius: 13
+ color: control.pressed ? "#f0f0f0" : "#f6f6f6"
+ border.color: "#bdbebf"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
new file mode 100644
index 00000000..20b569f3
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Slider {
+ value: 0.5
+ Rectangle {
+ anchors.fill: handle
+ color: "transparent"
+ border.color: "red"
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
new file mode 100644
index 00000000..6433fd80
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+SpinBox {
+ id: control
+ value: 50
+ editable: true
+
+ contentItem: TextInput {
+ z: 2
+ text: control.textFromValue(control.value, control.locale)
+
+ font: control.font
+ color: "#21be2b"
+ selectionColor: "#21be2b"
+ selectedTextColor: "#ffffff"
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+
+ readOnly: !control.editable
+ validator: control.validator
+ inputMethodHints: Qt.ImhFormattedNumbersOnly
+ }
+
+ up.indicator: Rectangle {
+ x: control.mirrored ? 0 : parent.width - width
+ height: parent.height
+ implicitWidth: 40
+ implicitHeight: 40
+ color: up.pressed ? "#e4e4e4" : "#f6f6f6"
+ border.color: enabled ? "#21be2b" : "#bdbebf"
+
+ Text {
+ text: "+"
+ font.pixelSize: control.font.pixelSize * 2
+ color: "#21be2b"
+ anchors.fill: parent
+ fontSizeMode: Text.Fit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ down.indicator: Rectangle {
+ x: control.mirrored ? parent.width - width : 0
+ height: parent.height
+ implicitWidth: 40
+ implicitHeight: 40
+ color: down.pressed ? "#e4e4e4" : "#f6f6f6"
+ border.color: enabled ? "#21be2b" : "#bdbebf"
+
+ Text {
+ text: "-"
+ font.pixelSize: control.font.pixelSize * 2
+ color: "#21be2b"
+ anchors.fill: parent
+ fontSizeMode: Text.Fit
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ background: Rectangle {
+ implicitWidth: 140
+ border.color: "#bdbebf"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
new file mode 100644
index 00000000..15af31ae
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Controls 2.0
+
+//! [1]
+SpinBox {
+ id: spinbox
+ from: 0
+ value: 110
+ to: 100 * 100
+ stepSize: 100
+ anchors.centerIn: parent
+
+ property int decimals: 2
+ property real realValue: value / 100
+
+ validator: DoubleValidator {
+ bottom: Math.min(spinbox.from, spinbox.to)
+ top: Math.max(spinbox.from, spinbox.to)
+ }
+
+ textFromValue: function(value, locale) {
+ return Number(value / 100).toLocaleString(locale, 'f', spinbox.decimals)
+ }
+
+ valueFromText: function(text, locale) {
+ return Number.fromLocaleString(locale, text) * 100
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
new file mode 100644
index 00000000..419dae5c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+SpinBox {
+ value: 50
+ Rectangle {
+ anchors.fill: down.indicator
+ color: "transparent"
+ border.color: "red"
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
new file mode 100644
index 00000000..814b8b28
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+//! [1]
+SpinBox {
+ from: 0
+ to: items.length - 1
+ value: 1 // "Medium"
+
+ property var items: ["Small", "Medium", "Large"]
+
+ validator: RegExpValidator {
+ regExp: new RegExp("(Small|Medium|Large)", "i")
+ }
+
+ textFromValue: function(value) {
+ return items[value];
+ }
+
+ valueFromText: function(text) {
+ for (var i = 0; i < items.length; ++i) {
+ if (items[i].toLowerCase().indexOf(text.toLowerCase()) === 0)
+ return i
+ }
+ return sb.value
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
new file mode 100644
index 00000000..b4b0fab3
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+SpinBox {
+ value: 50
+ Rectangle {
+ anchors.fill: up.indicator
+ color: "transparent"
+ border.color: "red"
+ }
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
new file mode 100644
index 00000000..6616ed60
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+//! [1]
+SpinBox {
+ value: 50
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
new file mode 100644
index 00000000..ae63efed
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+SwipeDelegate {
+ id: control
+ text: qsTr("SwipeDelegate")
+
+ Component {
+ id: component
+
+ Rectangle {
+ color: control.swipe.complete && control.down ? "#333" : "#444"
+ width: parent.width
+ height: parent.height
+ clip: true
+
+ Label {
+ text: qsTr("Press me!")
+ color: "#21be2b"
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ swipe.left: component
+ swipe.right: component
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ color: control.enabled ? (control.down ? "#17a81a" : "#21be2b") : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
new file mode 100644
index 00000000..2ba8df9c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Item {
+ width: 200
+ height: 320
+
+ //! [1]
+ SwipeView {
+ id: view
+
+ currentIndex: 1
+ anchors.fill: parent
+
+ Item {
+ id: firstPage
+ }
+ Item {
+ id: secondPage
+ }
+ Item {
+ id: thirdPage
+ }
+ }
+
+ PageIndicator {
+ id: indicator
+
+ count: view.count
+ currentIndex: view.currentIndex
+
+ anchors.bottom: view.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
new file mode 100644
index 00000000..f9a18b1c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Switch {
+ text: "Checked"
+ checked: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
new file mode 100644
index 00000000..698c1a05
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Switch {
+ id: control
+ text: qsTr("Switch")
+
+ indicator: Rectangle {
+ implicitWidth: 48
+ implicitHeight: 26
+ x: control.leftPadding
+ y: parent.height / 2 - height / 2
+ radius: 13
+ color: control.checked ? "#17a81a" : "#ffffff"
+ border.color: control.checked ? "#17a81a" : "#cccccc"
+
+ Rectangle {
+ x: control.checked ? parent.width - width : 0
+ width: 26
+ height: 26
+ radius: 13
+ color: control.down ? "#cccccc" : "#ffffff"
+ border.color: control.checked ? (control.down ? "#17a81a" : "#21be2b") : "#999999"
+ }
+ }
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ leftPadding: control.indicator.width + control.spacing
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
new file mode 100644
index 00000000..a40586b5
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Switch {
+ text: "Disabled"
+ enabled: false
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
new file mode 100644
index 00000000..f98f2c90
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Switch {
+ text: "Focused"
+ focus: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
new file mode 100644
index 00000000..a55c2854
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
@@ -0,0 +1,33 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Switch {
+ text: "Normal"
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml
new file mode 100644
index 00000000..8d0daa0a
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+SwitchDelegate {
+ id: control
+ text: qsTr("SwitchDelegate")
+ checked: true
+
+ contentItem: Text {
+ rightPadding: control.indicator.width + control.spacing
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ indicator: Rectangle {
+ implicitWidth: 48
+ implicitHeight: 26
+ x: control.width - width - control.rightPadding
+ y: parent.height / 2 - height / 2
+ radius: 13
+ color: control.checked ? "#17a81a" : "transparent"
+ border.color: control.checked ? "#17a81a" : "#cccccc"
+
+ Rectangle {
+ x: control.checked ? parent.width - width : 0
+ width: 26
+ height: 26
+ radius: 13
+ color: control.down ? "#cccccc" : "#ffffff"
+ border.color: control.checked ? (control.down ? "#17a81a" : "#21be2b") : "#999999"
+ }
+ }
+
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.down || control.highlighted
+ color: control.down ? "#bdbebf" : "#eeeeee"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
new file mode 100644
index 00000000..1873fba9
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+TabBar {
+ id: control
+
+ background: Rectangle {
+ color: "#eeeeee"
+ }
+
+ TabButton {
+ text: qsTr("Home")
+ }
+ TabButton {
+ text: qsTr("Discover")
+ }
+ TabButton {
+ text: qsTr("Activity")
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-explicit.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-explicit.qml
new file mode 100644
index 00000000..f3e24f10
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-explicit.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Controls 2.0
+
+Item {
+ width: 360
+ height: childrenRect.height
+
+//! [1]
+TabBar {
+ width: parent.width
+ TabButton {
+ text: "First"
+ width: implicitWidth
+ }
+ TabButton {
+ text: "Second"
+ width: implicitWidth
+ }
+ TabButton {
+ text: "Third"
+ width: implicitWidth
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml
new file mode 100644
index 00000000..2a4fac0e
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Controls 2.0
+
+Item {
+ width: 360
+ height: bar.height
+
+//! [1]
+TabBar {
+ id: bar
+ width: parent.width
+
+ Repeater {
+ model: ["First", "Second", "Third", "Fourth", "Fifth"]
+
+ TabButton {
+ text: modelData
+ width: Math.max(100, bar.width / 5)
+ }
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
new file mode 100644
index 00000000..b445ee67
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** 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 QtQuick.Layouts 1.3
+import QtQuick.Controls 2.0
+
+Column {
+ width: 300
+
+ //! [1]
+ TabBar {
+ id: bar
+ width: parent.width
+ TabButton {
+ text: qsTr("Home")
+ }
+ TabButton {
+ text: qsTr("Discover")
+ }
+ TabButton {
+ text: qsTr("Activity")
+ }
+ }
+
+ StackLayout {
+ width: parent.width
+ currentIndex: bar.currentIndex
+ Item {
+ id: homeTab
+ }
+ Item {
+ id: discoverTab
+ }
+ Item {
+ id: activityTab
+ }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
new file mode 100644
index 00000000..67e5e1e0
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+//! [1]
+TabBar {
+ TabButton {
+ text: qsTr("Home")
+ }
+ TabButton {
+ text: qsTr("Discover")
+ }
+ TabButton {
+ text: qsTr("Activity")
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
new file mode 100644
index 00000000..f70c7135
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+TextArea {
+ id: control
+ placeholderText: qsTr("Enter description")
+
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 40
+ border.color: control.enabled ? "#21be2b" : "transparent"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
new file mode 100644
index 00000000..e11750cb
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Item {
+ width: 100
+ height: 100
+
+ Binding { target: flickable.ScrollBar.vertical; property: "active"; value: true }
+
+ //! [1]
+ Flickable {
+ id: flickable
+ anchors.fill: parent
+
+ TextArea.flickable: TextArea {
+ text: "TextArea\n...\n...\n...\n...\n...\n...\n"
+ wrapMode: TextArea.Wrap
+ }
+
+ ScrollBar.vertical: ScrollBar { }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
new file mode 100644
index 00000000..0deb0e5c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+TextField {
+ id: control
+ placeholderText: qsTr("Enter description")
+
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 40
+ color: control.enabled ? "transparent" : "#353637"
+ border.color: control.enabled ? "#21be2b" : "transparent"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
new file mode 100644
index 00000000..ac798f53
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+TextField {
+ width: 80
+ text: "Disabled"
+ enabled: false
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
new file mode 100644
index 00000000..a4e1b3b1
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+TextField {
+ width: 80
+ text: "Focused"
+ focus: true
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
new file mode 100644
index 00000000..12c7ead9
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
@@ -0,0 +1,34 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+TextField {
+ width: 80
+ text: "Normal"
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
new file mode 100644
index 00000000..3e98808c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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.6
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+//! [file]
+ToolBar {
+ id: control
+
+ background: Rectangle {
+ implicitHeight: 40
+ color: "#eeeeee"
+
+ Rectangle {
+ width: parent.width
+ height: 1
+ anchors.bottom: parent.bottom
+ color: "transparent"
+ border.color: "#21be2b"
+ }
+ }
+
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {
+ text: qsTr("Undo")
+ }
+ ToolButton {
+ text: qsTr("Redo")
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
new file mode 100644
index 00000000..246f3ae5
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+
+Item {
+ width: children[0].implicitWidth * 2
+ height: children[0].implicitHeight
+ Binding {
+ target: children[0]
+ property: "width"
+ value: width
+ }
+//! [1]
+ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {
+ text: qsTr("‹")
+ onClicked: stack.pop()
+ }
+ Label {
+ text: "Title"
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: qsTr("â‹®")
+ onClicked: menu.open()
+ }
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
new file mode 100644
index 00000000..10491cb5
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ToolButton {
+ id: control
+ text: qsTr("ToolButton")
+ width: 120
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled ? 1.0 : 0.3
+ color: control.down ? "#17a81a" : "#21be2b"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+
+ background: Rectangle {
+ implicitWidth: 40
+ implicitHeight: 40
+ color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0)
+ opacity: enabled ? 1 : 0.3
+ visible: control.down || (control.enabled && (control.checked || control.highlighted))
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
new file mode 100644
index 00000000..330ab83c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ hoverEnabled: true
+
+ ToolTip.delay: 1000
+ ToolTip.timeout: 5000
+ ToolTip.visible: hovered
+ ToolTip.text: qsTr("This tool tip is shown after hovering the button for a second.")
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
new file mode 100644
index 00000000..eddb09e6
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Controls 2.0
+
+//! [1]
+Button {
+ text: qsTr("Button")
+
+ ToolTip.visible: pressed
+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
+ ToolTip.text: qsTr("This tool tip is shown after pressing and holding the button down.")
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
new file mode 100644
index 00000000..e6a386c1
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+
+Item {
+ id: root
+ width: slider.width
+ height: slider.height * 2.0
+
+ Binding { target: slider.anchors; property: "centerIn"; value: root }
+ Binding { target: slider.anchors; property: "verticalCenterOffset"; value: slider.height / 2 }
+ Binding { target: slider; property: "pressed"; value: root.Window.active }
+
+ //! [1]
+ Slider {
+ id: slider
+ value: 0.5
+
+ ToolTip {
+ parent: slider.handle
+ visible: slider.pressed
+ text: slider.position.toFixed(1)
+ }
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
new file mode 100644
index 00000000..146fe477
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QtQuick.Window 2.2
+import QtQuick.Controls 2.0
+
+Item {
+ id: root
+ width: 360
+ height: button.height * 2
+
+ property Button button: children[0]
+
+ Binding { target: button; property: "down"; value: root.Window.active }
+ Binding { target: button.anchors; property: "bottom"; value: root.bottom }
+ Binding { target: button.anchors; property: "horizontalCenter"; value: root.horizontalCenter }
+
+ //! [1]
+ Button {
+ text: qsTr("Save")
+
+ ToolTip.visible: down
+ ToolTip.text: qsTr("Save the active project")
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
new file mode 100644
index 00000000..d2b4f960
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+//! [file]
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Tumbler {
+ id: control
+ model: 15
+ visibleItemCount: 5
+
+ background: Item {
+ Rectangle {
+ opacity: control.enabled ? 0.2 : 0.1
+ border.color: "#000000"
+ width: parent.width
+ height: 1
+ anchors.top: parent.top
+ }
+
+ Rectangle {
+ opacity: control.enabled ? 0.2 : 0.1
+ border.color: "#000000"
+ width: parent.width
+ height: 1
+ anchors.bottom: parent.bottom
+ }
+ }
+
+ delegate: Text {
+ text: qsTr("Item %1").arg(modelData + 1)
+ font: control.font
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ opacity: 1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)
+ }
+
+ Rectangle {
+ anchors.horizontalCenter: control.horizontalCenter
+ y: control.height * 0.4
+ width: 40
+ height: 1
+ color: "#21be2b"
+ }
+
+ Rectangle {
+ anchors.horizontalCenter: control.horizontalCenter
+ y: control.height * 0.6
+ width: 40
+ height: 1
+ color: "#21be2b"
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
new file mode 100644
index 00000000..4d389ab7
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** 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 QtQuick.Controls 2.0
+
+Tumbler {
+ id: tumbler
+ model: 5
+
+ Column {
+ Repeater {
+ model: 3
+
+ Rectangle {
+ width: tumbler.contentItem.width
+ height: tumbler.contentItem.height / 3
+ color: 'transparent'
+ border.color: 'red'
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc b/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc
index 02e92bf0..d99b3880 100644
--- a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc
+++ b/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc
@@ -39,11 +39,13 @@
\generatelist {qmltypesbymodule Qt.labs.calendar}
+ \labs
+
\section1 Related Information
\list
\li \l{Qt Quick}
\li \l{Qt Quick Layouts}
- \li \l{Qt Labs Controls}
+ \li \l{Qt Quick Controls 2}
\endlist
*/
diff --git a/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc b/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc
index f483ae91..a94e5ec6 100644
--- a/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc
+++ b/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc
@@ -33,7 +33,7 @@
The \l{Qt Labs Calendar} module provides QML types for creating
calendars. These QML types work in conjunction with \l{Qt Quick} and
- \l{Qt Labs Controls}.
+ \l{Qt Quick Controls 2}.
The QML types can be imported into your application using the
following import statement in your .qml file:
@@ -46,10 +46,12 @@
\generatelist {qmltypesbymodule Qt.labs.calendar}
+ \labs
+
\section1 Related Information
\list
- \li \l {Qt Labs Controls QML Types}
+ \li \l {Qt Quick Controls 2 QML Types}
\endlist
\noautolist
diff --git a/src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc b/src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc
new file mode 100644
index 00000000..02d92de0
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc
@@ -0,0 +1,13 @@
+//! [notes]
+
+\note If the background item has no explicit size specified, it automatically
+ follows the control's size. In most cases, there is no need to specify
+ width or height for a background item.
+
+\note Most controls use the implicit size of the background item to calculate
+the implicit size of the control itself. If you replace the background item
+with a custom one, you should also consider providing a sensible implicit
+size for it (unless it is an item like \l Image which has its own implicit
+size).
+
+//! [notes]
diff --git a/src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc b/src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc
new file mode 100644
index 00000000..b69e9e60
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc
@@ -0,0 +1,15 @@
+This property holds the reason of the last focus change.
+
+\note This property does not indicate whether the control has \l {Item::activeFocus}
+ {active focus}, but the reason why the control either gained or lost focus.
+
+\value Qt.MouseFocusReason A mouse action occurred.
+\value Qt.TabFocusReason The Tab key was pressed.
+\value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
+\value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
+\value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
+\value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
+\value Qt.MenuBarFocusReason The menu bar took focus.
+\value Qt.OtherFocusReason Another reason, usually application-specific.
+
+\sa Item::activeFocus
diff --git a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
new file mode 100644
index 00000000..c5d94279
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
@@ -0,0 +1,63 @@
+//! [conf]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c Theme
+ \li Specifies the default \l {material-theme-attached-prop}{Material theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c Accent
+ \li Specifies the default \l {material-accent-attached-prop}{Material accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "Teal".
+ \row
+ \li \c Primary
+ \li Specifies the default \l {material-primary-attached-prop}{Material primary color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "BlueGrey".
+ \row
+ \li \c Foreground
+ \li Specifies the default \l {material-foreground-attached-prop}{Material foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Brown".
+ \row
+ \li \c Background
+ \li Specifies the default \l {material-background-attached-prop}{Material background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Grey".
+\endtable
+//! [conf]
+
+//! [env]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_THEME
+ \li Specifies the default \l {material-theme-attached-prop}{Material theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_ACCENT
+ \li Specifies the default \l {material-accent-attached-prop}{Material accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "Teal".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_PRIMARY
+ \li Specifies the default \l {material-primary-attached-prop}{Material primary color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "BlueGrey".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_FOREGROUND
+ \li Specifies the default \l {material-foreground-attached-prop}{Material foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Brown".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_BACKGROUND
+ \li Specifies the default \l {material-background-attached-prop}{Material background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Grey".
+\endtable
+//! [env]
diff --git a/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc b/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc
new file mode 100644
index 00000000..31f5d2db
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc
@@ -0,0 +1,10 @@
+//! [padding]
+
+The padding properties are used to control the geometry of the
+\l {contentItem}{content item}.
+
+Popup uses the same approach to padding as \l {Control::padding}{Control}.
+For a visual explanation of the padding system, see the \l {Control Layout}
+section of the documentation.
+
+//! [padding]
diff --git a/src/imports/controls/doc/src/includes/qquickswipedelegate-interaction.qdocinc b/src/imports/controls/doc/src/includes/qquickswipedelegate-interaction.qdocinc
new file mode 100644
index 00000000..05aeadb6
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickswipedelegate-interaction.qdocinc
@@ -0,0 +1,5 @@
+Both interactive and non-interactive items can be used here. Normal
+event handling rules apply; if an interactive control like \l Button
+is used, interaction signals of SwipeDelegate such as
+\l {AbstractButton::}{clicked()} will not get emitted if the button
+is clicked.
diff --git a/src/imports/controls/doc/src/includes/qquickswitch.qdocinc b/src/imports/controls/doc/src/includes/qquickswitch.qdocinc
new file mode 100644
index 00000000..985f85d9
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickswitch.qdocinc
@@ -0,0 +1,28 @@
+//! [position]
+
+This property holds the logical position of the thumb indicator.
+
+The position is expressed as a fraction of the indicator's size, in the range
+\c 0.0 - \c 1.0. The position can be used for example to determine whether
+the thumb has been dragged past the halfway point. For visualizing a thumb
+indicator, the right-to-left aware \l visualPosition should be used instead.
+
+\sa visualPosition
+
+//! [position]
+
+
+//! [visualPosition]
+
+This property holds the visual position of the thumb indicator.
+
+The position is expressed as a fraction of the indicator's size, in the range
+\c 0.0 - \c 1.0. When the control is \l {Control::mirrored}{mirrored}, the
+value is equal to \c {1.0 - position}. This makes the value suitable for
+visualizing the thumb indicator taking right-to-left support into account.
+In order to for example determine whether the thumb has been dragged past
+the halfway point, the logical \l position should be used instead.
+
+\sa position
+
+//! [visualPosition]
diff --git a/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc
new file mode 100644
index 00000000..a7ecbaef
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc
@@ -0,0 +1,53 @@
+//! [conf]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c Theme
+ \li Specifies the default \l {universal-theme-attached-prop}{Universal theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c Accent
+ \li Specifies the default \l {universal-accent-attached-prop}{Universal accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Universal colors}, for example \c "Violet".
+ \row
+ \li \c Foreground
+ \li Specifies the default \l {universal-foreground-attached-prop}{Universal foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Brown".
+ \row
+ \li \c Background
+ \li Specifies the default \l {universal-background-attached-prop}{Universal background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Steel".
+\endtable
+//! [conf]
+
+//! [env]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_THEME
+ \li Specifies the default \l {universal-theme-attached-prop}{Universal theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_ACCENT
+ \li Specifies the default \l {universal-accent-attached-prop}{Universal accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Universal colors}, for example \c "Violet".
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND
+ \li Specifies the default \l {universal-foreground-attached-prop}{Universal foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Brown".
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND
+ \li Specifies the default \l {universal-background-attached-prop}{Universal background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Steel".
+\endtable
+//! [env]
diff --git a/src/imports/controls/doc/src/qtlabscontrols-buttons.qdoc b/src/imports/controls/doc/src/qtlabscontrols-buttons.qdoc
deleted file mode 100644
index 562b21c6..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-buttons.qdoc
+++ /dev/null
@@ -1,79 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-buttons.html
- \title Button Controls
-
- Qt Labs Controls offers a selection of button-like controls.
-
- \annotatedlist qtlabscontrols-buttons
-
- Each type of button has its own specific target use case. The following
- sections offer guidelines for choosing the appropriate type of button,
- depending on the use case.
-
- \section1 Button Control
-
- \image qtlabscontrols-button.png
-
- \l Button presents a push-button control that can be pushed or clicked
- by the user. Buttons are normally used to perform an action, or to answer
- a question. Typical buttons are \e OK, \e Apply, \e Cancel, \e Close,
- \e Yes, \e No, and \e Help.
-
- \section1 CheckBox Control
-
- \image qtlabscontrols-checkbox.png
-
- \l CheckBox presents an option button that can be toggled on (checked)
- or off (unchecked). Check boxes are typically used to select one or more
- options from a set of options.
-
- \section1 RadioButton Control
-
- \image qtlabscontrols-radiobutton.png
-
- \l RadioButton presents an option button that can be toggled on (checked)
- or off (unchecked). Radio buttons are typically used to select one option
- from a set of options.
-
- \section1 Switch Control
-
- \image qtlabscontrols-switch.png
-
- \l Switch is an option button that can be dragged or toggled on (checked)
- or off (unchecked). Switches are typically used to select between two
- states.
-
- \section1 ToolButton Control
-
- \image qtlabscontrols-toolbutton.png
-
- \l ToolButton is functionally similar to \l Button, but provides a look
- that is more suitable within a \l ToolBar.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
deleted file mode 100644
index 803695c9..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
+++ /dev/null
@@ -1,97 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-containers.html
- \title Container Controls
-
- Qt Labs Controls offers a selection of container-like controls.
-
- \annotatedlist qtlabscontrols-containers
-
- Each type of container can be used to group a set of controls together.
- The following sections offer guidelines for choosing the appropriate type
- of container, depending on the use case.
-
- \section1 ApplicationWindow Control
-
- \image qtlabscontrols-applicationwindow-wireframe.png
-
- \l ApplicationWindow contains optional header and footer items.
-
- \section1 Frame Control
-
- \image qtlabscontrols-frame.png
-
- \l Frame is used to layout a logical group of controls together, within
- a visual frame.
-
- \section1 GroupBox Control
-
- \image qtlabscontrols-groupbox.png
-
- \l GroupBox is used to layout a logical group of controls together,
- within a titled visual frame.
-
- \section1 Page Control
-
- \image qtlabscontrols-page-wireframe.png
-
- \l Page provides page-specific header and footer items.
-
- \section1 Pane Control
-
- \image qtlabscontrols-pane.png
-
- \l Pane provides a background color that matches with the application
- style and theme.
-
- \section1 StackView Control
-
- \image qtlabscontrols-stackview-wireframe.png
-
- \l StackView organizes content pages into a stack.
-
- \section1 SwipeView Control
-
- \image qtlabscontrols-swipeview-wireframe.png
-
- \l SwipeView organizes content pages into a swipable strip.
-
- \section1 TabBar Control
-
- \image qtlabscontrols-tabbar-wireframe.png
-
- \l TabBar organizes content pages into tabs.
-
- \section1 ToolBar Control
-
- \image qtlabscontrols-toolbar.png
-
- \l ToolBar is a container of application-wide and context-sensitive
- actions and controls.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
deleted file mode 100644
index 4aff46a4..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
+++ /dev/null
@@ -1,593 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-customize.html
- \title Customizing Qt Labs Controls
- \brief A set of UI controls to create user interfaces in Qt Quick
-
- Qt Labs Controls consist of a hierarchy (tree) of items. In order to
- provide a custom look and feel, the default QML implementation of each
- item can be replaced with a custom one. The following snippets present
- the default implementations of various items. These can be used as a
- starting point to implement a custom look and feel.
-
- \section1 Customizing BusyIndicator
-
- BusyIndicator consists of two visual items: \l {Control::background}{background}
- and \l {Control::contentItem}{contentItem}.
-
- \section3 Background
-
- \image qtlabscontrols-busyindicator-background.png
-
- BusyIndicator has no background item by default.
-
- \section3 Content item
-
- \image qtlabscontrols-busyindicator-contentItem.png
-
- \snippet BusyIndicator.qml contentItem
-
-
- \section1 Customizing Button
-
- Button consists of two visual items: \l {Control::background}{background}
- and \l {AbstractButton::label}{label}.
-
- \section3 Background
-
- \image qtlabscontrols-button-background.png
-
- \snippet Button.qml background
-
- \section3 Label
-
- \image qtlabscontrols-button-label.png
-
- \snippet Button.qml label
-
-
- \section1 Customizing CheckBox
-
- CheckBox consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
-
- \section3 Background
-
- \image qtlabscontrols-checkbox-background.png
-
- CheckBox has no background item by default.
-
- \section3 Label
-
- \image qtlabscontrols-checkbox-label.png
-
- \snippet CheckBox.qml label
-
- \section3 Indicator
-
- \image qtlabscontrols-checkbox-indicator.png
-
- \snippet CheckBox.qml indicator
-
-
- \section1 Customizing ComboBox
-
- ComboBox consists of \l {Control::background}{background},
- \l {Control::contentItem}{content item}, \l {ComboBox::popup}{popup},
- and \l {ComboBox::delegate}{delegate}.
-
- \section3 Background
-
- \image qtlabscontrols-combobox-background.png
-
- \snippet ComboBox.qml background
-
- \section3 Content item
-
- \image qtlabscontrols-combobox-contentItem.png
-
- \snippet ComboBox.qml contentItem
-
- \section3 Popup
-
- \image qtlabscontrols-combobox-popup.png
-
- \snippet ComboBox.qml popup
-
- \section3 Delegate
-
- \image qtlabscontrols-combobox-delegate.png
-
- \snippet ComboBox.qml delegate
-
-
- \section1 Customizing Dial
-
- Dial consists of two visual items: \l {Control::background}{background}
- and \l {Dial::handle}{handle}.
-
- \section3 Background
-
- \image qtlabscontrols-dial-background.png
-
- \snippet Dial.qml background
-
- \section3 Indicator
-
- \image qtlabscontrols-dial-handle.png
-
- \snippet Dial.qml handle
-
-
- \section1 Customizing Drawer
-
- Drawer can have a visual \l {Control::background}{background}
- item. The navigation is implemented by the \l {Control::contentItem}
- {content item}.
-
- \section3 Background
-
- \snippet Drawer.qml background
-
- \section3 Content item
-
- Drawer has no content item by default.
-
-
- \section1 Customizing Frame
-
- Frame consists of two visual items: \l {Control::background}{background}
- and \l {Frame::frame}{frame}.
-
- \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
-
-
- \section1 Customizing GroupBox
-
- GroupBox consists of three visual items: \l {Control::background}{background},
- \l {Frame::frame}{frame} 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
-
- \section3 Label
-
- \image qtlabscontrols-groupbox-label.png
-
- \snippet GroupBox.qml label
-
-
- \section1 Customizing ItemDelegate
-
- ItemDelegate consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
- The indicator is only visible for \l {AbstractButton::checkable}{checkable} items.
-
- \section3 Background
-
- \image qtlabscontrols-itemdelegate-background.png
-
- \snippet ItemDelegate.qml background
-
- \section3 Label
-
- \image qtlabscontrols-itemdelegate-label.png
-
- \snippet ItemDelegate.qml label
-
- \section3 Indicator
-
- \image qtlabscontrols-itemdelegate-indicator.png
-
- \snippet ItemDelegate.qml indicator
-
-
- \section1 Customizing Label
-
- Label can have a visual \l {Label::background}{background} item.
-
- \section3 Background
-
- \image qtlabscontrols-label-background.png
-
- Label has no background item by default.
-
-
- \section1 Customizing Menu
-
- Menu consists of a \l {Popup::}{contentItem}.
-
- \section3 Content item
-
- \image qtlabscontrols-menu-contentItem.png
-
- \snippet Menu.qml contentItem
-
-
- \section1 Customizing MenuItem
-
- MenuItem can be customized in the same manner as
- \l {Customizing Button}{Button}.
-
-
- \section1 Customizing PageIndicator
-
- TODO
-
-
- \section1 Customizing Pane
-
- Pane consists of a \l {Control::background}{background}.
-
- \section3 Background
-
- \image qtlabscontrols-pane-background.png
-
- \snippet Pane.qml background
-
-
- \section1 Customizing ProgressBar
-
- ProgressBar consists of two visual items: \l {Control::background}{background}
- and \l {ProgressBar::indicator}{indicator}.
-
- \section3 Background
-
- \image qtlabscontrols-progressbar-background.png
-
- \snippet ProgressBar.qml background
-
- \section3 Indicator
-
- \image qtlabscontrols-progressbar-indicator.png
-
- \snippet ProgressBar.qml indicator
-
-
- \section1 Customizing RadioButton
-
- RadioButton consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
-
- \section3 Background
-
- \image qtlabscontrols-radiobutton-background.png
-
- RadioButton has no background item by default.
-
- \section3 Label
-
- \image qtlabscontrols-radiobutton-label.png
-
- \snippet RadioButton.qml label
-
- \section3 Indicator
-
- \image qtlabscontrols-radiobutton-indicator.png
-
- \snippet RadioButton.qml indicator
-
-
- \section1 Customizing RangeSlider
-
- RangeSlider consists of four visual items:
- \l {Control::background}{background}, \l {RangeSlider::track}{track},
- \l {RangeSlider::first}{first.handle} and
- \l {RangeSlider::second.handle}{second.handle}.
-
- \section3 Background
-
- \image qtlabscontrols-rangeslider-background.png
-
- RangeSlider has no background item by default.
-
- \section3 Track
-
- \image qtlabscontrols-rangeslider-track.png
-
- \snippet RangeSlider.qml track
-
- \section3 First Handle
-
- \image qtlabscontrols-rangeslider-first-handle.png
-
- \snippet RangeSlider.qml firstHandle
-
- \section3 Second Handle
-
- \image qtlabscontrols-rangeslider-second-handle.png
-
- \snippet RangeSlider.qml secondHandle
-
-
- \section1 Customizing ScrollBar
-
- ScrollBar consists of two visual items: \l {Control::background}{background}
- and \l {ScrollBar::handle}{handle}.
-
- \section3 Background
-
- \image qtlabscontrols-scrollbar-background.png
-
- ScrollBar has no background item by default.
-
- \section3 Handle
-
- \image qtlabscontrols-scrollbar-handle.png
-
- \snippet ScrollBar.qml handle
-
-
- \section1 Customizing ScrollIndicator
-
- ScrollIndicator consists of two visual items: \l {Control::background}{background}
- and \l {ScrollIndicator::indicator}{indicator}.
-
- \section3 Background
-
- \image qtlabscontrols-scrollindicator-background.png
-
- ScrollIndicator has no background item by default.
-
- \section3 Indicator
-
- \image qtlabscontrols-scrollindicator-indicator.png
-
- \snippet ScrollIndicator.qml indicator
-
-
- \section1 Customizing Slider
-
- Slider consists of three visual items: \l {Control::background}{background},
- \l {Slider::track}{track} and \l {Slider::handle}{handle}.
-
- \section3 Background
-
- \image qtlabscontrols-slider-background.png
-
- Slider has no background item by default.
-
- \section3 Track
-
- \image qtlabscontrols-slider-track.png
-
- \snippet Slider.qml track
-
- \section3 Handle
-
- \image qtlabscontrols-slider-handle.png
-
- \snippet Slider.qml handle
-
-
- \section1 Customizing SpinBox
-
- SpinBox consists of four visual items: \l {Control::background}{background},
- \l {Control::contentItem}{contentItem}, \l {SpinBox::up.indicator}{up indicator},
- and \l {SpinBox::down.indicator}{down indicator}.
-
- \section3 Background
-
- \image qtlabscontrols-spinbox-background.png
-
- \snippet SpinBox.qml background
-
- \section3 Content item
-
- \image qtlabscontrols-spinbox-contentItem.png
-
- \snippet SpinBox.qml contentItem
-
- \section3 Down indicator
-
- \image qtlabscontrols-spinbox-down.png
-
- \snippet SpinBox.qml down.indicator
-
- \section3 Up indicator
-
- \image qtlabscontrols-spinbox-up.png
-
- \snippet SpinBox.qml up.indicator
-
-
- \section1 Customizing StackView
-
- StackView can have a visual \l {Control::background}{background}
- item, and it allows customizing the transitions that are used for
- push, pop, and replace operations.
-
- \section3 Push enter
-
- \snippet StackView.qml pushEnter
-
- \section3 Push exit
-
- \snippet StackView.qml pushExit
-
- \section3 Pop enter
-
- \snippet StackView.qml popEnter
-
- \section3 Pop exit
-
- \snippet StackView.qml popExit
-
- \section3 Replace enter
-
- \snippet StackView.qml replaceEnter
-
- \section3 Replace exit
-
- \snippet StackView.qml replaceExit
-
-
- \section1 Customizing SwipeView
-
- SwipeView can have a visual \l {Control::background}{background}
- item. The navigation is implemented by the \l {Control::contentItem}
- {content item}.
-
- \section3 Background
-
- SwipeView has no background item by default.
-
- \section3 Content item
-
- \snippet SwipeView.qml contentItem
-
- \section1 Customizing Switch
-
- Switch consists of three visual items: \l {Control::background}{background},
- \l {AbstractButton::label}{label} and \l {AbstractButton::indicator}{indicator}.
-
- \section3 Background
-
- \image qtlabscontrols-switch-background.png
-
- Switch has no background item by default.
-
- \section3 Label
-
- \image qtlabscontrols-switch-label.png
-
- \snippet Switch.qml label
-
- \section3 Indicator
-
- \image qtlabscontrols-switch-indicator.png
-
- \snippet Switch.qml indicator
-
-
- \section1 Customizing TabBar
-
- TODO
-
-
- \section1 Customizing TabButton
-
- TODO
-
-
- \section1 Customizing TextArea
-
- TODO
-
-
- \section1 Customizing TextField
-
- TextField offers a customizable \l {TextField::background}{background} item.
-
- \section3 Background
-
- \image qtlabscontrols-textfield-background.png
-
- \snippet TextField.qml background
-
-
- \section1 Customizing ToolBar
-
- ToolBar consists of two visual items: \l {Control::background}{background} and
- \l {Frame::frame}{frame}.
-
- \section3 Background
-
- \image qtlabscontrols-toolbar-background.png
-
- \snippet ToolBar.qml background
-
- \section3 Frame
-
- \image qtlabscontrols-toolbar-frame.png
-
- ToolBar has no frame item by default.
-
-
- \section1 Customizing ToolButton
-
- ToolButton consists of two visual items: \l {Control::background}{background}
- and \l {AbstractButton::label}{label}.
-
- \section3 Background
-
- \image qtlabscontrols-toolbutton-background.png
-
- \snippet ToolButton.qml background
-
- \section3 Label
-
- \image qtlabscontrols-toolbutton-label.png
-
- \snippet ToolButton.qml label
-
- \section1 Customizing Tumbler
-
- Tumbler consists of three visual items:
- \l {Control::background}{background},
- \l {Control::contentItem}{contentItem}, and
- \l {Tumbler::delegate}{delegate}.
-
- \section3 Background
-
- \image qtlabscontrols-tumbler-background.png
-
- Tumbler has no background item by default.
-
- \section3 Content Item
-
- \image qtlabscontrols-tumbler-contentItem.png
-
- \snippet Tumbler.qml contentItem
-
- \section3 Delegate
-
- \image qtlabscontrols-tumbler-delegate.png
-
- \snippet Tumbler.qml delegate
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-default.qdoc b/src/imports/controls/doc/src/qtlabscontrols-default.qdoc
deleted file mode 100644
index c885c161..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-default.qdoc
+++ /dev/null
@@ -1,53 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-default.html
- \title Default Style
-
- The Default style is a basic all-round style.
-
- The Default style a simple and light-weight style that offers the maximum
- performance for Qt Labs Controls. It is built with a minimal amount of Qt
- Quick primitives, and keeps animations and transitions to the minimum.
-
- \image qtlabscontrols-default.png
-
- The style is selected by default when running Qt Labs Controls applications.
- It is built into the module's resources, so by default it is shipped with
- any application that depends on the Qt Labs Controls module
-
- \note The Default style is used as a fallback for other styles. If a style
- does not implement a certain control, the Default style implementation of
- that control is selected.
-
- \section1 Related Information
-
- \list
- \li \l{Styling Qt Labs Controls}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc b/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
deleted file mode 100644
index 7fcce7a3..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
+++ /dev/null
@@ -1,283 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-differences.html
- \title Differences between Qt Quick Controls
-
- Qt Quick Controls were originally developed to support desktop platforms,
- with mobile and embedded support coming shortly afterwards. They have a
- very broad scope, in that they provide a styling system flexible enough to
- allow the development of applications that have either a platform-dependent
- or platform-independent style.
-
- On embedded systems, where the hardware has limited resources, this approach
- can be inefficient. Qt Labs Controls were designed to solve this problem,
- using
- \l {https://blog.qt.io/blog/2015/03/31/qt-quick-controls-for-embedded/}{benchmarks}
- to guide the development.
-
- \section2 C++ and QML
-
- In many cases, the internal state of a control can be more efficiently
- processed in C++. For example, handling input events in C++ makes a
- difference for controls that would otherwise need to create internal
- MouseAreas and attached Keys objects.
-
- \section2 Styles
-
- Not only does handling events and logic in C++ increase performance, but it
- allows the visual QML layer to be a simple, declarative layer on top. This
- is reflected in the structure of the controls project: all visual
- implementations sit in the \e imports folder, so that users who want to
- create their own complete style can copy the folder and start tweaking.
- Read more about implementing a style plugin \l {TODO}{here}.
-
- In Qt Labs Controls, styles no longer provide components that are
- dynamically instantiated by controls, but controls themselves consist of
- item delegates that can be replaced. In effect, this means that delegates
- are Qt Quick items that are instantiated on the spot, as properties of the
- control, and are simply parented to the control.
-
- \section2 Modularity and Simplicity
-
- When it comes to more complex controls, it is sometimes better to split
- them up into separate building blocks. As an example, the complex
- ScrollView control:
-
- \qml
- ScrollView {
- horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
- Flickable {
- // ...
- }
- }
- \endqml
-
- Is replaced with simple ScrollBar/ScrollIndicator controls that can be
- attached to any Flickable:
-
- \qml
- Flickable {
- // ...
- ScrollBar.vertical: ScrollBar { }
- }
- \endqml
-
- The API of Qt Labs Controls aims to be clean and simple. Common
- operations are easy, and more advanced ones are liberally documented with
- snippets that can be copied into your code.
-
- \section2 Feature Comparison Table
-
- \table
- \header
- \li
- \li Qt Quick Controls
- \li Qt Labs Controls
- \row
- \li Stylable delegates
- \li Yes
- \li Yes
- \row
- \li Pre-built native styles
- \li Yes
- \li No
- \row
- \li Runtime style changes
- \li Yes
- \li Yes
- \row
- \li Can be used on Desktop
- \li Yes
- \li Yes \b *
- \row
- \li Can be used on Mobile
- \li Yes
- \li Yes
- \row
- \li Can be used on Embedded
- \li Yes
- \li Yes
- \row
- \li Internal event handling
- \li QML
- \li C++
- \endtable
-
- \b {* No hover support}
-
- \section2 Porting Qt Quick Controls Code
-
- The API of Qt Labs Controls is very similar to Qt Quick Controls, but it
- does come with some changes necessary to facilitate the improvements. The
- majority of changes are to do with styling; all of a control's delegates
- are now accessible in the control itself, instead of in a separate style
- object.
-
- For example, to style a button in Qt Quick Controls:
-
- \badcode
- Button {
- style: ButtonStyle {
- label: Label {
- // ...
- }
- }
- }
- \endcode
-
- To style a button in Qt Labs Controls:
-
- \qml
- Button {
- label: Label {
- // ...
- }
- }
- \endqml
-
- \section3 Preparing for Migration
-
- With this in mind, a good way to prepare for a migration to Qt Quick
- Labs is to place each control that you have a custom style for in its
- own QML file. For example, the Qt Quick Controls button above could be moved to a
- file named Button.qml, and used in the following manner:
-
- \badcode
- import "controls" as Controls
-
- Controls.Button {
- ...
- }
- \endcode
-
- This works with both modules, and will reduce the amount of work needed
- when the migration begins.
-
- \section3 Type Changes
-
- \table
- \header
- \li Qt Quick Controls
- \li Qt Labs Controls
- \row
- \li \l [QtQuickControls] {Action}
- \li No equivalent; see \l [QtQuick] {Shortcut} instead.
- \row
- \li \l [QtQuickControls] {ApplicationWindow}
- \li \l [QtLabsControls] {ApplicationWindow}
- \row
- \li \l [QtQuickControls] {BusyIndicator}
- \li \l [QtLabsControls] {BusyIndicator}
- \row
- \li \l [QtQuickControls] {Button}
- \li \l [QtLabsControls] {Button}
- \row
- \li \l [QtQuickControls] {Calendar}
- \li No equivalent; see \l [QML] {MonthGrid}, \l [QML] {DayOfWeekRow} and \l [QML] {WeekNumberColumn} instead.
- \row
- \li \l [QtQuickControls] {CheckBox}
- \li \l [QtLabsControls] {CheckBox}
- \row
- \li \l [QtQuickControls] {ComboBox}
- \li \l [QtLabsControls] {ComboBox}
- \row
- \li \l [QtQuickControls] {ExclusiveGroup}
- \li \l [QtLabsControls] {ButtonGroup}
- \row
- \li \l [QtQuickControls] {GroupBox}
-
- \li \l [QtLabsControls] {GroupBox}, or \l [QtLabsControls] {Frame}
- if a title is not required.
-
- \row
- \li \l [QtQuickControls] {Label}
- \li \l [QtLabsControls] {Label}
- \row
- \li \l [QtQuickControls] {Menu}
- \li \l [QtLabsControls] {Menu}
- \row
- \li \l [QtQuickControls] {ProgressBar}
- \li \l [QtLabsControls] {ProgressBar}
- \row
- \li \l [QtQuickControls] {RadioButton}
- \li \l [QtLabsControls] {RadioButton}
- \row
- \li \l [QtQuickControls] {ScrollView}
- \li \l [QtLabsControls] {ScrollBar},
- \l [QtLabsControls] {ScrollIndicator}
- \row
- \li \l [QtQuickControls] {Slider}
- \li \l [QtLabsControls] {Slider}
- \row
- \li \l [QtQuickControls] {SpinBox}
- \li \l [QtLabsControls] {SpinBox}
- \row
- \li \l [QtQuickControls] {Stack},
- \l [QtQuickControls] {StackView},
- \l [QtQuickControls] {StackViewDelegate}
- \li \l [QtLabsControls] {StackView}
- \row
- \li \l [QtQuickControls] {StatusBar}
- \li No equivalent
- \row
- \li \l [QtQuickControls] {Switch}
- \li \l [QtLabsControls] {Switch}
- \row
- \li \l [QtQuickControls] {Tab},
- \l [QtQuickControls] {TabView}
- \li \l [QtLabsControls] {TabBar} in combination with, for example,
- \l [QtLabsControls] {SwipeView}.
- \row
- \li \l [QtQuickControls] {TableView}
- \li No equivalent
- \row
- \li \l [QtQuickControls] {TextArea}
- \li \l [QtLabsControls] {TextArea}
- \row
- \li \l [QtQuickControls] {TextField}
- \li \l [QtLabsControls] {TextField}
- \row
- \li \l [QtQuickControls] {ToolBar}
- \li \l [QtLabsControls] {ToolBar}
- \row
- \li \l [QtQuickControls] {ToolButton}
- \li \l [QtLabsControls] {ToolButton}
- \row
- \li \l [QtQuickControls] {TreeView}
- \li No equivalent
- \endtable
-
- \section1 Related Information
-
- \list
- \li \l{Qt Quick}
- \li \l{Qt Quick Controls}
- \li \l{Qt Labs Controls QML Types}{Qt Labs Controls QML Types}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-examples.qdoc b/src/imports/controls/doc/src/qtlabscontrols-examples.qdoc
deleted file mode 100644
index 04aabcfa..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-examples.qdoc
+++ /dev/null
@@ -1,68 +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$
-**
-****************************************************************************/
-
-/*!
- \group qtlabscontrols-examples
- \ingroup all-examples
- \title Qt Labs Controls Examples
- \brief A collection of examples for \l {Qt Labs Controls}
-
- These examples demonstrate creating user interfaces using \l {Qt Labs Controls}.
-*/
-
-/*!
- \example gallery
- \title Qt Labs Controls - Gallery
- \ingroup qtlabscontrols-examples
- \brief A gallery of controls
-
- \raw HTML
- <div class="table"><table style="background:transparent; border:0px">
- <tr><td style="border:0px">
- \endraw
- \image qtlabscontrols-gallery-welcome.png
- \caption Welcome Screen
- \raw HTML
- </td><td style="border:0px">
- \endraw
- \image qtlabscontrols-gallery-drawer.png
- \caption Side Drawer
- \raw HTML
- </td><td style="border:0px">
- \endraw
- \image qtlabscontrols-gallery-menu.png
- \caption Options Menu
- \raw HTML
- </td></tr>
- </table></div>
- \endraw
-
- This example project demonstrates the various UI controls provided by
- \l {Qt Labs Controls}.
-
- \include examples-run.qdocinc
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-gettingstarted.qdoc b/src/imports/controls/doc/src/qtlabscontrols-gettingstarted.qdoc
deleted file mode 100644
index fda89d5b..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-gettingstarted.qdoc
+++ /dev/null
@@ -1,71 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-gettingstarted.html
- \title Getting Started with Qt Labs Controls
-
- A basic example of a QML file that makes use of controls is shown here:
-
- \snippet basic-example.qml 0
-
- \section1 Setting Up Controls from C++
-
- Although QQuickView has traditionally been used to display QML files in a
- C++ application, doing this means you can only set window properties from
- C++.
-
- With Qt Labs Controls, declare an ApplicationWindow as the root item of
- your application and launch it by using QQmlApplicationEngine instead.
- This ensures that you can control top level window properties from QML.
-
- A basic example of a source file that makes use of controls is shown here:
-
- \code
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- return app.exec();
- }
- \endcode
-
- \section2 Using C++ Data From QML
-
- If you need to register a C++ class to use from QML, you can call
- qmlRegisterType() before declaring your QQmlApplicationEngine.
- See \l [QtQml] {Defining QML Types from C++} for more information.
-
- If you need to expose data to QML components, you need to make them
- available to the context of the current QML engine. See QQmlContext for
- more information.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc b/src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc
deleted file mode 100644
index e9f6a88b..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc
+++ /dev/null
@@ -1,62 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-highdpi.html
- \title High-DPI Support in Qt Labs Controls
-
- Qt Labs Controls support Qt's cross-platform high-DPI scaling introduced in Qt 5.6.
- The feature is opt-in, and can be enabled by setting the \c Qt::AA_EnableHighDpiScaling
- application attribute in C++ before QGuiApplication is constructed:
-
- \code
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <--
- QGuiApplication app(argc, argv);
- QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
- return app.exec();
- }
- \endcode
-
- Alternatively, an environment variable \c QT_AUTO_SCREEN_SCALE_FACTOR=1 can be set
- to enable automatic high-DPI scaling.
-
- \warning \l {Qt Quick Controls}{Qt Quick Controls 1.x} are not compatible with Qt's
- automatic high-DPI scaling. There is currently no available solution for high-DPI
- support in applications wishing to mix Qt Quick Controls and Qt Labs Controls.
-
- \section1 Related Information
- \list
- \li \l {High DPI Displays}
- \li \l {Scalability}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-index.qdoc b/src/imports/controls/doc/src/qtlabscontrols-index.qdoc
deleted file mode 100644
index 2f554db7..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-index.qdoc
+++ /dev/null
@@ -1,64 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-index.html
- \title Qt Labs Controls
-
- \brief Provides a set of UI controls for Qt Quick.
-
- Qt Labs Controls provides a set of controls that can be used
- to build complete interfaces in Qt Quick.
-
- \section1 QML Types
-
- \section2 Qt.labs.controls Module
- \generatelist {qmltypesbymodule Qt.labs.controls}
-
- \section2 Qt.labs.calendar Module
- \generatelist {qmltypesbymodule Qt.labs.calendar}
-
- \section1 Important Concepts in Qt Labs Controls
-
- \list
- \li \l{Getting Started with Qt Labs Controls}
- \li \l{Styling Qt Labs Controls}
- \li \l{High-DPI Support in Qt Labs Controls}
- \li \l{Differences between Qt Quick Controls}
- \endlist
-
- \section1 Related Information
-
- \list
- \li \l{Qt Quick}
- \li \l{Qt Quick Layouts}
- \li \l{Qt Labs Calendar}
- \li \l{Qt Labs Templates}
- \li \l{Qt Labs Controls QML Types}{Qt Labs Controls QML Types}
- \li \l{Qt Labs Controls Examples}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-indicators.qdoc b/src/imports/controls/doc/src/qtlabscontrols-indicators.qdoc
deleted file mode 100644
index 11d440f7..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-indicators.qdoc
+++ /dev/null
@@ -1,67 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-indicators.html
- \title Indicator Controls
-
- Qt Labs Controls offers a selection of indicator-like controls.
-
- \annotatedlist qtlabscontrols-indicators
-
- Each type of indicator has its own specific target use case. The following
- sections offer guidelines for choosing the appropriate type of indicator,
- depending on the use case.
-
- \section1 BusyIndicator Control
-
- \image qtlabscontrols-busyindicator.png
-
- \l BusyIndicator should be used to indicate activity.
-
- \section1 PageIndicator Control
-
- \image qtlabscontrols-pageindicator.png
-
- \l PageIndicator is used to indicate the currently active page in
- a container of multiple pages.
-
- \section1 ScrollBar Control
-
- \image qtlabscontrols-scrollbar.png
-
- \l ScrollBar is an interactive bar that indicates the current scroll
- position, and can be used to scroll to a specific position in a
- \l Flickable.
-
- \section1 ScrollIndicator Control
-
- \image qtlabscontrols-scrollindicator.png
-
- \l ScrollIndicator is a non-interactive indicator that indicates the
- current scroll position in a \l Flickable.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-input.qdoc b/src/imports/controls/doc/src/qtlabscontrols-input.qdoc
deleted file mode 100644
index 06c0b40d..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-input.qdoc
+++ /dev/null
@@ -1,83 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-input.html
- \title Input Controls
-
- Qt Labs Controls offers a variety of input controls for both numeric
- and textual input.
-
- \annotatedlist qtlabscontrols-input
-
- Each type of input control has its own specific target use case. The
- following sections offer guidelines for choosing the appropriate type
- of input control, depending on the use case.
-
- \section1 ComboBox Control
-
- \image qtlabscontrols-combobox.png
-
- \l ComboBox is used to select a value from a drop-down list.
-
- \section1 Dial Control
-
- \image qtlabscontrols-dial.png
-
- \l Dial is a circular dial that is rotated to set a value.
-
- \section1 TextArea Control
-
- \image qtlabscontrols-textarea.png
-
- \l TextArea is a multi-line text editor.
-
- \section1 TextField Control
-
- \image qtlabscontrols-textfield.png
-
- \l TextField is a single line text editor.
-
- \section1 Slider Control
-
- \image qtlabscontrols-slider.png
-
- \l Slider is used to select a value by sliding a handle along a track.
-
- \section1 RangeSlider Control
-
- \image qtlabscontrols-rangeslider.png
-
- \l RangeSlider is used to select a range specified by two values,
- by sliding each handle along a track.
-
- \section1 Tumbler Control
-
- \image qtlabscontrols-tumbler.png
-
- \l Tumbler is a spinnable wheel of items that can be selected.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-material.qdoc b/src/imports/controls/doc/src/qtlabscontrols-material.qdoc
deleted file mode 100644
index e2cadbda..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-material.qdoc
+++ /dev/null
@@ -1,200 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-material.html
- \title Material Style
-
- The Material Style is based on the Google Material Design Guidelines.
- \l {detailed-description}{More...}
-
- \styleimport {Qt.labs.controls.material 1.0}
-
- \section1 Attached Properties
-
- \list
- \li \l {accent-attached-prop}{\b accent} : color
- \li \l {primary-attached-prop}{\b primary} : color
- \li \l {theme-attached-prop}{\b theme} : enumeration
- \endlist
-
- \section1 Detailed Description
-
- The Material style is based on the \l {https://www.google.com/design/spec/material-design/introduction.html}
- {Google Material Design Guidelines}. It allows for a unified experience
- across platforms and device sizes.
-
- \image qtlabscontrols-material.png
- \caption The Material style in light and dark themes
-
- \note The Material style is not a native Android style. The Material
- style is a 100% cross-platform Qt Labs Controls style implementation that
- follows the Google Material Design Guidelines. The style runs on any
- platform, and looks more or less identical everywhere. Minor differences
- may occur due to differences in available system fonts and font rendering
- engines.
-
- \section2 Customization
-
- The Material style allows customizing three attributes, \l {theme-attached-prop}{theme},
- \l {primary-attached-prop}{primary} and \l {accent-attached-prop}{accent}. The following
- example illustrates how to create a red \e stop button with light text:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import Qt.labs.controls 1.0
- import Qt.labs.controls.material 1.0
-
- Button {
- text: "Stop"
- highlighted: true
-
- Material.accent: Material.Red
- Material.theme: Material.Dark
- }
- \endqml
- \li
- \image qtlabscontrols-material-button.png
- \endtable
-
- Both attributes can be specified for any window or item, and they automatically
- propagate to children in the same manner as \l {Control::font}{fonts}. In the
- following example, the window and all three radio buttons appear in the dark
- theme using a purple accent color:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import Qt.labs.controls 1.0
- import Qt.labs.controls.material 1.0
-
- ApplicationWindow {
- visible: true
-
- Material.theme: Material.Dark
- Material.accent: Material.Purple
-
- Column {
- anchors.centerIn: parent
-
- RadioButton { text: qsTr("Small") }
- RadioButton { text: qsTr("Medium"); checked: true }
- RadioButton { text: qsTr("Large") }
- }
- }
- \endqml
- \li
- \image qtlabscontrols-material-dark.png
- \endtable
-
- \note The Material style must be separately imported to gain access to
- these style-specific attributes. It should be noted that regardless of the
- references to the Material style, the same application code runs with any
- other style. The Material style-specific attributes only have an effect
- when the application is run with the Material style. Furthermore, in case
- of explicit Material style-specific references, the Material style must
- be deployed with the application.
-
- \section2 Pre-defined Colors
-
- Even though primary and accent can be any \l {colorbasictypedocs}{color}, it
- is recommended to use one of the pre-defined colors that have been designed
- to work well with the rest of the Material style palette:
-
- Available pre-defined colors:
- \value Material.Red Red (#F44336)
- \value Material.Pink Pink (#E91E63)
- \value Material.Purple Purple (#9C27B0)
- \value Material.DeepPurple Deep Purple (#673AB7)
- \value Material.Indigo Indigo (#3F51B5)
- \value Material.Blue Blue (#2196F3)
- \value Material.LightBlue Light Blue (#03A9F4)
- \value Material.Cyan Cyan (#00BCD4)
- \value Material.Teal Teal (#009688)
- \value Material.Green Green (#4CAF50)
- \value Material.LightGreen Light Green (#8BC34A)
- \value Material.Lime Lime (#CDDC39)
- \value Material.Yellow Yellow (#FFEB3B)
- \value Material.Amber Amber (#FFC107)
- \value Material.Orange Orange (#FF9800)
- \value Material.DeepOrange Deep Orange (#FF5722)
- \value Material.Brown Brown (#795548)
- \value Material.Grey Grey (#9E9E9E)
- \value Material.BlueGrey Blue Grey (#607D8B)
-
- \labs
-
- \section1 Attached Property Documentation
-
- \styleproperty {Material.accent} {color} {accent-attached-prop}
- \target accent-attached-prop
- This attached property holds the accent color of the theme. The property
- can be attached to any window or item. The value is propagated to children.
-
- The default value is \c Material.Teal.
-
- \note Even though the accent can be any \l {colorbasictypedocs}{color}, it is
- recommended to use one of the \l {pre-defined colors} that have been designed
- to work well with the rest of the Material style palette.
-
- \endstyleproperty
-
- \styleproperty {Material.primary} {color} {primary-attached-prop}
- \target primary-attached-prop
- This attached property holds the primary color of the theme. The property
- can be attached to any window or item. The value is propagated to children.
-
- The default value is \c Material.BlueGray.
-
- \note Even though the primary can be any \l {colorbasictypedocs}{color}, it is
- recommended to use one of the \l {pre-defined colors} that have been designed
- to work well with the rest of the Material style palette.
-
- \endstyleproperty
-
- \styleproperty {Material.theme} {enumeration} {theme-attached-prop}
- \target theme-attached-prop
- This attached property holds whether the theme is light or dark. The property
- can be attached to any window or item. The value is propagated to children.
-
- Available themes:
- \value Material.Light Light theme (default)
- \value Material.Dark Dark theme
-
- \endstyleproperty
-
- \section1 Related Information
-
- \list
- \li \l{Styling Qt Labs Controls}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-menus.qdoc b/src/imports/controls/doc/src/qtlabscontrols-menus.qdoc
deleted file mode 100644
index 65b4f04c..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-menus.qdoc
+++ /dev/null
@@ -1,43 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-menus.html
- \title Menu Controls
-
- \annotatedlist qtlabscontrols-menus
-
- Each type of menu control has its own specific target use case. The
- following sections offer guidelines for choosing the appropriate type
- of menu control, depending on the use case.
-
- \section1 Menu Control
-
- \image qtlabscontrols-menu.png
-
- \l Menu is a traditional menu.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-navigation.qdoc b/src/imports/controls/doc/src/qtlabscontrols-navigation.qdoc
deleted file mode 100644
index 8d919d45..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-navigation.qdoc
+++ /dev/null
@@ -1,56 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-navigation.html
- \title Navigation Controls
-
- Qt Labs Controls offers a selection of navigation models.
-
- \annotatedlist qtlabscontrols-navigation
-
- The following sections offer guidelines for choosing the appropriate type
- of navigation model, depending on the use case.
-
- \section1 StackView Control
-
- \image qtlabscontrols-stackview-wireframe.png
-
- \l StackView provides a stack-based navigation model.
-
- \section1 SwipeView Control
-
- \image qtlabscontrols-swipeview-wireframe.png
-
- \l SwipeView provides a swipe-based navigation model.
-
- \section1 TabBar and TabButton Controls
-
- \image qtlabscontrols-tabbar-wireframe.png
-
- \l TabBar and \l TabButton provide a tab-based navigation model.
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-styles.qdoc b/src/imports/controls/doc/src/qtlabscontrols-styles.qdoc
deleted file mode 100644
index 858a9105..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-styles.qdoc
+++ /dev/null
@@ -1,119 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-styles.html
- \title Styling Qt Labs Controls
-
- Qt Labs Controls comes with a selection of styles. The \l {Default Style}
- {Default} style is a simple and light-weight all-round style that offers
- the maximum performance for Qt Labs Controls. The more advanced
- \l {Universal Style}{Universal} and \l {Material Style}{Material} styles
- offer an appealing design, but require more system resources.
-
- \section1 Usage
-
- In order to run an application with a specific style, either pass a command
- line argument, or set an environment variable. Alternatively, the preferred
- style and style-specific attributes can be specified in a configuration file.
-
- \section2 Command line argument
-
- Passing a \c -style command line argument is the convenient way to test different
- styles. It takes precedence over the other methods listed below. The following
- example runs a Qt Labs Controls application with the Material style:
-
- \code
- ./app -style material
- \endcode
-
- \section2 Environment variable
-
- Setting the \c QT_LABS_CONTROLS_STYLE environment variable can be used to set
- a system-wide style preference. It takes precedence over the configuration file
- mentioned below. The following example runs a Qt Labs Controls application with
- the Universal style:
-
- \code
- QT_LABS_CONTROLS_STYLE=universal ./app
- \endcode
-
- \section2 Configuration file
-
- Qt Labs Controls support a special configuration file, \c :/qtlabscontrols.conf,
- that is built into an application's resources.
-
- The configuration file can specify the preferred style (may be overridden by either
- of the methods described earlier) and certain style-specific attributes. The following
- example specifies that the preferred style is the Material style. Furthermore, when the
- application is run with the Material style, its theme is light and the accent color is
- brown. However, if the application is run with the Universal style instead, the theme
- is dark and the accent color is red.
-
- \code
- [Controls]
- Style=Material
-
- [Universal]
- Theme=Dark
- Accent=Red
-
- [Material]
- Theme=Light
- Accent=Brown
- \endcode
-
- In order to make it possible for Qt Labs Controls to find the configuration file,
- it must be built into application's resources using the \l {The Qt Resource System}.
- Here's an example \c .qrc file:
-
- \code
- <!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/">
- <file>qtlabscontrols.conf</file>
- </qresource>
- </RCC>
- \endcode
-
- \note Qt Labs Controls uses a file selector to load the configuration file. It
- is possible to provide a different configuration file for different platforms and
- locales. See \l QFileSelector documentation for more details.
-
- Finally, the \c .qrc file must be listed in the application's \c .pro file so that
- the build system knows about it. For example:
-
- \code
- RESOURCES = application.qrc
- \endcode
-
- \section1 Related Information
- \list
- \li \l {Default Style}
- \li \l {Material Style}
- \li \l {Universal Style}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-universal.qdoc b/src/imports/controls/doc/src/qtlabscontrols-universal.qdoc
deleted file mode 100644
index bf3dcfdc..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols-universal.qdoc
+++ /dev/null
@@ -1,179 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabscontrols-universal.html
- \title Universal Style
-
- The Universal Style is based on the Microsoft Universal Design Guidelines.
- \l {detailed-description}{More...}
-
- \styleimport {Qt.labs.controls.universal 1.0}
-
- \section1 Attached Properties
-
- \list
- \li \l {accent-attached-prop}{\b accent} : color
- \li \l {theme-attached-prop}{\b theme} : enumeration
- \endlist
-
- \section1 Detailed Description
-
- The Universal style is a device-agnostic style based on the
- \l {https://dev.windows.com/design}{Microsoft Universal Design Guidelines}.
- The Universal style has been designed to look good on all devices, from
- phones and tablets to PCs.
-
- \image qtlabscontrols-universal.png
- \caption The Universal style in light and dark themes
-
- \note The Universal style is not a native Windows 10 style. The Universal
- style is a 100% cross-platform Qt Labs Controls style implementation that
- follows the Microsoft Universal Design Guidelines. The style runs on any
- platform, and looks more or less identical everywhere. Minor differences
- may occur due to differences in available system fonts and font rendering
- engines.
-
- \section2 Customization
-
- The Universal style allows customizing two attributes, \l {theme-attached-prop}{theme}
- and \l {accent-attached-prop}{accent}. The following example illustrates how to create
- a red \e stop button with light text:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import Qt.labs.controls 1.0
- import Qt.labs.controls.universal 1.0
-
- Button {
- text: "Stop"
- highlighted: true
-
- Universal.accent: Universal.Red
- Universal.theme: Universal.Dark
- }
- \endqml
- \li
- \image qtlabscontrols-universal-button.png
- \endtable
-
- Both attributes can be specified for any window or item, and they automatically
- propagate to children in the same manner as \l {Control::font}{fonts}. In the
- following example, the window and all three radio buttons appear in the dark
- theme using a violet accent color:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import Qt.labs.controls 1.0
- import Qt.labs.controls.universal 1.0
-
- ApplicationWindow {
- visible: true
-
- Universal.theme: Universal.Dark
- Universal.accent: Universal.Violet
-
- Column {
- anchors.centerIn: parent
-
- RadioButton { text: qsTr("Small") }
- RadioButton { text: qsTr("Medium"); checked: true }
- RadioButton { text: qsTr("Large") }
- }
- }
- \endqml
- \li
- \image qtlabscontrols-universal-dark.png
- \endtable
-
- \note The Universal style must be separately imported to gain access to
- these style-specific attributes. It should be noted that regardless of the
- references to the Universal style, the same application code runs with any
- other style. The Universal style-specific attributes only have an effect
- when the application is run with the Universal style. Furthermore, in case
- of explicit Universal style-specific references, the Universal style must
- be deployed with the application.
-
- \labs
-
- \section1 Attached Property Documentation
-
- \styleproperty {Universal.accent} {color} {accent-attached-prop}
- \target accent-attached-prop
- This attached property holds the accent color of the theme. The property
- can be attached to any window or item. The value is propagated to children.
-
- Even though the accent can be any \l {colorbasictypedocs}{color}, it is
- recommended to use one of the pre-defined accents that have been designed
- to work well with the rest of the Universal style palette:
-
- \value Universal.Lime Lime (#A4C400)
- \value Universal.Green Green (#60A917)
- \value Universal.Emerald Emerald (#008A00)
- \value Universal.Teal Teal (#00ABA9)
- \value Universal.Cyan Cyan (#1BA1E2)
- \value Universal.Cobalt Cobalt (#3E65FF, default)
- \value Universal.Indigo Indigo (#6A00FF)
- \value Universal.Violet Violet (#AA00FF)
- \value Universal.Pink Pink (#F472D0)
- \value Universal.Magenta Magenta (#D80073)
- \value Universal.Crimson Crimson (#A20025)
- \value Universal.Red Red (#E51400)
- \value Universal.Orange Orange (#FA6800)
- \value Universal.Amber Amber (#F0A30A)
- \value Universal.Yellow Yellow (#E3C800)
- \value Universal.Brown Brown (#825A2C)
- \value Universal.Olive Olive (#6D8764)
- \value Universal.Steel Steel (#647687)
- \value Universal.Mauve Mauve (#76608A)
- \value Universal.Taupe Taupe (#87794E)
-
- \endstyleproperty
-
- \styleproperty {Universal.theme} {enumeration} {theme-attached-prop}
- \target theme-attached-prop
- This attached property holds whether the theme is light or dark. The property
- can be attached to any window or item. The value is propagated to children.
-
- Available themes:
- \value Universal.Light Light theme (default)
- \value Universal.Dark Dark theme
-
- \endstyleproperty
-
- \section1 Related Information
-
- \list
- \li \l{Styling Qt Labs Controls}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols.qdoc b/src/imports/controls/doc/src/qtlabscontrols.qdoc
deleted file mode 100644
index 17e93a44..00000000
--- a/src/imports/controls/doc/src/qtlabscontrols.qdoc
+++ /dev/null
@@ -1,62 +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$
-**
-****************************************************************************/
-
-/*!
- \qmlmodule Qt.labs.controls 1.0
- \title Qt Labs Controls QML Types
- \ingroup qmlmodules
- \brief Provides QML types for user interfaces (Qt Labs Controls).
-
- \l{Qt Labs Controls} provides QML types for creating user interfaces.
- These QML types work in conjunction with \l{Qt Quick} and
- \l{Qt Quick Layouts}.
-
- Qt Labs Controls QML types can be imported into your application
- using the following import statement in your .qml file:
-
- \badcode
- import Qt.labs.controls 1.0
- \endcode
-
- The calendar related QML types can be imported using the
- following statement:
-
- \badcode
- import Qt.labs.calendar 1.0
- \endcode
-
- \labs
-
- \section1 QML Types
-
- \section2 Qt.labs.controls Module
- \generatelist {qmltypesbymodule Qt.labs.controls}
-
- \section2 Qt.labs.calendar Module
- \generatelist {qmltypesbymodule Qt.labs.calendar}
- \noautolist
-*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
new file mode 100644
index 00000000..5e2c9370
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-buttons.html
+ \title Button Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for button controls
+
+ Qt Quick Controls 2 offers a selection of button-like controls.
+
+ \annotatedlist qtquickcontrols2-buttons
+
+ Each type of button has its own specific use case. The following
+ sections offer guidelines for choosing the appropriate type of button,
+ depending on the use case.
+
+ \section1 Button Control
+
+
+ \l Button is a clickable control that starts an action, or opens or
+ closes a popup. A button usually has a text label but it can also
+ contain an icon.
+
+ Button is a very suitable control when a popup or dialog needs
+ to perform an action. The most common examples are Apply, Cancel,
+ Save, Close and Help.
+
+ \image qtquickcontrols2-button.gif
+
+ Recommendations:
+
+ \list
+ \li The button's text should be a verb describing the action, or a noun matching
+ the title of the popup that will be opened.
+ \li Don't use a button to set state. \l Switch is more suitable for that.
+ \li Use the default font unless you have UI guidelines specifying otherwise.
+ \li If the text is localized, consider the influence of a longer text on the layout.
+ \endlist
+
+ \b {See also} \l Button and \l AbstractButton
+
+ \section1 CheckBox Control
+
+ \image qtquickcontrols2-checkbox.gif
+
+ \l CheckBox is used to build multi-selection option lists. Any number of
+ options can be selected, including none, but the options should
+ not be mutually exclusive.
+
+ Use a single CheckBox for a yes/no choice, such as when you have
+ to accept the terms of service agreement in a form.
+
+ For a single yes/no choice, it is also possible to use a switch. If the choice
+ concerns an option, it is best to use a CheckBox. If it concerns action to
+ be taken, a switch is recommended.
+
+ When options can be grouped, you can use a partially checked CheckBox to
+ represent the whole group. Use the checkbox's indeterminate state when
+ a user selects some, but not all, sub-items in the group.
+
+ The three availables statuses are: checked, unchecked and disabled.
+ "Disabled" is useful when the user should not be able to check or uncheck
+ a checkbox.
+
+ The checkable options are often listed vertically.
+
+ Recommendations:
+ \list
+ \li The checkbox label should be a statement that the check mark makes true,
+ and that the absence of a check mark makes false.
+ \li The checkbox label should not contain a negative statement.
+ \li Use the default font, unless you have UI guidelines specifying otherwise.
+ \li If the text is localized, consider the influence of a longer text on the layout.
+ \endlist
+
+ \b {See also} \l CheckBox
+
+ \section1 RadioButton Control
+
+ \image qtquickcontrols2-radiobutton.gif
+
+ \l RadioButton is used to select only one option from a set of options.
+ Selecting one option automatically deselects the one selected before.
+
+ The set of options should not be too large, otherwise it starts taking too much
+ space on the screen. In that case it would be more practical to use a \l ComboBox.
+
+ If there are only two mutually exclusive options, combine them into a
+ single checkbox or a switch.
+
+ Recommendations:
+
+ \list
+ \li Limit the label text to one line.
+ \li Ensure that a sensible default option is checked.
+ \li List RadioButton options vertically.
+ \li If the text is localized, consider the influence of a longer text on the layout.
+ \li Use the default font, unless you have UI guidelines that specify otherwise.
+ \li Just like with CheckBox, do not make the list too large.
+ \li In order to avoid confusion, do not put two groups of radio buttons next to each
+ other.
+ \endlist
+
+ \b {See also} \l RadioButton
+
+ \section1 Switch Control
+
+ \image qtquickcontrols2-switch.png
+
+ \l Switch represents a physical switch that allows users to choose between an "on"
+ or "off" state.
+ Use a switch for binary operations that take effect immediately after it has been
+ switched on. For example, a switch to turn WIFI on or off.
+
+ Recommendations:
+
+ \list
+ \li Keep labels short and concise.
+ \li If the text is localized, consider the influence of a longer text on the layout.
+ \endlist
+
+ \b {See also} \l Switch
+
+ \section1 ToolButton Control
+
+ \image qtquickcontrols2-toolbutton.png
+
+ \l ToolButton is nearly identical to \l Button, but it has a graphical
+ appearance that makes it more suitable for insertion into a \l ToolBar.
+
+ \b {See also} \l ToolButton
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
new file mode 100644
index 00000000..29bfc99c
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-configuration.html
+ \title Qt Quick Controls 2 Configuration File
+
+ Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf,
+ that is built into an application's resources.
+
+ The configuration file can specify the preferred style and certain style-specific
+ attributes. The following example specifies that the preferred style is the \l {Material style}.
+ Furthermore, when the application is run with the Material style, its theme is light and the
+ accent and primary colors are teal and blue grey, respectively. However, if the application
+ is run with the \l {Universal style} instead, the theme is dark and the accent color is red.
+
+ \code
+ [Controls]
+ Style=Material
+
+ [Universal]
+ Theme=Dark
+ Accent=Red
+
+ [Material]
+ Theme=Light
+ Accent=Teal
+ Primary=BlueGrey
+ \endcode
+
+ \l {Material style} specific values that can be specified in a \c Material
+ section of the configuration file:
+
+ \include qquickmaterialstyle.qdocinc conf
+
+ \l {Universal style} specific values that can be specified in a \c Universal
+ section of the configuration file:
+
+ \include qquickuniversalstyle.qdocinc conf
+
+ In order to make it possible for Qt Quick Controls 2 to find the configuration file,
+ it must be built into application's resources using the \l {The Qt Resource System}.
+ Here's an example \c .qrc file:
+
+ \code
+ <!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/">
+ <file>qtquickcontrols2.conf</file>
+ </qresource>
+ </RCC>
+ \endcode
+
+ \note Qt Quick Controls 2 uses a file selector to load the configuration file. It
+ is possible to provide a different configuration file for different platforms and
+ locales. See \l QFileSelector documentation for more details.
+
+ Finally, the \c .qrc file must be listed in the application's \c .pro file so that
+ the build system knows about it. For example:
+
+ \code
+ RESOURCES = application.qrc
+ \endcode
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \li \l{Supported Environment Variables in Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-containers.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-containers.qdoc
new file mode 100644
index 00000000..d19cff5a
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-containers.qdoc
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-containers.html
+ \title Container Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for container controls
+
+ Qt Quick Controls 2 offers a selection of container-like controls.
+
+ \annotatedlist qtquickcontrols2-containers
+
+ Each type of container can be used to group a set of controls together.
+ The following sections offer guidelines for choosing the appropriate type
+ of container, depending on the use case.
+
+ \section1 ApplicationWindow Control
+
+ \image qtquickcontrols2-applicationwindow-wireframe.png
+
+ \l ApplicationWindow creates the root window of an application, and makes
+ it easy to add an optional header and footer to that window.
+
+ \section1 Frame Control
+
+ \image qtquickcontrols2-frame.png
+
+ \l Frame is used to layout a logical group of controls together, within
+ a visual frame.
+
+ \section1 GroupBox Control
+
+ \image qtquickcontrols2-groupbox.png
+
+ \l GroupBox is used to layout a logical group of controls together,
+ within a titled visual frame.
+
+ \section1 Page Control
+
+ \image qtquickcontrols2-page-wireframe.png
+
+ \l Page provides page-specific header and footer items.
+ It is perfectly possible to use ApplicationWindow for setting the header
+ and the footer, but if you have a header and footer which varies per
+ screen, then it is better to use \l Page.
+
+ \section1 Pane Control
+
+ \image qtquickcontrols2-pane.png
+
+ \l 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 position its contents, for instance by using a \l RowLayout or
+ a \l ColumnLayout.
+
+ \section1 StackView Control
+
+ \image qtquickcontrols2-stackview-wireframe.png
+
+ \l StackView organizes content pages into a stack using a last-in-first-out
+ principle: the last item to be "pushed" onto the stack is the first one to
+ be removed, and the top-most item is always the one that is visible.
+
+ \section1 SwipeView Control
+
+ \image qtquickcontrols2-swipeview-wireframe.png
+
+ \l SwipeView organizes content pages into a swipable strip.
+
+ \section1 TabBar Control
+
+ \image qtquickcontrols2-tabbar-wireframe.png
+
+ \l TabBar organizes content pages into tabs.
+
+ \section1 ToolBar Control
+
+ \image qtquickcontrols2-toolbar.png
+
+ \l ToolBar is a container of application-wide and context-sensitive
+ actions and controls.
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-cppclasses.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-cppclasses.qdoc
new file mode 100644
index 00000000..5c2b9486
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-cppclasses.qdoc
@@ -0,0 +1,50 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \module QtQuickControls2
+ \title Qt Quick Controls 2 C++ Classes
+ \ingroup modules
+ \brief Provides classes for setting up the controls from C++.
+
+ The C++ types can be included into your application using the following
+ include statement:
+
+ \code
+ #include <QtQuickControls2>
+ \endcode
+
+ \note If you are using a few classes from this module, we recommend including
+ those specific classes only instead of the module.
+
+ To link against the corresponding C++ libraries, add the following to your
+ qmake project file:
+
+ \code
+ QT += quickcontrols2
+ \endcode
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
new file mode 100644
index 00000000..71ffe350
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -0,0 +1,750 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-customize.html
+ \title Customizing Qt Quick Controls 2
+ \brief A set of UI controls to create user interfaces in Qt Quick
+
+ Qt Quick Controls 2 consist of a hierarchy (tree) of items. In order to
+ provide a custom look and feel, the default QML implementation of each
+ item can be replaced with a custom one.
+
+ \section1 Customizing a Control
+
+ Sometimes you'll want to create a "one-off" look for a specific part of
+ your UI, and use a complete style everywhere else. Perhaps you're happy
+ with the style you're using, but there's a certain button that has some
+ special significance.
+
+ The first way to create this button is to simply define it in-place,
+ wherever it is needed. For example, perhaps you're not satisfied with the
+ default style's Button having square corners. To make them rounded, you
+ can override the \l {Control::}{background} item and set the radius
+ property of Rectangle:
+
+ \qml
+ import QtQuick 2.6
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ width: 400
+ height: 400
+ visible: true
+
+ Button {
+ id: button
+ text: "A Special Button"
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ color: button.down ? "#d6d6d6" : "#f6f6f6"
+ border.color: "#26282a"
+ border.width: 1
+ radius: 4
+ }
+ }
+ }
+ \endqml
+
+ The second way to create the button is good if you plan to use your rounded
+ button in several places. It involves moving the code into its own QML file
+ within your project.
+
+ For this approach, we'll copy the background code from the default style's
+ \c Button.qml. This file can be found in the following path in your Qt
+ installation:
+
+ \c {$QTDIR/qml/QtQuick/Controls.2/Button.qml}
+
+ After doing that, we'll simply add the following line:
+
+ \code
+ radius: 4
+ \endcode
+
+ To avoid confusion with the controls in the
+ module itself, we'll call the file \c MyButton.qml. To use the control in
+ your application, refer to it by its filename:
+
+ \qml
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ MyButton {
+ text: qsTr("A Special Button")
+ }
+ }
+ \endqml
+
+ The third way to create the button is a bit more structured, both in terms
+ of where the file sits in the file system and how it is used in QML. First,
+ copy an existing file as you did above, but this time, put it into a
+ subfolder in your project named (for example) \c controls. To use the
+ control, first import the folder into a namespace:
+
+ \qml
+ import QtQuick.Controls 2.0
+ import "controls" as MyControls
+
+ ApplicationWindow {
+ MyControls.Button {
+ text: qsTr("A Special Button")
+ }
+ }
+ \endqml
+
+ As you now have the \c MyControls namespace, you can name the controls after
+ their actual counterparts in the Qt Quick Controls 2 module. You can repeat
+ this process for any control that you wish to add.
+
+ \section1 Creating a Custom Style
+
+ There are several ways to go about creating your own styles. Below, we'll
+ explain the various approaches.
+
+ \section2 Definition of a Style
+
+ In Qt Quick Controls 2, a style is essentially an interchangeable set of
+ QML files within a single directory. There are two requirements for a style
+ to be \l {Using Styles in Qt Quick Controls 2}{usable}:
+
+ \list
+ \li At least one QML file whose name matches a control (for example,
+ \c Button.qml) must exist.
+
+ The Default style will be used for any controls that aren't implemented.
+ \li The files must be in a directory in the filesystem or in the
+ \l {The Qt Resource System}{resource system}.
+
+ For example, these are all valid paths to a style:
+
+ \list
+ \li \c {./myapp -style /home/absolute/path/to/my/style}
+ \li \c {./myapp -style :/mystyle}
+ \li \c {./myapp -style relative/path/to/my/style}
+ \li \c {./myapp -style MyStyle}
+ \endlist
+
+ The third and fourth paths will be looked up within the QML engine's import path
+ list. This is the same as what happens when you pass \c Material as the style,
+ for example.
+ \endlist
+
+ What this means is that you can implement as many controls as you like for
+ your custom style, and place them almost anywhere. It also allows users to
+ create their own styles for your application.
+
+ \section2 Style-specific C++ Extensions
+
+ Sometimes you may need to use C++ to extend your custom style. There are two
+ ways to expose such types to QML:
+
+ \list
+ \li If the style that uses the type is the only style used by an application,
+ it's enough to register it with the QML engine via qmlRegisterType():
+
+ \code
+ qmlRegisterType<ACoolCppItem>("MyApp", 1, 0, "ACoolItem");
+ \endcode
+
+ See \l {Using C++ Data From QML} for more information about this.
+ \li If the style that uses the type is one of many styles used by an
+ application, it may be better to only register it when necessary. This
+ is the point at which it would make sense to implement your own
+ \l {Creating C++ Plugins for QML}{QML plugin}.
+
+ Using a plugin as part of your style is not that much different from
+ using a set of QML files. The only difference is that the plugin and
+ its \c qmldir file must be present in the same directory as the QML
+ files.
+ \endlist
+
+ \section3 Attached properties
+
+ It is common for a style to have certain properties or attributes that
+ apply to all controls. \l {Attached Properties and Attached Signal
+ Handlers}{Attached properties} are a great way of extending an item in QML
+ without having to modify any existing C++ belonging to that item. For
+ example, both the \l {Material Style}{Material} and \l {Universal
+ Style}{Universal} styles have an attached theme property that controls
+ whether an item and its children will be rendered in a light or dark theme.
+
+ As an example, let's add an attached property that controls elevation. Our
+ style will illustrate the elevation with a drop shadow; the higher the
+ elevation, the larger the shadow.
+
+ The first step is to add a C++ type that stores the elevation. Since the
+ type will be used for every control supported by our style, and because we
+ may wish to add other attached properties later on, we'll call it
+ MyStyle. Here is \c MyStyle.h:
+
+ \code
+ #ifndef MYSTYLE_H
+ #define MYSTYLE_H
+
+ #include <QObject>
+ #include <QtQml>
+
+ class MyStyle : public QObject
+ {
+ Q_OBJECT
+ Q_PROPERTY(int elevation READ elevation WRITE setElevation NOTIFY elevationChanged)
+
+ public:
+ explicit MyStyle(QObject *parent = nullptr);
+
+ static MyStyle *qmlAttachedProperties(QObject *object);
+
+ int elevation() const;
+ void setElevation(int elevation);
+
+ signals:
+ void elevationChanged();
+
+ private:
+ int m_elevation;
+ };
+
+ QML_DECLARE_TYPEINFO(MyStyle, QML_HAS_ATTACHED_PROPERTIES)
+
+ #endif // MYSTYLE_H
+ \endcode
+
+ \c MyStyle.cpp:
+
+ \code
+ #include "mystyle.h"
+
+ MyStyle::MyStyle(QObject *parent) :
+ QObject(parent),
+ m_elevation(0)
+ {
+ }
+
+ MyStyle *MyStyle::qmlAttachedProperties(QObject *object)
+ {
+ return new MyStyle(object);
+ }
+
+ int MyStyle::elevation() const
+ {
+ return m_elevation;
+ }
+
+ void MyStyle::setElevation(int elevation)
+ {
+ if (elevation == m_elevation)
+ return;
+
+ m_elevation = elevation;
+ emit elevationChanged();
+ }
+ \endcode
+
+ The \c MyStyle type is special in the sense that it shouldn't be
+ instantiated, but rather used for its attached properties. For that reason,
+ we register it in the following manner:
+
+ \code
+ qmlRegisterUncreatableType<MyStyle>("MyStyle", 1, 0, "MyStyle", "MyStyle is an attached property");
+ \endcode
+
+ We then copy the existing default Button style, and add the code for a drop
+ shadow (which was taken from the Material Button style). We modify that
+ slightly to ensure that we:
+
+ \list
+ \li Don't bother using the drop shadow when the elevation is \c 0
+ \li Change the shadow's color depending on whether or not the button has
+ focus
+ \li Make the size of the shadow depend on the elevation
+ \endlist
+
+ \code
+ layer.enabled: control.enabled && control.MyStyle.elevation > 0
+ layer.effect: DropShadow {
+ verticalOffset: 1
+ color: control.visualFocus ? "#330066ff" : "#aaaaaa"
+ samples: control.MyStyle.elevation
+ spread: 0.5
+ }
+ \endcode
+
+ With that in place, we can try out our new elevation feature:
+
+ \qml
+ import QtQuick 2.6
+ import QtQuick.Controls 2.0
+
+ import MyStyle 1.0
+
+ ApplicationWindow {
+ id: window
+ width: 400
+ height: 400
+ visible: true
+
+ Row {
+ spacing: 20
+ anchors.centerIn: parent
+
+ Button {
+ text: "Button 1"
+ }
+ Button {
+ text: "Button 2"
+ MyStyle.elevation: 10
+ }
+ }
+ }
+ \endqml
+
+ The end result:
+
+ \image qtquickcontrols2-customize-buttons.png
+
+ \section1 Customization Reference
+
+ The following snippets present examples where the default style's controls
+ have been customized using the same approach as the
+ \l {Customizing a Control} section. The code can be used as a starting
+ point to implement a custom look and feel.
+
+ \section2 Customizing ApplicationWindow
+
+ ApplicationWindow consists of one visual item:
+ \l {ApplicationWindow::background}{background}. It is also possible
+ to customize the \l {ApplicationWindow::overlay}{modal} and
+ \l {ApplicationWindow::overlay}{modeless} items.
+
+ \code
+ import QtQuick 2.7
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ visible: true
+
+ background: Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#ffffff" }
+ GradientStop { position: 1; color: "#c1bbf9" }
+ }
+ }
+
+ overlay.modal: Rectangle {
+ color: "#8f28282a"
+ }
+
+ overlay.modeless: Rectangle {
+ color: "#2f28282a"
+ }
+ }
+ \endcode
+
+
+ \section2 Customizing BusyIndicator
+
+ BusyIndicator consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{contentItem}.
+
+ \image qtquickcontrols2-busyindicator-custom.png
+
+ \snippet qtquickcontrols2-busyindicator-custom.qml file
+
+
+ \section2 Customizing Button
+
+ Button consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-button-custom.png
+
+ \snippet qtquickcontrols2-button-custom.qml file
+
+
+ \section2 Customizing CheckBox
+
+ CheckBox consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
+
+ \image qtquickcontrols2-checkbox-custom.png
+
+ \snippet qtquickcontrols2-checkbox-custom.qml file
+
+ \section2 Customizing CheckDelegate
+
+ CheckDelegate consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
+
+ \image qtquickcontrols2-checkdelegate-custom.png
+
+ \snippet qtquickcontrols2-checkdelegate-custom.qml file
+
+
+ \section2 Customizing ComboBox
+
+ ComboBox consists of \l {Control::background}{background},
+ \l {Control::contentItem}{content item}, \l {ComboBox::popup}{popup},
+ and \l {ComboBox::delegate}{delegate}.
+
+ \image qtquickcontrols2-combobox-custom.png
+
+ \snippet qtquickcontrols2-combobox-custom.qml file
+
+
+ \section2 Customizing Dial
+
+ Dial consists of two visual items: \l {Control::background}{background}
+ and \l {Dial::handle}{handle}.
+
+ \image qtquickcontrols2-dial-custom.png
+
+ \snippet qtquickcontrols2-dial-custom.qml file
+
+
+ \section2 Customizing Drawer
+
+ Drawer can have a visual \l {Control::background}{background}
+ item.
+
+ \code
+ background: Rectangle {
+ Rectangle {
+ x: parent.width - 1
+ width: 1
+ height: parent.height
+ color: "#21be2b"
+ }
+ }
+ \endcode
+
+
+ \section2 Customizing Frame
+
+ Frame consists of one visual item: \l {Control::background}{background}.
+
+ \image qtquickcontrols2-frame-custom.png
+
+ \snippet qtquickcontrols2-frame-custom.qml file
+
+
+ \section2 Customizing GroupBox
+
+ GroupBox consists of two visual items: \l {Control::background}{background}
+ and \l {GroupBox::label}{label}.
+
+ \image qtquickcontrols2-groupbox-custom.png
+
+ \snippet qtquickcontrols2-groupbox-custom.qml file
+
+
+ \section2 Customizing ItemDelegate
+
+ ItemDelegate consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-itemdelegate-custom.png
+
+ \snippet qtquickcontrols2-itemdelegate-custom.qml file
+
+
+ \section2 Customizing Label
+
+ Label can have a visual \l {Label::background}{background} item.
+
+ \image qtquickcontrols2-label-custom.png
+
+ \snippet qtquickcontrols2-label-custom.qml file
+
+
+ \section2 Customizing Menu
+
+ Menu consists of a \l {Popup::}{contentItem}.
+
+ \quotefromfile qtquickcontrols2-menu-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.0
+ \skipto Menu
+ \printto contentItem.parent: window
+ \skipline contentItem.parent: window
+ \printuntil text: qsTr("Save")
+ \printuntil }
+ \printuntil }
+
+
+ \section2 Customizing MenuItem
+
+ MenuItem can be customized in the same manner as
+ \l {Customizing Button}{Button}.
+
+
+ \section2 Customizing PageIndicator
+
+ PageIndicator consists of a \l {Control::background}{background}, \l {Control::contentItem}{content item}, and \l {PageIndicator::delegate}{delegate}.
+
+ \image qtquickcontrols2-pageindicator-custom.png
+
+ \snippet qtquickcontrols2-pageindicator-custom.qml file
+
+
+ \section2 Customizing Pane
+
+ Pane consists of a \l {Control::background}{background}.
+
+ \image qtquickcontrols2-pane-custom.png
+
+ \snippet qtquickcontrols2-pane-custom.qml file
+
+
+ \section2 Customizing Popup
+
+ Popup consists of a \l {Popup::background}{background} and
+ \l {Popup::contentItem}{content item}.
+
+ \image qtquickcontrols2-popup-custom.png
+
+ \quotefromfile qtquickcontrols2-popup-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.0
+ \codeline
+ \skipto Popup
+ \printuntil {
+ \printuntil }
+ \printuntil }
+ \printuntil }
+
+
+ \section2 Customizing ProgressBar
+
+ ProgressBar consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-progressbar-custom.png
+
+ \snippet qtquickcontrols2-progressbar-custom.qml file
+
+
+ \section2 Customizing RadioButton
+
+ RadioButton consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
+
+ \image qtquickcontrols2-radiobutton-custom.png
+
+ \snippet qtquickcontrols2-radiobutton-custom.qml file
+
+
+ \section2 Customizing RadioDelegate
+
+ RadioDelegate consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
+
+ \image qtquickcontrols2-radiodelegate-custom.png
+
+ \snippet qtquickcontrols2-radiodelegate-custom.qml file
+
+
+ \section2 Customizing RangeSlider
+
+ RangeSlider consists of three visual items:
+ \l {Control::background}{background},
+ \l {RangeSlider::first}{first.handle} and
+ \l {RangeSlider::second.handle}{second.handle}.
+
+ \image qtquickcontrols2-rangeslider-custom.png
+
+ \snippet qtquickcontrols2-rangeslider-custom.qml file
+
+
+ \section2 Customizing ScrollBar
+
+ ScrollBar consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-scrollbar-custom.png
+
+ \snippet qtquickcontrols2-scrollbar-custom.qml file
+
+
+ \section2 Customizing ScrollIndicator
+
+ ScrollIndicator consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-scrollindicator-custom.png
+
+ \snippet qtquickcontrols2-scrollindicator-custom.qml file
+
+
+ \section2 Customizing Slider
+
+ Slider consists of two visual items: \l {Control::background}{background},
+ and \l {Slider::handle}{handle}.
+
+ \image qtquickcontrols2-slider-custom.png
+
+ \snippet qtquickcontrols2-slider-custom.qml file
+
+
+ \section2 Customizing SpinBox
+
+ SpinBox consists of four visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem}, \l {SpinBox::up.indicator}{up indicator},
+ and \l {SpinBox::down.indicator}{down indicator}.
+
+ \image qtquickcontrols2-spinbox-custom.png
+
+ \snippet qtquickcontrols2-spinbox-custom.qml file
+
+
+ \section2 Customizing StackView
+
+ StackView can have a visual \l {Control::background}{background}
+ item, and it allows customizing the transitions that are used for
+ push, pop, and replace operations.
+
+ \snippet qtquickcontrols2-stackview-custom.qml file
+
+
+ \section2 Customizing SwipeDelegate
+
+ SwipeDelegate consists of six visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{content item}, \l {AbstractButton::indicator}{indicator},
+ \c swipe.left, \c swipe.right, and \c swipe.behind.
+
+ \image qtquickcontrols2-swipedelegate-custom.png
+
+ \snippet qtquickcontrols2-swipedelegate-custom.qml file
+
+
+ \section2 Customizing SwipeView
+
+ SwipeView can have a visual \l {Control::background}{background}
+ item. The navigation is implemented by the \l {Control::contentItem}
+ {content item}.
+
+ \snippet qtquickcontrols2-swipeview-custom.qml file
+
+
+ \section2 Customizing Switch
+
+ Switch consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
+
+ \image qtquickcontrols2-switch-custom.png
+
+ \snippet qtquickcontrols2-switch-custom.qml file
+
+ \section2 Customizing SwitchDelegate
+
+ SwitchDelegate consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
+
+ \image qtquickcontrols2-switchdelegate-custom.png
+
+ \snippet qtquickcontrols2-switchdelegate-custom.qml file
+
+
+ \section2 Customizing TabBar
+
+ TabBar consists of two visual items: \l {Control::background}{background},
+ and \l {Control::contentItem}{contentItem}.
+
+ \image qtquickcontrols2-tabbar-custom.png
+
+ \snippet qtquickcontrols2-tabbar-custom.qml file
+
+
+ \section2 Customizing TabButton
+
+ TabButton can be customized in the same manner as
+ \l {Customizing Button}{Button}.
+
+
+ \section2 Customizing TextArea
+
+ TextArea consists of a \l {TextArea::background}{background} item.
+
+ \image qtquickcontrols2-textarea-custom.png
+
+ \snippet qtquickcontrols2-textarea-custom.qml file
+
+
+ \section2 Customizing TextField
+
+ TextField consists of a \l {TextField::background}{background} item.
+
+ \image qtquickcontrols2-textfield-custom.png
+
+ \snippet qtquickcontrols2-textfield-custom.qml file
+
+
+ \section2 Customizing ToolBar
+
+ ToolBar consists of one visual item: \l {Control::background}{background}.
+
+ \image qtquickcontrols2-toolbar-custom.png
+
+ \snippet qtquickcontrols2-toolbar-custom.qml file
+
+
+ \section2 Customizing ToolButton
+
+ ToolButton consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-toolbutton-custom.png
+
+ \snippet qtquickcontrols2-toolbutton-custom.qml file
+
+
+ \section2 Customizing ToolTip
+
+ ToolTip consists of two visual items: \l {Popup::background}{background}
+ and \l {Popup::contentItem}{content item}.
+
+ \quotefromfile qtquickcontrols2-tooltip-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.0
+ \skipto ToolTip
+ \printuntil }
+ \printuntil }
+ \printuntil }
+
+
+ \section2 Customizing Tumbler
+
+ Tumbler consists of three visual items:
+ \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem}, and
+ \l {Tumbler::delegate}{delegate}.
+
+ \image qtquickcontrols2-tumbler-custom.png
+
+ \snippet qtquickcontrols2-tumbler-custom.qml file
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-default.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-default.qdoc
new file mode 100644
index 00000000..88faf25a
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-default.qdoc
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-default.html
+ \title Default Style
+
+ The Default style is a basic all-round style.
+
+ The Default style a simple and light-weight style that offers the maximum
+ performance for Qt Quick Controls 2. It is built with a minimal amount of Qt
+ Quick primitives, and keeps animations and transitions to the minimum.
+
+ \image qtquickcontrols2-default.png
+
+ The style is selected by default when running Qt Quick Controls 2 applications.
+ It is built into the module's resources, so by default it is shipped with
+ any application that depends on the Qt Quick Controls 2 module
+
+ \note The Default style is used as a fallback for other styles. If a style
+ does not implement a certain control, the Default style implementation of
+ that control is selected.
+
+ \b {See also} \l {Material Style}, \l {Universal Style}
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc
new file mode 100644
index 00000000..33b97850
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-delegates.html
+ \title Delegate Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for delegate controls
+
+ Qt Quick Controls 2 offers a selection of controls that are used as
+ delegates in views.
+
+ \annotatedlist qtquickcontrols2-delegates
+
+ Each type of delegate has its own specific target use case. The following
+ sections offer guidelines for choosing the appropriate type of delegate,
+ depending on the use case.
+
+ \section1 ItemDelegate Control
+
+ \image qtquickcontrols2-itemdelegate.gif
+
+ \l ItemDelegate presents a checkable control that can be pressed and
+ clicked by the user.
+
+ \section1 RadioDelegate Control
+
+ \image qtquickcontrols2-radiodelegate.gif
+
+ \l RadioDelegate presents a checkable control that can be toggled on
+ (checked) or off (unchecked). Radio delegates are typically used to select
+ one option from a set of options.
+
+ \b {See also} \l {RadioButton Control}.
+
+ \section1 SwipeDelegate Control
+
+ \image qtquickcontrols2-swipedelegate.gif
+
+ \l SwipeDelegate presents a view item that can be swiped left or right to
+ expose more options or information.
+
+ \section1 SwitchDelegate Control
+
+ \image qtquickcontrols2-switchdelegate.gif
+
+ \l SwitchDelegate presents a switchable delegate that can be toggled on or off.
+
+ \b {See also} \l {Switch Control}.
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
+
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-deployment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-deployment.qdoc
new file mode 100644
index 00000000..fe78ca55
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-deployment.qdoc
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-deployment.html
+ \title Deploying Qt Quick Controls 2 Applications
+
+ Deployment of Qt Quick Controls 2 applications is very similar to
+ deployment of other types of Qt applications. However, there are a few
+ factors to consider.
+
+ \section1 Deploying an Application with Several Styles
+
+ Suppose you have an application that will be deployed to both Android and
+ Windows devices. To ensure that only the minimum set of files that are
+ necessary for the application to run are deployed to each device, you can
+ use file selectors. For example, your directory structure could look like
+ this:
+
+ \code
+ resources.qrc
+ main.qml
+ +windows/MyPage.qml
+ +windows/qtquickcontrols2.conf
+ +android/MyPage.qml
+ +android/qtquickcontrols2.conf
+ \endcode
+
+ In the project above, \c main.qml would import \c QtQuick.Controls, for
+ example, but shouldn't import, say, \c QtQuick.Controls.Material. Any code
+ that is style-specific is moved out into separate files; just as we've done
+ for \c MyPage.qml.
+
+ The \c +windows/qtquickcontrols2.conf file would contain configuration
+ options specific to the Universal style:
+
+ \code
+ [Controls]
+ Style=Universal
+
+ [Universal]
+ Theme=Dark
+ Accent=Red
+ \endcode
+
+ The \c +android/qtquickcontrols2.conf file would contain configuration
+ options specific to the Material style:
+
+ \code
+ [Controls]
+ Style=Material
+
+ [Material]
+ Theme=Light
+ Accent=Brown
+ \endcode
+
+ \section1 Static Builds
+
+ For dynamically built applications, it is not necessary to import a
+ specific style that should be usable by that application. For statically
+ built applications, Qt's build system must be involved to ensure that
+ QML plugins function as expected. Specifically, \c qmake uses
+ \c qmlimportscanner to scan the QML files in your application for import
+ statements. For this reason, any styles that should be usable by a
+ statically built application must explicitly import that style. Where the
+ import occurs is up to the developer, but it is recommended to follow the
+ approach mentioned in the \l {Deploying an Application with Several Styles}
+ section, so that only the minimum set of files that are necessary for a
+ particular device are deployed.
+
+ \sa {Deploying Qt Applications}
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
new file mode 100644
index 00000000..a85890f5
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
@@ -0,0 +1,378 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-differences.html
+ \title Differences between Qt Quick Controls
+
+ Qt Quick Controls were originally developed to support desktop platforms,
+ with mobile and embedded support coming shortly afterwards. They have a
+ very broad scope, in that they provide a styling system flexible enough to
+ allow the development of applications that have either a platform-dependent
+ or platform-independent style.
+
+ On embedded systems, where the hardware has limited resources, this approach
+ can be inefficient. Qt Quick Controls 2 were designed to solve this problem,
+ using
+ \l {https://blog.qt.io/blog/2015/03/31/qt-quick-controls-for-embedded/}{benchmarks}
+ to guide the development.
+
+ \section2 C++ and QML
+
+ In many cases, the internal state of a control can be more efficiently
+ processed in C++. For example, handling input events in C++ makes a
+ difference for controls that would otherwise need to create internal
+ MouseAreas and attached Keys objects.
+
+ \section2 Styles
+
+ Not only does handling events and logic in C++ increase performance, but it
+ allows the visual QML layer to be a simple, declarative layer on top. This
+ is reflected in the structure of the controls project: all visual
+ implementations sit in the \e imports folder, so that users who want to
+ create their own complete style can copy the folder and start tweaking.
+ Read more about implementing a style plugin
+ \l {Creating a Custom Style}{here}.
+
+ In Qt Quick Controls 2, styles no longer provide components that are
+ dynamically instantiated by controls, but controls themselves consist of
+ item delegates that can be replaced. In effect, this means that delegates
+ are Qt Quick items that are instantiated on the spot, as properties of the
+ control, and are simply parented to the control.
+
+ \section2 Modularity and Simplicity
+
+ When it comes to more complex controls, it is sometimes better to split
+ them up into separate building blocks. As an example, the complex
+ ScrollView control:
+
+ \qml
+ ScrollView {
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+ Flickable {
+ // ...
+ }
+ }
+ \endqml
+
+ Is replaced with simple ScrollBar/ScrollIndicator controls that can be
+ attached to any Flickable:
+
+ \qml
+ Flickable {
+ // ...
+ ScrollBar.vertical: ScrollBar { }
+ }
+ \endqml
+
+ The API of Qt Quick Controls 2 aims to be clean and simple. Common
+ operations are easy, and more advanced ones are liberally documented with
+ snippets that can be copied into your code.
+
+ \section2 Feature Comparison Table
+
+ \table
+ \header
+ \li
+ \li Qt Quick Controls
+ \li Qt Quick Controls 2
+ \row
+ \li Stylable delegates
+ \li Yes
+ \li Yes
+ \row
+ \li Pre-built native styles
+ \li Yes
+ \li No
+ \row
+ \li Runtime style/theme changes
+ \li Yes \sup 1
+ \li Yes \sup 2
+ \row
+ \li Can be used on Desktop
+ \li Yes
+ \li Yes \sup 3
+ \row
+ \li Can be used on Mobile
+ \li Yes \sup 4
+ \li Yes
+ \row
+ \li Can be used on Embedded
+ \li Yes \sup 4
+ \li Yes
+ \row
+ \li Internal event handling
+ \li QML
+ \li C++
+ \endtable
+
+ \list 1
+ \li Not officially supported, but technically possible via private APIs
+ \li Only themes for specific styles can be changed at runtime, styles are fixed
+ \li No hover effects
+ \li Performance may not be optimal
+ \endlist
+
+ \section2 Porting Qt Quick Controls Code
+
+ The API of Qt Quick Controls 2 is very similar to Qt Quick Controls, but it
+ does come with some changes necessary to facilitate the improvements. The
+ majority of changes are to do with styling; all of a control's delegates
+ are now accessible in the control itself, instead of in a separate style
+ object.
+
+ For example, to style a button in Qt Quick Controls:
+
+ \badcode
+ Button {
+ style: ButtonStyle {
+ label: Label {
+ // ...
+ }
+ }
+ }
+ \endcode
+
+ To style a button in Qt Quick Controls 2:
+
+ \qml
+ Button {
+ contentItem: Label {
+ // ...
+ }
+ }
+ \endqml
+
+ \section3 Preparing for Migration
+
+ With this in mind, a good way to prepare for a migration to Qt Quick
+ Controls 2 is to place each control that you have a custom style for in its
+ own QML file. For example, the Qt Quick Controls button above could be
+ moved to a file named \c Button.qml in a directory named \c controls, and
+ used in the following manner:
+
+ \badcode
+ import "controls" as Controls
+
+ Controls.Button {
+ ...
+ }
+ \endcode
+
+ This works with both modules, and will reduce the amount of work needed
+ when the migration begins.
+
+ \section3 Type Comparison Table
+
+ \table
+ \header
+ \li Qt Quick Controls 1, Qt Quick Extras
+ \li Qt Quick Controls 2, Qt Labs Calendar
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {AbstractButton}
+ \row
+ \li \l [QML QtQuickControls] {Action}
+ \li \span {} {\mdash \nbsp \sub {(see \l [QML QtQuick] {Shortcut} instead)}}
+ \row
+ \li \l [QML QtQuickControls] {ApplicationWindow}
+ \li \l [QML QtQuickControls2] {ApplicationWindow}
+ \row
+ \li \l [QML QtQuickControls] {BusyIndicator}
+ \li \l [QML QtQuickControls2] {BusyIndicator}
+ \row
+ \li \l [QML QtQuickControls] {Button}
+ \li \l [QML QtQuickControls2] {Button}
+ \row
+ \li \l [QML QtQuickExtras] {CircularGauge}
+ \li \mdash
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Control}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Container}
+ \row
+ \li \l [QML QtQuickControls] {Calendar}
+ \li \l [QML QtLabsCalendar] {MonthGrid},
+ \l [QML QtLabsCalendar] {DayOfWeekRow},
+ \l [QML QtLabsCalendar] {WeekNumberColumn}
+ \row
+ \li \l [QML QtQuickControls] {CheckBox}
+ \li \l [QML QtQuickControls2] {CheckBox}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {CheckDelegate}
+ \row
+ \li \l [QML QtQuickControls] {ComboBox}
+ \li \l [QML QtQuickControls2] {ComboBox}
+ \row
+ \li \l [QML QtQuickExtras] {DelayButton}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickExtras] {Dial}
+ \li \l [QML QtQuickControls2] {Dial}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Drawer}
+ \row
+ \li \l [QML QtQuickControls] {ExclusiveGroup}
+ \li \l [QML QtQuickControls2] {ButtonGroup}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Frame}
+ \row
+ \li \l [QML QtQuickExtras] {Gauge}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickControls] {GroupBox}
+ \li \l [QML QtQuickControls2] {GroupBox}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {ItemDelegate}
+ \row
+ \li \l [QML QtQuickControls] {Label}
+ \li \l [QML QtQuickControls2] {Label}
+ \row
+ \li \l [QML QtQuickControls] {Menu}
+ \li \l [QML QtQuickControls2] {Menu}
+ \row
+ \li \l [QML QtQuickControls] {MenuBar}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickControls] {MenuItem}
+ \li \l [QML QtQuickControls2] {MenuItem}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Page}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {PageIndicator}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Pane}
+ \row
+ \li \l [QML QtQuickExtras] {Picture}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickExtras] {PieMenu}
+ \li \mdash
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {Popup}
+ \row
+ \li \l [QML QtQuickControls] {ProgressBar}
+ \li \l [QML QtQuickControls2] {ProgressBar}
+ \row
+ \li \l [QML QtQuickControls] {RadioButton}
+ \li \l [QML QtQuickControls2] {RadioButton}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {RadioDelegate}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {RangeSlider}
+ \row
+ \li \l [QML QtQuickControls] {ScrollView}
+ \li \l [QML QtQuickControls2] {ScrollBar},
+ \l [QML QtQuickControls2] {ScrollIndicator}
+ \row
+ \li \l [QML QtQuickControls] {Slider}
+ \li \l [QML QtQuickControls2] {Slider}
+ \row
+ \li \l [QML QtQuickControls] {SplitView}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickControls] {SpinBox}
+ \li \l [QML QtQuickControls2] {SpinBox}
+ \row
+ \li \l [QML QtQuickControls] {StackView},
+ \l [QML QtQuickControls] {StackViewDelegate},
+ \l [QML QtQuickControls] {Stack}
+ \li \l [QML QtQuickControls2] {StackView}
+ \row
+ \li \l [QML QtQuickControls] {StatusBar}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickExtras] {StatusIndicator}
+ \li \mdash
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {SwipeDelegate}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {SwipeView}
+ \row
+ \li \l [QML QtQuickControls] {Switch}
+ \li \l [QML QtQuickControls2] {Switch}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {SwitchDelegate}
+ \row
+ \li \l [QML QtQuickControls] {TabView},
+ \l [QML QtQuickControls] {Tab}
+ \li \l [QML QtQuickControls2] {TabBar},
+ \l [QML QtQuickControls2] {TabButton}
+ \row
+ \li \l [QML QtQuickControls] {TableView}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickControls] {TextArea}
+ \li \l [QML QtQuickControls2] {TextArea}
+ \row
+ \li \l [QML QtQuickControls] {TextField}
+ \li \l [QML QtQuickControls2] {TextField}
+ \row
+ \li \l [QML QtQuickExtras] {ToggleButton}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickControls] {ToolBar}
+ \li \l [QML QtQuickControls2] {ToolBar}
+ \row
+ \li \l [QML QtQuickControls] {ToolButton}
+ \li \l [QML QtQuickControls2] {ToolButton}
+ \row
+ \li \mdash
+ \li \l [QML QtQuickControls2] {ToolTip}
+ \row
+ \li \l [QML QtQuickControls] {TreeView}
+ \li \mdash
+ \row
+ \li \l [QML QtQuickExtras] {Tumbler},
+ \l [QML QtQuickExtras] {TumblerColumn}
+ \li \l [QML QtQuickControls2] {Tumbler}
+ \endtable
+
+ \section1 Related Information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Controls 2 QML Types}
+ \li \l{Qt Quick Controls QML Types}
+ \li \l{Qt Quick Extras QML Types}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
new file mode 100644
index 00000000..7c1b1c16
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-environment.html
+ \title Supported Environment Variables in Qt Quick Controls 2
+
+ This page contains a list of all environment variables that Qt Quick Controls 2
+ supports. The environment variables are primarily meant for testing purposes, but
+ they can also be used to set system-wide defaults.
+
+ \table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c QT_QUICK_CONTROLS_STYLE
+ \li Specifies the default \l {Styling Qt Quick Controls 2}{Qt Quick Controls 2 style}.
+ The value can be either one of the built-in styles, for example \c "Material",
+ or the path to a custom style such as \c ":/mystyle".
+ \row
+ \li \c QT_QUICK_CONTROLS_CONF
+ \li Specifies the location of the \l {Qt Quick Controls 2 configuration file}.
+ By default, the configuration file is loaded from the application's
+ resources in \c ":/qtquickcontrols2.conf".
+ \endtable
+
+ \l {Material style} specific environment variables:
+
+ \include qquickmaterialstyle.qdocinc env
+
+ \l {Universal style} specific environment variables:
+
+ \include qquickuniversalstyle.qdocinc env
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \li \l{Qt Quick Controls 2 Configuration File}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-examples.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-examples.qdoc
new file mode 100644
index 00000000..1455d98a
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-examples.qdoc
@@ -0,0 +1,35 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \group qtquickcontrols2-examples
+ \ingroup all-examples
+ \title Qt Quick Controls 2 Examples
+ \brief A collection of examples for \l {Qt Quick Controls 2}
+
+ These examples demonstrate creating user interfaces using \l {Qt Quick Controls 2}.
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc
new file mode 100644
index 00000000..86df60c7
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-fileselectors.html
+ \title Using File Selectors with Qt Quick Controls 2
+
+ \l {QFileSelector}{File selectors} provide a convenient way of selecting
+ file variants. Qt offers the platform name and the locale as built-in
+ selectors. Qt Quick Controls 2 extends the built-in selectors with the name
+ (lowercase) of the style that an application is running with.
+
+ By using file selectors, style-specific tweaks can be applied without
+ creating a hard dependency to a style. From the available file variants,
+ only the selected QML file is loaded by the QML engine. Each file variant
+ can assume the context, that is, a specific style. This typically leads
+ to some code duplication, but on the other hand, cuts the aforementioned
+ hard dependency to the style, and leads to simpler and more efficient
+ QML code. The same technique is used to implement the \l {Styling Qt
+ Quick Controls 2}{Qt Quick Controls 2 styles}.
+
+ The following example demonstrates a custom rounded button that has a
+ styled drop shadow in the \l {Material Style}{Material style}, and looks
+ flat in other styles. The files are organized so that the Material version
+ of \c CustomButton.qml is placed into a \c +material sub-directory.
+
+ \code
+ :/main.qml
+ :/CustomButton.qml
+ :/+material/CustomButton.qml
+ \endcode
+
+ By default, \c main.qml will use \c CustomButton.qml for the \c CustomButton
+ type. However, when the application is run with the Material style, the
+ \c material selector will be present and the \c +material/CustomButton.qml
+ version will be used instead.
+
+ \code
+ // main.qml
+ import QtQuick 2.6
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ id: window
+ visible: true
+
+ CustomButton {
+ text: "Button"
+ anchors.centerIn: parent
+ }
+ }
+ \endcode
+
+ The base implementation of the custom button is a simple rounded
+ flat button.
+
+ \code
+ // CustomButton.qml
+ import QtQuick 2.6
+ import QtQuick.Controls 2.0
+
+ Button {
+ id: control
+
+ background: Rectangle {
+ radius: width / 2
+ implicitWidth: 36
+ implicitHeight: 36
+ color: control.pressed ? "#ccc" : "#eee"
+ }
+ }
+ \endcode
+
+ The Material style's implementation of the custom button imports the
+ Material style, requests a dark theme to get light text, and creates
+ a drop shadow for the background.
+
+ \code
+ // +material/CustomButton.qml
+ import QtQuick 2.6
+ import QtGraphicalEffects 1.0
+ import QtQuick.Controls 2.0
+ import QtQuick.Controls.Material 2.0
+
+ Button {
+ id: control
+
+ Material.theme: Material.Dark
+
+ background: Rectangle {
+ implicitWidth: 48
+ implicitHeight: 48
+ color: Material.accentColor
+ radius: width / 2
+
+ layer.enabled: control.enabled
+ layer.effect: DropShadow {
+ verticalOffset: 1
+ color: Material.dropShadowColor
+ samples: control.pressed ? 20 : 10
+ spread: 0.5
+ }
+ }
+ }
+ \endcode
+
+ \note It is recommended to use \l QQmlApplicationEngine, which internally
+ creates a \l QQmlFileSelector instance. This is all that is needed to take
+ QML file selectors into use.
+
+ \section1 Related Information
+ \list
+ \li \l {QFileSelector}
+ \li \l {QQmlFileSelector}
+ \li \l {Styling Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc
new file mode 100644
index 00000000..4661e8c9
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-gettingstarted.html
+ \title Getting Started with Qt Quick Controls 2
+
+ A basic example of a QML file that makes use of controls is shown here:
+
+ \snippet basic-example.qml 0
+
+ \section1 Setting Up Controls from C++
+
+ Although QQuickView has traditionally been used to display QML files in a
+ C++ application, doing this means you can only set window properties from
+ C++.
+
+ With Qt Quick Controls 2, declare an ApplicationWindow as the root item of
+ your application and launch it by using QQmlApplicationEngine instead.
+ This ensures that you can control top level window properties from QML.
+
+ A basic example of a source file that makes use of controls is shown here:
+
+ \code
+ #include <QGuiApplication>
+ #include <QQmlApplicationEngine>
+
+ int main(int argc, char *argv[])
+ {
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ return app.exec();
+ }
+ \endcode
+
+ \section2 Using C++ Data From QML
+
+ If you need to register a C++ class to use from QML, you can call
+ qmlRegisterType() before declaring your QQmlApplicationEngine.
+ See \l [QtQml] {Defining QML Types from C++} for more information.
+
+ If you need to expose data to QML components, you need to make them
+ available to the context of the current QML engine. See QQmlContext for
+ more information.
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-guidelines.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-guidelines.qdoc
new file mode 100644
index 00000000..87ba4cf1
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-guidelines.qdoc
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-guidelines.html
+ \title Qt Quick Controls 2 Guidelines
+
+ Qt Quick Controls 2 offers a selection of controls that can be used to
+ build complete interfaces in Qt Quick.
+
+ Below you will find practical guidelines on how and when to use
+ the controls.
+
+ \annotatedlist qtquickcontrols2-guidelines
+
+ \section1 Related Information
+ \list
+ \li \l{Qt Quick Controls 2 QML Types}{All Qt Quick Controls 2 QML Types}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-highdpi.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-highdpi.qdoc
new file mode 100644
index 00000000..301337e4
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-highdpi.qdoc
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-highdpi.html
+ \title High-DPI Support in Qt Quick Controls 2
+
+ Qt Quick Controls 2 support Qt's cross-platform high-DPI scaling introduced in Qt 5.6.
+ The feature is opt-in, and can be enabled by setting the \c Qt::AA_EnableHighDpiScaling
+ application attribute in C++ before QGuiApplication is constructed:
+
+ \code
+ #include <QGuiApplication>
+ #include <QQmlApplicationEngine>
+
+ int main(int argc, char *argv[])
+ {
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <--
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ return app.exec();
+ }
+ \endcode
+
+ Alternatively, an environment variable \c QT_AUTO_SCREEN_SCALE_FACTOR=1 can be set
+ to enable automatic high-DPI scaling.
+
+ \warning \l {Qt Quick Controls}{Qt Quick Controls 1.x} are not compatible with Qt's
+ automatic high-DPI scaling. There is currently no available solution for high-DPI
+ support in applications wishing to mix Qt Quick Controls and Qt Quick Controls 2.
+
+ \section1 Related Information
+ \list
+ \li \l {High DPI Displays}
+ \li \l {Scalability}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
new file mode 100644
index 00000000..cdb20a27
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-index.html
+ \title Qt Quick Controls 2
+
+ \brief Provides a set of UI controls for Qt Quick.
+
+ Qt Quick Controls 2 provides a set of controls that can be used
+ to build complete interfaces in Qt Quick.
+
+ \section1 Prerequisites
+
+ The \l{Qt Quick Controls 2 QML Types}{QML types} can be imported into your
+ application using the following import statement in your \c {.qml} file:
+
+ \code
+ import QtQuick.Controls 2.0
+ \endcode
+
+ The \l{Qt Quick Controls 2 C++ Classes}{C++ classes} can be included into
+ your application using the following include statement:
+
+ \code
+ #include <QtQuickControls2>
+ \endcode
+
+ To link against the corresponding C++ libraries, add the following to your
+ qmake project file:
+
+ \code
+ QT += quickcontrols2
+ \endcode
+
+ For more details, see \l {Getting Started with Qt Quick Controls 2}.
+
+ \section1 Important Concepts in Qt Quick Controls 2
+
+ \list
+ \li \l{Qt Quick Controls 2 Guidelines}
+ \li \l{Styling Qt Quick Controls 2}
+ \li \l{Customizing Qt Quick Controls 2}
+ \li \l{High-DPI Support in Qt Quick Controls 2}
+ \li \l{Using File Selectors with Qt Quick Controls 2}
+ \li \l{Differences between Qt Quick Controls}
+ \li \l{Deploying Qt Quick Controls 2 Applications}
+ \li \l{Qt Quick Controls 2 Configuration File}
+ \li \l{Supported Environment Variables in Qt Quick Controls 2}
+ \endlist
+
+ \section1 Reference
+
+ \list
+ \li \l{Qt Quick Controls 2 QML Types}{QML Types}
+ \li \l{Qt Quick Controls 2 C++ Classes}{C++ Classes}
+ \endlist
+
+ \section1 Examples
+
+ \list
+ \li \l{Qt Quick Controls 2 - Gallery}{Gallery}
+ \li \l{Qt Quick Controls 2 - Chat Tutorial}{Chat Tutorial}
+ \li \l{Qt Quick Controls 2 Examples}{All Examples}
+ \endlist
+
+ \section1 Related Modules
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Layouts}
+ \li \l{Qt Quick Templates 2}
+ \li \l{Qt Labs Calendar}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc
new file mode 100644
index 00000000..84367278
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-indicators.html
+ \title Indicator Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for indicator controls
+
+ Qt Quick Controls 2 offers a selection of indicator-like controls.
+
+ \annotatedlist qtquickcontrols2-indicators
+
+ Each type of indicator has its own specific target use case. The following
+ sections offer guidelines for choosing the appropriate type of indicator,
+ depending on the use case.
+
+ \section1 BusyIndicator Control
+
+ \image qtquickcontrols2-busyindicator.png
+
+ \l BusyIndicator should be used to indicate activity.
+
+ \section1 PageIndicator Control
+
+ \image qtquickcontrols2-pageindicator.png
+
+ \l BusyIndicator can be used to show that an operation is in progress,
+ and that the UI has to wait for the operation to complete.
+
+ \section1 ProgressBar Control
+
+ \image qtquickcontrols2-progressbar.gif
+
+ \l ProgressBar indicates the progress of an operation. The value should be
+ updated regularly.
+
+ \section1 ScrollBar Control
+
+ \image qtquickcontrols2-scrollbar.gif
+
+ \l ScrollBar is an interactive bar that indicates the current scroll
+ position, and can be used to scroll to a specific position in a
+ \l Flickable.
+
+ \section1 ScrollIndicator Control
+
+ \image qtquickcontrols2-scrollindicator.gif
+
+ \l ScrollIndicator is a non-interactive indicator that indicates the
+ current scroll position, and can be used to scroll to a specific position in a
+ \l {Flickable}.
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
new file mode 100644
index 00000000..ce7b6aa4
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-input.html
+ \title Input Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for input controls
+
+ Qt Quick Controls 2 offers a variety of input controls for both numeric
+ and textual input.
+
+ \annotatedlist qtquickcontrols2-input
+
+ Each type of input control has its own specific target use case. The
+ following sections offer guidelines for choosing the appropriate type
+ of input control, depending on the use case.
+
+ \section1 ComboBox Control
+
+ \image qtquickcontrols2-combobox.gif
+
+ \l ComboBox is used to select a value from a static multiple-line drop-down list.
+ It is not possible to add new values, and only one option can be selected.
+
+ Recommendations:
+ \list
+ \li If the number of values is very large, consider applying a filter.
+ \li If the list is very limited, consider using RadioButton. This has the
+ advantage that the user can see all options at the same time.
+ \li Select a default value, the value that will be chosen most often.
+ \endlist
+
+ \b {See also} \l {CheckBox Control}, \l {Tumbler Control}.
+
+ \section1 Dial Control
+
+ \image qtquickcontrols2-dial.png
+
+ \l Dial is similar to a traditional dial knob that is found on devices such
+ as stereos or industrial equipment.
+
+ The dial is rotated by clicking and dragging, with the handle indicating the
+ value of the dial.
+
+ \b {See also} \l {Tumbler Control}.
+
+ \section1 TextArea Control
+
+ \image qtquickcontrols2-textarea.png
+
+ \l TextArea is a multi-line text editor.
+
+ \section1 TextField Control
+
+ \image qtquickcontrols2-textfield.png
+
+ \l TextField is a single line text editor.
+
+ \b {See also} \l {Tumbler Control}.
+
+ \section1 Slider Control
+
+ \image qtquickcontrols2-slider.gif
+
+ \l Slider is used to select a value by sliding a handle along a track.
+
+ \section1 RangeSlider Control
+
+ \image qtquickcontrols2-rangeslider.gif
+
+ \l RangeSlider is used to select a range specified by two values,
+ by sliding each handle along a track.
+
+
+ \b {See also} \l {Slider Control}.
+
+ \section1 Tumbler Control
+
+ \image qtquickcontrols2-tumbler.png
+
+ \l Tumbler is a spinnable wheel of items that can be selected.
+
+ \b {See also} \l {ComboBox Control}.
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
new file mode 100644
index 00000000..9842fee6
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
@@ -0,0 +1,367 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-material.html
+ \title Material Style
+
+ The Material Style is based on the Google Material Design Guidelines.
+ \l{detailed-desc-material}{More...}
+
+ \styleimport {QtQuick.Controls.Material 2.0} {Qt 5.7}
+
+ \section1 Attached Properties
+
+ \list
+ \li \l {material-accent-attached-prop}{\b accent} : color
+ \li \l {material-background-attached-prop}{\b background} : color
+ \li \l {material-elevation-attached-prop}{\b elevation} : int
+ \li \l {material-foreground-attached-prop}{\b foreground} : color
+ \li \l {material-primary-attached-prop}{\b primary} : color
+ \li \l {material-theme-attached-prop}{\b theme} : enumeration
+ \endlist
+
+ \section1 Attached Methods
+
+ \list
+ \li color \l {material-color-attached-method}{\b color}(enumeration predefined, enumeration shade)
+ \endlist
+
+ \section1 Detailed Description
+ \target detailed-desc-material
+
+ The Material style is based on the \l {https://www.google.com/design/spec/material-design/introduction.html}
+ {Google Material Design Guidelines}. It allows for a unified experience
+ across platforms and device sizes.
+
+ \image qtquickcontrols2-material.png
+ \caption The Material style in light and dark themes
+
+ To run an application with the Material style, see
+ \l {Using Styles in Qt Quick Controls 2}.
+
+ \note The Material style is not a native Android style. The Material
+ style is a 100% cross-platform Qt Quick Controls 2 style implementation that
+ follows the Google Material Design Guidelines. The style runs on any
+ platform, and looks more or less identical everywhere. Minor differences
+ may occur due to differences in available system fonts and font rendering
+ engines.
+
+ \section2 Customization
+
+ The Material style allows customizing five attributes, \l {material-theme-attached-prop}{theme},
+ \l {material-primary-attached-prop}{primary}, \l {material-accent-attached-prop}{accent},
+ \l {material-foreground-attached-prop}{foreground}, and \l {material-background-attached-prop}{background}.
+
+ \image qtquickcontrols2-material-attributes.png
+
+ All attributes can be specified for any window or item, and they automatically
+ propagate to children in the same manner as \l {Control::font}{fonts}. In the
+ following example, the window and all three radio buttons appear in the dark
+ theme using a purple accent color:
+
+ \table
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+ import QtQuick.Controls 2.0
+ import QtQuick.Controls.Material 2.0
+
+ ApplicationWindow {
+ visible: true
+
+ Material.theme: Material.Dark
+ Material.accent: Material.Purple
+
+ Column {
+ anchors.centerIn: parent
+
+ RadioButton { text: qsTr("Small") }
+ RadioButton { text: qsTr("Medium"); checked: true }
+ RadioButton { text: qsTr("Large") }
+ }
+ }
+ \endqml
+ \li
+ \image qtquickcontrols2-material-dark.png
+ \endtable
+
+ In addition to specifying the attributes in QML, it is also possible to
+ specify them via environment variables or in a configuration file. Attributes
+ specified in QML take precedence over all other methods.
+
+ \section3 Configuration File
+
+ \include qquickmaterialstyle.qdocinc conf
+
+ See \l {Qt Quick Controls 2 Configuration File} for more details about the
+ configuration file.
+
+ \section3 Environment Variables
+
+ \include qquickmaterialstyle.qdocinc env
+
+ See \l {Supported Environment Variables in Qt Quick Controls 2} for the full
+ list of supported environment variables.
+
+ \section2 Dependency
+
+ The Material style must be separately imported to gain access to the
+ attributes that are specific to the Material style. It should be noted
+ that regardless of the references to the Material style, the same
+ application code runs with any other style. Material-specific attributes
+ only have an effect when the application is run with the Material style.
+
+ If the Material style is imported in a QML file that is always loaded, the
+ Material style must be deployed with the application in order to be able
+ to run the application regardless of which style the application is run with.
+ By using \l {Using File Selectors with Qt Quick Controls 2}{file selectors},
+ style-specific tweaks can be applied without creating a hard dependency to
+ a style.
+
+ \section2 Pre-defined Material Colors
+
+ Even though primary and accent can be any \l {colorbasictypedocs}{color}, it
+ is recommended to use one of the pre-defined colors that have been designed
+ to work well with the rest of the Material style palette:
+
+ Available pre-defined colors:
+ \value Material.Red \stylecolor {#F44336} {}
+ \value Material.Pink \stylecolor {#E91E63} {(default accent)}
+ \value Material.Purple \stylecolor {#9C27B0} {}
+ \value Material.DeepPurple \stylecolor {#673AB7} {}
+ \value Material.Indigo \stylecolor {#3F51B5} {(default primary)}
+ \value Material.Blue \stylecolor {#2196F3} {}
+ \value Material.LightBlue \stylecolor {#03A9F4} {}
+ \value Material.Cyan \stylecolor {#00BCD4} {}
+ \value Material.Teal \stylecolor {#009688} {}
+ \value Material.Green \stylecolor {#4CAF50} {}
+ \value Material.LightGreen \stylecolor {#8BC34A} {}
+ \value Material.Lime \stylecolor {#CDDC39} {}
+ \value Material.Yellow \stylecolor {#FFEB3B} {}
+ \value Material.Amber \stylecolor {#FFC107} {}
+ \value Material.Orange \stylecolor {#FF9800} {}
+ \value Material.DeepOrange \stylecolor {#FF5722} {}
+ \value Material.Brown \stylecolor {#795548} {}
+ \value Material.Grey \stylecolor {#9E9E9E} {}
+ \value Material.BlueGrey \stylecolor {#607D8B} {}
+
+ When the dark theme is in use, different \l {Pre-defined Shades}{shades} of
+ the pre-defined colors are used by default:
+
+ \value Material.Red \stylecolor {#EF9A9A} {}
+ \value Material.Pink \stylecolor {#F48FB1} {(default accent)}
+ \value Material.Purple \stylecolor {#CE93D8} {}
+ \value Material.DeepPurple \stylecolor {#B39DDB} {}
+ \value Material.Indigo \stylecolor {#9FA8DA} {(default primary)}
+ \value Material.Blue \stylecolor {#90CAF9} {}
+ \value Material.LightBlue \stylecolor {#81D4FA} {}
+ \value Material.Cyan \stylecolor {#80DEEA} {}
+ \value Material.Teal \stylecolor {#80CBC4} {}
+ \value Material.Green \stylecolor {#A5D6A7} {}
+ \value Material.LightGreen \stylecolor {#C5E1A5} {}
+ \value Material.Lime \stylecolor {#E6EE9C} {}
+ \value Material.Yellow \stylecolor {#FFF59D} {}
+ \value Material.Amber \stylecolor {#FFE082} {}
+ \value Material.Orange \stylecolor {#FFCC80} {}
+ \value Material.DeepOrange \stylecolor {#FFAB91} {}
+ \value Material.Brown \stylecolor {#BCAAA4} {}
+ \value Material.Grey \stylecolor {#EEEEEE} {}
+ \value Material.BlueGrey \stylecolor {#B0BEC5} {}
+
+ \section2 Pre-defined Shades
+
+ There are several different
+ \l {https://material.google.com/style/color.html#color-color-palette}{shades}
+ of each \l {Pre-defined Material Colors}{pre-defined color} that can be passed
+ to the \l {material-color-attached-method}{Material.color()} function:
+ \value Material.Shade50
+ \value Material.Shade100
+ \value Material.Shade200
+ \value Material.Shade300
+ \value Material.Shade400
+ \value Material.Shade500
+ \value Material.Shade600
+ \value Material.Shade700
+ \value Material.Shade800
+ \value Material.Shade900
+ \value Material.ShadeA100
+ \value Material.ShadeA200
+ \value Material.ShadeA400
+ \value Material.ShadeA700
+
+ \b {See also} \l {Default Style}, \l {Universal Style}
+
+ \section1 Attached Property Documentation
+
+ \styleproperty {Material.accent} {color} {material-accent-attached-prop}
+ \target material-accent-attached-prop
+ This attached property holds the accent color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The default value is \c Material.Pink.
+
+ In the following example, the accent color of the highlighted button is
+ changed to \c Material.Orange:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-accent.qml 1
+ \li
+ \image qtquickcontrols2-material-accent.png
+ \endtable
+
+ \note Even though the accent can be any \l {colorbasictypedocs}{color}, it is
+ recommended to use one of the \l {pre-defined Material colors} that have been
+ designed to work well with the rest of the Material style palette.
+
+ \endstyleproperty
+
+ \styleproperty {Material.background} {color} {material-background-attached-prop}
+ \target material-background-attached-prop
+ This attached property holds the background color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The default value is theme-specific (light or dark).
+
+ In the following example, the background color of the button is changed to
+ \c Material.Teal:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-background.qml 1
+ \li
+ \image qtquickcontrols2-material-background.png
+ \endtable
+
+ \endstyleproperty
+
+ \styleproperty {Material.elevation} {int} {material-elevation-attached-prop}
+ \target material-elevation-attached-prop
+ This attached property holds the elevation of the control. The higher the
+ elevation, the deeper the shadow. The property can be attached to any control,
+ but not all controls visualize elevation.
+
+ The default value is control-specific.
+
+ In the following example, the elevation of the pane is set to \c 6
+ in order to achieve the look of an
+ \l {https://material.google.com/components/cards.html}{elevated card}:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-elevation.qml 1
+ \li
+ \image qtquickcontrols2-material-elevation.png
+ \endtable
+
+ \endstyleproperty
+
+ \styleproperty {Material.foreground} {color} {material-foreground-attached-prop}
+ \target material-foreground-attached-prop
+ This attached property holds the foreground color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The default value is theme-specific (light or dark).
+
+ In the following example, the foreground color of the button is set to \c
+ Material.Pink:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-foreground.qml 1
+ \li
+ \image qtquickcontrols2-material-foreground.png
+ \endtable
+
+ \endstyleproperty
+
+ \styleproperty {Material.primary} {color} {material-primary-attached-prop}
+ \target material-primary-attached-prop
+ This attached property holds the primary color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The primary color is used as the background color of ToolBar by default.
+
+ The default value is \c Material.Indigo.
+
+ \note Even though the primary can be any \l {colorbasictypedocs}{color}, it is
+ recommended to use one of the \l {pre-defined Material colors} that have been
+ designed to work well with the rest of the Material style palette.
+
+ \endstyleproperty
+
+ \styleproperty {Material.theme} {enumeration} {material-theme-attached-prop}
+ \target material-theme-attached-prop
+ This attached property holds whether the theme is light or dark. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ Available themes:
+ \value Material.Light Light theme (default)
+ \value Material.Dark Dark theme
+
+ In the following example, the theme for both the pane and the button is set
+ to \c Material.Dark:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-theme.qml 1
+ \li
+ \image qtquickcontrols2-material-theme.png
+ \endtable
+
+ \endstyleproperty
+
+ \section1 Attached Method Documentation
+
+ \stylemethod2 {color} {color} {enumeration} {predefined} {enumeration} {shade} {material-color-attached-method}
+ \target material-color-attached-method
+ This attached method returns the effective color value of the specified
+ \l {pre-defined Material colors}{pre-defined Material color} combined with
+ the given \l {pre-defined shades}{shade}. If omitted, the shade argument
+ defaults to \c Material.Shade500.
+
+ \qml
+ Rectangle {
+ color: Material.color(Material.Red)
+ }
+ \endqml
+
+ \endstylemethod2
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-menus.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-menus.qdoc
new file mode 100644
index 00000000..faa8c3bc
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-menus.qdoc
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-menus.html
+ \title Menu Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for menu controls
+
+ \annotatedlist qtquickcontrols2-menus
+
+ Each type of menu control has its own specific target use case. The
+ following sections offer guidelines for choosing the appropriate type
+ of menu control, depending on the use case.
+
+ \section1 Menu Control
+
+ \image qtquickcontrols2-menu.png
+
+ \l Menu control can be used for context menus; for example, after
+ right-clicking. It can also be used for popup menus; for example, a
+ menu that is shown after clicking a button.
+
+ \l MenuItem is an item in the Menu control. Each item in a menu:
+ \list
+ \li displays text to the user
+ \li allows checking/unchecking
+ \li is highlighted (for example, on keyboard navigation)
+ \li performs some action on activation
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc
new file mode 100644
index 00000000..a2bd15a6
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-navigation.qdoc
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-navigation.html
+ \title Navigation Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for navigation controls
+
+ Qt Quick Controls 2 offers a selection of navigation models.
+
+ \annotatedlist qtquickcontrols2-navigation
+
+ The following sections offer guidelines for choosing the appropriate type
+ of navigation model, depending on the use case.
+
+ \section1 StackView Control
+
+ \image qtquickcontrols2-stackview-wireframe.png
+
+ \l StackView provides a stack-based navigation model which can be used
+ with a set of interlinked pages. StackView works according to a last-in
+ first-out principle: the page pushed last on the stack is the one visible.
+ Popping a page removes the last page and makes the previous one visible.
+
+ \section1 SwipeView Control
+
+ \image qtquickcontrols2-swipeview-wireframe.png
+
+ \l SwipeView provides a navigation model that simplifies horizontal paged
+ scrolling. The page indicator on the bottom shows which is the presently
+ active page.
+
+ \section1 TabBar
+
+ \image qtquickcontrols2-tabbar-wireframe.png
+
+ \l TabBar is a bar with icons or text that allows the user to switch
+ between different subtasks, views, or modes.
+
+ \section1 TabButton Control
+
+ \image qtquickcontrols2-tabbutton.png
+
+ \l TabButton is a button with a layout suitable for a TabBar control.
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc
new file mode 100644
index 00000000..aa2efb90
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-popups.qdoc
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-popups.html
+ \title Popup Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for popup controls
+
+ \annotatedlist qtquickcontrols2-popups
+
+ Each type of popup control has its own specific target use case. The
+ following sections offer guidelines for choosing the appropriate type
+ of popup control, depending on the use case.
+
+ \section1 Drawer Control
+
+ \image qtquickcontrols2-drawer-expanded-wireframe.png
+
+ \l Drawer provides a swipe-based side panel, similar to those often used
+ in touch interfaces to provide a central location for navigation.
+
+ The drawer can be positioned at any of the four edges of the screen. It allows
+ the user to add navigation without taking up valuable screen space. The user can
+ show and hide the drawer at any time with a simple swipe movement.
+
+ \section1 Menu Control
+
+ \image qtquickcontrols2-menu.png
+
+ The \l Menu control displays a vertical list of items that can be selected. It can
+ be used for offering a list of actions that can be taken in a given context.
+
+ \b {See also} \l {Drawer Control}.
+
+ \section1 Popup Control
+
+ \image qtquickcontrols2-popup-settings.png
+
+ A \l Popup displays content over other application content.
+ It prompts the user to make a decision or enter information.
+
+ Popups can be modal or non-modal. A modal popup blocks users from interacting
+ with the application until they have made a choice and closed the popup.
+
+ A popup can be used for:
+
+ \list
+ \li communicating a message to the user that he must read and acknowledge.
+ \li displaying an error message.
+ \li prompting the user to make a choice and/or enter a value.
+ \endlist
+
+ \section1 ToolTip Control
+
+ \image qtquickcontrols2-tooltip.png
+
+ \l ToolTip shows a short piece of text that informs the user of a control's
+ function. It is typically placed above or below the parent control.
+
+ Recommendations:
+ \list
+ \li Use a tooltip if a control has little or no descriptive text, or needs
+ a short explanation.
+ \li Use a tooltip only if the information on a particular control is not
+ available elsewhere in the screen.
+ \li Keep the tooltip text short so that it does not cover other content
+ while being displayed.
+ \endlist
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
new file mode 100644
index 00000000..52da41a7
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick.Controls 2.0
+ \title Qt Quick Controls 2 QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for user interfaces (Qt Quick Controls 2).
+
+ \l{Qt Quick Controls 2} provides QML types for creating user interfaces.
+ These QML types work in conjunction with \l{Qt Quick} and
+ \l{Qt Quick Layouts}.
+
+ Qt Quick Controls 2 QML types can be imported into your application
+ using the following import statement in your .qml file:
+
+ \badcode
+ import QtQuick.Controls 2.0
+ \endcode
+
+ \section1 QML Types
+ \generatelist {qmltypesbymodule QtQuick.Controls}
+ \noautolist
+
+ For more information on the Qt Quick Controls 2 module, see the
+ \l {Qt Quick Controls 2} module documentation.
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
new file mode 100644
index 00000000..d9c03ec3
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-styles.html
+ \title Styling Qt Quick Controls 2
+
+ Qt Quick Controls 2 comes with a selection of styles.
+
+ \raw HTML
+ <table style="background:transparent; border:0px">
+ <tr>
+ <td style="border:0px">
+ <a href="qtquickcontrols2-default.html">
+ <img src="images/qtquickcontrols2-default.png" width="45%"/>
+ </a>
+ </td>
+ <td style="border:0px">
+ <a href="qtquickcontrols2-material.html">
+ <img src="images/qtquickcontrols2-material.png" width="75%"/>
+ </a>
+ </td>
+ <td style="border:0px">
+ <a href="qtquickcontrols2-universal.html">
+ <img src="images/qtquickcontrols2-universal.png" width="75%"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td style="border:0px">
+ The <a href="qtquickcontrols2-default.html">Default</a> style is
+ a simple and light-weight all-round style that offers the maximum
+ performance for Qt Quick Controls 2.
+ </td>
+ <td style="border:0px">
+ The <a href="qtquickcontrols2-material.html">Material</a> style offers an appealing design
+ based on the <a href="https://www.google.com/design/spec/material-design/introduction.html">
+ Google Material Design Guidelines</a>, but requires more system resources than the Default style.
+ </td>
+ <td style="border:0px">
+ The <a href="qtquickcontrols2-universal.html">Universal</a> style offers an appealing design
+ based on the <a href="https://dev.windows.com/design">Microsoft Universal Design Guidelines</a>,
+ but requires more system resources than the Default style.
+ </td>
+ </tr>
+ </table>
+ \endraw
+
+ \section1 Using Styles in Qt Quick Controls 2
+
+ In order to run an application with a specific style, either configure the
+ style using \l QQuickStyle in C++, pass a command line argument, or set an
+ environment variable. Alternatively, the preferred style and style-specific
+ attributes can be specified in a configuration file.
+
+ The priority of these approaches follows the order they are listed below,
+ from highest to lowest. That is, using QQuickStyle to set the style will
+ always take priority over using the command line argument, for example.
+
+ \section2 Using QQuickStyle in C++
+
+ \l QQuickStyle provides C++ API for configuring a specific style. The following
+ example runs a Qt Quick Controls 2 application with the Material style:
+
+ \code
+ QQuickStyle::setStyle("Material");
+ \endcode
+
+ See the detailed description of \l QQuickStyle for more details.
+
+ \section2 Command line argument
+
+ Passing a \c -style command line argument is the convenient way to test different
+ styles. It takes precedence over the other methods listed below. The following
+ example runs a Qt Quick Controls 2 application with the Material style:
+
+ \code
+ ./app -style material
+ \endcode
+
+ \section2 Environment variable
+
+ Setting the \c QT_QUICK_CONTROLS_STYLE environment variable can be used to set
+ a system-wide style preference. It takes precedence over the configuration file
+ mentioned below. The following example runs a Qt Quick Controls 2 application with
+ the Universal style:
+
+ \code
+ QT_QUICK_CONTROLS_STYLE=universal ./app
+ \endcode
+
+ See \l {Supported Environment Variables in Qt Quick Controls 2} for the full list
+ of supported environment variables.
+
+ \section2 Configuration file
+
+ Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf,
+ that is built into an application's resources.
+
+ The configuration file can specify the preferred style (may be overridden by either
+ of the methods described earlier) and certain style-specific attributes. The following
+ example specifies that the preferred style is the Material style.
+
+ \code
+ [Controls]
+ Style=Material
+ \endcode
+
+ See \l {Qt Quick Controls 2 Configuration File} for more details about the
+ configuration file.
+
+ \section1 Related Information
+ \list
+ \li \l {Default Style}
+ \li \l {Material Style}
+ \li \l {Universal Style}
+ \li \l{Using File Selectors with Qt Quick Controls 2}
+ \li \l {Deploying Qt Quick Controls 2 Applications}
+ \li \l {Qt Quick Controls 2 Configuration File}
+ \li \l {Supported Environment Variables in Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
new file mode 100644
index 00000000..c0e2daee
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
@@ -0,0 +1,278 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-universal.html
+ \title Universal Style
+
+ The Universal Style is based on the Microsoft Universal Design Guidelines.
+ \l {detailed-desc-universal}{More...}
+
+ \styleimport {QtQuick.Controls.Universal 2.0} {Qt 5.7}
+
+ \section1 Attached Properties
+
+ \list
+ \li \l {universal-accent-attached-prop}{\b accent} : color
+ \li \l {universal-background-attached-prop}{\b background} : color
+ \li \l {universal-foreground-attached-prop}{\b foreground} : color
+ \li \l {universal-theme-attached-prop}{\b theme} : enumeration
+ \endlist
+
+ \section1 Attached Methods
+
+ \list
+ \li color \l {color-attached-method}{\b color}(enumeration predefined)
+ \endlist
+
+ \section1 Detailed Description
+ \target detailed-desc-universal
+
+ The Universal style is a device-agnostic style based on the
+ \l {https://dev.windows.com/design}{Microsoft Universal Design Guidelines}.
+ The Universal style has been designed to look good on all devices, from
+ phones and tablets to PCs.
+
+ \image qtquickcontrols2-universal.png
+ \caption The Universal style in light and dark themes
+
+ To run an application with the Universal style, see
+ \l {Using Styles in Qt Quick Controls 2}.
+
+ \note The Universal style is not a native Windows 10 style. The Universal
+ style is a 100% cross-platform Qt Quick Controls 2 style implementation that
+ follows the Microsoft Universal Design Guidelines. The style runs on any
+ platform, and looks more or less identical everywhere. Minor differences
+ may occur due to differences in available system fonts and font rendering
+ engines.
+
+ \section2 Customization
+
+ The Universal style allows customizing four attributes, \l {universal-theme-attached-prop}{theme},
+ \l {universal-accent-attached-prop}{accent}, \l {universal-foreground-attached-prop}{foreground}, and
+ \l {universal-background-attached-prop}{background}.
+
+ \image qtquickcontrols2-universal-attributes.png
+
+ Both attributes can be specified for any window or item, and they automatically
+ propagate to children in the same manner as \l {Control::font}{fonts}. In the
+ following example, the window and all three radio buttons appear in the dark
+ theme using a violet accent color:
+
+ \table
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+ import QtQuick.Controls 2.0
+ import QtQuick.Controls.Universal 2.0
+
+ ApplicationWindow {
+ visible: true
+
+ Universal.theme: Universal.Dark
+ Universal.accent: Universal.Violet
+
+ Column {
+ anchors.centerIn: parent
+
+ RadioButton { text: qsTr("Small") }
+ RadioButton { text: qsTr("Medium"); checked: true }
+ RadioButton { text: qsTr("Large") }
+ }
+ }
+ \endqml
+ \li
+ \image qtquickcontrols2-universal-dark.png
+ \endtable
+
+ In addition to specifying the attributes in QML, it is also possible to
+ specify them via environment variables or in a configuration file. Attributes
+ specified in QML take precedence over all other methods.
+
+ \section3 Configuration File
+
+ \include qquickuniversalstyle.qdocinc conf
+
+ See \l {Qt Quick Controls 2 Configuration File} for more details about the
+ configuration file.
+
+ \section3 Environment Variables
+
+ \include qquickuniversalstyle.qdocinc env
+
+ See \l {Supported Environment Variables in Qt Quick Controls 2} for the full
+ list of supported environment variables.
+
+ \section2 Dependency
+
+ The Universal style must be separately imported to gain access to the
+ attributes that are specific to the Universal style. It should be noted
+ that regardless of the references to the Universal style, the same
+ application code runs with any other style. Universal-specific attributes
+ only have an effect when the application is run with the Universal style.
+
+ If the Universal style is imported in a QML file that is always loaded, the
+ Universal style must be deployed with the application in order to be able
+ to run the application regardless of which style the application is run with.
+ By using \l {Using File Selectors with Qt Quick Controls 2}{file selectors},
+ style-specific tweaks can be applied without creating a hard dependency to
+ a style.
+
+ \section2 Pre-defined Universal Colors
+
+ Available pre-defined colors:
+ \value Universal.Lime \stylecolor {#A4C400} {}
+ \value Universal.Green \stylecolor {#60A917} {}
+ \value Universal.Emerald \stylecolor {#008A00} {}
+ \value Universal.Teal \stylecolor {#00ABA9} {}
+ \value Universal.Cyan \stylecolor {#1BA1E2} {}
+ \value Universal.Cobalt \stylecolor {#3E65FF} {(default accent)}
+ \value Universal.Indigo \stylecolor {#6A00FF} {}
+ \value Universal.Violet \stylecolor {#AA00FF} {}
+ \value Universal.Pink \stylecolor {#F472D0} {}
+ \value Universal.Magenta \stylecolor {#D80073} {}
+ \value Universal.Crimson \stylecolor {#A20025} {}
+ \value Universal.Red \stylecolor {#E51400} {}
+ \value Universal.Orange \stylecolor {#FA6800} {}
+ \value Universal.Amber \stylecolor {#F0A30A} {}
+ \value Universal.Yellow \stylecolor {#E3C800} {}
+ \value Universal.Brown \stylecolor {#825A2C} {}
+ \value Universal.Olive \stylecolor {#6D8764} {}
+ \value Universal.Steel \stylecolor {#647687} {}
+ \value Universal.Mauve \stylecolor {#76608A} {}
+ \value Universal.Taupe \stylecolor {#87794E} {}
+
+ \b {See also} \l {Default Style}, \l {Material Style}
+
+ \section1 Attached Property Documentation
+
+ \styleproperty {Universal.accent} {color} {universal-accent-attached-prop}
+ \target universal-accent-attached-prop
+ This attached property holds the accent color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The default value is \c Universal.Cobalt.
+
+ In the following example, the accent color of the highlighted button is
+ changed to \c Universal.Orange:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-accent.qml 1
+ \li
+ \image qtquickcontrols2-universal-accent.png
+ \endtable
+
+ \note Even though the accent can be any \l {colorbasictypedocs}{color}, it is
+ recommended to use one of the \l {pre-defined Universal colors} that have been
+ designed to work well with the rest of the Universal style palette.
+
+ \endstyleproperty
+
+ \styleproperty {Universal.background} {color} {universal-background-attached-prop}
+ \target universal-background-attached-prop
+ This attached property holds the background color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The default value is theme-specific (light or dark).
+
+ In the following example, the background color of the pane is changed to
+ \c Universal.Steel:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-background.qml 1
+ \li
+ \image qtquickcontrols2-universal-background.png
+ \endtable
+
+ \endstyleproperty
+
+ \styleproperty {Universal.foreground} {color} {universal-foreground-attached-prop}
+ \target universal-foreground-attached-prop
+ This attached property holds the foreground color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ The default value is theme-specific (light or dark).
+
+ In the following example, the foreground color of the button is set to \c
+ Universal.Pink:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-foreground.qml 1
+ \li
+ \image qtquickcontrols2-universal-foreground.png
+ \endtable
+
+ \styleproperty {Universal.theme} {enumeration} {universal-theme-attached-prop}
+ \target universal-theme-attached-prop
+ This attached property holds whether the theme is light or dark. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ Available themes:
+ \value Universal.Light Light theme (default)
+ \value Universal.Dark Dark theme
+
+ In the following example, the theme for both the pane and the button is set
+ to \c Universal.Dark:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-theme.qml 1
+ \li
+ \image qtquickcontrols2-universal-theme.png
+ \endtable
+
+ \endstyleproperty
+
+ \section1 Attached Method Documentation
+
+ \stylemethod {color} {color} {enumeration} {predefined} {color-attached-method}
+ \target color-attached-method
+ This attached method returns the effective color value of the specified
+ \l {pre-defined Universal colors}{pre-defined Universal color}.
+
+ \qml
+ Rectangle {
+ color: Universal.color(Universal.Red)
+ }
+ \endqml
+
+ \endstylemethod
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc b/src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc
deleted file mode 100644
index fded42cd..00000000
--- a/src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc
+++ /dev/null
@@ -1,54 +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$
-**
-****************************************************************************/
-
-/*!
- \page qtlabstemplates-index.html
- \title Qt Labs Templates
- \brief A set of templates to create user interface controls in Qt Quick
-
- Qt Labs Templates are the foundations of \l {Qt Labs Controls}. Templates
- are non-visual implementations of controls' logic and behavior. They offer
- an interface to visualize the controls in QML using \l {Qt Quick}.
-
- Even though the templates aim to be as style-agnostic as possible, in some
- cases they have to make certain assumptions about the visual structure of
- a control. For example, a spinbox has buttons that increment and decrement
- the value of the spinbox. In order to implement the behavior of a spinbox,
- the spinbox template needs to know if the user is interacting with the up
- or down button. A visual implementation of the spinbox template merely needs
- to position the up and down buttons and visualize them in normal, pressed,
- and disabled states. Any input event handling and state processing is taken
- care of by the underlying template.
-
- \section1 Related Information
-
- \list
- \li \l{Qt Quick}
- \li \l{Qt Labs Controls}
- \li \l{Qt Labs Templates QML Types}
- \endlist
-*/
diff --git a/src/imports/controls/doc/src/templates/qtlabstemplates.qdoc b/src/imports/controls/doc/src/templates/qtlabstemplates.qdoc
deleted file mode 100644
index 0f7f7d86..00000000
--- a/src/imports/controls/doc/src/templates/qtlabstemplates.qdoc
+++ /dev/null
@@ -1,65 +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$
-**
-****************************************************************************/
-
-/*!
- \qmlmodule Qt.labs.templates 1.0
- \title Qt Labs Templates QML Types
- \ingroup qmlmodules
- \brief Provides QML types for templates (Qt Labs Templates).
-
- The \l {Qt Labs Templates} module provides a set of non-visual templates
- that can be used to build user interface controls in QML using \l {Qt Quick}.
-
- The QML types can be imported using the following import statement in your
- \c .qml file:
-
- \badcode
- import Qt.labs.templates 1.0 as T
- \endcode
-
- \labs
-
- For the sake of clarity, there is a one-to-one mapping between the types
- provided by the \c Qt.labs.templates and \c Qt.labs.controls imports. For
- every type available in the \c Qt.labs.controls import, a non-visual template
- type by the same name exists in the \c Qt.labs.templates import.
-
- \note It is recommended to use a namespace for the templates import to avoid
- overlap with the types provided by the \c Qt.labs.controls import.
-
- \section1 QML Types
-
- \generatelist {qmltypesbymodule Qt.labs.controls}
-
- \section1 Related Information
-
- \list
- \li \l {Qt Labs Controls QML Types}
- \endlist
-
- \noautolist
-*/
diff --git a/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc b/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc
new file mode 100644
index 00000000..2e22196b
--- /dev/null
+++ b/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtquicktemplates2-index.html
+ \title Qt Quick Templates 2
+ \brief A set of templates to create user interface controls in Qt Quick
+
+ Qt Quick Templates are the foundations of \l {Qt Quick Controls 2}. Templates
+ are non-visual implementations of controls' logic and behavior. They offer
+ an interface to visualize the controls in QML using \l {Qt Quick}.
+
+ Even though the templates aim to be as style-agnostic as possible, in some
+ cases they have to make certain assumptions about the visual structure of
+ a control. For example, a spinbox has buttons that increment and decrement
+ the value of the spinbox. In order to implement the behavior of a spinbox,
+ the spinbox template needs to know if the user is interacting with the up
+ or down button. A visual implementation of the spinbox template merely needs
+ to position the up and down buttons and visualize them in normal, pressed,
+ and disabled states. Any input event handling and state processing is taken
+ care of by the underlying template.
+
+ \section1 Related Information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Controls 2}
+ \li \l{Qt Quick Templates 2 QML Types}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc b/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc
new file mode 100644
index 00000000..1ddfe763
--- /dev/null
+++ b/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule QtQuick.Templates 2.0
+ \title Qt Quick Templates 2 QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for templates (Qt Quick Templates).
+
+ The \l {Qt Quick Templates 2} module provides a set of non-visual templates
+ that can be used to build user interface controls in QML using \l {Qt Quick}.
+
+ The QML types can be imported using the following import statement in your
+ \c .qml file:
+
+ \badcode
+ import QtQuick.Templates 2.0 as T
+ \endcode
+
+ For the sake of clarity, there is a one-to-one mapping between the types
+ provided by the \c QtQuick.Templates and \c QtQuick.Controls imports. For
+ every type available in the \c QtQuick.Controls import, a non-visual template
+ type by the same name exists in the \c QtQuick.Templates import.
+
+ \note It is recommended to use a namespace for the templates import to avoid
+ overlap with the types provided by the \c QtQuick.Controls import.
+
+ \section1 QML Types
+
+ \generatelist {qmltypesbymodule QtQuick.Controls}
+
+ \section1 Related Information
+
+ \list
+ \li \l {Qt Quick Controls 2 QML Types}
+ \endlist
+
+ \noautolist
+*/
diff --git a/src/imports/controls/images/check@2x.png b/src/imports/controls/images/check@2x.png
index 597aab7f..bc5aaabe 100644
--- a/src/imports/controls/images/check@2x.png
+++ b/src/imports/controls/images/check@2x.png
Binary files differ
diff --git a/src/imports/controls/images/check@3x.png b/src/imports/controls/images/check@3x.png
index 1a10289b..0f515e0b 100644
--- a/src/imports/controls/images/check@3x.png
+++ b/src/imports/controls/images/check@3x.png
Binary files differ
diff --git a/src/imports/controls/images/check@4x.png b/src/imports/controls/images/check@4x.png
index 54e885f6..8ad1fe21 100644
--- a/src/imports/controls/images/check@4x.png
+++ b/src/imports/controls/images/check@4x.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator.png b/src/imports/controls/images/dial-indicator.png
index 92357c51..8cb0824f 100644
--- a/src/imports/controls/images/dial-indicator.png
+++ b/src/imports/controls/images/dial-indicator.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator@2x.png b/src/imports/controls/images/dial-indicator@2x.png
index f436443b..cd4f8d81 100644
--- a/src/imports/controls/images/dial-indicator@2x.png
+++ b/src/imports/controls/images/dial-indicator@2x.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator@3x.png b/src/imports/controls/images/dial-indicator@3x.png
index d883045b..f443605c 100644
--- a/src/imports/controls/images/dial-indicator@3x.png
+++ b/src/imports/controls/images/dial-indicator@3x.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator@4x.png b/src/imports/controls/images/dial-indicator@4x.png
index 79477712..dec99715 100644
--- a/src/imports/controls/images/dial-indicator@4x.png
+++ b/src/imports/controls/images/dial-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow.png b/src/imports/controls/images/double-arrow.png
new file mode 100644
index 00000000..a6d84dbc
--- /dev/null
+++ b/src/imports/controls/images/double-arrow.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow@2x.png b/src/imports/controls/images/double-arrow@2x.png
new file mode 100644
index 00000000..36ffd5fe
--- /dev/null
+++ b/src/imports/controls/images/double-arrow@2x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow@3x.png b/src/imports/controls/images/double-arrow@3x.png
new file mode 100644
index 00000000..5a2a59fe
--- /dev/null
+++ b/src/imports/controls/images/double-arrow@3x.png
Binary files differ
diff --git a/src/imports/controls/images/double-arrow@4x.png b/src/imports/controls/images/double-arrow@4x.png
new file mode 100644
index 00000000..22977545
--- /dev/null
+++ b/src/imports/controls/images/double-arrow@4x.png
Binary files differ
diff --git a/src/imports/controls/images/drop-indicator@4x.png b/src/imports/controls/images/drop-indicator@4x.png
index 58311fbe..b82b6db3 100644
--- a/src/imports/controls/images/drop-indicator@4x.png
+++ b/src/imports/controls/images/drop-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/material/ApplicationWindow.qml b/src/imports/controls/material/ApplicationWindow.qml
index e69c46da..db27f25b 100644
--- a/src/imports/controls/material/ApplicationWindow.qml
+++ b/src/imports/controls/material/ApplicationWindow.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -36,15 +36,20 @@
import QtQuick 2.6
import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.ApplicationWindow {
id: window
color: Material.backgroundColor
- overlay.background: Rectangle {
+ overlay.modal: Rectangle {
+ color: window.Material.backgroundDimColor
+ Behavior on opacity { NumberAnimation { duration: 150 } }
+ }
+
+ overlay.modeless: Rectangle {
color: window.Material.backgroundDimColor
Behavior on opacity { NumberAnimation { duration: 150 } }
}
diff --git a/src/imports/controls/material/BoxShadow.qml b/src/imports/controls/material/BoxShadow.qml
new file mode 100644
index 00000000..b70fcee5
--- /dev/null
+++ b/src/imports/controls/material/BoxShadow.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtGraphicalEffects 1.0
+
+/*!
+ A implementation of CSS's box-shadow, used by ElevationEffect for a Material Design
+ elevation shadow effect.
+ */
+RectangularGlow {
+ // The 4 properties from CSS box-shadow, plus the inherited color property
+ property int offsetX
+ property int offsetY
+ property int blurRadius
+ property int spreadRadius
+
+ // The source item the shadow is being applied to, used for correctly
+ // calculating the corner radious
+ property Item source
+
+ property bool fullWidth
+ property bool fullHeight
+
+ x: (parent.width - width)/2 + offsetX
+ y: (parent.height - height)/2 + offsetY
+
+ implicitWidth: source ? source.width : parent.width
+ implicitHeight: source ? source.height : parent.height
+
+ width: implicitWidth + 2 * spreadRadius + (fullWidth ? 2 * cornerRadius : 0)
+ height: implicitHeight + 2 * spreadRadius + (fullHeight ? 2 * cornerRadius : 0)
+ glowRadius: blurRadius/2
+ spread: 0.05
+ cornerRadius: blurRadius + (source && source.radius || 0)
+}
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml
index 9eb48613..387ffb71 100644
--- a/src/imports/controls/material/BusyIndicator.qml
+++ b/src/imports/controls/material/BusyIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,9 +35,9 @@
****************************************************************************/
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
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.BusyIndicator {
id: control
@@ -47,7 +47,6 @@ T.BusyIndicator {
padding: 6
- //! [contentItem]
contentItem: ProgressRing {
id: ring
x: control.leftPadding + (control.availableWidth - width) / 2
@@ -68,5 +67,4 @@ T.BusyIndicator {
running: control.visible && control.running
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml
index a869c915..f2fad313 100644
--- a/src/imports/controls/material/Button.qml
+++ b/src/imports/controls/material/Button.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,42 +35,40 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
-import QtGraphicalEffects 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
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
+ leftPadding: padding - 4
+ rightPadding: padding - 4
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
+ Material.elevation: flat ? control.down || control.hovered ? 2 : 0
+ : control.down ? 8 : 2
+ Material.background: flat ? "transparent" : undefined
+ contentItem: Text {
text: control.text
font: control.font
color: !control.enabled ? control.Material.hintTextColor :
+ control.flat && control.highlighted ? control.Material.accentColor :
control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.primaryTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
- //! [label]
- //! [background]
+ // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state
background: Rectangle {
implicitWidth: 64
implicitHeight: 48
@@ -80,10 +78,16 @@ T.Button {
width: parent.width
height: parent.height - 12
radius: 2
- color: !control.enabled ? (control.highlighted ? control.Material.raisedHighlightedButtonDisabledColor : control.Material.raisedButtonDisabledColor) :
- (control.pressed ? (control.highlighted ? control.Material.raisedHighlightedButtonPressColor : control.Material.raisedButtonPressColor) :
- (control.activeFocus ? (control.highlighted ? control.Material.raisedHighlightedButtonHoverColor : control.Material.raisedButtonHoverColor) :
- (control.highlighted ? control.Material.raisedHighlightedButtonColor : control.Material.raisedButtonColor)))
+ color: !control.enabled
+ ? control.Material.buttonDisabledColor
+ : control.down
+ ? control.highlighted ? control.Material.highlightedButtonPressColor
+ : control.Material.buttonPressColor
+ : control.visualFocus || control.checked
+ ? control.highlighted ? control.Material.highlightedButtonHoverColor
+ : control.Material.buttonHoverColor
+ : control.highlighted ? control.Material.highlightedButtonColor
+ : control.Material.buttonColor
Behavior on color {
ColorAnimation {
@@ -91,21 +95,12 @@ T.Button {
}
}
- Rectangle {
- width: parent.width
- height: parent.height
- radius: parent.radius
- visible: control.activeFocus
- color: control.Material.checkBoxUncheckedRippleColor
- }
-
- layer.enabled: control.enabled
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- samples: control.pressed ? 15 : 9
- spread: 0.5
+ // The layer is disabled when the button color is transparent so you can do
+ // Material.background: "transparent" and get a proper flat button without needing
+ // to set Material.elevation as well
+ layer.enabled: control.enabled && control.Material.buttonColor.a > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
}
}
- //! [background]
}
diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml
index 230f696f..1c6848d8 100644
--- a/src/imports/controls/material/CheckBox.qml
+++ b/src/imports/controls/material/CheckBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,120 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.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
- leftPadding: 8
- rightPadding: 8
- bottomPadding: 14
+ padding: 8
+ topPadding: padding + 7
+ bottomPadding: padding + 7
- //! [indicator]
- indicator: Rectangle {
- id: indicatorItem
+ indicator: CheckIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 20
- implicitHeight: 20
- color: "transparent"
- border.color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor
- border.width: control.checked ? width / 2 : 2
- radius: 2
-
- Behavior on border.width {
- NumberAnimation {
- duration: 100
- easing.type: Easing.OutCubic
- }
- }
-
- Behavior on border.color {
- ColorAnimation {
- duration: 100
- easing.type: Easing.OutCubic
- }
- }
-
- Ripple {
- width: parent.width
- height: width
- control: control
- colored: control.checked
- opacity: control.pressed || control.activeFocus ? 1 : 0
- }
-
- // TODO: This needs to be transparent
- Image {
- id: checkImage
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 16
- height: 16
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/check.png"
- fillMode: Image.PreserveAspectFit
-
- scale: control.checkState === Qt.Checked ? 1 : 0
- Behavior on scale { NumberAnimation { duration: 100 } }
- }
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 12
- height: 3
- visible: control.checkState === Qt.PartiallyChecked
- }
-
- states: [
- State {
- name: "checked"
- when: control.checkState === Qt.Checked
- },
- State {
- name: "partiallychecked"
- when: control.checkState === Qt.PartiallyChecked
- }
- ]
-
- transitions: Transition {
- SequentialAnimation {
- NumberAnimation {
- target: indicatorItem
- property: "scale"
- // Go down 2 pixels in size.
- to: 1 - 2 / indicatorItem.width
- duration: 120
- }
- NumberAnimation {
- target: indicatorItem
- property: "scale"
- to: 1
- duration: 120
- }
- }
- }
+ control: control
}
- //! [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: 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 +72,4 @@ T.CheckBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
}
diff --git a/src/imports/controls/material/CheckDelegate.qml b/src/imports/controls/material/CheckDelegate.qml
new file mode 100644
index 00000000..d5785467
--- /dev/null
+++ b/src/imports/controls/material/CheckDelegate.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+
+T.CheckDelegate {
+ id: control
+
+ 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: 16
+ topPadding: 14
+ bottomPadding: 14
+ spacing: 16
+
+ indicator: CheckIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitHeight: 48
+
+ visible: control.down || control.highlighted
+ color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ }
+}
diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml
new file mode 100644
index 00000000..f64ca168
--- /dev/null
+++ b/src/imports/controls/material/CheckIndicator.qml
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls.Material 2.0
+
+Rectangle {
+ id: indicatorItem
+ implicitWidth: 18
+ implicitHeight: 18
+ color: "transparent"
+ border.color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor
+ border.width: control.checked ? width / 2 : 2
+ radius: 2
+
+ property alias control: ripple.control
+
+ Behavior on border.width {
+ NumberAnimation {
+ duration: 100
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ Behavior on border.color {
+ ColorAnimation {
+ duration: 100
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ Ripple {
+ id: ripple
+ width: parent.width
+ height: width
+ control: control
+ colored: control.checked
+ opacity: control.down || control.visualFocus ? 1 : 0
+ }
+
+ // TODO: This needs to be transparent
+ Image {
+ id: checkImage
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 14
+ height: 14
+ source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/images/check.png"
+ fillMode: Image.PreserveAspectFit
+
+ scale: control.checkState === Qt.Checked ? 1 : 0
+ Behavior on scale { NumberAnimation { duration: 100 } }
+ }
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 12
+ height: 3
+
+ scale: control.checkState === Qt.PartiallyChecked ? 1 : 0
+ Behavior on scale { NumberAnimation { duration: 100 } }
+ }
+
+ states: [
+ State {
+ name: "checked"
+ when: control.checkState === Qt.Checked
+ },
+ State {
+ name: "partiallychecked"
+ when: control.checkState === Qt.PartiallyChecked
+ }
+ ]
+
+ transitions: Transition {
+ SequentialAnimation {
+ NumberAnimation {
+ target: indicatorItem
+ property: "scale"
+ // Go down 2 pixels in size.
+ to: 1 - 2 / indicatorItem.width
+ duration: 120
+ }
+ NumberAnimation {
+ target: indicatorItem
+ property: "scale"
+ to: 1
+ duration: 120
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 97724585..183bcef9 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -36,48 +36,65 @@
import QtQuick 2.6
import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
-import QtGraphicalEffects 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.ComboBox {
id: control
+ Material.elevation: control.pressed ? 8 : 2
+
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 6
+ // external vertical padding is 6 (to increase touch area)
padding: 12
+ leftPadding: padding - 4
+ rightPadding: padding - 4
+
+ // Don't use toolTextColor, as that is often white when we have a white background.
+ Material.foreground: Material.foreground === Material.toolTextColor ? undefined : Material.foreground
- //! [delegate]
delegate: MenuItem {
- width: control.width
+ width: control.popup.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
+ Material.foreground: control.currentIndex === index ? control.Material.accent : control.Material.foreground
highlighted: control.highlightedIndex === index
- pressed: highlighted && control.pressed
}
- //! [delegate]
- //! [contentItem]
+ indicator: Image {
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+ opacity: !control.enabled ? 0.5 : 1.0
+ source: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/images/drop-indicator.png"
+ }
+
contentItem: Text {
+ leftPadding: control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
+ rightPadding: !control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
+
text: control.displayText
font: control.font
color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
- rightPadding: 14 + control.spacing
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 120
- implicitHeight: 32
+ implicitHeight: 48
+ // external vertical padding is 6 (to increase touch area)
+ y: 6
+ height: parent.height - 12
radius: 2
color: control.Material.dialogColor
@@ -87,36 +104,23 @@ T.ComboBox {
}
}
- layer.enabled: control.enabled
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- samples: control.pressed ? 15 : 9
- spread: 0.5
- }
-
- Image {
- x: parent.width - width - control.rightPadding
- y: (parent.height - height) / 2
- opacity: !control.enabled ? 0.5 : 1.0
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/drop-indicator.png"
+ layer.enabled: control.enabled && control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
}
Rectangle {
width: parent.width
height: parent.height
radius: parent.radius
- visible: control.activeFocus
+ visible: control.visualFocus
color: control.Material.checkBoxUncheckedRippleColor
}
}
- //! [background]
- //! [popup]
popup: T.Popup {
- y: control.height
- implicitWidth: control.width
- implicitHeight: listview.contentHeight
+ width: control.width
+ implicitHeight: contentItem.implicitHeight
transformOrigin: Item.Top
topMargin: 12
bottomMargin: 12
@@ -138,26 +142,24 @@ T.ComboBox {
}
contentItem: ListView {
- id: listview
clip: true
+ implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
+ highlightRangeMode: ListView.ApplyRange
+ highlightMoveDuration: 0
T.ScrollIndicator.vertical: ScrollIndicator { }
}
background: Rectangle {
- radius: 3
+ radius: 2
color: control.Material.dialogColor
layer.enabled: control.enabled
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- samples: 15
- spread: 0.5
+ layer.effect: ElevationEffect {
+ elevation: 8
}
}
}
- //! [popup]
}
diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml
index a05982cc..c07cd423 100644
--- a/src/imports/controls/material/Dial.qml
+++ b/src/imports/controls/material/Dial.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.Dial {
id: control
@@ -44,20 +44,17 @@ T.Dial {
implicitWidth: 100
implicitHeight: 100
- //! [background]
background: Rectangle {
x: control.width / 2 - width / 2
y: control.height / 2 - height / 2
width: Math.max(64, Math.min(control.width, control.height))
- height: Math.max(64, Math.min(control.width, control.height))
+ height: width
color: "transparent"
radius: width / 2
border.color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor
}
- //! [background]
- //! [handle]
handle: Rectangle {
id: handleItem
@@ -78,5 +75,4 @@ T.Dial {
radius: width / 2
color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor
}
- //! [handle]
}
diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml
index 133ea9c8..1c15e689 100644
--- a/src/imports/controls/material/Drawer.qml
+++ b/src/imports/controls/material/Drawer.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,19 +35,33 @@
****************************************************************************/
import QtQuick 2.6
-import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.Drawer {
id: control
- parent: T.ApplicationWindow.overlay || Window.contentItem
- width: parent ? parent.width : 0 // TODO: Window.width
- height: parent ? parent.height : 0 // TODO: Window.height
+ parent: T.ApplicationWindow.overlay
- // TODO: make this a proper transition
- animation: SmoothedAnimation {
- velocity: 5
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
+ enter: Transition { SmoothedAnimation { velocity: 5 } }
+ exit: Transition { SmoothedAnimation { velocity: 5 } }
+
+ contentItem: Item { }
+
+ background: Rectangle {
+ color: control.Material.dialogColor
+
+ layer.enabled: control.position > 0
+ layer.effect: ElevationEffect {
+ elevation: 16
+ fullHeight: true
+ }
}
}
diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml
new file mode 100644
index 00000000..4ee4369c
--- /dev/null
+++ b/src/imports/controls/material/ElevationEffect.qml
@@ -0,0 +1,279 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+
+/*!
+ An effect for standard Material Design elevation shadows. Useful for using as \c layer.effect.
+ */
+Item {
+ id: effect
+
+ /*!
+ The source the effect is applied to.
+ */
+ property var source
+
+ /*!
+ The elevation of the \l source Item.
+ */
+ property int elevation: 0
+
+ /*!
+ Set to \c true if the \l source Item is the same width as its parent and the shadow
+ should be full width instead of rounding around the corner of the Item.
+
+ \sa fullHeight
+ */
+ property bool fullWidth: false
+
+ /*!
+ Set to \c true if the \l source Item is the same height as its parent and the shadow
+ should be full height instead of rounding around the corner of the Item.
+
+ \sa fullWidth
+ */
+ property bool fullHeight: false
+
+ /*!
+ \internal
+
+ The actual source Item the effect is applied to.
+ */
+ readonly property Item sourceItem: source.sourceItem
+
+ /*
+ * The following shadow values are taken from Angular Material
+ *
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2016 Google, Inc. http://angularjs.org
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+ /*!
+ \internal
+
+ The shadows to use for each possible elevation. There are three shadows that when combined
+ make up the elevation.
+ */
+ readonly property var _shadows: [
+ [{offset: 0, blur: 0, spread: 0},
+ {offset: 0, blur: 0, spread: 0},
+ {offset: 0, blur: 0, spread: 0}],
+
+ [{offset: 1, blur: 3, spread: 0},
+ {offset: 1, blur: 1, spread: 0},
+ {offset: 2, blur: 1, spread: -1}],
+
+ [{offset: 1, blur: 5, spread: 0},
+ {offset: 2, blur: 2, spread: 0},
+ {offset: 3, blur: 1, spread: -2}],
+
+ [{offset: 1, blur: 8, spread: 0},
+ {offset: 3, blur: 4, spread: 0},
+ {offset: 3, blur: 3, spread: -2}],
+
+ [{offset: 2, blur: 4, spread: -1},
+ {offset: 4, blur: 5, spread: 0},
+ {offset: 1, blur: 10, spread: 0}],
+
+ [{offset: 3, blur: 5, spread: -1},
+ {offset: 5, blur: 8, spread: 0},
+ {offset: 1, blur: 14, spread: 0}],
+
+ [{offset: 3, blur: 5, spread: -1},
+ {offset: 6, blur: 10, spread: 0},
+ {offset: 1, blur: 18, spread: 0}],
+
+ [{offset: 4, blur: 5, spread: -2},
+ {offset: 7, blur: 10, spread: 1},
+ {offset: 2, blur: 16, spread: 1}],
+
+ [{offset: 5, blur: 5, spread: -3},
+ {offset: 8, blur: 10, spread: 1},
+ {offset: 3, blur: 14, spread: 2}],
+
+ [{offset: 5, blur: 6, spread: -3},
+ {offset: 9, blur: 12, spread: 1},
+ {offset: 3, blur: 16, spread: 2}],
+
+ [{offset: 6, blur: 6, spread: -3},
+ {offset: 10, blur: 14, spread: 1},
+ {offset: 4, blur: 18, spread: 3}],
+
+ [{offset: 6, blur: 7, spread: -4},
+ {offset: 11, blur: 15, spread: 1},
+ {offset: 4, blur: 20, spread: 3}],
+
+ [{offset: 7, blur: 8, spread: -4},
+ {offset: 12, blur: 17, spread: 2},
+ {offset: 5, blur: 22, spread: 4}],
+
+ [{offset: 7, blur: 8, spread: -4},
+ {offset: 13, blur: 19, spread: 2},
+ {offset: 5, blur: 24, spread: 4}],
+
+ [{offset: 7, blur: 9, spread: -4},
+ {offset: 14, blur: 21, spread: 2},
+ {offset: 5, blur: 26, spread: 4}],
+
+ [{offset: 8, blur: 9, spread: -5},
+ {offset: 15, blur: 22, spread: 2},
+ {offset: 6, blur: 28, spread: 5}],
+
+ [{offset: 8, blur: 10, spread: -5},
+ {offset: 16, blur: 24, spread: 2},
+ {offset: 6, blur: 30, spread: 5}],
+
+ [{offset: 8, blur: 11, spread: -5},
+ {offset: 17, blur: 26, spread: 2},
+ {offset: 6, blur: 32, spread: 5}],
+
+ [{offset: 9, blur: 11, spread: -5},
+ {offset: 18, blur: 28, spread: 2},
+ {offset: 7, blur: 34, spread: 6}],
+
+ [{offset: 9, blur: 12, spread: -6},
+ {offset: 19, blur: 29, spread: 2},
+ {offset: 7, blur: 36, spread: 6}],
+
+ [{offset: 10, blur: 13, spread: -6},
+ {offset: 20, blur: 31, spread: 3},
+ {offset: 8, blur: 38, spread: 7}],
+
+ [{offset: 10, blur: 13, spread: -6},
+ {offset: 21, blur: 33, spread: 3},
+ {offset: 8, blur: 40, spread: 7}],
+
+ [{offset: 10, blur: 14, spread: -6},
+ {offset: 22, blur: 35, spread: 3},
+ {offset: 8, blur: 42, spread: 7}],
+
+ [{offset: 11, blur: 14, spread: -7},
+ {offset: 23, blur: 36, spread: 3},
+ {offset: 9, blur: 44, spread: 8}],
+
+ [{offset: 11, blur: 15, spread: -7},
+ {offset: 24, blur: 38, spread: 3},
+ {offset: 9, blur: 46, spread: 8}]
+ ]
+
+ /*!
+ \internal
+
+ The current shadow based on the elevation.
+ */
+ readonly property var _shadow: _shadows[Math.max(0, Math.min(elevation, _shadows.length - 1))]
+
+ // Nest the shadows and source view in two items rendered as a layer
+ // so the shadow is not clipped by the bounds of the source view
+ Item {
+ property int margin: -100
+
+ x: margin
+ y: margin
+ width: parent.width - 2 * margin
+ height: parent.height - 2 * margin
+
+ // By rendering as a layer, the shadow will never show through the source item,
+ // even when the source item's opacity is less than 1
+ layer.enabled: true
+
+ // The box shadows automatically pick up the size of the source Item and not
+ // the size of the parent, so we don't need to worry about the extra padding
+ // in the parent Item
+ BoxShadow {
+ offsetY: _shadow[0].offset
+ blurRadius: _shadow[0].blur
+ spreadRadius: _shadow[0].spread
+ color: Qt.rgba(0,0,0, 0.2)
+
+ fullWidth: effect.fullWidth
+ fullHeight: effect.fullHeight
+ source: effect.sourceItem
+ }
+
+ BoxShadow {
+ offsetY: _shadow[1].offset
+ blurRadius: _shadow[1].blur
+ spreadRadius: _shadow[1].spread
+ color: Qt.rgba(0,0,0, 0.14)
+
+ fullWidth: effect.fullWidth
+ fullHeight: effect.fullHeight
+ source: effect.sourceItem
+ }
+
+ BoxShadow {
+ offsetY: _shadow[2].offset
+ blurRadius: _shadow[2].blur
+ spreadRadius: _shadow[2].spread
+ color: Qt.rgba(0,0,0, 0.12)
+
+ fullWidth: effect.fullWidth
+ fullHeight: effect.fullHeight
+ source: effect.sourceItem
+ }
+
+ ShaderEffect {
+ property alias source: effect.source
+
+ x: (parent.width - width)/2
+ y: (parent.height - height)/2
+ width: sourceItem.width
+ height: sourceItem.height
+ }
+ }
+}
diff --git a/src/imports/controls/material/Frame.qml b/src/imports/controls/material/Frame.qml
index 9336850d..c2f623ae 100644
--- a/src/imports/controls/material/Frame.qml
+++ b/src/imports/controls/material/Frame.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.Frame {
id: control
@@ -47,20 +48,18 @@ T.Frame {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- padding: 6
+ padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [frame]
- frame: Rectangle {
- width: parent.width
- height: parent.height
-
- radius: 3
- color: "transparent"
+ background: Rectangle {
+ radius: 2
+ color: control.Material.elevation > 0 ? control.Material.backgroundColor : "transparent"
border.color: control.Material.frameColor
+
+ layer.enabled: control.enabled && control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ }
}
- //! [frame]
}
diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml
index 3461cb6e..6d84197c 100644
--- a/src/imports/controls/material/GroupBox.qml
+++ b/src/imports/controls/material/GroupBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.GroupBox {
id: control
@@ -50,14 +51,11 @@ T.GroupBox {
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
spacing: 6
- padding: 6
- topPadding: 6 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ padding: 12
+ topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- //! [contentItem]
contentItem: Item {}
- //! [contentItem]
- //! [label]
label: Text {
x: control.leftPadding
width: control.availableWidth
@@ -69,17 +67,19 @@ T.GroupBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [frame]
- frame: Rectangle {
+ background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
height: parent.height - control.topPadding + control.padding
- radius: 3
- color: "transparent"
+ radius: 2
+ color: control.Material.elevation > 0 ? control.Material.backgroundColor : "transparent"
border.color: control.Material.frameColor
+
+ layer.enabled: control.enabled && control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ }
}
- //! [frame]
}
diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml
index acfbfb98..e43fc981 100644
--- a/src/imports/controls/material/ItemDelegate.qml
+++ b/src/imports/controls/material/ItemDelegate.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,105 +35,25 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.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
- //! [indicator]
- indicator: Rectangle {
- id: indicatorItem
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
- y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 20
- implicitHeight: 20
- color: "transparent"
- border.color: control.checked ? control.Material.accentColor : control.Material.secondaryTextColor
- border.width: control.checked ? width / 2 : 2
- radius: 2
-
- visible: control.checkable
-
- Behavior on border.width {
- NumberAnimation {
- duration: 100
- easing.type: Easing.OutCubic
- }
- }
-
- Behavior on border.color {
- ColorAnimation {
- duration: 100
- easing.type: Easing.OutCubic
- }
- }
-
- Ripple {
- width: parent.width
- height: width
- control: control
- colored: control.checked
- opacity: control.pressed ? 1 : 0
- }
-
- // TODO: This needs to be transparent
- Image {
- id: checkImage
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 16
- height: 16
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/check.png"
- fillMode: Image.PreserveAspectFit
-
- scale: control.checked ? 1 : 0
- Behavior on scale { NumberAnimation { duration: 100 } }
- }
-
- states: State {
- name: "checked"
- when: control.checked
- }
-
- transitions: Transition {
- SequentialAnimation {
- NumberAnimation {
- target: indicatorItem
- property: "scale"
- // Go down 2 pixels in size.
- to: 1 - 2 / indicatorItem.width
- duration: 120
- }
- NumberAnimation {
- target: indicatorItem
- property: "scale"
- to: 1
- duration: 120
- }
- }
- }
- }
- //! [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: Text {
+ leftPadding: control.checkable && !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+ rightPadding: control.checkable && control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
text: control.text
font: control.font
@@ -143,12 +63,11 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Rectangle {
- visible: control.pressed || control.highlighted
- color: control.pressed ? control.Material.flatButtonPressColor : control.Material.listHighlightColor
+ implicitHeight: 48
+
+ visible: control.down || control.highlighted
+ color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
}
- //! [background]
}
diff --git a/src/imports/controls/material/Label.qml b/src/imports/controls/material/Label.qml
index 3d8952f2..8bda5cc2 100644
--- a/src/imports/controls/material/Label.qml
+++ b/src/imports/controls/material/Label.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,12 +35,12 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.Label {
id: control
- color: Material.primaryTextColor
+ color: enabled ? Material.primaryTextColor : Material.hintTextColor
linkColor: Material.accentColor
}
diff --git a/src/imports/controls/material/Menu.qml b/src/imports/controls/material/Menu.qml
index 755f5a56..b11c00b6 100644
--- a/src/imports/controls/material/Menu.qml
+++ b/src/imports/controls/material/Menu.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,18 +35,24 @@
****************************************************************************/
import QtQuick 2.6
-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
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.Menu {
id: control
+ Material.elevation: 8
+
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.min(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight + topPadding + bottomPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+
+ margins: 0
+ topPadding: 8
+ bottomPadding: 8
transformOrigin: Item.Top
@@ -62,7 +68,6 @@ T.Menu {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
}
- //! [contentItem]
contentItem: ListView {
implicitHeight: contentHeight
@@ -75,23 +80,17 @@ T.Menu {
ScrollIndicator.vertical: ScrollIndicator {}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 200
- implicitHeight: 200
+ implicitHeight: 48
radius: 3
color: control.Material.dialogColor
- layer.enabled: true
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- samples: 15
- spread: 0.5
+ layer.enabled: control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
}
}
- //! [background]
}
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml
index 89867e15..27c2922c 100644
--- a/src/imports/controls/material/MenuItem.qml
+++ b/src/imports/controls/material/MenuItem.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,105 +35,35 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.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
+ topPadding: 12
+ bottomPadding: 12
spacing: 16
- //! [indicator]
- indicator: Rectangle {
- id: indicatorItem
+ indicator: CheckIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 20
- implicitHeight: 20
- color: "transparent"
- border.color: control.checked ? control.Material.accentColor : control.Material.secondaryTextColor
- border.width: control.checked ? width / 2 : 2
- radius: 2
-
visible: control.checkable
-
- Behavior on border.width {
- NumberAnimation {
- duration: 100
- easing.type: Easing.OutCubic
- }
- }
-
- Behavior on border.color {
- ColorAnimation {
- duration: 100
- easing.type: Easing.OutCubic
- }
- }
-
- Ripple {
- width: parent.width
- height: width
- control: control
- colored: control.checked
- opacity: control.pressed ? 1 : 0
- }
-
- // TODO: This needs to be transparent
- Image {
- id: checkImage
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 16
- height: 16
- source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/check.png"
- fillMode: Image.PreserveAspectFit
-
- scale: control.checked ? 1 : 0
- Behavior on scale { NumberAnimation { duration: 100 } }
- }
-
- states: State {
- name: "checked"
- when: control.checked
- }
-
- transitions: Transition {
- SequentialAnimation {
- NumberAnimation {
- target: indicatorItem
- property: "scale"
- // Go down 2 pixels in size.
- to: 1 - 2 / indicatorItem.width
- duration: 120
- }
- NumberAnimation {
- target: indicatorItem
- property: "scale"
- to: 1
- duration: 120
- }
- }
- }
+ control: control
}
- //! [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: 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,13 +73,11 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Rectangle {
implicitWidth: 200
- visible: control.pressed || control.highlighted
- color: control.pressed ? control.Material.flatButtonPressColor : control.Material.listHighlightColor
+ implicitHeight: 48
+ visible: control.down || control.highlighted
+ color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
}
- //! [background]
}
diff --git a/src/imports/controls/material/Page.qml b/src/imports/controls/material/Page.qml
index 4ff3541f..92c85b58 100644
--- a/src/imports/controls/material/Page.qml
+++ b/src/imports/controls/material/Page.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,19 +35,15 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.Page {
id: control
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: control.Material.backgroundColor
}
- //! [background]
}
diff --git a/src/imports/controls/material/PageIndicator.qml b/src/imports/controls/material/PageIndicator.qml
index 1d646f97..78372afe 100644
--- a/src/imports/controls/material/PageIndicator.qml
+++ b/src/imports/controls/material/PageIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.PageIndicator {
id: control
@@ -49,20 +49,17 @@ T.PageIndicator {
padding: 6
spacing: 6
- //! [delegate]
delegate: Rectangle {
implicitWidth: 8
implicitHeight: 8
radius: width / 2
- color: control.Material.primaryTextColor
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45
Behavior on opacity { OpacityAnimator { duration: 100 } }
}
- //! [delegate]
- //! [contentItem]
contentItem: Row {
spacing: control.spacing
@@ -71,5 +68,4 @@ T.PageIndicator {
delegate: control.delegate
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml
index b936f08f..251492ea 100644
--- a/src/imports/controls/material/Pane.qml
+++ b/src/imports/controls/material/Pane.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.Pane {
id: control
@@ -47,15 +48,17 @@ T.Pane {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- padding: 6
+ padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: control.Material.backgroundColor
+ radius: control.Material.elevation > 0 ? 2 : 0
+
+ layer.enabled: control.enabled && control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ }
}
- //! [background]
}
diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml
index d882840a..19fd6b79 100644
--- a/src/imports/controls/material/Popup.qml
+++ b/src/imports/controls/material/Popup.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,13 +35,15 @@
****************************************************************************/
import QtQuick 2.6
-import QtGraphicalEffects 1.0
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.Popup {
id: control
+ Material.elevation: 24
+
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
@@ -50,7 +52,7 @@ T.Popup {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- padding: 6
+ padding: 12
enter: Transition {
// grow_fade_in
@@ -67,15 +69,12 @@ T.Popup {
contentItem: Item { }
background: Rectangle {
- radius: 3
+ radius: 2
color: control.Material.dialogColor
- layer.enabled: true
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- samples: 15
- spread: 0.5
+ layer.enabled: control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
}
}
}
diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml
index 08e0323e..eb8bf3ce 100644
--- a/src/imports/controls/material/ProgressBar.qml
+++ b/src/imports/controls/material/ProgressBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,25 +35,21 @@
****************************************************************************/
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
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.ProgressBar {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- indicator ? indicator.implicitWidth : 0) + leftPadding + rightPadding
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
+ contentItem.implicitHeight + topPadding + bottomPadding)
- //! [indicator]
- indicator: ProgressStrip {
+ contentItem: ProgressStrip {
id: strip
- x: control.leftPadding
- y: control.topPadding + (control.availableHeight - height) / 2
- width: control.availableWidth
- height: 4
+ implicitHeight: 4
scale: control.mirrored ? -1 : 1
indeterminate: control.indeterminate
@@ -65,9 +61,7 @@ T.ProgressBar {
running: control.visible && control.indeterminate
}
}
- //! [indicator]
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 4
@@ -78,5 +72,4 @@ T.ProgressBar {
color: Qt.rgba(control.Material.accentColor.r, control.Material.accentColor.g, control.Material.accentColor.b, 0.25)
}
- //! [background]
}
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index f01d2dc9..3ea2cf4d 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,64 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.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
- leftPadding: 8
- rightPadding: 8
- bottomPadding: 14
+ padding: 8
+ topPadding: padding + 6
+ bottomPadding: padding + 6
- //! [indicator]
- indicator: Rectangle {
+ indicator: RadioIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 20
- implicitHeight: 20
- radius: width / 2
- border.width: 2
- border.color: control.checked || control.pressed ? control.Material.accentColor : control.Material.secondaryTextColor
- color: "transparent"
-
- Ripple {
- width: parent.width
- height: width
- control: control
- colored: control.checked
- opacity: control.pressed || control.activeFocus ? 1 : 0
- }
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 10
- height: 10
- radius: width / 2
- color: parent.border.color
- visible: control.checked || control.pressed
- }
+ control: control
}
- //! [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: 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 +72,4 @@ T.RadioButton {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
}
diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml
new file mode 100644
index 00000000..95bfb19b
--- /dev/null
+++ b/src/imports/controls/material/RadioDelegate.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+
+T.RadioDelegate {
+ id: control
+
+ 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: 16
+ topPadding: 8
+ bottomPadding: 8
+ spacing: 16
+
+ indicator: RadioIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitHeight: 48
+
+ visible: control.down || control.highlighted
+ color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ }
+}
diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml
new file mode 100644
index 00000000..4090c732
--- /dev/null
+++ b/src/imports/controls/material/RadioIndicator.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+
+Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ radius: width / 2
+ border.width: 2
+ border.color: control.checked || control.down ? control.Material.accentColor : control.Material.secondaryTextColor
+ color: "transparent"
+
+ property alias control: ripple.control
+
+ Ripple {
+ id: ripple
+ width: parent.width
+ height: width
+ control: control
+ colored: control.checked
+ opacity: control.down || control.visualFocus ? 1 : 0
+ }
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 10
+ height: 10
+ radius: width / 2
+ color: parent.border.color
+ visible: control.checked || control.down
+ }
+}
diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml
index bf8c16ef..dc2c25fa 100644
--- a/src/imports/controls/material/RangeSlider.qml
+++ b/src/imports/controls/material/RangeSlider.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,24 +35,22 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.RangeSlider {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(track ? track.implicitWidth : 0,
- first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
+ Math.max(first.handle ? first.handle.implicitWidth : 0,
+ second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(track ? track.implicitHeight : 0,
- first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ Math.max(first.handle ? first.handle.implicitHeight : 0,
+ second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
padding: 6
- //! [firstHandle]
first.handle: SliderHandle {
x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
@@ -60,9 +58,7 @@ T.RangeSlider {
handleHasFocus: activeFocus
handlePressed: first.pressed
}
- //! [firstHandle]
- //! [secondHandle]
second.handle: SliderHandle {
x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height))
@@ -70,16 +66,14 @@ T.RangeSlider {
handleHasFocus: activeFocus
handlePressed: second.pressed
}
- //! [secondHandle]
- //! [track]
- track: Rectangle {
+ background: Rectangle {
x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
- implicitWidth: horizontal ? 200 : 1
- implicitHeight: horizontal ? 1 : 200
- width: horizontal ? control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.availableHeight
+ implicitWidth: horizontal ? 200 : 48
+ implicitHeight: horizontal ? 48 : 200
+ width: horizontal ? control.availableWidth : 1
+ height: horizontal ? 1 : control.availableHeight
color: control.Material.primaryTextColor
scale: horizontal && control.mirrored ? -1 : 1
@@ -94,5 +88,4 @@ T.RangeSlider {
color: control.Material.accentColor
}
}
- //! [track]
}
diff --git a/src/imports/controls/material/Ripple.qml b/src/imports/controls/material/Ripple.qml
index a8fd27e8..15650384 100644
--- a/src/imports/controls/material/Ripple.qml
+++ b/src/imports/controls/material/Ripple.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls.material 1.0
+import QtQuick.Controls.Material 2.0
Rectangle {
property Item control
diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml
index 72130c63..84f2d33a 100644
--- a/src/imports/controls/material/ScrollBar.qml
+++ b/src/imports/controls/material/ScrollBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,21 +35,23 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.ScrollBar {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- handle.implicitWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- handle.implicitHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
padding: 2
+ topPadding: padding + (control.orientation === Qt.Horizontal ? 12 : 0)
+ leftPadding: padding + (control.orientation === Qt.Vertical && !control.mirrored ? 12 : 0)
+ rightPadding: padding + (control.orientation === Qt.Vertical && control.mirrored ? 12 : 0)
- //! [handle]
- handle: Rectangle {
+ contentItem: Rectangle {
id: handle
implicitWidth: 4
@@ -59,12 +61,6 @@ T.ScrollBar {
visible: control.size < 1.0
opacity: 0.0
- readonly property bool horizontal: control.orientation === Qt.Horizontal
- x: control.leftPadding + (horizontal ? control.position * control.availableWidth : 0)
- y: control.topPadding + (horizontal ? 0 : control.position * control.availableHeight)
- width: horizontal ? control.size * control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.size * control.availableHeight
-
states: State {
name: "active"
when: control.active
@@ -79,5 +75,4 @@ T.ScrollBar {
}
}
}
- //! [handle]
}
diff --git a/src/imports/controls/material/ScrollIndicator.qml b/src/imports/controls/material/ScrollIndicator.qml
index f92b366f..b5f25d33 100644
--- a/src/imports/controls/material/ScrollIndicator.qml
+++ b/src/imports/controls/material/ScrollIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,21 +35,20 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.ScrollIndicator {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- indicator.implicitWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- indicator.implicitHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
padding: 2
- //! [indicator]
- indicator: Rectangle {
+ contentItem: Rectangle {
id: indicator
implicitWidth: 4
@@ -59,12 +58,6 @@ T.ScrollIndicator {
visible: control.size < 1.0
opacity: 0.0
- readonly property bool horizontal: control.orientation === Qt.Horizontal
- x: control.leftPadding + (horizontal ? control.position * control.width : 0)
- y: control.topPadding + (horizontal ? 0 : control.position * control.height)
- width: horizontal ? control.size * control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.size * control.availableHeight
-
states: State {
name: "active"
when: control.active
@@ -81,5 +74,4 @@ T.ScrollIndicator {
}
]
}
- //! [indicator]
}
diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml
index 139c9151..15c8edb2 100644
--- a/src/imports/controls/material/Slider.qml
+++ b/src/imports/controls/material/Slider.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,52 +35,47 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.Slider {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(track ? track.implicitWidth : 0,
- handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
+ (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(track ? track.implicitHeight : 0,
- handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
padding: 6
- //! [handle]
handle: SliderHandle {
x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
value: control.value
- handleHasFocus: control.activeFocus
+ handleHasFocus: control.visualFocus
handlePressed: control.pressed
}
- //! [handle]
- //! [track]
- track: Rectangle {
+ background: Rectangle {
x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
- implicitWidth: horizontal ? 200 : 1
- implicitHeight: horizontal ? 1 : 200
- width: horizontal ? control.availableWidth : implicitWidth
- height: horizontal ? 1 : control.position * implicitHeight - 4
+ implicitWidth: horizontal ? 200 : 48
+ implicitHeight: horizontal ? 48 : 200
+ width: horizontal ? control.availableWidth : 1
+ height: horizontal ? 1 : control.availableHeight
color: control.Material.primaryTextColor
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
Rectangle {
- x: 0
- y: parent.horizontal ? -1 : control.visualPosition * parent.height + 3
+ x: parent.horizontal ? 0 : (parent.width - width) / 2
+ y: parent.horizontal ? (parent.height - height) / 2 : control.visualPosition * parent.height
width: parent.horizontal ? control.position * parent.width : 3
- height: parent.horizontal ? 3 : control.availableHeight
+ height: parent.horizontal ? 3 : control.position * parent.height
color: control.Material.accentColor
}
}
- //! [track]
}
diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml
index 6f54eaf5..49f833d0 100644
--- a/src/imports/controls/material/SliderHandle.qml
+++ b/src/imports/controls/material/SliderHandle.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls.material 1.0
+import QtQuick.Controls.Material 2.0
Item {
id: root
diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml
index 0c9fe767..e28815e8 100644
--- a/src/imports/controls/material/SpinBox.qml
+++ b/src/imports/controls/material/SpinBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,15 +35,15 @@
****************************************************************************/
import QtQuick 2.6
-import QtGraphicalEffects 1.0
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.SpinBox {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + 2 * padding +
+ contentItem.implicitWidth +
(up.indicator ? up.indicator.implicitWidth : 0) +
(down.indicator ? down.indicator.implicitWidth : 0))
implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
@@ -52,24 +52,23 @@ T.SpinBox {
down.indicator ? down.indicator.implicitHeight : 0)
baselineOffset: contentItem.y + contentItem.baselineOffset
- padding: 6
- leftPadding: 6 + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
- rightPadding: 6 + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
+ spacing: 6
+ topPadding: 8
+ bottomPadding: 16
+ leftPadding: (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
+ rightPadding: (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
- //! [validator]
validator: IntValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
}
- //! [validator]
- //! [contentItem]
contentItem: TextInput {
text: control.textFromValue(control.value, control.locale)
font: control.font
- color: control.Material.primaryTextColor
+ color: enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
selectionColor: control.Material.textSelectionColor
selectedTextColor: control.Material.primaryTextColor
horizontalAlignment: Qt.AlignHCenter
@@ -93,77 +92,77 @@ T.SpinBox {
id: timer
running: control.activeFocus
repeat: true
- interval: Qt.styleHints.cursorFlashTime
+ interval: Qt.styleHints.cursorFlashTime / 2
onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0
// force the cursor visible when gaining focus
onRunningChanged: cursor.opacity = 1
}
}
+ readOnly: !control.editable
validator: control.validator
inputMethodHints: Qt.ImhFormattedNumbersOnly
}
- //! [contentItem]
- //! [up.indicator]
- up.indicator: Rectangle {
+ up.indicator: PaddedRectangle {
x: control.mirrored ? 0 : parent.width - width
- implicitWidth: 26
+ implicitWidth: 48
+ implicitHeight: 48
height: parent.height
- radius: 3
- color: Qt.tint(Qt.tint(control.Material.raisedButtonColor,
- control.activeFocus ? control.Material.raisedButtonHoverColor : "transparent"),
- control.up.pressed ? control.Material.raisedButtonPressColor: "transparent")
+ width: height
+ padding: control.spacing
+ radius: 2
+ color: Qt.tint(Qt.tint(control.Material.buttonColor,
+ control.activeFocus ? control.Material.buttonHoverColor : "transparent"),
+ control.up.pressed ? control.Material.buttonPressColor: "transparent")
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: Math.min(parent.width / 3, parent.width / 3)
height: 2
- color: control.Material.primaryTextColor
+ color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor
}
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 2
height: Math.min(parent.width / 3, parent.width / 3)
- color: control.Material.primaryTextColor
+ color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor
}
}
- //! [up.indicator]
- //! [down.indicator]
- down.indicator: Rectangle {
+ down.indicator: PaddedRectangle {
x: control.mirrored ? parent.width - width : 0
- implicitWidth: 26
+ implicitWidth: 48
+ implicitHeight: 48
height: parent.height
- radius: 3
- color: Qt.tint(Qt.tint(control.Material.raisedButtonColor,
- control.activeFocus ? control.Material.raisedButtonHoverColor : "transparent"),
- control.down.pressed ? control.Material.raisedButtonPressColor : "transparent")
+ width: height
+ padding: control.spacing
+ radius: 2
+ color: Qt.tint(Qt.tint(control.Material.buttonColor,
+ control.activeFocus ? control.Material.buttonHoverColor : "transparent"),
+ control.down.pressed ? control.Material.buttonPressColor : "transparent")
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width / 3
height: 2
- color: control.Material.primaryTextColor
+ color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor
}
}
- //! [down.indicator]
- //! [background]
background: Item {
- implicitWidth: 100
- implicitHeight: 26
+ implicitWidth: 192
+ implicitHeight: 48
Rectangle {
x: parent.width / 2 - width / 2
- y: parent.y + parent.height - height
+ y: parent.y + parent.height - height - control.bottomPadding / 2
width: control.availableWidth
height: control.activeFocus ? 2 : 1
color: control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor
}
}
- //! [background]
}
diff --git a/src/imports/controls/material/StackView.qml b/src/imports/controls/material/StackView.qml
index c31c13d2..982a37cb 100644
--- a/src/imports/controls/material/StackView.qml
+++ b/src/imports/controls/material/StackView.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,56 +35,44 @@
****************************************************************************/
import QtQuick 2.4
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.StackView {
- id: root
+ id: control
- //! [popEnter]
popEnter: Transition {
// slide_in_left
- NumberAnimation { property: "x"; from: (root.mirrored ? -0.5 : 0.5) * -root.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * -control.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
- //! [popEnter]
- //! [popExit]
popExit: Transition {
// slide_out_right
- NumberAnimation { property: "x"; from: 0; to: (root.mirrored ? -0.5 : 0.5) * root.width; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * control.width; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
- //! [popExit]
- //! [pushEnter]
pushEnter: Transition {
// slide_in_right
- NumberAnimation { property: "x"; from: (root.mirrored ? -0.5 : 0.5) * root.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
- //! [pushEnter]
- //! [pushExit]
pushExit: Transition {
// slide_out_left
- NumberAnimation { property: "x"; from: 0; to: (root.mirrored ? -0.5 : 0.5) * -root.width; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
- //! [pushExit]
- //! [replaceEnter]
replaceEnter: Transition {
// slide_in_right
- NumberAnimation { property: "x"; from: (root.mirrored ? -0.5 : 0.5) * root.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: (control.mirrored ? -0.5 : 0.5) * control.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
- //! [replaceEnter]
- //! [replaceExit]
replaceExit: Transition {
// slide_out_left
- NumberAnimation { property: "x"; from: 0; to: (root.mirrored ? -0.5 : 0.5) * -root.width; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: 0; to: (control.mirrored ? -0.5 : 0.5) * -control.width; duration: 200; easing.type: Easing.OutCubic }
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
- //! [replaceExit]
}
diff --git a/src/imports/controls/material/SwipeDelegate.qml b/src/imports/controls/material/SwipeDelegate.qml
new file mode 100644
index 00000000..dec2d12f
--- /dev/null
+++ b/src/imports/controls/material/SwipeDelegate.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+
+T.SwipeDelegate {
+ id: control
+
+ 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: 16
+ topPadding: 8
+ bottomPadding: 8
+ spacing: 16
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0
+ rightPadding: control.mirrored ? (control.indicator ? control.indicator.width + control.spacing : 0) : 0
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+
+ background: Rectangle {
+ implicitHeight: 48
+
+ color: control.Material.backgroundColor
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.down ? control.Material.buttonPressColor :
+ control.visualFocus || control.hovered ? control.Material.swipeDelegateHoverColor :
+ control.Material.listHighlightColor
+ }
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml
index 00655bcb..38c12b6b 100644
--- a/src/imports/controls/material/SwipeView.qml
+++ b/src/imports/controls/material/SwipeView.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,7 +35,7 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
+import QtQuick.Templates 2.0 as T
T.SwipeView {
id: control
@@ -45,7 +45,6 @@ T.SwipeView {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem.implicitHeight + topPadding + bottomPadding)
- //! [contentItem]
contentItem: ListView {
model: control.contentModel
currentIndex: control.currentIndex
@@ -60,5 +59,4 @@ T.SwipeView {
preferredHighlightEnd: 0
highlightMoveDuration: 250
}
- //! [contentItem]
}
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index 0b9edcab..ca739e62 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,84 +35,32 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls.material 1.0
-import Qt.labs.templates 1.0 as T
-import QtGraphicalEffects 1.0
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+import QtQuick.Templates 2.0 as T
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
- //! [indicator]
- indicator: Item {
+ indicator: SwitchIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 38
- implicitHeight: 32
-
- Ripple {
- x: handle.x + handle.width / 2 - width / 2
- y: handle.y + handle.height / 2 - height / 2
- width: handle.width
- height: width
- control: control
- colored: control.checked
- opacity: control.pressed || control.activeFocus ? 1 : 0
- }
-
- Rectangle {
- width: parent.width
- height: 14
- radius: height / 2
- y: parent.height / 2 - height / 2
- color: control.enabled ? (control.checked ? control.Material.switchCheckedTrackColor : control.Material.switchUncheckedTrackColor)
- : control.Material.switchDisabledTrackColor
- }
-
- Rectangle {
- id: handle
- x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2)))
- y: (parent.height - height) / 2
- width: 20
- height: 20
- radius: width / 2
- color: control.enabled ? (control.checked ? control.Material.switchCheckedHandleColor : control.Material.switchUncheckedHandleColor)
- : control.Material.switchDisabledHandleColor
-
- Behavior on x {
- enabled: !control.pressed
- SmoothedAnimation {
- duration: 300
- }
- }
-
- layer.enabled: true
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- spread: 0.3
- }
- }
+ control: control
}
- //! [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: 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 +70,4 @@ T.Switch {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
}
diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml
new file mode 100644
index 00000000..097f0acd
--- /dev/null
+++ b/src/imports/controls/material/SwitchDelegate.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+
+T.SwitchDelegate {
+ id: control
+
+ 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: 16
+ topPadding: 8
+ bottomPadding: 8
+ spacing: 16
+
+ indicator: SwitchIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+
+ background: Rectangle {
+ implicitHeight: 48
+
+ visible: control.down || control.highlighted
+ color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ }
+}
diff --git a/src/imports/controls/material/SwitchIndicator.qml b/src/imports/controls/material/SwitchIndicator.qml
new file mode 100644
index 00000000..0d2163b2
--- /dev/null
+++ b/src/imports/controls/material/SwitchIndicator.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
+
+Item {
+ id: indicator
+ implicitWidth: 38
+ implicitHeight: 32
+
+ property alias control: ripple.control
+
+ Material.elevation: 1
+
+ Ripple {
+ id: ripple
+ x: handle.x + handle.width / 2 - width / 2
+ y: handle.y + handle.height / 2 - height / 2
+ width: handle.width
+ height: width
+ colored: control.checked
+ opacity: control.pressed || control.visualFocus ? 1 : 0
+ }
+
+ Rectangle {
+ width: parent.width
+ height: 14
+ radius: height / 2
+ y: parent.height / 2 - height / 2
+ color: control.enabled ? (control.checked ? control.Material.switchCheckedTrackColor : control.Material.switchUncheckedTrackColor)
+ : control.Material.switchDisabledTrackColor
+ }
+
+ Rectangle {
+ id: handle
+ x: Math.max(0, Math.min(parent.width - width, control.visualPosition * parent.width - (width / 2)))
+ y: (parent.height - height) / 2
+ width: 20
+ height: 20
+ radius: width / 2
+ color: control.enabled ? (control.checked ? control.Material.switchCheckedHandleColor : control.Material.switchUncheckedHandleColor)
+ : control.Material.switchDisabledHandleColor
+
+ Behavior on x {
+ enabled: !control.pressed
+ SmoothedAnimation {
+ duration: 300
+ }
+ }
+ layer.enabled: indicator.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: indicator.Material.elevation
+ }
+ }
+}
diff --git a/src/imports/controls/material/TabBar.qml b/src/imports/controls/material/TabBar.qml
index dbc62512..901e3328 100644
--- a/src/imports/controls/material/TabBar.qml
+++ b/src/imports/controls/material/TabBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick 2.7
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.TabBar {
id: control
@@ -48,7 +49,6 @@ T.TabBar {
spacing: 1
- //! [contentItem]
contentItem: ListView {
implicitWidth: contentWidth
implicitHeight: 48
@@ -59,20 +59,34 @@ T.TabBar {
spacing: control.spacing
orientation: ListView.Horizontal
boundsBehavior: Flickable.StopAtBounds
+ flickableDirection: Flickable.AutoFlickIfNeeded
snapMode: ListView.SnapToItem
highlightMoveDuration: 250
highlightResizeDuration: 0
highlightFollowsCurrentItem: true
+ highlightRangeMode: ListView.ApplyRange
+ preferredHighlightBegin: 48
+ preferredHighlightEnd: width - 48
+
highlight: Item {
z: 2
Rectangle {
height: 2
width: parent.width
- y: parent.height - height
+ y: control.position === T.TabBar.Footer ? 0 : parent.height - height
color: control.Material.accentColor
}
}
}
- //! [contentItem]
+
+ background: Rectangle {
+ color: control.Material.backgroundColor
+
+ layer.enabled: control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ fullWidth: true
+ }
+ }
}
diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml
index 27b27e3b..535dfc02 100644
--- a/src/imports/controls/material/TabButton.qml
+++ b/src/imports/controls/material/TabButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,39 +35,30 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.contentWidth + leftPadding + rightPadding : 0)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.contentHeight + topPadding + bottomPadding : 0)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ contentItem.implicitHeight + 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: Text {
text: control.text
font: control.font
elide: Text.ElideRight
- color: !control.enabled ? control.Material.hintTextColor : control.pressed || control.checked ? control.Material.accentColor : control.Material.primaryTextColor
+ color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.primaryTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Item {
implicitHeight: 48
}
- //! [background]
}
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index 40c8c412..38502ed6 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.TextArea {
id: control
@@ -56,6 +56,7 @@ T.TextArea {
selectedTextColor: Material.primaryHighlightedTextColor
cursorDelegate: Rectangle {
id: cursor
+ clip: true // TODO
color: control.Material.accentColor
width: 2
visible: control.activeFocus && control.selectionStart === control.selectionEnd
@@ -73,14 +74,13 @@ T.TextArea {
id: timer
running: control.activeFocus
repeat: true
- interval: Qt.styleHints.cursorFlashTime
+ interval: Qt.styleHints.cursorFlashTime / 2
onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0
// force the cursor visible when gaining focus
onRunningChanged: cursor.opacity = 1
}
}
- //! [placeholder]
Text {
id: placeholder
x: control.leftPadding
@@ -93,16 +93,13 @@ 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]
- //! [background]
background: Rectangle {
- y: control.height - height - control.bottomPadding / 2
+ y: parent.height - height - control.bottomPadding / 2
implicitWidth: 120
height: control.activeFocus ? 2 : 1
color: control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor
}
- //! [background]
}
diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml
index 0f929a00..ab6f6187 100644
--- a/src/imports/controls/material/TextField.qml
+++ b/src/imports/controls/material/TextField.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,16 +35,18 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.TextField {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- placeholder.implicitHeight + 1 + topPadding + bottomPadding)
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ background ? background.implicitHeight : 0,
+ placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: 8
bottomPadding: 16
@@ -72,14 +74,13 @@ T.TextField {
id: timer
running: control.activeFocus
repeat: true
- interval: Qt.styleHints.cursorFlashTime
+ interval: Qt.styleHints.cursorFlashTime / 2
onTriggered: cursor.opacity = !cursor.opacity ? 1 : 0
// force the cursor visible when gaining focus
onRunningChanged: cursor.opacity = 1
}
}
- //! [placeholder]
Text {
id: placeholder
x: control.leftPadding
@@ -92,17 +93,14 @@ 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]
- //! [background]
background: Rectangle {
y: control.height - height - control.bottomPadding / 2
implicitWidth: 120
height: control.activeFocus ? 2 : 1
color: control.activeFocus ? control.Material.accentColor : control.Material.hintTextColor
}
- //! [background]
}
diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml
index 57a70564..f0b50f73 100644
--- a/src/imports/controls/material/ToolBar.qml
+++ b/src/imports/controls/material/ToolBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,26 +35,33 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+import QtQuick.Controls.Material.impl 2.0
T.ToolBar {
id: control
+ Material.elevation: 4
+
implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- //! [contentItem]
+ Material.foreground: Material.toolTextColor
+
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitHeight: 48
- color: control.Material.primaryColor
+ color: control.Material.toolBarColor
+
+ layer.enabled: control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ fullWidth: true
+ }
}
- //! [background]
}
diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml
index ebdc36f2..d8c945a7 100644
--- a/src/imports/controls/material/ToolButton.qml
+++ b/src/imports/controls/material/ToolButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,27 +35,21 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
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: Text {
text: control.text
font: control.font
color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
@@ -63,15 +57,12 @@ T.ToolButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Rectangle {
implicitWidth: 48
implicitHeight: 48
- color: control.pressed ? control.Material.flatButtonPressColor : control.Material.flatButtonFocusColor
- visible: control.enabled && (control.pressed || control.activeFocus || control.checked || control.highlighted)
+ color: control.down ? control.Material.buttonPressColor : control.Material.buttonHoverColor
+ visible: control.enabled && (control.down || control.visualFocus || control.checked || control.highlighted)
}
- //! [background]
}
diff --git a/src/imports/controls/material/ToolTip.qml b/src/imports/controls/material/ToolTip.qml
new file mode 100644
index 00000000..ab3b05d8
--- /dev/null
+++ b/src/imports/controls/material/ToolTip.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
+
+T.ToolTip {
+ id: control
+
+ x: parent ? (parent.width - implicitWidth) / 2 : 0
+ y: -implicitHeight - 24
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ margins: 12
+ padding: 8
+ leftPadding: padding + 8
+ rightPadding: padding + 8
+
+ closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
+
+ Material.theme: Material.Dark
+
+ enter: Transition {
+ // toast_enter
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutQuad; duration: 500 }
+ }
+
+ exit: Transition {
+ // toast_exit
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.InQuad; duration: 500 }
+ }
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ // TODO: wrapMode: Label.Wrap
+ color: control.Material.primaryTextColor
+ }
+
+ background: Rectangle {
+ implicitHeight: 32
+ color: control.Material.tooltipColor
+ opacity: 0.9
+ radius: 2
+ }
+}
diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml
index e5b930a8..7e914319 100644
--- a/src/imports/controls/material/Tumbler.qml
+++ b/src/imports/controls/material/Tumbler.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,28 +35,25 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.material 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Material 2.0
T.Tumbler {
id: control
implicitWidth: 60
implicitHeight: 200
- //! [delegate]
delegate: Text {
id: label
text: modelData
color: control.Material.primaryTextColor
font: control.font
- opacity: 0.4 + Math.max(0, 1 - Math.abs(Tumbler.displacement)) * 0.6
+ opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [delegate]
- //! [contentItem]
contentItem: PathView {
id: pathView
model: control.model
@@ -78,5 +75,4 @@ T.Tumbler {
property real delegateHeight: control.availableHeight / control.visibleItemCount
}
- //! [contentItem]
}
diff --git a/src/imports/controls/material/images/drop-indicator.png b/src/imports/controls/material/images/drop-indicator.png
index b4396ec6..08bb4855 100644
--- a/src/imports/controls/material/images/drop-indicator.png
+++ b/src/imports/controls/material/images/drop-indicator.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator.svg b/src/imports/controls/material/images/drop-indicator.svg
new file mode 100644
index 00000000..94b5ca15
--- /dev/null
+++ b/src/imports/controls/material/images/drop-indicator.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <path d="M7,10l5,5,5-5z" fill="#757575"/>
+</svg>
diff --git a/src/imports/controls/material/images/drop-indicator@2x.png b/src/imports/controls/material/images/drop-indicator@2x.png
index 1c711bc2..ccdfc2b1 100644
--- a/src/imports/controls/material/images/drop-indicator@2x.png
+++ b/src/imports/controls/material/images/drop-indicator@2x.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator@3x.png b/src/imports/controls/material/images/drop-indicator@3x.png
index 06dd8bd2..00cae691 100644
--- a/src/imports/controls/material/images/drop-indicator@3x.png
+++ b/src/imports/controls/material/images/drop-indicator@3x.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator@4x.png b/src/imports/controls/material/images/drop-indicator@4x.png
index b2157c30..0a61cb01 100644
--- a/src/imports/controls/material/images/drop-indicator@4x.png
+++ b/src/imports/controls/material/images/drop-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index e41c7d2d..d6247895 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -12,12 +12,16 @@ SOURCES += \
QML_FILES += \
$$PWD/ApplicationWindow.qml \
+ $$PWD/BoxShadow.qml \
$$PWD/BusyIndicator.qml \
$$PWD/Button.qml \
$$PWD/CheckBox.qml \
+ $$PWD/CheckDelegate.qml \
+ $$PWD/CheckIndicator.qml \
$$PWD/ComboBox.qml \
$$PWD/Dial.qml \
$$PWD/Drawer.qml \
+ $$PWD/ElevationEffect.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
$$PWD/ItemDelegate.qml \
@@ -30,6 +34,8 @@ QML_FILES += \
$$PWD/Popup.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
+ $$PWD/RadioDelegate.qml \
+ $$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
$$PWD/Ripple.qml \
$$PWD/ScrollBar.qml \
@@ -38,12 +44,16 @@ QML_FILES += \
$$PWD/SliderHandle.qml \
$$PWD/SpinBox.qml \
$$PWD/StackView.qml \
+ $$PWD/SwipeDelegate.qml \
$$PWD/SwipeView.qml \
$$PWD/Switch.qml \
+ $$PWD/SwitchDelegate.qml \
+ $$PWD/SwitchIndicator.qml \
$$PWD/TabBar.qml \
$$PWD/TabButton.qml \
$$PWD/TextArea.qml \
$$PWD/TextField.qml \
$$PWD/ToolBar.qml \
$$PWD/ToolButton.qml \
+ $$PWD/ToolTip.qml \
$$PWD/Tumbler.qml
diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro
index 63450289..06499467 100644
--- a/src/imports/controls/material/material.pro
+++ b/src/imports/controls/material/material.pro
@@ -1,9 +1,9 @@
-TARGET = qtlabsmaterialstyleplugin
-TARGETPATH = Qt/labs/controls/material
-IMPORT_VERSION = 1.0
+TARGET = qtquickcontrols2materialstyleplugin
+TARGETPATH = QtQuick/Controls.2/Material
+IMPORT_VERSION = 2.0
QT += qml quick
-QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private
+QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
@@ -11,10 +11,10 @@ OTHER_FILES += \
qmldir
SOURCES += \
- $$PWD/qtlabsmaterialstyleplugin.cpp
+ $$PWD/qtquickcontrols2materialstyleplugin.cpp
RESOURCES += \
- $$PWD/qtlabsmaterialstyleplugin.qrc
+ $$PWD/qtquickcontrols2materialstyleplugin.qrc
include(material.pri)
diff --git a/src/imports/controls/material/plugins.qmltypes b/src/imports/controls/material/plugins.qmltypes
new file mode 100644
index 00000000..0ff64084
--- /dev/null
+++ b/src/imports/controls/material/plugins.qmltypes
@@ -0,0 +1,92 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtQuick.Controls.Material 2.0'
+
+Module {
+ dependencies: []
+ Component {
+ name: "QQuickMaterialStyle"
+ prototype: "QQuickStyle"
+ exports: ["QtQuick.Controls.Material/Material 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Theme"
+ values: {
+ "Light": 0,
+ "Dark": 1
+ }
+ }
+ Enum {
+ name: "Color"
+ values: {
+ "Red": 0,
+ "Pink": 1,
+ "Purple": 2,
+ "DeepPurple": 3,
+ "Indigo": 4,
+ "Blue": 5,
+ "LightBlue": 6,
+ "Cyan": 7,
+ "Teal": 8,
+ "Green": 9,
+ "LightGreen": 10,
+ "Lime": 11,
+ "Yellow": 12,
+ "Amber": 13,
+ "Orange": 14,
+ "DeepOrange": 15,
+ "Brown": 16,
+ "Grey": 17,
+ "BlueGrey": 18
+ }
+ }
+ Enum {
+ name: "Shade"
+ values: {
+ "Shade50": 0,
+ "Shade100": 1,
+ "Shade200": 2,
+ "Shade300": 3,
+ "Shade400": 4,
+ "Shade500": 5,
+ "Shade600": 6,
+ "Shade700": 7,
+ "Shade800": 8,
+ "Shade900": 9,
+ "ShadeA100": 10,
+ "ShadeA200": 11,
+ "ShadeA400": 12,
+ "ShadeA700": 13
+ }
+ }
+ Property { name: "theme"; type: "Theme" }
+ Property { name: "primary"; type: "QVariant" }
+ Property { name: "accent"; type: "QVariant" }
+ Property { name: "foreground"; type: "QVariant" }
+ Property { name: "background"; type: "QVariant" }
+ Signal { name: "paletteChanged" }
+ Method {
+ name: "color"
+ type: "QColor"
+ Parameter { name: "color"; type: "Color" }
+ Parameter { name: "shade"; type: "Shade" }
+ }
+ Method {
+ name: "color"
+ type: "QColor"
+ Parameter { name: "color"; type: "Color" }
+ }
+ Method {
+ name: "shade"
+ type: "QColor"
+ Parameter { name: "color"; type: "QColor" }
+ Parameter { name: "shade"; type: "Shade" }
+ }
+ }
+ Component { name: "QQuickStyle"; prototype: "QObject" }
+}
diff --git a/src/imports/controls/material/qmldir b/src/imports/controls/material/qmldir
index d90e75d8..51dafa08 100644
--- a/src/imports/controls/material/qmldir
+++ b/src/imports/controls/material/qmldir
@@ -1,5 +1,5 @@
-module Qt.labs.controls.material
-plugin qtlabsmaterialstyleplugin
-classname QtLabsMaterialStylePlugin
-depends Qt.labs.controls 1.0
+module QtQuick.Controls.Material
+plugin qtquickcontrols2materialstyleplugin
+classname QtQuickControls2MaterialStylePlugin
+depends QtQuick.Controls 2.0
depends QtGraphicalEffects 1.0
diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp
index c11a347f..8407c7c2 100644
--- a/src/imports/controls/material/qquickmaterialprogressring.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressring.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -67,13 +67,15 @@ 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:
+ int m_lastStartAngle;
+ int m_lastEndAngle;
qreal m_devicePixelRatio;
QSGNode *m_containerNode;
QQuickWindow *m_window;
@@ -134,11 +136,12 @@ QColor QQuickMaterialProgressRing::color() const
void QQuickMaterialProgressRing::setColor(QColor color)
{
- if (m_color != color) {
- m_color = color;
- update();
- emit colorChanged();
- }
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ update();
+ emit colorChanged();
}
static const int spanAnimationDuration = 700;
@@ -166,9 +169,11 @@ QQuickAnimatorJob *QQuickMaterialRingAnimator::createJob() const
}
QQuickMaterialRingAnimatorJob::QQuickMaterialRingAnimatorJob() :
+ m_lastStartAngle(0),
+ m_lastEndAngle(0),
m_devicePixelRatio(1.0),
- m_containerNode(Q_NULLPTR),
- m_window(Q_NULLPTR)
+ m_containerNode(nullptr),
+ m_window(nullptr)
{
}
@@ -214,29 +219,25 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
const int iteration = time / spanAnimationDuration;
int startAngle = 0;
int endAngle = 0;
- static int lastStartAngle = 0;
- static int lastEndAngle = 0;
if (iteration % 2 == 0) {
- if (lastStartAngle > 360 * oneDegree) {
- lastStartAngle -= 360 * oneDegree;
+ if (m_lastStartAngle > 360 * oneDegree) {
+ m_lastStartAngle -= 360 * oneDegree;
}
// The start angle is only affected by the rotation animation for the "grow" phase.
- startAngle = lastStartAngle;
- // TODO: use the correct curve here. QEasingCurve's bezier API doesn't support SVG path data.
+ startAngle = m_lastStartAngle;
QEasingCurve angleCurve(QEasingCurve::OutQuad);
const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete);
- endAngle = lastStartAngle + minSweepSpan + percentage * (maxSweepSpan - minSweepSpan);
- lastEndAngle = endAngle;
+ endAngle = m_lastStartAngle + minSweepSpan + percentage * (maxSweepSpan - minSweepSpan);
+ m_lastEndAngle = endAngle;
} else {
// Both the start angle *and* the span are affected by the "shrink" phase.
- // TODO: use the correct curve here. QEasingCurve's bezier API doesn't support SVG path data.
QEasingCurve angleCurve(QEasingCurve::InQuad);
const qreal percentage = angleCurve.valueForProgress(spanPercentageComplete);
- startAngle = lastEndAngle - maxSweepSpan + percentage * (maxSweepSpan - minSweepSpan);
- endAngle = lastEndAngle;
- lastStartAngle = startAngle;
+ startAngle = m_lastEndAngle - maxSweepSpan + percentage * (maxSweepSpan - minSweepSpan);
+ endAngle = m_lastEndAngle;
+ m_lastStartAngle = startAngle;
}
const int halfPen = pen.width() / 2;
@@ -258,8 +259,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..8d6cd578 100644
--- a/src/imports/controls/material/qquickmaterialprogressring_p.h
+++ b/src/imports/controls/material/qquickmaterialprogressring_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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 1d888183..ce4d676e 100644
--- a/src/imports/controls/material/qquickmaterialprogressstrip.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressstrip.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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()
@@ -207,12 +207,17 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa
{
QQuickItemPrivate *d = QQuickItemPrivate::get(this);
+ QRectF bounds = boundingRect();
+ bounds.setHeight(implicitHeight());
+ bounds.moveTop((height() - bounds.height()) / 2.0);
+
if (!oldNode)
- oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
- static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+ oldNode = new QSGSimpleRectNode(bounds, Qt::transparent);
+ static_cast<QSGSimpleRectNode *>(oldNode)->setRect(bounds);
const int count = m_indeterminate ? 2 : 1;
const qreal w = m_indeterminate ? 0 : m_progress * width();
+ const QRectF rect(0, bounds.y(), w, bounds.height());
QSGNode *transformNode = oldNode->firstChild();
for (int i = 0; i < count; ++i) {
@@ -230,7 +235,7 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa
QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(transformNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
- rectNode->setRect(QRectF(0, 0, w, height()));
+ rectNode->setRect(rect);
rectNode->setColor(m_color);
rectNode->update();
diff --git a/src/imports/controls/material/qquickmaterialprogressstrip_p.h b/src/imports/controls/material/qquickmaterialprogressstrip_p.h
index d0618af6..f441c09d 100644
--- a/src/imports/controls/material/qquickmaterialprogressstrip_p.h
+++ b/src/imports/controls/material/qquickmaterialprogressstrip_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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 d7a25914..1c19bbd3 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -39,7 +39,7 @@
#include <QtCore/qdebug.h>
#include <QtCore/qsettings.h>
#include <QtQml/qqmlinfo.h>
-#include <QtLabsControls/private/qquickstyle_p.h>
+#include <QtQuickControls2/private/qquickstyleattached_p.h>
QT_BEGIN_NAMESPACE
@@ -369,41 +369,67 @@ static const QRgb colors[][14] = {
}
};
-static QQuickMaterialStyle::Theme defaultTheme = QQuickMaterialStyle::Light;
-static uint defaultPrimary = QQuickMaterialStyle::Indigo;
-static uint defaultAccent = QQuickMaterialStyle::Pink;
-static bool defaultPrimaryCustom = false;
-static bool defaultAccentCustom = false;
+// If no value was inherited from a parent or explicitly set, the "global" values are used.
+// The initial, default values of the globals are hard-coded here, but the environment
+// variables and .conf file override them if specified.
+static QQuickMaterialStyle::Theme globalTheme = QQuickMaterialStyle::Light;
+static uint globalPrimary = QQuickMaterialStyle::Indigo;
+static uint globalAccent = QQuickMaterialStyle::Pink;
+static uint globalForeground = 0xDD000000; // primaryTextColorLight
+static uint globalBackground = 0xFFFAFAFA; // backgroundColorLight
+// These represent whether a global foreground/background was set.
+// Each style's m_hasForeground/m_hasBackground are initialized to these values.
+static bool hasGlobalForeground = false;
+static bool hasGlobalBackground = false;
+// These represent whether or not the global color value was specified as one of the
+// values that QColor accepts, as opposed to one of the pre-defined colors like Red.
+static bool globalPrimaryCustom = false;
+static bool globalAccentCustom = false;
+static bool globalForegroundCustom = true;
+static bool globalBackgroundCustom = true;
+
static const QRgb backgroundColorLight = 0xFFFAFAFA;
static const QRgb backgroundColorDark = 0xFF303030;
static const QRgb dialogColorLight = 0xFFFFFFFF;
-static const QRgb dialogColorDark = 0xFF303030;
+static const QRgb dialogColorDark = 0xFF424242;
static const QRgb primaryTextColorLight = 0xDD000000;
static const QRgb primaryTextColorDark = 0xFFFFFFFF;
static const QRgb secondaryTextColorLight = 0x89000000;
static const QRgb secondaryTextColorDark = 0xB2FFFFFF;
static const QRgb hintTextColorLight = 0x60000000;
static const QRgb hintTextColorDark = 0x4CFFFFFF;
-static const QRgb dividerTextColorLight = 0x1E000000;
-static const QRgb dividerTextColorDark = 0x1EFFFFFF;
+static const QRgb dividerColorLight = 0x1E000000;
+static const QRgb dividerColorDark = 0x1EFFFFFF;
+static const QRgb iconColorLight = 0x89000000;
+static const QRgb iconColorDark = 0xFFFFFFFF;
+static const QRgb iconDisabledColorLight = 0x42000000;
+static const QRgb iconDisabledColorDark = 0x4CFFFFFF;
static const QRgb raisedButtonColorLight = 0xFFD6D7D7;
-// TODO: find out actual value
-static const QRgb raisedButtonPressColorLight = 0xFFCCCDCD;
-static const QRgb raisedButtonDisabledColorLight = dividerTextColorLight;
-static const QRgb raisedButtonDisabledColorDark = dividerTextColorDark;
+static const QRgb raisedButtonColorDark = 0x3FCCCCCC;
+static const QRgb raisedButtonDisabledColorLight = dividerColorLight;
+static const QRgb raisedButtonDisabledColorDark = dividerColorDark;
static const QRgb flatButtonPressColorLight = 0x66999999;
static const QRgb flatButtonPressColorDark = 0x3FCCCCCC;
static const QRgb flatButtonFocusColorLight = 0x33CCCCCC;
static const QRgb flatButtonFocusColorDark = 0x26CCCCCC;
+static const QRgb swipeDelegateColorLight = 0xFFD6D7D7;
+static const QRgb swipeDelegateColorDark = 0xFF525252;
+static const QRgb swipeDelegateHoverColorLight = 0xFFDFDFDF;
+static const QRgb swipeDelegateHoverColorDark = 0xFF5D5D5D;
+static const QRgb swipeDelegatePressColorLight = 0xFFCFCFCF;
+static const QRgb swipeDelegatePressColorDark = 0xFF484848;
+static const QRgb swipeDelegateDisabledColorLight = 0xFFEFEFEF;
+static const QRgb swipeDelegateDisabledColorDark = 0xFF7C7C7C;
static const QRgb frameColorLight = hintTextColorLight;
static const QRgb frameColorDark = hintTextColorDark;
static const QRgb switchUncheckedTrackColorLight = 0x42000000;
static const QRgb switchUncheckedTrackColorDark = 0x4CFFFFFF;
static const QRgb switchDisabledTrackColorLight = 0x1E000000;
static const QRgb switchDisabledTrackColorDark = 0x19FFFFFF;
-// TODO: find out actual values
static const QRgb checkBoxUncheckedRippleColorLight = 0x10000000;
static const QRgb checkBoxUncheckedRippleColorDark = 0x20FFFFFF;
+static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC;
+static const QRgb spinBoxDisabledIconColorDark = 0xFF666666;
static QColor alphaBlend(const QColor &bg, const QColor &fg)
{
@@ -415,15 +441,24 @@ static QColor alphaBlend(const QColor &bg, const QColor &fg)
return result;
}
-QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickStyle(parent),
+QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickStyleAttached(parent),
m_explicitTheme(false),
m_explicitPrimary(false),
m_explicitAccent(false),
- m_customPrimary(defaultPrimaryCustom),
- m_customAccent(defaultAccentCustom),
- m_theme(defaultTheme),
- m_primary(defaultPrimary),
- m_accent(defaultAccent)
+ m_explicitForeground(false),
+ m_explicitBackground(false),
+ m_customPrimary(globalPrimaryCustom),
+ m_customAccent(globalAccentCustom),
+ m_customForeground(globalForegroundCustom),
+ m_customBackground(globalBackgroundCustom),
+ m_hasForeground(hasGlobalForeground),
+ m_hasBackground(hasGlobalBackground),
+ m_theme(globalTheme),
+ m_primary(globalPrimary),
+ m_accent(globalAccent),
+ m_foreground(globalForeground),
+ m_background(globalBackground),
+ m_elevation(0)
{
init();
}
@@ -441,27 +476,42 @@ QQuickMaterialStyle::Theme QQuickMaterialStyle::theme() const
void QQuickMaterialStyle::setTheme(Theme theme)
{
m_explicitTheme = true;
- if (m_theme != theme) {
- m_theme = theme;
- propagateTheme();
- emit themeChanged();
- emit paletteChanged();
- }
+ if (m_theme == theme)
+ return;
+
+ m_theme = theme;
+ propagateTheme();
+ emit themeChanged();
+ emit paletteChanged();
+ if (!m_customAccent)
+ emit accentChanged();
+ if (!m_hasBackground)
+ emit backgroundChanged();
+ if (!m_hasForeground)
+ emit foregroundChanged();
}
void QQuickMaterialStyle::inheritTheme(Theme theme)
{
- if (!m_explicitTheme && m_theme != theme) {
- m_theme = theme;
- propagateTheme();
- emit themeChanged();
- emit paletteChanged();
- }
+ if (m_explicitTheme || m_theme == theme)
+ return;
+
+ m_theme = theme;
+ propagateTheme();
+ emit themeChanged();
+ emit paletteChanged();
+ if (!m_customAccent)
+ emit accentChanged();
+ if (!m_hasBackground)
+ emit backgroundChanged();
+ if (!m_hasForeground)
+ emit foregroundChanged();
}
void QQuickMaterialStyle::propagateTheme()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
if (material)
material->inheritTheme(m_theme);
@@ -470,11 +520,12 @@ void QQuickMaterialStyle::propagateTheme()
void QQuickMaterialStyle::resetTheme()
{
- if (m_explicitTheme) {
- m_explicitTheme = false;
- QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
- inheritTheme(material ? material->theme() : defaultTheme);
- }
+ if (!m_explicitTheme)
+ return;
+
+ m_explicitTheme = false;
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
+ inheritTheme(material ? material->theme() : globalTheme);
}
QVariant QQuickMaterialStyle::primary() const
@@ -486,52 +537,36 @@ void QQuickMaterialStyle::setPrimary(const QVariant &var)
{
QRgb primary = 0;
bool custom = false;
- if (var.type() == QVariant::Int) {
- int val = var.toInt();
- if (val > BlueGrey) {
- qmlInfo(parent()) << "unknown Material.primary value: " << val;
- return;
- }
- primary = val;
- } else {
- int val = QMetaEnum::fromType<Color>().keyToValue(var.toByteArray());
- if (val != -1) {
- primary = val;
- } else {
- QColor color(var.toString());
- if (!color.isValid()) {
- qmlInfo(parent()) << "unknown Material.primary value: " << var.toString();
- return;
- }
- custom = true;
- primary = color.rgba();
- }
- }
+ if (!variantToRgba(var, "primary", &primary, &custom))
+ return;
m_explicitPrimary = true;
- if (m_primary != primary) {
- m_customPrimary = custom;
- m_primary = primary;
- propagatePrimary();
- emit primaryChanged();
- emit paletteChanged();
- }
+ if (m_primary == primary)
+ return;
+
+ m_customPrimary = custom;
+ m_primary = primary;
+ propagatePrimary();
+ emit primaryChanged();
+ emit paletteChanged();
}
void QQuickMaterialStyle::inheritPrimary(uint primary, bool custom)
{
- if (!m_explicitPrimary && m_primary != primary) {
- m_customPrimary = custom;
- m_primary = primary;
- propagatePrimary();
- emit primaryChanged();
- emit paletteChanged();
- }
+ if (m_explicitPrimary || m_primary == primary)
+ return;
+
+ m_customPrimary = custom;
+ m_primary = primary;
+ propagatePrimary();
+ emit primaryChanged();
+ emit paletteChanged();
}
void QQuickMaterialStyle::propagatePrimary()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
if (material)
material->inheritPrimary(m_primary, m_customPrimary);
@@ -540,12 +575,16 @@ void QQuickMaterialStyle::propagatePrimary()
void QQuickMaterialStyle::resetPrimary()
{
- if (m_explicitPrimary) {
- m_customPrimary = false;
- m_explicitPrimary = false;
- QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
- inheritPrimary(material ? material->m_primary : defaultPrimary, true);
- }
+ if (!m_explicitPrimary)
+ return;
+
+ m_customPrimary = false;
+ m_explicitPrimary = false;
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
+ if (material)
+ inheritPrimary(material->m_primary, material->m_customPrimary);
+ else
+ inheritPrimary(globalPrimary, false);
}
QVariant QQuickMaterialStyle::accent() const
@@ -557,52 +596,36 @@ void QQuickMaterialStyle::setAccent(const QVariant &var)
{
QRgb accent = 0;
bool custom = false;
- if (var.type() == QVariant::Int) {
- int val = var.toInt();
- if (val > BlueGrey) {
- qmlInfo(parent()) << "unknown Material.accent value: " << val;
- return;
- }
- accent = val;
- } else {
- int val = QMetaEnum::fromType<Color>().keyToValue(var.toByteArray());
- if (val != -1) {
- accent = val;
- } else {
- QColor color(var.toString());
- if (!color.isValid()) {
- qmlInfo(parent()) << "unknown Material.accent value: " << var.toString();
- return;
- }
- custom = true;
- accent = color.rgba();
- }
- }
+ if (!variantToRgba(var, "accent", &accent, &custom))
+ return;
m_explicitAccent = true;
- if (m_accent != accent) {
- m_customAccent = custom;
- m_accent = accent;
- propagateAccent();
- emit accentChanged();
- emit paletteChanged();
- }
+ if (m_accent == accent)
+ return;
+
+ m_customAccent = custom;
+ m_accent = accent;
+ propagateAccent();
+ emit accentChanged();
+ emit paletteChanged();
}
void QQuickMaterialStyle::inheritAccent(uint accent, bool custom)
{
- if (!m_explicitAccent && m_accent != accent) {
- m_customAccent = custom;
- m_accent = accent;
- propagateAccent();
- emit accentChanged();
- emit paletteChanged();
- }
+ if (m_explicitAccent || m_accent == accent)
+ return;
+
+ m_customAccent = custom;
+ m_accent = accent;
+ propagateAccent();
+ emit accentChanged();
+ emit paletteChanged();
}
void QQuickMaterialStyle::propagateAccent()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
if (material)
material->inheritAccent(m_accent, m_customAccent);
@@ -611,14 +634,153 @@ void QQuickMaterialStyle::propagateAccent()
void QQuickMaterialStyle::resetAccent()
{
- if (m_explicitAccent) {
- m_customAccent = false;
- m_explicitAccent = false;
- QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
- inheritAccent(material ? material->m_accent : defaultAccent, true);
+ if (!m_explicitAccent)
+ return;
+
+ m_customAccent = false;
+ m_explicitAccent = false;
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
+ if (material)
+ inheritAccent(material->m_accent, material->m_customAccent);
+ else
+ inheritAccent(globalAccent, false);
+}
+
+QVariant QQuickMaterialStyle::foreground() const
+{
+ return primaryTextColor();
+}
+
+void QQuickMaterialStyle::setForeground(const QVariant &var)
+{
+ QRgb foreground = 0;
+ bool custom = false;
+ if (!variantToRgba(var, "foreground", &foreground, &custom))
+ return;
+
+ m_hasForeground = true;
+ m_explicitForeground = true;
+ if (m_foreground == foreground)
+ return;
+
+ m_customForeground = custom;
+ m_foreground = foreground;
+ propagateForeground();
+ emit foregroundChanged();
+}
+
+void QQuickMaterialStyle::inheritForeground(uint foreground, bool custom, bool has)
+{
+ if (m_explicitForeground || m_foreground == foreground)
+ return;
+
+ m_hasForeground = has;
+ m_customForeground = custom;
+ m_foreground = foreground;
+ propagateForeground();
+ emit foregroundChanged();
+}
+
+void QQuickMaterialStyle::propagateForeground()
+{
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
+ if (material)
+ material->inheritForeground(m_foreground, m_customForeground, m_hasForeground);
}
}
+void QQuickMaterialStyle::resetForeground()
+{
+ if (!m_explicitForeground)
+ return;
+
+ m_hasForeground = false;
+ m_customForeground = false;
+ m_explicitForeground = false;
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
+ inheritForeground(material ? material->m_foreground : globalForeground, true, material ? material->m_hasForeground : false);
+}
+
+QVariant QQuickMaterialStyle::background() const
+{
+ return backgroundColor();
+}
+
+void QQuickMaterialStyle::setBackground(const QVariant &var)
+{
+ QRgb background = 0;
+ bool custom = false;
+ if (!variantToRgba(var, "background", &background, &custom))
+ return;
+
+ m_hasBackground = true;
+ m_explicitBackground = true;
+ if (m_background == background)
+ return;
+
+ m_customBackground = custom;
+ m_background = background;
+ propagateBackground();
+ emit backgroundChanged();
+ emit paletteChanged();
+}
+
+void QQuickMaterialStyle::inheritBackground(uint background, bool custom, bool has)
+{
+ if (m_explicitBackground || m_background == background)
+ return;
+
+ m_hasBackground = has;
+ m_customBackground = custom;
+ m_background = background;
+ propagateBackground();
+ emit backgroundChanged();
+ emit paletteChanged();
+}
+
+void QQuickMaterialStyle::propagateBackground()
+{
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
+ if (material)
+ material->inheritBackground(m_background, m_customBackground, m_hasBackground);
+ }
+}
+
+void QQuickMaterialStyle::resetBackground()
+{
+ if (!m_explicitBackground)
+ return;
+
+ m_hasBackground = false;
+ m_customBackground = false;
+ m_explicitBackground = false;
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
+ inheritBackground(material ? material->m_background : globalBackground, true, material ? material->m_hasBackground : false);
+}
+
+int QQuickMaterialStyle::elevation() const
+{
+ return m_elevation;
+}
+
+void QQuickMaterialStyle::setElevation(int elevation)
+{
+ if (m_elevation == elevation)
+ return;
+
+ m_elevation = elevation;
+ emit elevationChanged();
+}
+
+void QQuickMaterialStyle::resetElevation()
+{
+ setElevation(0);
+}
+
QColor QQuickMaterialStyle::primaryColor() const
{
if (m_customPrimary)
@@ -628,27 +790,53 @@ QColor QQuickMaterialStyle::primaryColor() const
return colors[m_primary][Shade500];
}
-QColor QQuickMaterialStyle::accentColor() const
+QColor QQuickMaterialStyle::accentColor(Shade shade) const
{
if (m_customAccent)
- return QColor::fromRgba(m_accent);
+ return shade == themeShade() ? QColor::fromRgba(m_accent)
+ : this->shade(QColor::fromRgba(m_accent), shade);
if (m_accent > BlueGrey)
return QColor();
- return colors[m_accent][m_theme == Light ? Shade500 : Shade200];
+ return colors[m_accent][shade];
+}
+
+QColor QQuickMaterialStyle::accentColor() const
+{
+ return accentColor(themeShade());
+}
+
+QColor QQuickMaterialStyle::backgroundColor(Shade shade) const
+{
+ if (!m_hasBackground)
+ return QColor::fromRgba(m_theme == Light ? backgroundColorLight : backgroundColorDark);
+ if (m_customBackground)
+ return shade == themeShade() ? QColor::fromRgba(m_background)
+ : this->shade(QColor::fromRgba(m_background), shade);
+ if (m_background > BlueGrey)
+ return QColor();
+ return colors[m_background][shade];
}
QColor QQuickMaterialStyle::backgroundColor() const
{
- return QColor::fromRgba(m_theme == Light ? backgroundColorLight : backgroundColorDark);
+ return backgroundColor(themeShade());
}
QColor QQuickMaterialStyle::primaryTextColor() const
{
- return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark);
+ if (!m_hasForeground)
+ return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark);
+ if (m_customForeground)
+ return QColor::fromRgba(m_foreground);
+ if (m_foreground > BlueGrey)
+ return QColor();
+ return colors[m_foreground][Shade500];
}
QColor QQuickMaterialStyle::primaryHighlightedTextColor() const
{
+ if (m_explicitForeground)
+ return primaryTextColor();
return QColor::fromRgba(primaryTextColorDark);
}
@@ -676,60 +864,117 @@ QColor QQuickMaterialStyle::dropShadowColor() const
QColor QQuickMaterialStyle::dividerColor() const
{
- return QColor::fromRgba(m_theme == Light ? dividerTextColorLight : dividerTextColorDark);
+ return QColor::fromRgba(m_theme == Light ? dividerColorLight : dividerColorDark);
}
-QColor QQuickMaterialStyle::raisedButtonColor() const
+QColor QQuickMaterialStyle::iconColor() const
{
- return QColor::fromRgba(m_theme == Light ? raisedButtonColorLight : flatButtonFocusColorDark);
+ return QColor::fromRgba(m_theme == Light ? iconColorLight : iconColorDark);
}
-QColor QQuickMaterialStyle::raisedButtonHoverColor() const
+QColor QQuickMaterialStyle::iconDisabledColor() const
{
- // The specs don't specify different colors here for the light theme.
- return QColor::fromRgba(m_theme == Light ? raisedButtonColorLight : flatButtonPressColorDark);
+ return QColor::fromRgba(m_theme == Light ? iconDisabledColorLight : iconDisabledColorDark);
}
-QColor QQuickMaterialStyle::raisedButtonPressColor() const
+QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hover) const
{
- return QColor::fromRgba(m_theme == Light ? raisedButtonPressColorLight : flatButtonPressColorDark);
+ Shade shade = pressed ? (m_theme == Light ? Shade700 : Shade100)
+ : themeShade();
+
+ QColor color = Qt::transparent;
+
+ if (m_explicitBackground) {
+ color = backgroundColor(shade);
+ } else if (highlighted) {
+ color = accentColor(shade);
+ } else if (elevation() > 0) {
+ color = QColor::fromRgba(m_theme == Light ? raisedButtonColorLight
+ : raisedButtonColorDark);
+
+ if (pressed) {
+ color = this->shade(color, shade);
+ }
+ }
+
+ if (color == Qt::transparent) {
+ if (pressed) {
+ return QColor::fromRgba(m_theme == Light ? flatButtonPressColorLight
+ : flatButtonPressColorDark);
+ } else if (hover) {
+ return QColor::fromRgba(m_theme == Light ? flatButtonFocusColorLight
+ : flatButtonFocusColorDark);
+ } else {
+ return color;
+ }
+ }
+
+ if (pressed || hover) {
+ // Add overlaying black shadow 12% opacity
+ return alphaBlend(color, QColor::fromRgba(0x1F000000));
+ } else {
+ return color;
+ }
}
-QColor QQuickMaterialStyle::raisedButtonDisabledColor() const
+QColor QQuickMaterialStyle::buttonColor() const
{
- return QColor::fromRgba(m_theme == Light ? raisedButtonDisabledColorLight : raisedButtonDisabledColorDark);
+ return buttonColor(false, false, false);
}
-QColor QQuickMaterialStyle::raisedHighlightedButtonColor() const
+QColor QQuickMaterialStyle::buttonHoverColor() const
{
- return accentColor();
+ return buttonColor(false, false, true);
}
-QColor QQuickMaterialStyle::raisedHighlightedButtonHoverColor() const
+QColor QQuickMaterialStyle::buttonPressColor() const
{
- // Add overlaying black shadow 12% opacity
- return alphaBlend(accentColor(), QColor::fromRgba(0x1F000000));
+ return buttonColor(false, true, false);
}
-QColor QQuickMaterialStyle::raisedHighlightedButtonPressColor() const
+QColor QQuickMaterialStyle::buttonDisabledColor() const
{
- // Add overlaying black shadow 12% opacity
- return alphaBlend(shade(accentColor(), m_theme == Light ? Shade700 : Shade100), QColor::fromRgba(0x1F000000));
+ if (elevation() > 0) {
+ return QColor::fromRgba(m_theme == Light ? raisedButtonDisabledColorLight
+ : raisedButtonDisabledColorDark);
+ } else {
+ return Qt::transparent;
+ }
+}
+
+QColor QQuickMaterialStyle::highlightedButtonColor() const
+{
+ return buttonColor(true, false, false);
+}
+
+QColor QQuickMaterialStyle::highlightedButtonHoverColor() const
+{
+ return buttonColor(true, false, true);
+}
+
+QColor QQuickMaterialStyle::highlightedButtonPressColor() const
+{
+ return buttonColor(true, true, false);
}
-QColor QQuickMaterialStyle::raisedHighlightedButtonDisabledColor() const
+QColor QQuickMaterialStyle::swipeDelegateColor() const
{
- return QColor::fromRgba(m_theme == Light ? raisedButtonDisabledColorLight : raisedButtonDisabledColorDark);
+ return QColor::fromRgba(m_theme == Light ? swipeDelegateColorLight : swipeDelegateColorDark);
}
-QColor QQuickMaterialStyle::flatButtonPressColor() const
+QColor QQuickMaterialStyle::swipeDelegateHoverColor() const
{
- return QColor::fromRgba(m_theme == Light ? flatButtonPressColorLight : flatButtonPressColorDark);
+ return QColor::fromRgba(m_theme == Light ? swipeDelegateHoverColorLight : swipeDelegateHoverColorDark);
}
-QColor QQuickMaterialStyle::flatButtonFocusColor() const
+QColor QQuickMaterialStyle::swipeDelegatePressColor() const
{
- return QColor::fromRgba(m_theme == Light ? flatButtonFocusColorLight : flatButtonFocusColorDark);
+ return QColor::fromRgba(m_theme == Light ? swipeDelegatePressColorLight : swipeDelegatePressColorDark);
+}
+
+QColor QQuickMaterialStyle::swipeDelegateDisabledColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? swipeDelegateDisabledColorLight : swipeDelegateDisabledColorDark);
}
QColor QQuickMaterialStyle::frameColor() const
@@ -745,7 +990,6 @@ QColor QQuickMaterialStyle::checkBoxUncheckedRippleColor() const
QColor QQuickMaterialStyle::checkBoxCheckedRippleColor() const
{
QColor pressColor = accentColor();
- // TODO: find out actual value
pressColor.setAlpha(m_theme == Light ? 30 : 50);
return pressColor;
}
@@ -757,7 +1001,7 @@ QColor QQuickMaterialStyle::switchUncheckedTrackColor() const
QColor QQuickMaterialStyle::switchCheckedTrackColor() const
{
- QColor trackColor = m_theme == Light ? accentColor() : shade(accentColor(), Shade200);
+ QColor trackColor(accentColor());
trackColor.setAlphaF(0.5);
return trackColor;
}
@@ -792,13 +1036,10 @@ QColor QQuickMaterialStyle::scrollBarPressedColor() const
return QColor::fromRgba(m_theme == Light ? 0x80000000 : 0x80FFFFFF);
}
-QColor QQuickMaterialStyle::drawerBackgroundColor() const
-{
- return QColor::fromRgba(dividerTextColorLight);
-}
-
QColor QQuickMaterialStyle::dialogColor() const
{
+ if (m_hasBackground)
+ return backgroundColor();
return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark);
}
@@ -812,6 +1053,61 @@ QColor QQuickMaterialStyle::listHighlightColor() const
return QColor::fromRgba(m_theme == Light ? 0x1e000000 : 0x1effffff);
}
+QColor QQuickMaterialStyle::tooltipColor() const
+{
+ if (m_explicitBackground)
+ return backgroundColor();
+ return color(Grey, Shade700);
+}
+
+QColor QQuickMaterialStyle::toolBarColor() const
+{
+ if (m_explicitBackground)
+ return backgroundColor();
+ return primaryColor();
+}
+
+QColor QQuickMaterialStyle::toolTextColor() const
+{
+ if (m_hasForeground || m_customPrimary)
+ return primaryTextColor();
+
+ switch (m_primary) {
+ case Red:
+ case Pink:
+ case Purple:
+ case DeepPurple:
+ case Indigo:
+ case Blue:
+ case Teal:
+ case DeepOrange:
+ case Brown:
+ case BlueGrey:
+ return QColor::fromRgba(primaryTextColorDark);
+
+ case LightBlue:
+ case Cyan:
+ case Green:
+ case LightGreen:
+ case Lime:
+ case Yellow:
+ case Amber:
+ case Orange:
+ case Grey:
+ return QColor::fromRgba(primaryTextColorLight);
+
+ default:
+ break;
+ }
+
+ return primaryTextColor();
+}
+
+QColor QQuickMaterialStyle::spinBoxDisabledIconColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? spinBoxDisabledIconColorLight : spinBoxDisabledIconColorDark);
+}
+
QColor QQuickMaterialStyle::color(QQuickMaterialStyle::Color color, QQuickMaterialStyle::Shade shade) const
{
int count = sizeof(colors) / sizeof(colors[0]);
@@ -832,13 +1128,18 @@ static QColor lighterShade(const QColor &color, qreal amount)
return hsl.convertTo(color.spec());
}
-QColor darkerShade(const QColor &color, qreal amount)
+static QColor darkerShade(const QColor &color, qreal amount)
{
QColor hsl = color.toHsl();
hsl.setHslF(hsl.hueF(), hsl.saturationF(), qBound<qreal>(0.0, hsl.lightnessF() - amount, 1.0), color.alphaF());
return hsl.convertTo(color.spec());
}
+QQuickMaterialStyle::Shade QQuickMaterialStyle::themeShade() const
+{
+ return m_theme == Light ? Shade500 : Shade200;
+}
+
/*
* The following lightness values originate from the Material Design Color Generator project.
*
@@ -864,6 +1165,8 @@ QColor darkerShade(const QColor &color, qreal amount)
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
+
+// Returns the same color, if shade == themeShade()
QColor QQuickMaterialStyle::shade(const QColor &color, Shade shade) const
{
switch (shade) {
@@ -901,13 +1204,15 @@ QColor QQuickMaterialStyle::shade(const QColor &color, Shade shade) const
}
}
-void QQuickMaterialStyle::parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent)
+void QQuickMaterialStyle::parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent)
{
Q_UNUSED(oldParent);
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(newParent);
if (material) {
inheritPrimary(material->m_primary, material->m_customPrimary);
inheritAccent(material->m_accent, material->m_customAccent);
+ inheritForeground(material->m_foreground, material->m_customForeground, material->m_hasForeground);
+ inheritBackground(material->m_background, material->m_customBackground, material->m_hasBackground);
inheritTheme(material->theme());
}
}
@@ -919,54 +1224,123 @@ static Enum toEnumValue(const QByteArray &value, bool *ok)
return static_cast<Enum>(enumeration.keyToValue(value, ok));
}
+static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer<QSettings> &settings, const QString &name)
+{
+ QByteArray value = qgetenv(env);
+ if (value.isNull() && !settings.isNull())
+ value = settings->value(name).toByteArray();
+ return value;
+}
+
void QQuickMaterialStyle::init()
{
- static bool defaultsInitialized = false;
- if (!defaultsInitialized) {
- QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Material"));
- if (!settings.isNull()) {
- bool ok = false;
- QByteArray value = settings->value(QStringLiteral("Theme")).toByteArray();
- Theme theme = toEnumValue<Theme>(value, &ok);
- if (ok)
- defaultTheme = m_theme = theme;
- else if (!value.isEmpty())
- qWarning().nospace().noquote() << settings->fileName() << ": unknown Material theme value: " << value;
-
- value = settings->value(QStringLiteral("Primary")).toByteArray();
- Color primary = toEnumValue<Color>(value, &ok);
- if (ok) {
- defaultPrimaryCustom = m_customPrimary = false;
- defaultPrimary = m_primary = primary;
+ static bool globalsInitialized = false;
+ if (!globalsInitialized) {
+ QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Material"));
+
+ bool ok = false;
+ QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme"));
+ Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
+ if (ok)
+ globalTheme = m_theme = themeEnum;
+ else if (!themeValue.isEmpty())
+ qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue;
+
+ QByteArray primaryValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_PRIMARY", settings, QStringLiteral("Primary"));
+ Color primaryEnum = toEnumValue<Color>(primaryValue, &ok);
+ if (ok) {
+ globalPrimaryCustom = m_customPrimary = false;
+ globalPrimary = m_primary = primaryEnum;
+ } else {
+ QColor color(primaryValue.constData());
+ if (color.isValid()) {
+ globalPrimaryCustom = m_customPrimary = true;
+ globalPrimary = m_primary = color.rgba();
+ } else if (!primaryValue.isEmpty()) {
+ qWarning().nospace().noquote() << "Material: unknown primary value: " << primaryValue;
+ }
+ }
+
+ QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_ACCENT", settings, QStringLiteral("Accent"));
+ Color accentEnum = toEnumValue<Color>(accentValue, &ok);
+ if (ok) {
+ globalAccentCustom = m_customAccent = false;
+ globalAccent = m_accent = accentEnum;
+ } else if (!accentValue.isEmpty()) {
+ QColor color(accentValue.constData());
+ if (color.isValid()) {
+ globalAccentCustom = m_customAccent = true;
+ globalAccent = m_accent = color.rgba();
} else {
- QColor color(value.constData());
- if (color.isValid()) {
- defaultPrimaryCustom = m_customPrimary = true;
- defaultPrimary = m_primary = color.rgba();
- } else if (!value.isEmpty()) {
- qWarning().nospace().noquote() << settings->fileName() << ": unknown Material primary value: " << value;
- }
+ qWarning().nospace().noquote() << "Material: unknown accent value: " << accentValue;
}
+ }
+
+ QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_FOREGROUND", settings, QStringLiteral("Foreground"));
+ Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok);
+ if (ok) {
+ globalForegroundCustom = m_customForeground = false;
+ globalForeground = m_foreground = foregroundEnum;
+ hasGlobalForeground = m_hasForeground = true;
+ } else if (!foregroundValue.isEmpty()) {
+ QColor color(foregroundValue.constData());
+ if (color.isValid()) {
+ globalForegroundCustom = m_customForeground = true;
+ globalForeground = m_foreground = color.rgba();
+ hasGlobalForeground = m_hasForeground = true;
+ } else {
+ qWarning().nospace().noquote() << "Material: unknown foreground value: " << foregroundValue;
+ }
+ }
- value = settings->value(QStringLiteral("Accent")).toByteArray();
- Color accent = toEnumValue<Color>(value, &ok);
- if (ok) {
- defaultAccentCustom = m_customAccent = false;
- defaultAccent = m_accent = accent;
+ QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_BACKGROUND", settings, QStringLiteral("Background"));
+ Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok);
+ if (ok) {
+ globalBackgroundCustom = m_customBackground = false;
+ globalBackground = m_background = backgroundEnum;
+ hasGlobalBackground = m_hasBackground = true;
+ } else if (!backgroundValue.isEmpty()) {
+ QColor color(backgroundValue.constData());
+ if (color.isValid()) {
+ globalBackgroundCustom = m_customBackground = true;
+ globalBackground = m_background = color.rgba();
+ hasGlobalBackground = m_hasBackground = true;
} else {
- QColor color(value.constData());
- if (color.isValid()) {
- defaultAccentCustom = m_customAccent = true;
- defaultAccent = m_accent = color.rgba();
- } else if (!value.isEmpty()) {
- qWarning().nospace().noquote() << settings->fileName() << ": unknown Material accent value: " << value;
- }
+ qWarning().nospace().noquote() << "Material: unknown background value: " << backgroundValue;
}
}
- defaultsInitialized = true;
+
+ globalsInitialized = true;
}
- QQuickStyle::init(); // TODO: lazy init?
+ QQuickStyleAttached::init(); // TODO: lazy init?
+}
+
+bool QQuickMaterialStyle::variantToRgba(const QVariant &var, const char *name, QRgb *rgba, bool *custom) const
+{
+ *custom = false;
+ if (var.type() == QVariant::Int) {
+ int val = var.toInt();
+ if (val > BlueGrey) {
+ qmlInfo(parent()) << "unknown Material." << name << " value: " << val;
+ return false;
+ }
+ *rgba = val;
+ } else {
+ int val = QMetaEnum::fromType<Color>().keyToValue(var.toByteArray());
+ if (val != -1) {
+ *rgba = val;
+ } else {
+ QColor color(var.toString());
+ if (!color.isValid()) {
+ qmlInfo(parent()) << "unknown Material." << name << " value: " << var.toString();
+ return false;
+ }
+ *custom = true;
+ *rgba = color.rgba();
+ }
+ }
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index f92bfe9d..af5638f1 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -49,38 +49,44 @@
//
#include <QtGui/qcolor.h>
-#include <QtLabsControls/private/qquickstyle_p.h>
+#include <QtQuickControls2/private/qquickstyleattached_p.h>
QT_BEGIN_NAMESPACE
-class QQuickMaterialStylePrivate;
-
-class QQuickMaterialStyle : public QQuickStyle
+class QQuickMaterialStyle : public QQuickStyleAttached
{
Q_OBJECT
Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL)
Q_PROPERTY(QVariant primary READ primary WRITE setPrimary RESET resetPrimary NOTIFY primaryChanged FINAL)
Q_PROPERTY(QVariant accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL)
+ Q_PROPERTY(QVariant foreground READ foreground WRITE setForeground RESET resetForeground NOTIFY foregroundChanged FINAL)
+ Q_PROPERTY(QVariant background READ background WRITE setBackground RESET resetBackground NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(int elevation READ elevation WRITE setElevation RESET resetElevation NOTIFY elevationChanged FINAL)
+
+
Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryChanged FINAL) // TODO: remove?
Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL) // TODO: remove?
- Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY foregroundChanged FINAL) // TODO: rename to foregroundColor()?
Q_PROPERTY(QColor primaryHighlightedTextColor READ primaryHighlightedTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor secondaryTextColor READ secondaryTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor hintTextColor READ hintTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor textSelectionColor READ textSelectionColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dropShadowColor READ dropShadowColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dividerColor READ dividerColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedButtonColor READ raisedButtonColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedButtonHoverColor READ raisedButtonHoverColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedButtonPressColor READ raisedButtonPressColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedButtonDisabledColor READ raisedButtonDisabledColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedHighlightedButtonColor READ raisedHighlightedButtonColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedHighlightedButtonHoverColor READ raisedHighlightedButtonHoverColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedHighlightedButtonPressColor READ raisedHighlightedButtonPressColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor raisedHighlightedButtonDisabledColor READ raisedHighlightedButtonDisabledColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor flatButtonPressColor READ flatButtonPressColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor flatButtonFocusColor READ flatButtonFocusColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor iconColor READ iconColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor iconDisabledColor READ iconDisabledColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor buttonPressColor READ buttonPressColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor buttonDisabledColor READ buttonDisabledColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor highlightedButtonColor READ highlightedButtonColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor highlightedButtonHoverColor READ highlightedButtonHoverColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor highlightedButtonPressColor READ highlightedButtonPressColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor swipeDelegateColor READ swipeDelegateColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor swipeDelegateHoverColor READ swipeDelegateHoverColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor swipeDelegatePressColor READ swipeDelegatePressColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor swipeDelegateDisabledColor READ swipeDelegateDisabledColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor frameColor READ frameColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor checkBoxUncheckedRippleColor READ checkBoxUncheckedRippleColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor checkBoxCheckedRippleColor READ checkBoxCheckedRippleColor NOTIFY paletteChanged FINAL)
@@ -92,10 +98,13 @@ class QQuickMaterialStyle : public QQuickStyle
Q_PROPERTY(QColor switchDisabledHandleColor READ switchDisabledHandleColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY paletteChanged FINAL)
- Q_PROPERTY(QColor drawerBackgroundColor READ drawerBackgroundColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor listHighlightColor READ listHighlightColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor tooltipColor READ tooltipColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor toolBarColor READ toolBarColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL)
public:
enum Theme {
@@ -146,7 +155,7 @@ public:
Q_ENUM(Color)
Q_ENUM(Shade)
- explicit QQuickMaterialStyle(QObject *parent = Q_NULLPTR);
+ explicit QQuickMaterialStyle(QObject *parent = nullptr);
static QQuickMaterialStyle *qmlAttachedProperties(QObject *object);
@@ -168,6 +177,22 @@ public:
void propagateAccent();
void resetAccent();
+ QVariant foreground() const;
+ void setForeground(const QVariant &foreground);
+ void inheritForeground(uint foreground, bool custom, bool has);
+ void propagateForeground();
+ void resetForeground();
+
+ QVariant background() const;
+ void setBackground(const QVariant &background);
+ void inheritBackground(uint background, bool custom, bool has);
+ void propagateBackground();
+ void resetBackground();
+
+ int elevation() const;
+ void setElevation(int elevation);
+ void resetElevation();
+
QColor primaryColor() const;
QColor accentColor() const;
QColor backgroundColor() const;
@@ -178,16 +203,20 @@ public:
QColor textSelectionColor() const;
QColor dropShadowColor() const;
QColor dividerColor() const;
- QColor raisedButtonColor() const;
- QColor raisedButtonHoverColor() const;
- QColor raisedButtonPressColor() const;
- QColor raisedButtonDisabledColor() const;
- QColor raisedHighlightedButtonColor() const;
- QColor raisedHighlightedButtonHoverColor() const;
- QColor raisedHighlightedButtonPressColor() const;
- QColor raisedHighlightedButtonDisabledColor() const;
- QColor flatButtonPressColor() const;
- QColor flatButtonFocusColor() const;
+ QColor iconColor() const;
+ QColor iconDisabledColor() const;
+ QColor buttonColor() const;
+ QColor buttonHoverColor() const;
+ QColor buttonPressColor() const;
+ QColor buttonDisabledColor() const;
+ QColor highlightedButtonColor() const;
+ QColor highlightedButtonHoverColor() const;
+ QColor highlightedButtonPressColor() const;
+ QColor highlightedButtonDisabledColor() const;
+ QColor swipeDelegateColor() const;
+ QColor swipeDelegateHoverColor() const;
+ QColor swipeDelegatePressColor() const;
+ QColor swipeDelegateDisabledColor() const;
QColor frameColor() const;
QColor checkBoxUncheckedRippleColor() const;
QColor checkBoxCheckedRippleColor() const;
@@ -199,10 +228,13 @@ public:
QColor switchDisabledHandleColor() const;
QColor scrollBarColor() const;
QColor scrollBarPressedColor() const;
- QColor drawerBackgroundColor() const;
QColor dialogColor() const;
QColor backgroundDimColor() const;
QColor listHighlightColor() const;
+ QColor tooltipColor() const;
+ QColor toolBarColor() const;
+ QColor toolTextColor() const;
+ QColor spinBoxDisabledIconColor() const;
Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const;
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const;
@@ -211,22 +243,51 @@ Q_SIGNALS:
void themeChanged();
void primaryChanged();
void accentChanged();
+ void foregroundChanged();
+ void backgroundChanged();
+ void elevationChanged();
+
void paletteChanged();
protected:
- void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) Q_DECL_OVERRIDE;
+ void parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent) override;
private:
void init();
+ bool variantToRgba(const QVariant &var, const char *name, QRgb *rgba, bool *custom) const;
+
+ QColor backgroundColor(Shade shade) const;
+ QColor accentColor(Shade shade) const;
+ QColor buttonColor(bool highlighted, bool pressed, bool hover) const;
+ Shade themeShade() const;
+ // These reflect whether a color value was explicitly set on the specific
+ // item that this attached style object represents.
bool m_explicitTheme;
bool m_explicitPrimary;
bool m_explicitAccent;
+ bool m_explicitForeground;
+ bool m_explicitBackground;
+ // These reflect whether the color value that was either inherited or
+ // explicitly set is in the form that QColor expects, rather than one of
+ // our pre-defined color enum values.
bool m_customPrimary;
bool m_customAccent;
+ bool m_customForeground;
+ bool m_customBackground;
+ // These will be true when this item has an explicit or inherited foreground/background
+ // color, or these colors were declared globally via settings (e.g. conf or env vars).
+ // Some color properties of the style will return different values depending on whether
+ // or not these are set.
+ bool m_hasForeground;
+ bool m_hasBackground;
+ // The actual values for this item, whether explicit, inherited or globally set.
Theme m_theme;
uint m_primary;
uint m_accent;
+ uint m_foreground;
+ uint m_background;
+ int m_elevation;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index 5c89d382..1967a74b 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -37,6 +37,7 @@
#include "qquickmaterialtheme_p.h"
#include <QtGui/qfont.h>
+#include <QtGui/qfontinfo.h>
QT_BEGIN_NAMESPACE
@@ -44,15 +45,22 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
QFont font;
- font.setFamily(QStringLiteral("Roboto"));
- if (!font.exactMatch())
- font.setFamily(QStringLiteral("Noto"));
+ font.setFamily(QLatin1String("Roboto"));
+ QString family = QFontInfo(font).family();
- if (font.exactMatch()) {
- systemFont.setFamily(font.family());
- buttonFont.setFamily(font.family());
- itemViewFont.setFamily(font.family());
- menuItemFont.setFamily(font.family());
+ if (family != QLatin1String("Roboto")) {
+ font.setFamily(QLatin1String("Noto"));
+ family = QFontInfo(font).family();
+ }
+
+ if (family == QLatin1String("Roboto") || family == QLatin1String("Noto")) {
+ systemFont.setFamily(family);
+ buttonFont.setFamily(family);
+ toolTipFont.setFamily(family);
+ itemViewFont.setFamily(family);
+ listViewFont.setFamily(family);
+ menuItemFont.setFamily(family);
+ editorFont.setFamily(family);
}
systemFont.setPixelSize(14);
@@ -61,14 +69,17 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
buttonFont.setCapitalization(QFont::AllUppercase);
buttonFont.setWeight(QFont::Medium);
+ toolTipFont.setPixelSize(14);
+ toolTipFont.setWeight(QFont::Medium);
+
itemViewFont.setPixelSize(14);
itemViewFont.setWeight(QFont::Medium);
+ listViewFont.setPixelSize(16);
+
menuItemFont.setPixelSize(16);
-}
-QQuickMaterialTheme::~QQuickMaterialTheme()
-{
+ editorFont.setPixelSize(16);
}
const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
@@ -78,11 +89,17 @@ const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
case QPlatformTheme::PushButtonFont:
case QPlatformTheme::ToolButtonFont:
return &buttonFont;
+ case QPlatformTheme::TipLabelFont:
+ return &toolTipFont;
case QPlatformTheme::ItemViewFont:
return &itemViewFont;
+ case QPlatformTheme::ListViewFont:
+ return &listViewFont;
case QPlatformTheme::MenuItemFont:
case QPlatformTheme::ComboMenuItemFont:
return &menuItemFont;
+ case QPlatformTheme::EditorFont:
+ return &editorFont;
default:
return &systemFont;
}
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index 28008a14..9bd62fc1 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKMATERIALTHEME_H
-#define QQUICKMATERIALTHEME_H
+#ifndef QQUICKMATERIALTHEME_P_H
+#define QQUICKMATERIALTHEME_P_H
//
// W A R N I N G
@@ -48,28 +48,28 @@
// We mean it.
//
-#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/qfont.h>
-#include <QtLabsControls/private/qquickproxytheme_p.h>
+#include <QtQuickControls2/private/qquickproxytheme_p.h>
QT_BEGIN_NAMESPACE
class QQuickMaterialTheme : public QQuickProxyTheme
{
public:
- QQuickMaterialTheme(QPlatformTheme *theme);
+ explicit QQuickMaterialTheme(QPlatformTheme *theme = nullptr);
- ~QQuickMaterialTheme();
-
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type = SystemFont) const override;
private:
QFont systemFont;
QFont buttonFont;
+ QFont toolTipFont;
QFont itemViewFont;
+ QFont listViewFont;
QFont menuItemFont;
+ QFont editorFont;
};
QT_END_NAMESPACE
-#endif // QQUICKMATERIALTHEME_H
+#endif // QQUICKMATERIALTHEME_P_H
diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
deleted file mode 100644
index 6dd9e563..00000000
--- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/qqmlextensionplugin.h>
-
-#include "qquickmaterialstyle_p.h"
-#include "qquickmaterialtheme_p.h"
-#include "qquickmaterialprogressring_p.h"
-#include "qquickmaterialprogressstrip_p.h"
-
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtLabsControls/private/qquickstyleselector_p.h>
-
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtlabsmaterialstyleplugin);
-}
-
-QT_BEGIN_NAMESPACE
-
-class QtLabsMaterialStylePlugin : public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- ~QtLabsMaterialStylePlugin();
- void registerTypes(const char *uri) Q_DECL_OVERRIDE;
- void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE;
-
-private:
- QQuickProxyTheme *theme;
-};
-
-QtLabsMaterialStylePlugin::~QtLabsMaterialStylePlugin()
-{
- if (theme) {
- QPlatformTheme *old = theme->theme();
- QGuiApplicationPrivate::platform_theme = old;
- delete theme;
- }
-}
-
-void QtLabsMaterialStylePlugin::registerTypes(const char *uri)
-{
- qmlRegisterUncreatableType<QQuickMaterialStyle>(uri, 1, 0, "Material", tr("Material is an attached property"));
-}
-
-void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
-{
- Q_UNUSED(engine);
- Q_UNUSED(uri);
-
- QQuickStyleSelector selector;
- if (selector.style() == QLatin1String("material")) {
- QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
- if (old) {
- QQuickProxyTheme *theme = new QQuickMaterialTheme(old);
- QGuiApplicationPrivate::platform_theme = theme;
- }
- }
-
- 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");
-}
-
-QT_END_NAMESPACE
-
-#include "qtlabsmaterialstyleplugin.moc"
diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc b/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc
deleted file mode 100644
index 8398d505..00000000
--- a/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc
+++ /dev/null
@@ -1,12 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/imports/Qt/labs/controls/material">
- <file>images/check.png</file>
- <file>images/check@2x.png</file>
- <file>images/check@3x.png</file>
- <file>images/check@4x.png</file>
- <file>images/drop-indicator.png</file>
- <file>images/drop-indicator@2x.png</file>
- <file>images/drop-indicator@3x.png</file>
- <file>images/drop-indicator@4x.png</file>
- </qresource>
-</RCC>
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
new file mode 100644
index 00000000..ac11e95b
--- /dev/null
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQuickControls2/private/qquickstyleplugin_p.h>
+
+#include "qquickmaterialstyle_p.h"
+#include "qquickmaterialtheme_p.h"
+#include "qquickmaterialprogressring_p.h"
+#include "qquickmaterialprogressstrip_p.h"
+
+#include <QtQuickControls2/private/qquickstyleselector_p.h>
+#include <QtQuickControls2/private/qquickpaddedrectangle_p.h>
+
+static inline void initResources()
+{
+ Q_INIT_RESOURCE(qtquickcontrols2materialstyleplugin);
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Controls_2_Material);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickControls2MaterialStylePlugin : public QQuickStylePlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtQuickControls2MaterialStylePlugin(QObject *parent = nullptr);
+
+ void registerTypes(const char *uri) override;
+ void initializeEngine(QQmlEngine *engine, const char *uri) override;
+
+ QString name() const override;
+ QQuickProxyTheme *createTheme() const override;
+};
+
+QtQuickControls2MaterialStylePlugin::QtQuickControls2MaterialStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
+{
+ initResources();
+}
+
+void QtQuickControls2MaterialStylePlugin::registerTypes(const char *uri)
+{
+ qmlRegisterUncreatableType<QQuickMaterialStyle>(uri, 2, 0, "Material", tr("Material is an attached property"));
+}
+
+void QtQuickControls2MaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ QQuickStylePlugin::initializeEngine(engine, uri);
+
+ QByteArray import = QByteArray(uri) + ".impl";
+ qmlRegisterType<QQuickPaddedRectangle>(import, 2, 0, "PaddedRectangle");
+ qmlRegisterType<QQuickMaterialProgressRing>(import, 2, 0, "ProgressRing");
+ qmlRegisterType<QQuickMaterialProgressStrip>(import, 2, 0, "ProgressStrip");
+ qmlRegisterType<QQuickMaterialRingAnimator>(import, 2, 0, "RingAnimator");
+ qmlRegisterType<QQuickMaterialStripAnimator>(import, 2, 0, "StripAnimator");
+ qmlRegisterType(typeUrl(QStringLiteral("BoxShadow.qml")), import, 2, 0, "BoxShadow");
+ qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
+ qmlRegisterType(typeUrl(QStringLiteral("ElevationEffect.qml")), import, 2, 0, "ElevationEffect");
+ qmlRegisterType(typeUrl(QStringLiteral("Ripple.qml")), import, 2, 0, "Ripple");
+ qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle");
+ qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
+}
+
+QString QtQuickControls2MaterialStylePlugin::name() const
+{
+ return QStringLiteral("material");
+}
+
+QQuickProxyTheme *QtQuickControls2MaterialStylePlugin::createTheme() const
+{
+ return new QQuickMaterialTheme;
+}
+
+QT_END_NAMESPACE
+
+#include "qtquickcontrols2materialstyleplugin.moc"
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
new file mode 100644
index 00000000..47257ce4
--- /dev/null
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
@@ -0,0 +1,12 @@
+<RCC>
+ <qresource prefix="/qt-project.org/imports/QtQuick/Controls.2/Material">
+ <file>images/check.png</file>
+ <file>images/check@2x.png</file>
+ <file>images/check@3x.png</file>
+ <file>images/check@4x.png</file>
+ <file>images/drop-indicator.png</file>
+ <file>images/drop-indicator@2x.png</file>
+ <file>images/drop-indicator@3x.png</file>
+ <file>images/drop-indicator@4x.png</file>
+ </qresource>
+</RCC>
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes
index 029597cb..e661056c 100644
--- a/src/imports/controls/plugins.qmltypes
+++ b/src/imports/controls/plugins.qmltypes
@@ -4,126 +4,522 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.controls 1.0'
+// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.0 -merge ..\templates\plugins.qmltypes -dependencies dep.json'
Module {
- dependencies: [
- "Qt.labs.templates 1.0",
- "QtGraphicalEffects 1.0",
- "QtGraphicalEffects.private 1.0",
- "QtQuick 2.6",
- "QtQuick.Window 2.2"
- ]
+ dependencies: ["QtQuick.Templates 2.0", "QtQuick.Window 2.2", "QtQuick 2.7"]
Component {
- name: "QQuickAbstractButton"
- defaultProperty: "data"
- prototype: "QQuickControl"
- exports: ["Qt.labs.templates/AbstractButton 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "text"; type: "string" }
- Property { name: "pressed"; type: "bool" }
- Property { name: "checked"; type: "bool" }
- Property { name: "checkable"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
- 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" }
- Signal { name: "clicked" }
- Signal { name: "pressAndHold" }
- Signal { name: "doubleClicked" }
- Method { name: "toggle" }
- }
- //
- // Manually added to work around QtC limitations:
- //
- Component {
- name: "QQuickWindowQmlImpl"
- defaultProperty: "data"
- prototype: "QQuickWindow"
- exports: ["QtQuick.Window/Window 2.1", "QtQuick.Window/Window 2.2"]
- exportMetaObjectRevisions: [0, 1]
- attachedType: "QQuickWindowAttached"
- Property { name: "visible"; type: "bool" }
- Property { name: "visibility"; type: "Visibility" }
+ name: "QQuickAbstractAnimation"
+ prototype: "QObject"
+ Enum {
+ name: "Loops"
+ values: {
+ "Infinite": -2
+ }
+ }
+ Property { name: "running"; type: "bool" }
+ Property { name: "paused"; type: "bool" }
+ Property { name: "alwaysRunToEnd"; type: "bool" }
+ Property { name: "loops"; type: "int" }
+ Signal { name: "started" }
+ Signal { name: "stopped" }
Signal {
- name: "visibleChanged"
- Parameter { name: "arg"; type: "bool" }
+ name: "runningChanged"
+ Parameter { type: "bool" }
}
Signal {
- name: "visibilityChanged"
- Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ name: "pausedChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "alwaysRunToEndChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "loopCountChanged"
+ Parameter { type: "int" }
}
+ Method { name: "restart" }
+ Method { name: "start" }
+ Method { name: "pause" }
+ Method { name: "resume" }
+ Method { name: "stop" }
+ Method { name: "complete" }
}
Component {
- name: "QQuickWindow"
- defaultProperty: "data"
- prototype: "QWindow"
+ name: "QQuickAnimator"
+ prototype: "QQuickAbstractAnimation"
exports: [
- "QtQuick.Window/Window 2.0",
- "QtQuick.Window/Window 2.1",
- "QtQuick.Window/Window 2.2"
+ "QtQuick.Controls.impl/BusyRingAnimator 2.0",
+ "QtQuick.Controls.impl/ProgressStripAnimator 2.0"
]
- exportMetaObjectRevisions: [0, 1, 2]
- Enum {
- name: "SceneGraphError"
- values: {
- "ContextNotAvailable": 1
- }
- }
- Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "color"; type: "QColor" }
- Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property {
- name: "activeFocusItem"
- revision: 1
- type: "QQuickItem"
- isReadonly: true
- isPointer: true
+ exportMetaObjectRevisions: [0, 0]
+ Property { name: "target"; type: "QQuickItem"; isPointer: true }
+ Property { name: "easing"; type: "QEasingCurve" }
+ Property { name: "duration"; type: "int" }
+ Property { name: "to"; type: "double" }
+ Property { name: "from"; type: "double" }
+ Signal {
+ name: "targetItemChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
}
- Signal { name: "frameSwapped" }
Signal {
- name: "openglContextCreated"
- revision: 2
- Parameter { name: "context"; type: "QOpenGLContext"; isPointer: true }
+ name: "durationChanged"
+ Parameter { name: "duration"; type: "int" }
}
- Signal { name: "sceneGraphInitialized" }
- Signal { name: "sceneGraphInvalidated" }
- Signal { name: "beforeSynchronizing" }
- Signal { name: "afterSynchronizing"; revision: 2 }
- Signal { name: "beforeRendering" }
- Signal { name: "afterRendering" }
- Signal { name: "afterAnimating"; revision: 2 }
- Signal { name: "sceneGraphAboutToStop"; revision: 2 }
Signal {
- name: "closing"
- revision: 1
- Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ name: "easingChanged"
+ Parameter { name: "curve"; type: "QEasingCurve" }
}
Signal {
- name: "colorChanged"
- Parameter { type: "QColor" }
+ name: "toChanged"
+ Parameter { name: "to"; type: "double" }
}
- Signal { name: "activeFocusItemChanged"; revision: 1 }
Signal {
- name: "sceneGraphError"
- revision: 2
- Parameter { name: "error"; type: "QQuickWindow::SceneGraphError" }
- Parameter { name: "message"; type: "string" }
+ name: "fromChanged"
+ Parameter { name: "from"; type: "double" }
}
- Method { name: "update" }
- Method { name: "releaseResources" }
+ }
+ Component {
+ name: "QQuickBusyIndicatorRing"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.impl/BusyRing 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickButtonGroup"
+ prototype: "QObject"
+ exports: ["QtQuick.Controls/ButtonGroup 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickButtonGroupAttached"
+ Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true }
+ Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true }
+ Method {
+ name: "addButton"
+ Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true }
+ }
+ Method {
+ name: "removeButton"
+ Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickButtonGroupAttached"
+ prototype: "QObject"
+ Property { name: "group"; type: "QQuickButtonGroup"; isPointer: true }
+ }
+ Component {
+ name: "QQuickDialRing"
+ defaultProperty: "data"
+ prototype: "QQuickPaintedItem"
+ exports: ["QtQuick.Controls.impl/DialRing 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "progress"; type: "double" }
+ Property { name: "color"; type: "QColor" }
+ }
+ Component {
+ name: "QQuickPaintedItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Enum {
+ name: "RenderTarget"
+ values: {
+ "Image": 0,
+ "FramebufferObject": 1,
+ "InvertedYFramebufferObject": 2
+ }
+ }
+ Property { name: "contentsSize"; type: "QSize" }
+ Property { name: "fillColor"; type: "QColor" }
+ Property { name: "contentsScale"; type: "double" }
+ Property { name: "renderTarget"; type: "RenderTarget" }
+ Property { name: "textureSize"; type: "QSize" }
+ }
+ Component {
+ name: "QQuickProgressStrip"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.impl/ProgressStrip 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "indeterminate"; type: "bool" }
+ Property { name: "progress"; type: "double" }
+ }
+ Component {
+ prototype: "QQuickApplicationWindow"
+ name: "QtQuick.Controls/ApplicationWindow 2.0"
+ exports: ["QtQuick.Controls/ApplicationWindow 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickBusyIndicator"
+ name: "QtQuick.Controls/BusyIndicator 2.0"
+ exports: ["QtQuick.Controls/BusyIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickButton"
+ name: "QtQuick.Controls/Button 2.0"
+ exports: ["QtQuick.Controls/Button 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickCheckBox"
+ name: "QtQuick.Controls/CheckBox 2.0"
+ exports: ["QtQuick.Controls/CheckBox 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickCheckDelegate"
+ name: "QtQuick.Controls/CheckDelegate 2.0"
+ exports: ["QtQuick.Controls/CheckDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls.impl/CheckIndicator 2.0"
+ exports: ["QtQuick.Controls.impl/CheckIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "control"; type: "QQuickItem"; isPointer: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "gradient"; type: "QQuickGradient"; isPointer: true }
+ Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
+ Property { name: "radius"; type: "double" }
+ }
+ Component {
+ prototype: "QQuickComboBox"
+ name: "QtQuick.Controls/ComboBox 2.0"
+ exports: ["QtQuick.Controls/ComboBox 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickDial"
+ name: "QtQuick.Controls/Dial 2.0"
+ exports: ["QtQuick.Controls/Dial 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickDrawer"
+ name: "QtQuick.Controls/Drawer 2.0"
+ exports: ["QtQuick.Controls/Drawer 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickFrame"
+ name: "QtQuick.Controls/Frame 2.0"
+ exports: ["QtQuick.Controls/Frame 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickGroupBox"
+ name: "QtQuick.Controls/GroupBox 2.0"
+ exports: ["QtQuick.Controls/GroupBox 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickItemDelegate"
+ name: "QtQuick.Controls/ItemDelegate 2.0"
+ exports: ["QtQuick.Controls/ItemDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickLabel"
+ name: "QtQuick.Controls/Label 2.0"
+ exports: ["QtQuick.Controls/Label 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickMenu"
+ name: "QtQuick.Controls/Menu 2.0"
+ exports: ["QtQuick.Controls/Menu 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickMenuItem"
+ name: "QtQuick.Controls/MenuItem 2.0"
+ exports: ["QtQuick.Controls/MenuItem 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickPage"
+ name: "QtQuick.Controls/Page 2.0"
+ exports: ["QtQuick.Controls/Page 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickPageIndicator"
+ name: "QtQuick.Controls/PageIndicator 2.0"
+ exports: ["QtQuick.Controls/PageIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickPane"
+ name: "QtQuick.Controls/Pane 2.0"
+ exports: ["QtQuick.Controls/Pane 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickPopup"
+ name: "QtQuick.Controls/Popup 2.0"
+ exports: ["QtQuick.Controls/Popup 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickProgressBar"
+ name: "QtQuick.Controls/ProgressBar 2.0"
+ exports: ["QtQuick.Controls/ProgressBar 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickRadioButton"
+ name: "QtQuick.Controls/RadioButton 2.0"
+ exports: ["QtQuick.Controls/RadioButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickRadioDelegate"
+ name: "QtQuick.Controls/RadioDelegate 2.0"
+ exports: ["QtQuick.Controls/RadioDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls.impl/RadioIndicator 2.0"
+ exports: ["QtQuick.Controls.impl/RadioIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "control"; type: "QQuickItem"; isPointer: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "gradient"; type: "QQuickGradient"; isPointer: true }
+ Property { name: "border"; type: "QQuickPen"; isReadonly: true; isPointer: true }
+ Property { name: "radius"; type: "double" }
+ }
+ Component {
+ prototype: "QQuickRangeSlider"
+ name: "QtQuick.Controls/RangeSlider 2.0"
+ exports: ["QtQuick.Controls/RangeSlider 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickScrollBar"
+ name: "QtQuick.Controls/ScrollBar 2.0"
+ exports: ["QtQuick.Controls/ScrollBar 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickScrollIndicator"
+ name: "QtQuick.Controls/ScrollIndicator 2.0"
+ exports: ["QtQuick.Controls/ScrollIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickSlider"
+ name: "QtQuick.Controls/Slider 2.0"
+ exports: ["QtQuick.Controls/Slider 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickSpinBox"
+ name: "QtQuick.Controls/SpinBox 2.0"
+ exports: ["QtQuick.Controls/SpinBox 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickStackView"
+ name: "QtQuick.Controls/StackView 2.0"
+ exports: ["QtQuick.Controls/StackView 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickSwipeDelegate"
+ name: "QtQuick.Controls/SwipeDelegate 2.0"
+ exports: ["QtQuick.Controls/SwipeDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickSwipeView"
+ name: "QtQuick.Controls/SwipeView 2.0"
+ exports: ["QtQuick.Controls/SwipeView 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickSwitch"
+ name: "QtQuick.Controls/Switch 2.0"
+ exports: ["QtQuick.Controls/Switch 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickSwitchDelegate"
+ name: "QtQuick.Controls/SwitchDelegate 2.0"
+ exports: ["QtQuick.Controls/SwitchDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickItem"
+ name: "QtQuick.Controls.impl/SwitchIndicator 2.0"
+ exports: ["QtQuick.Controls.impl/SwitchIndicator 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ Property { name: "control"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickTabBar"
+ name: "QtQuick.Controls/TabBar 2.0"
+ exports: ["QtQuick.Controls/TabBar 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickTabButton"
+ name: "QtQuick.Controls/TabButton 2.0"
+ exports: ["QtQuick.Controls/TabButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickTextArea"
+ name: "QtQuick.Controls/TextArea 2.0"
+ exports: ["QtQuick.Controls/TextArea 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickTextField"
+ name: "QtQuick.Controls/TextField 2.0"
+ exports: ["QtQuick.Controls/TextField 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickToolBar"
+ name: "QtQuick.Controls/ToolBar 2.0"
+ exports: ["QtQuick.Controls/ToolBar 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickToolButton"
+ name: "QtQuick.Controls/ToolButton 2.0"
+ exports: ["QtQuick.Controls/ToolButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ prototype: "QQuickToolTip"
+ name: "QtQuick.Controls/ToolTip 2.0"
+ exports: ["QtQuick.Controls/ToolTip 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickTumbler"
+ name: "QtQuick.Controls/Tumbler 2.0"
+ exports: ["QtQuick.Controls/Tumbler 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
+ name: "QQuickAbstractButton"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/AbstractButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "down"; type: "bool" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "autoExclusive"; type: "bool" }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ Signal { name: "pressed" }
+ Signal { name: "released" }
+ Signal { name: "canceled" }
+ Signal { name: "clicked" }
+ Signal { name: "pressAndHold" }
+ Signal { name: "doubleClicked" }
+ Method { name: "toggle" }
}
Component {
name: "QQuickApplicationWindow"
defaultProperty: "data"
prototype: "QQuickWindowQmlImpl"
- exports: ["Qt.labs.templates/ApplicationWindow 1.0"]
+ exports: ["QtQuick.Templates/ApplicationWindow 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickApplicationWindowAttached"
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "activeFocusControl"; type: "QQuickItem"; isReadonly: true; isPointer: true }
@@ -134,165 +530,6 @@ Module {
Property { name: "locale"; type: "QLocale" }
}
Component {
- name: "QWindow"
- prototype: "QObject"
- Enum {
- name: "Visibility"
- values: {
- "Hidden": 0,
- "AutomaticVisibility": 1,
- "Windowed": 2,
- "Minimized": 3,
- "Maximized": 4,
- "FullScreen": 5
- }
- }
- Property { name: "title"; type: "string" }
- Property { name: "modality"; type: "Qt::WindowModality" }
- Property { name: "flags"; type: "Qt::WindowFlags" }
- Property { name: "x"; type: "int" }
- Property { name: "y"; type: "int" }
- Property { name: "width"; type: "int" }
- Property { name: "height"; type: "int" }
- Property { name: "minimumWidth"; type: "int" }
- Property { name: "minimumHeight"; type: "int" }
- Property { name: "maximumWidth"; type: "int" }
- Property { name: "maximumHeight"; type: "int" }
- Property { name: "visible"; type: "bool" }
- Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
- Property { name: "visibility"; revision: 1; type: "Visibility" }
- Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
- Property { name: "opacity"; revision: 1; type: "double" }
- Signal {
- name: "screenChanged"
- Parameter { name: "screen"; type: "QScreen"; isPointer: true }
- }
- Signal {
- name: "modalityChanged"
- Parameter { name: "modality"; type: "Qt::WindowModality" }
- }
- Signal {
- name: "windowStateChanged"
- Parameter { name: "windowState"; type: "Qt::WindowState" }
- }
- Signal {
- name: "windowTitleChanged"
- revision: 2
- Parameter { name: "title"; type: "string" }
- }
- Signal {
- name: "xChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "yChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "widthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "heightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "minimumWidthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "minimumHeightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "maximumWidthChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "maximumHeightChanged"
- Parameter { name: "arg"; type: "int" }
- }
- Signal {
- name: "visibleChanged"
- Parameter { name: "arg"; type: "bool" }
- }
- Signal {
- name: "visibilityChanged"
- revision: 1
- Parameter { name: "visibility"; type: "QWindow::Visibility" }
- }
- Signal { name: "activeChanged"; revision: 1 }
- Signal {
- name: "contentOrientationChanged"
- Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
- }
- Signal {
- name: "focusObjectChanged"
- Parameter { name: "object"; type: "QObject"; isPointer: true }
- }
- Signal {
- name: "opacityChanged"
- revision: 1
- Parameter { name: "opacity"; type: "double" }
- }
- Method { name: "requestActivate"; revision: 1 }
- Method {
- name: "setVisible"
- Parameter { name: "visible"; type: "bool" }
- }
- Method { name: "show" }
- Method { name: "hide" }
- Method { name: "showMinimized" }
- Method { name: "showMaximized" }
- Method { name: "showFullScreen" }
- Method { name: "showNormal" }
- Method { name: "close"; type: "bool" }
- Method { name: "raise" }
- Method { name: "lower" }
- Method {
- name: "setTitle"
- Parameter { type: "string" }
- }
- Method {
- name: "setX"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setY"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setWidth"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "arg"; type: "int" }
- }
- Method {
- name: "setMinimumWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setMinimumHeight"
- Parameter { name: "h"; type: "int" }
- }
- Method {
- name: "setMaximumWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setMaximumHeight"
- Parameter { name: "h"; type: "int" }
- }
- Method {
- name: "alert"
- revision: 1
- Parameter { name: "msec"; type: "int" }
- }
- Method { name: "requestUpdate"; revision: 3 }
- }
- Component {
name: "QQuickApplicationWindowAttached"
prototype: "QObject"
Property { name: "window"; type: "QQuickApplicationWindow"; isReadonly: true; isPointer: true }
@@ -306,7 +543,7 @@ Module {
name: "QQuickBusyIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/BusyIndicator 1.0"]
+ exports: ["QtQuick.Templates/BusyIndicator 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "running"; type: "bool" }
}
@@ -314,14 +551,27 @@ Module {
name: "QQuickButton"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/Button 1.0"]
+ exports: ["QtQuick.Templates/Button 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "autoRepeat"; type: "bool" }
+ Property { name: "highlighted"; type: "bool" }
+ Property { name: "flat"; type: "bool" }
}
Component {
name: "QQuickCheckBox"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/CheckBox 1.0"]
+ exports: ["QtQuick.Templates/CheckBox 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "tristate"; type: "bool" }
+ Property { name: "checkState"; type: "Qt::CheckState" }
+ }
+ Component {
+ name: "QQuickCheckDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/CheckDelegate 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "tristate"; type: "bool" }
Property { name: "checkState"; type: "Qt::CheckState" }
@@ -330,7 +580,7 @@ Module {
name: "QQuickComboBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ComboBox 1.0"]
+ exports: ["QtQuick.Templates/ComboBox 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
@@ -342,6 +592,7 @@ Module {
Property { name: "displayText"; type: "string" }
Property { name: "textRole"; type: "string" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
Signal {
name: "activated"
@@ -351,6 +602,8 @@ Module {
name: "highlighted"
Parameter { name: "index"; type: "int" }
}
+ Method { name: "incrementCurrentIndex" }
+ Method { name: "decrementCurrentIndex" }
Method {
name: "textAt"
type: "string"
@@ -372,7 +625,7 @@ Module {
name: "QQuickContainer"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Container 1.0"]
+ exports: ["QtQuick.Templates/Container 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
@@ -412,7 +665,7 @@ Module {
name: "QQuickControl"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["Qt.labs.templates/Control 1.0"]
+ exports: ["QtQuick.Templates/Control 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "font"; type: "QFont" }
Property { name: "availableWidth"; type: "double"; isReadonly: true }
@@ -425,7 +678,12 @@ Module {
Property { name: "spacing"; type: "double" }
Property { name: "locale"; type: "QLocale" }
Property { name: "mirrored"; type: "bool"; isReadonly: true }
+ Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Property { name: "visualFocus"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; type: "bool" }
+ Property { name: "wheelEnabled"; type: "bool" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
}
@@ -433,7 +691,7 @@ Module {
name: "QQuickDial"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Dial 1.0"]
+ exports: ["QtQuick.Templates/Dial 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "SnapMode"
@@ -450,6 +708,7 @@ Module {
Property { name: "angle"; type: "double"; isReadonly: true }
Property { name: "stepSize"; type: "double" }
Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "wrap"; type: "bool" }
Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Method { name: "increase" }
@@ -457,31 +716,26 @@ Module {
}
Component {
name: "QQuickDrawer"
- defaultProperty: "contentItem"
- prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Drawer 1.0"]
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["QtQuick.Templates/Drawer 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "edge"; type: "Qt::Edge" }
Property { name: "position"; type: "double" }
- Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
- Property { name: "animation"; type: "QQuickPropertyAnimation"; isPointer: true }
- Signal { name: "clicked" }
- Method { name: "open" }
- Method { name: "close" }
+ Property { name: "dragMargin"; type: "double" }
}
Component {
name: "QQuickFrame"
defaultProperty: "contentData"
prototype: "QQuickPane"
- exports: ["Qt.labs.templates/Frame 1.0"]
+ exports: ["QtQuick.Templates/Frame 2.0"]
exportMetaObjectRevisions: [0]
- Property { name: "frame"; type: "QQuickItem"; isPointer: true }
}
Component {
name: "QQuickGroupBox"
defaultProperty: "contentData"
prototype: "QQuickFrame"
- exports: ["Qt.labs.templates/GroupBox 1.0"]
+ exports: ["QtQuick.Templates/GroupBox 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "title"; type: "string" }
Property { name: "label"; type: "QQuickItem"; isPointer: true }
@@ -499,14 +753,15 @@ Module {
name: "QQuickItemDelegate"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/ItemDelegate 1.0"]
+ exports: ["QtQuick.Templates/ItemDelegate 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "highlighted"; type: "bool" }
}
Component {
name: "QQuickLabel"
defaultProperty: "data"
prototype: "QQuickText"
- exports: ["Qt.labs.templates/Label 1.0"]
+ exports: ["QtQuick.Templates/Label 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "font"; type: "QFont" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
@@ -515,7 +770,7 @@ Module {
name: "QQuickMenu"
defaultProperty: "contentData"
prototype: "QQuickPopup"
- exports: ["Qt.labs.templates/Menu 1.0"]
+ exports: ["QtQuick.Templates/Menu 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
@@ -548,15 +803,18 @@ Module {
name: "QQuickMenuItem"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/MenuItem 1.0"]
+ exports: ["QtQuick.Templates/MenuItem 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "highlighted"; type: "bool" }
Signal { name: "triggered" }
}
Component {
name: "QQuickOverlay"
defaultProperty: "data"
prototype: "QQuickItem"
- Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Property { name: "modal"; type: "QQuickItem"; isPointer: true }
+ Property { name: "modeless"; type: "QQuickItem"; isPointer: true }
Signal { name: "pressed" }
Signal { name: "released" }
}
@@ -564,8 +822,9 @@ Module {
name: "QQuickPage"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Page 1.0"]
+ exports: ["QtQuick.Templates/Page 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
@@ -575,7 +834,7 @@ Module {
name: "QQuickPageIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/PageIndicator 1.0"]
+ exports: ["QtQuick.Templates/PageIndicator 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "count"; type: "int" }
Property { name: "currentIndex"; type: "int" }
@@ -586,7 +845,7 @@ Module {
name: "QQuickPane"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Pane 1.0"]
+ exports: ["QtQuick.Templates/Pane 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "contentWidth"; type: "double" }
Property { name: "contentHeight"; type: "double" }
@@ -597,17 +856,17 @@ Module {
name: "QQuickPopup"
defaultProperty: "contentData"
prototype: "QObject"
- exports: ["Qt.labs.templates/Popup 1.0"]
+ exports: ["QtQuick.Templates/Popup 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "ClosePolicy"
values: {
"NoAutoClose": 0,
- "OnPressOutside": 1,
- "OnPressOutsideParent": 2,
- "OnReleaseOutside": 4,
- "OnReleaseOutsideParent": 8,
- "OnEscape": 16
+ "CloseOnPressOutside": 1,
+ "CloseOnPressOutsideParent": 2,
+ "CloseOnReleaseOutside": 4,
+ "CloseOnReleaseOutsideParent": 8,
+ "CloseOnEscape": 16
}
}
Enum {
@@ -645,6 +904,8 @@ Module {
Property { name: "leftPadding"; type: "double" }
Property { name: "rightPadding"; type: "double" }
Property { name: "bottomPadding"; type: "double" }
+ Property { name: "locale"; type: "QLocale" }
+ Property { name: "font"; type: "QFont" }
Property { name: "parent"; type: "QQuickItem"; isPointer: true }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
@@ -654,6 +915,7 @@ Module {
Property { name: "focus"; type: "bool" }
Property { name: "activeFocus"; type: "bool"; isReadonly: true }
Property { name: "modal"; type: "bool" }
+ Property { name: "dim"; type: "bool" }
Property { name: "visible"; type: "bool" }
Property { name: "opacity"; type: "double" }
Property { name: "scale"; type: "double" }
@@ -661,8 +923,14 @@ Module {
Property { name: "transformOrigin"; type: "TransformOrigin" }
Property { name: "enter"; type: "QQuickTransition"; isPointer: true }
Property { name: "exit"; type: "QQuickTransition"; isPointer: true }
+ Signal {
+ name: "windowChanged"
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
Signal { name: "aboutToShow" }
Signal { name: "aboutToHide" }
+ Signal { name: "opened" }
+ Signal { name: "closed" }
Method { name: "open" }
Method { name: "close" }
}
@@ -670,7 +938,7 @@ Module {
name: "QQuickProgressBar"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ProgressBar 1.0"]
+ exports: ["QtQuick.Templates/ProgressBar 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "from"; type: "double" }
Property { name: "to"; type: "double" }
@@ -678,20 +946,26 @@ Module {
Property { name: "position"; type: "double"; isReadonly: true }
Property { name: "visualPosition"; type: "double"; isReadonly: true }
Property { name: "indeterminate"; type: "bool" }
- Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
}
Component {
name: "QQuickRadioButton"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/RadioButton 1.0"]
+ exports: ["QtQuick.Templates/RadioButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickRadioDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/RadioDelegate 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickRangeSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/RangeSlider 1.0"]
+ exports: ["QtQuick.Templates/RangeSlider 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "SnapMode"
@@ -708,7 +982,6 @@ Module {
Property { name: "stepSize"; type: "double" }
Property { name: "snapMode"; type: "SnapMode" }
Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "track"; type: "QQuickItem"; isPointer: true }
Method {
name: "setValues"
Parameter { name: "firstValue"; type: "double" }
@@ -727,18 +1000,33 @@ Module {
Method { name: "decrease" }
}
Component {
+ name: "QQuickRootItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Method {
+ name: "setWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ }
+ Component {
name: "QQuickScrollBar"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ScrollBar 1.0"]
+ exports: ["QtQuick.Templates/ScrollBar 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickScrollBarAttached"
Property { name: "size"; type: "double" }
Property { name: "position"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
Property { name: "active"; type: "bool" }
Property { name: "pressed"; type: "bool" }
Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "handle"; type: "QQuickItem"; isPointer: true }
+ Method { name: "increase" }
+ Method { name: "decrease" }
Method {
name: "setSize"
Parameter { name: "size"; type: "double" }
@@ -758,14 +1046,13 @@ Module {
name: "QQuickScrollIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ScrollIndicator 1.0"]
+ exports: ["QtQuick.Templates/ScrollIndicator 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickScrollIndicatorAttached"
Property { name: "size"; type: "double" }
Property { name: "position"; type: "double" }
Property { name: "active"; type: "bool" }
Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Method {
name: "setSize"
Parameter { name: "size"; type: "double" }
@@ -785,7 +1072,7 @@ Module {
name: "QQuickSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Slider 1.0"]
+ exports: ["QtQuick.Templates/Slider 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "SnapMode"
@@ -805,7 +1092,6 @@ Module {
Property { name: "pressed"; type: "bool" }
Property { name: "orientation"; type: "Qt::Orientation" }
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
- Property { name: "track"; type: "QQuickItem"; isPointer: true }
Method { name: "increase" }
Method { name: "decrease" }
}
@@ -813,12 +1099,13 @@ Module {
name: "QQuickSpinBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/SpinBox 1.0"]
+ exports: ["QtQuick.Templates/SpinBox 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "from"; type: "int" }
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
Property { name: "stepSize"; type: "int" }
+ Property { name: "editable"; type: "bool" }
Property { name: "validator"; type: "QValidator"; isPointer: true }
Property { name: "textFromValue"; type: "QJSValue" }
Property { name: "valueFromText"; type: "QJSValue" }
@@ -844,7 +1131,7 @@ Module {
name: "QQuickStackView"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/StackView 1.0"]
+ exports: ["QtQuick.Templates/StackView 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickStackAttached"
Enum {
@@ -917,10 +1204,30 @@ Module {
}
}
Component {
+ name: "QQuickSwipe"
+ prototype: "QObject"
+ Property { name: "position"; type: "double"; isReadonly: true }
+ Property { name: "complete"; type: "bool"; isReadonly: true }
+ Property { name: "left"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "behind"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "right"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "leftItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "behindItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "rightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickSwipeDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/SwipeDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "swipe"; type: "QQuickSwipe"; isReadonly: true; isPointer: true }
+ }
+ Component {
name: "QQuickSwipeView"
defaultProperty: "contentData"
prototype: "QQuickContainer"
- exports: ["Qt.labs.templates/SwipeView 1.0"]
+ exports: ["QtQuick.Templates/SwipeView 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickSwipeViewAttached"
}
@@ -935,7 +1242,16 @@ Module {
name: "QQuickSwitch"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/Switch 1.0"]
+ exports: ["QtQuick.Templates/Switch 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "position"; type: "double" }
+ Property { name: "visualPosition"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickSwitchDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/SwitchDelegate 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "position"; type: "double" }
Property { name: "visualPosition"; type: "double"; isReadonly: true }
@@ -944,14 +1260,22 @@ Module {
name: "QQuickTabBar"
defaultProperty: "contentData"
prototype: "QQuickContainer"
- exports: ["Qt.labs.templates/TabBar 1.0"]
+ exports: ["QtQuick.Templates/TabBar 2.0"]
exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Position"
+ values: {
+ "Header": 0,
+ "Footer": 1
+ }
+ }
+ Property { name: "position"; type: "Position" }
}
Component {
name: "QQuickTabButton"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/TabButton 1.0"]
+ exports: ["QtQuick.Templates/TabButton 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
@@ -1086,23 +1410,23 @@ Module {
}
Signal {
name: "styleChanged"
- Parameter { name: "style"; type: "TextStyle" }
+ Parameter { name: "style"; type: "QQuickText::TextStyle" }
}
Signal {
name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "HAlignment" }
+ Parameter { name: "alignment"; type: "QQuickText::HAlignment" }
}
Signal {
name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "VAlignment" }
+ Parameter { name: "alignment"; type: "QQuickText::VAlignment" }
}
Signal {
name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "TextFormat" }
+ Parameter { name: "textFormat"; type: "QQuickText::TextFormat" }
}
Signal {
name: "elideModeChanged"
- Parameter { name: "mode"; type: "TextElideMode" }
+ Parameter { name: "mode"; type: "QQuickText::TextElideMode" }
}
Signal { name: "contentSizeChanged" }
Signal {
@@ -1135,20 +1459,28 @@ Module {
name: "QQuickTextArea"
defaultProperty: "data"
prototype: "QQuickTextEdit"
- exports: ["Qt.labs.templates/TextArea 1.0"]
+ exports: ["QtQuick.Templates/TextArea 2.0"]
exportMetaObjectRevisions: [0]
+ attachedType: "QQuickTextAreaAttached"
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
Property { name: "implicitHeight"; type: "double" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Signal { name: "implicitWidthChanged3" }
+ Signal { name: "implicitHeightChanged3" }
Signal {
name: "pressAndHold"
Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
}
Component {
+ name: "QQuickTextAreaAttached"
+ prototype: "QObject"
+ Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true }
+ }
+ Component {
name: "QQuickTextEdit"
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
@@ -1251,6 +1583,8 @@ Module {
Property { name: "leftPadding"; revision: 6; type: "double" }
Property { name: "rightPadding"; revision: 6; type: "double" }
Property { name: "bottomPadding"; revision: 6; type: "double" }
+ Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
+ Signal { name: "preeditTextChanged"; revision: 7 }
Signal { name: "contentSizeChanged" }
Signal {
name: "colorChanged"
@@ -1362,6 +1696,7 @@ Module {
revision: 2
Parameter { name: "text"; type: "string" }
}
+ Method { name: "clear"; revision: 7 }
Method {
name: "inputMethodQuery"
revision: 4
@@ -1413,7 +1748,7 @@ Module {
name: "QQuickTextField"
defaultProperty: "data"
prototype: "QQuickTextInput"
- exports: ["Qt.labs.templates/TextField 1.0"]
+ exports: ["QtQuick.Templates/TextField 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
@@ -1421,6 +1756,8 @@ Module {
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Signal { name: "implicitWidthChanged3" }
+ Signal { name: "implicitHeightChanged3" }
Signal {
name: "pressAndHold"
Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
@@ -1514,6 +1851,7 @@ Module {
Property { name: "passwordCharacter"; type: "string" }
Property { name: "passwordMaskDelay"; revision: 3; type: "int" }
Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
Property { name: "autoScroll"; type: "bool" }
Property { name: "selectByMouse"; type: "bool" }
Property { name: "mouseSelectionMode"; type: "SelectionMode" }
@@ -1538,11 +1876,11 @@ Module {
}
Signal {
name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "HAlignment" }
+ Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" }
}
Signal {
name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "VAlignment" }
+ Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" }
}
Signal {
name: "readOnlyChanged"
@@ -1562,13 +1900,14 @@ Module {
}
Signal {
name: "echoModeChanged"
- Parameter { name: "echoMode"; type: "EchoMode" }
+ Parameter { name: "echoMode"; type: "QQuickTextInput::EchoMode" }
}
Signal {
name: "passwordMaskDelayChanged"
revision: 3
Parameter { name: "delay"; type: "int" }
}
+ Signal { name: "preeditTextChanged"; revision: 7 }
Signal {
name: "activeFocusOnPressChanged"
Parameter { name: "activeFocusOnPress"; type: "bool" }
@@ -1583,7 +1922,7 @@ Module {
}
Signal {
name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "SelectionMode" }
+ Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" }
}
Signal { name: "contentSizeChanged" }
Signal { name: "paddingChanged"; revision: 6 }
@@ -1625,6 +1964,7 @@ Module {
revision: 3
Parameter { name: "position"; type: "int" }
}
+ Method { name: "clear"; revision: 7 }
Method {
name: "positionAt"
Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
@@ -1661,21 +2001,61 @@ Module {
name: "QQuickToolBar"
defaultProperty: "contentData"
prototype: "QQuickFrame"
- exports: ["Qt.labs.templates/ToolBar 1.0"]
+ exports: ["QtQuick.Templates/ToolBar 2.0"]
exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Position"
+ values: {
+ "Header": 0,
+ "Footer": 1
+ }
+ }
+ Property { name: "position"; type: "Position" }
}
Component {
name: "QQuickToolButton"
defaultProperty: "data"
prototype: "QQuickButton"
- exports: ["Qt.labs.templates/ToolButton 1.0"]
+ exports: ["QtQuick.Templates/ToolButton 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
+ name: "QQuickToolTip"
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["QtQuick.Templates/ToolTip 2.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickToolTipAttached"
+ Property { name: "delay"; type: "int" }
+ Property { name: "timeout"; type: "int" }
+ Property { name: "text"; type: "string" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
+ name: "QQuickToolTipAttached"
+ prototype: "QObject"
+ Property { name: "text"; type: "string" }
+ Property { name: "delay"; type: "int" }
+ Property { name: "timeout"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "toolTip"; type: "QQuickToolTip"; isReadonly: true; isPointer: true }
+ Method {
+ name: "show"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "ms"; type: "int" }
+ }
+ Method {
+ name: "show"
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hide" }
+ }
+ Component {
name: "QQuickTumbler"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Tumbler 1.0"]
+ exports: ["QtQuick.Templates/Tumbler 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickTumblerAttached"
Property { name: "model"; type: "QVariant" }
@@ -1691,314 +2071,240 @@ Module {
Property { name: "tumbler"; type: "QQuickTumbler"; isReadonly: true; isPointer: true }
Property { name: "displacement"; type: "double"; isReadonly: true }
}
+
+ Component {
+ name: "QQuickWindowQmlImpl"
+ defaultProperty: "data"
+ prototype: "QQuickWindow"
+ exports: ["QtQuick.Window/Window 2.1", "QtQuick.Window/Window 2.2"]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickWindowAttached"
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibility"; type: "Visibility" }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ }
+
Component {
- name: "QQuickBusyIndicatorRing"
+ name: "QQuickWindow"
defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["Qt.labs.controls.impl/BusyRing 1.0"]
+ prototype: "QWindow"
+ exports: ["QtQuick.Window/Window 2.0"]
exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SceneGraphError"
+ values: {
+ "ContextNotAvailable": 1
+ }
+ }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property {
+ name: "activeFocusItem"
+ revision: 1
+ type: "QQuickItem"
+ isReadonly: true
+ isPointer: true
+ }
+ Signal { name: "frameSwapped" }
+ Signal {
+ name: "openglContextCreated"
+ revision: 2
+ Parameter { name: "context"; type: "QOpenGLContext"; isPointer: true }
+ }
+ Signal { name: "sceneGraphInitialized" }
+ Signal { name: "sceneGraphInvalidated" }
+ Signal { name: "beforeSynchronizing" }
+ Signal { name: "afterSynchronizing"; revision: 2 }
+ Signal { name: "beforeRendering" }
+ Signal { name: "afterRendering" }
+ Signal { name: "afterAnimating"; revision: 2 }
+ Signal { name: "sceneGraphAboutToStop"; revision: 2 }
+ Signal {
+ name: "closing"
+ revision: 1
+ Parameter { name: "close"; type: "QQuickCloseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "colorChanged"
+ Parameter { type: "QColor" }
+ }
+ Signal { name: "activeFocusItemChanged"; revision: 1 }
+ Signal {
+ name: "sceneGraphError"
+ revision: 2
+ Parameter { name: "error"; type: "QQuickWindow::SceneGraphError" }
+ Parameter { name: "message"; type: "string" }
+ }
+ Method { name: "update" }
+ Method { name: "releaseResources" }
}
+
Component {
- name: "QQuickButtonGroup"
+ name: "QWindow"
prototype: "QObject"
- exports: ["Qt.labs.controls/ButtonGroup 1.0"]
- exportMetaObjectRevisions: [0]
- attachedType: "QQuickButtonGroupAttached"
- Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true }
- Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true }
+ Enum {
+ name: "Visibility"
+ values: {
+ "Hidden": 0,
+ "AutomaticVisibility": 1,
+ "Windowed": 2,
+ "Minimized": 3,
+ "Maximized": 4,
+ "FullScreen": 5
+ }
+ }
+ Property { name: "title"; type: "string" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "x"; type: "int" }
+ Property { name: "y"; type: "int" }
+ Property { name: "width"; type: "int" }
+ Property { name: "height"; type: "int" }
+ Property { name: "minimumWidth"; type: "int" }
+ Property { name: "minimumHeight"; type: "int" }
+ Property { name: "maximumWidth"; type: "int" }
+ Property { name: "maximumHeight"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "active"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "visibility"; revision: 1; type: "Visibility" }
+ Property { name: "contentOrientation"; type: "Qt::ScreenOrientation" }
+ Property { name: "opacity"; revision: 1; type: "double" }
+ Signal {
+ name: "screenChanged"
+ Parameter { name: "screen"; type: "QScreen"; isPointer: true }
+ }
+ Signal {
+ name: "modalityChanged"
+ Parameter { name: "modality"; type: "Qt::WindowModality" }
+ }
+ Signal {
+ name: "windowStateChanged"
+ Parameter { name: "windowState"; type: "Qt::WindowState" }
+ }
+ Signal {
+ name: "windowTitleChanged"
+ revision: 2
+ Parameter { name: "title"; type: "string" }
+ }
+ Signal {
+ name: "xChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "yChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "widthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "heightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "minimumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumWidthChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "maximumHeightChanged"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Signal {
+ name: "visibleChanged"
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Signal {
+ name: "visibilityChanged"
+ revision: 1
+ Parameter { name: "visibility"; type: "QWindow::Visibility" }
+ }
+ Signal { name: "activeChanged"; revision: 1 }
+ Signal {
+ name: "contentOrientationChanged"
+ Parameter { name: "orientation"; type: "Qt::ScreenOrientation" }
+ }
+ Signal {
+ name: "focusObjectChanged"
+ Parameter { name: "object"; type: "QObject"; isPointer: true }
+ }
+ Signal {
+ name: "opacityChanged"
+ revision: 1
+ Parameter { name: "opacity"; type: "double" }
+ }
+ Method { name: "requestActivate"; revision: 1 }
Method {
- name: "addButton"
- Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true }
+ name: "setVisible"
+ Parameter { name: "visible"; type: "bool" }
}
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method { name: "showMinimized" }
+ Method { name: "showMaximized" }
+ Method { name: "showFullScreen" }
+ Method { name: "showNormal" }
+ Method { name: "close"; type: "bool" }
+ Method { name: "raise" }
+ Method { name: "lower" }
Method {
- name: "removeButton"
- Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true }
+ name: "setTitle"
+ Parameter { type: "string" }
}
+ Method {
+ name: "setX"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setY"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setWidth"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "arg"; type: "int" }
+ }
+ Method {
+ name: "setMinimumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMinimumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "setMaximumWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setMaximumHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ Method {
+ name: "alert"
+ revision: 1
+ Parameter { name: "msec"; type: "int" }
+ }
+ Method { name: "requestUpdate"; revision: 3 }
}
- Component {
- name: "QQuickButtonGroupAttached"
- prototype: "QObject"
- Property { name: "group"; type: "QQuickButtonGroup"; isPointer: true }
- }
- Component {
- name: "QQuickProgressStrip"
- defaultProperty: "data"
- prototype: "QQuickItem"
- exports: ["Qt.labs.controls.impl/ProgressStrip 1.0"]
- exportMetaObjectRevisions: [0]
- Property { name: "indeterminate"; type: "bool" }
- Property { name: "progress"; type: "double" }
- }
- Component {
- prototype: "QQuickApplicationWindow"
- name: "Qt.labs.controls/ApplicationWindow 1.0"
- exports: ["Qt.labs.controls/ApplicationWindow 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickBusyIndicator"
- name: "Qt.labs.controls/BusyIndicator 1.0"
- exports: ["Qt.labs.controls/BusyIndicator 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickButton"
- name: "Qt.labs.controls/Button 1.0"
- exports: ["Qt.labs.controls/Button 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickCheckBox"
- name: "Qt.labs.controls/CheckBox 1.0"
- exports: ["Qt.labs.controls/CheckBox 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickComboBox"
- name: "Qt.labs.controls/ComboBox 1.0"
- exports: ["Qt.labs.controls/ComboBox 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickDial"
- name: "Qt.labs.controls/Dial 1.0"
- exports: ["Qt.labs.controls/Dial 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickDrawer"
- name: "Qt.labs.controls/Drawer 1.0"
- exports: ["Qt.labs.controls/Drawer 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentItem"
- }
- Component {
- prototype: "QQuickFrame"
- name: "Qt.labs.controls/Frame 1.0"
- exports: ["Qt.labs.controls/Frame 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickGroupBox"
- name: "Qt.labs.controls/GroupBox 1.0"
- exports: ["Qt.labs.controls/GroupBox 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickItemDelegate"
- name: "Qt.labs.controls/ItemDelegate 1.0"
- exports: ["Qt.labs.controls/ItemDelegate 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickLabel"
- name: "Qt.labs.controls/Label 1.0"
- exports: ["Qt.labs.controls/Label 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickMenu"
- name: "Qt.labs.controls/Menu 1.0"
- exports: ["Qt.labs.controls/Menu 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickMenuItem"
- name: "Qt.labs.controls/MenuItem 1.0"
- exports: ["Qt.labs.controls/MenuItem 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickPage"
- name: "Qt.labs.controls/Page 1.0"
- exports: ["Qt.labs.controls/Page 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickPageIndicator"
- name: "Qt.labs.controls/PageIndicator 1.0"
- exports: ["Qt.labs.controls/PageIndicator 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickFrame"
- name: "Qt.labs.controls/Pane 1.0"
- exports: ["Qt.labs.controls/Pane 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickPopup"
- name: "Qt.labs.controls/Popup 1.0"
- exports: ["Qt.labs.controls/Popup 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickProgressBar"
- name: "Qt.labs.controls/ProgressBar 1.0"
- exports: ["Qt.labs.controls/ProgressBar 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickRadioButton"
- name: "Qt.labs.controls/RadioButton 1.0"
- exports: ["Qt.labs.controls/RadioButton 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickRangeSlider"
- name: "Qt.labs.controls/RangeSlider 1.0"
- exports: ["Qt.labs.controls/RangeSlider 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickScrollBar"
- name: "Qt.labs.controls/ScrollBar 1.0"
- exports: ["Qt.labs.controls/ScrollBar 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickScrollIndicator"
- name: "Qt.labs.controls/ScrollIndicator 1.0"
- exports: ["Qt.labs.controls/ScrollIndicator 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickSlider"
- name: "Qt.labs.controls/Slider 1.0"
- exports: ["Qt.labs.controls/Slider 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickSpinBox"
- name: "Qt.labs.controls/SpinBox 1.0"
- exports: ["Qt.labs.controls/SpinBox 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickStackView"
- name: "Qt.labs.controls/StackView 1.0"
- exports: ["Qt.labs.controls/StackView 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickSwipeView"
- name: "Qt.labs.controls/SwipeView 1.0"
- exports: ["Qt.labs.controls/SwipeView 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickSwitch"
- name: "Qt.labs.controls/Switch 1.0"
- exports: ["Qt.labs.controls/Switch 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickTabBar"
- name: "Qt.labs.controls/TabBar 1.0"
- exports: ["Qt.labs.controls/TabBar 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickTabButton"
- name: "Qt.labs.controls/TabButton 1.0"
- exports: ["Qt.labs.controls/TabButton 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickTextArea"
- name: "Qt.labs.controls/TextArea 1.0"
- exports: ["Qt.labs.controls/TextArea 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickTextField"
- name: "Qt.labs.controls/TextField 1.0"
- exports: ["Qt.labs.controls/TextField 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickToolBar"
- name: "Qt.labs.controls/ToolBar 1.0"
- exports: ["Qt.labs.controls/ToolBar 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "contentData"
- }
- Component {
- prototype: "QQuickToolButton"
- name: "Qt.labs.controls/ToolButton 1.0"
- exports: ["Qt.labs.controls/ToolButton 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
- Component {
- prototype: "QQuickTumbler"
- name: "Qt.labs.controls/Tumbler 1.0"
- exports: ["Qt.labs.controls/Tumbler 1.0"]
- exportMetaObjectRevisions: [0]
- isComposite: true
- defaultProperty: "data"
- }
+
}
diff --git a/src/imports/controls/qmldir b/src/imports/controls/qmldir
index 98c57fe1..50f786d7 100644
--- a/src/imports/controls/qmldir
+++ b/src/imports/controls/qmldir
@@ -1,5 +1,5 @@
-module Qt.labs.controls
-plugin qtlabscontrolsplugin
-classname QtLabsControlsPlugin
-depends Qt.labs.templates 1.0
+module QtQuick.Controls
+plugin qtquickcontrols2plugin
+classname QtQuickControls2Plugin
+depends QtQuick.Templates 2.0
designersupported
diff --git a/src/imports/controls/qquickbusyindicatorring.cpp b/src/imports/controls/qquickbusyindicatorring.cpp
index 96213fa4..4f9e9977 100644
--- a/src/imports/controls/qquickbusyindicatorring.cpp
+++ b/src/imports/controls/qquickbusyindicatorring.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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..ceac0471 100644
--- a/src/imports/controls/qquickbusyindicatorring_p.h
+++ b/src/imports/controls/qquickbusyindicatorring_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKBUSYINDICATOR_P_H
-#define QQUICKBUSYINDICATOR_P_H
+#ifndef QQUICKBUSYINDICATORRING_P_H
+#define QQUICKBUSYINDICATORRING_P_H
//
// W A R N I N G
@@ -58,25 +58,25 @@ 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
QML_DECLARE_TYPE(QQuickBusyIndicatorRing)
-#endif // QQUICKBUSYINDICATOR_P_H
+#endif // QQUICKBUSYINDICATORRING_P_H
diff --git a/src/imports/controls/qquickdialring.cpp b/src/imports/controls/qquickdialring.cpp
new file mode 100644
index 00000000..664460e0
--- /dev/null
+++ b/src/imports/controls/qquickdialring.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickdialring_p.h"
+
+#include <QtCore/qmath.h>
+#include <QtGui/qpainter.h>
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickDialRing::QQuickDialRing(QQuickItem *parent) :
+ QQuickPaintedItem(parent),
+ m_progress(0),
+ m_color(Qt::black)
+{
+}
+
+qreal QQuickDialRing::progress() const
+{
+ return m_progress;
+}
+
+void QQuickDialRing::setProgress(qreal progress)
+{
+ if (progress == m_progress)
+ return;
+
+ m_progress = progress;
+ update();
+ emit progressChanged();
+}
+
+QColor QQuickDialRing::color() const
+{
+ return m_color;
+}
+
+void QQuickDialRing::setColor(const QColor &color)
+{
+ if (color == m_color)
+ return;
+
+ m_color = color;
+ update();
+ emit colorChanged();
+}
+
+void QQuickDialRing::paint(QPainter *painter)
+{
+ if (width() <= 0 || height() <= 0)
+ return;
+
+ QPen pen(m_color);
+ pen.setWidth(8);
+ pen.setCapStyle(Qt::FlatCap);
+ painter->setPen(pen);
+
+ const QRectF bounds = boundingRect();
+ const qreal smallest = qMin(bounds.width(), bounds.height());
+ QRectF rect = QRectF(pen.widthF() / 2.0 + 1, pen.widthF() / 2.0 + 1, smallest - pen.widthF() - 2, smallest - pen.widthF() - 2);
+ rect.moveCenter(bounds.center());
+
+ // Make sure the arc is aligned to whole pixels.
+ if (rect.x() - int(rect.x()) > 0)
+ rect.setX(qCeil(rect.x()));
+ if (rect.y() - int(rect.y()) > 0)
+ rect.setY(qCeil(rect.y()));
+ if (rect.width() - int(rect.width()) > 0)
+ rect.setWidth(qFloor(rect.width()));
+ if (rect.height() - int(rect.height()) > 0)
+ rect.setHeight(qFloor(rect.height()));
+
+ painter->setRenderHint(QPainter::Antialiasing);
+
+ const qreal startAngle = (140 + 90);
+ const qreal spanAngle = (m_progress * 280) * -1;
+ QPainterPath path;
+ path.arcMoveTo(rect, startAngle);
+ path.arcTo(rect, startAngle, spanAngle);
+ painter->drawPath(path);
+
+ rect.adjust(-pen.widthF() / 2.0, -pen.widthF() / 2.0, pen.widthF() / 2.0, pen.widthF() / 2.0);
+ pen.setWidth(1);
+ painter->setPen(pen);
+
+ path = QPainterPath();
+ path.arcMoveTo(rect, 0);
+ path.arcTo(rect, 0, 360);
+ painter->drawPath(path);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/qquickdialring_p.h b/src/imports/controls/qquickdialring_p.h
new file mode 100644
index 00000000..1048552b
--- /dev/null
+++ b/src/imports/controls/qquickdialring_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDIALRING_P_H
+#define QQUICKDIALRING_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qcolor.h>
+#include <QtQuick/qquickpainteditem.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDialRing : public QQuickPaintedItem
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal progress READ progress WRITE setProgress NOTIFY progressChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+
+public:
+ QQuickDialRing(QQuickItem *parent = nullptr);
+
+ qreal progress() const;
+ void setProgress(qreal progress);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ void paint(QPainter *painter) override;
+
+Q_SIGNALS:
+ void progressChanged();
+ void colorChanged();
+
+private:
+ qreal m_progress;
+ QColor m_color;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDIALRING_P_H
diff --git a/src/imports/controls/qquickprogressstrip.cpp b/src/imports/controls/qquickprogressstrip.cpp
index e9480ff1..5b50a28d 100644
--- a/src/imports/controls/qquickprogressstrip.cpp
+++ b/src/imports/controls/qquickprogressstrip.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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;
@@ -63,8 +63,6 @@ QQuickProgressStrip::QQuickProgressStrip(QQuickItem *parent) :
m_indeterminate(false)
{
setFlag(QQuickItem::ItemHasContents);
- setImplicitWidth(116);
- setImplicitHeight(6);
}
QQuickProgressStrip::~QQuickProgressStrip()
@@ -142,6 +140,7 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
}
Q_ASSERT(rootTransformNode->type() == QSGNode::TransformNodeType);
+ const qreal y = (height() - implicitHeight()) / 2;
const QColor color(0x35, 0x36, 0x37);
if (m_indeterminate) {
if (rootTransformNode->childCount() != blocks) {
@@ -167,7 +166,7 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
m.translate(blockStartX(i), 0);
transformNode->setMatrix(m);
- rectNode->setRect(QRectF(QPointF(), QSizeF(blockWidth, height())));
+ rectNode->setRect(QRectF(QPointF(0, y), QSizeF(blockWidth, implicitHeight())));
rectNode->update();
transformNode = static_cast<QSGTransformNode *>(transformNode->nextSibling());
@@ -185,7 +184,7 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
rootTransformNode->appendChildNode(rectNode);
}
- rectNode->setRect(QRectF(QPointF(), QSizeF(m_progress * width(), height())));
+ rectNode->setRect(QRectF(QPointF(0, y), QSizeF(m_progress * width(), implicitHeight())));
rectNode->update();
}
@@ -210,7 +209,7 @@ QQuickAnimatorJob *QQuickProgressAnimator::createJob() const
}
QQuickProgressAnimatorJob::QQuickProgressAnimatorJob() :
- m_node(Q_NULLPTR)
+ m_node(nullptr)
{
}
@@ -308,7 +307,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..d2e297f5 100644
--- a/src/imports/controls/qquickprogressstrip_p.h
+++ b/src/imports/controls/qquickprogressstrip_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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
deleted file mode 100644
index 16e99cd5..00000000
--- a/src/imports/controls/qtlabscontrolsplugin.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/qqmlextensionplugin.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qcoreapplication.h>
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-#include <QtLabsTemplates/private/qquickbuttongroup_p.h>
-#include <QtLabsTemplates/private/qquickcontainer_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtLabsTemplates/private/qquickpopup_p.h>
-#include <QtLabsControls/private/qquickstyleselector_p.h>
-
-#include "qquickbusyindicatorring_p.h"
-#include "qquickprogressstrip_p.h"
-
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtlabscontrolsplugin);
-}
-
-QT_BEGIN_NAMESPACE
-
-class QtLabsControlsPlugin: public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- void registerTypes(const char *uri);
- void initializeEngine(QQmlEngine *engine, const char *uri);
-};
-
-void QtLabsControlsPlugin::registerTypes(const char *uri)
-{
- qmlRegisterType<QQuickAbstractButton>(uri, 1, 0, "AbstractButton");
- qmlRegisterType<QQuickButtonGroup>(uri, 1, 0, "ButtonGroup");
- qmlRegisterType<QQuickButtonGroupAttached>();
- qmlRegisterType<QQuickContainer>(uri, 1, 0, "Container");
- qmlRegisterType<QQuickControl>(uri, 1, 0, "Control");
-
- QQuickStyleSelector selector;
- selector.setBaseUrl(baseUrl());
-
- qmlRegisterType(selector.select(QStringLiteral("/ApplicationWindow.qml")), uri, 1, 0, "ApplicationWindow");
- qmlRegisterType(selector.select(QStringLiteral("/BusyIndicator.qml")), uri, 1, 0, "BusyIndicator");
- qmlRegisterType(selector.select(QStringLiteral("/Button.qml")), uri, 1, 0, "Button");
- qmlRegisterType(selector.select(QStringLiteral("/CheckBox.qml")), uri, 1, 0, "CheckBox");
- qmlRegisterType(selector.select(QStringLiteral("/ComboBox.qml")), uri, 1, 0, "ComboBox");
- qmlRegisterType(selector.select(QStringLiteral("/Dial.qml")), uri, 1, 0, "Dial");
- qmlRegisterType(selector.select(QStringLiteral("/Drawer.qml")), uri, 1, 0, "Drawer");
- qmlRegisterType(selector.select(QStringLiteral("/Frame.qml")), uri, 1, 0, "Frame");
- qmlRegisterType(selector.select(QStringLiteral("/GroupBox.qml")), uri, 1, 0, "GroupBox");
- qmlRegisterType(selector.select(QStringLiteral("/ItemDelegate.qml")), uri, 1, 0, "ItemDelegate");
- qmlRegisterType(selector.select(QStringLiteral("/Label.qml")), uri, 1, 0, "Label");
- qmlRegisterType(selector.select(QStringLiteral("/Menu.qml")), uri, 1, 0, "Menu");
- qmlRegisterType(selector.select(QStringLiteral("/MenuItem.qml")), uri, 1, 0, "MenuItem");
- qmlRegisterType(selector.select(QStringLiteral("/Page.qml")), uri, 1, 0, "Page");
- qmlRegisterType(selector.select(QStringLiteral("/PageIndicator.qml")), uri, 1, 0, "PageIndicator");
- qmlRegisterType(selector.select(QStringLiteral("/Pane.qml")), uri, 1, 0, "Pane");
- qmlRegisterType(selector.select(QStringLiteral("/Popup.qml")), uri, 1, 0, "Popup");
- qmlRegisterType(selector.select(QStringLiteral("/ProgressBar.qml")), uri, 1, 0, "ProgressBar");
- qmlRegisterType(selector.select(QStringLiteral("/RadioButton.qml")), uri, 1, 0, "RadioButton");
- qmlRegisterType(selector.select(QStringLiteral("/RangeSlider.qml")), uri, 1, 0, "RangeSlider");
- qmlRegisterType(selector.select(QStringLiteral("/ScrollBar.qml")), uri, 1, 0, "ScrollBar");
- qmlRegisterType(selector.select(QStringLiteral("/ScrollIndicator.qml")), uri, 1, 0, "ScrollIndicator");
- qmlRegisterType(selector.select(QStringLiteral("/Slider.qml")), uri, 1, 0, "Slider");
- qmlRegisterType(selector.select(QStringLiteral("/SpinBox.qml")), uri, 1, 0, "SpinBox");
- qmlRegisterType(selector.select(QStringLiteral("/StackView.qml")), uri, 1, 0, "StackView");
- qmlRegisterType(selector.select(QStringLiteral("/SwipeView.qml")), uri, 1, 0, "SwipeView");
- qmlRegisterType(selector.select(QStringLiteral("/Switch.qml")), uri, 1, 0, "Switch");
- qmlRegisterType(selector.select(QStringLiteral("/TabBar.qml")), uri, 1, 0, "TabBar");
- qmlRegisterType(selector.select(QStringLiteral("/TabButton.qml")), uri, 1, 0, "TabButton");
- qmlRegisterType(selector.select(QStringLiteral("/TextArea.qml")), uri, 1, 0, "TextArea");
- qmlRegisterType(selector.select(QStringLiteral("/TextField.qml")), uri, 1, 0, "TextField");
- qmlRegisterType(selector.select(QStringLiteral("/ToolBar.qml")), uri, 1, 0, "ToolBar");
- qmlRegisterType(selector.select(QStringLiteral("/ToolButton.qml")), uri, 1, 0, "ToolButton");
- qmlRegisterType(selector.select(QStringLiteral("/Tumbler.qml")), uri, 1, 0, "Tumbler");
-}
-
-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");
- qmlRegisterType<QQuickBusyIndicatorAnimator>(import, 1, 0, "BusyRingAnimator");
- qmlRegisterType<QQuickProgressStrip>(import, 1, 0, "ProgressStrip");
- qmlRegisterType<QQuickProgressAnimator>(import, 1, 0, "ProgressStripAnimator");
-}
-
-QT_END_NAMESPACE
-
-#include "qtlabscontrolsplugin.moc"
diff --git a/src/imports/controls/qtlabscontrolsplugin.qrc b/src/imports/controls/qtlabscontrolsplugin.qrc
deleted file mode 100644
index 1147ae3d..00000000
--- a/src/imports/controls/qtlabscontrolsplugin.qrc
+++ /dev/null
@@ -1,16 +0,0 @@
-<RCC>
- <qresource prefix="/qt-project.org/imports/Qt/labs/controls">
- <file>images/check.png</file>
- <file>images/check@2x.png</file>
- <file>images/check@3x.png</file>
- <file>images/check@4x.png</file>
- <file>images/dial-indicator.png</file>
- <file>images/dial-indicator@2x.png</file>
- <file>images/dial-indicator@3x.png</file>
- <file>images/dial-indicator@4x.png</file>
- <file>images/drop-indicator.png</file>
- <file>images/drop-indicator@2x.png</file>
- <file>images/drop-indicator@3x.png</file>
- <file>images/drop-indicator@4x.png</file>
- </qresource>
-</RCC>
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
new file mode 100644
index 00000000..8e41a58c
--- /dev/null
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtCore/private/qfileselector_p.h>
+#include <QtQuickControls2/qquickstyle.h>
+#include <QtQuickControls2/private/qquickstyleplugin_p.h>
+#include <QtQuickControls2/private/qquickstyleselector_p.h>
+#include <QtQuickControls2/private/qquickcolorimageprovider_p.h>
+#include <QtQuickTemplates2/private/qquickbuttongroup_p.h>
+
+#include "qquickbusyindicatorring_p.h"
+#include "qquickdialring_p.h"
+#include "qquickprogressstrip_p.h"
+
+static inline void initResources()
+{
+ Q_INIT_RESOURCE(qtquickcontrols2plugin);
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Controls_2);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickControls2Plugin: public QQuickStylePlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtQuickControls2Plugin(QObject *parent = nullptr);
+ void registerTypes(const char *uri);
+ void initializeEngine(QQmlEngine *engine, const char *uri);
+};
+
+QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlugin(parent)
+{
+ initResources();
+}
+
+void QtQuickControls2Plugin::registerTypes(const char *uri)
+{
+ qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
+ qmlRegisterType<QQuickButtonGroupAttached>();
+
+ QQuickStyleSelector selector;
+ selector.setBaseUrl(typeUrl());
+
+ const QString style = QQuickStyle::name();
+ if (!style.isEmpty())
+ QFileSelectorPrivate::addStatics(QStringList() << style.toLower());
+
+ qmlRegisterType(selector.select(QStringLiteral("AbstractButton.qml")), uri, 2, 0, "AbstractButton");
+ qmlRegisterType(selector.select(QStringLiteral("ApplicationWindow.qml")), uri, 2, 0, "ApplicationWindow");
+ qmlRegisterType(selector.select(QStringLiteral("BusyIndicator.qml")), uri, 2, 0, "BusyIndicator");
+ qmlRegisterType(selector.select(QStringLiteral("Button.qml")), uri, 2, 0, "Button");
+ qmlRegisterType(selector.select(QStringLiteral("CheckBox.qml")), uri, 2, 0, "CheckBox");
+ qmlRegisterType(selector.select(QStringLiteral("CheckDelegate.qml")), uri, 2, 0, "CheckDelegate");
+ qmlRegisterType(selector.select(QStringLiteral("ComboBox.qml")), uri, 2, 0, "ComboBox");
+ qmlRegisterType(selector.select(QStringLiteral("Container.qml")), uri, 2, 0, "Container");
+ qmlRegisterType(selector.select(QStringLiteral("Control.qml")), uri, 2, 0, "Control");
+ qmlRegisterType(selector.select(QStringLiteral("Dial.qml")), uri, 2, 0, "Dial");
+ qmlRegisterType(selector.select(QStringLiteral("Drawer.qml")), uri, 2, 0, "Drawer");
+ qmlRegisterType(selector.select(QStringLiteral("Frame.qml")), uri, 2, 0, "Frame");
+ qmlRegisterType(selector.select(QStringLiteral("GroupBox.qml")), uri, 2, 0, "GroupBox");
+ qmlRegisterType(selector.select(QStringLiteral("ItemDelegate.qml")), uri, 2, 0, "ItemDelegate");
+ qmlRegisterType(selector.select(QStringLiteral("Label.qml")), uri, 2, 0, "Label");
+ qmlRegisterType(selector.select(QStringLiteral("Menu.qml")), uri, 2, 0, "Menu");
+ qmlRegisterType(selector.select(QStringLiteral("MenuItem.qml")), uri, 2, 0, "MenuItem");
+ qmlRegisterType(selector.select(QStringLiteral("Page.qml")), uri, 2, 0, "Page");
+ qmlRegisterType(selector.select(QStringLiteral("PageIndicator.qml")), uri, 2, 0, "PageIndicator");
+ qmlRegisterType(selector.select(QStringLiteral("Pane.qml")), uri, 2, 0, "Pane");
+ qmlRegisterType(selector.select(QStringLiteral("Popup.qml")), uri, 2, 0, "Popup");
+ qmlRegisterType(selector.select(QStringLiteral("ProgressBar.qml")), uri, 2, 0, "ProgressBar");
+ qmlRegisterType(selector.select(QStringLiteral("RadioButton.qml")), uri, 2, 0, "RadioButton");
+ qmlRegisterType(selector.select(QStringLiteral("RadioDelegate.qml")), uri, 2, 0, "RadioDelegate");
+ qmlRegisterType(selector.select(QStringLiteral("RangeSlider.qml")), uri, 2, 0, "RangeSlider");
+ qmlRegisterType(selector.select(QStringLiteral("ScrollBar.qml")), uri, 2, 0, "ScrollBar");
+ qmlRegisterType(selector.select(QStringLiteral("ScrollIndicator.qml")), uri, 2, 0, "ScrollIndicator");
+ qmlRegisterType(selector.select(QStringLiteral("Slider.qml")), uri, 2, 0, "Slider");
+ qmlRegisterType(selector.select(QStringLiteral("SpinBox.qml")), uri, 2, 0, "SpinBox");
+ qmlRegisterType(selector.select(QStringLiteral("StackView.qml")), uri, 2, 0, "StackView");
+ qmlRegisterType(selector.select(QStringLiteral("SwipeDelegate.qml")), uri, 2, 0, "SwipeDelegate");
+ qmlRegisterType(selector.select(QStringLiteral("SwipeView.qml")), uri, 2, 0, "SwipeView");
+ qmlRegisterType(selector.select(QStringLiteral("Switch.qml")), uri, 2, 0, "Switch");
+ qmlRegisterType(selector.select(QStringLiteral("SwitchDelegate.qml")), uri, 2, 0, "SwitchDelegate");
+ qmlRegisterType(selector.select(QStringLiteral("TabBar.qml")), uri, 2, 0, "TabBar");
+ qmlRegisterType(selector.select(QStringLiteral("TabButton.qml")), uri, 2, 0, "TabButton");
+ qmlRegisterType(selector.select(QStringLiteral("TextArea.qml")), uri, 2, 0, "TextArea");
+ qmlRegisterType(selector.select(QStringLiteral("TextField.qml")), uri, 2, 0, "TextField");
+ qmlRegisterType(selector.select(QStringLiteral("ToolBar.qml")), uri, 2, 0, "ToolBar");
+ qmlRegisterType(selector.select(QStringLiteral("ToolButton.qml")), uri, 2, 0, "ToolButton");
+ qmlRegisterType(selector.select(QStringLiteral("ToolTip.qml")), uri, 2, 0, "ToolTip");
+ qmlRegisterType(selector.select(QStringLiteral("Tumbler.qml")), uri, 2, 0, "Tumbler");
+}
+
+void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ Q_UNUSED(uri);
+
+ engine->addImageProvider(QStringLiteral("default"), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/QtQuick/Controls.2/images")));
+
+ const QByteArray import = QByteArray(uri) + ".impl";
+ qmlRegisterType<QQuickBusyIndicatorRing>(import, 2, 0, "BusyRing");
+ qmlRegisterType<QQuickBusyIndicatorAnimator>(import, 2, 0, "BusyRingAnimator");
+ qmlRegisterType<QQuickProgressStrip>(import, 2, 0, "ProgressStrip");
+ qmlRegisterType<QQuickProgressAnimator>(import, 2, 0, "ProgressStripAnimator");
+ qmlRegisterType<QQuickDialRing>(import, 2, 0, "DialRing");
+
+ qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
+ qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
+ qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
+}
+
+QT_END_NAMESPACE
+
+#include "qtquickcontrols2plugin.moc"
diff --git a/src/imports/controls/qtquickcontrols2plugin.qrc b/src/imports/controls/qtquickcontrols2plugin.qrc
new file mode 100644
index 00000000..0948a529
--- /dev/null
+++ b/src/imports/controls/qtquickcontrols2plugin.qrc
@@ -0,0 +1,20 @@
+<RCC>
+ <qresource prefix="/qt-project.org/imports/QtQuick/Controls.2">
+ <file>images/check.png</file>
+ <file>images/check@2x.png</file>
+ <file>images/check@3x.png</file>
+ <file>images/check@4x.png</file>
+ <file>images/dial-indicator.png</file>
+ <file>images/dial-indicator@2x.png</file>
+ <file>images/dial-indicator@3x.png</file>
+ <file>images/dial-indicator@4x.png</file>
+ <file>images/drop-indicator.png</file>
+ <file>images/drop-indicator@2x.png</file>
+ <file>images/drop-indicator@3x.png</file>
+ <file>images/drop-indicator@4x.png</file>
+ <file>images/double-arrow.png</file>
+ <file>images/double-arrow@2x.png</file>
+ <file>images/double-arrow@3x.png</file>
+ <file>images/double-arrow@4x.png</file>
+ </qresource>
+</RCC>
diff --git a/src/imports/controls/universal/ApplicationWindow.qml b/src/imports/controls/universal/ApplicationWindow.qml
index 3113e748..70bd403c 100644
--- a/src/imports/controls/universal/ApplicationWindow.qml
+++ b/src/imports/controls/universal/ApplicationWindow.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,16 +35,20 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
-import Qt.labs.controls.universal.impl 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls.Universal.impl 2.0
T.ApplicationWindow {
id: window
- color: Universal.altHighColor
+ color: Universal.background
- overlay.background: Rectangle {
+ overlay.modal: Rectangle {
+ color: window.Universal.baseLowColor
+ }
+
+ overlay.modeless: Rectangle {
color: window.Universal.baseLowColor
}
@@ -52,7 +56,6 @@ T.ApplicationWindow {
parent: window.activeFocusControl
width: parent ? parent.width : 0
height: parent ? parent.height : 0
- visible: parent && !!parent.useSystemFocusVisuals
- && (parent.focusReason === Qt.TabFocusReason || parent.focusReason === Qt.BacktabFocusReason)
+ visible: parent && !!parent.useSystemFocusVisuals && !!parent.visualFocus
}
}
diff --git a/src/imports/controls/universal/BusyIndicator.qml b/src/imports/controls/universal/BusyIndicator.qml
index 4a62b800..fe2186a7 100644
--- a/src/imports/controls/universal/BusyIndicator.qml
+++ b/src/imports/controls/universal/BusyIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,9 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
-import Qt.labs.controls.universal.impl 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls.Universal.impl 2.0
T.BusyIndicator {
id: control
@@ -45,7 +45,6 @@ T.BusyIndicator {
implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
- //! [contentItem]
contentItem: ProgressRing {
id: ring
@@ -62,5 +61,4 @@ T.BusyIndicator {
running: control.visible && control.running
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml
index 1dc94c89..6954d31a 100644
--- a/src/imports/controls/universal/Button.qml
+++ b/src/imports/controls/universal/Button.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,50 +35,42 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
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
- rightPadding: 8
- bottomPadding: 4
+ padding: 8
+ topPadding: padding - 4
+ bottomPadding: padding - 4
property bool useSystemFocusVisuals: true
- //! [label]
- label: Text {
- x: control.leftPadding
- y: control.topPadding
- width: control.availableWidth
- height: control.availableHeight
-
+ contentItem: Text {
text: control.text
font: control.font
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
- //! [background]
background: Rectangle {
implicitWidth: 32
implicitHeight: 32
- color: control.pressed ? control.Universal.baseMediumLowColor :
+ visible: !control.flat || control.down || control.checked || control.highlighted
+ color: control.down ? control.Universal.baseMediumLowColor :
control.enabled && (control.highlighted || control.checked) ? control.Universal.accent :
control.Universal.baseLowColor
}
- //! [background]
}
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index 37c20d00..a1c3ba6b 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,69 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls.Universal.impl 2.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
padding: 6
spacing: 8
property bool useSystemFocusVisuals: true
- //! [indicator]
- indicator: Rectangle {
- id: normalRectangle
- implicitWidth: 20
- implicitHeight: 20
+ indicator: CheckIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
-
- color: !control.enabled ? "transparent" :
- control.pressed && control.checkState !== Qt.PartiallyChecked ? control.Universal.baseMediumColor :
- control.checkState === Qt.Checked ? control.Universal.accent : "transparent"
- border.color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor :
- control.checked ? control.Universal.accent : control.Universal.baseMediumHighColor
- border.width: 2 // CheckBoxBorderThemeThickness
-
- Image {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
-
- visible: control.checkState === Qt.Checked
- source: "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.Universal.chromeWhiteColor)
- }
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: parent.width / 2
- height: parent.height / 2
-
- visible: control.checkState === Qt.PartiallyChecked
- color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
- }
+ control: control
}
- //! [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: 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
@@ -106,7 +71,7 @@ T.CheckBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
}
diff --git a/src/imports/controls/universal/CheckDelegate.qml b/src/imports/controls/universal/CheckDelegate.qml
new file mode 100644
index 00000000..c0ca272e
--- /dev/null
+++ b/src/imports/controls/universal/CheckDelegate.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+T.CheckDelegate {
+ id: control
+
+ 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
+
+ spacing: 12
+
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
+
+ indicator: CheckIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+ }
+
+ background: Rectangle {
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.visualFocus || control.highlighted
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+
+ }
+}
diff --git a/src/imports/controls/universal/CheckIndicator.qml b/src/imports/controls/universal/CheckIndicator.qml
new file mode 100644
index 00000000..eeecf264
--- /dev/null
+++ b/src/imports/controls/universal/CheckIndicator.qml
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+
+ color: !control.enabled ? "transparent" :
+ control.down && control.checkState !== Qt.PartiallyChecked ? control.Universal.baseMediumColor :
+ control.checkState === Qt.Checked ? control.Universal.accent : "transparent"
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.down ? control.Universal.baseMediumColor :
+ control.checked ? control.Universal.accent : control.Universal.baseMediumHighColor
+ border.width: 2 // CheckBoxBorderThemeThickness
+
+ property Item control
+
+ Image {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ visible: control.checkState === Qt.Checked
+ source: "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.Universal.chromeWhiteColor)
+ sourceSize.width: width
+ sourceSize.height: height
+ }
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 2
+ height: parent.height / 2
+
+ visible: control.checkState === Qt.PartiallyChecked
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ }
+}
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index 31a928a3..bb816fc1 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -36,8 +36,9 @@
import QtQuick 2.6
import QtQuick.Window 2.2
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.ComboBox {
id: control
@@ -45,37 +46,44 @@ T.ComboBox {
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 10
- topPadding: 5
- leftPadding: 12
- rightPadding: 10
- bottomPadding: 7
+ padding: 12
+ topPadding: padding - 7
+ rightPadding: padding - 2
+ bottomPadding: padding - 5
- //! [delegate]
delegate: ItemDelegate {
- width: control.width
+ width: control.popup.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
highlighted: control.highlightedIndex === index
- pressed: highlighted && control.pressed
}
- //! [delegate]
- //! [contentItem]
+ indicator: Image {
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+ source: "image://universal/downarrow/" + (!control.enabled ? control.Universal.baseLowColor : control.Universal.baseMediumHighColor)
+ sourceSize.width: width
+ sourceSize.height: height
+ }
+
contentItem: Text {
+ leftPadding: control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
+ rightPadding: !control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
+
text: control.displayText
font: control.font
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
- rightPadding: 12 + control.spacing
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 120
implicitHeight: 32
@@ -92,24 +100,15 @@ T.ComboBox {
width: parent.width - 4
height: parent.height - 4
- visible: control.activeFocus && (control.focusReason === Qt.TabFocusReason || control.focusReason === Qt.BacktabFocusReason)
+ visible: control.visualFocus
color: control.Universal.accent
opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
}
-
- Image {
- id: checkmark
- x: parent.width - width - control.rightPadding
- y: (parent.height - height) / 2
- source: "image://universal/downarrow/" + (!control.enabled ? control.Universal.baseLowColor : control.Universal.baseMediumHighColor)
- }
}
- //! [background]
- //! [popup]
popup: T.Popup {
- implicitWidth: control.width
- implicitHeight: Math.min(396, listview.contentHeight)
+ width: control.width
+ implicitHeight: Math.min(396, contentItem.implicitHeight)
topMargin: 8
bottomMargin: 8
@@ -117,10 +116,12 @@ T.ComboBox {
Universal.accent: control.Universal.accent
contentItem: ListView {
- id: listview
clip: true
+ implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
+ highlightRangeMode: ListView.ApplyRange
+ highlightMoveDuration: 0
T.ScrollIndicator.vertical: ScrollIndicator { }
}
@@ -131,5 +132,4 @@ T.ComboBox {
border.width: 1 // FlyoutBorderThemeThickness
}
}
- //! [popup]
}
diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml
index 9db1f8a5..6781d387 100644
--- a/src/imports/controls/universal/Dial.qml
+++ b/src/imports/controls/universal/Dial.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Dial {
id: control
@@ -44,20 +44,17 @@ T.Dial {
implicitWidth: 100
implicitHeight: 100
- //! [background]
background: Rectangle {
x: control.width / 2 - width / 2
y: control.height / 2 - height / 2
width: Math.max(64, Math.min(control.width, control.height))
- height: Math.max(64, Math.min(control.width, control.height))
+ height: width
radius: width / 2
color: "transparent"
border.color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseMediumColor
border.width: 2
}
- //! [background]
- //! [handle]
handle: Rectangle {
implicitWidth: 20
implicitHeight: 20
@@ -80,5 +77,4 @@ T.Dial {
}
]
}
- //! [handle]
}
diff --git a/src/imports/controls/universal/Drawer.qml b/src/imports/controls/universal/Drawer.qml
new file mode 100644
index 00000000..84831323
--- /dev/null
+++ b/src/imports/controls/universal/Drawer.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+T.Drawer {
+ id: control
+
+ parent: T.ApplicationWindow.overlay
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
+ topPadding: control.edge === Qt.BottomEdge
+ leftPadding: control.edge === Qt.RightEdge
+ rightPadding: control.edge === Qt.LeftEdge
+ bottomPadding: control.edge === Qt.TopEdge
+
+ enter: Transition { SmoothedAnimation { velocity: 5 } }
+ exit: Transition { SmoothedAnimation { velocity: 5 } }
+
+ contentItem: Item { }
+
+ background: Rectangle {
+ color: control.Universal.chromeMediumLowColor
+ Rectangle {
+ readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge
+ width: horizontal ? 1 : parent.width
+ height: horizontal ? parent.height : 1
+ color: control.Universal.chromeHighColor
+ x: control.edge === Qt.LeftEdge ? parent.width - 1 : 0
+ y: control.edge === Qt.TopEdge ? parent.height - 1 : 0
+ }
+ }
+}
diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml
index 9427dc2f..d5b327c1 100644
--- a/src/imports/controls/universal/Frame.qml
+++ b/src/imports/controls/universal/Frame.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Frame {
id: control
@@ -49,17 +49,10 @@ T.Frame {
padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
-
- //! [frame]
- frame: Rectangle {
- width: parent.width
- height: parent.height
+ background: Rectangle {
color: "transparent"
border.color: control.Universal.chromeDisabledLowColor
}
- //! [frame]
}
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
index b4e28eb1..c75c81a6 100644
--- a/src/imports/controls/universal/GroupBox.qml
+++ b/src/imports/controls/universal/GroupBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.GroupBox {
id: control
@@ -51,28 +51,25 @@ T.GroupBox {
spacing: 12
padding: 12
- topPadding: 12 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [label]
label: Text {
x: control.leftPadding
width: control.availableWidth
text: control.title
font: control.font
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
- //! [frame]
- frame: Rectangle {
+ background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
height: parent.height - control.topPadding + control.padding
@@ -80,5 +77,4 @@ T.GroupBox {
color: "transparent"
border.color: control.Universal.chromeDisabledLowColor
}
- //! [frame]
}
diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml
index 2aaf270b..6822d658 100644
--- a/src/imports/controls/universal/ItemDelegate.qml
+++ b/src/imports/controls/universal/ItemDelegate.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,44 +35,28 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.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
spacing: 12
- topPadding: 11
- leftPadding: 12
- rightPadding: 12
- bottomPadding: 13
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
- //! [indicator]
- indicator: Image {
- x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
- y: control.topPadding + (control.availableHeight - height) / 2
-
- visible: control.checked
- source: !control.checkable ? "" : "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor)
- }
- //! [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: Text {
+ leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+ rightPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
text: control.text
font: control.font
@@ -81,22 +65,20 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
- //! [background]
background: Rectangle {
- visible: control.pressed || control.highlighted || control.activeFocus
- color: control.pressed ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
- visible: control.activeFocus || control.highlighted
+ visible: control.visualFocus || control.highlighted
color: control.Universal.accent
opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
}
}
- //! [background]
}
diff --git a/src/imports/controls/universal/Label.qml b/src/imports/controls/universal/Label.qml
index 7630364c..9b50f4f5 100644
--- a/src/imports/controls/universal/Label.qml
+++ b/src/imports/controls/universal/Label.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,12 +35,13 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Label {
id: control
- color: !control.enabled ? Universal.baseLowColor : Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
linkColor: Universal.accent
}
diff --git a/src/imports/controls/universal/Menu.qml b/src/imports/controls/universal/Menu.qml
index 7cae65f1..5ee2c243 100644
--- a/src/imports/controls/universal/Menu.qml
+++ b/src/imports/controls/universal/Menu.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,19 +35,20 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Menu {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.min(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight + topPadding + bottomPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+
+ margins: 0
- //! [contentItem]
contentItem: ListView {
implicitHeight: contentHeight
model: control.contentModel
@@ -59,15 +60,12 @@ T.Menu {
ScrollIndicator.vertical: ScrollIndicator {}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 200
- implicitHeight: 200
+ implicitHeight: 40
color: control.Universal.chromeMediumLowColor
border.color: control.Universal.chromeHighColor
border.width: 1 // FlyoutBorderThemeThickness
}
- //! [background]
}
diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml
index fee5d886..d8fdbcd0 100644
--- a/src/imports/controls/universal/MenuItem.qml
+++ b/src/imports/controls/universal/MenuItem.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,31 +35,27 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.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
- rightPadding: 12
- bottomPadding: 13
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
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: Text {
+ leftPadding: !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -69,35 +65,32 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [indicator]
indicator: Image {
x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
visible: control.checked
- source: !control.checkable ? "" : "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor)
+ source: !control.checkable ? "" : "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.down ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor)
+ sourceSize.width: width
+ sourceSize.height: height
}
- //! [indicator]
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
Rectangle {
x: 1; y: 1
width: parent.width - 2
height: parent.height - 2
- visible: control.activeFocus
+ visible: control.visualFocus
color: control.Universal.accent
opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
}
}
- //! [background]
}
diff --git a/src/imports/controls/universal/Page.qml b/src/imports/controls/universal/Page.qml
index 975ddfe0..3150715f 100644
--- a/src/imports/controls/universal/Page.qml
+++ b/src/imports/controls/universal/Page.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,19 +35,15 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Page {
id: control
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
- color: control.Universal.altHighColor
+ color: control.Universal.background
}
- //! [background]
}
diff --git a/src/imports/controls/universal/PageIndicator.qml b/src/imports/controls/universal/PageIndicator.qml
index f3ec9a7b..0c4e3b80 100644
--- a/src/imports/controls/universal/PageIndicator.qml
+++ b/src/imports/controls/universal/PageIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.PageIndicator {
id: control
@@ -49,7 +49,6 @@ T.PageIndicator {
padding: 6
spacing: 7
- //! [delegate]
delegate: Rectangle {
implicitWidth: 5
implicitHeight: 5
@@ -58,9 +57,7 @@ T.PageIndicator {
color: index === control.currentIndex ? control.Universal.baseMediumHighColor :
pressed ? control.Universal.baseMediumLowColor : control.Universal.baseLowColor
}
- //! [delegate]
- //! [contentItem]
contentItem: Row {
spacing: control.spacing
@@ -69,5 +66,4 @@ T.PageIndicator {
delegate: control.delegate
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/universal/Pane.qml b/src/imports/controls/universal/Pane.qml
index 138b4ad4..cd62b65c 100644
--- a/src/imports/controls/universal/Pane.qml
+++ b/src/imports/controls/universal/Pane.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Pane {
id: control
@@ -49,13 +49,9 @@ T.Pane {
padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
- color: control.Universal.altHighColor
+ color: control.Universal.background
}
- //! [background]
}
diff --git a/src/imports/controls/universal/Popup.qml b/src/imports/controls/universal/Popup.qml
index 7ab79545..892db087 100644
--- a/src/imports/controls/universal/Popup.qml
+++ b/src/imports/controls/universal/Popup.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Popup {
id: control
diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml
index 3d88fc67..66d1aeb8 100644
--- a/src/imports/controls/universal/ProgressBar.qml
+++ b/src/imports/controls/universal/ProgressBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,47 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
-import Qt.labs.controls.universal.impl 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls.Universal.impl 2.0
T.ProgressBar {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- indicator ? indicator.implicitWidth : 0) + leftPadding + rightPadding
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
+ contentItem.implicitHeight + topPadding + bottomPadding)
- //! [indicator]
- indicator: Rectangle {
- x: control.leftPadding
- y: control.topPadding + (control.availableHeight - height) / 2
- width: control.indeterminate ? 0 : control.position * control.availableWidth
- height: 10
+ contentItem: ProgressStrip {
+ id: strip
+ implicitHeight: 10
scale: control.mirrored ? -1 : 1
+ indeterminate: control.indeterminate
color: control.Universal.accent
+ progress: control.position
+ clip: control.indeterminate
- ProgressStrip {
- id: strip
-
- width: control.availableWidth
- height: control.availableHeight
-
- clip: control.indeterminate
- visible: control.indeterminate
- color: control.Universal.accent
-
- ProgressStripAnimator {
- target: strip
- running: strip.visible
- }
+ ProgressStripAnimator {
+ target: strip
+ running: control.visible && control.indeterminate
}
}
- //! [indicator]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 10
@@ -88,5 +75,4 @@ T.ProgressBar {
visible: !control.indeterminate
color: control.Universal.baseLowColor
}
- //! [background]
}
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 95e55db9..b8986488 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,75 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls.Universal.impl 2.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
padding: 6
spacing: 8
property bool useSystemFocusVisuals: true
- //! [indicator]
- indicator: Rectangle {
- id: outerEllipse
- implicitWidth: 20
- implicitHeight: 20
+ indicator: RadioIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
-
- radius: width / 2
- color: "transparent"
- border.width: 2 // RadioButtonBorderThemeThickness
- border.color: control.checked ? "transparent" :
- !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
-
- Rectangle {
- id: checkOuterEllipse
- width: parent.width
- height: parent.height
-
- radius: width / 2
- opacity: control.checked ? 1 : 0
- color: "transparent"
- border.width: 2 // RadioButtonBorderThemeThickness
- border.color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.accent
- }
-
- Rectangle {
- id: checkGlyph
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: parent.width / 2
- height: parent.height / 2
-
- radius: width / 2
- opacity: control.checked ? 1 : 0
- color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
- }
+ control: control
}
- //! [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: 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
@@ -112,7 +71,7 @@ T.RadioButton {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
}
diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml
new file mode 100644
index 00000000..09f86f15
--- /dev/null
+++ b/src/imports/controls/universal/RadioDelegate.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+T.RadioDelegate {
+ id: control
+
+ 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
+
+ spacing: 12
+
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
+
+ property Item control
+
+ indicator: RadioIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+ }
+
+ background: Rectangle {
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.visualFocus || control.highlighted
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+
+ }
+}
diff --git a/src/imports/controls/universal/RadioIndicator.qml b/src/imports/controls/universal/RadioIndicator.qml
new file mode 100644
index 00000000..65790e6a
--- /dev/null
+++ b/src/imports/controls/universal/RadioIndicator.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls.Universal 2.0
+
+Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ radius: width / 2
+ color: "transparent"
+ border.width: 2 // RadioButtonBorderThemeThickness
+ border.color: control.checked ? "transparent" :
+ !control.enabled ? control.Universal.baseLowColor :
+ control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+
+ property var control
+
+ Rectangle {
+ id: checkOuterEllipse
+ width: parent.width
+ height: parent.height
+
+ radius: width / 2
+ opacity: control.checked ? 1 : 0
+ color: "transparent"
+ border.width: 2 // RadioButtonBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.down ? control.Universal.baseMediumColor : control.Universal.accent
+ }
+
+ Rectangle {
+ id: checkGlyph
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 2
+ height: parent.height / 2
+
+ radius: width / 2
+ opacity: control.checked ? 1 : 0
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ }
+}
diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml
index f01c06ed..ec2ff7c8 100644
--- a/src/imports/controls/universal/RangeSlider.qml
+++ b/src/imports/controls/universal/RangeSlider.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,24 +35,21 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.RangeSlider {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(track ? track.implicitWidth : 0,
- first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
+ Math.max(first.handle ? first.handle.implicitWidth : 0,
+ second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(track ? track.implicitHeight : 0,
- first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ Math.max(first.handle ? first.handle.implicitHeight : 0,
+ second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
padding: 6
- //! [firstHandle]
first.handle: Rectangle {
implicitWidth: horizontal ? 8 : 24
implicitHeight: horizontal ? 24 : 8
@@ -65,9 +62,7 @@ T.RangeSlider {
radius: 4
color: control.first.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
- //! [firstHandle]
- //! [secondHandle]
second.handle: Rectangle {
implicitWidth: horizontal ? 8 : 24
implicitHeight: horizontal ? 24 : 8
@@ -80,10 +75,8 @@ T.RangeSlider {
radius: 4
color: control.second.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
- //! [secondHandle]
- //! [track]
- track: Item {
+ background: Item {
implicitWidth: horizontal ? 200 : 18
implicitHeight: horizontal ? 18 : 200
@@ -99,20 +92,19 @@ T.RangeSlider {
Rectangle {
x: parent.horizontal ? 0 : (parent.width - width) / 2
y: parent.horizontal ? (parent.height - height) / 2 : 0
- width: parent.horizontal ? parent.width : 2 // SliderTrackThemeHeight
- height: !parent.horizontal ? parent.height : 2 // SliderTrackThemeHeight
+ width: parent.horizontal ? parent.width : 2 // SliderBackgroundThemeHeight
+ height: !parent.horizontal ? parent.height : 2 // SliderBackgroundThemeHeight
color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
}
Rectangle {
- x: parent.horizontal ? control.first.position * parent.width : 0
+ x: parent.horizontal ? control.first.position * parent.width : (parent.width - width) / 2
y: parent.horizontal ? (parent.height - height) / 2 : control.second.visualPosition * parent.height
- width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 2 // SliderTrackThemeHeight
- height: !parent.horizontal ? control.second.position * parent.height - control.first.position * parent.height : 2 // SliderTrackThemeHeight
+ width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 2 // SliderBackgroundThemeHeight
+ height: !parent.horizontal ? control.second.position * parent.height - control.first.position * parent.height : 2 // SliderBackgroundThemeHeight
color: control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
}
- //! [track]
}
diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml
index dd0a81ca..1ac627a7 100644
--- a/src/imports/controls/universal/ScrollBar.qml
+++ b/src/imports/controls/universal/ScrollBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,37 +35,28 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.ScrollBar {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- handle.implicitWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- handle.implicitHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
// TODO: arrows
- //! [handle]
- handle: Rectangle {
+ contentItem: Rectangle {
implicitWidth: 12
implicitHeight: 12
color: control.pressed ? control.Universal.baseMediumColor : control.Universal.chromeHighColor
visible: control.size < 1.0
opacity: 0.0
-
- readonly property bool horizontal: control.orientation === Qt.Horizontal
- x: control.leftPadding + (horizontal ? control.position * control.availableWidth : 0)
- y: control.topPadding + (horizontal ? 0 : control.position * control.availableHeight)
- width: horizontal ? control.size * control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.size * control.availableHeight
}
- //! [handle]
- //! [background]
background: Rectangle {
implicitWidth: 12
implicitHeight: 12
@@ -74,7 +65,6 @@ T.ScrollBar {
visible: control.size < 1.0
opacity: 0.0
}
- //! [background]
states: [
State {
@@ -86,13 +76,13 @@ T.ScrollBar {
transitions: [
Transition {
to: "active"
- NumberAnimation { targets: [handle, background]; property: "opacity"; to: 1.0 }
+ NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 }
},
Transition {
from: "active"
SequentialAnimation {
PauseAnimation { duration: 3000 }
- NumberAnimation { targets: [handle, background]; property: "opacity"; to: 0.0 }
+ NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 }
}
}
]
diff --git a/src/imports/controls/universal/ScrollIndicator.qml b/src/imports/controls/universal/ScrollIndicator.qml
index 5787b60a..ce289ce3 100644
--- a/src/imports/controls/universal/ScrollIndicator.qml
+++ b/src/imports/controls/universal/ScrollIndicator.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,19 +35,20 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.ScrollIndicator {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- indicator.implicitWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- indicator.implicitHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ contentItem: Rectangle {
+ id: indicator
- //! [indicator]
- indicator: Rectangle {
implicitWidth: 6
implicitHeight: 6
@@ -55,12 +56,6 @@ T.ScrollIndicator {
visible: control.size < 1.0
opacity: 0.0
- readonly property bool horizontal: control.orientation === Qt.Horizontal
- x: control.leftPadding + (horizontal ? control.position * control.width : 0)
- y: control.topPadding + (horizontal ? 0 : control.position * control.height)
- width: horizontal ? control.size * control.availableWidth : implicitWidth
- height: horizontal ? implicitHeight : control.size * control.availableHeight
-
states: [
State {
name: "active"
@@ -82,5 +77,4 @@ T.ScrollIndicator {
}
]
}
- //! [indicator]
}
diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml
index 66357c6e..baf91211 100644
--- a/src/imports/controls/universal/Slider.qml
+++ b/src/imports/controls/universal/Slider.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,24 +35,21 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.Slider {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(track ? track.implicitWidth : 0,
- handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
+ (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(track ? track.implicitHeight : 0,
- handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
padding: 6
property bool useSystemFocusVisuals: true
- //! [handle]
handle: Rectangle {
implicitWidth: horizontal ? 8 : 24
implicitHeight: horizontal ? 24 : 8
@@ -65,10 +62,8 @@ T.Slider {
radius: 4
color: control.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
- //! [handle]
- //! [track]
- track: Item {
+ background: Item {
implicitWidth: horizontal ? 200 : 18
implicitHeight: horizontal ? 18 : 200
@@ -99,5 +94,4 @@ T.Slider {
color: control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
}
- //! [track]
}
diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml
index c903baf4..d3647114 100644
--- a/src/imports/controls/universal/SpinBox.qml
+++ b/src/imports/controls/universal/SpinBox.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.SpinBox {
id: control
@@ -52,39 +52,36 @@ T.SpinBox {
baselineOffset: contentItem.y + contentItem.baselineOffset
// TextControlThemePadding + 2 (border)
- topPadding: 5
- bottomPadding: 7
- leftPadding: 12 + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
- rightPadding: 8 + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
+ padding: 12
+ topPadding: padding - 7
+ leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
+ rightPadding: padding - 4 + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
+ bottomPadding: padding - 5
Universal.theme: activeFocus ? Universal.Light : undefined
- //! [validator]
validator: IntValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
}
- //! [validator]
- //! [contentItem]
contentItem: TextInput {
text: control.textFromValue(control.value, control.locale)
font: control.font
color: !enabled ? control.Universal.chromeDisabledLowColor :
- activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor
+ activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.foreground
selectionColor: control.Universal.accent
selectedTextColor: control.Universal.chromeWhiteColor
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: TextInput.AlignVCenter
+ readOnly: !control.editable
validator: control.validator
inputMethodHints: Qt.ImhFormattedNumbersOnly
}
- //! [contentItem]
- //! [up.indicator]
up.indicator: Item {
implicitWidth: 28
height: parent.height + 4
@@ -104,13 +101,13 @@ T.SpinBox {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
source: "image://universal/" + (control.mirrored ? "left" : "right") + "arrow/"
- + (!control.enabled ? control.Universal.chromeDisabledLowColor :
- control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ + (!enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ sourceSize.width: width
+ sourceSize.height: height
}
}
- //! [up.indicator]
- //! [down.indicator]
down.indicator: Item {
implicitWidth: 28
height: parent.height + 4
@@ -130,13 +127,13 @@ T.SpinBox {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
source: "image://universal/" + (control.mirrored ? "right" : "left") + "arrow/"
- + (!control.enabled ? control.Universal.chromeDisabledLowColor :
- control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ + (!enabled ? control.Universal.chromeDisabledLowColor :
+ control.activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor)
+ sourceSize.width: width
+ sourceSize.height: height
}
}
- //! [down.indicator]
- //! [background]
background: Rectangle {
implicitWidth: 60 + 28 // TextControlThemeMinWidth - 4 (border)
implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
@@ -144,7 +141,6 @@ T.SpinBox {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
- color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
+ color: control.enabled ? control.Universal.background : control.Universal.baseLowColor
}
- //! [background]
}
diff --git a/src/imports/controls/universal/StackView.qml b/src/imports/controls/universal/StackView.qml
index b49c2dbb..4f37bb76 100644
--- a/src/imports/controls/universal/StackView.qml
+++ b/src/imports/controls/universal/StackView.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,54 +35,42 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.StackView {
- id: root
+ id: control
- //! [popEnter]
popEnter: Transition {
ParallelAnimation {
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InQuint }
- NumberAnimation { property: "x"; from: (root.mirrored ? -0.3 : 0.3) * -root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: (control.mirrored ? -0.3 : 0.3) * -control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
}
- //! [popEnter]
- //! [popExit]
popExit: Transition {
NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutQuint }
}
- //! [popExit]
- //! [pushEnter]
pushEnter: Transition {
ParallelAnimation {
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InQuint }
- NumberAnimation { property: "x"; from: (root.mirrored ? -0.3 : 0.3) * root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: (control.mirrored ? -0.3 : 0.3) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
}
- //! [pushEnter]
- //! [pushExit]
pushExit: Transition {
NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutQuint }
}
- //! [pushExit]
- //! [replaceEnter]
replaceEnter: Transition {
ParallelAnimation {
NumberAnimation { property: "opacity"; from: 0; to: 1; duration: 200; easing.type: Easing.InQuint }
- NumberAnimation { property: "x"; from: (root.mirrored ? -0.3 : 0.3) * root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "x"; from: (control.mirrored ? -0.3 : 0.3) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
}
- //! [replaceEnter]
- //! [replaceExit]
replaceExit: Transition {
NumberAnimation { property: "opacity"; from: 1; to: 0; duration: 200; easing.type: Easing.OutQuint }
}
- //! [replaceExit]
}
diff --git a/src/imports/controls/universal/SwipeDelegate.qml b/src/imports/controls/universal/SwipeDelegate.qml
new file mode 100644
index 00000000..82c1e744
--- /dev/null
+++ b/src/imports/controls/universal/SwipeDelegate.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+T.SwipeDelegate {
+ id: control
+
+ 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
+
+ spacing: 12
+
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+ rightPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+
+ background: Rectangle {
+ color: control.Universal.background
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.visualFocus || control.highlighted
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+ }
+
+ Behavior on x {
+ enabled: !control.down
+ NumberAnimation {
+ easing.type: Easing.InOutCubic
+ duration: 400
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index 768291fc..b42361dc 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,67 +35,33 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
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
property bool useSystemFocusVisuals: true
- //! [indicator]
- indicator: Rectangle {
- implicitWidth: 44
- implicitHeight: 20
+ indicator: SwitchIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
-
- radius: 10
- color: !control.enabled ? "transparent" :
- control.pressed ? control.Universal.baseMediumColor :
- control.checked ? control.Universal.accent : "transparent"
- border.color: !control.enabled ? control.Universal.baseLowColor :
- control.checked && !control.pressed ? control.Universal.accent : control.Universal.baseMediumColor
- border.width: 2
-
- Rectangle {
- width: 10
- height: 10
- radius: 5
-
- color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed || control.checked ? control.Universal.chromeWhiteColor : control.Universal.baseMediumHighColor
-
- x: Math.max(5, Math.min(parent.width - width - 5,
- control.visualPosition * parent.width - (width / 2)))
- y: (parent.height - height) / 2
-
- Behavior on x {
- enabled: !control.pressed
- SmoothedAnimation { velocity: 200 }
- }
- }
+ control: control
}
- //! [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: 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
@@ -104,7 +70,7 @@ T.Switch {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
}
diff --git a/src/imports/controls/universal/SwitchDelegate.qml b/src/imports/controls/universal/SwitchDelegate.qml
new file mode 100644
index 00000000..558f5cfb
--- /dev/null
+++ b/src/imports/controls/universal/SwitchDelegate.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+T.SwitchDelegate {
+ id: control
+
+ 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
+
+ spacing: 12
+
+ padding: 12
+ topPadding: padding - 1
+ bottomPadding: padding + 1
+
+ indicator: SwitchIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+ }
+
+ background: Rectangle {
+ visible: control.down || control.highlighted || control.visualFocus
+ color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.visualFocus || control.highlighted
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+
+ }
+}
diff --git a/src/imports/controls/universal/SwitchIndicator.qml b/src/imports/controls/universal/SwitchIndicator.qml
new file mode 100644
index 00000000..b3d44d9e
--- /dev/null
+++ b/src/imports/controls/universal/SwitchIndicator.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+Rectangle {
+ implicitWidth: 44
+ implicitHeight: 20
+
+ radius: 10
+ color: !control.enabled ? "transparent" :
+ control.pressed ? control.Universal.baseMediumColor :
+ control.checked ? control.Universal.accent : "transparent"
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.checked && !control.pressed ? control.Universal.accent : control.Universal.baseMediumColor
+ border.width: 2
+
+ property Item control
+
+ Rectangle {
+ width: 10
+ height: 10
+ radius: 5
+
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed || control.checked ? control.Universal.chromeWhiteColor : control.Universal.baseMediumHighColor
+
+ x: Math.max(5, Math.min(parent.width - width - 5,
+ control.visualPosition * parent.width - (width / 2)))
+ y: (parent.height - height) / 2
+
+ Behavior on x {
+ enabled: !control.pressed
+ SmoothedAnimation { velocity: 200 }
+ }
+ }
+}
diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml
index 1eee3b06..7c2e83a6 100644
--- a/src/imports/controls/universal/TabBar.qml
+++ b/src/imports/controls/universal/TabBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick 2.7
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.TabBar {
id: control
@@ -46,7 +46,6 @@ T.TabBar {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem.implicitHeight + topPadding + bottomPadding)
- //! [contentItem]
contentItem: PathView {
implicitWidth: 200
implicitHeight: 48
@@ -56,6 +55,7 @@ T.TabBar {
interactive: false
snapMode: PathView.SnapToItem
+ movementDirection: PathView.Positive
highlightMoveDuration: 100
path: Path {
@@ -67,13 +67,10 @@ T.TabBar {
}
}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 48
- color: control.Universal.altHighColor
+ color: control.Universal.background
}
- //! [background]
}
diff --git a/src/imports/controls/universal/TabButton.qml b/src/imports/controls/universal/TabButton.qml
index c736a87b..d503c86a 100644
--- a/src/imports/controls/universal/TabButton.qml
+++ b/src/imports/controls/universal/TabButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,33 +35,28 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
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: Text {
text: control.text
font: control.font
elide: Text.ElideRight
- color: control.checked || control.pressed ? control.Universal.baseHighColor : control.Universal.baseLowColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
+
+ opacity: control.checked || control.down ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
}
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
index 255f5774..43fd40f4 100644
--- a/src/imports/controls/universal/TextArea.qml
+++ b/src/imports/controls/universal/TextArea.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.TextArea {
id: control
@@ -49,15 +49,14 @@ T.TextArea {
placeholder.implicitHeight + topPadding + bottomPadding)
// TextControlThemePadding + 2 (border)
- topPadding: 5
- leftPadding: 12
- rightPadding: 8
- bottomPadding: 7
+ padding: 12
+ topPadding: padding - 7
+ rightPadding: padding - 4
+ bottomPadding: padding - 5
Universal.theme: activeFocus ? Universal.Light : undefined
- color: !enabled ? Universal.chromeDisabledLowColor :
- activeFocus ? Universal.chromeBlackHighColor : Universal.baseHighColor
+ color: !enabled ? Universal.chromeDisabledLowColor : Universal.foreground
selectionColor: Universal.accent
selectedTextColor: Universal.chromeWhiteColor
@@ -72,13 +71,12 @@ 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
elide: Text.ElideRight
}
- //! [background]
background: Rectangle {
implicitWidth: 60 // TextControlThemeMinWidth - 4 (border)
implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
@@ -86,7 +84,6 @@ T.TextArea {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
- color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
+ color: control.enabled ? control.Universal.background : control.Universal.baseLowColor
}
- //! [background]
}
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index fe9e071d..bd496ecc 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,29 +35,28 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.TextField {
id: control
- implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
- placeholder.implicitWidth + leftPadding + rightPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
+ || contentWidth + leftPadding + rightPadding
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
background ? background.implicitHeight : 0,
placeholder.implicitHeight + topPadding + bottomPadding)
// TextControlThemePadding + 2 (border)
- topPadding: 5
- leftPadding: 12
- rightPadding: 8
- bottomPadding: 7
+ padding: 12
+ topPadding: padding - 7
+ rightPadding: padding - 4
+ bottomPadding: padding - 5
Universal.theme: activeFocus ? Universal.Light : undefined
- color: !enabled ? Universal.chromeDisabledLowColor :
- activeFocus ? Universal.chromeBlackHighColor : Universal.baseHighColor
+ color: !enabled ? Universal.chromeDisabledLowColor : Universal.foreground
selectionColor: Universal.accent
selectedTextColor: Universal.chromeWhiteColor
verticalAlignment: TextInput.AlignVCenter
@@ -73,13 +72,12 @@ 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
elide: Text.ElideRight
}
- //! [background]
background: Rectangle {
implicitWidth: 60 // TextControlThemeMinWidth - 4 (border)
implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
@@ -87,7 +85,6 @@ T.TextField {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
- color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
+ color: control.enabled ? control.Universal.background : control.Universal.baseLowColor
}
- //! [background]
}
diff --git a/src/imports/controls/universal/ToolBar.qml b/src/imports/controls/universal/ToolBar.qml
index cefb9dc9..48e200c0 100644
--- a/src/imports/controls/universal/ToolBar.qml
+++ b/src/imports/controls/universal/ToolBar.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,8 +35,8 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
T.ToolBar {
id: control
@@ -47,14 +47,10 @@ T.ToolBar {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitHeight: 48 // AppBarThemeCompactHeight
color: control.Universal.chromeMediumColor
}
- //! [background]
}
diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml
index a8fa8bd5..cb87130d 100644
--- a/src/imports/controls/universal/ToolButton.qml
+++ b/src/imports/controls/universal/ToolButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,45 +35,38 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
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: Text {
text: control.text
font: control.font
- color: control.enabled ? control.Universal.baseHighColor : control.Universal.baseLowColor
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
- //! [background]
background: Rectangle {
implicitWidth: 68
implicitHeight: 48 // AppBarThemeCompactHeight
- color: control.pressed ? control.Universal.listMediumColor :
+ color: control.down ? control.Universal.listMediumColor :
control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : "transparent"
}
- //! [background]
}
diff --git a/src/imports/controls/universal/ToolTip.qml b/src/imports/controls/universal/ToolTip.qml
new file mode 100644
index 00000000..423e729d
--- /dev/null
+++ b/src/imports/controls/universal/ToolTip.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+
+T.ToolTip {
+ id: control
+
+ x: parent ? (parent.width - implicitWidth) / 2 : 0
+ y: -implicitHeight - 16
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ margins: 8
+ padding: 8
+ topPadding: padding - 3
+ bottomPadding: padding - 1
+
+ closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ // TODO: wrapMode: Label.Wrap
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+ }
+
+ background: Rectangle {
+ color: control.Universal.chromeMediumLowColor
+ border.color: control.Universal.chromeHighColor
+ border.width: 1 // ToolTipBorderThemeThickness
+ }
+}
diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
index e1efca06..7b134b84 100644
--- a/src/imports/controls/universal/Tumbler.qml
+++ b/src/imports/controls/universal/Tumbler.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,9 +35,9 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
-import Qt.labs.controls 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls 2.0
T.Tumbler {
id: control
@@ -45,18 +45,15 @@ T.Tumbler {
implicitWidth: 60
implicitHeight: 200
- //! [delegate]
delegate: Text {
text: modelData
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
font: control.font
- opacity: 0.4 + Math.max(0, 1 - Math.abs(Tumbler.displacement)) * 0.6
+ color: control.Universal.foreground
+ opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [delegate]
- //! [contentItem]
contentItem: PathView {
id: pathView
model: control.model
@@ -78,5 +75,4 @@ T.Tumbler {
property real delegateHeight: control.availableHeight / control.visibleItemCount
}
- //! [contentItem]
}
diff --git a/src/imports/controls/universal/plugins.qmltypes b/src/imports/controls/universal/plugins.qmltypes
new file mode 100644
index 00000000..165e658e
--- /dev/null
+++ b/src/imports/controls/universal/plugins.qmltypes
@@ -0,0 +1,61 @@
+import QtQuick.tooling 1.2
+
+// This file describes the plugin-supplied types contained in the library.
+// It is used for QML tooling purposes only.
+//
+// This file was auto-generated by:
+// 'qmlplugindump -nonrelocatable QtQuick.Controls.Universal 2.0'
+
+Module {
+ dependencies: []
+ Component { name: "QQuickStyle"; prototype: "QObject" }
+ Component {
+ name: "QQuickUniversalStyle"
+ prototype: "QQuickStyle"
+ exports: ["QtQuick.Controls.Universal/Universal 2.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Theme"
+ values: {
+ "Light": 0,
+ "Dark": 1
+ }
+ }
+ Enum {
+ name: "Color"
+ values: {
+ "Lime": 0,
+ "Green": 1,
+ "Emerald": 2,
+ "Teal": 3,
+ "Cyan": 4,
+ "Cobalt": 5,
+ "Indigo": 6,
+ "Violet": 7,
+ "Pink": 8,
+ "Magenta": 9,
+ "Crimson": 10,
+ "Red": 11,
+ "Orange": 12,
+ "Amber": 13,
+ "Yellow": 14,
+ "Brown": 15,
+ "Olive": 16,
+ "Steel": 17,
+ "Mauve": 18,
+ "Taupe": 19
+ }
+ }
+ Property { name: "theme"; type: "Theme" }
+ Property { name: "accent"; type: "QVariant" }
+ Property { name: "foreground"; type: "QVariant" }
+ Property { name: "background"; type: "QVariant" }
+ Signal { name: "paletteChanged" }
+ Method {
+ name: "color"
+ type: "QColor"
+ Parameter { name: "color"; type: "Color" }
+ }
+ }
+}
diff --git a/src/imports/controls/universal/qmldir b/src/imports/controls/universal/qmldir
index ebf841fb..e4b804a6 100644
--- a/src/imports/controls/universal/qmldir
+++ b/src/imports/controls/universal/qmldir
@@ -1,4 +1,4 @@
-module Qt.labs.controls.universal
-plugin qtlabsuniversalstyleplugin
-classname QtLabsUniversalStylePlugin
-depends Qt.labs.controls 1.0
+module QtQuick.Controls.Universal
+plugin qtquickcontrols2universalstyleplugin
+classname QtQuickControls2UniversalStylePlugin
+depends QtQuick.Controls 2.0
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
index 554b8607..bc8a8eef 100644
--- a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
+++ b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -55,9 +55,11 @@ void QQuickUniversalFocusRectangle::paint(QPainter *painter)
return;
QRect bounds = boundingRect().toAlignedRect();
- const QString key = QStringLiteral("qquickuniversalfocusrectangle_%1_%2").arg(bounds.width()).arg(bounds.height());
+ const int boundsWidth = bounds.width();
+ const int boundsHeight = bounds.width();
+ const QString key = QStringLiteral("qquickuniversalfocusrectangle_%1_%2").arg(QString::number(boundsWidth), QString::number(boundsHeight));
- QPixmap pixmap(bounds.width(), bounds.height());
+ QPixmap pixmap(boundsWidth, boundsHeight);
if (!QPixmapCache::find(key, &pixmap)) {
bounds.adjust(0, 0, -1, -1);
pixmap.fill(Qt::transparent);
@@ -70,7 +72,7 @@ void QQuickUniversalFocusRectangle::paint(QPainter *painter)
p.drawRect(bounds);
pen.setColor(Qt::black);
- pen.setDashPattern(QVector<qreal>() << 1 << 1);
+ pen.setDashPattern(QVector<qreal>(2, 1));
p.setPen(pen);
p.drawRect(bounds);
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h b/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
index 6b15bc8d..02372dda 100644
--- a/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
+++ b/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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/qquickuniversalimageprovider.cpp b/src/imports/controls/universal/qquickuniversalimageprovider.cpp
deleted file mode 100644
index 7cb7b926..00000000
--- a/src/imports/controls/universal/qquickuniversalimageprovider.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickuniversalimageprovider_p.h"
-
-#include <QtCore/qdebug.h>
-#include <QtGui/qpainter.h>
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qscreen.h>
-#include <QtGui/qicon.h>
-
-QT_BEGIN_NAMESPACE
-
-QQuickUniversalImageProvider::QQuickUniversalImageProvider() : QQuickImageProvider(Image)
-{
-}
-
-QImage QQuickUniversalImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
-{
- Q_UNUSED(requestedSize);
-
- int sep = id.indexOf(QLatin1Char('/'));
- 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);
-
- QImage image(file);
- if (image.isNull()) {
- qWarning() << "QQuickUniversalImageProvider: unknown id:" << id;
- return QImage();
- }
-
- if (size)
- *size = image.size();
-
- if (!color.isEmpty()) {
- QPainter painter(&image);
- painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
- painter.fillRect(image.rect(), QColor(color));
- }
-
- return image;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider_p.h b/src/imports/controls/universal/qquickuniversalimageprovider_p.h
deleted file mode 100644
index 15648157..00000000
--- a/src/imports/controls/universal/qquickuniversalimageprovider_p.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKUNIVERSALIMAGEPROVIDER_P_H
-#define QQUICKUNIVERSALIMAGEPROVIDER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/qquickimageprovider.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickUniversalImageProvider : public QQuickImageProvider
-{
-public:
- QQuickUniversalImageProvider();
-
- QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) Q_DECL_OVERRIDE;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKUNIVERSALIMAGEPROVIDER_P_H
diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp
index 2fe66047..ac087c78 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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 );
@@ -121,7 +121,7 @@ void QQuickUniversalProgressRingAnimatorJob::updateCurrentTime(int time)
if (visible) {
int phaseIndex, remain = time, elapsed = 0;
- for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) {
+ for (phaseIndex = 0; phaseIndex < PhaseCount - 1; ++phaseIndex) {
if (remain <= m_phases[phaseIndex].duration + begin)
break;
remain -= m_phases[phaseIndex].duration;
@@ -153,7 +153,7 @@ void QQuickUniversalProgressRingAnimatorJob::writeBack()
void QQuickUniversalProgressRingAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
void QQuickUniversalProgressRingAnimatorJob::afterNodeSync()
@@ -191,11 +191,12 @@ int QQuickUniversalProgressRing::count() const
void QQuickUniversalProgressRing::setCount(int count)
{
- if (m_count != count) {
- m_count = count;
- update();
- emit countChanged();
- }
+ if (m_count == count)
+ return;
+
+ m_count = count;
+ update();
+ emit countChanged();
}
QColor QQuickUniversalProgressRing::color() const
@@ -205,11 +206,12 @@ QColor QQuickUniversalProgressRing::color() const
void QQuickUniversalProgressRing::setColor(const QColor &color)
{
- if (m_color != color) {
- m_color = color;
- update();
- emit colorChanged();
- }
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ update();
+ emit colorChanged();
}
QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
@@ -228,6 +230,7 @@ QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePa
qreal diameter = size / 10.0;
qreal radius = diameter / 2;
qreal offset = (size - diameter * 2) / M_PI;
+ const QRectF rect(offset, offset, diameter, diameter);
QSGNode *transformNode = oldNode->firstChild();
for (int i = 0; i < m_count; ++i) {
@@ -249,7 +252,7 @@ QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePa
QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
- rectNode->setRect(QRectF(offset, offset, diameter, diameter));
+ rectNode->setRect(rect);
rectNode->setColor(m_color);
rectNode->setRadius(radius);
rectNode->update();
diff --git a/src/imports/controls/universal/qquickuniversalprogressring_p.h b/src/imports/controls/universal/qquickuniversalprogressring_p.h
index 1d484e3a..ef73ebed 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring_p.h
+++ b/src/imports/controls/universal/qquickuniversalprogressring_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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..16f394f1 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -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);
@@ -148,7 +148,7 @@ void QQuickUniversalProgressStripAnimatorJob::updateCurrentTime(int time)
if (visible) {
{
int phaseIndex, remain = time, elapsed = 0;
- for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) {
+ for (phaseIndex = 0; phaseIndex < PhaseCount - 1; ++phaseIndex) {
if (remain <= m_borderPhases[phaseIndex].duration + begin)
break;
remain -= m_borderPhases[phaseIndex].duration;
@@ -171,7 +171,7 @@ void QQuickUniversalProgressStripAnimatorJob::updateCurrentTime(int time)
curve.addCubicBezierSegment(QPointF(0.4, 0.0), QPointF(0.6, 1.0), QPointF(1.0, 1.0));
int phaseIndex, remain = time, elapsed = 0;
- for (phaseIndex = 0; phaseIndex < PhaseCount; ++phaseIndex) {
+ for (phaseIndex = 0; phaseIndex < PhaseCount - 1; ++phaseIndex) {
if (remain <= m_ellipsePhases[phaseIndex].duration + begin)
break;
remain -= m_ellipsePhases[phaseIndex].duration;
@@ -203,7 +203,7 @@ void QQuickUniversalProgressStripAnimatorJob::writeBack()
void QQuickUniversalProgressStripAnimatorJob::nodeWasDestroyed()
{
- m_node = Q_NULLPTR;
+ m_node = nullptr;
}
void QQuickUniversalProgressStripAnimatorJob::afterNodeSync()
@@ -229,7 +229,7 @@ QQuickAnimatorJob *QQuickUniversalProgressStripAnimator::createJob() const
}
QQuickUniversalProgressStrip::QQuickUniversalProgressStrip(QQuickItem *parent)
- : QQuickItem(parent), m_color(Qt::black)
+ : QQuickItem(parent), m_color(Qt::black), m_progress(0.0), m_indeterminate(false)
{
setFlag(ItemHasContents);
}
@@ -241,25 +241,67 @@ QColor QQuickUniversalProgressStrip::color() const
void QQuickUniversalProgressStrip::setColor(const QColor &color)
{
- if (m_color != color) {
- m_color = color;
- update();
- emit colorChanged();
- }
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ update();
+}
+
+qreal QQuickUniversalProgressStrip::progress() const
+{
+ return m_progress;
+}
+
+void QQuickUniversalProgressStrip::setProgress(qreal progress)
+{
+ if (progress == m_progress)
+ return;
+
+ m_progress = progress;
+ update();
+}
+
+bool QQuickUniversalProgressStrip::isIndeterminate() const
+{
+ return m_indeterminate;
+}
+
+void QQuickUniversalProgressStrip::setIndeterminate(bool indeterminate)
+{
+ if (indeterminate == m_indeterminate)
+ return;
+
+ m_indeterminate = indeterminate;
+ update();
}
QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
QQuickItemPrivate *d = QQuickItemPrivate::get(this);
- if (!oldNode)
- oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
- static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+ QRectF bounds = boundingRect();
+ bounds.setHeight(implicitHeight());
+ bounds.moveTop((height() - bounds.height()) / 2.0);
+ if (!m_indeterminate)
+ bounds.setWidth(m_progress * bounds.width());
- QSGTransformNode *gridNode = static_cast<QSGTransformNode *>(oldNode->firstChild());
+ QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(oldNode);
+ if (!geometryNode)
+ geometryNode = new QSGSimpleRectNode(bounds, Qt::transparent);
+ geometryNode->setRect(bounds);
+ geometryNode->setColor(m_indeterminate ? Qt::transparent : m_color);
+
+ if (!m_indeterminate) {
+ while (QSGNode *node = geometryNode->firstChild())
+ delete node;
+ return geometryNode;
+ }
+
+ QSGTransformNode *gridNode = static_cast<QSGTransformNode *>(geometryNode->firstChild());
if (!gridNode) {
gridNode = new QSGTransformNode;
- oldNode->appendChildNode(gridNode);
+ geometryNode->appendChildNode(gridNode);
}
Q_ASSERT(gridNode->type() == QSGNode::TransformNodeType);
@@ -298,7 +340,7 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP
borderNode = borderNode->nextSibling();
}
- return oldNode;
+ return geometryNode;
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
index b61e73c6..89350e4d 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -56,22 +56,29 @@ QT_BEGIN_NAMESPACE
class QQuickUniversalProgressStrip : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(qreal progress READ progress WRITE setProgress FINAL)
+ Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate FINAL)
public:
- QQuickUniversalProgressStrip(QQuickItem *parent = Q_NULLPTR);
+ QQuickUniversalProgressStrip(QQuickItem *parent = nullptr);
QColor color() const;
void setColor(const QColor &color);
-Q_SIGNALS:
- void colorChanged();
+ qreal progress() const;
+ void setProgress(qreal progress);
+
+ bool isIndeterminate() const;
+ void setIndeterminate(bool indeterminate);
protected:
- QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
private:
QColor m_color;
+ qreal m_progress;
+ bool m_indeterminate;
};
class QQuickUniversalProgressStripAnimator : public QQuickAnimator
@@ -79,11 +86,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..2328f1a5 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -39,11 +39,11 @@
#include <QtCore/qdebug.h>
#include <QtCore/qsettings.h>
#include <QtQml/qqmlinfo.h>
-#include <QtLabsControls/private/qquickstyle_p.h>
+#include <QtQuickControls2/private/qquickstyleattached_p.h>
QT_BEGIN_NAMESPACE
-static QColor qquickuniversal_light_color(QQuickUniversalStyle::SystemColor role)
+static QRgb qquickuniversal_light_color(QQuickUniversalStyle::SystemColor role)
{
static const QRgb colors[] = {
0xFFFFFFFF, // SystemAltHighColor
@@ -71,10 +71,10 @@ static QColor qquickuniversal_light_color(QQuickUniversalStyle::SystemColor role
0x19000000, // SystemListLowColor
0x33000000 // SystemListMediumColor
};
- return QColor::fromRgba(colors[role]);
+ return colors[role];
}
-static QColor qquickuniversal_dark_color(QQuickUniversalStyle::SystemColor role)
+static QRgb qquickuniversal_dark_color(QQuickUniversalStyle::SystemColor role)
{
static const QRgb colors[] = {
0xFF000000, // SystemAltHighColor
@@ -102,10 +102,10 @@ static QColor qquickuniversal_dark_color(QQuickUniversalStyle::SystemColor role)
0x19FFFFFF, // SystemListLowColor
0x33FFFFFF // SystemListMediumColor
};
- return QColor::fromRgba(colors[role]);
+ return colors[role];
}
-static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Accent accent)
+static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Color accent)
{
static const QRgb colors[] = {
0xFFA4C400, // Lime
@@ -132,11 +132,22 @@ static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Accent accent)
return colors[accent];
}
-static QQuickUniversalStyle::Theme DefaultTheme = QQuickUniversalStyle::Light;
-static QRgb DefaultAccent = qquickuniversal_accent_color(QQuickUniversalStyle::Cobalt);
+// If no value was inherited from a parent or explicitly set, the "global" values are used.
+// The initial, default values of the globals are hard-coded here, but the environment
+// variables and .conf file override them if specified.
+static QQuickUniversalStyle::Theme GlobalTheme = QQuickUniversalStyle::Light;
+static QRgb GlobalAccent = qquickuniversal_accent_color(QQuickUniversalStyle::Cobalt);
+static QRgb GlobalForeground = qquickuniversal_light_color(QQuickUniversalStyle::BaseHigh);
+static QRgb GlobalBackground = qquickuniversal_light_color(QQuickUniversalStyle::AltHigh);
+// These represent whether a global foreground/background was set.
+// Each style's m_hasForeground/m_hasBackground are initialized to these values.
+static bool HasGlobalForeground = false;
+static bool HasGlobalBackground = false;
-QQuickUniversalStyle::QQuickUniversalStyle(QObject *parent) : QQuickStyle(parent),
- m_hasTheme(false), m_hasAccent(false), m_theme(DefaultTheme), m_accent(DefaultAccent)
+QQuickUniversalStyle::QQuickUniversalStyle(QObject *parent) : QQuickStyleAttached(parent),
+ m_explicitTheme(false), m_explicitAccent(false), m_explicitForeground(false), m_explicitBackground(false),
+ m_hasForeground(HasGlobalForeground), m_hasBackground(HasGlobalBackground), m_theme(GlobalTheme),
+ m_accent(GlobalAccent), m_foreground(GlobalForeground), m_background(GlobalBackground)
{
init();
}
@@ -153,28 +164,35 @@ QQuickUniversalStyle::Theme QQuickUniversalStyle::theme() const
void QQuickUniversalStyle::setTheme(Theme theme)
{
- m_hasTheme = true;
- if (m_theme != theme) {
- m_theme = theme;
- propagateTheme();
- emit themeChanged();
- emit paletteChanged();
- }
+ m_explicitTheme = true;
+ if (m_theme == theme)
+ return;
+
+ m_theme = theme;
+ propagateTheme();
+ emit themeChanged();
+ emit paletteChanged();
+ emit foregroundChanged();
+ emit backgroundChanged();
}
void QQuickUniversalStyle::inheritTheme(Theme theme)
{
- if (!m_hasTheme && m_theme != theme) {
- m_theme = theme;
- propagateTheme();
- emit themeChanged();
- emit paletteChanged();
- }
+ if (m_explicitTheme || m_theme == theme)
+ return;
+
+ m_theme = theme;
+ propagateTheme();
+ emit themeChanged();
+ emit paletteChanged();
+ emit foregroundChanged();
+ emit backgroundChanged();
}
void QQuickUniversalStyle::propagateTheme()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(child);
if (universal)
universal->inheritTheme(m_theme);
@@ -183,11 +201,12 @@ void QQuickUniversalStyle::propagateTheme()
void QQuickUniversalStyle::resetTheme()
{
- if (m_hasTheme) {
- m_hasTheme = false;
- QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritTheme(universal ? universal->theme() : DefaultTheme);
- }
+ if (!m_explicitTheme)
+ return;
+
+ m_explicitTheme = false;
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
+ inheritTheme(universal ? universal->theme() : GlobalTheme);
}
QVariant QQuickUniversalStyle::accent() const
@@ -198,47 +217,32 @@ QVariant QQuickUniversalStyle::accent() const
void QQuickUniversalStyle::setAccent(const QVariant &var)
{
QRgb accent = 0;
- if (var.type() == QVariant::Int) {
- int val = var.toInt();
- if (val < Lime || val > Taupe) {
- qmlInfo(parent()) << "unknown Universal.accent value: " << val;
- return;
- }
- accent = qquickuniversal_accent_color(static_cast<Accent>(val));
- } else {
- int val = QMetaEnum::fromType<Accent>().keyToValue(var.toByteArray());
- if (val != -1) {
- accent = qquickuniversal_accent_color(static_cast<Accent>(val));
- } else {
- QColor color(var.toString());
- if (!color.isValid()) {
- qmlInfo(parent()) << "unknown Universal.accent value: " << var.toString();
- return;
- }
- accent = color.rgba();
- }
- }
+ if (!variantToRgba(var, "accent", &accent))
+ return;
- m_hasAccent = true;
- if (m_accent != accent) {
- m_accent = accent;
- propagateAccent();
- emit accentChanged();
- }
+ m_explicitAccent = true;
+ if (m_accent == accent)
+ return;
+
+ m_accent = accent;
+ propagateAccent();
+ emit accentChanged();
}
void QQuickUniversalStyle::inheritAccent(QRgb accent)
{
- if (!m_hasAccent && m_accent != accent) {
- m_accent = accent;
- propagateAccent();
- emit accentChanged();
- }
+ if (m_explicitAccent || m_accent == accent)
+ return;
+
+ m_accent = accent;
+ propagateAccent();
+ emit accentChanged();
}
void QQuickUniversalStyle::propagateAccent()
{
- foreach (QQuickStyle *child, childStyles()) {
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(child);
if (universal)
universal->inheritAccent(m_accent);
@@ -247,145 +251,263 @@ void QQuickUniversalStyle::propagateAccent()
void QQuickUniversalStyle::resetAccent()
{
- if (m_hasAccent) {
- m_hasAccent = false;
- QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritAccent(universal ? universal->m_accent : DefaultAccent);
+ if (!m_explicitAccent)
+ return;
+
+ m_explicitAccent = false;
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
+ inheritAccent(universal ? universal->m_accent : GlobalAccent);
+}
+
+QVariant QQuickUniversalStyle::foreground() const
+{
+ if (m_hasForeground)
+ return QColor::fromRgba(m_foreground);
+ return baseHighColor();
+}
+
+void QQuickUniversalStyle::setForeground(const QVariant &var)
+{
+ QRgb foreground = 0;
+ if (!variantToRgba(var, "foreground", &foreground))
+ return;
+
+ m_hasForeground = true;
+ m_explicitForeground = true;
+ if (m_foreground == foreground)
+ return;
+
+ m_foreground = foreground;
+ propagateForeground();
+ emit foregroundChanged();
+}
+
+void QQuickUniversalStyle::inheritForeground(QRgb foreground, bool has)
+{
+ if (m_explicitForeground || m_foreground == foreground)
+ return;
+
+ m_hasForeground = has;
+ m_foreground = foreground;
+ propagateForeground();
+ emit foregroundChanged();
+}
+
+void QQuickUniversalStyle::propagateForeground()
+{
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(child);
+ if (universal)
+ universal->inheritForeground(m_foreground, m_hasForeground);
+ }
+}
+
+void QQuickUniversalStyle::resetForeground()
+{
+ if (!m_explicitForeground)
+ return;
+
+ m_hasForeground = false;
+ m_explicitForeground = false;
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
+ inheritForeground(universal ? universal->m_foreground : GlobalForeground, universal ? universal->m_hasForeground : false);
+}
+
+QVariant QQuickUniversalStyle::background() const
+{
+ if (m_hasBackground)
+ return QColor::fromRgba(m_background);
+ return altHighColor();
+}
+
+void QQuickUniversalStyle::setBackground(const QVariant &var)
+{
+ QRgb background = 0;
+ if (!variantToRgba(var, "background", &background))
+ return;
+
+ m_hasBackground = true;
+ m_explicitBackground = true;
+ if (m_background == background)
+ return;
+
+ m_background = background;
+ propagateBackground();
+ emit backgroundChanged();
+}
+
+void QQuickUniversalStyle::inheritBackground(QRgb background, bool has)
+{
+ if (m_explicitBackground || m_background == background)
+ return;
+
+ m_hasBackground = has;
+ m_background = background;
+ propagateBackground();
+ emit backgroundChanged();
+}
+
+void QQuickUniversalStyle::propagateBackground()
+{
+ const auto styles = childStyles();
+ for (QQuickStyleAttached *child : styles) {
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(child);
+ if (universal)
+ universal->inheritBackground(m_background, m_hasBackground);
}
}
+void QQuickUniversalStyle::resetBackground()
+{
+ if (!m_explicitBackground)
+ return;
+
+ m_hasBackground = false;
+ m_explicitBackground = false;
+ QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
+ inheritBackground(universal ? universal->m_background : GlobalBackground, universal ? universal->m_hasBackground : false);
+}
+
+QColor QQuickUniversalStyle::color(Color color) const
+{
+ return qquickuniversal_accent_color(color);
+}
+
QColor QQuickUniversalStyle::altHighColor() const
{
- return getColor(AltHigh);
+ return systemColor(AltHigh);
}
QColor QQuickUniversalStyle::altLowColor() const
{
- return getColor(AltLow);
+ return systemColor(AltLow);
}
QColor QQuickUniversalStyle::altMediumColor() const
{
- return getColor(AltMedium);
+ return systemColor(AltMedium);
}
QColor QQuickUniversalStyle::altMediumHighColor() const
{
- return getColor(AltMediumHigh);
+ return systemColor(AltMediumHigh);
}
QColor QQuickUniversalStyle::altMediumLowColor() const
{
- return getColor(AltMediumLow);
+ return systemColor(AltMediumLow);
}
QColor QQuickUniversalStyle::baseHighColor() const
{
- return getColor(BaseHighColor);
+ return systemColor(BaseHigh);
}
QColor QQuickUniversalStyle::baseLowColor() const
{
- return getColor(BaseLow);
+ return systemColor(BaseLow);
}
QColor QQuickUniversalStyle::baseMediumColor() const
{
- return getColor(BaseMedium);
+ return systemColor(BaseMedium);
}
QColor QQuickUniversalStyle::baseMediumHighColor() const
{
- return getColor(BaseMediumHigh);
+ return systemColor(BaseMediumHigh);
}
QColor QQuickUniversalStyle::baseMediumLowColor() const
{
- return getColor(BaseMediumLow);
+ return systemColor(BaseMediumLow);
}
QColor QQuickUniversalStyle::chromeAltLowColor() const
{
- return getColor(ChromeAltLow);
+ return systemColor(ChromeAltLow);
}
QColor QQuickUniversalStyle::chromeBlackHighColor() const
{
- return getColor(ChromeBlackHigh);
+ return systemColor(ChromeBlackHigh);
}
QColor QQuickUniversalStyle::chromeBlackLowColor() const
{
- return getColor(ChromeBlackLow);
+ return systemColor(ChromeBlackLow);
}
QColor QQuickUniversalStyle::chromeBlackMediumLowColor() const
{
- return getColor(ChromeBlackMediumLow);
+ return systemColor(ChromeBlackMediumLow);
}
QColor QQuickUniversalStyle::chromeBlackMediumColor() const
{
- return getColor(ChromeBlackMedium);
+ return systemColor(ChromeBlackMedium);
}
QColor QQuickUniversalStyle::chromeDisabledHighColor() const
{
- return getColor(ChromeDisabledHigh);
+ return systemColor(ChromeDisabledHigh);
}
QColor QQuickUniversalStyle::chromeDisabledLowColor() const
{
- return getColor(ChromeDisabledLow);
+ return systemColor(ChromeDisabledLow);
}
QColor QQuickUniversalStyle::chromeHighColor() const
{
- return getColor(ChromeHigh);
+ return systemColor(ChromeHigh);
}
QColor QQuickUniversalStyle::chromeLowColor() const
{
- return getColor(ChromeLow);
+ return systemColor(ChromeLow);
}
QColor QQuickUniversalStyle::chromeMediumColor() const
{
- return getColor(ChromeMedium);
+ return systemColor(ChromeMedium);
}
QColor QQuickUniversalStyle::chromeMediumLowColor() const
{
- return getColor(ChromeMediumLow);
+ return systemColor(ChromeMediumLow);
}
QColor QQuickUniversalStyle::chromeWhiteColor() const
{
- return getColor(ChromeWhite);
+ return systemColor(ChromeWhite);
}
QColor QQuickUniversalStyle::listLowColor() const
{
- return getColor(ListLow);
+ return systemColor(ListLow);
}
QColor QQuickUniversalStyle::listMediumColor() const
{
- return getColor(ListMedium);
+ return systemColor(ListMedium);
}
-QColor QQuickUniversalStyle::getColor(SystemColor role) const
+QColor QQuickUniversalStyle::systemColor(SystemColor role) const
{
- return m_theme == QQuickUniversalStyle::Dark ? qquickuniversal_dark_color(role) : qquickuniversal_light_color(role);
+ return QColor::fromRgba(m_theme == QQuickUniversalStyle::Dark ? qquickuniversal_dark_color(role) : qquickuniversal_light_color(role));
}
-void QQuickUniversalStyle::parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent)
+void QQuickUniversalStyle::parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent)
{
Q_UNUSED(oldParent);
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(newParent);
if (universal) {
inheritTheme(universal->theme());
inheritAccent(universal->m_accent);
+ inheritForeground(universal->m_foreground, universal->m_hasForeground);
+ inheritBackground(universal->m_background, universal->m_hasBackground);
}
}
@@ -396,36 +518,99 @@ static Enum toEnumValue(const QByteArray &value, bool *ok)
return static_cast<Enum>(enumeration.keyToValue(value, ok));
}
+static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer<QSettings> &settings, const QString &name)
+{
+ QByteArray value = qgetenv(env);
+ if (value.isNull() && !settings.isNull())
+ value = settings->value(name).toByteArray();
+ return value;
+}
+
void QQuickUniversalStyle::init()
{
- static bool defaultsInitialized = false;
- if (!defaultsInitialized) {
- QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Universal"));
- if (!settings.isNull()) {
- bool ok = false;
- QByteArray value = settings->value(QStringLiteral("Theme")).toByteArray();
- Theme theme = toEnumValue<Theme>(value, &ok);
- if (ok)
- DefaultTheme = m_theme = theme;
- else if (!value.isEmpty())
- qWarning().nospace().noquote() << settings->fileName() << ": unknown Universal theme value: " << value;
-
- value = settings->value(QStringLiteral("Accent")).toByteArray();
- Accent accent = toEnumValue<Accent>(value, &ok);
- if (ok) {
- DefaultAccent = m_accent = qquickuniversal_accent_color(accent);
+ static bool globalsInitialized = false;
+ if (!globalsInitialized) {
+ QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Universal"));
+
+ bool ok = false;
+ QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_THEME", settings, QStringLiteral("Theme"));
+ Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
+ if (ok)
+ GlobalTheme = m_theme = themeEnum;
+ else if (!themeValue.isEmpty())
+ qWarning().nospace().noquote() << "Universal: unknown theme value: " << themeValue;
+
+ QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_ACCENT", settings, QStringLiteral("Accent"));
+ Color accentEnum = toEnumValue<Color>(accentValue, &ok);
+ if (ok) {
+ GlobalAccent = m_accent = qquickuniversal_accent_color(accentEnum);
+ } else if (!accentValue.isEmpty()) {
+ QColor color(accentValue.constData());
+ if (color.isValid())
+ GlobalAccent = m_accent = color.rgba();
+ else
+ qWarning().nospace().noquote() << "Universal: unknown accent value: " << accentValue;
+ }
+
+ QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND", settings, QStringLiteral("Foreground"));
+ Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok);
+ if (ok) {
+ GlobalForeground = m_foreground = qquickuniversal_accent_color(foregroundEnum);
+ HasGlobalForeground = m_hasForeground = true;
+ } else if (!foregroundValue.isEmpty()) {
+ QColor color(foregroundValue.constData());
+ if (color.isValid()) {
+ GlobalForeground = m_foreground = color.rgba();
+ HasGlobalForeground = m_hasForeground = true;
+ } else {
+ qWarning().nospace().noquote() << "Universal: unknown foreground value: " << foregroundValue;
+ }
+ }
+
+ QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND", settings, QStringLiteral("Background"));
+ Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok);
+ if (ok) {
+ GlobalBackground = m_background = qquickuniversal_accent_color(backgroundEnum);
+ HasGlobalBackground = m_hasBackground = true;
+ } else if (!backgroundValue.isEmpty()) {
+ QColor color(backgroundValue.constData());
+ if (color.isValid()) {
+ GlobalBackground = m_background = color.rgba();
+ HasGlobalBackground = m_hasBackground = true;
} else {
- QColor color(value.constData());
- if (color.isValid())
- DefaultAccent = m_accent = color.rgba();
- else if (!value.isEmpty())
- qWarning().nospace().noquote() << settings->fileName() << ": unknown Universal accent value: " << value;
+ qWarning().nospace().noquote() << "Universal: unknown background value: " << backgroundValue;
}
}
- defaultsInitialized = true;
+
+ globalsInitialized = true;
}
- QQuickStyle::init(); // TODO: lazy init?
+ QQuickStyleAttached::init(); // TODO: lazy init?
+}
+
+bool QQuickUniversalStyle::variantToRgba(const QVariant &var, const char *name, QRgb *rgba) const
+{
+ if (var.type() == QVariant::Int) {
+ int val = var.toInt();
+ if (val < Lime || val > Taupe) {
+ qmlInfo(parent()) << "unknown Universal." << name << " value: " << val;
+ return false;
+ }
+ *rgba = qquickuniversal_accent_color(static_cast<Color>(val));
+ } else {
+ int val = QMetaEnum::fromType<Color>().keyToValue(var.toByteArray());
+ if (val != -1) {
+ *rgba = qquickuniversal_accent_color(static_cast<Color>(val));
+ } else {
+ QColor color(var.toString());
+ if (!color.isValid()) {
+ qmlInfo(parent()) << "unknown Universal." << name << " value: " << var.toString();
+ return false;
+ }
+ *rgba = color.rgba();
+ }
+ }
+ return true;
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h
index 00a04c65..bf0a84d8 100644
--- a/src/imports/controls/universal/qquickuniversalstyle_p.h
+++ b/src/imports/controls/universal/qquickuniversalstyle_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -49,17 +49,19 @@
//
#include <QtGui/qcolor.h>
-#include <QtLabsControls/private/qquickstyle_p.h>
+#include <QtQuickControls2/private/qquickstyleattached_p.h>
QT_BEGIN_NAMESPACE
class QQuickUniversalStylePrivate;
-class QQuickUniversalStyle : public QQuickStyle
+class QQuickUniversalStyle : public QQuickStyleAttached
{
Q_OBJECT
Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL)
Q_PROPERTY(QVariant accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL)
+ Q_PROPERTY(QVariant foreground READ foreground WRITE setForeground RESET resetForeground NOTIFY foregroundChanged FINAL)
+ Q_PROPERTY(QVariant background READ background WRITE setBackground RESET resetBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QColor altHighColor READ altHighColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor altLowColor READ altLowColor NOTIFY paletteChanged FINAL)
@@ -87,7 +89,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);
@@ -100,7 +102,7 @@ public:
void propagateTheme();
void resetTheme();
- enum Accent {
+ enum Color {
Lime,
Green,
Emerald,
@@ -122,7 +124,7 @@ public:
Mauve,
Taupe
};
- Q_ENUM(Accent)
+ Q_ENUM(Color)
QVariant accent() const;
void setAccent(const QVariant &accent);
@@ -130,6 +132,20 @@ public:
void propagateAccent();
void resetAccent();
+ QVariant foreground() const;
+ void setForeground(const QVariant &foreground);
+ void inheritForeground(QRgb foreground, bool has);
+ void propagateForeground();
+ void resetForeground();
+
+ QVariant background() const;
+ void setBackground(const QVariant &background);
+ void inheritBackground(QRgb background, bool has);
+ void propagateBackground();
+ void resetBackground();
+
+ Q_INVOKABLE QColor color(Color color) const;
+
QColor altHighColor() const;
QColor altLowColor() const;
QColor altMediumColor() const;
@@ -161,7 +177,7 @@ public:
AltMedium,
AltMediumHigh,
AltMediumLow,
- BaseHighColor,
+ BaseHigh,
BaseLow,
BaseMedium,
BaseMediumHigh,
@@ -182,23 +198,39 @@ public:
ListMedium
};
- QColor getColor(SystemColor role) const;
+ QColor systemColor(SystemColor role) const;
Q_SIGNALS:
void themeChanged();
void accentChanged();
+ void foregroundChanged();
+ void backgroundChanged();
void paletteChanged();
protected:
- void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) Q_DECL_OVERRIDE;
+ void parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent) override;
private:
void init();
-
- bool m_hasTheme;
- bool m_hasAccent;
+ bool variantToRgba(const QVariant &var, const char *name, QRgb *rgba) const;
+
+ // These reflect whether a color value was explicitly set on the specific
+ // item that this attached style object represents.
+ bool m_explicitTheme;
+ bool m_explicitAccent;
+ bool m_explicitForeground;
+ bool m_explicitBackground;
+ // These will be true when this item has an explicit or inherited foreground/background
+ // color, or these colors were declared globally via settings (e.g. conf or env vars).
+ // Some color properties of the style will return different values depending on whether
+ // or not these are set.
+ bool m_hasForeground;
+ bool m_hasBackground;
+ // The actual values for this item, whether explicit, inherited or globally set.
QQuickUniversalStyle::Theme m_theme;
QRgb m_accent;
+ QRgb m_foreground;
+ QRgb m_background;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp
index 290faa5d..dc516b45 100644
--- a/src/imports/controls/universal/qquickuniversaltheme.cpp
+++ b/src/imports/controls/universal/qquickuniversaltheme.cpp
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -37,17 +37,19 @@
#include "qquickuniversaltheme_p.h"
#include <QtGui/qfont.h>
+#include <QtGui/qfontinfo.h>
QT_BEGIN_NAMESPACE
QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
- const QFont font(QStringLiteral("Segoe UI"));
- if (font.exactMatch()) {
- systemFont.setFamily(font.family());
- groupBoxTitleFont.setFamily(font.family());
- tabButtonFont.setFamily(font.family());
+ const QFont font(QLatin1String("Segoe UI"));
+ if (QFontInfo(font).family() == QLatin1String("Segoe UI")) {
+ const QString family = font.family();
+ systemFont.setFamily(family);
+ groupBoxTitleFont.setFamily(family);
+ tabButtonFont.setFamily(family);
}
systemFont.setPixelSize(15);
@@ -59,10 +61,6 @@ QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme)
tabButtonFont.setWeight(QFont::Light);
}
-QQuickUniversalTheme::~QQuickUniversalTheme()
-{
-}
-
const QFont *QQuickUniversalTheme::font(QPlatformTheme::Font type) const
{
switch (type) {
diff --git a/src/imports/controls/universal/qquickuniversaltheme_p.h b/src/imports/controls/universal/qquickuniversaltheme_p.h
index 20243917..e2a3a436 100644
--- a/src/imports/controls/universal/qquickuniversaltheme_p.h
+++ b/src/imports/controls/universal/qquickuniversaltheme_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKUNIVERSALTHEME_H
-#define QQUICKUNIVERSALTHEME_H
+#ifndef QQUICKUNIVERSALTHEME_P_H
+#define QQUICKUNIVERSALTHEME_P_H
//
// W A R N I N G
@@ -48,20 +48,17 @@
// We mean it.
//
-#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/qfont.h>
-#include <QtLabsControls/private/qquickproxytheme_p.h>
+#include <QtQuickControls2/private/qquickproxytheme_p.h>
QT_BEGIN_NAMESPACE
class QQuickUniversalTheme : public QQuickProxyTheme
{
public:
- QQuickUniversalTheme(QPlatformTheme *theme);
+ explicit QQuickUniversalTheme(QPlatformTheme *theme = nullptr);
- ~QQuickUniversalTheme();
-
- const QFont *font(Font type = SystemFont) const Q_DECL_OVERRIDE;
+ const QFont *font(Font type = SystemFont) const override;
private:
QFont systemFont;
@@ -71,4 +68,4 @@ private:
QT_END_NAMESPACE
-#endif // QQUICKUNIVERSALTHEME_H
+#endif // QQUICKUNIVERSALTHEME_P_H
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
deleted file mode 100644
index 8f6ed194..00000000
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Controls module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <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/qquickstyleselector_p.h>
-
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtlabsuniversalstyleplugin);
-}
-
-QT_BEGIN_NAMESPACE
-
-class QtLabsUniversalStylePlugin: public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- ~QtLabsUniversalStylePlugin();
- void registerTypes(const char *uri) Q_DECL_OVERRIDE;
- void initializeEngine(QQmlEngine *engine, const char *uri) Q_DECL_OVERRIDE;
-
-private:
- QQuickProxyTheme *theme;
-};
-
-QtLabsUniversalStylePlugin::~QtLabsUniversalStylePlugin()
-{
- if (theme) {
- QPlatformTheme *old = theme->theme();
- QGuiApplicationPrivate::platform_theme = old;
- delete theme;
- }
-}
-
-void QtLabsUniversalStylePlugin::registerTypes(const char *uri)
-{
- qmlRegisterUncreatableType<QQuickUniversalStyle>(uri, 1, 0, "Universal", tr("Universal is an attached property"));
-}
-
-void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
-{
- QQuickStyleSelector selector;
- if (selector.style() == QLatin1String("universal")) {
- QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
- if (old) {
- QQuickProxyTheme *theme = new QQuickUniversalTheme(old);
- QGuiApplicationPrivate::platform_theme = theme;
- }
- }
-
- initResources();
- engine->addImageProvider(QStringLiteral("universal"), new QQuickUniversalImageProvider);
-
- QByteArray import = QByteArray(uri) + ".impl";
- qmlRegisterType<QQuickUniversalFocusRectangle>(import, 1, 0, "FocusRectangle");
- qmlRegisterType<QQuickUniversalProgressRing>(import, 1, 0, "ProgressRing");
- qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 1, 0, "ProgressRingAnimator");
- qmlRegisterType<QQuickUniversalProgressStrip>(import, 1, 0, "ProgressStrip");
- qmlRegisterType<QQuickUniversalProgressStripAnimator>(import, 1, 0, "ProgressStripAnimator");
-}
-
-QT_END_NAMESPACE
-
-#include "qtlabsuniversalstyleplugin.moc"
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc b/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
deleted file mode 100644
index 5a0249d7..00000000
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="qt-project.org/imports/Qt/labs/controls/universal">
- <file>images/checkmark.png</file>
- <file>images/checkmark@2x.png</file>
- <file>images/checkmark@3x.png</file>
- <file>images/checkmark@4x.png</file>
- <file>images/downarrow.png</file>
- <file>images/downarrow@2x.png</file>
- <file>images/downarrow@3x.png</file>
- <file>images/downarrow@4x.png</file>
- <file>images/leftarrow.png</file>
- <file>images/leftarrow@2x.png</file>
- <file>images/leftarrow@3x.png</file>
- <file>images/leftarrow@4x.png</file>
- <file>images/rightarrow.png</file>
- <file>images/rightarrow@2x.png</file>
- <file>images/rightarrow@3x.png</file>
- <file>images/rightarrow@4x.png</file>
-</qresource>
-</RCC>
diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
new file mode 100644
index 00000000..ddad6548
--- /dev/null
+++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQuickControls2/private/qquickstyleplugin_p.h>
+
+#include "qquickuniversalfocusrectangle_p.h"
+#include "qquickuniversalprogressring_p.h"
+#include "qquickuniversalprogressstrip_p.h"
+#include "qquickuniversalstyle_p.h"
+#include "qquickuniversaltheme_p.h"
+
+#include <QtQuickControls2/private/qquickcolorimageprovider_p.h>
+
+static inline void initResources()
+{
+ Q_INIT_RESOURCE(qtquickcontrols2universalstyleplugin);
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Controls_2_Universal);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickControls2UniversalStylePlugin: public QQuickStylePlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtQuickControls2UniversalStylePlugin(QObject *parent = nullptr);
+
+ void registerTypes(const char *uri) override;
+ void initializeEngine(QQmlEngine *engine, const char *uri) override;
+
+ QString name() const override;
+ QQuickProxyTheme *createTheme() const override;
+};
+
+QtQuickControls2UniversalStylePlugin::QtQuickControls2UniversalStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
+{
+ initResources();
+}
+
+void QtQuickControls2UniversalStylePlugin::registerTypes(const char *uri)
+{
+ qmlRegisterUncreatableType<QQuickUniversalStyle>(uri, 2, 0, "Universal", tr("Universal is an attached property"));
+}
+
+void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ QQuickStylePlugin::initializeEngine(engine, uri);
+
+ engine->addImageProvider(name(), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/QtQuick/Controls.2/Universal/images")));
+
+ QByteArray import = QByteArray(uri) + ".impl";
+ qmlRegisterType<QQuickUniversalFocusRectangle>(import, 2, 0, "FocusRectangle");
+ qmlRegisterType<QQuickUniversalProgressRing>(import, 2, 0, "ProgressRing");
+ qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 2, 0, "ProgressRingAnimator");
+ qmlRegisterType<QQuickUniversalProgressStrip>(import, 2, 0, "ProgressStrip");
+ qmlRegisterType<QQuickUniversalProgressStripAnimator>(import, 2, 0, "ProgressStripAnimator");
+
+ qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
+ qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
+}
+
+QString QtQuickControls2UniversalStylePlugin::name() const
+{
+ return QStringLiteral("universal");
+}
+
+QQuickProxyTheme *QtQuickControls2UniversalStylePlugin::createTheme() const
+{
+ return new QQuickUniversalTheme;
+}
+
+QT_END_NAMESPACE
+
+#include "qtquickcontrols2universalstyleplugin.moc"
diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.qrc b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.qrc
new file mode 100644
index 00000000..cd9ea61f
--- /dev/null
+++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.qrc
@@ -0,0 +1,20 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="qt-project.org/imports/QtQuick/Controls.2/Universal">
+ <file>images/checkmark.png</file>
+ <file>images/checkmark@2x.png</file>
+ <file>images/checkmark@3x.png</file>
+ <file>images/checkmark@4x.png</file>
+ <file>images/downarrow.png</file>
+ <file>images/downarrow@2x.png</file>
+ <file>images/downarrow@3x.png</file>
+ <file>images/downarrow@4x.png</file>
+ <file>images/leftarrow.png</file>
+ <file>images/leftarrow@2x.png</file>
+ <file>images/leftarrow@3x.png</file>
+ <file>images/leftarrow@4x.png</file>
+ <file>images/rightarrow.png</file>
+ <file>images/rightarrow@2x.png</file>
+ <file>images/rightarrow@3x.png</file>
+ <file>images/rightarrow@4x.png</file>
+</qresource>
+</RCC>
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index c7717d78..61b6912a 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -3,8 +3,11 @@ QML_FILES += \
$$PWD/BusyIndicator.qml \
$$PWD/Button.qml \
$$PWD/CheckBox.qml \
+ $$PWD/CheckDelegate.qml \
+ $$PWD/CheckIndicator.qml \
$$PWD/ComboBox.qml \
$$PWD/Dial.qml \
+ $$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
$$PWD/ItemDelegate.qml \
@@ -17,12 +20,17 @@ QML_FILES += \
$$PWD/Popup.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
+ $$PWD/RadioDelegate.qml \
+ $$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \
$$PWD/Slider.qml \
$$PWD/SpinBox.qml \
$$PWD/StackView.qml \
+ $$PWD/SwipeDelegate.qml \
+ $$PWD/SwitchDelegate.qml \
+ $$PWD/SwitchIndicator.qml \
$$PWD/Switch.qml \
$$PWD/TabBar.qml \
$$PWD/TabButton.qml \
@@ -30,11 +38,11 @@ QML_FILES += \
$$PWD/TextField.qml \
$$PWD/ToolBar.qml \
$$PWD/ToolButton.qml \
+ $$PWD/ToolTip.qml \
$$PWD/Tumbler.qml
HEADERS += \
$$PWD/qquickuniversalfocusrectangle_p.h \
- $$PWD/qquickuniversalimageprovider_p.h \
$$PWD/qquickuniversalprogressring_p.h \
$$PWD/qquickuniversalprogressstrip_p.h \
$$PWD/qquickuniversalstyle_p.h \
@@ -42,7 +50,6 @@ HEADERS += \
SOURCES += \
$$PWD/qquickuniversalfocusrectangle.cpp \
- $$PWD/qquickuniversalimageprovider.cpp \
$$PWD/qquickuniversalprogressring.cpp \
$$PWD/qquickuniversalprogressstrip.cpp \
$$PWD/qquickuniversalstyle.cpp \
diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro
index 88bad8f7..f10f21b0 100644
--- a/src/imports/controls/universal/universal.pro
+++ b/src/imports/controls/universal/universal.pro
@@ -1,9 +1,9 @@
-TARGET = qtlabsuniversalstyleplugin
-TARGETPATH = Qt/labs/controls/universal
-IMPORT_VERSION = 1.0
+TARGET = qtquickcontrols2universalstyleplugin
+TARGETPATH = QtQuick/Controls.2/Universal
+IMPORT_VERSION = 2.0
QT += qml quick
-QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private labscontrols-private
+QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
@@ -11,10 +11,10 @@ OTHER_FILES += \
qmldir
SOURCES += \
- $$PWD/qtlabsuniversalstyleplugin.cpp
+ $$PWD/qtquickcontrols2universalstyleplugin.cpp
RESOURCES += \
- $$PWD/qtlabsuniversalstyleplugin.qrc
+ $$PWD/qtquickcontrols2universalstyleplugin.qrc
include(universal.pri)
diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes
index 05491643..75a11a6e 100644
--- a/src/imports/templates/plugins.qmltypes
+++ b/src/imports/templates/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable Qt.labs.templates 1.0'
+// 'qmlplugindump -nonrelocatable QtQuick.Templates 2.0'
Module {
dependencies: ["QtQuick.Window 2.2"]
@@ -12,17 +12,14 @@ Module {
name: "QQuickAbstractButton"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/AbstractButton 1.0"]
+ exports: ["QtQuick.Templates/AbstractButton 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "text"; type: "string" }
- Property { name: "pressed"; type: "bool" }
+ Property { name: "down"; type: "bool" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "checked"; type: "bool" }
- Property { name: "checkable"; type: "bool" }
- Property { name: "highlighted"; type: "bool" }
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" }
@@ -35,9 +32,10 @@ Module {
name: "QQuickApplicationWindow"
defaultProperty: "data"
prototype: "QQuickWindowQmlImpl"
- exports: ["Qt.labs.templates/ApplicationWindow 1.0"]
+ exports: ["QtQuick.Templates/ApplicationWindow 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickApplicationWindowAttached"
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "activeFocusControl"; type: "QQuickItem"; isReadonly: true; isPointer: true }
@@ -61,7 +59,7 @@ Module {
name: "QQuickBusyIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/BusyIndicator 1.0"]
+ exports: ["QtQuick.Templates/BusyIndicator 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "running"; type: "bool" }
}
@@ -69,14 +67,27 @@ Module {
name: "QQuickButton"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/Button 1.0"]
+ exports: ["QtQuick.Templates/Button 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "autoRepeat"; type: "bool" }
+ Property { name: "highlighted"; type: "bool" }
+ Property { name: "flat"; type: "bool" }
}
Component {
name: "QQuickCheckBox"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/CheckBox 1.0"]
+ exports: ["QtQuick.Templates/CheckBox 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "tristate"; type: "bool" }
+ Property { name: "checkState"; type: "Qt::CheckState" }
+ }
+ Component {
+ name: "QQuickCheckDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/CheckDelegate 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "tristate"; type: "bool" }
Property { name: "checkState"; type: "Qt::CheckState" }
@@ -85,7 +96,7 @@ Module {
name: "QQuickComboBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ComboBox 1.0"]
+ exports: ["QtQuick.Templates/ComboBox 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
@@ -97,6 +108,7 @@ Module {
Property { name: "displayText"; type: "string" }
Property { name: "textRole"; type: "string" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
Signal {
name: "activated"
@@ -106,6 +118,8 @@ Module {
name: "highlighted"
Parameter { name: "index"; type: "int" }
}
+ Method { name: "incrementCurrentIndex" }
+ Method { name: "decrementCurrentIndex" }
Method {
name: "textAt"
type: "string"
@@ -127,7 +141,7 @@ Module {
name: "QQuickContainer"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Container 1.0"]
+ exports: ["QtQuick.Templates/Container 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
@@ -167,7 +181,7 @@ Module {
name: "QQuickControl"
defaultProperty: "data"
prototype: "QQuickItem"
- exports: ["Qt.labs.templates/Control 1.0"]
+ exports: ["QtQuick.Templates/Control 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "font"; type: "QFont" }
Property { name: "availableWidth"; type: "double"; isReadonly: true }
@@ -180,7 +194,12 @@ Module {
Property { name: "spacing"; type: "double" }
Property { name: "locale"; type: "QLocale" }
Property { name: "mirrored"; type: "bool"; isReadonly: true }
+ Property { name: "focusPolicy"; type: "Qt::FocusPolicy" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Property { name: "visualFocus"; type: "bool"; isReadonly: true }
+ Property { name: "hovered"; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; type: "bool" }
+ Property { name: "wheelEnabled"; type: "bool" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
}
@@ -188,7 +207,7 @@ Module {
name: "QQuickDial"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Dial 1.0"]
+ exports: ["QtQuick.Templates/Dial 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "SnapMode"
@@ -205,6 +224,7 @@ Module {
Property { name: "angle"; type: "double"; isReadonly: true }
Property { name: "stepSize"; type: "double" }
Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "wrap"; type: "bool" }
Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Method { name: "increase" }
@@ -212,31 +232,26 @@ Module {
}
Component {
name: "QQuickDrawer"
- defaultProperty: "contentItem"
- prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Drawer 1.0"]
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["QtQuick.Templates/Drawer 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "edge"; type: "Qt::Edge" }
Property { name: "position"; type: "double" }
- Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
- Property { name: "animation"; type: "QQuickPropertyAnimation"; isPointer: true }
- Signal { name: "clicked" }
- Method { name: "open" }
- Method { name: "close" }
+ Property { name: "dragMargin"; type: "double" }
}
Component {
name: "QQuickFrame"
defaultProperty: "contentData"
prototype: "QQuickPane"
- exports: ["Qt.labs.templates/Frame 1.0"]
+ exports: ["QtQuick.Templates/Frame 2.0"]
exportMetaObjectRevisions: [0]
- Property { name: "frame"; type: "QQuickItem"; isPointer: true }
}
Component {
name: "QQuickGroupBox"
defaultProperty: "contentData"
prototype: "QQuickFrame"
- exports: ["Qt.labs.templates/GroupBox 1.0"]
+ exports: ["QtQuick.Templates/GroupBox 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "title"; type: "string" }
Property { name: "label"; type: "QQuickItem"; isPointer: true }
@@ -251,17 +266,184 @@ Module {
Signal { name: "implicitHeightChanged2"; revision: 1 }
}
Component {
+ name: "QQuickItem"
+ defaultProperty: "data"
+ prototype: "QObject"
+ Enum {
+ name: "TransformOrigin"
+ values: {
+ "TopLeft": 0,
+ "Top": 1,
+ "TopRight": 2,
+ "Left": 3,
+ "Center": 4,
+ "Right": 5,
+ "BottomLeft": 6,
+ "Bottom": 7,
+ "BottomRight": 8
+ }
+ }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapToGlobal"
+ revision: 7
+ type: "QPointF"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromGlobal"
+ revision: 7
+ type: "QPointF"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
name: "QQuickItemDelegate"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/ItemDelegate 1.0"]
+ exports: ["QtQuick.Templates/ItemDelegate 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "highlighted"; type: "bool" }
}
Component {
name: "QQuickLabel"
defaultProperty: "data"
prototype: "QQuickText"
- exports: ["Qt.labs.templates/Label 1.0"]
+ exports: ["QtQuick.Templates/Label 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "font"; type: "QFont" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
@@ -270,7 +452,7 @@ Module {
name: "QQuickMenu"
defaultProperty: "contentData"
prototype: "QQuickPopup"
- exports: ["Qt.labs.templates/Menu 1.0"]
+ exports: ["QtQuick.Templates/Menu 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
@@ -303,15 +485,18 @@ Module {
name: "QQuickMenuItem"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/MenuItem 1.0"]
+ exports: ["QtQuick.Templates/MenuItem 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "highlighted"; type: "bool" }
Signal { name: "triggered" }
}
Component {
name: "QQuickOverlay"
defaultProperty: "data"
prototype: "QQuickItem"
- Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Property { name: "modal"; type: "QQuickItem"; isPointer: true }
+ Property { name: "modeless"; type: "QQuickItem"; isPointer: true }
Signal { name: "pressed" }
Signal { name: "released" }
}
@@ -319,8 +504,9 @@ Module {
name: "QQuickPage"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Page 1.0"]
+ exports: ["QtQuick.Templates/Page 2.0"]
exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
@@ -330,7 +516,7 @@ Module {
name: "QQuickPageIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/PageIndicator 1.0"]
+ exports: ["QtQuick.Templates/PageIndicator 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "count"; type: "int" }
Property { name: "currentIndex"; type: "int" }
@@ -341,7 +527,7 @@ Module {
name: "QQuickPane"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Pane 1.0"]
+ exports: ["QtQuick.Templates/Pane 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "contentWidth"; type: "double" }
Property { name: "contentHeight"; type: "double" }
@@ -352,17 +538,17 @@ Module {
name: "QQuickPopup"
defaultProperty: "contentData"
prototype: "QObject"
- exports: ["Qt.labs.templates/Popup 1.0"]
+ exports: ["QtQuick.Templates/Popup 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "ClosePolicy"
values: {
"NoAutoClose": 0,
- "OnPressOutside": 1,
- "OnPressOutsideParent": 2,
- "OnReleaseOutside": 4,
- "OnReleaseOutsideParent": 8,
- "OnEscape": 16
+ "CloseOnPressOutside": 1,
+ "CloseOnPressOutsideParent": 2,
+ "CloseOnReleaseOutside": 4,
+ "CloseOnReleaseOutsideParent": 8,
+ "CloseOnEscape": 16
}
}
Enum {
@@ -400,6 +586,8 @@ Module {
Property { name: "leftPadding"; type: "double" }
Property { name: "rightPadding"; type: "double" }
Property { name: "bottomPadding"; type: "double" }
+ Property { name: "locale"; type: "QLocale" }
+ Property { name: "font"; type: "QFont" }
Property { name: "parent"; type: "QQuickItem"; isPointer: true }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
@@ -409,6 +597,7 @@ Module {
Property { name: "focus"; type: "bool" }
Property { name: "activeFocus"; type: "bool"; isReadonly: true }
Property { name: "modal"; type: "bool" }
+ Property { name: "dim"; type: "bool" }
Property { name: "visible"; type: "bool" }
Property { name: "opacity"; type: "double" }
Property { name: "scale"; type: "double" }
@@ -416,8 +605,14 @@ Module {
Property { name: "transformOrigin"; type: "TransformOrigin" }
Property { name: "enter"; type: "QQuickTransition"; isPointer: true }
Property { name: "exit"; type: "QQuickTransition"; isPointer: true }
+ Signal {
+ name: "windowChanged"
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
Signal { name: "aboutToShow" }
Signal { name: "aboutToHide" }
+ Signal { name: "opened" }
+ Signal { name: "closed" }
Method { name: "open" }
Method { name: "close" }
}
@@ -425,7 +620,7 @@ Module {
name: "QQuickProgressBar"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ProgressBar 1.0"]
+ exports: ["QtQuick.Templates/ProgressBar 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "from"; type: "double" }
Property { name: "to"; type: "double" }
@@ -433,20 +628,26 @@ Module {
Property { name: "position"; type: "double"; isReadonly: true }
Property { name: "visualPosition"; type: "double"; isReadonly: true }
Property { name: "indeterminate"; type: "bool" }
- Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
}
Component {
name: "QQuickRadioButton"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/RadioButton 1.0"]
+ exports: ["QtQuick.Templates/RadioButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickRadioDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/RadioDelegate 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
name: "QQuickRangeSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/RangeSlider 1.0"]
+ exports: ["QtQuick.Templates/RangeSlider 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "SnapMode"
@@ -463,7 +664,6 @@ Module {
Property { name: "stepSize"; type: "double" }
Property { name: "snapMode"; type: "SnapMode" }
Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "track"; type: "QQuickItem"; isPointer: true }
Method {
name: "setValues"
Parameter { name: "firstValue"; type: "double" }
@@ -482,18 +682,33 @@ Module {
Method { name: "decrease" }
}
Component {
+ name: "QQuickRootItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Method {
+ name: "setWidth"
+ Parameter { name: "w"; type: "int" }
+ }
+ Method {
+ name: "setHeight"
+ Parameter { name: "h"; type: "int" }
+ }
+ }
+ Component {
name: "QQuickScrollBar"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ScrollBar 1.0"]
+ exports: ["QtQuick.Templates/ScrollBar 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickScrollBarAttached"
Property { name: "size"; type: "double" }
Property { name: "position"; type: "double" }
+ Property { name: "stepSize"; type: "double" }
Property { name: "active"; type: "bool" }
Property { name: "pressed"; type: "bool" }
Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "handle"; type: "QQuickItem"; isPointer: true }
+ Method { name: "increase" }
+ Method { name: "decrease" }
Method {
name: "setSize"
Parameter { name: "size"; type: "double" }
@@ -513,14 +728,13 @@ Module {
name: "QQuickScrollIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/ScrollIndicator 1.0"]
+ exports: ["QtQuick.Templates/ScrollIndicator 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickScrollIndicatorAttached"
Property { name: "size"; type: "double" }
Property { name: "position"; type: "double" }
Property { name: "active"; type: "bool" }
Property { name: "orientation"; type: "Qt::Orientation" }
- Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Method {
name: "setSize"
Parameter { name: "size"; type: "double" }
@@ -540,7 +754,7 @@ Module {
name: "QQuickSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Slider 1.0"]
+ exports: ["QtQuick.Templates/Slider 2.0"]
exportMetaObjectRevisions: [0]
Enum {
name: "SnapMode"
@@ -560,7 +774,6 @@ Module {
Property { name: "pressed"; type: "bool" }
Property { name: "orientation"; type: "Qt::Orientation" }
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
- Property { name: "track"; type: "QQuickItem"; isPointer: true }
Method { name: "increase" }
Method { name: "decrease" }
}
@@ -568,12 +781,13 @@ Module {
name: "QQuickSpinBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/SpinBox 1.0"]
+ exports: ["QtQuick.Templates/SpinBox 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "from"; type: "int" }
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
Property { name: "stepSize"; type: "int" }
+ Property { name: "editable"; type: "bool" }
Property { name: "validator"; type: "QValidator"; isPointer: true }
Property { name: "textFromValue"; type: "QJSValue" }
Property { name: "valueFromText"; type: "QJSValue" }
@@ -599,7 +813,7 @@ Module {
name: "QQuickStackView"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/StackView 1.0"]
+ exports: ["QtQuick.Templates/StackView 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickStackAttached"
Enum {
@@ -672,10 +886,30 @@ Module {
}
}
Component {
+ name: "QQuickSwipe"
+ prototype: "QObject"
+ Property { name: "position"; type: "double"; isReadonly: true }
+ Property { name: "complete"; type: "bool"; isReadonly: true }
+ Property { name: "left"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "behind"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "right"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "leftItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "behindItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "rightItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickSwipeDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/SwipeDelegate 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "swipe"; type: "QQuickSwipe"; isReadonly: true; isPointer: true }
+ }
+ Component {
name: "QQuickSwipeView"
defaultProperty: "contentData"
prototype: "QQuickContainer"
- exports: ["Qt.labs.templates/SwipeView 1.0"]
+ exports: ["QtQuick.Templates/SwipeView 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickSwipeViewAttached"
}
@@ -690,7 +924,16 @@ Module {
name: "QQuickSwitch"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/Switch 1.0"]
+ exports: ["QtQuick.Templates/Switch 2.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "position"; type: "double" }
+ Property { name: "visualPosition"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickSwitchDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickItemDelegate"
+ exports: ["QtQuick.Templates/SwitchDelegate 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "position"; type: "double" }
Property { name: "visualPosition"; type: "double"; isReadonly: true }
@@ -699,14 +942,22 @@ Module {
name: "QQuickTabBar"
defaultProperty: "contentData"
prototype: "QQuickContainer"
- exports: ["Qt.labs.templates/TabBar 1.0"]
+ exports: ["QtQuick.Templates/TabBar 2.0"]
exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Position"
+ values: {
+ "Header": 0,
+ "Footer": 1
+ }
+ }
+ Property { name: "position"; type: "Position" }
}
Component {
name: "QQuickTabButton"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
- exports: ["Qt.labs.templates/TabButton 1.0"]
+ exports: ["QtQuick.Templates/TabButton 2.0"]
exportMetaObjectRevisions: [0]
}
Component {
@@ -841,23 +1092,23 @@ Module {
}
Signal {
name: "styleChanged"
- Parameter { name: "style"; type: "TextStyle" }
+ Parameter { name: "style"; type: "QQuickText::TextStyle" }
}
Signal {
name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "HAlignment" }
+ Parameter { name: "alignment"; type: "QQuickText::HAlignment" }
}
Signal {
name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "VAlignment" }
+ Parameter { name: "alignment"; type: "QQuickText::VAlignment" }
}
Signal {
name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "TextFormat" }
+ Parameter { name: "textFormat"; type: "QQuickText::TextFormat" }
}
Signal {
name: "elideModeChanged"
- Parameter { name: "mode"; type: "TextElideMode" }
+ Parameter { name: "mode"; type: "QQuickText::TextElideMode" }
}
Signal { name: "contentSizeChanged" }
Signal {
@@ -890,20 +1141,28 @@ Module {
name: "QQuickTextArea"
defaultProperty: "data"
prototype: "QQuickTextEdit"
- exports: ["Qt.labs.templates/TextArea 1.0"]
+ exports: ["QtQuick.Templates/TextArea 2.0"]
exportMetaObjectRevisions: [0]
+ attachedType: "QQuickTextAreaAttached"
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
Property { name: "implicitHeight"; type: "double" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Signal { name: "implicitWidthChanged3" }
+ Signal { name: "implicitHeightChanged3" }
Signal {
name: "pressAndHold"
Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
}
Component {
+ name: "QQuickTextAreaAttached"
+ prototype: "QObject"
+ Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true }
+ }
+ Component {
name: "QQuickTextEdit"
defaultProperty: "data"
prototype: "QQuickImplicitSizeItem"
@@ -1006,6 +1265,8 @@ Module {
Property { name: "leftPadding"; revision: 6; type: "double" }
Property { name: "rightPadding"; revision: 6; type: "double" }
Property { name: "bottomPadding"; revision: 6; type: "double" }
+ Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
+ Signal { name: "preeditTextChanged"; revision: 7 }
Signal { name: "contentSizeChanged" }
Signal {
name: "colorChanged"
@@ -1117,6 +1378,7 @@ Module {
revision: 2
Parameter { name: "text"; type: "string" }
}
+ Method { name: "clear"; revision: 7 }
Method {
name: "inputMethodQuery"
revision: 4
@@ -1168,7 +1430,7 @@ Module {
name: "QQuickTextField"
defaultProperty: "data"
prototype: "QQuickTextInput"
- exports: ["Qt.labs.templates/TextField 1.0"]
+ exports: ["QtQuick.Templates/TextField 2.0"]
exportMetaObjectRevisions: [0]
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
@@ -1176,6 +1438,8 @@ Module {
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Signal { name: "implicitWidthChanged3" }
+ Signal { name: "implicitHeightChanged3" }
Signal {
name: "pressAndHold"
Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
@@ -1269,6 +1533,7 @@ Module {
Property { name: "passwordCharacter"; type: "string" }
Property { name: "passwordMaskDelay"; revision: 3; type: "int" }
Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "preeditText"; revision: 7; type: "string"; isReadonly: true }
Property { name: "autoScroll"; type: "bool" }
Property { name: "selectByMouse"; type: "bool" }
Property { name: "mouseSelectionMode"; type: "SelectionMode" }
@@ -1293,11 +1558,11 @@ Module {
}
Signal {
name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "HAlignment" }
+ Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" }
}
Signal {
name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "VAlignment" }
+ Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" }
}
Signal {
name: "readOnlyChanged"
@@ -1317,13 +1582,14 @@ Module {
}
Signal {
name: "echoModeChanged"
- Parameter { name: "echoMode"; type: "EchoMode" }
+ Parameter { name: "echoMode"; type: "QQuickTextInput::EchoMode" }
}
Signal {
name: "passwordMaskDelayChanged"
revision: 3
Parameter { name: "delay"; type: "int" }
}
+ Signal { name: "preeditTextChanged"; revision: 7 }
Signal {
name: "activeFocusOnPressChanged"
Parameter { name: "activeFocusOnPress"; type: "bool" }
@@ -1338,7 +1604,7 @@ Module {
}
Signal {
name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "SelectionMode" }
+ Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" }
}
Signal { name: "contentSizeChanged" }
Signal { name: "paddingChanged"; revision: 6 }
@@ -1380,6 +1646,7 @@ Module {
revision: 3
Parameter { name: "position"; type: "int" }
}
+ Method { name: "clear"; revision: 7 }
Method {
name: "positionAt"
Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
@@ -1416,21 +1683,61 @@ Module {
name: "QQuickToolBar"
defaultProperty: "contentData"
prototype: "QQuickFrame"
- exports: ["Qt.labs.templates/ToolBar 1.0"]
+ exports: ["QtQuick.Templates/ToolBar 2.0"]
exportMetaObjectRevisions: [0]
+ Enum {
+ name: "Position"
+ values: {
+ "Header": 0,
+ "Footer": 1
+ }
+ }
+ Property { name: "position"; type: "Position" }
}
Component {
name: "QQuickToolButton"
defaultProperty: "data"
prototype: "QQuickButton"
- exports: ["Qt.labs.templates/ToolButton 1.0"]
+ exports: ["QtQuick.Templates/ToolButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickToolTip"
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["QtQuick.Templates/ToolTip 2.0"]
exportMetaObjectRevisions: [0]
+ attachedType: "QQuickToolTipAttached"
+ Property { name: "delay"; type: "int" }
+ Property { name: "timeout"; type: "int" }
+ Property { name: "text"; type: "string" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
+ name: "QQuickToolTipAttached"
+ prototype: "QObject"
+ Property { name: "text"; type: "string" }
+ Property { name: "delay"; type: "int" }
+ Property { name: "timeout"; type: "int" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "toolTip"; type: "QQuickToolTip"; isReadonly: true; isPointer: true }
+ Method {
+ name: "show"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "ms"; type: "int" }
+ }
+ Method {
+ name: "show"
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hide" }
}
Component {
name: "QQuickTumbler"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["Qt.labs.templates/Tumbler 1.0"]
+ exports: ["QtQuick.Templates/Tumbler 2.0"]
exportMetaObjectRevisions: [0]
attachedType: "QQuickTumblerAttached"
Property { name: "model"; type: "QVariant" }
diff --git a/src/imports/templates/qmldir b/src/imports/templates/qmldir
index 74dcf0ff..afb94818 100644
--- a/src/imports/templates/qmldir
+++ b/src/imports/templates/qmldir
@@ -1,4 +1,4 @@
-module Qt.labs.templates
-plugin qtlabstemplatesplugin
-classname QtLabsTemplatesPlugin
+module QtQuick.Templates
+plugin qtquicktemplates2plugin
+classname QtQuickTemplates2Plugin
depends QtQuick.Window 2.2
diff --git a/src/imports/templates/qtlabstemplatesplugin.cpp b/src/imports/templates/qtlabstemplatesplugin.cpp
deleted file mode 100644
index efc757e8..00000000
--- a/src/imports/templates/qtlabstemplatesplugin.cpp
+++ /dev/null
@@ -1,144 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtQml/qqmlextensionplugin.h>
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-#include <QtLabsTemplates/private/qquickapplicationwindow_p.h>
-#include <QtLabsTemplates/private/qquickbusyindicator_p.h>
-#include <QtLabsTemplates/private/qquickbutton_p.h>
-#include <QtLabsTemplates/private/qquickcheckbox_p.h>
-#include <QtLabsTemplates/private/qquickcombobox_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtLabsTemplates/private/qquickcontainer_p.h>
-#include <QtLabsTemplates/private/qquickdial_p.h>
-#include <QtLabsTemplates/private/qquickdrawer_p.h>
-#include <QtLabsTemplates/private/qquickframe_p.h>
-#include <QtLabsTemplates/private/qquickgroupbox_p.h>
-#include <QtLabsTemplates/private/qquickitemdelegate_p.h>
-#include <QtLabsTemplates/private/qquicklabel_p.h>
-#include <QtLabsTemplates/private/qquickmenu_p.h>
-#include <QtLabsTemplates/private/qquickmenuitem_p.h>
-#include <QtLabsTemplates/private/qquickoverlay_p.h>
-#include <QtLabsTemplates/private/qquickpage_p.h>
-#include <QtLabsTemplates/private/qquickpageindicator_p.h>
-#include <QtLabsTemplates/private/qquickpane_p.h>
-#include <QtLabsTemplates/private/qquickpopup_p.h>
-#include <QtLabsTemplates/private/qquickprogressbar_p.h>
-#include <QtLabsTemplates/private/qquickradiobutton_p.h>
-#include <QtLabsTemplates/private/qquickrangeslider_p.h>
-#include <QtLabsTemplates/private/qquickscrollbar_p.h>
-#include <QtLabsTemplates/private/qquickscrollindicator_p.h>
-#include <QtLabsTemplates/private/qquickslider_p.h>
-#include <QtLabsTemplates/private/qquickspinbox_p.h>
-#include <QtLabsTemplates/private/qquickstackview_p.h>
-#include <QtLabsTemplates/private/qquickswipeview_p.h>
-#include <QtLabsTemplates/private/qquickswitch_p.h>
-#include <QtLabsTemplates/private/qquicktabbar_p.h>
-#include <QtLabsTemplates/private/qquicktabbutton_p.h>
-#include <QtLabsTemplates/private/qquicktextarea_p.h>
-#include <QtLabsTemplates/private/qquicktextfield_p.h>
-#include <QtLabsTemplates/private/qquicktoolbar_p.h>
-#include <QtLabsTemplates/private/qquicktoolbutton_p.h>
-#include <QtLabsTemplates/private/qquicktumbler_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QtLabsTemplatesPlugin: public QQmlExtensionPlugin
-{
- Q_OBJECT
- Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
-
-public:
- void registerTypes(const char *uri);
-};
-
-void QtLabsTemplatesPlugin::registerTypes(const char *uri)
-{
- qmlRegisterType<QQuickAbstractButton>(uri, 1, 0, "AbstractButton");
- qmlRegisterType<QQuickApplicationWindow>(uri, 1, 0, "ApplicationWindow");
- qmlRegisterType<QQuickApplicationWindowAttached>();
- qmlRegisterType<QQuickBusyIndicator>(uri, 1, 0, "BusyIndicator");
- qmlRegisterType<QQuickButton>(uri, 1, 0, "Button");
- qmlRegisterType<QQuickCheckBox>(uri, 1, 0, "CheckBox");
- qmlRegisterType<QQuickComboBox>(uri, 1, 0, "ComboBox");
- qmlRegisterType<QQuickContainer>(uri, 1, 0, "Container");
- qmlRegisterType<QQuickControl>(uri, 1, 0, "Control");
- qmlRegisterType<QQuickDial>(uri, 1, 0, "Dial");
- qmlRegisterType<QQuickDrawer>(uri, 1, 0, "Drawer");
- qmlRegisterType<QQuickFrame>(uri, 1, 0, "Frame");
- qmlRegisterType<QQuickGroupBox>(uri, 1, 0, "GroupBox");
- qmlRegisterType<QQuickItemDelegate>(uri, 1, 0, "ItemDelegate");
- qmlRegisterType<QQuickLabel>(uri, 1, 0, "Label");
- qmlRegisterType<QQuickMenu>(uri, 1, 0, "Menu");
- qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem");
- qmlRegisterType<QQuickOverlay>();
- qmlRegisterType<QQuickPage>(uri, 1, 0, "Page");
- qmlRegisterType<QQuickPageIndicator>(uri, 1, 0, "PageIndicator");
- qmlRegisterType<QQuickPane>(uri, 1, 0, "Pane");
- qmlRegisterType<QQuickPopup>(uri, 1, 0, "Popup");
- qmlRegisterType<QQuickProgressBar>(uri, 1, 0, "ProgressBar");
- qmlRegisterType<QQuickRadioButton>(uri, 1, 0, "RadioButton");
- qmlRegisterType<QQuickRangeSlider>(uri, 1, 0, "RangeSlider");
- qmlRegisterType<QQuickRangeSliderNode>();
- qmlRegisterType<QQuickScrollBar>(uri, 1, 0, "ScrollBar");
- qmlRegisterType<QQuickScrollIndicator>(uri, 1, 0, "ScrollIndicator");
- qmlRegisterType<QQuickSlider>(uri, 1, 0, "Slider");
- qmlRegisterType<QQuickSpinBox>(uri, 1, 0, "SpinBox");
- qmlRegisterType<QQuickSpinButton>();
- qmlRegisterType<QQuickStackView>(uri, 1, 0, "StackView");
- qmlRegisterType<QQuickSwipeViewAttached>();
- qmlRegisterType<QQuickSwipeView>(uri, 1, 0, "SwipeView");
- qmlRegisterType<QQuickSwitch>(uri, 1, 0, "Switch");
- qmlRegisterType<QQuickTabBar>(uri, 1, 0, "TabBar");
- qmlRegisterType<QQuickTabButton>(uri, 1, 0, "TabButton");
- qmlRegisterType<QQuickTextArea>(uri, 1, 0, "TextArea");
- qmlRegisterType<QQuickTextField>(uri, 1, 0, "TextField");
- qmlRegisterType<QQuickToolBar>(uri, 1, 0, "ToolBar");
- qmlRegisterType<QQuickToolButton>(uri, 1, 0, "ToolButton");
- qmlRegisterType<QQuickTumblerAttached>();
- qmlRegisterType<QQuickTumbler>(uri, 1, 0, "Tumbler");
-
- qmlRegisterRevision<QQuickItem, 2>(uri, 1, 0);
- qmlRegisterRevision<QQuickWindow, 2>(uri, 1, 0);
- qmlRegisterRevision<QQuickText, 6>(uri, 1, 0);
- qmlRegisterRevision<QQuickTextInput, 6>(uri, 1, 0);
- qmlRegisterRevision<QQuickTextEdit, 6>(uri, 1, 0);
-}
-
-QT_END_NAMESPACE
-
-#include "qtlabstemplatesplugin.moc"
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
new file mode 100644
index 00000000..e93b80c7
--- /dev/null
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -0,0 +1,198 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtQml/qqmlextensionplugin.h>
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
+#include <QtQuickTemplates2/private/qquickbusyindicator_p.h>
+#include <QtQuickTemplates2/private/qquickbutton_p.h>
+#include <QtQuickTemplates2/private/qquickbuttongroup_p.h>
+#include <QtQuickTemplates2/private/qquickcheckbox_p.h>
+#include <QtQuickTemplates2/private/qquickcheckdelegate_p.h>
+#include <QtQuickTemplates2/private/qquickcombobox_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickcontainer_p.h>
+#include <QtQuickTemplates2/private/qquickdial_p.h>
+#include <QtQuickTemplates2/private/qquickdrawer_p.h>
+#include <QtQuickTemplates2/private/qquickframe_p.h>
+#include <QtQuickTemplates2/private/qquickgroupbox_p.h>
+#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
+#include <QtQuickTemplates2/private/qquicklabel_p.h>
+#include <QtQuickTemplates2/private/qquickmenu_p.h>
+#include <QtQuickTemplates2/private/qquickmenuitem_p.h>
+#include <QtQuickTemplates2/private/qquickoverlay_p.h>
+#include <QtQuickTemplates2/private/qquickpage_p.h>
+#include <QtQuickTemplates2/private/qquickpageindicator_p.h>
+#include <QtQuickTemplates2/private/qquickpane_p.h>
+#include <QtQuickTemplates2/private/qquickpopup_p.h>
+#include <QtQuickTemplates2/private/qquickprogressbar_p.h>
+#include <QtQuickTemplates2/private/qquickradiobutton_p.h>
+#include <QtQuickTemplates2/private/qquickradiodelegate_p.h>
+#include <QtQuickTemplates2/private/qquickrangeslider_p.h>
+#include <QtQuickTemplates2/private/qquickscrollbar_p.h>
+#include <QtQuickTemplates2/private/qquickscrollindicator_p.h>
+#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
+#include <QtQuickTemplates2/private/qquickslider_p.h>
+#include <QtQuickTemplates2/private/qquickspinbox_p.h>
+#include <QtQuickTemplates2/private/qquickstackview_p.h>
+#include <QtQuickTemplates2/private/qquickswipe_p.h>
+#include <QtQuickTemplates2/private/qquickswipedelegate_p.h>
+#include <QtQuickTemplates2/private/qquickswipeview_p.h>
+#include <QtQuickTemplates2/private/qquickswitch_p.h>
+#include <QtQuickTemplates2/private/qquickswitchdelegate_p.h>
+#include <QtQuickTemplates2/private/qquicktabbar_p.h>
+#include <QtQuickTemplates2/private/qquicktabbutton_p.h>
+#include <QtQuickTemplates2/private/qquicktextarea_p.h>
+#include <QtQuickTemplates2/private/qquicktextfield_p.h>
+#include <QtQuickTemplates2/private/qquicktoolbar_p.h>
+#include <QtQuickTemplates2/private/qquicktoolbutton_p.h>
+#include <QtQuickTemplates2/private/qquicktooltip_p.h>
+#include <QtQuickTemplates2/private/qquicktumbler_p.h>
+
+static inline void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_QtQuick_Templates_2);
+#endif
+}
+
+// qtdeclarative/src/quick/util/qquickshortcut.cpp
+typedef bool (*ShortcutContextMatcher)(QObject *, Qt::ShortcutContext);
+extern ShortcutContextMatcher qt_quick_shortcut_context_matcher();
+extern void qt_quick_set_shortcut_context_matcher(ShortcutContextMatcher matcher);
+
+QT_BEGIN_NAMESPACE
+
+class QtQuickTemplates2Plugin: public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtQuickTemplates2Plugin(QObject *parent = nullptr);
+ ~QtQuickTemplates2Plugin();
+
+ void registerTypes(const char *uri);
+
+private:
+ ShortcutContextMatcher originalContextMatcher;
+};
+
+QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+
+ originalContextMatcher = qt_quick_shortcut_context_matcher();
+ qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher);
+}
+
+QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin()
+{
+ qt_quick_set_shortcut_context_matcher(originalContextMatcher);
+}
+
+void QtQuickTemplates2Plugin::registerTypes(const char *uri)
+{
+ qmlRegisterType<QQuickAbstractButton>(uri, 2, 0, "AbstractButton");
+ qmlRegisterType<QQuickApplicationWindow>(uri, 2, 0, "ApplicationWindow");
+ qmlRegisterType<QQuickApplicationWindowAttached>();
+ qmlRegisterType<QQuickBusyIndicator>(uri, 2, 0, "BusyIndicator");
+ qmlRegisterType<QQuickButton>(uri, 2, 0, "Button");
+ qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
+ qmlRegisterType<QQuickButtonGroupAttached>();
+ qmlRegisterType<QQuickCheckBox>(uri, 2, 0, "CheckBox");
+ qmlRegisterType<QQuickCheckDelegate>(uri, 2, 0, "CheckDelegate");
+ qmlRegisterType<QQuickComboBox>(uri, 2, 0, "ComboBox");
+ qmlRegisterType<QQuickContainer>(uri, 2, 0, "Container");
+ qmlRegisterType<QQuickControl>(uri, 2, 0, "Control");
+ qmlRegisterType<QQuickDial>(uri, 2, 0, "Dial");
+ qmlRegisterType<QQuickDrawer>(uri, 2, 0, "Drawer");
+ qmlRegisterType<QQuickFrame>(uri, 2, 0, "Frame");
+ qmlRegisterType<QQuickGroupBox>(uri, 2, 0, "GroupBox");
+ qmlRegisterType<QQuickItemDelegate>(uri, 2, 0, "ItemDelegate");
+ qmlRegisterType<QQuickLabel>(uri, 2, 0, "Label");
+ qmlRegisterType<QQuickMenu>(uri, 2, 0, "Menu");
+ qmlRegisterType<QQuickMenuItem>(uri, 2, 0, "MenuItem");
+ qmlRegisterType<QQuickOverlay>();
+ qmlRegisterType<QQuickPage>(uri, 2, 0, "Page");
+ qmlRegisterType<QQuickPageIndicator>(uri, 2, 0, "PageIndicator");
+ qmlRegisterType<QQuickPane>(uri, 2, 0, "Pane");
+ qmlRegisterType<QQuickPopup>(uri, 2, 0, "Popup");
+ qmlRegisterType<QQuickProgressBar>(uri, 2, 0, "ProgressBar");
+ qmlRegisterType<QQuickRadioButton>(uri, 2, 0, "RadioButton");
+ qmlRegisterType<QQuickRadioDelegate>(uri, 2, 0, "RadioDelegate");
+ qmlRegisterType<QQuickRangeSlider>(uri, 2, 0, "RangeSlider");
+ qmlRegisterType<QQuickRangeSliderNode>();
+ qmlRegisterType<QQuickScrollBar>(uri, 2, 0, "ScrollBar");
+ qmlRegisterType<QQuickScrollBarAttached>();
+ qmlRegisterType<QQuickScrollIndicator>(uri, 2, 0, "ScrollIndicator");
+ qmlRegisterType<QQuickScrollIndicatorAttached>();
+ qmlRegisterType<QQuickSlider>(uri, 2, 0, "Slider");
+ qmlRegisterType<QQuickSpinBox>(uri, 2, 0, "SpinBox");
+ qmlRegisterType<QQuickSpinButton>();
+ qmlRegisterType<QQuickStackView>(uri, 2, 0, "StackView");
+ qmlRegisterType<QQuickStackAttached>();
+ qmlRegisterType<QQuickSwipeDelegate>(uri, 2, 0, "SwipeDelegate");
+ qmlRegisterType<QQuickSwipe>();
+ qmlRegisterType<QQuickSwipeViewAttached>();
+ qmlRegisterType<QQuickSwipeView>(uri, 2, 0, "SwipeView");
+ qmlRegisterType<QQuickSwitch>(uri, 2, 0, "Switch");
+ qmlRegisterType<QQuickSwitchDelegate>(uri, 2, 0, "SwitchDelegate");
+ qmlRegisterType<QQuickTabBar>(uri, 2, 0, "TabBar");
+ qmlRegisterType<QQuickTabButton>(uri, 2, 0, "TabButton");
+ qmlRegisterType<QQuickTextAreaAttached>();
+ qmlRegisterType<QQuickTextArea>(uri, 2, 0, "TextArea");
+ qmlRegisterType<QQuickTextField>(uri, 2, 0, "TextField");
+ qmlRegisterType<QQuickToolBar>(uri, 2, 0, "ToolBar");
+ qmlRegisterType<QQuickToolButton>(uri, 2, 0, "ToolButton");
+ qmlRegisterType<QQuickToolTipAttached>();
+ qmlRegisterType<QQuickToolTip>(uri, 2, 0, "ToolTip");
+ qmlRegisterType<QQuickTumblerAttached>();
+ qmlRegisterType<QQuickTumbler>(uri, 2, 0, "Tumbler");
+
+ // NOTE: register the latest revisions of all template/control base classes to
+ // make revisioned properties available to their subclasses (synced with Qt 5.7)
+ qmlRegisterRevision<QQuickItem, 7>(uri, 2, 0);
+ qmlRegisterRevision<QQuickWindow, 2>(uri, 2, 0);
+ qmlRegisterRevision<QQuickText, 6>(uri, 2, 0);
+ qmlRegisterRevision<QQuickTextInput, 7>(uri, 2, 0);
+ qmlRegisterRevision<QQuickTextEdit, 7>(uri, 2, 0);
+}
+
+QT_END_NAMESPACE
+
+#include "qtquicktemplates2plugin.moc"
diff --git a/src/imports/templates/templates.pro b/src/imports/templates/templates.pro
index 0e48168c..8785734a 100644
--- a/src/imports/templates/templates.pro
+++ b/src/imports/templates/templates.pro
@@ -1,9 +1,9 @@
-TARGET = qtlabstemplatesplugin
-TARGETPATH = Qt/labs/templates
-IMPORT_VERSION = 1.0
+TARGET = qtquicktemplates2plugin
+TARGETPATH = QtQuick/Templates.2
+IMPORT_VERSION = 2.0
QT += qml quick
-QT_PRIVATE += core-private gui-private qml-private quick-private labstemplates-private
+QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
@@ -11,7 +11,7 @@ OTHER_FILES += \
qmldir
SOURCES += \
- $$PWD/qtlabstemplatesplugin.cpp
+ $$PWD/qtquicktemplates2plugin.cpp
CONFIG += no_cxx_module
load(qml_plugin)
diff --git a/src/quickcontrols2/qquickcolorimageprovider.cpp b/src/quickcontrols2/qquickcolorimageprovider.cpp
new file mode 100644
index 00000000..1e95b5f6
--- /dev/null
+++ b/src/quickcontrols2/qquickcolorimageprovider.cpp
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcolorimageprovider_p.h"
+
+#include <QtCore/qdebug.h>
+#include <QtGui/qpainter.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qscreen.h>
+#include <QtGui/qicon.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickColorImageProvider::QQuickColorImageProvider(const QString &path)
+ : QQuickImageProvider(Image), m_path(path)
+{
+}
+
+QImage QQuickColorImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize)
+{
+ Q_UNUSED(requestedSize);
+
+ int sep = id.indexOf(QLatin1Char('/'));
+ const QStringRef name = id.leftRef(sep);
+ qreal dpr = qApp->primaryScreen()->devicePixelRatio();
+ QString file = qt_findAtNxFile(m_path + QLatin1Char('/') + name + QLatin1String(".png"), dpr);
+
+ QImage image(file);
+ if (image.isNull()) {
+ qWarning() << "QQuickColorImageProvider: unknown id:" << id;
+ return QImage();
+ }
+
+ if (size)
+ *size = image.size();
+
+ const QString color = id.mid(sep + 1);
+ if (!color.isEmpty()) {
+ QPainter painter(&image);
+ painter.setCompositionMode(QPainter::CompositionMode_SourceIn);
+ painter.fillRect(image.rect(), QColor(color));
+ }
+
+ return image;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickcolorimageprovider_p.h b/src/quickcontrols2/qquickcolorimageprovider_p.h
new file mode 100644
index 00000000..e4a562e3
--- /dev/null
+++ b/src/quickcontrols2/qquickcolorimageprovider_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCOLORIMAGEPROVIDER_P_H
+#define QQUICKCOLORIMAGEPROVIDER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickimageprovider.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickColorImageProvider : public QQuickImageProvider
+{
+public:
+ QQuickColorImageProvider(const QString &path);
+
+ QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) override;
+
+private:
+ QString m_path;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKOCOLORIMAGEPROVIDER_P_H
diff --git a/src/quickcontrols2/qquickpaddedrectangle.cpp b/src/quickcontrols2/qquickpaddedrectangle.cpp
new file mode 100644
index 00000000..08d74dc6
--- /dev/null
+++ b/src/quickcontrols2/qquickpaddedrectangle.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpaddedrectangle_p.h"
+
+#include <QtQuick/private/qsgadaptationlayer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickPaddedRectangle::QQuickPaddedRectangle(QQuickItem *parent) :
+ QQuickRectangle(parent), m_padding(0),
+ m_topPadding(0), m_leftPadding(0), m_rightPadding(0), m_bottomPadding(0),
+ m_hasTopPadding(false), m_hasLeftPadding(false), m_hasRightPadding(false), m_hasBottomPadding(false)
+{
+}
+
+qreal QQuickPaddedRectangle::padding() const
+{
+ return m_padding;
+}
+
+void QQuickPaddedRectangle::setPadding(qreal padding)
+{
+ if (!qFuzzyCompare(m_padding, padding)) {
+ m_padding = padding;
+ update();
+ emit paddingChanged();
+ if (m_hasTopPadding)
+ emit topPaddingChanged();
+ if (!m_hasLeftPadding)
+ emit leftPaddingChanged();
+ if (!m_hasRightPadding)
+ emit rightPaddingChanged();
+ if (!m_hasBottomPadding)
+ emit bottomPaddingChanged();
+ }
+}
+
+void QQuickPaddedRectangle::resetPadding()
+{
+ setPadding(0);
+}
+
+qreal QQuickPaddedRectangle::topPadding() const
+{
+ return m_hasTopPadding ? m_topPadding : m_padding;
+}
+
+void QQuickPaddedRectangle::setTopPadding(qreal padding)
+{
+ setTopPadding(padding, true);
+}
+
+void QQuickPaddedRectangle::resetTopPadding()
+{
+ setTopPadding(0, false);
+}
+
+qreal QQuickPaddedRectangle::leftPadding() const
+{
+ return m_hasLeftPadding ? m_leftPadding : m_padding;
+}
+
+void QQuickPaddedRectangle::setLeftPadding(qreal padding)
+{
+ setLeftPadding(padding, true);
+}
+
+void QQuickPaddedRectangle::resetLeftPadding()
+{
+ setLeftPadding(0, false);
+}
+
+qreal QQuickPaddedRectangle::rightPadding() const
+{
+ return m_hasRightPadding ? m_rightPadding : m_padding;
+}
+
+void QQuickPaddedRectangle::setRightPadding(qreal padding)
+{
+ setRightPadding(padding, true);
+}
+
+void QQuickPaddedRectangle::resetRightPadding()
+{
+ setRightPadding(0, false);
+}
+
+qreal QQuickPaddedRectangle::bottomPadding() const
+{
+ return m_hasBottomPadding ? m_bottomPadding : m_padding;
+}
+
+void QQuickPaddedRectangle::setBottomPadding(qreal padding)
+{
+ setBottomPadding(padding, true);
+}
+
+void QQuickPaddedRectangle::resetBottomPadding()
+{
+ setBottomPadding(0, false);
+}
+
+void QQuickPaddedRectangle::setTopPadding(qreal padding, bool has)
+{
+ qreal oldPadding = topPadding();
+ m_hasTopPadding = has;
+ m_topPadding = padding;
+ if (!qFuzzyCompare(oldPadding, padding)) {
+ update();
+ emit topPaddingChanged();
+ }
+}
+
+void QQuickPaddedRectangle::setLeftPadding(qreal padding, bool has)
+{
+ qreal oldPadding = leftPadding();
+ m_hasLeftPadding = has;
+ m_leftPadding = padding;
+ if (!qFuzzyCompare(oldPadding, padding)) {
+ update();
+ emit leftPaddingChanged();
+ }
+}
+
+void QQuickPaddedRectangle::setRightPadding(qreal padding, bool has)
+{
+ qreal oldPadding = rightPadding();
+ m_hasRightPadding = has;
+ m_rightPadding = padding;
+ if (!qFuzzyCompare(oldPadding, padding)) {
+ update();
+ emit rightPaddingChanged();
+ }
+}
+
+void QQuickPaddedRectangle::setBottomPadding(qreal padding, bool has)
+{
+ qreal oldPadding = bottomPadding();
+ m_hasBottomPadding = has;
+ m_bottomPadding = padding;
+ if (!qFuzzyCompare(oldPadding, padding)) {
+ update();
+ emit bottomPaddingChanged();
+ }
+}
+
+QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
+{
+ QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(node);
+ if (!transformNode)
+ transformNode = new QSGTransformNode;
+
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data));
+
+ if (rectNode) {
+ if (!transformNode->firstChild())
+ transformNode->appendChildNode(rectNode);
+
+ qreal top = topPadding();
+ qreal left = leftPadding();
+ qreal right = rightPadding();
+ qreal bottom = bottomPadding();
+
+ if (!qFuzzyIsNull(top) || !qFuzzyIsNull(left) || !qFuzzyIsNull(right) || !qFuzzyIsNull(bottom)) {
+ QMatrix4x4 m;
+ m.translate(left, top);
+ transformNode->setMatrix(m);
+
+ rectNode->setRect(boundingRect().adjusted(0, 0, -left-right, -top-bottom));
+ rectNode->update();
+ }
+ }
+ return transformNode;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickpaddedrectangle_p.h b/src/quickcontrols2/qquickpaddedrectangle_p.h
new file mode 100644
index 00000000..4f1cb303
--- /dev/null
+++ b/src/quickcontrols2/qquickpaddedrectangle_p.h
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPADDEDRECTANGLE_P_H
+#define QQUICKPADDEDRECTANGLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickPaddedRectangle : public QQuickRectangle
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
+ Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
+ Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
+ Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
+ Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
+
+public:
+ QQuickPaddedRectangle(QQuickItem *parent = nullptr);
+
+ qreal padding() const;
+ void setPadding(qreal padding);
+ void resetPadding();
+
+ qreal topPadding() const;
+ void setTopPadding(qreal padding);
+ void resetTopPadding();
+
+ qreal leftPadding() const;
+ void setLeftPadding(qreal padding);
+ void resetLeftPadding();
+
+ qreal rightPadding() const;
+ void setRightPadding(qreal padding);
+ void resetRightPadding();
+
+ qreal bottomPadding() const;
+ void setBottomPadding(qreal padding);
+ void resetBottomPadding();
+
+Q_SIGNALS:
+ void paddingChanged();
+ void topPaddingChanged();
+ void leftPaddingChanged();
+ void rightPaddingChanged();
+ void bottomPaddingChanged();
+
+protected:
+ QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *) override;
+
+private:
+ void setTopPadding(qreal padding, bool has);
+ void setLeftPadding(qreal padding, bool has);
+ void setRightPadding(qreal padding, bool has);
+ void setBottomPadding(qreal padding, bool has);
+
+ qreal m_padding;
+ qreal m_topPadding;
+ qreal m_leftPadding;
+ qreal m_rightPadding;
+ qreal m_bottomPadding;
+ bool m_hasTopPadding;
+ bool m_hasLeftPadding;
+ bool m_hasRightPadding;
+ bool m_hasBottomPadding;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPaddedRectangle)
+
+#endif // QQUICKPADDEDRECTANGLE_P_H
diff --git a/src/quickcontrols2/qquickproxytheme.cpp b/src/quickcontrols2/qquickproxytheme.cpp
new file mode 100644
index 00000000..da4f2a2e
--- /dev/null
+++ b/src/quickcontrols2/qquickproxytheme.cpp
@@ -0,0 +1,168 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickproxytheme_p.h"
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpixmap.h>
+#include <QtGui/qfont.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickProxyTheme::QQuickProxyTheme(QPlatformTheme *theme)
+ : m_theme(theme ? theme : QGuiApplicationPrivate::platform_theme)
+{
+}
+
+QQuickProxyTheme::~QQuickProxyTheme()
+{
+ if (QGuiApplicationPrivate::platform_theme == this)
+ QGuiApplicationPrivate::platform_theme = m_theme;
+}
+
+QPlatformTheme *QQuickProxyTheme::theme() const
+{
+ return m_theme;
+}
+
+QPlatformMenuItem *QQuickProxyTheme::createPlatformMenuItem() const
+{
+ if (m_theme)
+ return m_theme->createPlatformMenuItem();
+ return QPlatformTheme::createPlatformMenuItem();
+}
+
+QPlatformMenu *QQuickProxyTheme::createPlatformMenu() const
+{
+ if (m_theme)
+ return m_theme->createPlatformMenu();
+ return QPlatformTheme::createPlatformMenu();
+}
+
+QPlatformMenuBar *QQuickProxyTheme::createPlatformMenuBar() const
+{
+ if (m_theme)
+ return m_theme->createPlatformMenuBar();
+ return QPlatformTheme::createPlatformMenuBar();
+}
+
+void QQuickProxyTheme::showPlatformMenuBar()
+{
+ if (m_theme)
+ m_theme->showPlatformMenuBar();
+ QPlatformTheme::showPlatformMenuBar();
+}
+
+bool QQuickProxyTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
+{
+ if (m_theme)
+ return m_theme->usePlatformNativeDialog(type);
+ return QPlatformTheme::usePlatformNativeDialog(type);
+}
+
+QPlatformDialogHelper *QQuickProxyTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const
+{
+ if (m_theme)
+ return m_theme->createPlatformDialogHelper(type);
+ return QPlatformTheme::createPlatformDialogHelper(type);
+}
+
+#ifndef QT_NO_SYSTEMTRAYICON
+QPlatformSystemTrayIcon *QQuickProxyTheme::createPlatformSystemTrayIcon() const
+{
+ if (m_theme)
+ return m_theme->createPlatformSystemTrayIcon();
+ return QPlatformTheme::createPlatformSystemTrayIcon();
+}
+#endif
+
+const QPalette *QQuickProxyTheme::palette(QPlatformTheme::Palette type) const
+{
+ if (m_theme)
+ return m_theme->palette(type);
+ return QPlatformTheme::palette(type);
+}
+
+const QFont *QQuickProxyTheme::font(QPlatformTheme::Font type) const
+{
+ if (m_theme)
+ return m_theme->font(type);
+ return QPlatformTheme::font(type);
+}
+
+QVariant QQuickProxyTheme::themeHint(QPlatformTheme::ThemeHint hint) const
+{
+ if (m_theme)
+ return m_theme->themeHint(hint);
+ return QPlatformTheme::themeHint(hint);
+}
+
+QPixmap QQuickProxyTheme::standardPixmap(QPlatformTheme::StandardPixmap sp, const QSizeF &size) const
+{
+ if (m_theme)
+ return m_theme->standardPixmap(sp, size);
+ return QPlatformTheme::standardPixmap(sp, size);
+}
+
+QPixmap QQuickProxyTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, QPlatformTheme::IconOptions iconOptions) const
+{
+ if (m_theme)
+ return m_theme->fileIconPixmap(fileInfo, size, iconOptions);
+ return QPlatformTheme::fileIconPixmap(fileInfo, size, iconOptions);
+}
+
+QIconEngine *QQuickProxyTheme::createIconEngine(const QString &iconName) const
+{
+ if (m_theme)
+ return m_theme->createIconEngine(iconName);
+ return QPlatformTheme::createIconEngine(iconName);
+}
+
+QList<QKeySequence> QQuickProxyTheme::keyBindings(QKeySequence::StandardKey key) const
+{
+ if (m_theme)
+ return m_theme->keyBindings(key);
+ return QPlatformTheme::keyBindings(key);
+}
+
+QString QQuickProxyTheme::standardButtonText(int button) const
+{
+ if (m_theme)
+ return m_theme->standardButtonText(button);
+ return QPlatformTheme::standardButtonText(button);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickproxytheme_p.h b/src/quickcontrols2/qquickproxytheme_p.h
new file mode 100644
index 00000000..c94417dc
--- /dev/null
+++ b/src/quickcontrols2/qquickproxytheme_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPROXYTHEME_P_H
+#define QQUICKPROXYTHEME_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickProxyTheme : public QPlatformTheme
+{
+public:
+ explicit QQuickProxyTheme(QPlatformTheme *theme = nullptr);
+ ~QQuickProxyTheme();
+
+ QPlatformTheme* theme() const;
+
+ QPlatformMenuItem* createPlatformMenuItem() const override;
+ QPlatformMenu* createPlatformMenu() const override;
+ QPlatformMenuBar* createPlatformMenuBar() const override;
+ void showPlatformMenuBar() override;
+
+ bool usePlatformNativeDialog(DialogType type) const override;
+ QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
+
+#ifndef QT_NO_SYSTEMTRAYICON
+ QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
+#endif
+
+ const QPalette *palette(Palette type = SystemPalette) const override;
+
+ const QFont *font(Font type = SystemFont) const override;
+
+ QVariant themeHint(ThemeHint hint) const override;
+
+ QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
+ QPixmap fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size,
+ QPlatformTheme::IconOptions iconOptions = 0) const override;
+
+ QIconEngine *createIconEngine(const QString &iconName) const override;
+
+ QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const override;
+
+ QString standardButtonText(int button) const override;
+
+private:
+ QPlatformTheme *m_theme;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPROXYTHEME_P_H
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
new file mode 100644
index 00000000..143f599a
--- /dev/null
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -0,0 +1,220 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstyle.h"
+#include "qquickstyleattached_p.h"
+
+#include <QtCore/qdir.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qsettings.h>
+#include <QtCore/qlibraryinfo.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQml/private/qqmlmetatype_p.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlfile.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class QQuickStyle
+ \brief The QQuickStyle class allows configuring the application style.
+ \inmodule QtQuickControls2
+ \since 5.7
+
+ QQuickStyle provides API for querying and configuring the application
+ \l {Styling Qt Quick Controls 2}{styles} of Qt Quick Controls 2.
+
+ \code
+ #include <QGuiApplication>
+ #include <QQmlApplicationEngine>
+ #include <QQuickStyle>
+
+ int main(int argc, char *argv[])
+ {
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QGuiApplication app(argc, argv);
+
+ QQuickStyle::setStyle("Material");
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/main.qml"));
+
+ return app.exec();
+ }
+ \endcode
+
+ \note The style must be configured \b before loading QML that imports
+ Qt Quick Controls 2. It is not possible to change the style after the QML
+ types have been registered.
+
+ \sa {Styling Qt Quick Controls 2}
+*/
+
+// TODO: QQmlImportDatabase::defaultImportPathList()
+static QStringList defaultImportPathList()
+{
+ QStringList importPaths;
+ importPaths.reserve(3);
+ importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+ const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
+ importPaths += QString::fromLatin1(envImportPath).split(QDir::listSeparator(), QString::SkipEmptyParts);
+ }
+
+ importPaths += QStringLiteral("qrc:/qt-project.org/imports");
+ importPaths += QCoreApplication::applicationDirPath();
+ return importPaths;
+}
+
+struct QQuickStyleSpec
+{
+ QQuickStyleSpec() : resolved(false) { }
+
+ QString name()
+ {
+ if (!resolved)
+ resolve();
+ return style.mid(style.lastIndexOf(QLatin1Char('/')) + 1);
+ }
+
+ QString path()
+ {
+ if (!resolved)
+ resolve();
+ QString s = style;
+ if (QQmlFile::isLocalFile(s))
+ s = QQmlFile::urlToLocalFileOrQrc(s);
+ return s.left(s.lastIndexOf(QLatin1Char('/')) + 1);
+ }
+
+ void setStyle(const QString &s)
+ {
+ style = s;
+ resolved = false;
+ resolve();
+ }
+
+ void resolve()
+ {
+ if (style.isEmpty())
+ style = QGuiApplicationPrivate::styleOverride;
+ if (style.isEmpty())
+ style = QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_STYLE"));
+ if (style.isEmpty()) {
+ QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Controls"));
+ if (settings)
+ style = settings->value(QStringLiteral("Style")).toString();
+ }
+
+ if (QGuiApplication::instance()) {
+ if (!style.contains(QLatin1Char('/'))) {
+ const QString targetPath = QStringLiteral("QtQuick/Controls.2");
+ const QStringList importPaths = defaultImportPathList();
+
+ for (const QString &importPath : importPaths) {
+ QDir importDir(importPath);
+ if (importDir.cd(targetPath)) {
+ if (style.isEmpty()) {
+ style = importDir.absolutePath() + QLatin1Char('/');
+ resolved = true;
+ break;
+ }
+ const QStringList entries = importDir.entryList(QStringList(), QDir::Dirs | QDir::NoDotAndDotDot);
+ for (const QString &entry : entries) {
+ if (entry.compare(style, Qt::CaseInsensitive) == 0) {
+ style = importDir.absoluteFilePath(entry);
+ resolved = true;
+ break;
+ }
+ }
+ }
+ if (resolved)
+ break;
+ }
+ }
+ resolved = true;
+ }
+ }
+
+ bool resolved;
+ QString style;
+};
+
+Q_GLOBAL_STATIC(QQuickStyleSpec, styleSpec)
+
+/*!
+ Returns the name of the application style.
+
+ \note The application style can be specified by passing a \c -style command
+ line argument. Therefore \c name() may not return a fully resolved
+ value if called before constructing a QGuiApplication.
+*/
+QString QQuickStyle::name()
+{
+ return styleSpec()->name();
+}
+
+/*!
+ Returns the path of an overridden application style, or an empty
+ string if the style is one of the built-in Qt Quick Controls 2 styles.
+
+ \note The application style can be specified by passing a \c -style command
+ line argument. Therefore \c path() may not return a fully resolved
+ value if called before constructing a QGuiApplication.
+*/
+QString QQuickStyle::path()
+{
+ return styleSpec()->path();
+}
+
+/*!
+ Sets the application style to \a style.
+
+ \note The style must be configured \b before loading QML that imports Qt Quick Controls 2.
+ It is not possible to change the style after the QML types have been registered.
+*/
+void QQuickStyle::setStyle(const QString &style)
+{
+ if (QQmlMetaType::isModule(QStringLiteral("QtQuick.Controls"), 2, 0)) {
+ qWarning() << "ERROR: QQuickStyle::setStyle() must be called before loading QML that imports Qt Quick Controls 2.";
+ return;
+ }
+
+ styleSpec()->setStyle(style);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle.h b/src/quickcontrols2/qquickstyle.h
new file mode 100644
index 00000000..4476a29a
--- /dev/null
+++ b/src/quickcontrols2/qquickstyle.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTYLE_H
+#define QQUICKSTYLE_H
+
+#include <QtCore/qurl.h>
+#include <QtCore/qstring.h>
+#include <QtQuickControls2/qtquickcontrols2global.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_EXPORT QQuickStyle
+{
+public:
+ static QString name();
+ static QString path();
+ static void setStyle(const QString &style);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTYLE_H
diff --git a/src/quickcontrols2/qquickstyleattached.cpp b/src/quickcontrols2/qquickstyleattached.cpp
new file mode 100644
index 00000000..e72abde0
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleattached.cpp
@@ -0,0 +1,259 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstyleattached_p.h"
+
+#include <QtCore/qfile.h>
+#include <QtCore/qsettings.h>
+#include <QtCore/qfileselector.h>
+#include <QtQuick/qquickwindow.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuickTemplates2/private/qquickpopup_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static QQuickStyleAttached *attachedStyle(const QMetaObject *type, QObject *object, bool create = false)
+{
+ if (!object)
+ return nullptr;
+ int idx = -1;
+ return qobject_cast<QQuickStyleAttached *>(qmlAttachedPropertiesObject(&idx, object, type, create));
+}
+
+static QQuickStyleAttached *findParentStyle(const QMetaObject *type, QObject *object)
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (item) {
+ // lookup parent items and popups
+ QQuickItem *parent = item->parentItem();
+ while (parent) {
+ QQuickStyleAttached *style = attachedStyle(type, parent);
+ if (style)
+ return style;
+
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent->parent());
+ if (popup)
+ return attachedStyle(type, popup);
+
+ parent = parent->parentItem();
+ }
+
+ // fallback to item's window
+ QQuickStyleAttached *style = attachedStyle(type, item->window());
+ if (style)
+ return style;
+ } else {
+ // lookup popup's window
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(object);
+ if (popup)
+ return attachedStyle(type, popup->popupItem()->window());
+ }
+
+ // lookup parent window
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(object);
+ if (window) {
+ QQuickWindow *parentWindow = qobject_cast<QQuickWindow *>(window->parent());
+ if (parentWindow) {
+ QQuickStyleAttached *style = attachedStyle(type, window);
+ if (style)
+ return style;
+ }
+ }
+
+ // fallback to engine (global)
+ if (object) {
+ QQmlEngine *engine = qmlEngine(object);
+ if (engine) {
+ QByteArray name = QByteArray("_q_") + type->className();
+ QQuickStyleAttached *style = engine->property(name).value<QQuickStyleAttached*>();
+ if (!style) {
+ style = attachedStyle(type, engine, true);
+ engine->setProperty(name, QVariant::fromValue(style));
+ }
+ return style;
+ }
+ }
+
+ return nullptr;
+}
+
+static QList<QQuickStyleAttached *> findChildStyles(const QMetaObject *type, QObject *object)
+{
+ QList<QQuickStyleAttached *> children;
+
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (!item) {
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(object);
+ if (window) {
+ item = window->contentItem();
+
+ const auto windowChildren = window->children();
+ for (QObject *child : windowChildren) {
+ QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child);
+ if (childWindow) {
+ QQuickStyleAttached *style = attachedStyle(type, childWindow);
+ if (style)
+ children += style;
+ }
+ }
+ }
+ }
+
+ if (item) {
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
+ QQuickStyleAttached *style = attachedStyle(type, child);
+ if (style)
+ children += style;
+ else
+ children += findChildStyles(type, child);
+ }
+ }
+
+ return children;
+}
+
+static QString resolveConfigFile()
+{
+ QString filePath = QFile::decodeName(qgetenv("QT_QUICK_CONTROLS_CONF"));
+ if (!QFile::exists(filePath)) {
+ if (!filePath.isEmpty())
+ qWarning("QT_QUICK_CONTROLS_CONF=%s: No such file", qPrintable(filePath));
+
+ filePath = QStringLiteral(":/qtquickcontrols2.conf");
+ }
+ return filePath;
+}
+
+QQuickStyleAttached::QQuickStyleAttached(QObject *parent) : QObject(parent)
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent);
+ if (!item) {
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent);
+ if (popup)
+ item = popup->popupItem();
+ }
+
+ if (item) {
+ connect(item, &QQuickItem::windowChanged, this, &QQuickStyleAttached::itemWindowChanged);
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
+ }
+}
+
+QQuickStyleAttached::~QQuickStyleAttached()
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent());
+ if (item) {
+ disconnect(item, &QQuickItem::windowChanged, this, &QQuickStyleAttached::itemWindowChanged);
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
+ }
+
+ setParentStyle(nullptr);
+}
+
+QSharedPointer<QSettings> QQuickStyleAttached::settings(const QString &group)
+{
+#ifndef QT_NO_SETTINGS
+ static const QString filePath = resolveConfigFile();
+ if (QFile::exists(filePath)) {
+ QFileSelector selector;
+ QSettings *settings = new QSettings(selector.select(filePath), QSettings::IniFormat);
+ if (!group.isEmpty())
+ settings->beginGroup(group);
+ return QSharedPointer<QSettings>(settings);
+ }
+#endif // QT_NO_SETTINGS
+ return QSharedPointer<QSettings>();
+}
+
+QList<QQuickStyleAttached *> QQuickStyleAttached::childStyles() const
+{
+ return m_childStyles;
+}
+
+QQuickStyleAttached *QQuickStyleAttached::parentStyle() const
+{
+ return m_parentStyle;
+}
+
+void QQuickStyleAttached::setParentStyle(QQuickStyleAttached *style)
+{
+ if (m_parentStyle != style) {
+ QQuickStyleAttached *oldParent = m_parentStyle;
+ if (m_parentStyle)
+ m_parentStyle->m_childStyles.removeOne(this);
+ m_parentStyle = style;
+ if (style)
+ style->m_childStyles.append(this);
+ parentStyleChange(style, oldParent);
+ }
+}
+
+void QQuickStyleAttached::init()
+{
+ QQuickStyleAttached *parentStyle = findParentStyle(metaObject(), parent());
+ if (parentStyle)
+ setParentStyle(parentStyle);
+
+ const QList<QQuickStyleAttached *> children = findChildStyles(metaObject(), parent());
+ for (QQuickStyleAttached *child : children)
+ child->setParentStyle(this);
+}
+
+void QQuickStyleAttached::parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent)
+{
+ Q_UNUSED(newParent);
+ Q_UNUSED(oldParent);
+}
+
+void QQuickStyleAttached::itemWindowChanged(QQuickWindow *window)
+{
+ QQuickStyleAttached *parentStyle = nullptr;
+ QQuickItem *item = qobject_cast<QQuickItem *>(sender());
+ if (item)
+ parentStyle = findParentStyle(metaObject(), item);
+ if (!parentStyle)
+ parentStyle = attachedStyle(metaObject(), window);
+ setParentStyle(parentStyle);
+}
+
+void QQuickStyleAttached::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+{
+ Q_UNUSED(parent);
+ setParentStyle(findParentStyle(metaObject(), item));
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleattached_p.h b/src/quickcontrols2/qquickstyleattached_p.h
new file mode 100644
index 00000000..13b816f2
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleattached_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTYLEATTACHED_P_H
+#define QQUICKSTYLEATTACHED_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml/qqml.h>
+#include <QtCore/qlist.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qpointer.h>
+#include <QtCore/qsharedpointer.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSettings;
+class QQuickWindow;
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStyleAttached : public QObject, public QQuickItemChangeListener
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickStyleAttached(QObject *parent = nullptr);
+ ~QQuickStyleAttached();
+
+ static QSharedPointer<QSettings> settings(const QString &group = QString());
+
+protected:
+ void init();
+
+ QList<QQuickStyleAttached *> childStyles() const;
+
+ QQuickStyleAttached *parentStyle() const;
+ void setParentStyle(QQuickStyleAttached *style);
+
+ virtual void parentStyleChange(QQuickStyleAttached *newParent, QQuickStyleAttached *oldParent);
+
+ void itemWindowChanged(QQuickWindow *window);
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
+
+private:
+ QList<QQuickStyleAttached *> m_childStyles;
+ QPointer<QQuickStyleAttached> m_parentStyle;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTYLEATTACHED_P_H
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp
new file mode 100644
index 00000000..3a4a0952
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleplugin.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstyleplugin_p.h"
+#include "qquickproxytheme_p.h"
+#include "qquickstyle.h"
+
+#include <QtGui/private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickStylePlugin::QQuickStylePlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+}
+
+QQuickStylePlugin::~QQuickStylePlugin()
+{
+}
+
+void QQuickStylePlugin::registerTypes(const char *uri)
+{
+ Q_UNUSED(uri);
+}
+
+void QQuickStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(uri);
+
+ // make sure not to re-create the proxy theme if initializeEngine()
+ // is called multiple times, like in case of qml2puppet (QTBUG-54995)
+ if (!m_theme.isNull())
+ return;
+
+ const QString style = name();
+ if (!style.isEmpty() && style.compare(QQuickStyle::name(), Qt::CaseInsensitive) == 0) {
+ m_theme.reset(createTheme());
+ if (m_theme)
+ QGuiApplicationPrivate::platform_theme = m_theme.data();
+ }
+}
+
+QString QQuickStylePlugin::name() const
+{
+ return QString();
+}
+
+QQuickProxyTheme *QQuickStylePlugin::createTheme() const
+{
+ return nullptr;
+}
+
+/*
+ Returns either a file system path if Qt was built as shared libraries,
+ or a QRC path if Qt was built statically.
+*/
+QUrl QQuickStylePlugin::typeUrl(const QString &name) const
+{
+#ifdef QT_STATIC
+ QString url = QLatin1String("qrc") + baseUrl().path();
+#else
+ QString url = baseUrl().toString();
+#endif
+ if (!name.isEmpty())
+ url += QLatin1Char('/') + name;
+ return QUrl(url);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleplugin_p.h b/src/quickcontrols2/qquickstyleplugin_p.h
new file mode 100644
index 00000000..34e262e1
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleplugin_p.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTYLEPLUGIN_P_H
+#define QQUICKSTYLEPLUGIN_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qscopedpointer.h>
+#include <QtQml/qqmlextensionplugin.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickProxyTheme;
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStylePlugin : public QQmlExtensionPlugin
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickStylePlugin(QObject *parent = nullptr);
+ ~QQuickStylePlugin();
+
+ void registerTypes(const char *uri) override;
+ void initializeEngine(QQmlEngine *engine, const char *uri) override;
+
+ virtual QString name() const;
+ virtual QQuickProxyTheme *createTheme() const;
+
+ QUrl typeUrl(const QString &name = QString()) const;
+
+private:
+ QScopedPointer<QQuickProxyTheme> m_theme;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTYLEPLUGIN_P_H
diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp
new file mode 100644
index 00000000..5210a684
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleselector.cpp
@@ -0,0 +1,165 @@
+/***************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstyleselector_p.h"
+#include "qquickstyleselector_p_p.h"
+#include "qquickstyle.h"
+
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qsysinfo.h>
+#include <QtCore/qlocale.h>
+
+#include <QtCore/private/qfileselector_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static bool isLocalScheme(const QString &scheme)
+{
+ bool local = scheme == QLatin1String("qrc");
+#ifdef Q_OS_ANDROID
+ local |= scheme == QLatin1String("assets");
+#endif
+ return local;
+}
+
+static QStringList allSelectors(const QString &style = QString())
+{
+ static const QStringList platformSelectors = QFileSelectorPrivate::platformSelectors();
+ QStringList selectors = platformSelectors;
+ selectors += QLocale().name();
+ if (!style.isEmpty())
+ selectors.prepend(style);
+ return selectors;
+}
+
+static QString selectionHelper(const QString &path, const QString &fileName, const QStringList &selectors)
+{
+ /* selectionHelper does a depth-first search of possible selected files. Because there is strict
+ selector ordering in the API, we can stop checking as soon as we find the file in a directory
+ which does not contain any other valid selector directories.
+ */
+ Q_ASSERT(path.isEmpty() || path.endsWith(QLatin1Char('/')));
+
+ for (const QString &s : selectors) {
+ QString prospectiveBase = path + s + QLatin1Char('/');
+ QStringList remainingSelectors = selectors;
+ remainingSelectors.removeAll(s);
+ if (!QDir(prospectiveBase).exists())
+ continue;
+ QString prospectiveFile = selectionHelper(prospectiveBase, fileName, remainingSelectors);
+ if (!prospectiveFile.isEmpty())
+ return prospectiveFile;
+ }
+
+ // 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.
+ const QString result = path + fileName;
+ if (!QFileInfo::exists(result))
+ return QString();
+ return result;
+}
+
+QString QQuickStyleSelectorPrivate::select(const QString &filePath) const
+{
+ QFileInfo fi(filePath);
+ // If file doesn't exist, don't select
+ if (!fi.exists())
+ return filePath;
+
+ const QString path = fi.path();
+ const QString ret = selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'),
+ fi.fileName(), allSelectors(style));
+
+ if (!ret.isEmpty())
+ return ret;
+ return filePath;
+}
+
+QQuickStyleSelector::QQuickStyleSelector() : d_ptr(new QQuickStyleSelectorPrivate)
+{
+ Q_D(QQuickStyleSelector);
+ d->style = QQuickStyle::name();
+}
+
+QQuickStyleSelector::~QQuickStyleSelector()
+{
+}
+
+QUrl QQuickStyleSelector::baseUrl() const
+{
+ Q_D(const QQuickStyleSelector);
+ return d->baseUrl;
+}
+
+void QQuickStyleSelector::setBaseUrl(const QUrl &url)
+{
+ Q_D(QQuickStyleSelector);
+ d->baseUrl = url;
+}
+
+QString QQuickStyleSelector::select(const QString &fileName) const
+{
+ Q_D(const QQuickStyleSelector);
+ const QString overridePath = QQuickStyle::path();
+ if (!overridePath.isEmpty()) {
+ const QString stylePath = overridePath + d->style + QLatin1Char('/');
+ if (QFile::exists(stylePath + fileName)) {
+ // the style name is included to the path, so exclude it from the selectors.
+ // the rest of the selectors (os, locale) are still valid, though.
+ const QString selectedPath = selectionHelper(stylePath, fileName, allSelectors());
+ if (selectedPath.startsWith(QLatin1Char(':')))
+ return QLatin1String("qrc") + selectedPath;
+ return QUrl::fromLocalFile(QFileInfo(selectedPath).absoluteFilePath()).toString();
+ }
+ }
+
+ QString base = d->baseUrl.toString();
+ if (!base.isEmpty() && !base.endsWith(QLatin1Char('/')))
+ base += QLatin1Char('/');
+
+ QUrl url(base + fileName);
+ if (isLocalScheme(url.scheme())) {
+ QString equivalentPath = QLatin1Char(':') + url.path();
+ QString selectedPath = d->select(equivalentPath);
+ url.setPath(selectedPath.remove(0, 1));
+ } else if (url.isLocalFile()) {
+ url = QUrl::fromLocalFile(d->select(url.toLocalFile()));
+ }
+ return url.toString();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleselector_p.h b/src/quickcontrols2/qquickstyleselector_p.h
new file mode 100644
index 00000000..a212477b
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleselector_p.h
@@ -0,0 +1,77 @@
+/***************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTYLESELECTOR_P_H
+#define QQUICKSTYLESELECTOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qurl.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickStyleSelectorPrivate;
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStyleSelector
+{
+public:
+ QQuickStyleSelector();
+ ~QQuickStyleSelector();
+
+ QUrl baseUrl() const;
+ void setBaseUrl(const QUrl &url);
+
+ QString select(const QString &fileName) const;
+
+private:
+ Q_DISABLE_COPY(QQuickStyleSelector)
+ Q_DECLARE_PRIVATE(QQuickStyleSelector)
+ QScopedPointer<QQuickStyleSelectorPrivate> d_ptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTYLESELECTOR_P_H
diff --git a/src/quickcontrols2/qquickstyleselector_p_p.h b/src/quickcontrols2/qquickstyleselector_p_p.h
new file mode 100644
index 00000000..cc3f0a58
--- /dev/null
+++ b/src/quickcontrols2/qquickstyleselector_p_p.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** As a special exception, The Qt Company gives you certain additional
+** rights. These rights are described in The Qt Company LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTYLESELECTOR_P_P_H
+#define QQUICKSTYLESELECTOR_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickControls2/private/qquickstyleselector_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickStyleSelectorPrivate
+{
+public:
+ QString select(const QString &filePath) const;
+
+ QUrl baseUrl;
+ QString style;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTYLESELECTOR_P_P_H
+
diff --git a/src/quickcontrols2/qtquickcontrols2global.h b/src/quickcontrols2/qtquickcontrols2global.h
new file mode 100644
index 00000000..6e6cde7c
--- /dev/null
+++ b/src/quickcontrols2/qtquickcontrols2global.h
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKCONTROLS2GLOBAL_H
+#define QTQUICKCONTROLS2GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QUICKCONTROLS2_LIB)
+# define Q_QUICKCONTROLS2_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QUICKCONTROLS2_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QUICKCONTROLS2_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKCONTROLS2GLOBAL_H
diff --git a/src/quickcontrols2/qtquickcontrols2global_p.h b/src/quickcontrols2/qtquickcontrols2global_p.h
new file mode 100644
index 00000000..9072d912
--- /dev/null
+++ b/src/quickcontrols2/qtquickcontrols2global_p.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKCONTROLS2GLOBAL_P_H
+#define QTQUICKCONTROLS2GLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickControls2/qtquickcontrols2global.h>
+
+#define Q_QUICKCONTROLS2_PRIVATE_EXPORT Q_QUICKCONTROLS2_EXPORT
+
+#endif // QTQUICKCONTROLS2GLOBAL_P_H
diff --git a/src/quickcontrols2/quickcontrols2.pri b/src/quickcontrols2/quickcontrols2.pri
new file mode 100644
index 00000000..aaf01ed6
--- /dev/null
+++ b/src/quickcontrols2/quickcontrols2.pri
@@ -0,0 +1,18 @@
+HEADERS += \
+ $$PWD/qquickcolorimageprovider_p.h \
+ $$PWD/qquickproxytheme_p.h \
+ $$PWD/qquickstyle.h \
+ $$PWD/qquickstyleattached_p.h \
+ $$PWD/qquickstyleplugin_p.h \
+ $$PWD/qquickstyleselector_p.h \
+ $$PWD/qquickstyleselector_p_p.h \
+ $$PWD/qquickpaddedrectangle_p.h
+
+SOURCES += \
+ $$PWD/qquickcolorimageprovider.cpp \
+ $$PWD/qquickproxytheme.cpp \
+ $$PWD/qquickstyle.cpp \
+ $$PWD/qquickstyleattached.cpp \
+ $$PWD/qquickstyleplugin.cpp \
+ $$PWD/qquickstyleselector.cpp \
+ $$PWD/qquickpaddedrectangle.cpp
diff --git a/src/quickcontrols2/quickcontrols2.pro b/src/quickcontrols2/quickcontrols2.pro
new file mode 100644
index 00000000..bdad3095
--- /dev/null
+++ b/src/quickcontrols2/quickcontrols2.pro
@@ -0,0 +1,14 @@
+TARGET = QtQuickControls2
+MODULE = quickcontrols2
+
+QT += quick
+QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+HEADERS += \
+ $$PWD/qtquickcontrols2global.h
+ $$PWD/qtquickcontrols2global_p.h
+
+include(quickcontrols2.pri)
+load(qt_module)
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
new file mode 100644
index 00000000..75854d04
--- /dev/null
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -0,0 +1,640 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickabstractbutton_p.h"
+#include "qquickabstractbutton_p_p.h"
+#include "qquickbuttongroup_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/qguiapplication.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+#include <QtQml/qqmllist.h>
+
+QT_BEGIN_NAMESPACE
+
+// copied from qabstractbutton.cpp
+static const int AUTO_REPEAT_DELAY = 300;
+static const int AUTO_REPEAT_INTERVAL = 100;
+
+/*!
+ \qmltype AbstractButton
+ \inherits Control
+ \instantiates QQuickAbstractButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-buttons
+ \brief Abstract base type providing functionality common to buttons.
+
+ AbstractButton provides the interface for controls with button-like
+ behavior; for example, push buttons and checkable controls like
+ radio buttons and check boxes. As an abstract control, it has no delegate
+ implementations, leaving them to the types that derive from it.
+
+ \sa ButtonGroup, {Button Controls}
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::AbstractButton::pressed()
+
+ This signal is emitted when the button is interactively pressed by the user.
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::AbstractButton::released()
+
+ This signal is emitted when the button is interactively released by the user.
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::AbstractButton::canceled()
+
+ This signal is emitted when the button loses mouse grab
+ while being pressed, or when it would emit the \l released
+ signal but the mouse cursor is not inside the button.
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::AbstractButton::clicked()
+
+ This signal is emitted when the button is interactively clicked by the user.
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::AbstractButton::pressAndHold()
+
+ This signal is emitted when the button is interactively pressed and held down by the user.
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::AbstractButton::doubleClicked()
+
+ This signal is emitted when the button is interactively double clicked by the user.
+*/
+
+QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() :
+ down(false), explicitDown(false), pressed(false), keepPressed(false), checked(false), checkable(false),
+ autoExclusive(false), autoRepeat(false), wasHeld(false),
+ holdTimer(0), delayTimer(0), repeatTimer(0), repeatButton(Qt::NoButton), indicator(nullptr), group(nullptr)
+{
+}
+
+bool QQuickAbstractButtonPrivate::isPressAndHoldConnected()
+{
+ Q_Q(QQuickAbstractButton);
+ IS_SIGNAL_CONNECTED(q, QQuickAbstractButton, pressAndHold, ());
+}
+
+void QQuickAbstractButtonPrivate::startPressAndHold()
+{
+ Q_Q(QQuickAbstractButton);
+ wasHeld = false;
+ stopPressAndHold();
+ if (isPressAndHoldConnected())
+ holdTimer = q->startTimer(QGuiApplication::styleHints()->mousePressAndHoldInterval());
+}
+
+void QQuickAbstractButtonPrivate::stopPressAndHold()
+{
+ Q_Q(QQuickAbstractButton);
+ if (holdTimer > 0) {
+ q->killTimer(holdTimer);
+ holdTimer = 0;
+ }
+}
+
+void QQuickAbstractButtonPrivate::startRepeatDelay()
+{
+ Q_Q(QQuickAbstractButton);
+ stopPressRepeat();
+ delayTimer = q->startTimer(AUTO_REPEAT_DELAY);
+}
+
+void QQuickAbstractButtonPrivate::startPressRepeat()
+{
+ Q_Q(QQuickAbstractButton);
+ stopPressRepeat();
+ repeatTimer = q->startTimer(AUTO_REPEAT_INTERVAL);
+}
+
+void QQuickAbstractButtonPrivate::stopPressRepeat()
+{
+ Q_Q(QQuickAbstractButton);
+ if (delayTimer > 0) {
+ q->killTimer(delayTimer);
+ delayTimer = 0;
+ }
+ if (repeatTimer > 0) {
+ q->killTimer(repeatTimer);
+ repeatTimer = 0;
+ }
+}
+
+QQuickAbstractButton *QQuickAbstractButtonPrivate::findCheckedButton() const
+{
+ Q_Q(const QQuickAbstractButton);
+ if (group)
+ return qobject_cast<QQuickAbstractButton *>(group->checkedButton());
+
+ 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
+ // that QQuickRadioButton adopted. Uncommenting the following count check
+ // gives the QRadioButton behavior. Notice that tst_radiobutton.qml needs
+ // to be updated.
+ if (!autoExclusive /*|| buttons.count() == 1*/)
+ return nullptr;
+
+ for (QQuickAbstractButton *button : buttons) {
+ if (button->isChecked() && button != q)
+ return button;
+ }
+ return checked ? const_cast<QQuickAbstractButton *>(q) : nullptr;
+}
+
+QList<QQuickAbstractButton *> QQuickAbstractButtonPrivate::findExclusiveButtons() const
+{
+ QList<QQuickAbstractButton *> buttons;
+ if (group) {
+ QQmlListProperty<QQuickAbstractButton> groupButtons = group->buttons();
+ int count = groupButtons.count(&groupButtons);
+ for (int i = 0; i < count; ++i) {
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(groupButtons.at(&groupButtons, i));
+ if (button)
+ buttons += button;
+ }
+ } else if (parentItem) {
+ 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;
+ }
+ }
+ return buttons;
+}
+
+QQuickAbstractButton::QQuickAbstractButton(QQuickItem *parent) :
+ QQuickControl(*(new QQuickAbstractButtonPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setFocusPolicy(Qt::StrongFocus);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickAbstractButton::QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ setActiveFocusOnTab(true);
+ setFocusPolicy(Qt::StrongFocus);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickAbstractButton::~QQuickAbstractButton()
+{
+ Q_D(QQuickAbstractButton);
+ if (d->group)
+ d->group->removeButton(this);
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::AbstractButton::text
+
+ 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 content item is an image.
+
+ \sa {Control::contentItem}{contentItem}
+*/
+QString QQuickAbstractButton::text() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->text;
+}
+
+void QQuickAbstractButton::setText(const QString &text)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->text == text)
+ return;
+
+ d->text = text;
+ setAccessibleName(text);
+ emit textChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::AbstractButton::down
+
+ This property holds whether the button is visually down.
+
+ Unless explicitly set, this property follows the value of \l pressed. To
+ return to the default value, set this property to \c undefined.
+
+ \sa pressed
+*/
+bool QQuickAbstractButton::isDown() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->down;
+}
+
+void QQuickAbstractButton::setDown(bool down)
+{
+ Q_D(QQuickAbstractButton);
+ d->explicitDown = true;
+
+ if (d->down == down)
+ return;
+
+ d->down = down;
+ emit downChanged();
+}
+
+void QQuickAbstractButton::resetDown()
+{
+ Q_D(QQuickAbstractButton);
+ if (!d->explicitDown)
+ return;
+
+ setDown(d->pressed);
+ d->explicitDown = false;
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::AbstractButton::pressed
+ \readonly
+
+ This property holds whether the button is physically pressed. A button can
+ be pressed by either touch or key events.
+
+ \sa down
+*/
+bool QQuickAbstractButton::isPressed() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->pressed;
+}
+
+void QQuickAbstractButton::setPressed(bool isPressed)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->pressed == isPressed)
+ return;
+
+ d->pressed = isPressed;
+ setAccessibleProperty("pressed", isPressed);
+ emit pressedChanged();
+
+ if (!d->explicitDown) {
+ setDown(d->pressed);
+ d->explicitDown = false;
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::AbstractButton::checked
+
+ This property holds whether the button is checked.
+*/
+bool QQuickAbstractButton::isChecked() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->checked;
+}
+
+void QQuickAbstractButton::setChecked(bool checked)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->checked == checked)
+ return;
+
+ if (checked && !d->checkable)
+ setCheckable(true);
+
+ d->checked = checked;
+ setAccessibleProperty("checked", checked);
+ checkStateSet();
+ emit checkedChanged();
+}
+
+// We define these in QQuickAbstractButton without exposing checkable as a
+// property, and instead expose it as a property in QQuickButton.
+// QQuickRadioButton, QQuickSwitch and QQuickCheckBox are checkable by default,
+// but if we removed the checkable code from here, they'd each have to
+// duplicate it.
+bool QQuickAbstractButton::isCheckable() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->checkable;
+}
+
+void QQuickAbstractButton::setCheckable(bool checkable)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->checkable == checkable)
+ return;
+
+ d->checkable = checkable;
+ setAccessibleProperty("checkable", checkable);
+ checkableChange();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::AbstractButton::autoExclusive
+
+ This property holds whether auto-exclusivity is enabled.
+
+ If auto-exclusivity is enabled, checkable buttons that belong to the same
+ parent item behave as if they were part of the same ButtonGroup. Only
+ one button can be checked at any time; checking another button automatically
+ unchecks the previously checked one.
+
+ \note The property has no effect on buttons that belong to a ButtonGroup.
+
+ RadioButton and TabButton are auto-exclusive by default.
+*/
+bool QQuickAbstractButton::autoExclusive() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->autoExclusive;
+}
+
+void QQuickAbstractButton::setAutoExclusive(bool exclusive)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->autoExclusive == exclusive)
+ return;
+
+ d->autoExclusive = exclusive;
+ emit autoExclusiveChanged();
+}
+
+bool QQuickAbstractButton::autoRepeat() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->autoRepeat;
+}
+
+void QQuickAbstractButton::setAutoRepeat(bool repeat)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->autoRepeat == repeat)
+ return;
+
+ d->stopPressRepeat();
+ d->autoRepeat = repeat;
+ autoRepeatChange();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::AbstractButton::indicator
+
+ This property holds the indicator item.
+*/
+QQuickItem *QQuickAbstractButton::indicator() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->indicator;
+}
+
+void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickAbstractButton);
+ if (d->indicator == indicator)
+ return;
+
+ d->deleteDelegate(d->indicator);
+ d->indicator = indicator;
+ if (indicator) {
+ if (!indicator->parentItem())
+ indicator->setParentItem(this);
+ indicator->setAcceptedMouseButtons(Qt::LeftButton);
+ }
+ emit indicatorChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::AbstractButton::toggle()
+
+ Toggles the checked state of the button.
+*/
+void QQuickAbstractButton::toggle()
+{
+ Q_D(QQuickAbstractButton);
+ setChecked(!d->checked);
+}
+
+void QQuickAbstractButton::focusOutEvent(QFocusEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::focusOutEvent(event);
+ if (d->pressed) {
+ setPressed(false);
+ emit canceled();
+ }
+}
+
+void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::keyPressEvent(event);
+ if (event->key() == Qt::Key_Space) {
+ setPressed(true);
+ d->pressPoint = QPoint(qRound(width() / 2), qRound(height() / 2));
+
+ if (d->autoRepeat) {
+ d->startRepeatDelay();
+ d->repeatButton = Qt::NoButton;
+ }
+
+ emit pressed();
+ }
+}
+
+void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::keyReleaseEvent(event);
+ if (event->key() == Qt::Key_Space) {
+ setPressed(false);
+
+ nextCheckState();
+ emit released();
+ emit clicked();
+
+ if (d->autoRepeat)
+ d->stopPressRepeat();
+ }
+}
+
+void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::mousePressEvent(event);
+ setPressed(true);
+ d->pressPoint = event->pos();
+
+ emit pressed();
+
+ if (d->autoRepeat) {
+ d->startRepeatDelay();
+ d->repeatButton = event->button();
+ } else if (Qt::LeftButton == (event->buttons() & Qt::LeftButton)) {
+ d->startPressAndHold();
+ } else {
+ d->stopPressAndHold();
+ }
+}
+
+void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::mouseMoveEvent(event);
+ setPressed(d->keepPressed || contains(event->pos()));
+
+ if (!d->pressed && d->autoRepeat)
+ d->stopPressRepeat();
+ else if (d->holdTimer > 0 && (!d->pressed || QLineF(d->pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance()))
+ d->stopPressAndHold();
+}
+
+void QQuickAbstractButton::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::mouseReleaseEvent(event);
+ bool wasPressed = d->pressed;
+ setPressed(false);
+
+ if (d->keepPressed || contains(event->pos()))
+ nextCheckState();
+
+ if (wasPressed) {
+ emit released();
+ if (!d->wasHeld)
+ emit clicked();
+ } else {
+ emit canceled();
+ }
+
+ if (d->autoRepeat)
+ d->stopPressRepeat();
+ else
+ d->stopPressAndHold();
+}
+
+void QQuickAbstractButton::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ QQuickControl::mouseDoubleClickEvent(event);
+ emit doubleClicked();
+}
+
+void QQuickAbstractButton::mouseUngrabEvent()
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::mouseUngrabEvent();
+ if (d->pressed) {
+ setPressed(false);
+ d->stopPressRepeat();
+ d->stopPressAndHold();
+ emit canceled();
+ }
+}
+
+void QQuickAbstractButton::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickAbstractButton);
+ QQuickControl::timerEvent(event);
+ if (event->timerId() == d->holdTimer) {
+ d->stopPressAndHold();
+ d->wasHeld = true;
+ emit pressAndHold();
+ } else if (event->timerId() == d->delayTimer) {
+ d->startPressRepeat();
+ } else if (event->timerId() == d->repeatTimer) {
+ emit released();
+ emit clicked();
+ emit pressed();
+ }
+}
+
+void QQuickAbstractButton::checkStateSet()
+{
+ Q_D(QQuickAbstractButton);
+ if (d->checked) {
+ QQuickAbstractButton *button = d->findCheckedButton();
+ if (button && button != this)
+ button->setChecked(false);
+ }
+}
+
+void QQuickAbstractButton::nextCheckState()
+{
+ Q_D(QQuickAbstractButton);
+ if (d->checkable && (!d->checked || d->findCheckedButton() != this))
+ setChecked(!d->checked);
+}
+
+void QQuickAbstractButton::checkableChange()
+{
+}
+
+void QQuickAbstractButton::autoRepeatChange()
+{
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickAbstractButton::accessibilityActiveChanged(bool active)
+{
+ QQuickControl::accessibilityActiveChanged(active);
+
+ Q_D(QQuickAbstractButton);
+ if (active) {
+ setAccessibleName(d->text);
+ setAccessibleProperty("pressed", d->pressed);
+ setAccessibleProperty("checked", d->checked);
+ setAccessibleProperty("checkable", d->checkable);
+ }
+}
+
+QAccessible::Role QQuickAbstractButton::accessibleRole() const
+{
+ return QAccessible::Button;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h
new file mode 100644
index 00000000..779739de
--- /dev/null
+++ b/src/quicktemplates2/qquickabstractbutton_p.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTBUTTON_P_H
+#define QQUICKABSTRACTBUTTON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractButtonPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButton : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(bool down READ isDown WRITE setDown NOTIFY downChanged RESET resetDown FINAL)
+ Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
+ Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+
+public:
+ explicit QQuickAbstractButton(QQuickItem *parent = nullptr);
+ ~QQuickAbstractButton();
+
+ QString text() const;
+ void setText(const QString &text);
+
+ bool isDown() const;
+ void setDown(bool down);
+ void resetDown();
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ bool isChecked() const;
+ void setChecked(bool checked);
+
+ bool isCheckable() const;
+ void setCheckable(bool checkable);
+
+ bool autoExclusive() const;
+ void setAutoExclusive(bool exclusive);
+
+ bool autoRepeat() const;
+ void setAutoRepeat(bool repeat);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+public Q_SLOTS:
+ void toggle();
+
+Q_SIGNALS:
+ void pressed();
+ void released();
+ void canceled();
+ void clicked();
+ void pressAndHold();
+ void doubleClicked();
+ void textChanged();
+ void downChanged();
+ void pressedChanged();
+ void checkedChanged();
+ void autoExclusiveChanged();
+ void indicatorChanged();
+
+protected:
+ QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent);
+
+ 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();
+
+ virtual void checkableChange();
+ virtual void autoRepeatChange();
+
+#ifndef QT_NO_ACCESSIBILITY
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickAbstractButton)
+ Q_DECLARE_PRIVATE(QQuickAbstractButton)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickAbstractButton)
+
+#endif // QQUICKABSTRACTBUTTON_P_H
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
new file mode 100644
index 00000000..8138a61d
--- /dev/null
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKABSTRACTBUTTON_P_P_H
+#define QQUICKABSTRACTBUTTON_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickButtonGroup;
+
+class QQuickAbstractButtonPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickAbstractButton)
+
+public:
+ QQuickAbstractButtonPrivate();
+
+ static QQuickAbstractButtonPrivate *get(QQuickAbstractButton *button)
+ {
+ return button->d_func();
+ }
+
+ bool isPressAndHoldConnected();
+ void startPressAndHold();
+ void stopPressAndHold();
+
+ void startRepeatDelay();
+ void startPressRepeat();
+ void stopPressRepeat();
+
+ QQuickAbstractButton *findCheckedButton() const;
+ QList<QQuickAbstractButton *> findExclusiveButtons() const;
+
+ QString text;
+ bool down;
+ bool explicitDown;
+ bool pressed;
+ bool keepPressed;
+ bool checked;
+ bool checkable;
+ bool autoExclusive;
+ bool autoRepeat;
+ bool wasHeld;
+ int holdTimer;
+ int delayTimer;
+ int repeatTimer;
+ QPointF pressPoint;
+ Qt::MouseButton repeatButton;
+ QQuickItem *indicator;
+ QQuickButtonGroup *group;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKABSTRACTBUTTON_P_P_H
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
new file mode 100644
index 00000000..3a454353
--- /dev/null
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -0,0 +1,871 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickapplicationwindow_p.h"
+#include "qquickoverlay_p.h"
+#include "qquickpopup_p.h"
+#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>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ApplicationWindow
+ \inherits Window
+ \instantiates QQuickApplicationWindow
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \brief Styled top-level window with support for a header and footer.
+
+ ApplicationWindow is a \l Window which makes it convenient to add
+ a \l header and \l footer item to the window.
+
+ You can declare ApplicationWindow as the root item of your application,
+ and run it by using \l QQmlApplicationEngine. In this way you can control
+ the window's properties, appearance and layout from QML.
+
+ \image qtquickcontrols2-applicationwindow-wireframe.png
+
+ \qml
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ visible: true
+
+ header: ToolBar {
+ // ...
+ }
+
+ footer: TabBar {
+ // ...
+ }
+
+ StackView {
+ anchors.fill: parent
+ }
+ }
+ \endqml
+
+ ApplicationWindow supports popups via its \l overlay property, which
+ ensures that popups are displayed above other content and that the
+ background is dimmed when a \l {Popup::}{modal} or \l {Popup::dim}
+ {dimmed} popup is visible.
+
+ \note By default, an ApplicationWindow is not visible.
+
+ \section2 Attached ApplicationWindow Properties
+
+ Due to how \l {Scope and Naming Resolution} works in QML, it is possible
+ to reference the \c id of the application root element anywhere in its
+ child QML objects. Even though this approach is fine for many applications
+ and use cases, for a generic QML component it may not be acceptable as it
+ creates a dependency to the surrounding environment.
+
+ ApplicationWindow provides a set of attached properties that can be used
+ to access the window and its building blocks from places where no direct
+ access to the window is available, without creating a dependency to a
+ certain window \c id. A QML component that uses the ApplicationWindow
+ attached properties works in any window regardless of its \c id. The
+ following example uses the attached \c overlay property to position the
+ popup to the center of the window, despite the position of the button
+ that opens the popup.
+
+ \code
+ Button {
+ onClicked: popup.open()
+
+ Popup {
+ id: popup
+
+ parent: ApplicationWindow.overlay
+
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 100
+ height: 100
+ }
+ }
+ \endcode
+
+ \sa {Customizing ApplicationWindow}, Page, {Container Controls}
+*/
+
+class QQuickApplicationWindowPrivate : public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickApplicationWindow)
+
+public:
+ QQuickApplicationWindowPrivate()
+ : complete(false)
+ , background(nullptr)
+ , contentItem(nullptr)
+ , header(nullptr)
+ , footer(nullptr)
+ , overlay(nullptr)
+ , activeFocusControl(nullptr)
+ { }
+
+ static QQuickApplicationWindowPrivate *get(QQuickApplicationWindow *window)
+ {
+ return window->d_func();
+ }
+
+ void relayout();
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect) override;
+ void itemVisibilityChanged(QQuickItem *item) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
+ void updateFont(const QFont &f);
+ inline void setFont_helper(const QFont &f) {
+ if (font.resolve() == f.resolve() && font == f)
+ return;
+ updateFont(f);
+ }
+ void resolveFont();
+
+ void _q_updateActiveFocus();
+ void setActiveFocusControl(QQuickItem *item);
+
+ bool complete;
+ QQuickItem *background;
+ QQuickItem *contentItem;
+ QQuickItem *header;
+ QQuickItem *footer;
+ QQuickOverlay *overlay;
+ QFont font;
+ QLocale locale;
+ QQuickItem *activeFocusControl;
+ QQuickApplicationWindow *q_ptr;
+};
+
+void QQuickApplicationWindowPrivate::relayout()
+{
+ Q_Q(QQuickApplicationWindow);
+ QQuickItem *content = q->contentItem();
+ qreal hh = header && header->isVisible() ? header->height() : 0;
+ qreal fh = footer && footer->isVisible() ? footer->height() : 0;
+
+ content->setY(hh);
+ content->setWidth(q->width());
+ content->setHeight(q->height() - hh - fh);
+
+ if (header) {
+ header->setY(-hh);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(header);
+ if (!p->widthValid) {
+ header->setWidth(q->width());
+ p->widthValid = false;
+ }
+ }
+
+ if (footer) {
+ footer->setY(content->height());
+ QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
+ if (!p->widthValid) {
+ footer->setWidth(q->width());
+ p->widthValid = false;
+ }
+ }
+
+ if (background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (!p->widthValid && qFuzzyIsNull(background->x())) {
+ background->setWidth(q->width());
+ p->widthValid = false;
+ }
+ if (!p->heightValid && qFuzzyIsNull(background->y())) {
+ background->setHeight(q->height());
+ p->heightValid = false;
+ }
+ }
+}
+
+void QQuickApplicationWindowPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect)
+{
+ Q_UNUSED(item)
+ Q_UNUSED(newRect)
+ Q_UNUSED(oldRect)
+ relayout();
+}
+
+void QQuickApplicationWindowPrivate::itemVisibilityChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+void QQuickApplicationWindowPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+void QQuickApplicationWindowPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+void QQuickApplicationWindowPrivate::_q_updateActiveFocus()
+{
+ Q_Q(QQuickApplicationWindow);
+ QQuickItem *item = q->activeFocusItem();
+ while (item) {
+ QQuickControl *control = qobject_cast<QQuickControl *>(item);
+ if (control) {
+ setActiveFocusControl(control);
+ break;
+ }
+ QQuickTextField *textField = qobject_cast<QQuickTextField *>(item);
+ if (textField) {
+ setActiveFocusControl(textField);
+ break;
+ }
+ QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(item);
+ if (textArea) {
+ setActiveFocusControl(textArea);
+ break;
+ }
+ item = item->parentItem();
+ }
+}
+
+void QQuickApplicationWindowPrivate::setActiveFocusControl(QQuickItem *control)
+{
+ Q_Q(QQuickApplicationWindow);
+ if (activeFocusControl != control) {
+ activeFocusControl = control;
+ emit q->activeFocusControlChanged();
+ }
+}
+
+QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent) :
+ QQuickWindowQmlImpl(parent), d_ptr(new QQuickApplicationWindowPrivate)
+{
+ d_ptr->q_ptr = this;
+ connect(this, SIGNAL(activeFocusItemChanged()), this, SLOT(_q_updateActiveFocus()));
+}
+
+QQuickApplicationWindow::~QQuickApplicationWindow()
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->header)
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
+ QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (d->footer)
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
+ QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ d_ptr.reset(); // QTBUG-52731
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::ApplicationWindow::background
+
+ This property holds the background item.
+
+ The background item is stacked under the \l {contentItem}{content item},
+ but above the \l {Window::color}{background color} of the window.
+
+ The background item is useful for images and gradients, for example,
+ but the \l {Window::}{color} property is preferable for solid colors,
+ as it doesn't need to create an item.
+
+ \note If the background item has no explicit size specified, it automatically
+ follows the control's size. In most cases, there is no need to specify
+ width or height for a background item.
+
+ \sa {Customizing ApplicationWindow}, contentItem, header, footer, overlay
+*/
+QQuickItem *QQuickApplicationWindow::background() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->background;
+}
+
+void QQuickApplicationWindow::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->background == background)
+ return;
+
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setParentItem(QQuickWindow::contentItem());
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->relayout();
+ }
+ emit backgroundChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::ApplicationWindow::header
+
+ 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.
+
+ \code
+ ApplicationWindow {
+ header: TabBar {
+ // ...
+ }
+ }
+ \endcode
+
+ \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
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->header;
+}
+
+void QQuickApplicationWindow::setHeader(QQuickItem *header)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->header == header)
+ return;
+
+ if (d->header) {
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
+ 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::Geometry | QQuickItemPrivate::Visibility |
+ 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();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::ApplicationWindow::footer
+
+ 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.
+
+ \code
+ ApplicationWindow {
+ footer: ToolBar {
+ // ...
+ }
+ }
+ \endcode
+
+ \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
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->footer;
+}
+
+void QQuickApplicationWindow::setFooter(QQuickItem *footer)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->footer == footer)
+ return;
+
+ if (d->footer) {
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
+ 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::Geometry | QQuickItemPrivate::Visibility |
+ 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();
+}
+
+/*!
+ \qmlproperty list<Object> QtQuick.Controls::ApplicationWindow::contentData
+ \default
+
+ This default property holds the list of all objects declared as children of
+ the window.
+
+ The data property allows you to freely mix visual children, resources and
+ other windows in an ApplicationWindow.
+
+ If you assign an Item to the contentData list, it becomes a child of the
+ window's contentItem, so that it appears inside the window. The item's
+ parent will be the window's \l contentItem.
+
+ It should not generally be necessary to refer to the contentData property,
+ as it is the default property for ApplicationWindow and thus all child
+ items are automatically assigned to this property.
+
+ \sa contentItem
+*/
+QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
+{
+ return QQuickItemPrivate::get(contentItem())->data();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::ApplicationWindow::contentItem
+ \readonly
+
+ This property holds the window content item.
+
+ The content item is stacked above the \l background item, and under the
+ \l header, \l footer, and \l overlay items.
+
+ \sa background, header, footer, overlay
+*/
+QQuickItem *QQuickApplicationWindow::contentItem() const
+{
+ QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
+ if (!d->contentItem) {
+ d->contentItem = new QQuickItem(QQuickWindow::contentItem());
+ d->contentItem->setFlag(QQuickItem::ItemIsFocusScope);
+ d->contentItem->setFocus(true);
+ d->relayout();
+ }
+ return d->contentItem;
+}
+
+/*!
+ \qmlproperty Control QtQuick.Controls::ApplicationWindow::activeFocusControl
+ \readonly
+
+ This property holds the control that currently has active focus, or \c null if there is
+ no control with active focus.
+
+ The difference between \l Window::activeFocusItem and ApplicationWindow::activeFocusControl
+ is that the former may point to a building block of a control, whereas the latter points
+ to the enclosing control. For example, when SpinBox has focus, activeFocusItem points to
+ the editor and activeFocusControl to the SpinBox itself.
+
+ \sa Window::activeFocusItem
+*/
+QQuickItem *QQuickApplicationWindow::activeFocusControl() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->activeFocusControl;
+}
+
+/*!
+ \qmlpropertygroup QtQuick.Controls::ApplicationWindow::overlay
+ \qmlproperty Item QtQuick.Controls::ApplicationWindow::overlay
+ \qmlproperty Component QtQuick.Controls::ApplicationWindow::overlay.modal
+ \qmlproperty Component QtQuick.Controls::ApplicationWindow::overlay.modeless
+
+ This property holds the window overlay item. Popups are automatically
+ reparented to the overlay.
+
+ \table
+ \header
+ \li Property
+ \li Description
+ \row
+ \li overlay.modal
+ \li This property holds a component to use as a visual item that implements
+ background dimming for modal popups. It is created for and stacked below
+ visible modal popups.
+ \row
+ \li overlay.modeless
+ \li This property holds a component to use as a visual item that implements
+ background dimming for modeless popups. It is created for and stacked below
+ visible dimming popups.
+ \row
+ \li overlay.pressed()
+ \li This signal is emitted when the overlay is pressed by the user while
+ a popup is visible.
+ \row
+ \li overlay.released()
+ \li This signal is emitted when the overlay is released by the user while
+ a modal popup is visible.
+ \endtable
+
+ \sa Popup::modal, Popup::dim
+*/
+QQuickOverlay *QQuickApplicationWindow::overlay() const
+{
+ QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
+ if (!d) // being deleted
+ return nullptr;
+
+ if (!d->overlay) {
+ d->overlay = new QQuickOverlay(QQuickWindow::contentItem());
+ d->overlay->stackAfter(QQuickApplicationWindow::contentItem());
+ }
+ return d->overlay;
+}
+
+/*!
+ \qmlproperty font QtQuick.Controls::ApplicationWindow::font
+
+ This property holds the font currently set for the window.
+
+ The default font depends on the system environment. QGuiApplication maintains a system/theme
+ font which serves as a default for all application windows. You can also set the default font
+ for windows by passing a custom font to QGuiApplication::setFont(), before loading any QML.
+ Finally, the font is matched against Qt's font database to find the best match.
+
+ ApplicationWindow propagates explicit font properties to child controls. If you change a specific
+ property on the window's font, that property propagates to all child controls in the window,
+ overriding any system defaults for that property.
+
+ \sa Control::font
+*/
+QFont QQuickApplicationWindow::font() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->font;
+}
+
+void QQuickApplicationWindow::setFont(const QFont &font)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->font.resolve() == font.resolve() && d->font == font)
+ return;
+
+ QFont resolvedFont = font.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
+ d->setFont_helper(resolvedFont);
+}
+
+void QQuickApplicationWindow::resetFont()
+{
+ setFont(QFont());
+}
+
+void QQuickApplicationWindowPrivate::resolveFont()
+{
+ QFont resolvedFont = font.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
+ setFont_helper(resolvedFont);
+}
+
+void QQuickApplicationWindowPrivate::updateFont(const QFont &f)
+{
+ Q_Q(QQuickApplicationWindow);
+ const bool changed = font != f;
+ font = f;
+
+ QQuickControlPrivate::updateFontRecur(q->QQuickWindow::contentItem(), f);
+
+ // TODO: internal QQuickPopupManager that provides reliable access to all QQuickPopup instances
+ const QList<QQuickPopup *> popups = q->findChildren<QQuickPopup *>();
+ for (QQuickPopup *popup : popups)
+ QQuickControlPrivate::get(static_cast<QQuickControl *>(popup->popupItem()))->inheritFont(f);
+
+ if (changed)
+ emit q->fontChanged();
+}
+
+QLocale QQuickApplicationWindow::locale() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->locale;
+}
+
+void QQuickApplicationWindow::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->locale == locale)
+ return;
+
+ d->locale = locale;
+ QQuickControlPrivate::updateLocaleRecur(QQuickWindow::contentItem(), locale);
+
+ // TODO: internal QQuickPopupManager that provides reliable access to all QQuickPopup instances
+ const QList<QQuickPopup *> popups = QQuickWindow::contentItem()->findChildren<QQuickPopup *>();
+ for (QQuickPopup *popup : popups)
+ QQuickControlPrivate::get(static_cast<QQuickControl *>(popup->popupItem()))->updateLocale(locale, false); // explicit=false
+
+ emit localeChanged();
+}
+
+void QQuickApplicationWindow::resetLocale()
+{
+ setLocale(QLocale());
+}
+
+QQuickApplicationWindowAttached *QQuickApplicationWindow::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickApplicationWindowAttached(object);
+}
+
+bool QQuickApplicationWindow::isComponentComplete() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->complete;
+}
+
+void QQuickApplicationWindow::classBegin()
+{
+ Q_D(QQuickApplicationWindow);
+ QQuickWindowQmlImpl::classBegin();
+ d->resolveFont();
+}
+
+void QQuickApplicationWindow::componentComplete()
+{
+ Q_D(QQuickApplicationWindow);
+ d->complete = true;
+ QQuickWindowQmlImpl::componentComplete();
+}
+
+void QQuickApplicationWindow::resizeEvent(QResizeEvent *event)
+{
+ Q_D(QQuickApplicationWindow);
+ QQuickWindowQmlImpl::resizeEvent(event);
+ d->relayout();
+}
+
+class QQuickApplicationWindowAttachedPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickApplicationWindowAttached)
+
+public:
+ QQuickApplicationWindowAttachedPrivate() : window(nullptr) { }
+
+ void windowChange(QQuickWindow *wnd);
+
+ QQuickWindow *window;
+};
+
+void QQuickApplicationWindowAttachedPrivate::windowChange(QQuickWindow *wnd)
+{
+ Q_Q(QQuickApplicationWindowAttached);
+ if (window == wnd)
+ return;
+
+ QQuickApplicationWindow *oldWindow = qobject_cast<QQuickApplicationWindow *>(window);
+ if (oldWindow && !QQuickApplicationWindowPrivate::get(oldWindow))
+ oldWindow = nullptr; // being deleted (QTBUG-52731)
+
+ if (oldWindow) {
+ QObject::disconnect(oldWindow, &QQuickApplicationWindow::activeFocusControlChanged,
+ q, &QQuickApplicationWindowAttached::activeFocusControlChanged);
+ QObject::disconnect(oldWindow, &QQuickApplicationWindow::headerChanged,
+ q, &QQuickApplicationWindowAttached::headerChanged);
+ QObject::disconnect(oldWindow, &QQuickApplicationWindow::footerChanged,
+ q, &QQuickApplicationWindowAttached::footerChanged);
+ }
+
+ QQuickApplicationWindow *newWindow = qobject_cast<QQuickApplicationWindow *>(wnd);
+ if (newWindow) {
+ QObject::connect(newWindow, &QQuickApplicationWindow::activeFocusControlChanged,
+ q, &QQuickApplicationWindowAttached::activeFocusControlChanged);
+ QObject::connect(newWindow, &QQuickApplicationWindow::headerChanged,
+ q, &QQuickApplicationWindowAttached::headerChanged);
+ QObject::connect(newWindow, &QQuickApplicationWindow::footerChanged,
+ q, &QQuickApplicationWindowAttached::footerChanged);
+ }
+
+ window = wnd;
+ emit q->windowChanged();
+ emit q->contentItemChanged();
+ emit q->overlayChanged();
+
+ if ((oldWindow && oldWindow->activeFocusControl()) || (newWindow && newWindow->activeFocusControl()))
+ emit q->activeFocusControlChanged();
+ if ((oldWindow && oldWindow->header()) || (newWindow && newWindow->header()))
+ emit q->headerChanged();
+ if ((oldWindow && oldWindow->footer()) || (newWindow && newWindow->footer()))
+ emit q->footerChanged();
+}
+
+QQuickApplicationWindowAttached::QQuickApplicationWindowAttached(QObject *parent)
+ : QObject(*(new QQuickApplicationWindowAttachedPrivate), parent)
+{
+ Q_D(QQuickApplicationWindowAttached);
+ if (QQuickItem *item = qobject_cast<QQuickItem *>(parent)) {
+ d->windowChange(item->window());
+ QObjectPrivate::connect(item, &QQuickItem::windowChanged, d, &QQuickApplicationWindowAttachedPrivate::windowChange);
+ if (!d->window) {
+ QQuickItem *p = item;
+ while (p) {
+ if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(p->parent())) {
+ d->windowChange(popup->window());
+ QObjectPrivate::connect(popup, &QQuickPopup::windowChanged, d, &QQuickApplicationWindowAttachedPrivate::windowChange);
+ }
+ p = p->parentItem();
+ }
+ }
+ } else if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(parent)) {
+ d->windowChange(popup->window());
+ QObjectPrivate::connect(popup, &QQuickPopup::windowChanged, d, &QQuickApplicationWindowAttachedPrivate::windowChange);
+ }
+}
+
+/*!
+ \qmlattachedproperty ApplicationWindow QtQuick.Controls::ApplicationWindow::window
+ \readonly
+
+ This attached property holds the application window. The property can be attached
+ to any item. The value is \c null if the item is not in an ApplicationWindow.
+
+ \sa {Attached ApplicationWindow Properties}
+*/
+QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const
+{
+ Q_D(const QQuickApplicationWindowAttached);
+ return qobject_cast<QQuickApplicationWindow *>(d->window);
+}
+
+/*!
+ \qmlattachedproperty Item QtQuick.Controls::ApplicationWindow::contentItem
+ \readonly
+
+ This attached property holds the window content item. The property can be attached
+ to any item. The value is \c null if the item is not in an ApplicationWindow.
+
+ \sa {Attached ApplicationWindow Properties}
+*/
+QQuickItem *QQuickApplicationWindowAttached::contentItem() const
+{
+ Q_D(const QQuickApplicationWindowAttached);
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(d->window))
+ return window->contentItem();
+ return nullptr;
+}
+
+/*!
+ \qmlattachedproperty Control QtQuick.Controls::ApplicationWindow::activeFocusControl
+ \readonly
+
+ This attached property holds the control that currently has active focus, or \c null
+ if there is no control with active focus. The property can be attached to any item.
+ The value is \c null if the item is not in an ApplicationWindow, or the window has
+ no active focus.
+
+ \sa Window::activeFocusItem, {Attached ApplicationWindow Properties}
+*/
+QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
+{
+ Q_D(const QQuickApplicationWindowAttached);
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(d->window))
+ return window->activeFocusControl();
+ return nullptr;
+}
+
+/*!
+ \qmlattachedproperty Item QtQuick.Controls::ApplicationWindow::header
+ \readonly
+
+ This attached property holds the window header item. The property can be attached
+ to any item. The value is \c null if the item is not in an ApplicationWindow, or
+ the window has no header item.
+
+ \sa {Attached ApplicationWindow Properties}
+*/
+QQuickItem *QQuickApplicationWindowAttached::header() const
+{
+ Q_D(const QQuickApplicationWindowAttached);
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(d->window))
+ return window->header();
+ return nullptr;
+}
+
+/*!
+ \qmlattachedproperty Item QtQuick.Controls::ApplicationWindow::footer
+ \readonly
+
+ This attached property holds the window footer item. The property can be attached
+ to any item. The value is \c null if the item is not in an ApplicationWindow, or
+ the window has no footer item.
+
+ \sa {Attached ApplicationWindow Properties}
+*/
+QQuickItem *QQuickApplicationWindowAttached::footer() const
+{
+ Q_D(const QQuickApplicationWindowAttached);
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(d->window))
+ return window->footer();
+ return nullptr;
+}
+
+/*!
+ \qmlattachedproperty Item QtQuick.Controls::ApplicationWindow::overlay
+ \readonly
+
+ This attached property holds the window overlay item. The property can be attached
+ to any item. The value is \c null if the item is not in an ApplicationWindow.
+
+ \sa {Attached ApplicationWindow Properties}
+*/
+QQuickOverlay *QQuickApplicationWindowAttached::overlay() const
+{
+ Q_D(const QQuickApplicationWindowAttached);
+ return QQuickOverlay::overlay(d->window);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickapplicationwindow_p.cpp"
diff --git a/src/quicktemplates2/qquickapplicationwindow_p.h b/src/quicktemplates2/qquickapplicationwindow_p.h
new file mode 100644
index 00000000..820c6d23
--- /dev/null
+++ b/src/quicktemplates2/qquickapplicationwindow_p.h
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKAPPLICATIONWINDOW_P_H
+#define QQUICKAPPLICATIONWINDOW_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquickwindowmodule_p.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+#include <QtGui/qfont.h>
+#include <QtCore/qlocale.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickOverlay;
+class QQuickApplicationWindowPrivate;
+class QQuickApplicationWindowAttached;
+class QQuickApplicationWindowAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImpl
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> data READ contentData FINAL)
+ Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
+ Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
+ Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
+ Q_PROPERTY(QQuickOverlay *overlay READ overlay CONSTANT FINAL)
+ Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "data")
+
+public:
+ explicit QQuickApplicationWindow(QWindow *parent = nullptr);
+ ~QQuickApplicationWindow();
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+ QQuickItem *contentItem() const;
+ QQmlListProperty<QObject> contentData();
+
+ QQuickItem *activeFocusControl() const;
+
+ QQuickItem *header() const;
+ void setHeader(QQuickItem *header);
+
+ QQuickItem *footer() const;
+ void setFooter(QQuickItem *footer);
+
+ QQuickOverlay *overlay() const;
+
+ QFont font() const;
+ void setFont(const QFont &font);
+ void resetFont();
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+ void resetLocale();
+
+ static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void backgroundChanged();
+ void activeFocusControlChanged();
+ void headerChanged();
+ void footerChanged();
+ void fontChanged();
+ void localeChanged();
+
+protected:
+ bool isComponentComplete() const;
+ void classBegin() override;
+ void componentComplete() override;
+ void resizeEvent(QResizeEvent *event) override;
+
+private:
+ Q_DISABLE_COPY(QQuickApplicationWindow)
+ Q_DECLARE_PRIVATE(QQuickApplicationWindow)
+ Q_PRIVATE_SLOT(d_func(), void _q_updateActiveFocus())
+ QScopedPointer<QQuickApplicationWindowPrivate> d_ptr;
+};
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindowAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickApplicationWindow *window READ window NOTIFY windowChanged FINAL)
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem NOTIFY contentItemChanged FINAL)
+ Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
+ Q_PROPERTY(QQuickItem *header READ header NOTIFY headerChanged FINAL)
+ Q_PROPERTY(QQuickItem *footer READ footer NOTIFY footerChanged FINAL)
+ Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL)
+
+public:
+ explicit QQuickApplicationWindowAttached(QObject *parent = nullptr);
+
+ QQuickApplicationWindow *window() const;
+ QQuickItem *contentItem() const;
+ QQuickItem *activeFocusControl() const;
+ QQuickItem *header() const;
+ QQuickItem *footer() const;
+ QQuickOverlay *overlay() const;
+
+Q_SIGNALS:
+ void windowChanged();
+ void contentItemChanged();
+ void activeFocusControlChanged();
+ void headerChanged();
+ void footerChanged();
+ void overlayChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickApplicationWindowAttached)
+ Q_DECLARE_PRIVATE(QQuickApplicationWindowAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickApplicationWindow)
+QML_DECLARE_TYPEINFO(QQuickApplicationWindow, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKAPPLICATIONWINDOW_P_H
diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp
new file mode 100644
index 00000000..2cd3f62d
--- /dev/null
+++ b/src/quicktemplates2/qquickbusyindicator.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickbusyindicator_p.h"
+#include "qquickcontrol_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype BusyIndicator
+ \inherits Control
+ \instantiates QQuickBusyIndicator
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-indicators
+ \brief Indicates background activity, for example, while content is being loaded.
+
+ \image qtquickcontrols2-busyindicator.gif
+
+ The busy indicator should be used to indicate activity while content is
+ being loaded or the UI is blocked waiting for a resource to become available.
+
+ The following snippet shows how to use the BusyIndicator:
+
+ \qml
+ BusyIndicator {
+ running: image.status === Image.Loading
+ }
+ \endqml
+
+ BusyIndicator is similar to an indeterminate \l ProgressBar. Both can be
+ used to indicate background activity. The main difference is visual, and
+ that ProgressBar can also present a concrete amount of progress (when it
+ can be determined). Due to the visual difference, busy indicators and
+ indeterminate progress bars fit different places in user interfaces.
+ Typical places for a busy indicator:
+ \list
+ \li in the corner of a \l ToolBar
+ \li as an overlay on top of a \l Page
+ \li on the side of an \l ItemDelegate
+ \endlist
+
+ \sa {Customizing BusyIndicator}, {Indicator Controls}, ProgressBar
+*/
+
+class QQuickBusyIndicatorPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickBusyIndicatorPrivate() : running(true) { }
+
+ bool running;
+};
+
+QQuickBusyIndicator::QQuickBusyIndicator(QQuickItem *parent) :
+ QQuickControl(*(new QQuickBusyIndicatorPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::BusyIndicator::running
+
+ This property holds whether the busy indicator is currently indicating
+ activity.
+
+ \note The indicator is only visible when this property is set to \c true.
+
+ The default value is \c true.
+
+*/
+bool QQuickBusyIndicator::isRunning() const
+{
+ Q_D(const QQuickBusyIndicator);
+ return d->running;
+}
+
+void QQuickBusyIndicator::setRunning(bool running)
+{
+ Q_D(QQuickBusyIndicator);
+ if (d->running == running)
+ return;
+
+ d->running = running;
+ emit runningChanged();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickBusyIndicator::accessibleRole() const
+{
+ return QAccessible::Indicator;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickbusyindicator_p.h b/src/quicktemplates2/qquickbusyindicator_p.h
new file mode 100644
index 00000000..4da2c152
--- /dev/null
+++ b/src/quicktemplates2/qquickbusyindicator_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKBUSYINDICATOR_P_H
+#define QQUICKBUSYINDICATOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickBusyIndicatorPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickBusyIndicator : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged FINAL)
+
+public:
+ explicit QQuickBusyIndicator(QQuickItem *parent = nullptr);
+
+ bool isRunning() const;
+ void setRunning(bool running);
+
+Q_SIGNALS:
+ void runningChanged();
+
+protected:
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickBusyIndicator)
+ Q_DECLARE_PRIVATE(QQuickBusyIndicator)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickBusyIndicator)
+
+#endif // QQUICKBUSYINDICATOR_P_H
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
new file mode 100644
index 00000000..ca6d4551
--- /dev/null
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickbutton_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Button
+ \inherits AbstractButton
+ \instantiates QQuickButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-buttons
+ \brief Push-button that can be clicked to perform a command or answer a question.
+
+ \image qtquickcontrols2-button.gif
+
+ Button presents a push-button control that can be pushed or clicked by
+ the user. Buttons are normally used to perform an action, or to answer
+ a question. Typical buttons are \e OK, \e Apply, \e Cancel, \e Close,
+ \e Yes, \e No, and \e Help.
+
+ A button emits the signal \l {AbstractButton::}{clicked()} when it is activated by the user.
+ Connect to this signal to perform the button's action. Buttons also
+ provide the signals \l {AbstractButton::}{canceled()}, \l {AbstractButton::}{doubleClicked()}, \l {AbstractButton::}{pressed()},
+ \l {AbstractButton::}{released()} and \l {AbstractButton::}{pressAndHold()} for long presses.
+
+ See the snippet below on how to connect to the button's signals.
+
+ \code
+ RowLayout {
+ Button {
+ text: "Ok"
+ onClicked: model.submit()
+ }
+ Button {
+ text: "Cancel"
+ onClicked: model.revert()
+ }
+ }
+ \endcode
+
+ \sa {Customizing Button}, {Button Controls}
+*/
+
+class QQuickButtonPrivate : public QQuickAbstractButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickButton)
+
+public:
+ QQuickButtonPrivate();
+
+ bool flat;
+ bool highlighted;
+};
+
+QQuickButtonPrivate::QQuickButtonPrivate() :
+ flat(false), highlighted(false)
+{
+}
+
+QQuickButton::QQuickButton(QQuickItem *parent) :
+ QQuickAbstractButton(*(new QQuickButtonPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Button::checkable
+
+ This property holds whether the button is checkable.
+
+ A checkable button toggles between checked (on) and unchecked (off) when
+ the user clicks on it or presses the space bar while the button has active
+ focus.
+
+ Setting \l {AbstractButton::}{checked} to \c true forces this property to
+ \c true.
+
+ The default value is \c false.
+
+ \sa CheckBox, Switch
+*/
+
+void QQuickButton::checkableChange()
+{
+ emit checkableChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Button::autoRepeat
+
+ This property holds whether the button repeats
+ \l {AbstractButton::}{pressed()}, \l {AbstractButton::}{released()}
+ and \l {AbstractButton::}{clicked()} signals while the button is pressed
+ and held down.
+
+ The default value is \c false.
+*/
+
+void QQuickButton::autoRepeatChange()
+{
+ emit autoRepeatChanged();
+}
+
+QFont QQuickButton::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::PushButtonFont);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Button::highlighted
+
+ This property holds whether the button is highlighted.
+
+ \image qtquickcontrols2-button-highlighted.gif
+
+ A button can be highlighted in order to draw the user's attention towards
+ it. It has no effect on keyboard interaction.
+
+ The default value is \c false.
+*/
+bool QQuickButton::isHighlighted() const
+{
+ Q_D(const QQuickButton);
+ return d->highlighted;
+}
+
+void QQuickButton::setHighlighted(bool highlighted)
+{
+ Q_D(QQuickButton);
+ if (highlighted == d->highlighted)
+ return;
+
+ d->highlighted = highlighted;
+ emit highlightedChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Button::flat
+
+ This property holds whether the button is flat.
+
+ \image qtquickcontrols2-button-flat.gif
+
+ A flat button typically does not draw a background unless it is pressed or checked.
+
+ The default value is \c false.
+*/
+bool QQuickButton::isFlat() const
+{
+ Q_D(const QQuickButton);
+ return d->flat;
+}
+
+void QQuickButton::setFlat(bool flat)
+{
+ Q_D(QQuickButton);
+ if (flat == d->flat)
+ return;
+
+ d->flat = flat;
+ emit flatChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickbutton_p.h b/src/quicktemplates2/qquickbutton_p.h
new file mode 100644
index 00000000..fafce150
--- /dev/null
+++ b/src/quicktemplates2/qquickbutton_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKBUTTON_P_H
+#define QQUICKBUTTON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickButtonPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickButton : public QQuickAbstractButton
+{
+ Q_OBJECT
+ Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
+ Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
+ Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
+ Q_PROPERTY(bool flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL)
+
+public:
+ explicit QQuickButton(QQuickItem *parent = nullptr);
+
+ bool isHighlighted() const;
+ void setHighlighted(bool highlighted);
+
+ bool isFlat() const;
+ void setFlat(bool flat);
+
+Q_SIGNALS:
+ void checkableChanged();
+ void autoRepeatChanged();
+ void highlightedChanged();
+ void flatChanged();
+
+protected:
+ void checkableChange() override;
+ void autoRepeatChange() override;
+
+ QFont defaultFont() const override;
+
+private:
+ Q_DISABLE_COPY(QQuickButton)
+ Q_DECLARE_PRIVATE(QQuickButton)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickButton)
+
+#endif // QQUICKBUTTON_P_H
diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp
new file mode 100644
index 00000000..6ed75a2b
--- /dev/null
+++ b/src/quicktemplates2/qquickbuttongroup.cpp
@@ -0,0 +1,385 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickbuttongroup_p.h"
+
+#include <QtCore/private/qobject_p.h>
+#include <QtCore/qmetaobject.h>
+#include <QtCore/qvariant.h>
+#include <QtQml/qqmlinfo.h>
+
+#include "qquickabstractbutton_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ButtonGroup
+ \inherits QtObject
+ \instantiates QQuickButtonGroup
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup utilities
+ \brief Mutually-exclusive group of checkable buttons.
+
+ ButtonGroup is a non-visual, mutually exclusive group of buttons.
+ It is used with controls such as RadioButton, where only one of the options
+ can be selected at a time.
+
+ The most straight-forward way to use ButtonGroup is to assign
+ a list of buttons. For example, the list of children of a
+ \l{Item Positioners}{positioner} or a \l{Qt Quick Layouts}{layout}
+ that manages a group of mutually exclusive buttons.
+
+ \code
+ ButtonGroup {
+ buttons: column.children
+ }
+
+ Column {
+ id: column
+
+ RadioButton {
+ checked: true
+ text: qsTr("DAB")
+ }
+
+ RadioButton {
+ text: qsTr("FM")
+ }
+
+ RadioButton {
+ text: qsTr("AM")
+ }
+ }
+ \endcode
+
+ Mutually exclusive buttons do not always share the same parent item,
+ or the parent layout may sometimes contain items that should not be
+ included in the button group. Such cases are best handled using
+ the \l group attached property.
+
+ \code
+ ButtonGroup { id: radioGroup }
+
+ Column {
+ Label {
+ text: qsTr("Radio:")
+ }
+
+ RadioButton {
+ checked: true
+ text: qsTr("DAB")
+ ButtonGroup.group: radioGroup
+ }
+
+ RadioButton {
+ text: qsTr("FM")
+ ButtonGroup.group: radioGroup
+ }
+
+ RadioButton {
+ text: qsTr("AM")
+ ButtonGroup.group: radioGroup
+ }
+ }
+ \endcode
+
+ More advanced use cases can be handled using the \c addButton() and
+ \c removeButton() methods.
+
+ \sa RadioButton, {Button Controls}
+*/
+
+class QQuickButtonGroupPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickButtonGroup)
+
+public:
+ QQuickButtonGroupPrivate() : checkedButton(nullptr) { }
+
+ void clear();
+ void _q_updateCurrent();
+
+ static void buttons_append(QQmlListProperty<QQuickAbstractButton> *prop, QQuickAbstractButton *obj);
+ static int buttons_count(QQmlListProperty<QQuickAbstractButton> *prop);
+ static QQuickAbstractButton *buttons_at(QQmlListProperty<QQuickAbstractButton> *prop, int index);
+ static void buttons_clear(QQmlListProperty<QQuickAbstractButton> *prop);
+
+ QQuickAbstractButton *checkedButton;
+ QVector<QQuickAbstractButton*> buttons;
+};
+
+void QQuickButtonGroupPrivate::clear()
+{
+ for (QQuickAbstractButton *button : qAsConst(buttons)) {
+ QQuickAbstractButtonPrivate::get(button)->group = nullptr;
+ QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, this, &QQuickButtonGroupPrivate::_q_updateCurrent);
+ }
+ buttons.clear();
+}
+
+void QQuickButtonGroupPrivate::_q_updateCurrent()
+{
+ Q_Q(QQuickButtonGroup);
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(q->sender());
+ if (button && button->isChecked())
+ q->setCheckedButton(button);
+ else if (!buttons.contains(checkedButton))
+ q->setCheckedButton(nullptr);
+}
+
+void QQuickButtonGroupPrivate::buttons_append(QQmlListProperty<QQuickAbstractButton> *prop, QQuickAbstractButton *obj)
+{
+ QQuickButtonGroup *q = static_cast<QQuickButtonGroup *>(prop->object);
+ q->addButton(obj);
+}
+
+int QQuickButtonGroupPrivate::buttons_count(QQmlListProperty<QQuickAbstractButton> *prop)
+{
+ QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data);
+ return p->buttons.count();
+}
+
+QQuickAbstractButton *QQuickButtonGroupPrivate::buttons_at(QQmlListProperty<QQuickAbstractButton> *prop, int index)
+{
+ QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data);
+ return p->buttons.value(index);
+}
+
+void QQuickButtonGroupPrivate::buttons_clear(QQmlListProperty<QQuickAbstractButton> *prop)
+{
+ QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data);
+ if (!p->buttons.isEmpty()) {
+ p->clear();
+ QQuickButtonGroup *q = static_cast<QQuickButtonGroup *>(prop->object);
+ // QTBUG-52358: don't clear the checked button immediately
+ QMetaObject::invokeMethod(q, "_q_updateCurrent", Qt::QueuedConnection);
+ emit q->buttonsChanged();
+ }
+}
+
+QQuickButtonGroup::QQuickButtonGroup(QObject *parent)
+ : QObject(*(new QQuickButtonGroupPrivate), parent)
+{
+}
+
+QQuickButtonGroup::~QQuickButtonGroup()
+{
+ Q_D(QQuickButtonGroup);
+ d->clear();
+}
+
+QQuickButtonGroupAttached *QQuickButtonGroup::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickButtonGroupAttached(object);
+}
+
+/*!
+ \qmlproperty AbstractButton QtQuick.Controls::ButtonGroup::checkedButton
+
+ This property holds the currently selected button, or \c null if there is none.
+
+ By default, it is the first checked button added to the button group.
+*/
+QQuickAbstractButton *QQuickButtonGroup::checkedButton() const
+{
+ Q_D(const QQuickButtonGroup);
+ return d->checkedButton;
+}
+
+void QQuickButtonGroup::setCheckedButton(QQuickAbstractButton *checkedButton)
+{
+ Q_D(QQuickButtonGroup);
+ if (d->checkedButton == checkedButton)
+ return;
+
+ if (d->checkedButton)
+ d->checkedButton->setChecked(false);
+ d->checkedButton = checkedButton;
+ if (checkedButton)
+ checkedButton->setChecked(true);
+ emit checkedButtonChanged();
+}
+
+/*!
+ \qmlproperty list<AbstractButton> QtQuick.Controls::ButtonGroup::buttons
+ \default
+
+ This property holds the list of buttons.
+
+ \code
+ ButtonGroup {
+ buttons: column.children
+ }
+
+ Column {
+ id: column
+
+ RadioButton {
+ checked: true
+ text: qsTr("Option A")
+ }
+
+ RadioButton {
+ text: qsTr("Option B")
+ }
+ }
+ \endcode
+
+ \sa group
+*/
+QQmlListProperty<QQuickAbstractButton> QQuickButtonGroup::buttons()
+{
+ Q_D(QQuickButtonGroup);
+ return QQmlListProperty<QQuickAbstractButton>(this, d,
+ QQuickButtonGroupPrivate::buttons_append,
+ QQuickButtonGroupPrivate::buttons_count,
+ QQuickButtonGroupPrivate::buttons_at,
+ QQuickButtonGroupPrivate::buttons_clear);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::ButtonGroup::addButton(AbstractButton button)
+
+ Adds a \a button to the button group.
+
+ \note Manually adding objects to a button group is typically unnecessary.
+ The \l buttons property and the \l group attached property provide a
+ convenient and declarative syntax.
+
+ \sa buttons, group
+*/
+void QQuickButtonGroup::addButton(QQuickAbstractButton *button)
+{
+ Q_D(QQuickButtonGroup);
+ if (!button || d->buttons.contains(button))
+ return;
+
+ QQuickAbstractButtonPrivate::get(button)->group = this;
+ QObjectPrivate::connect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::_q_updateCurrent);
+
+ if (button->isChecked())
+ setCheckedButton(button);
+
+ d->buttons.append(button);
+ emit buttonsChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::ButtonGroup::removeButton(AbstractButton button)
+
+ Removes a \a button from the button group.
+
+ \note Manually removing objects from a button group is typically unnecessary.
+ The \l buttons property and the \l group attached property provide a
+ convenient and declarative syntax.
+
+ \sa buttons, group
+*/
+void QQuickButtonGroup::removeButton(QQuickAbstractButton *button)
+{
+ Q_D(QQuickButtonGroup);
+ if (!button || !d->buttons.contains(button))
+ return;
+
+ QQuickAbstractButtonPrivate::get(button)->group = nullptr;
+ QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::_q_updateCurrent);
+
+ if (d->checkedButton == button)
+ setCheckedButton(nullptr);
+
+ d->buttons.removeOne(button);
+ emit buttonsChanged();
+}
+
+class QQuickButtonGroupAttachedPrivate : public QObjectPrivate
+{
+public:
+ QQuickButtonGroupAttachedPrivate() : group(nullptr) { }
+
+ QQuickButtonGroup *group;
+};
+
+QQuickButtonGroupAttached::QQuickButtonGroupAttached(QObject *parent) :
+ QObject(*(new QQuickButtonGroupAttachedPrivate), parent)
+{
+}
+
+/*!
+ \qmlattachedproperty ButtonGroup QtQuick.Controls::ButtonGroup::group
+
+ This property attaches a button to a button group.
+
+ \code
+ ButtonGroup { id: group }
+
+ RadioButton {
+ checked: true
+ text: qsTr("Option A")
+ ButtonGroup.group: group
+ }
+
+ RadioButton {
+ text: qsTr("Option B")
+ ButtonGroup.group: group
+ }
+ \endcode
+
+ \sa buttons
+*/
+QQuickButtonGroup *QQuickButtonGroupAttached::group() const
+{
+ Q_D(const QQuickButtonGroupAttached);
+ return d->group;
+}
+
+void QQuickButtonGroupAttached::setGroup(QQuickButtonGroup *group)
+{
+ Q_D(QQuickButtonGroupAttached);
+ 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
+
+#include "moc_qquickbuttongroup_p.cpp"
diff --git a/src/quicktemplates2/qquickbuttongroup_p.h b/src/quicktemplates2/qquickbuttongroup_p.h
new file mode 100644
index 00000000..baf4e13f
--- /dev/null
+++ b/src/quicktemplates2/qquickbuttongroup_p.h
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKBUTTONGROUP_P_H
+#define QQUICKBUTTONGROUP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAbstractButton;
+class QQuickButtonGroupPrivate;
+class QQuickButtonGroupAttached;
+class QQuickButtonGroupAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickButtonGroup : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickAbstractButton *checkedButton READ checkedButton WRITE setCheckedButton NOTIFY checkedButtonChanged)
+ Q_PROPERTY(QQmlListProperty<QQuickAbstractButton> buttons READ buttons NOTIFY buttonsChanged FINAL)
+
+public:
+ explicit QQuickButtonGroup(QObject *parent = nullptr);
+ ~QQuickButtonGroup();
+
+ static QQuickButtonGroupAttached *qmlAttachedProperties(QObject *object);
+
+ QQuickAbstractButton *checkedButton() const;
+ void setCheckedButton(QQuickAbstractButton *checkedButton);
+
+ QQmlListProperty<QQuickAbstractButton> buttons();
+
+public Q_SLOTS:
+ void addButton(QQuickAbstractButton *button);
+ void removeButton(QQuickAbstractButton *button);
+
+Q_SIGNALS:
+ void checkedButtonChanged();
+ void buttonsChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickButtonGroup)
+ Q_DECLARE_PRIVATE(QQuickButtonGroup)
+
+ Q_PRIVATE_SLOT(d_func(), void _q_updateCurrent())
+};
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickButtonGroupAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickButtonGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL)
+
+public:
+ explicit QQuickButtonGroupAttached(QObject *parent = nullptr);
+
+ QQuickButtonGroup *group() const;
+ void setGroup(QQuickButtonGroup *group);
+
+Q_SIGNALS:
+ void groupChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickButtonGroupAttached)
+ Q_DECLARE_PRIVATE(QQuickButtonGroupAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickButtonGroup)
+QML_DECLARE_TYPEINFO(QQuickButtonGroup, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKBUTTONGROUP_P_H
diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp
new file mode 100644
index 00000000..fd5ab6ba
--- /dev/null
+++ b/src/quicktemplates2/qquickcheckbox.cpp
@@ -0,0 +1,197 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcheckbox_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype CheckBox
+ \inherits AbstractButton
+ \instantiates QQuickCheckBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-buttons
+ \brief Check button that can be toggled on or off.
+
+ \image qtquickcontrols2-checkbox.gif
+
+ CheckBox presents an option button that can be toggled on (checked) or
+ off (unchecked). Check boxes are typically used to select one or more
+ options from a set of options. For larger sets of options, such as those
+ in a list, consider using \l CheckDelegate instead.
+
+ CheckBox inherits its API from \l AbstractButton. For instance, the
+ state of the checkbox can be set with the \l {AbstractButton::}{checked} property.
+
+ In addition to the checked and unchecked states, there is a third state:
+ partially checked. The partially checked state can be enabled using the
+ \l tristate property. This state indicates that the regular checked/unchecked
+ state can not be determined; generally because of other states that affect
+ the checkbox. This state is useful when several child nodes are selected
+ in a treeview, for example.
+
+ \code
+ ColumnLayout {
+ CheckBox {
+ checked: true
+ text: qsTr("First")
+ }
+ CheckBox {
+ text: qsTr("Second")
+ }
+ CheckBox {
+ checked: true
+ text: qsTr("Third")
+ }
+ }
+ \endcode
+
+ \sa {Customizing CheckBox}, {Button Controls}
+*/
+
+class QQuickCheckBoxPrivate : public QQuickAbstractButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickCheckBox)
+
+public:
+ QQuickCheckBoxPrivate()
+ : tristate(false), checkState(Qt::Unchecked)
+ {
+ }
+
+ bool tristate;
+ Qt::CheckState checkState;
+};
+
+QQuickCheckBox::QQuickCheckBox(QQuickItem *parent) :
+ QQuickAbstractButton(*(new QQuickCheckBoxPrivate), parent)
+{
+ setCheckable(true);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::CheckBox::tristate
+
+ This property holds whether the checkbox is a tri-state checkbox.
+
+ In the animation below, the first checkbox is tri-state:
+
+ \image qtquickcontrols2-checkbox-tristate.gif
+
+ The default is \c false, i.e., the checkbox has only two states.
+*/
+bool QQuickCheckBox::isTristate() const
+{
+ Q_D(const QQuickCheckBox);
+ return d->tristate;
+}
+
+void QQuickCheckBox::setTristate(bool tristate)
+{
+ Q_D(QQuickCheckBox);
+ if (d->tristate == tristate)
+ return;
+
+ d->tristate = tristate;
+ emit tristateChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::CheckBox::checkState
+
+ This property holds the check state of the checkbox.
+
+ Available states:
+ \value Qt.Unchecked The checkbox is unchecked.
+ \value Qt.PartiallyChecked The checkbox is partially checked. This state is only used when \l tristate is enabled.
+ \value Qt.Checked The checkbox is checked.
+
+ \sa tristate, {AbstractButton::checked}{checked}
+*/
+Qt::CheckState QQuickCheckBox::checkState() const
+{
+ Q_D(const QQuickCheckBox);
+ return d->checkState;
+}
+
+void QQuickCheckBox::setCheckState(Qt::CheckState state)
+{
+ Q_D(QQuickCheckBox);
+ if (d->checkState == state)
+ return;
+
+ if (!d->tristate && state == Qt::PartiallyChecked)
+ setTristate(true);
+
+ bool wasChecked = isChecked();
+ d->checked = state != Qt::Unchecked;
+ d->checkState = state;
+ emit checkStateChanged();
+ if (d->checked != wasChecked)
+ emit checkedChanged();
+}
+
+QFont QQuickCheckBox::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::CheckBoxFont);
+}
+
+void QQuickCheckBox::checkStateSet()
+{
+ setCheckState(isChecked() ? Qt::Checked : Qt::Unchecked);
+}
+
+void QQuickCheckBox::nextCheckState()
+{
+ Q_D(QQuickCheckBox);
+ if (d->tristate)
+ setCheckState(static_cast<Qt::CheckState>((d->checkState + 1) % 3));
+ else
+ QQuickAbstractButton::nextCheckState();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickCheckBox::accessibleRole() const
+{
+ return QAccessible::CheckBox;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcheckbox_p.h b/src/quicktemplates2/qquickcheckbox_p.h
new file mode 100644
index 00000000..bee3bae4
--- /dev/null
+++ b/src/quicktemplates2/qquickcheckbox_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCHECKBOX_P_H
+#define QQUICKCHECKBOX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickCheckBoxPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickCheckBox : public QQuickAbstractButton
+{
+ Q_OBJECT
+ Q_PROPERTY(bool tristate READ isTristate WRITE setTristate NOTIFY tristateChanged FINAL)
+ Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL)
+
+public:
+ explicit QQuickCheckBox(QQuickItem *parent = nullptr);
+
+ bool isTristate() const;
+ void setTristate(bool tristate);
+
+ Qt::CheckState checkState() const;
+ void setCheckState(Qt::CheckState state);
+
+Q_SIGNALS:
+ void tristateChanged();
+ void checkStateChanged();
+
+protected:
+ QFont defaultFont() const override;
+
+ void checkStateSet() override;
+ void nextCheckState() override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickCheckBox)
+ Q_DECLARE_PRIVATE(QQuickCheckBox)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickCheckBox)
+
+#endif // QQUICKCHECKBOX_P_H
diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp
new file mode 100644
index 00000000..51bc8501
--- /dev/null
+++ b/src/quicktemplates2/qquickcheckdelegate.cpp
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcheckdelegate_p.h"
+#include "qquickitemdelegate_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype CheckDelegate
+ \inherits ItemDelegate
+ \instantiates QQuickCheckDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-delegates
+ \brief Item delegate with a check indicator that can be toggled on or off.
+
+ \image qtquickcontrols2-checkdelegate.gif
+
+ CheckDelegate presents an item delegate that can be toggled on (checked) or
+ off (unchecked). Check delegates are typically used to select one or more
+ options from a set of options in a list. For smaller sets of options, or
+ for options that need to be uniquely identifiable, consider using
+ \l CheckBox instead.
+
+ CheckDelegate inherits its API from \l ItemDelegate, which is inherited
+ from AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton
+ API. The state of the check delegate can be set with the
+ \l {AbstractButton::}{checked} property.
+
+ In addition to the checked and unchecked states, there is a third state:
+ partially checked. The partially checked state can be enabled using the
+ \l tristate property. This state indicates that the regular checked/unchecked
+ state can not be determined; generally because of other states that affect
+ the check delegate. This state is useful when several child nodes are selected
+ in a treeview, for example.
+
+ \code
+ ListView {
+ model: ["Option 1", "Option 2", "Option 3"]
+ delegate: CheckDelegate {
+ text: modelData
+ }
+ }
+ \endcode
+
+ \sa {Customizing CheckDelegate}, {Delegate Controls}, CheckBox
+*/
+
+class QQuickCheckDelegatePrivate : public QQuickItemDelegatePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickCheckDelegate)
+
+public:
+ QQuickCheckDelegatePrivate()
+ : tristate(false), checkState(Qt::Unchecked)
+ {
+ }
+
+ bool tristate;
+ Qt::CheckState checkState;
+};
+
+QQuickCheckDelegate::QQuickCheckDelegate(QQuickItem *parent) :
+ QQuickItemDelegate(*(new QQuickCheckDelegatePrivate), parent)
+{
+ setCheckable(true);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::CheckDelegate::tristate
+
+ This property determines whether the check delegate has three states.
+
+ In the animation below, the first checkdelegate is tri-state:
+
+ \image qtquickcontrols2-checkdelegate-tristate.gif
+
+ The default is \c false, i.e., the delegate has only two states.
+*/
+bool QQuickCheckDelegate::isTristate() const
+{
+ Q_D(const QQuickCheckDelegate);
+ return d->tristate;
+}
+
+void QQuickCheckDelegate::setTristate(bool tristate)
+{
+ Q_D(QQuickCheckDelegate);
+ if (d->tristate == tristate)
+ return;
+
+ d->tristate = tristate;
+ emit tristateChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::CheckDelegate::checkState
+
+ This property determines the check state of the check delegate.
+
+ Available states:
+ \value Qt.Unchecked The delegate is unchecked.
+ \value Qt.PartiallyChecked The delegate is partially checked. This state is only used when \l tristate is enabled.
+ \value Qt.Checked The delegate is checked.
+
+ \sa tristate, {AbstractButton::checked}{checked}
+*/
+Qt::CheckState QQuickCheckDelegate::checkState() const
+{
+ Q_D(const QQuickCheckDelegate);
+ return d->checkState;
+}
+
+void QQuickCheckDelegate::setCheckState(Qt::CheckState state)
+{
+ Q_D(QQuickCheckDelegate);
+ if (d->checkState == state)
+ return;
+
+ if (!d->tristate && state == Qt::PartiallyChecked)
+ setTristate(true);
+
+ bool wasChecked = isChecked();
+ d->checked = state != Qt::Unchecked;
+ d->checkState = state;
+ emit checkStateChanged();
+ if (d->checked != wasChecked)
+ emit checkedChanged();
+}
+
+QFont QQuickCheckDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
+void QQuickCheckDelegate::checkStateSet()
+{
+ setCheckState(isChecked() ? Qt::Checked : Qt::Unchecked);
+}
+
+void QQuickCheckDelegate::nextCheckState()
+{
+ Q_D(QQuickCheckDelegate);
+ if (d->tristate)
+ setCheckState(static_cast<Qt::CheckState>((d->checkState + 1) % 3));
+ else
+ QQuickItemDelegate::nextCheckState();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickCheckDelegate::accessibleRole() const
+{
+ return QAccessible::CheckBox;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcheckdelegate_p.h b/src/quicktemplates2/qquickcheckdelegate_p.h
new file mode 100644
index 00000000..d0509512
--- /dev/null
+++ b/src/quicktemplates2/qquickcheckdelegate_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCHECKDELEGATE_P_H
+#define QQUICKCHECKDELEGATE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickCheckDelegatePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickCheckDelegate : public QQuickItemDelegate
+{
+ Q_OBJECT
+ Q_PROPERTY(bool tristate READ isTristate WRITE setTristate NOTIFY tristateChanged FINAL)
+ Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL)
+
+public:
+ explicit QQuickCheckDelegate(QQuickItem *parent = nullptr);
+
+ bool isTristate() const;
+ void setTristate(bool tristate);
+
+ Qt::CheckState checkState() const;
+ void setCheckState(Qt::CheckState state);
+
+Q_SIGNALS:
+ void tristateChanged();
+ void checkStateChanged();
+
+protected:
+ QFont defaultFont() const override;
+
+ void checkStateSet() override;
+ void nextCheckState() override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickCheckDelegate)
+ Q_DECLARE_PRIVATE(QQuickCheckDelegate)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickCheckDelegate)
+
+#endif // QQUICKCHECKDELEGATE_P_H
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
new file mode 100644
index 00000000..01f0f699
--- /dev/null
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -0,0 +1,1037 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcombobox_p.h"
+#include "qquickcontrol_p_p.h"
+#include "qquickabstractbutton_p.h"
+#include "qquickpopup_p_p.h"
+
+#include <QtCore/qregexp.h>
+#include <QtCore/qabstractitemmodel.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ComboBox
+ \inherits Control
+ \instantiates QQuickComboBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Combined button and popup list for selecting options.
+
+ \image qtquickcontrols2-combobox.gif
+
+ ComboBox is a combined button and popup list. It provides a means of
+ presenting a list of options to the user in a way that takes up the
+ minimum amount of screen space.
+
+ ComboBox is populated with a data model. The data model is commonly
+ a JavaScript array, a \l ListModel or an integer, but other types
+ of \l {qml-data-models}{data models} are also supported.
+
+ \code
+ ComboBox {
+ model: ["First", "Second", "Third"]
+ }
+ \endcode
+
+ \section1 ComboBox Model Roles
+
+ ComboBox is able to visualize standard \l {qml-data-models}{data models}
+ that provide the \c modelData role:
+ \list
+ \li models that have only one role
+ \li models that do not have named roles (JavaScript array, integer)
+ \endlist
+
+ When using models that have multiple named roles, ComboBox must be configured
+ to use a specific \l {textRole}{text role} for its \l {displayText}{display text}
+ and \l delegate instances.
+
+ \code
+ ComboBox {
+ textRole: "key"
+ model: ListModel {
+ ListElement { key: "First"; value: 123 }
+ ListElement { key: "Second"; value: 456 }
+ ListElement { key: "Third"; value: 789 }
+ }
+ }
+ \endcode
+
+ \note If ComboBox is assigned a data model that has multiple named roles, but
+ \l textRole is not defined, ComboBox is unable to visualize it and throws a
+ \c {ReferenceError: modelData is not defined}.
+
+ \sa {Customizing ComboBox}, {Input Controls}
+*/
+
+/*!
+ \qmlsignal void QtQuick.Controls::ComboBox::activated(int index)
+
+ This signal is emitted when the item at \a index is activated by the user.
+
+ An item is activated when it is selected while the popup is open,
+ causing the popup to close (and \l currentIndex to change),
+ or while the popup is closed and the combo box is navigated via
+ keyboard, causing the \l currentIndex to change.
+ The \l currentIndex property is set to \a index.
+
+ \sa currentIndex
+*/
+
+/*!
+ \qmlsignal void QtQuick.Controls::ComboBox::highlighted(int index)
+
+ This signal is emitted when the item at \a index in the popup list is highlighted by the user.
+
+ The highlighted signal is only emitted when the popup is open and an item
+ is highlighted, but not necessarily \l activated.
+
+ \sa highlightedIndex
+*/
+
+namespace {
+ enum Activation { NoActivate, Activate };
+ enum Highlighting { NoHighlight, Highlight };
+}
+
+class QQuickComboBoxDelegateModel : public QQmlDelegateModel
+{
+public:
+ explicit QQuickComboBoxDelegateModel(QQuickComboBox *combo);
+ QString stringValue(int index, const QString &role) override;
+
+private:
+ QQuickComboBox *combo;
+};
+
+QQuickComboBoxDelegateModel::QQuickComboBoxDelegateModel(QQuickComboBox *combo) :
+ QQmlDelegateModel(qmlContext(combo), combo), combo(combo)
+{
+}
+
+QString QQuickComboBoxDelegateModel::stringValue(int index, const QString &role)
+{
+ QVariant model = combo->model();
+ if (model.userType() == QMetaType::QVariantList) {
+ QVariant object = model.toList().value(index);
+ if (object.userType() == QMetaType::QVariantMap) {
+ const QVariantMap data = object.toMap();
+ if (data.count() == 1 && role == QLatin1String("modelData"))
+ return data.first().toString();
+ return data.value(role).toString();
+ }
+ }
+ return QQmlDelegateModel::stringValue(index, role);
+}
+
+class QQuickComboBoxPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickComboBox)
+
+public:
+ QQuickComboBoxPrivate() : pressed(false), ownModel(false), hasDisplayText(false), hasCurrentIndex(false),
+ highlightedIndex(-1), currentIndex(-1), delegateModel(nullptr),
+ delegate(nullptr), indicator(nullptr), popup(nullptr) { }
+
+ bool isPopupVisible() const;
+ void showPopup();
+ void hidePopup(bool accept);
+ void togglePopup(bool accept);
+
+ void itemClicked();
+
+ void createdItem(int index, QObject *object);
+ void countChanged();
+ void updateCurrentText();
+ void incrementCurrentIndex();
+ void decrementCurrentIndex();
+ void setCurrentIndex(int index, Activation activate);
+ void updateHighlightedIndex();
+ void setHighlightedIndex(int index, Highlighting highlight);
+
+ void keySearch(const QString &text);
+ int match(int start, const QString &text, Qt::MatchFlags flags) const;
+
+ void createDelegateModel();
+
+ bool pressed;
+ bool ownModel;
+ bool hasDisplayText;
+ bool hasCurrentIndex;
+ int highlightedIndex;
+ int currentIndex;
+ QVariant model;
+ QString textRole;
+ QString currentText;
+ QString displayText;
+ QQuickItem *pressedItem;
+ QQmlInstanceModel *delegateModel;
+ QQmlComponent *delegate;
+ QQuickItem *indicator;
+ QQuickPopup *popup;
+};
+
+bool QQuickComboBoxPrivate::isPopupVisible() const
+{
+ return popup && popup->isVisible();
+}
+
+void QQuickComboBoxPrivate::showPopup()
+{
+ if (popup && !popup->isVisible())
+ popup->open();
+}
+
+void QQuickComboBoxPrivate::hidePopup(bool accept)
+{
+ Q_Q(QQuickComboBox);
+ if (accept) {
+ q->setCurrentIndex(highlightedIndex);
+ emit q->activated(currentIndex);
+ }
+ if (popup && popup->isVisible())
+ popup->close();
+}
+
+void QQuickComboBoxPrivate::togglePopup(bool accept)
+{
+ if (!popup)
+ return;
+
+ if (popup->isVisible())
+ hidePopup(accept);
+ else
+ showPopup();
+}
+
+void QQuickComboBoxPrivate::itemClicked()
+{
+ Q_Q(QQuickComboBox);
+ int index = delegateModel->indexOf(q->sender(), nullptr);
+ if (index != -1) {
+ setHighlightedIndex(index, Highlight);
+ hidePopup(true);
+ }
+}
+
+void QQuickComboBoxPrivate::createdItem(int index, QObject *object)
+{
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(object);
+ if (button) {
+ button->setFocusPolicy(Qt::NoFocus);
+ connect(button, &QQuickAbstractButton::clicked, this, &QQuickComboBoxPrivate::itemClicked);
+ }
+
+ if (index == currentIndex)
+ updateCurrentText();
+}
+
+void QQuickComboBoxPrivate::countChanged()
+{
+ Q_Q(QQuickComboBox);
+ if (q->count() == 0)
+ q->setCurrentIndex(-1);
+ emit q->countChanged();
+}
+
+void QQuickComboBoxPrivate::updateCurrentText()
+{
+ Q_Q(QQuickComboBox);
+ QString text = q->textAt(currentIndex);
+ if (currentText != text) {
+ currentText = text;
+ if (!hasDisplayText)
+ q->setAccessibleName(text);
+ emit q->currentTextChanged();
+ }
+ if (!hasDisplayText && displayText != text) {
+ displayText = text;
+ emit q->displayTextChanged();
+ }
+}
+
+void QQuickComboBoxPrivate::setCurrentIndex(int index, Activation activate)
+{
+ Q_Q(QQuickComboBox);
+ if (currentIndex == index)
+ return;
+
+ currentIndex = index;
+ emit q->currentIndexChanged();
+
+ if (componentComplete)
+ updateCurrentText();
+
+ if (activate)
+ emit q->activated(index);
+}
+
+void QQuickComboBoxPrivate::incrementCurrentIndex()
+{
+ Q_Q(QQuickComboBox);
+ if (isPopupVisible()) {
+ if (highlightedIndex < q->count() - 1)
+ setHighlightedIndex(highlightedIndex + 1, Highlight);
+ } else {
+ if (currentIndex < q->count() - 1)
+ setCurrentIndex(currentIndex + 1, Activate);
+ }
+}
+
+void QQuickComboBoxPrivate::decrementCurrentIndex()
+{
+ if (isPopupVisible()) {
+ if (highlightedIndex > 0)
+ setHighlightedIndex(highlightedIndex - 1, Highlight);
+ } else {
+ if (currentIndex > 0)
+ setCurrentIndex(currentIndex - 1, Activate);
+ }
+}
+
+void QQuickComboBoxPrivate::updateHighlightedIndex()
+{
+ setHighlightedIndex(popup->isVisible() ? currentIndex : -1, NoHighlight);
+}
+
+void QQuickComboBoxPrivate::setHighlightedIndex(int index, Highlighting highlight)
+{
+ Q_Q(QQuickComboBox);
+ if (highlightedIndex == index)
+ return;
+
+ highlightedIndex = index;
+ emit q->highlightedIndexChanged();
+
+ if (highlight)
+ emit q->highlighted(index);
+}
+
+void QQuickComboBoxPrivate::keySearch(const QString &text)
+{
+ int index = match(currentIndex + 1, text, Qt::MatchStartsWith | Qt::MatchWrap);
+ if (index != -1)
+ setCurrentIndex(index, Activate);
+}
+
+int QQuickComboBoxPrivate::match(int start, const QString &text, Qt::MatchFlags flags) const
+{
+ Q_Q(const QQuickComboBox);
+ uint matchType = flags & 0x0F;
+ bool wrap = flags & Qt::MatchWrap;
+ Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ int from = start;
+ int to = q->count();
+
+ // iterates twice if wrapping
+ for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) {
+ for (int idx = from; idx < to; ++idx) {
+ QString t = q->textAt(idx);
+ switch (matchType) {
+ case Qt::MatchExactly:
+ if (t == text)
+ return idx;
+ break;
+ case Qt::MatchRegExp:
+ if (QRegExp(text, cs).exactMatch(t))
+ return idx;
+ break;
+ case Qt::MatchWildcard:
+ if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
+ return idx;
+ break;
+ case Qt::MatchStartsWith:
+ if (t.startsWith(text, cs))
+ return idx;
+ break;
+ case Qt::MatchEndsWith:
+ if (t.endsWith(text, cs))
+ return idx;
+ break;
+ case Qt::MatchFixedString:
+ if (t.compare(text, cs) == 0)
+ return idx;
+ break;
+ case Qt::MatchContains:
+ default:
+ if (t.contains(text, cs))
+ return idx;
+ break;
+ }
+ }
+ // prepare for the next iteration
+ from = 0;
+ to = start;
+ }
+ return -1;
+}
+
+void QQuickComboBoxPrivate::createDelegateModel()
+{
+ Q_Q(QQuickComboBox);
+ bool ownedOldModel = ownModel;
+ QQmlInstanceModel* oldModel = delegateModel;
+ if (oldModel) {
+ disconnect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
+ disconnect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
+ disconnect(delegateModel, &QQmlInstanceModel::createdItem, this, &QQuickComboBoxPrivate::createdItem);
+ }
+
+ ownModel = false;
+ delegateModel = model.value<QQmlInstanceModel *>();
+
+ if (!delegateModel && model.isValid()) {
+ QQmlDelegateModel *dataModel = new QQuickComboBoxDelegateModel(q);
+ dataModel->setModel(model);
+ dataModel->setDelegate(delegate);
+ if (q->isComponentComplete())
+ dataModel->componentComplete();
+
+ ownModel = true;
+ delegateModel = dataModel;
+ }
+
+ if (delegateModel) {
+ connect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
+ connect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
+ connect(delegateModel, &QQmlInstanceModel::createdItem, this, &QQuickComboBoxPrivate::createdItem);
+ }
+
+ emit q->delegateModelChanged();
+
+ if (ownedOldModel)
+ delete oldModel;
+}
+
+QQuickComboBox::QQuickComboBox(QQuickItem *parent) :
+ QQuickControl(*(new QQuickComboBoxPrivate), parent)
+{
+ setFocusPolicy(Qt::StrongFocus);
+ setFlag(QQuickItem::ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickComboBox::~QQuickComboBox()
+{
+ Q_D(QQuickComboBox);
+ delete d->popup;
+ d->popup = nullptr;
+}
+
+/*!
+ \readonly
+ \qmlproperty int QtQuick.Controls::ComboBox::count
+
+ This property holds the number of items in the combo box.
+*/
+int QQuickComboBox::count() const
+{
+ Q_D(const QQuickComboBox);
+ return d->delegateModel ? d->delegateModel->count() : 0;
+}
+
+/*!
+ \qmlproperty model QtQuick.Controls::ComboBox::model
+
+ This property holds the model providing data for the combo box.
+
+ \code
+ ComboBox {
+ textRole: "key"
+ model: ListModel {
+ ListElement { key: "First"; value: 123 }
+ ListElement { key: "Second"; value: 456 }
+ ListElement { key: "Third"; value: 789 }
+ }
+ }
+ \endcode
+
+ \sa textRole, {qml-data-models}{Data Models}
+*/
+QVariant QQuickComboBox::model() const
+{
+ Q_D(const QQuickComboBox);
+ return d->model;
+}
+
+void QQuickComboBox::setModel(const QVariant& m)
+{
+ Q_D(QQuickComboBox);
+ QVariant model = m;
+ if (model.userType() == qMetaTypeId<QJSValue>())
+ model = model.value<QJSValue>().toVariant();
+
+ if (d->model == model)
+ return;
+
+ if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(d->model))
+ QObjectPrivate::disconnect(aim, &QAbstractItemModel::dataChanged, d, &QQuickComboBoxPrivate::updateCurrentText);
+ if (QAbstractItemModel* aim = qvariant_cast<QAbstractItemModel *>(model))
+ QObjectPrivate::connect(aim, &QAbstractItemModel::dataChanged, d, &QQuickComboBoxPrivate::updateCurrentText);
+
+ d->model = model;
+ d->createDelegateModel();
+ if (isComponentComplete()) {
+ setCurrentIndex(count() > 0 ? 0 : -1);
+ d->updateCurrentText();
+ }
+ emit modelChanged();
+}
+
+/*!
+ \internal
+ \qmlproperty model QtQuick.Controls::ComboBox::delegateModel
+
+ This property holds the model providing delegate instances for the combo box.
+*/
+QQmlInstanceModel *QQuickComboBox::delegateModel() const
+{
+ Q_D(const QQuickComboBox);
+ return d->delegateModel;
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::ComboBox::pressed
+
+ This property holds whether the combo box button is pressed.
+*/
+bool QQuickComboBox::isPressed() const
+{
+ Q_D(const QQuickComboBox);
+ return d->pressed;
+}
+
+void QQuickComboBox::setPressed(bool pressed)
+{
+ Q_D(QQuickComboBox);
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ emit pressedChanged();
+}
+
+/*!
+ \readonly
+ \qmlproperty int QtQuick.Controls::ComboBox::highlightedIndex
+
+ This property holds the index of the highlighted item in the combo box popup list.
+
+ When a highlighted item is activated, the popup is closed, \l currentIndex
+ is set to \c highlightedIndex, and the value of this property is reset to
+ \c -1, as there is no longer a highlighted item.
+
+ \sa highlighted(), currentIndex
+*/
+int QQuickComboBox::highlightedIndex() const
+{
+ Q_D(const QQuickComboBox);
+ return d->highlightedIndex;
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::ComboBox::currentIndex
+
+ This property holds the index of the current item in the combo box.
+
+ \sa activated(), currentText, highlightedIndex
+*/
+int QQuickComboBox::currentIndex() const
+{
+ Q_D(const QQuickComboBox);
+ return d->currentIndex;
+}
+
+void QQuickComboBox::setCurrentIndex(int index)
+{
+ Q_D(QQuickComboBox);
+ d->hasCurrentIndex = true;
+ d->setCurrentIndex(index, NoActivate);
+}
+
+/*!
+ \readonly
+ \qmlproperty string QtQuick.Controls::ComboBox::currentText
+
+ This property holds the text of the current item in the combo box.
+
+ \sa currentIndex, displayText, textRole
+*/
+QString QQuickComboBox::currentText() const
+{
+ Q_D(const QQuickComboBox);
+ return d->currentText;
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::ComboBox::displayText
+
+ This property holds the text that is displayed on the combo box button.
+
+ By default, the display text presents the current selection. That is,
+ it follows the text of the current item. However, the default display
+ text can be overridden with a custom value.
+
+ \code
+ ComboBox {
+ currentIndex: 1
+ displayText: "Size: " + currentText
+ model: ["S", "M", "L"]
+ }
+ \endcode
+
+ \sa currentText, textRole
+*/
+QString QQuickComboBox::displayText() const
+{
+ Q_D(const QQuickComboBox);
+ return d->displayText;
+}
+
+void QQuickComboBox::setDisplayText(const QString &text)
+{
+ Q_D(QQuickComboBox);
+ d->hasDisplayText = true;
+ if (d->displayText == text)
+ return;
+
+ d->displayText = text;
+ setAccessibleName(text);
+ emit displayTextChanged();
+}
+
+void QQuickComboBox::resetDisplayText()
+{
+ Q_D(QQuickComboBox);
+ if (!d->hasDisplayText)
+ return;
+
+ d->hasDisplayText = false;
+ d->updateCurrentText();
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::ComboBox::textRole
+
+ This property holds the model role used for populating the combo box.
+
+ When the model has multiple roles, \c textRole can be set to determine
+ which role should be displayed.
+
+ \sa model, currentText, displayText, {ComboBox Model Roles}
+*/
+QString QQuickComboBox::textRole() const
+{
+ Q_D(const QQuickComboBox);
+ return d->textRole;
+}
+
+void QQuickComboBox::setTextRole(const QString &role)
+{
+ Q_D(QQuickComboBox);
+ if (d->textRole == role)
+ return;
+
+ d->textRole = role;
+ if (isComponentComplete())
+ d->updateCurrentText();
+ emit textRoleChanged();
+}
+
+/*!
+ \qmlproperty Component QtQuick.Controls::ComboBox::delegate
+
+ This property holds a delegate that presents an item in the combo box popup.
+
+ It is recommended to use \l ItemDelegate (or any other \l AbstractButton
+ derivatives) as the delegate. This ensures that the interaction works as
+ expected, and the popup will automatically close when appropriate. When
+ other types are used as the delegate, the popup must be closed manually.
+ For example, if \l MouseArea is used:
+
+ \code
+ delegate: Rectangle {
+ // ...
+ MouseArea {
+ // ...
+ onClicked: comboBox.popup.close()
+ }
+ }
+ \endcode
+
+ \sa ItemDelegate, {Customizing ComboBox}
+*/
+QQmlComponent *QQuickComboBox::delegate() const
+{
+ Q_D(const QQuickComboBox);
+ return d->delegate;
+}
+
+void QQuickComboBox::setDelegate(QQmlComponent* delegate)
+{
+ Q_D(QQuickComboBox);
+ 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();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::ComboBox::indicator
+
+ This property holds the drop indicator item.
+
+ \sa {Customizing ComboBox}
+*/
+QQuickItem *QQuickComboBox::indicator() const
+{
+ Q_D(const QQuickComboBox);
+ return d->indicator;
+}
+
+void QQuickComboBox::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickComboBox);
+ if (d->indicator == indicator)
+ return;
+
+ d->deleteDelegate(d->indicator);
+ d->indicator = indicator;
+ if (indicator) {
+ if (!indicator->parentItem())
+ indicator->setParentItem(this);
+ }
+ emit indicatorChanged();
+}
+
+/*!
+ \qmlproperty Popup QtQuick.Controls::ComboBox::popup
+
+ This property holds the popup.
+
+ The popup can be opened or closed manually, if necessary:
+
+ \code
+ onSpecialEvent: comboBox.popup.close()
+ \endcode
+
+ \sa {Customizing ComboBox}
+*/
+QQuickPopup *QQuickComboBox::popup() const
+{
+ Q_D(const QQuickComboBox);
+ return d->popup;
+}
+
+void QQuickComboBox::setPopup(QQuickPopup *popup)
+{
+ Q_D(QQuickComboBox);
+ if (d->popup == popup)
+ return;
+
+ if (d->popup)
+ QObjectPrivate::disconnect(d->popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::updateHighlightedIndex);
+ d->deleteDelegate(d->popup);
+ if (popup) {
+ QQuickPopupPrivate::get(popup)->allowVerticalFlip = true;
+ popup->setClosePolicy(QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutsideParent);
+ QObjectPrivate::connect(popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::updateHighlightedIndex);
+ }
+ d->popup = popup;
+ emit popupChanged();
+}
+
+/*!
+ \qmlmethod string QtQuick.Controls::ComboBox::textAt(int index)
+
+ Returns the text for the specified \a index, or an empty string
+ if the index is out of bounds.
+
+ \sa textRole
+*/
+QString QQuickComboBox::textAt(int index) const
+{
+ Q_D(const QQuickComboBox);
+ if (!d->delegateModel || index < 0 || index >= d->delegateModel->count())
+ return QString();
+
+ QString text;
+ QObject *object = d->delegateModel->object(index);
+ if (object) {
+ text = d->delegateModel->stringValue(index, d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole);
+ d->delegateModel->release(object);
+ }
+ return text;
+}
+
+/*!
+ \qmlmethod int QtQuick.Controls::ComboBox::find(string text, flags = Qt.MatchExactly)
+
+ Returns the index of the specified \a text, or \c -1 if no match is found.
+
+ The way the search is performed is defined by the specified match \a flags. By default,
+ combo box performs case sensitive exact matching (\c Qt.MatchExactly). All other match
+ types are case-insensitive unless the \c Qt.MatchCaseSensitive flag is also specified.
+
+ \value Qt.MatchExactly The search term matches exactly (default).
+ \value Qt.MatchRegExp The search term matches as a regular expression.
+ \value Qt.MatchWildcard The search term matches using wildcards.
+ \value Qt.MatchFixedString The search term matches as a fixed string.
+ \value Qt.MatchStartsWith The search term matches the start of the item.
+ \value Qt.MatchEndsWidth The search term matches the end of the item.
+ \value Qt.MatchContains The search term is contained in the item.
+ \value Qt.MatchCaseSensitive The search is case sensitive.
+
+ \sa textRole
+*/
+int QQuickComboBox::find(const QString &text, Qt::MatchFlags flags) const
+{
+ Q_D(const QQuickComboBox);
+ return d->match(0, text, flags);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::ComboBox::incrementCurrentIndex()
+
+ Increments the current index of the combo box, or the highlighted
+ index if the popup list is visible.
+
+ \sa currentIndex, highlightedIndex
+*/
+void QQuickComboBox::incrementCurrentIndex()
+{
+ Q_D(QQuickComboBox);
+ d->incrementCurrentIndex();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::ComboBox::decrementCurrentIndex()
+
+ Decrements the current index of the combo box, or the highlighted
+ index if the popup list is visible.
+
+ \sa currentIndex, highlightedIndex
+*/
+void QQuickComboBox::decrementCurrentIndex()
+{
+ Q_D(QQuickComboBox);
+ d->decrementCurrentIndex();
+}
+
+void QQuickComboBox::focusOutEvent(QFocusEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::focusOutEvent(event);
+ d->hidePopup(false);
+ setPressed(false);
+}
+
+void QQuickComboBox::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::keyPressEvent(event);
+
+ switch (event->key()) {
+ case Qt::Key_Escape:
+ case Qt::Key_Back:
+ if (d->isPopupVisible())
+ event->accept();
+ break;
+ case Qt::Key_Space:
+ if (!event->isAutoRepeat())
+ setPressed(true);
+ event->accept();
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ if (d->isPopupVisible())
+ setPressed(true);
+ event->accept();
+ break;
+ case Qt::Key_Up:
+ d->decrementCurrentIndex();
+ event->accept();
+ break;
+ case Qt::Key_Down:
+ d->incrementCurrentIndex();
+ event->accept();
+ break;
+ case Qt::Key_Home:
+ if (d->isPopupVisible())
+ d->setHighlightedIndex(0, Highlight);
+ else
+ d->setCurrentIndex(0, Activate);
+ event->accept();
+ break;
+ case Qt::Key_End:
+ if (d->isPopupVisible())
+ d->setHighlightedIndex(count() - 1, Highlight);
+ else
+ d->setCurrentIndex(count() - 1, Activate);
+ event->accept();
+ break;
+ default:
+ if (!event->text().isEmpty())
+ d->keySearch(event->text());
+ else
+ event->ignore();
+ break;
+ }
+}
+
+void QQuickComboBox::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::keyReleaseEvent(event);
+ if (!d->popup || event->isAutoRepeat())
+ return;
+
+ switch (event->key()) {
+ case Qt::Key_Space:
+ d->togglePopup(true);
+ setPressed(false);
+ event->accept();
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ d->hidePopup(d->isPopupVisible());
+ setPressed(false);
+ event->accept();
+ break;
+ case Qt::Key_Escape:
+ case Qt::Key_Back:
+ d->hidePopup(false);
+ setPressed(false);
+ event->accept();
+ break;
+ default:
+ break;
+ }
+}
+
+void QQuickComboBox::mousePressEvent(QMouseEvent *event)
+{
+ QQuickControl::mousePressEvent(event);
+ setPressed(true);
+}
+
+void QQuickComboBox::mouseMoveEvent(QMouseEvent* event)
+{
+ QQuickControl::mouseMoveEvent(event);
+ setPressed(contains(event->pos()));
+}
+
+void QQuickComboBox::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::mouseReleaseEvent(event);
+ if (d->pressed) {
+ setPressed(false);
+ d->togglePopup(false);
+ }
+}
+
+void QQuickComboBox::mouseUngrabEvent()
+{
+ QQuickControl::mouseUngrabEvent();
+ setPressed(false);
+}
+
+void QQuickComboBox::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::wheelEvent(event);
+ if (d->wheelEnabled && !d->isPopupVisible()) {
+ const int oldIndex = d->currentIndex;
+ if (event->angleDelta().y() > 0)
+ d->decrementCurrentIndex();
+ else
+ d->incrementCurrentIndex();
+ event->setAccepted(d->currentIndex != oldIndex);
+ }
+}
+
+void QQuickComboBox::componentComplete()
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::componentComplete();
+
+ if (d->delegateModel && d->ownModel)
+ static_cast<QQmlDelegateModel *>(d->delegateModel)->componentComplete();
+
+ if (count() > 0) {
+ if (!d->hasCurrentIndex && d->currentIndex == -1)
+ setCurrentIndex(0);
+ else
+ d->updateCurrentText();
+ }
+}
+
+QFont QQuickComboBox::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ComboMenuItemFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickComboBox::accessibleRole() const
+{
+ return QAccessible::ComboBox;
+}
+
+void QQuickComboBox::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
+}
+#endif // QT_NO_ACCESSIBILITY
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
new file mode 100644
index 00000000..4cbdd77b
--- /dev/null
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCOMBOBOX_P_H
+#define QQUICKCOMBOBOX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPopup;
+class QQmlInstanceModel;
+class QQuickComboBoxPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
+ Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(int highlightedIndex READ highlightedIndex NOTIFY highlightedIndexChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+ Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged FINAL)
+ Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText RESET resetDisplayText NOTIFY displayTextChanged FINAL)
+ Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+ Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
+
+public:
+ explicit QQuickComboBox(QQuickItem *parent = nullptr);
+ ~QQuickComboBox();
+
+ int count() const;
+
+ QVariant model() const;
+ void setModel(const QVariant &model);
+ QQmlInstanceModel *delegateModel() const;
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ int highlightedIndex() const;
+
+ int currentIndex() const;
+ void setCurrentIndex(int index);
+
+ QString currentText() const;
+
+ QString displayText() const;
+ void setDisplayText(const QString &text);
+ void resetDisplayText();
+
+ QString textRole() const;
+ void setTextRole(const QString &role);
+
+ QQmlComponent *delegate() const;
+ void setDelegate(QQmlComponent *delegate);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+ QQuickPopup *popup() const;
+ void setPopup(QQuickPopup *popup);
+
+ Q_INVOKABLE QString textAt(int index) const;
+ Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const;
+
+public Q_SLOTS:
+ void incrementCurrentIndex();
+ void decrementCurrentIndex();
+
+Q_SIGNALS:
+ void countChanged();
+ void modelChanged();
+ void delegateModelChanged();
+ void pressedChanged();
+ void highlightedIndexChanged();
+ void currentIndexChanged();
+ void currentTextChanged();
+ void displayTextChanged();
+ void textRoleChanged();
+ void delegateChanged();
+ void indicatorChanged();
+ void popupChanged();
+
+ void activated(int index);
+ void highlighted(int index);
+
+protected:
+ 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 wheelEvent(QWheelEvent *event) override;
+
+ void componentComplete() override;
+
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickComboBox)
+ Q_DECLARE_PRIVATE(QQuickComboBox)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickComboBox)
+
+#endif // QQUICKCOMBOBOX_P_H
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
new file mode 100644
index 00000000..c95cfc75
--- /dev/null
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -0,0 +1,649 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcontainer_p.h"
+#include "qquickcontainer_p_p.h"
+
+#include <QtQuick/private/qquickflickable_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Container
+ \inherits Control
+ \instantiates QQuickContainer
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \brief Abstract base type providing functionality common to containers.
+
+ Container is the base type of container-like user interface controls that
+ allow dynamic insertion and removal of items.
+
+ \section2 Using Containers
+
+ Typically, items are statically declared as children of Container, but it
+ is also possible to \l {addItem}{add}, \l {insertItem}{insert},
+ \l {moveItem}{move} and \l {removeItem}{remove} items dynamically. The
+ items in a container can be accessed using \l itemAt() or
+ \l contentChildren.
+
+ Most containers have the concept of a "current" item. The current item is
+ specified via the \l currentIndex property, and can be accessed using the
+ read-only \l currentItem property.
+
+ The following example illustrates dynamic insertion of items to a \l TabBar,
+ which is one of the concrete implementations of Container.
+
+ \code
+ Row {
+ TabBar {
+ id: tabBar
+
+ currentIndex: 0
+ width: parent.width - addButton.width
+
+ TabButton { text: "TabButton" }
+ }
+
+ Component {
+ id: tabButton
+ TabButton { text: "TabButton" }
+ }
+
+ Button {
+ id: addButton
+ text: "+"
+ flat: true
+ onClicked: {
+ tabBar.addItem(tabButton.createObject(tabBar))
+ console.log("added:", tabBar.itemAt(tabBar.count - 1))
+ }
+ }
+ }
+ \endcode
+
+ \section2 Implementing Containers
+
+ Container does not provide any default visualization. It is used to implement
+ such containers as \l SwipeView and \l TabBar. When implementing a custom
+ container, the most important part of the API is \l contentModel, which provides
+ the contained items in a way that it can be used as a delegate model for item
+ views and repeaters.
+
+ \code
+ Container {
+ id: container
+
+ contentItem: ListView {
+ model: container.contentModel
+ snapMode: ListView.SnapOneItem
+ orientation: ListView.Horizontal
+ }
+
+ Text {
+ text: "Page 1"
+ width: container.width
+ height: container.height
+ }
+
+ Text {
+ text: "Page 2"
+ width: container.width
+ height: container.height
+ }
+ }
+ \endcode
+
+ Notice how the sizes of the page items are set by hand. This is because the
+ example uses a plain Container, which does not make any assumptions on the
+ visual layout. It is typically not necessary to specify sizes for items in
+ concrete Container implementations, such as \l SwipeView and \l TabBar.
+
+ \sa {Container Controls}
+*/
+
+static QQuickItem *effectiveContentItem(QQuickItem *item)
+{
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(item);
+ if (flickable)
+ return flickable->contentItem();
+ return item;
+}
+
+QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(nullptr), currentIndex(-1), updatingCurrent(false),
+ changeTypes(Destroyed | Parent | SiblingOrder)
+{
+}
+
+void QQuickContainerPrivate::init()
+{
+ Q_Q(QQuickContainer);
+ contentModel = new QQmlObjectModel(q);
+ QObject::connect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged);
+ QObject::connect(contentModel, &QQmlObjectModel::childrenChanged, q, &QQuickContainer::contentChildrenChanged);
+}
+
+void QQuickContainerPrivate::cleanup()
+{
+ Q_Q(QQuickContainer);
+ // ensure correct destruction order (QTBUG-46798)
+ const int count = contentModel->count();
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = itemAt(i);
+ if (item)
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes);
+ }
+
+ if (contentItem) {
+ QQuickItem *focusItem = QQuickItemPrivate::get(contentItem)->subFocusItem;
+ if (focusItem && window)
+ QQuickWindowPrivate::get(window)->clearFocusInScope(contentItem, focusItem, Qt::OtherFocusReason);
+
+ q->contentItemChange(nullptr, contentItem);
+ delete contentItem;
+ }
+
+ QObject::disconnect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged);
+ QObject::disconnect(contentModel, &QQmlObjectModel::childrenChanged, q, &QQuickContainer::contentChildrenChanged);
+ delete contentModel;
+}
+
+QQuickItem *QQuickContainerPrivate::itemAt(int index) const
+{
+ return qobject_cast<QQuickItem *>(contentModel->get(index));
+}
+
+void QQuickContainerPrivate::insertItem(int index, QQuickItem *item)
+{
+ Q_Q(QQuickContainer);
+ if (!q->isContent(item))
+ return;
+ contentData.append(item);
+
+ updatingCurrent = true;
+
+ item->setParentItem(effectiveContentItem(contentItem));
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, changeTypes);
+ contentModel->insert(index, item);
+
+ q->itemAdded(index, item);
+
+ if (contentModel->count() == 1 && currentIndex == -1)
+ q->setCurrentIndex(index);
+
+ updatingCurrent = false;
+}
+
+void QQuickContainerPrivate::moveItem(int from, int to)
+{
+ Q_Q(QQuickContainer);
+ int oldCurrent = currentIndex;
+ contentModel->move(from, to);
+
+ updatingCurrent = true;
+
+ if (from == oldCurrent)
+ q->setCurrentIndex(to);
+ else if (from < oldCurrent && to >= oldCurrent)
+ q->setCurrentIndex(oldCurrent - 1);
+ else if (from > oldCurrent && to <= oldCurrent)
+ q->setCurrentIndex(oldCurrent + 1);
+
+ updatingCurrent = false;
+}
+
+void QQuickContainerPrivate::removeItem(int index, QQuickItem *item)
+{
+ Q_Q(QQuickContainer);
+ if (!q->isContent(item))
+ return;
+ contentData.removeOne(item);
+
+ updatingCurrent = true;
+
+ bool currentChanged = false;
+ if (index == currentIndex) {
+ q->setCurrentIndex(currentIndex - 1);
+ } else if (index < currentIndex) {
+ --currentIndex;
+ currentChanged = true;
+ }
+
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes);
+ item->setParentItem(nullptr);
+ contentModel->remove(index);
+
+ q->itemRemoved(index, item);
+
+ if (currentChanged)
+ emit q->currentIndexChanged();
+
+ updatingCurrent = false;
+}
+
+void QQuickContainerPrivate::_q_currentIndexChanged()
+{
+ Q_Q(QQuickContainer);
+ if (!updatingCurrent)
+ q->setCurrentIndex(contentItem ? contentItem->property("currentIndex").toInt() : -1);
+}
+
+void QQuickContainerPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
+{
+ // add dynamically reparented items (eg. by a Repeater)
+ if (!QQuickItemPrivate::get(child)->isTransparentForPositioner() && !contentData.contains(child))
+ insertItem(contentModel->count(), child);
+}
+
+void QQuickContainerPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+{
+ // remove dynamically unparented items (eg. by a Repeater)
+ if (!parent)
+ removeItem(contentModel->indexOf(item, nullptr), item);
+}
+
+void QQuickContainerPrivate::itemSiblingOrderChanged(QQuickItem *)
+{
+ // reorder the restacked items (eg. by a Repeater)
+ Q_Q(QQuickContainer);
+ QList<QQuickItem *> siblings = effectiveContentItem(contentItem)->childItems();
+ for (int i = 0; i < siblings.count(); ++i) {
+ QQuickItem* sibling = siblings.at(i);
+ int index = contentModel->indexOf(sibling, nullptr);
+ q->moveItem(index, i);
+ }
+}
+
+void QQuickContainerPrivate::itemDestroyed(QQuickItem *item)
+{
+ int index = contentModel->indexOf(item, nullptr);
+ if (index != -1)
+ removeItem(index, item);
+}
+
+void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
+{
+ QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
+ QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
+ QQuickItem *item = qobject_cast<QQuickItem *>(obj);
+ if (item) {
+ if (QQuickItemPrivate::get(item)->isTransparentForPositioner())
+ item->setParentItem(effectiveContentItem(p->contentItem));
+ else if (p->contentModel->indexOf(item, nullptr) == -1)
+ q->addItem(item);
+ } else {
+ p->contentData.append(obj);
+ }
+}
+
+int QQuickContainerPrivate::contentData_count(QQmlListProperty<QObject> *prop)
+{
+ QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
+ return p->contentData.count();
+}
+
+QObject *QQuickContainerPrivate::contentData_at(QQmlListProperty<QObject> *prop, int index)
+{
+ QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
+ return p->contentData.value(index);
+}
+
+void QQuickContainerPrivate::contentData_clear(QQmlListProperty<QObject> *prop)
+{
+ QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
+ p->contentData.clear();
+}
+
+void QQuickContainerPrivate::contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *item)
+{
+ QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
+ q->addItem(item);
+}
+
+int QQuickContainerPrivate::contentChildren_count(QQmlListProperty<QQuickItem> *prop)
+{
+ QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
+ return p->contentModel->count();
+}
+
+QQuickItem *QQuickContainerPrivate::contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index)
+{
+ QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
+ return q->itemAt(index);
+}
+
+void QQuickContainerPrivate::contentChildren_clear(QQmlListProperty<QQuickItem> *prop)
+{
+ QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
+ p->contentModel->clear();
+}
+
+QQuickContainer::QQuickContainer(QQuickItem *parent) :
+ QQuickControl(*(new QQuickContainerPrivate), parent)
+{
+ Q_D(QQuickContainer);
+ d->init();
+}
+
+QQuickContainer::QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ Q_D(QQuickContainer);
+ d->init();
+}
+
+QQuickContainer::~QQuickContainer()
+{
+ Q_D(QQuickContainer);
+ d->cleanup();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::Container::count
+ \readonly
+
+ This property holds the number of items.
+*/
+int QQuickContainer::count() const
+{
+ Q_D(const QQuickContainer);
+ return d->contentModel->count();
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::Container::itemAt(int index)
+
+ Returns the item at \a index, or \c null if it does not exist.
+*/
+QQuickItem *QQuickContainer::itemAt(int index) const
+{
+ Q_D(const QQuickContainer);
+ return d->itemAt(index);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Container::addItem(Item item)
+
+ Adds an \a item.
+*/
+void QQuickContainer::addItem(QQuickItem *item)
+{
+ Q_D(QQuickContainer);
+ insertItem(d->contentModel->count(), item);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Container::insertItem(int index, Item item)
+
+ Inserts an \a item at \a index.
+*/
+void QQuickContainer::insertItem(int index, QQuickItem *item)
+{
+ Q_D(QQuickContainer);
+ if (!item)
+ return;
+ const int count = d->contentModel->count();
+ if (index < 0 || index > count)
+ index = count;
+
+ int oldIndex = d->contentModel->indexOf(item, nullptr);
+ if (oldIndex != -1) {
+ if (oldIndex < index)
+ --index;
+ if (oldIndex != index)
+ d->moveItem(oldIndex, index);
+ } else {
+ d->insertItem(index, item);
+ }
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Container::moveItem(int from, int to)
+
+ Moves an item \a from one index \a to another.
+*/
+void QQuickContainer::moveItem(int from, int to)
+{
+ Q_D(QQuickContainer);
+ const int count = d->contentModel->count();
+ if (from < 0 || from > count - 1)
+ return;
+ if (to < 0 || to > count - 1)
+ to = count - 1;
+
+ if (from != to)
+ d->moveItem(from, to);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Container::removeItem(int index)
+
+ Removes an item at \a index.
+
+ \note The ownership of the item is transferred to the caller.
+*/
+void QQuickContainer::removeItem(int index)
+{
+ Q_D(QQuickContainer);
+ const int count = d->contentModel->count();
+ if (index < 0 || index >= count)
+ return;
+
+ QQuickItem *item = itemAt(index);
+ if (item)
+ d->removeItem(index, item);
+}
+
+/*!
+ \qmlproperty model QtQuick.Controls::Container::contentModel
+ \readonly
+
+ This property holds the content model of items.
+
+ The content model is provided for visualization purposes. It can be assigned
+ as a model to a content item that presents the contents of the container.
+
+ \code
+ Container {
+ id: container
+ contentItem: ListView {
+ model: container.contentModel
+ }
+ }
+ \endcode
+
+ \sa contentData, contentChildren
+*/
+QVariant QQuickContainer::contentModel() const
+{
+ Q_D(const QQuickContainer);
+ return QVariant::fromValue(d->contentModel);
+}
+
+/*!
+ \qmlproperty list<Object> QtQuick.Controls::Container::contentData
+ \default
+
+ This property holds the list of content data.
+
+ The list contains all objects that have been declared in QML as children
+ of the container, and also items that have been dynamically added or
+ inserted using the \l addItem() and \l insertItem() methods, respectively.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects. It is not re-ordered when items are inserted or moved.
+
+ \sa Item::data, contentChildren
+*/
+QQmlListProperty<QObject> QQuickContainer::contentData()
+{
+ Q_D(QQuickContainer);
+ return QQmlListProperty<QObject>(this, d,
+ QQuickContainerPrivate::contentData_append,
+ QQuickContainerPrivate::contentData_count,
+ QQuickContainerPrivate::contentData_at,
+ QQuickContainerPrivate::contentData_clear);
+}
+
+/*!
+ \qmlproperty list<Item> QtQuick.Controls::Container::contentChildren
+
+ This property holds the list of content children.
+
+ The list contains all items that have been declared in QML as children
+ of the container, and also items that have been dynamically added or
+ inserted using the \l addItem() and \l insertItem() methods, respectively.
+
+ \note Unlike \c contentData, \c contentChildren does not include non-visual
+ QML objects. It is re-ordered when items are inserted or moved.
+
+ \sa Item::children, contentData
+*/
+QQmlListProperty<QQuickItem> QQuickContainer::contentChildren()
+{
+ Q_D(QQuickContainer);
+ return QQmlListProperty<QQuickItem>(this, d,
+ QQuickContainerPrivate::contentChildren_append,
+ QQuickContainerPrivate::contentChildren_count,
+ QQuickContainerPrivate::contentChildren_at,
+ QQuickContainerPrivate::contentChildren_clear);
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::Container::currentIndex
+
+ This property holds the index of the current item.
+
+ \sa currentItem
+*/
+int QQuickContainer::currentIndex() const
+{
+ Q_D(const QQuickContainer);
+ return d->currentIndex;
+}
+
+void QQuickContainer::setCurrentIndex(int index)
+{
+ Q_D(QQuickContainer);
+ if (d->currentIndex == index)
+ return;
+
+ d->currentIndex = index;
+ emit currentIndexChanged();
+ emit currentItemChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Container::currentItem
+ \readonly
+
+ This property holds the current item.
+
+ \sa currentIndex
+*/
+QQuickItem *QQuickContainer::currentItem() const
+{
+ Q_D(const QQuickContainer);
+ return itemAt(d->currentIndex);
+}
+
+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, nullptr) == -1)
+ addItem(data.item);
+ }
+}
+
+void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_D(QQuickContainer);
+ QQuickControl::contentItemChange(newItem, oldItem);
+
+ static const int slotIndex = metaObject()->indexOfSlot("_q_currentIndexChanged()");
+
+ if (oldItem) {
+ QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItem *oldContentItem = effectiveContentItem(oldItem);
+ if (oldContentItem != oldItem)
+ QQuickItemPrivate::get(oldContentItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
+
+ int signalIndex = oldItem->metaObject()->indexOfSignal("currentIndexChanged()");
+ if (signalIndex != -1)
+ QMetaObject::disconnect(oldItem, signalIndex, this, slotIndex);
+ }
+
+ if (newItem) {
+ QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItem *newContentItem = effectiveContentItem(newItem);
+ if (newContentItem != newItem)
+ QQuickItemPrivate::get(newContentItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
+
+ int signalIndex = newItem->metaObject()->indexOfSignal("currentIndexChanged()");
+ if (signalIndex != -1)
+ QMetaObject::connect(newItem, signalIndex, this, slotIndex);
+ }
+}
+
+bool QQuickContainer::isContent(QQuickItem *item) const
+{
+ // If the item has a QML context associated to it (it was created in QML),
+ // we add it to the content model. Otherwise, it's probably the default
+ // highlight item that is always created by the item views, which we need
+ // to exclude.
+ //
+ // TODO: Find a better way to identify/exclude the highlight item...
+ return qmlContext(item);
+}
+
+void QQuickContainer::itemAdded(int index, QQuickItem *item)
+{
+ Q_UNUSED(index);
+ Q_UNUSED(item);
+}
+
+void QQuickContainer::itemRemoved(int index, QQuickItem *item)
+{
+ Q_UNUSED(index);
+ Q_UNUSED(item);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickcontainer_p.cpp"
diff --git a/src/quicktemplates2/qquickcontainer_p.h b/src/quicktemplates2/qquickcontainer_p.h
new file mode 100644
index 00000000..2ed30b77
--- /dev/null
+++ b/src/quicktemplates2/qquickcontainer_p.h
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTAINER_P_H
+#define QQUICKCONTAINER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQml/qqmllist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickContainerPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainer : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
+ Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+ Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "contentData")
+
+public:
+ explicit QQuickContainer(QQuickItem *parent = nullptr);
+ ~QQuickContainer();
+
+ int count() const;
+ Q_INVOKABLE QQuickItem *itemAt(int index) const;
+ Q_INVOKABLE void addItem(QQuickItem *item);
+ Q_INVOKABLE void insertItem(int index, QQuickItem *item);
+ Q_INVOKABLE void moveItem(int from, int to);
+ Q_INVOKABLE void removeItem(int index);
+
+ QVariant contentModel() const;
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
+ int currentIndex() const;
+ QQuickItem *currentItem() const;
+
+public Q_SLOTS:
+ void setCurrentIndex(int index);
+
+Q_SIGNALS:
+ void countChanged();
+ void contentChildrenChanged();
+ void currentIndexChanged();
+ void currentItemChanged();
+
+protected:
+ QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent);
+
+ 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);
+ virtual void itemRemoved(int index, QQuickItem *item);
+
+private:
+ Q_DISABLE_COPY(QQuickContainer)
+ Q_DECLARE_PRIVATE(QQuickContainer)
+ Q_PRIVATE_SLOT(d_func(), void _q_currentIndexChanged())
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickContainer)
+
+#endif // QQUICKCONTAINER_P_H
diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h
new file mode 100644
index 00000000..3b60ad8c
--- /dev/null
+++ b/src/quicktemplates2/qquickcontainer_p_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTAINER_P_P_H
+#define QQUICKCONTAINER_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQml/private/qqmlobjectmodel_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickContainer)
+
+public:
+ QQuickContainerPrivate();
+
+ void init();
+ void cleanup();
+
+ QQuickItem *itemAt(int index) const;
+ void insertItem(int index, QQuickItem *item);
+ void moveItem(int from, int to);
+ void removeItem(int index, QQuickItem *item);
+
+ void _q_currentIndexChanged();
+
+ 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);
+ static QObject *contentData_at(QQmlListProperty<QObject> *prop, int index);
+ static void contentData_clear(QQmlListProperty<QObject> *prop);
+
+ static void contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *obj);
+ static int contentChildren_count(QQmlListProperty<QQuickItem> *prop);
+ static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index);
+ static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop);
+
+ QObjectList contentData;
+ QQmlObjectModel *contentModel;
+ int currentIndex;
+ bool updatingCurrent;
+ QQuickItemPrivate::ChangeTypes changeTypes;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCONTAINER_P_P_H
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
new file mode 100644
index 00000000..cb891ee9
--- /dev/null
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -0,0 +1,1226 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/qguiapplication.h>
+#include "qquicklabel_p.h"
+#include "qquicklabel_p_p.h"
+#include "qquicktextarea_p.h"
+#include "qquicktextarea_p_p.h"
+#include "qquicktextfield_p.h"
+#include "qquicktextfield_p_p.h"
+#include "qquickpopup_p.h"
+#include "qquickpopup_p_p.h"
+#include "qquickapplicationwindow_p.h"
+
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Control
+ \inherits Item
+ \instantiates QQuickControl
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \brief Abstract base type providing functionality common to all controls.
+
+ Control is the base type of user interface controls. It receives input
+ events from the window system, and paints a representation of itself on
+ the screen.
+
+ \section1 Control Layout
+
+ The following diagram illustrates the layout of a typical control:
+
+ \image qtquickcontrols2-control.png
+
+ The \l {Item::}{implicitWidth} and \l {Item::}{implicitHeight} of a control
+ are typically based on the implicit sizes of the background and the content
+ item plus any \l {Control::}{padding}. These properties determine how large
+ the control will be when no explicit \l {Item::}{width} or
+ \l {Item::}{height} is specified.
+
+ The \l {Control::}{background} item fills the entire width and height of the
+ control, unless an explicit size has been given for it.
+
+ The geometry of the \l {Control::}{contentItem} is determined by the
+ padding.
+
+ \section1 Event Handling
+
+ All controls, except non-interactive indicators, do not let clicks and
+ touches through to items below them. For example, if \l Pane is used as the
+ \l {ApplicationWindow::}{header} or \l {ApplicationWindow::}{footer} of
+ \l ApplicationWindow, items underneath it will not get mouse or touch
+ events.
+
+ \sa ApplicationWindow, Container
+*/
+
+static bool isKeyFocusReason(Qt::FocusReason reason)
+{
+ return reason == Qt::TabFocusReason || reason == Qt::BacktabFocusReason || reason == Qt::ShortcutFocusReason;
+}
+
+QQuickControlPrivate::ExtraData::ExtraData()
+{
+}
+
+QQuickControlPrivate::QQuickControlPrivate() :
+ hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false), hasLocale(false), hovered(false), wheelEnabled(false),
+ padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0), spacing(0),
+ focusPolicy(Qt::NoFocus), focusReason(Qt::OtherFocusReason),
+ background(nullptr), contentItem(nullptr), accessibleAttached(nullptr)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::installActivationObserver(this);
+#endif
+}
+
+QQuickControlPrivate::~QQuickControlPrivate()
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::removeActivationObserver(this);
+#endif
+}
+
+void QQuickControlPrivate::mirrorChange()
+{
+ Q_Q(QQuickControl);
+ if (locale.textDirection() == Qt::LeftToRight)
+ q->mirrorChange();
+}
+
+void QQuickControlPrivate::setTopPadding(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ qreal oldPadding = q->topPadding();
+ topPadding = value;
+ hasTopPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ emit q->topPaddingChanged();
+ emit q->availableHeightChanged();
+ q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
+ QMarginsF(leftPadding, oldPadding, rightPadding, bottomPadding));
+ }
+}
+
+void QQuickControlPrivate::setLeftPadding(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ qreal oldPadding = q->leftPadding();
+ leftPadding = value;
+ hasLeftPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ emit q->leftPaddingChanged();
+ emit q->availableWidthChanged();
+ q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
+ QMarginsF(oldPadding, topPadding, rightPadding, bottomPadding));
+ }
+}
+
+void QQuickControlPrivate::setRightPadding(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ qreal oldPadding = q->rightPadding();
+ rightPadding = value;
+ hasRightPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ emit q->rightPaddingChanged();
+ emit q->availableWidthChanged();
+ q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
+ QMarginsF(leftPadding, topPadding, oldPadding, bottomPadding));
+ }
+}
+
+void QQuickControlPrivate::setBottomPadding(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ qreal oldPadding = q->bottomPadding();
+ bottomPadding = value;
+ hasBottomPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ emit q->bottomPaddingChanged();
+ emit q->availableHeightChanged();
+ q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
+ QMarginsF(leftPadding, topPadding, rightPadding, oldPadding));
+ }
+}
+
+void QQuickControlPrivate::resizeBackground()
+{
+ Q_Q(QQuickControl);
+ if (background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (!p->widthValid && qFuzzyIsNull(background->x())) {
+ background->setWidth(q->width());
+ p->widthValid = false;
+ }
+ if (!p->heightValid && qFuzzyIsNull(background->y())) {
+ background->setHeight(q->height());
+ p->heightValid = false;
+ }
+ }
+}
+
+void QQuickControlPrivate::resizeContent()
+{
+ Q_Q(QQuickControl);
+ if (contentItem) {
+ contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding()));
+ contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight()));
+ }
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickControlPrivate::accessibilityActiveChanged(bool active)
+{
+ Q_Q(QQuickControl);
+ return q->accessibilityActiveChanged(active);
+}
+
+QAccessible::Role QQuickControlPrivate::accessibleRole() const
+{
+ Q_Q(const QQuickControl);
+ return q->accessibleRole();
+}
+
+QAccessible::Role QQuickControl::accessibleRole() const
+{
+ return QAccessible::NoRole;
+}
+
+void QQuickControl::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickControl);
+ if (d->accessibleAttached || !active)
+ return;
+
+ d->accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true));
+
+ // QQuickControl relies on the existence of a QQuickAccessibleAttached object.
+ // However, qmlAttachedPropertiesObject(create=true) creates an instance only
+ // for items that have been created by a QML engine. Therefore we create the
+ // object by hand for items created in C++ (QQuickPopupItem, for instance).
+ if (!d->accessibleAttached)
+ d->accessibleAttached = new QQuickAccessibleAttached(this);
+
+ d->accessibleAttached->setRole(accessibleRole());
+}
+#endif
+
+/*!
+ \internal
+
+ Returns the font that the control w inherits from its ancestors and
+ QGuiApplication::font.
+*/
+QFont QQuickControlPrivate::parentFont(const QQuickItem *item)
+{
+ QQuickItem *p = item->parentItem();
+ while (p) {
+ if (QQuickControl *control = qobject_cast<QQuickControl *>(p))
+ return control->font();
+ else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(p))
+ return label->font();
+ else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(p))
+ return textField->font();
+ else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(p))
+ return textArea->font();
+
+ p = p->parentItem();
+ }
+
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
+ return window->font();
+
+ return themeFont(QPlatformTheme::SystemFont);
+}
+
+QFont QQuickControlPrivate::themeFont(QPlatformTheme::Font type)
+{
+ if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
+ if (const QFont *font = theme->font(type)) {
+ QFont f = *font;
+ if (type == QPlatformTheme::SystemFont)
+ f.resolve(0);
+ return f;
+ }
+ }
+
+ return QFont();
+}
+
+/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickControlPrivate::resolveFont()
+{
+ Q_Q(QQuickControl);
+ inheritFont(parentFont(q));
+}
+
+void QQuickControlPrivate::inheritFont(const QFont &f)
+{
+ Q_Q(QQuickControl);
+ QFont parentFont = extra.isAllocated() ? extra->font.resolve(f) : f;
+ parentFont.resolve(extra.isAllocated() ? extra->font.resolve() | f.resolve() : f.resolve());
+
+ const QFont defaultFont = q->defaultFont();
+ const QFont resolvedFont = parentFont.resolve(defaultFont);
+
+ setFont_helper(resolvedFont);
+}
+
+/*!
+ \internal
+
+ Assign \a font to this control, and propagate it to all children.
+*/
+void QQuickControlPrivate::updateFont(const QFont &f)
+{
+ Q_Q(QQuickControl);
+ QFont old = resolvedFont;
+ resolvedFont = f;
+
+ if (old != f)
+ q->fontChange(f, old);
+
+ QQuickControlPrivate::updateFontRecur(q, f);
+
+ if (old != f)
+ emit q->fontChanged();
+}
+
+void QQuickControlPrivate::updateFontRecur(QQuickItem *item, const QFont &f)
+{
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
+ if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
+ QQuickControlPrivate::get(control)->inheritFont(f);
+ else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(child))
+ QQuickLabelPrivate::get(label)->inheritFont(f);
+ else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(child))
+ QQuickTextAreaPrivate::get(textArea)->inheritFont(f);
+ else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(child))
+ QQuickTextFieldPrivate::get(textField)->inheritFont(f);
+ else
+ QQuickControlPrivate::updateFontRecur(child, f);
+ }
+}
+
+QString QQuickControl::accessibleName() const
+{
+#ifndef QT_NO_ACCESSIBILITY
+ Q_D(const QQuickControl);
+ if (d->accessibleAttached)
+ return d->accessibleAttached->name();
+#endif
+ return QString();
+}
+
+void QQuickControl::setAccessibleName(const QString &name)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ Q_D(QQuickControl);
+ if (d->accessibleAttached)
+ d->accessibleAttached->setName(name);
+#else
+ Q_UNUSED(name)
+#endif
+}
+
+QVariant QQuickControl::accessibleProperty(const char *propertyName)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ Q_D(QQuickControl);
+ if (d->accessibleAttached)
+ return QQuickAccessibleAttached::property(this, propertyName);
+#endif
+ Q_UNUSED(propertyName)
+ return QVariant();
+}
+
+bool QQuickControl::setAccessibleProperty(const char *propertyName, const QVariant &value)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ Q_D(QQuickControl);
+ if (d->accessibleAttached)
+ return QQuickAccessibleAttached::setProperty(this, propertyName, value);
+#endif
+ Q_UNUSED(propertyName)
+ Q_UNUSED(value)
+ return false;
+}
+
+QQuickControl::QQuickControl(QQuickItem *parent) :
+ QQuickItem(*(new QQuickControlPrivate), parent)
+{
+}
+
+QQuickControl::QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent) :
+ QQuickItem(dd, parent)
+{
+}
+
+void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
+{
+ Q_D(QQuickControl);
+ QQuickItem::itemChange(change, value);
+ switch (change) {
+ case ItemVisibleHasChanged:
+ if (!value.boolValue)
+ setHovered(false);
+ break;
+ case ItemParentHasChanged:
+ if (value.item) {
+ d->resolveFont();
+ if (!d->hasLocale)
+ d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
+ }
+ break;
+ case ItemActiveFocusHasChanged:
+ if (isKeyFocusReason(d->focusReason))
+ emit visualFocusChanged();
+ break;
+ default:
+ break;
+ }
+}
+
+/*!
+ \qmlproperty font QtQuick.Controls::Control::font
+
+ This property holds the font currently set for the control.
+
+ This property describes the control's requested font. The font is used by the control's
+ style when rendering standard components, and is available as a means to ensure that custom
+ controls can maintain consistency with the native platform's native look and feel. It's common
+ that different platforms, or different styles, define different fonts for an application.
+
+ The default font depends on the system environment. ApplicationWindow maintains a system/theme
+ font which serves as a default for all controls. There may also be special font defaults for
+ certain types of controls. You can also set the default font for controls by passing a custom
+ font to QGuiApplication::setFont(), before loading the QML. Finally, the font is matched
+ against Qt's font database to find the best match.
+
+ Control propagates explicit font properties from parent to children. If you change a specific
+ property on a control's font, that property propagates to all of the control's children,
+ overriding any system defaults for that property.
+
+ \code
+ Page {
+ font.family: "Courier"
+
+ Column {
+ Label {
+ text: qsTr("This will use Courier...")
+ }
+
+ Switch {
+ text: qsTr("... and so will this")
+ }
+ }
+ }
+ \endcode
+*/
+QFont QQuickControl::font() const
+{
+ Q_D(const QQuickControl);
+ return d->resolvedFont;
+}
+
+void QQuickControl::setFont(const QFont &font)
+{
+ Q_D(QQuickControl);
+ if (d->extra.value().font.resolve() == font.resolve() && d->extra.value().font == font)
+ return;
+
+ d->extra.value().font = font;
+ d->resolveFont();
+}
+
+void QQuickControl::resetFont()
+{
+ setFont(QFont());
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::availableWidth
+ \readonly
+
+ This property holds the width available to the \l contentItem after
+ deducting horizontal padding from the \l {Item::}{width} of the control.
+
+ \sa {Control Layout}, padding, leftPadding, rightPadding
+*/
+qreal QQuickControl::availableWidth() const
+{
+ return qMax<qreal>(0.0, width() - leftPadding() - rightPadding());
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::availableHeight
+ \readonly
+
+ This property holds the height available to the \l contentItem after
+ deducting vertical padding from the \l {Item::}{height} of the control.
+
+ \sa {Control Layout}, padding, topPadding, bottomPadding
+*/
+qreal QQuickControl::availableHeight() const
+{
+ return qMax<qreal>(0.0, height() - topPadding() - bottomPadding());
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::padding
+
+ This property holds the default padding.
+
+ Padding adds a space between each edge of the content item and the
+ background item, effectively controlling the size of the content item. To
+ specify a padding value for a specific edge of the control, set its
+ relevant property:
+
+ \list
+ \li \l {Control::}{leftPadding}
+ \li \l {Control::}{rightPadding}
+ \li \l {Control::}{topPadding}
+ \li \l {Control::}{bottomPadding}
+ \endlist
+
+ \sa {Control Layout}, availableWidth, availableHeight, topPadding, leftPadding, rightPadding, bottomPadding
+*/
+qreal QQuickControl::padding() const
+{
+ Q_D(const QQuickControl);
+ return d->padding;
+}
+
+void QQuickControl::setPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ if (qFuzzyCompare(d->padding, padding))
+ return;
+ QMarginsF oldPadding(leftPadding(), topPadding(), rightPadding(), bottomPadding());
+ d->padding = padding;
+ emit paddingChanged();
+ QMarginsF newPadding(leftPadding(), topPadding(), rightPadding(), bottomPadding());
+ if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
+ emit topPaddingChanged();
+ if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
+ emit leftPaddingChanged();
+ if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
+ emit rightPaddingChanged();
+ if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
+ emit bottomPaddingChanged();
+ if (!qFuzzyCompare(newPadding.top(), oldPadding.top()) || !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
+ emit availableHeightChanged();
+ if (!qFuzzyCompare(newPadding.left(), oldPadding.left()) || !qFuzzyCompare(newPadding.right(), oldPadding.right()))
+ emit availableWidthChanged();
+ paddingChange(newPadding, oldPadding);
+}
+
+void QQuickControl::resetPadding()
+{
+ setPadding(0);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::topPadding
+
+ This property holds the top padding.
+
+ \sa {Control Layout}, padding, bottomPadding, availableHeight
+*/
+qreal QQuickControl::topPadding() const
+{
+ Q_D(const QQuickControl);
+ if (d->hasTopPadding)
+ return d->topPadding;
+ return d->padding;
+}
+
+void QQuickControl::setTopPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ d->setTopPadding(padding);
+}
+
+void QQuickControl::resetTopPadding()
+{
+ Q_D(QQuickControl);
+ d->setTopPadding(0, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::leftPadding
+
+ This property holds the left padding.
+
+ \sa {Control Layout}, padding, rightPadding, availableWidth
+*/
+qreal QQuickControl::leftPadding() const
+{
+ Q_D(const QQuickControl);
+ if (d->hasLeftPadding)
+ return d->leftPadding;
+ return d->padding;
+}
+
+void QQuickControl::setLeftPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ d->setLeftPadding(padding);
+}
+
+void QQuickControl::resetLeftPadding()
+{
+ Q_D(QQuickControl);
+ d->setLeftPadding(0, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::rightPadding
+
+ This property holds the right padding.
+
+ \sa {Control Layout}, padding, leftPadding, availableWidth
+*/
+qreal QQuickControl::rightPadding() const
+{
+ Q_D(const QQuickControl);
+ if (d->hasRightPadding)
+ return d->rightPadding;
+ return d->padding;
+}
+
+void QQuickControl::setRightPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ d->setRightPadding(padding);
+}
+
+void QQuickControl::resetRightPadding()
+{
+ Q_D(QQuickControl);
+ d->setRightPadding(0, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::bottomPadding
+
+ This property holds the bottom padding.
+
+ \sa {Control Layout}, padding, topPadding, availableHeight
+*/
+qreal QQuickControl::bottomPadding() const
+{
+ Q_D(const QQuickControl);
+ if (d->hasBottomPadding)
+ return d->bottomPadding;
+ return d->padding;
+}
+
+void QQuickControl::setBottomPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ d->setBottomPadding(padding);
+}
+
+void QQuickControl::resetBottomPadding()
+{
+ Q_D(QQuickControl);
+ d->setBottomPadding(0, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Control::spacing
+
+ This property holds the spacing.
+
+ Spacing is useful for controls that have multiple or repetitive building
+ blocks. For example, some styles use spacing to determine the distance
+ between the text and indicator of \l CheckBox. Spacing is not enforced by
+ Control, so each style may interpret it differently, and some may ignore it
+ altogether.
+*/
+qreal QQuickControl::spacing() const
+{
+ Q_D(const QQuickControl);
+ return d->spacing;
+}
+
+void QQuickControl::setSpacing(qreal spacing)
+{
+ Q_D(QQuickControl);
+ if (!qFuzzyCompare(d->spacing, spacing)) {
+ d->spacing = spacing;
+ emit spacingChanged();
+ }
+}
+
+void QQuickControl::resetSpacing()
+{
+ setSpacing(0);
+}
+
+/*!
+ \qmlproperty Locale QtQuick.Controls::Control::locale
+
+ This property holds the locale of the control.
+ It contains locale specific properties for formatting data and numbers.
+ Unless a special locale has been set, this is either the parent's locale
+ or the default locale.
+
+ Control propagates explicit locale properties from parent to children.
+ If you change a specific property on a control's locale, that property
+ propagates to all of the control's children, overriding any system defaults
+ for that property.
+
+ \sa mirrored, {LayoutMirroring}{LayoutMirroring}
+*/
+QLocale QQuickControl::locale() const
+{
+ Q_D(const QQuickControl);
+ return d->locale;
+}
+
+void QQuickControl::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickControl);
+ if (d->hasLocale && d->locale == locale)
+ return;
+
+ d->updateLocale(locale, true); // explicit=true
+}
+
+void QQuickControl::resetLocale()
+{
+ Q_D(QQuickControl);
+ if (!d->hasLocale)
+ return;
+
+ d->hasLocale = false;
+ d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
+}
+
+QLocale QQuickControlPrivate::calcLocale(const QQuickItem *item)
+{
+ const QQuickItem *p = item;
+ while (p) {
+ if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
+ return control->locale();
+
+ QVariant v = p->property("locale");
+ if (v.isValid() && v.userType() == QMetaType::QLocale)
+ return v.toLocale();
+
+ p = p->parentItem();
+ }
+
+ if (item) {
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
+ return window->locale();
+ }
+
+ return QLocale();
+}
+
+/*
+ Deletes "delegate" if Component.completed() has been emitted,
+ otherwise stores it in pendingDeletions.
+*/
+void QQuickControlPrivate::deleteDelegate(QObject *delegate)
+{
+ if (componentComplete)
+ delete delegate;
+ else
+ extra.value().pendingDeletions.append(delegate);
+}
+
+void QQuickControlPrivate::updateLocale(const QLocale &l, bool e)
+{
+ Q_Q(QQuickControl);
+ if (!e && hasLocale)
+ return;
+
+ QLocale old = q->locale();
+ hasLocale = e;
+ if (old != l) {
+ bool wasMirrored = q->isMirrored();
+ q->localeChange(l, old);
+ locale = l;
+ QQuickControlPrivate::updateLocaleRecur(q, l);
+ emit q->localeChanged();
+ if (wasMirrored != q->isMirrored())
+ q->mirrorChange();
+ }
+}
+
+void QQuickControlPrivate::updateLocaleRecur(QQuickItem *item, const QLocale &l)
+{
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
+ if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
+ QQuickControlPrivate::get(control)->updateLocale(l, false);
+ else
+ updateLocaleRecur(child, l);
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Control::mirrored
+ \readonly
+
+ This property holds whether the control is mirrored.
+
+ This property is provided for convenience. A control is considered mirrored
+ when its visual layout direction is right-to-left; that is, when using a
+ right-to-left locale or when \l {LayoutMirroring::enabled}{LayoutMirroring.enabled}
+ is \c true.
+
+ \sa locale, {LayoutMirroring}{LayoutMirroring}, {Right-to-left User Interfaces}
+*/
+bool QQuickControl::isMirrored() const
+{
+ Q_D(const QQuickControl);
+ return d->isMirrored() || d->locale.textDirection() == Qt::RightToLeft;
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Control::focusPolicy
+
+ This property determines the way the control accepts focus.
+
+ \value Qt.TabFocus The control accepts focus by tabbing.
+ \value Qt.ClickFocus The control accepts focus by clicking.
+ \value Qt.StrongFocus The control accepts focus by both tabbing and clicking.
+ \value Qt.WheelFocus The control accepts focus by tabbing, clicking, and using the mouse wheel.
+ \value Qt.NoFocus The control does not accept focus.
+*/
+Qt::FocusPolicy QQuickControl::focusPolicy() const
+{
+ Q_D(const QQuickControl);
+ uint policy = d->focusPolicy;
+ if (activeFocusOnTab())
+ policy |= Qt::TabFocus;
+ return static_cast<Qt::FocusPolicy>(policy);
+}
+
+void QQuickControl::setFocusPolicy(Qt::FocusPolicy policy)
+{
+ Q_D(QQuickControl);
+ if (d->focusPolicy == policy)
+ return;
+
+ d->focusPolicy = policy;
+ setActiveFocusOnTab(policy & Qt::TabFocus);
+ emit focusPolicyChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Control::focusReason
+ \readonly
+
+ \include qquickcontrol-focusreason.qdocinc
+
+ \sa visualFocus
+*/
+Qt::FocusReason QQuickControl::focusReason() const
+{
+ Q_D(const QQuickControl);
+ return d->focusReason;
+}
+
+void QQuickControl::setFocusReason(Qt::FocusReason reason)
+{
+ Q_D(QQuickControl);
+ if (d->focusReason == reason)
+ return;
+
+ Qt::FocusReason oldReason = d->focusReason;
+ d->focusReason = reason;
+ emit focusReasonChanged();
+ if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
+ emit visualFocusChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Control::visualFocus
+ \readonly
+
+ This property holds whether the control has visual focus. This property
+ is \c true when the control has active focus and the focus reason is either
+ \c Qt.TabFocusReason, \c Qt.BacktabFocusReason, or \c Qt.ShortcutFocusReason.
+
+ In general, for visualizing key focus, this property is preferred over
+ \l Item::activeFocus. This ensures that key focus is only visualized when
+ interacting with keys - not when interacting via touch or mouse.
+
+ \sa focusReason, Item::activeFocus
+*/
+bool QQuickControl::hasVisualFocus() const
+{
+ Q_D(const QQuickControl);
+ return d->activeFocus && isKeyFocusReason(d->focusReason);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Control::hovered
+ \readonly
+
+ This property holds whether the control is hovered.
+
+ \sa hoverEnabled
+*/
+bool QQuickControl::isHovered() const
+{
+ Q_D(const QQuickControl);
+ return d->hovered;
+}
+
+void QQuickControl::setHovered(bool hovered)
+{
+ Q_D(QQuickControl);
+ if (hovered == d->hovered)
+ return;
+
+ d->hovered = hovered;
+ emit hoveredChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Control::hoverEnabled
+
+ This property determines whether the control accepts hover events. The default value is \c false.
+
+ \sa hovered
+*/
+bool QQuickControl::isHoverEnabled() const
+{
+ Q_D(const QQuickControl);
+ return d->hoverEnabled;
+}
+
+void QQuickControl::setHoverEnabled(bool enabled)
+{
+ Q_D(QQuickControl);
+ if (enabled == d->hoverEnabled)
+ return;
+
+ setAcceptHoverEvents(enabled);
+ emit hoverEnabledChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Control::wheelEnabled
+
+ This property determines whether the control handles wheel events. The default value is \c false.
+
+ \note Care must be taken when enabling wheel events for controls within scrollable items such
+ as \l Flickable, as the control will consume the events and hence interrupt scrolling of the
+ Flickable.
+*/
+bool QQuickControl::isWheelEnabled() const
+{
+ Q_D(const QQuickControl);
+ return d->wheelEnabled;
+}
+
+void QQuickControl::setWheelEnabled(bool enabled)
+{
+ Q_D(QQuickControl);
+ if (d->wheelEnabled == enabled)
+ return;
+
+ d->wheelEnabled = enabled;
+ emit wheelEnabledChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Control::background
+
+ This property holds the background item.
+
+ \code
+ Button {
+ id: control
+ text: qsTr("Button")
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ opacity: enabled ? 1 : 0.3
+ color: control.down ? "#d0d0d0" : "#e0e0e0"
+ }
+ }
+ \endcode
+
+ \input qquickcontrol-background.qdocinc notes
+
+ \sa {Control Layout}
+*/
+QQuickItem *QQuickControl::background() const
+{
+ Q_D(const QQuickControl);
+ return d->background;
+}
+
+void QQuickControl::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickControl);
+ if (d->background == background)
+ return;
+
+ d->deleteDelegate(d->background);
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
+ }
+ emit backgroundChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Control::contentItem
+
+ This property holds the visual content item.
+
+ \note The content item is automatically resized to fit within the
+ \l padding of the control.
+
+ \note Most controls use the implicit size of the content item to calculate
+ the implicit size of the control itself. If you replace the content item
+ with a custom one, you should also consider providing a sensible implicit
+ size for it (unless it is an item like \l Text which has its own implicit
+ size).
+
+ \code
+ Button {
+ id: control
+ text: qsTr("Button")
+ contentItem: Label {
+ text: control.text
+ font: control.font
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ \endcode
+
+ \sa {Control Layout}, padding
+*/
+QQuickItem *QQuickControl::contentItem() const
+{
+ Q_D(const QQuickControl);
+ return d->contentItem;
+}
+
+void QQuickControl::setContentItem(QQuickItem *item)
+{
+ Q_D(QQuickControl);
+ if (d->contentItem == item)
+ return;
+
+ contentItemChange(item, d->contentItem);
+ d->deleteDelegate(d->contentItem);
+ d->contentItem = item;
+ if (item) {
+ if (!item->parentItem())
+ item->setParentItem(this);
+ if (isComponentComplete())
+ d->resizeContent();
+ }
+ emit contentItemChanged();
+}
+
+void QQuickControl::classBegin()
+{
+ Q_D(QQuickControl);
+ QQuickItem::classBegin();
+ d->resolveFont();
+}
+
+void QQuickControl::componentComplete()
+{
+ Q_D(QQuickControl);
+ QQuickItem::componentComplete();
+ if (!d->hasLocale)
+ d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
+#ifndef QT_NO_ACCESSIBILITY
+ if (!d->accessibleAttached && QAccessible::isActive())
+ accessibilityActiveChanged(true);
+#endif
+
+ if (d->extra.isAllocated()) {
+ qDeleteAll(d->extra.value().pendingDeletions);
+ d->extra.value().pendingDeletions.clear();
+ }
+}
+
+QFont QQuickControl::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
+}
+
+void QQuickControl::focusInEvent(QFocusEvent *event)
+{
+ QQuickItem::focusInEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickControl::focusOutEvent(QFocusEvent *event)
+{
+ QQuickItem::focusOutEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickControl::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickControl);
+ setHovered(d->hoverEnabled);
+ event->setAccepted(d->hoverEnabled);
+}
+
+void QQuickControl::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickControl);
+ setHovered(d->hoverEnabled && contains(event->pos()));
+ event->setAccepted(d->hoverEnabled);
+}
+
+void QQuickControl::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickControl);
+ setHovered(false);
+ event->setAccepted(d->hoverEnabled);
+}
+
+void QQuickControl::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickControl);
+ if ((d->focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && !QGuiApplication::styleHints()->setFocusOnTouchRelease())
+ forceActiveFocus(Qt::MouseFocusReason);
+
+ event->accept();
+}
+
+void QQuickControl::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickControl);
+ setHovered(d->hoverEnabled && contains(event->pos()));
+ event->accept();
+}
+
+void QQuickControl::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickControl);
+ if ((d->focusPolicy & Qt::ClickFocus) == Qt::ClickFocus && QGuiApplication::styleHints()->setFocusOnTouchRelease())
+ forceActiveFocus(Qt::MouseFocusReason);
+
+ event->accept();
+}
+
+void QQuickControl::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickControl);
+ if ((d->focusPolicy & Qt::WheelFocus) == Qt::WheelFocus)
+ forceActiveFocus(Qt::MouseFocusReason);
+
+ event->setAccepted(d->wheelEnabled);
+}
+
+void QQuickControl::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickControl);
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+ d->resizeBackground();
+ d->resizeContent();
+ if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width()))
+ emit availableWidthChanged();
+ if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height()))
+ emit availableHeightChanged();
+}
+
+void QQuickControl::fontChange(const QFont &newFont, const QFont &oldFont)
+{
+ Q_UNUSED(newFont);
+ Q_UNUSED(oldFont);
+}
+
+void QQuickControl::mirrorChange()
+{
+ emit mirroredChanged();
+}
+
+void QQuickControl::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
+{
+ Q_D(QQuickControl);
+ Q_UNUSED(newPadding);
+ Q_UNUSED(oldPadding);
+ d->resizeContent();
+}
+
+void QQuickControl::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_UNUSED(newItem);
+ Q_UNUSED(oldItem);
+}
+
+void QQuickControl::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_UNUSED(newLocale);
+ Q_UNUSED(oldLocale);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
new file mode 100644
index 00000000..d9827017
--- /dev/null
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -0,0 +1,215 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTROL_P_H
+#define QQUICKCONTROL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qlocale.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickControlPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControl : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
+ Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL)
+ Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL)
+ Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
+ Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
+ Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
+ Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
+ Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
+ Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL)
+ Q_PROPERTY(Qt::FocusPolicy focusPolicy READ focusPolicy WRITE setFocusPolicy NOTIFY focusPolicyChanged FINAL)
+ Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
+ Q_PROPERTY(bool visualFocus READ hasVisualFocus NOTIFY visualFocusChanged FINAL)
+ Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL)
+ Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged FINAL)
+ Q_PROPERTY(bool wheelEnabled READ isWheelEnabled WRITE setWheelEnabled NOTIFY wheelEnabledChanged FINAL)
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+
+public:
+ explicit QQuickControl(QQuickItem *parent = nullptr);
+
+ QFont font() const;
+ void setFont(const QFont &font);
+ void resetFont();
+
+ qreal availableWidth() const;
+ qreal availableHeight() const;
+
+ qreal padding() const;
+ void setPadding(qreal padding);
+ void resetPadding();
+
+ qreal topPadding() const;
+ void setTopPadding(qreal padding);
+ void resetTopPadding();
+
+ qreal leftPadding() const;
+ void setLeftPadding(qreal padding);
+ void resetLeftPadding();
+
+ qreal rightPadding() const;
+ void setRightPadding(qreal padding);
+ void resetRightPadding();
+
+ qreal bottomPadding() const;
+ void setBottomPadding(qreal padding);
+ void resetBottomPadding();
+
+ qreal spacing() const;
+ void setSpacing(qreal spacing);
+ void resetSpacing();
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+ void resetLocale();
+
+ bool isMirrored() const;
+
+ Qt::FocusPolicy focusPolicy() const;
+ void setFocusPolicy(Qt::FocusPolicy policy);
+
+ Qt::FocusReason focusReason() const;
+ void setFocusReason(Qt::FocusReason reason);
+
+ bool hasVisualFocus() const;
+
+ bool isHovered() const;
+ void setHovered(bool hovered);
+
+ bool isHoverEnabled() const;
+ void setHoverEnabled(bool enabled);
+
+ bool isWheelEnabled() const;
+ void setWheelEnabled(bool enabled);
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+ QQuickItem *contentItem() const;
+ void setContentItem(QQuickItem *item);
+
+Q_SIGNALS:
+ void fontChanged();
+ void availableWidthChanged();
+ void availableHeightChanged();
+ void paddingChanged();
+ void topPaddingChanged();
+ void leftPaddingChanged();
+ void rightPaddingChanged();
+ void bottomPaddingChanged();
+ void spacingChanged();
+ void localeChanged();
+ void mirroredChanged();
+ void focusPolicyChanged();
+ void focusReasonChanged();
+ void visualFocusChanged();
+ void hoveredChanged();
+ void hoverEnabledChanged();
+ void wheelEnabledChanged();
+ void backgroundChanged();
+ void contentItemChanged();
+
+protected:
+ virtual QFont defaultFont() const;
+
+ QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent);
+
+ void classBegin() override;
+ void componentComplete() override;
+
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+
+ void focusInEvent(QFocusEvent *event) override;
+ void focusOutEvent(QFocusEvent *event) override;
+ void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+ void wheelEvent(QWheelEvent *event) override;
+
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+ virtual void fontChange(const QFont &newFont, const QFont &oldFont);
+ virtual void mirrorChange();
+ virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
+ virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
+ virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
+
+#ifndef QT_NO_ACCESSIBILITY
+ virtual void accessibilityActiveChanged(bool active);
+ virtual QAccessible::Role accessibleRole() const;
+#endif
+
+ // helper functions which avoid to check QT_NO_ACCESSIBILITY
+ QString accessibleName() const;
+ void setAccessibleName(const QString &name);
+
+ QVariant accessibleProperty(const char *propertyName);
+ bool setAccessibleProperty(const char *propertyName, const QVariant &value);
+
+private:
+ Q_DISABLE_COPY(QQuickControl)
+ Q_DECLARE_PRIVATE(QQuickControl)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickControl)
+
+#endif // QQUICKCONTROL_P_H
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
new file mode 100644
index 00000000..64f29986
--- /dev/null
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTROL_P_P_H
+#define QQUICKCONTROL_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickcontrol_p.h"
+
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQml/private/qlazilyallocated_p.h>
+#include <qpa/qplatformtheme.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtGui/qaccessible.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAccessibleAttached;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControlPrivate : public QQuickItemPrivate
+#ifndef QT_NO_ACCESSIBILITY
+ , public QAccessible::ActivationObserver
+#endif
+{
+ Q_DECLARE_PUBLIC(QQuickControl)
+
+public:
+ QQuickControlPrivate();
+ virtual ~QQuickControlPrivate();
+
+ static QQuickControlPrivate *get(QQuickControl *control)
+ {
+ return control->d_func();
+ }
+
+ void mirrorChange() override;
+
+ void setTopPadding(qreal value, bool reset = false);
+ void setLeftPadding(qreal value, bool reset = false);
+ void setRightPadding(qreal value, bool reset = false);
+ void setBottomPadding(qreal value, bool reset = false);
+
+ void resizeBackground();
+ virtual void resizeContent();
+
+#ifndef QT_NO_ACCESSIBILITY
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+ void updateFont(const QFont &f);
+ static void updateFontRecur(QQuickItem *item, const QFont &f);
+ inline void setFont_helper(const QFont &f) {
+ if (resolvedFont.resolve() == f.resolve() && resolvedFont == f)
+ return;
+ updateFont(f);
+ }
+ virtual void resolveFont();
+ void inheritFont(const QFont &f);
+ static QFont parentFont(const QQuickItem *item);
+ static QFont themeFont(QPlatformTheme::Font type);
+
+ void updateLocale(const QLocale &l, bool e);
+ static void updateLocaleRecur(QQuickItem *item, const QLocale &l);
+ static QLocale calcLocale(const QQuickItem *item);
+
+ void deleteDelegate(QObject *object);
+
+ struct ExtraData {
+ ExtraData();
+ QFont font;
+ // This list contains the default delegates which were
+ // replaced with custom ones via declarative assignments
+ // before Component.completed() was emitted. See QTBUG-50992.
+ QVector<QObject*> pendingDeletions;
+ };
+ QLazilyAllocated<ExtraData> extra;
+
+ QFont resolvedFont;
+ bool hasTopPadding;
+ bool hasLeftPadding;
+ bool hasRightPadding;
+ bool hasBottomPadding;
+ bool hasLocale;
+ bool hovered;
+ bool wheelEnabled;
+ qreal padding;
+ qreal topPadding;
+ qreal leftPadding;
+ qreal rightPadding;
+ qreal bottomPadding;
+ qreal spacing;
+ QLocale locale;
+ Qt::FocusPolicy focusPolicy;
+ Qt::FocusReason focusReason;
+ QQuickItem *background;
+ QQuickItem *contentItem;
+ QQuickAccessibleAttached *accessibleAttached;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCONTROL_P_P_H
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
new file mode 100644
index 00000000..79aff781
--- /dev/null
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -0,0 +1,639 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickdial_p.h"
+
+#include <QtCore/qmath.h>
+#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Dial
+ \inherits Control
+ \instantiates QQuickDial
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Circular dial that is rotated to set a value.
+
+ The Dial is similar to a traditional dial knob that is found on devices
+ such as stereos or industrial equipment. It allows the user to specify a
+ value within a range.
+
+ \image qtquickcontrols2-dial-no-wrap.gif
+
+ The value of the dial is set with the \l value property. The range is
+ set with the \l from and \l to properties. To enable or disable wrapping,
+ use the \l wrap property.
+
+ The dial can be manipulated with a keyboard. It supports the following
+ actions:
+
+ \table
+ \header \li \b {Action} \li \b {Key}
+ \row \li Decrease \l value by \l stepSize \li \c Qt.Key_Left
+ \row \li Decrease \l value by \l stepSize \li \c Qt.Key_Down
+ \row \li Set \l value to \l from \li \c Qt.Key_Home
+ \row \li Increase \l value by \l stepSize \li \c Qt.Key_Right
+ \row \li Increase \l value by \l stepSize \li \c Qt.Key_Up
+ \row \li Set \l value to \l to \li \c Qt.Key_End
+ \endtable
+
+ \sa {Customizing Dial}, {Input Controls}
+*/
+
+static const qreal startAngleRadians = (M_PI * 2.0) * (4.0 / 6.0);
+static const qreal startAngle = -140;
+static const qreal endAngleRadians = (M_PI * 2.0) * (5.0 / 6.0);
+static const qreal endAngle = 140;
+
+class QQuickDialPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDial)
+
+public:
+ QQuickDialPrivate() :
+ from(0),
+ to(1),
+ value(0),
+ position(0),
+ angle(startAngle),
+ stepSize(0),
+ pressed(false),
+ snapMode(QQuickDial::NoSnap),
+ wrap(false),
+ handle(nullptr)
+ {
+ }
+
+ qreal valueAt(qreal position) const;
+ qreal snapPosition(qreal position) const;
+ qreal positionAt(const QPoint &point) const;
+ void setPosition(qreal position);
+ void updatePosition();
+ bool isLargeChange(const QPoint &eventPos, qreal proposedPosition) const;
+
+ qreal from;
+ qreal to;
+ qreal value;
+ qreal position;
+ qreal angle;
+ qreal stepSize;
+ bool pressed;
+ QPoint pressPoint;
+ QQuickDial::SnapMode snapMode;
+ bool wrap;
+ QQuickItem *handle;
+};
+
+qreal QQuickDialPrivate::valueAt(qreal position) const
+{
+ return from + (to - from) * position;
+}
+
+qreal QQuickDialPrivate::snapPosition(qreal position) const
+{
+ const qreal range = to - from;
+ if (qFuzzyIsNull(range))
+ return position;
+
+ const qreal effectiveStep = stepSize / range;
+ if (qFuzzyIsNull(effectiveStep))
+ return position;
+
+ return qRound(position / effectiveStep) * effectiveStep;
+}
+
+qreal QQuickDialPrivate::positionAt(const QPoint &point) const
+{
+ qreal yy = height / 2.0 - point.y();
+ qreal xx = point.x() - width / 2.0;
+ qreal angle = (xx || yy) ? atan2(yy, xx) : 0;
+
+ if (angle < M_PI / -2)
+ angle = angle + M_PI * 2;
+
+ qreal normalizedAngle = (startAngleRadians - angle) / endAngleRadians;
+ return normalizedAngle;
+}
+
+void QQuickDialPrivate::setPosition(qreal pos)
+{
+ Q_Q(QQuickDial);
+ pos = qBound<qreal>(0.0, pos, 1.0);
+ if (qFuzzyCompare(position, pos))
+ return;
+
+ position = pos;
+
+ angle = startAngle + position * qAbs(endAngle - startAngle);
+
+ emit q->positionChanged();
+ emit q->angleChanged();
+}
+
+void QQuickDialPrivate::updatePosition()
+{
+ qreal pos = 0;
+ if (!qFuzzyCompare(from, to))
+ pos = (value - from) / (to - from);
+ setPosition(pos);
+}
+
+bool QQuickDialPrivate::isLargeChange(const QPoint &eventPos, qreal proposedPosition) const
+{
+ return qAbs(proposedPosition - position) >= 0.5 && eventPos.y() >= height / 2;
+}
+
+QQuickDial::QQuickDial(QQuickItem *parent) :
+ QQuickControl(*(new QQuickDialPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Dial::from
+
+ This property holds the starting value for the range. The default value is \c 0.0.
+
+ \sa to, value
+*/
+qreal QQuickDial::from() const
+{
+ Q_D(const QQuickDial);
+ return d->from;
+}
+
+void QQuickDial::setFrom(qreal from)
+{
+ Q_D(QQuickDial);
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Dial::to
+
+ This property holds the end value for the range. The default value is
+ \c 1.0.
+
+ \sa from, value
+*/
+qreal QQuickDial::to() const
+{
+ Q_D(const QQuickDial);
+ return d->to;
+}
+
+void QQuickDial::setTo(qreal to)
+{
+ Q_D(QQuickDial);
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Dial::value
+
+ This property holds the value in the range \c from - \c to. The default
+ value is \c 0.0.
+
+ Unlike the \l position property, the \c value is not updated while the
+ handle is dragged. The value is updated after the value has been chosen
+ and the dial has been released.
+
+ \sa position
+*/
+qreal QQuickDial::value() const
+{
+ Q_D(const QQuickDial);
+ return d->value;
+}
+
+void QQuickDial::setValue(qreal value)
+{
+ Q_D(QQuickDial);
+ if (isComponentComplete())
+ value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
+
+ if (qFuzzyCompare(d->value, value))
+ return;
+
+ d->value = value;
+ d->updatePosition();
+ emit valueChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Dial::position
+ \readonly
+
+ This property holds the logical position of the handle.
+
+ The position is expressed as a fraction of the control's angle range (the
+ range within which the handle can be moved) in the range \c {0.0 - 1.0}.
+ Unlike the \l value property, the \c position is continuously updated while
+ the handle is dragged.
+
+ \sa value, angle
+*/
+qreal QQuickDial::position() const
+{
+ Q_D(const QQuickDial);
+ return d->position;
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Dial::angle
+ \readonly
+
+ This property holds the angle of the handle.
+
+ Like the \l position property, angle is continuously updated while the
+ handle is dragged.
+
+ The range is from \c -140 degrees to \c 140 degrees.
+
+ \sa position
+*/
+qreal QQuickDial::angle() const
+{
+ Q_D(const QQuickDial);
+ return d->angle;
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Dial::stepSize
+
+ This property holds the step size.
+
+ The step size determines the amount by which the dial's value
+ is increased and decreased when interacted with via the keyboard.
+ For example, a step size of \c 0.2, will result in the dial's
+ value increasing and decreasing in increments of \c 0.2.
+
+ The step size is only respected for touch and mouse interaction
+ when \l snapMode is set to a value other than \c Dial.NoSnap.
+
+ The default value is \c 0.0, which results in an effective step
+ size of \c 0.1 for keyboard interaction.
+
+ \sa snapMode, increase(), decrease()
+*/
+qreal QQuickDial::stepSize() const
+{
+ Q_D(const QQuickDial);
+ return d->stepSize;
+}
+
+void QQuickDial::setStepSize(qreal step)
+{
+ Q_D(QQuickDial);
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Dial::snapMode
+
+ This property holds the snap mode.
+
+ The snap mode works with the \l stepSize to allow the handle to snap to
+ certain points along the dial.
+
+ Possible values:
+ \value Dial.NoSnap The dial does not snap (default).
+ \value Dial.SnapAlways The dial snaps while the handle is dragged.
+ \value Dial.SnapOnRelease The dial does not snap while being dragged, but only after the handle is released.
+
+ \sa stepSize
+*/
+QQuickDial::SnapMode QQuickDial::snapMode() const
+{
+ Q_D(const QQuickDial);
+ return d->snapMode;
+}
+
+void QQuickDial::setSnapMode(SnapMode mode)
+{
+ Q_D(QQuickDial);
+ if (d->snapMode == mode)
+ return;
+
+ d->snapMode = mode;
+ emit snapModeChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Dial::wrap
+
+ This property holds whether the dial wraps when dragged.
+
+ For example, when this property is set to \c true, dragging the dial past
+ the \l to position will result in the handle being positioned at the
+ \l from position, and vice versa:
+
+ \image qtquickcontrols2-dial-wrap.gif
+
+ When this property is \c false, it's not possible to drag the dial across
+ the from and to values.
+
+ \image qtquickcontrols2-dial-no-wrap.gif
+
+ The default value is \c false.
+*/
+bool QQuickDial::wrap() const
+{
+ Q_D(const QQuickDial);
+ return d->wrap;
+}
+
+void QQuickDial::setWrap(bool wrap)
+{
+ Q_D(QQuickDial);
+ if (d->wrap == wrap)
+ return;
+
+ d->wrap = wrap;
+ emit wrapChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Dial::pressed
+
+ This property holds whether the dial is pressed.
+
+ The dial will be pressed when either the mouse is pressed over it, or a key
+ such as \c Qt.Key_Left is held down. If you'd prefer not to have the dial
+ be pressed upon key presses (due to styling reasons, for example), you can
+ use the \l {Keys}{Keys attached property}:
+
+ \code
+ Dial {
+ Keys.onLeftPressed: {}
+ }
+ \endcode
+
+ This will result in pressed only being \c true upon mouse presses.
+*/
+bool QQuickDial::isPressed() const
+{
+ Q_D(const QQuickDial);
+ return d->pressed;
+}
+
+void QQuickDial::setPressed(bool pressed)
+{
+ Q_D(QQuickDial);
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ setAccessibleProperty("pressed", pressed);
+ emit pressedChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Dial::increase()
+
+ Increases the value by \l stepSize, or \c 0.1 if stepSize is not defined.
+
+ \sa stepSize
+*/
+void QQuickDial::increase()
+{
+ Q_D(QQuickDial);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(d->value + step);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Dial::decrease()
+
+ Decreases the value by \l stepSize, or \c 0.1 if stepSize is not defined.
+
+ \sa stepSize
+*/
+void QQuickDial::decrease()
+{
+ Q_D(QQuickDial);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(d->value - step);
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Dial::handle
+
+ This property holds the handle of the dial.
+
+ The handle acts as a visual indicator of the position of the dial.
+
+ \sa {Customizing Dial}
+*/
+QQuickItem *QQuickDial::handle() const
+{
+ Q_D(const QQuickDial);
+ return d->handle;
+}
+
+void QQuickDial::setHandle(QQuickItem *handle)
+{
+ Q_D(QQuickDial);
+ if (handle == d->handle)
+ return;
+
+ d->deleteDelegate(d->handle);
+ d->handle = handle;
+ if (d->handle && !d->handle->parentItem())
+ d->handle->setParentItem(this);
+ emit handleChanged();
+}
+
+void QQuickDial::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickDial);
+ switch (event->key()) {
+ case Qt::Key_Left:
+ case Qt::Key_Down:
+ setPressed(true);
+ if (isMirrored())
+ increase();
+ else
+ decrease();
+ break;
+
+ case Qt::Key_Right:
+ case Qt::Key_Up:
+ setPressed(true);
+ if (isMirrored())
+ decrease();
+ else
+ increase();
+ break;
+
+ case Qt::Key_Home:
+ setPressed(true);
+ setValue(isMirrored() ? d->to : d->from);
+ break;
+
+ case Qt::Key_End:
+ setPressed(true);
+ setValue(isMirrored() ? d->from : d->to);
+ break;
+
+ default:
+ event->ignore();
+ QQuickControl::keyPressEvent(event);
+ break;
+ }
+}
+
+void QQuickDial::keyReleaseEvent(QKeyEvent *event)
+{
+ QQuickControl::keyReleaseEvent(event);
+ setPressed(false);
+}
+
+void QQuickDial::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickDial);
+ QQuickControl::mousePressEvent(event);
+ d->pressPoint = event->pos();
+ setPressed(true);
+}
+
+void QQuickDial::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickDial);
+ QQuickControl::mouseMoveEvent(event);
+ if (!keepMouseGrab()) {
+ bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event);
+ setKeepMouseGrab(overXDragThreshold);
+
+ if (!overXDragThreshold) {
+ bool overYDragThreshold = QQuickWindowPrivate::dragOverThreshold(event->pos().y() - d->pressPoint.y(), Qt::YAxis, event);
+ setKeepMouseGrab(overYDragThreshold);
+ }
+ }
+ if (keepMouseGrab()) {
+ qreal pos = d->positionAt(event->pos());
+ if (d->snapMode == SnapAlways)
+ pos = d->snapPosition(pos);
+
+ if (d->wrap || (!d->wrap && !d->isLargeChange(event->pos(), pos)))
+ d->setPosition(pos);
+ }
+}
+
+void QQuickDial::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickDial);
+ QQuickControl::mouseReleaseEvent(event);
+
+ if (keepMouseGrab()) {
+ qreal pos = d->positionAt(event->pos());
+ if (d->snapMode != NoSnap)
+ pos = d->snapPosition(pos);
+
+ if (d->wrap || (!d->wrap && !d->isLargeChange(event->pos(), pos)))
+ setValue(d->valueAt(pos));
+
+ setKeepMouseGrab(false);
+ }
+
+ setPressed(false);
+ d->pressPoint = QPoint();
+}
+
+void QQuickDial::mouseUngrabEvent()
+{
+ Q_D(QQuickDial);
+ QQuickControl::mouseUngrabEvent();
+ d->pressPoint = QPoint();
+ setPressed(false);
+}
+
+void QQuickDial::mirrorChange()
+{
+ QQuickControl::mirrorChange();
+ emit angleChanged();
+}
+
+void QQuickDial::componentComplete()
+{
+ Q_D(QQuickDial);
+ QQuickControl::componentComplete();
+ setValue(d->value);
+ d->updatePosition();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickDial::accessibilityActiveChanged(bool active)
+{
+ QQuickControl::accessibilityActiveChanged(active);
+
+ Q_D(QQuickDial);
+ if (active)
+ setAccessibleProperty("pressed", d->pressed);
+}
+
+QAccessible::Role QQuickDial::accessibleRole() const
+{
+ return QAccessible::Dial;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickdial_p.h b/src/quicktemplates2/qquickdial_p.h
new file mode 100644
index 00000000..2d87d6d9
--- /dev/null
+++ b/src/quicktemplates2/qquickdial_p.h
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDIAL_P_H
+#define QQUICKDIAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qvariant.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDialAttached;
+class QQuickDialPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDial : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged FINAL)
+ Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
+ Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
+ Q_PROPERTY(bool wrap READ wrap WRITE setWrap NOTIFY wrapChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
+
+public:
+ explicit QQuickDial(QQuickItem *parent = nullptr);
+
+ qreal from() const;
+ void setFrom(qreal from);
+
+ qreal to() const;
+ void setTo(qreal to);
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal position() const;
+
+ qreal angle() const;
+
+ qreal stepSize() const;
+ void setStepSize(qreal step);
+
+ enum SnapMode {
+ NoSnap,
+ SnapAlways,
+ SnapOnRelease
+ };
+ Q_ENUM(SnapMode)
+
+ SnapMode snapMode() const;
+ void setSnapMode(SnapMode mode);
+
+ bool wrap() const;
+ void setWrap(bool wrap);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ QQuickItem *handle() const;
+ void setHandle(QQuickItem *handle);
+
+public Q_SLOTS:
+ void increase();
+ void decrease();
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void valueChanged();
+ void positionChanged();
+ void angleChanged();
+ void stepSizeChanged();
+ void snapModeChanged();
+ void wrapChanged();
+ void pressedChanged();
+ void handleChanged();
+
+protected:
+ 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) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickDial)
+ Q_DECLARE_PRIVATE(QQuickDial)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickDial)
+
+#endif // QQUICKDIAL_P_H
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
new file mode 100644
index 00000000..1dae911e
--- /dev/null
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -0,0 +1,634 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickdrawer_p.h"
+#include "qquickdrawer_p_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQuick/private/qquicktransition_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Drawer
+ \inherits Popup
+ \instantiates QQuickDrawer
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-navigation
+ \ingroup qtquickcontrols2-popups
+ \brief Side panel that can be opened and closed using a swipe gesture.
+
+ Drawer provides a swipe-based side panel, similar to those often used in
+ touch interfaces to provide a central location for navigation.
+
+ \image qtquickcontrols2-drawer.gif
+
+ Drawer can be positioned at any of the four edges of the content item.
+ The drawer above is positioned against the left edge of the window. The
+ drawer is then opened by \e "dragging" it out from the left edge of the
+ window.
+
+ \code
+ import QtQuick 2.7
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ id: window
+ visible: true
+
+ Drawer {
+ id: drawer
+ width: 0.66 * window.width
+ height: window.height
+ }
+ }
+ \endcode
+
+ Drawer is a special type of popup that resides at one of the window \l {edge}{edges}.
+ By default, Drawer re-parents itself to the window \l {ApplicationWindow::}{overlay},
+ and therefore operates on window coordinates. It is also possible to manually set the
+ \l {Popup::}{parent} to something else to make the drawer operate in a specific
+ coordinate space.
+
+ Drawer can be configured to cover only part of its window edge. The following example
+ illustrates how Drawer can be positioned to appear below a window header:
+
+ \code
+ import QtQuick 2.7
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ id: window
+ visible: true
+
+ header: ToolBar { }
+
+ Drawer {
+ y: header.height
+ width: window.width * 0.6
+ height: window.height - header.height
+ }
+ }
+ \endcode
+
+ The \l position property determines how much of the drawer is visible, as
+ a value between \c 0.0 and \c 1.0. It is not possible to set the x-coordinate
+ (or horizontal margins) of a drawer at the left or right window edge, or the
+ y-coordinate (or vertical margins) of a drawer at the top or bottom window edge.
+
+ In the image above, the application's contents are \e "pushed" across the
+ screen. This is achieved by applying a translation to the contents:
+
+ \code
+ import QtQuick 2.7
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ id: window
+ width: 200
+ height: 228
+ visible: true
+
+ Drawer {
+ id: drawer
+ width: 0.66 * window.width
+ height: window.height
+ }
+
+ Label {
+ id: content
+
+ text: "Aa"
+ font.pixelSize: 96
+ anchors.fill: parent
+ verticalAlignment: Label.AlignVCenter
+ horizontalAlignment: Label.AlignHCenter
+
+ transform: Translate {
+ x: drawer.position * content.width * 0.33
+ }
+ }
+ }
+ \endcode
+
+ If you would like the application's contents to stay where they are when
+ the drawer is opened, don't apply a translation.
+
+ \note On some platforms, certain edges may be reserved for system
+ gestures and therefore cannot be used with Drawer. For example, the
+ top and bottom edges may be reserved for system notifications and
+ control centers on Android and iOS.
+
+ \sa SwipeView, {Customizing Drawer}, {Navigation Controls}, {Popup Controls}
+*/
+
+QQuickDrawerPrivate::QQuickDrawerPrivate()
+ : edge(Qt::LeftEdge), offset(0), position(0),
+ dragMargin(QGuiApplication::styleHints()->startDragDistance())
+{
+ setEdge(Qt::LeftEdge);
+}
+
+qreal QQuickDrawerPrivate::positionAt(const QPointF &point) const
+{
+ Q_Q(const QQuickDrawer);
+ QQuickWindow *window = q->window();
+ if (!window)
+ return 0;
+
+ switch (edge) {
+ case Qt::TopEdge:
+ return point.y() / q->height();
+ case Qt::LeftEdge:
+ return point.x() / q->width();
+ case Qt::RightEdge:
+ return (window->width() - point.x()) / q->width();
+ case Qt::BottomEdge:
+ return (window->height() - point.y()) / q->height();
+ default:
+ return 0;
+ }
+}
+
+void QQuickDrawerPrivate::reposition()
+{
+ Q_Q(QQuickDrawer);
+ QQuickWindow *window = q->window();
+ if (!window)
+ return;
+
+ switch (edge) {
+ case Qt::LeftEdge:
+ popupItem->setX((position - 1.0) * popupItem->width());
+ break;
+ case Qt::RightEdge:
+ popupItem->setX(window->width() - position * popupItem->width());
+ break;
+ case Qt::TopEdge:
+ popupItem->setY((position - 1.0) * popupItem->height());
+ break;
+ case Qt::BottomEdge:
+ popupItem->setY(window->height() - position * popupItem->height());
+ break;
+ }
+
+ QQuickPopupPrivate::reposition();
+}
+
+void QQuickDrawerPrivate::resizeOverlay()
+{
+ if (!dimmer || !window)
+ return;
+
+ QRectF geometry(0, 0, window->width(), window->height());
+
+ if (edge == Qt::LeftEdge || edge == Qt::RightEdge) {
+ geometry.setY(popupItem->y());
+ geometry.setHeight(popupItem->height());
+ } else {
+ geometry.setX(popupItem->x());
+ geometry.setWidth(popupItem->width());
+ }
+
+ dimmer->setPosition(geometry.topLeft());
+ dimmer->setSize(geometry.size());
+}
+
+static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int threshold = -1)
+{
+ return QQuickWindowPrivate::dragOverThreshold(d, axis, event, threshold);
+}
+
+bool QQuickDrawerPrivate::startDrag(QQuickWindow *window, QMouseEvent *event)
+{
+ if (!window || dragMargin < 0.0 || qFuzzyIsNull(dragMargin))
+ return false;
+
+ bool drag = false;
+ switch (edge) {
+ case Qt::LeftEdge:
+ drag = !dragOverThreshold(event->windowPos().x(), Qt::XAxis, event, dragMargin);
+ break;
+ case Qt::RightEdge:
+ drag = !dragOverThreshold(window->width() - event->windowPos().x(), Qt::XAxis, event, dragMargin);
+ break;
+ case Qt::TopEdge:
+ drag = !dragOverThreshold(event->windowPos().y(), Qt::YAxis, event, dragMargin);
+ break;
+ case Qt::BottomEdge:
+ drag = !dragOverThreshold(window->height() - event->windowPos().y(), Qt::YAxis, event, dragMargin);
+ break;
+ default:
+ break;
+ }
+
+ if (drag) {
+ prepareEnterTransition();
+ reposition();
+ handleMousePressEvent(window->contentItem(), event);
+ }
+
+ return drag;
+}
+
+bool QQuickDrawerPrivate::grabMouse(QMouseEvent *event)
+{
+ Q_Q(QQuickDrawer);
+ if (!window || popupItem->keepMouseGrab())
+ return false;
+
+ const QPointF movePoint = event->windowPos();
+
+ // Flickable uses a hard-coded threshold of 15 for flicking, and
+ // QStyleHints::startDragDistance for dragging. Drawer uses a bit
+ // larger threshold to avoid being too eager to steal touch (QTBUG-50045)
+ const int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
+ bool overThreshold = false;
+ if (position > 0 || dragMargin > 0) {
+ if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
+ overThreshold = dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event, threshold);
+ else
+ overThreshold = dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event, threshold);
+ }
+
+ // Don't be too eager to steal presses outside the drawer (QTBUG-53929)
+ if (overThreshold && qFuzzyCompare(position, qreal(1.0)) && !popupItem->contains(popupItem->mapFromScene(movePoint))) {
+ if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
+ overThreshold = qAbs(movePoint.x() - q->width()) < dragMargin;
+ else
+ overThreshold = qAbs(movePoint.y() - q->height()) < dragMargin;
+ }
+
+ return overThreshold;
+}
+
+static const qreal openCloseVelocityThreshold = 300;
+
+bool QQuickDrawerPrivate::ungrabMouse(QMouseEvent *event)
+{
+ bool wasGrabbed = popupItem->keepMouseGrab();
+ if (wasGrabbed) {
+ const QPointF releasePoint = event->windowPos();
+ velocityCalculator.stopMeasuring(releasePoint, event->timestamp());
+
+ qreal velocity = 0;
+ if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
+ velocity = velocityCalculator.velocity().x();
+ else
+ velocity = velocityCalculator.velocity().y();
+
+ // the velocity is calculated so that swipes from left to right
+ // and top to bottom have positive velocity, and swipes from right
+ // to left and bottom to top have negative velocity.
+ //
+ // - top/left edge: positive velocity opens, negative velocity closes
+ // - bottom/right edge: negative velocity opens, positive velocity closes
+ //
+ // => invert the velocity for bottom and right edges, for the threshold comparison below
+ if (edge == Qt::RightEdge || edge == Qt::BottomEdge)
+ velocity = -velocity;
+
+ if (position > 0.7 || velocity > openCloseVelocityThreshold) {
+ transitionManager.transitionEnter();
+ } else if (position < 0.3 || velocity < -openCloseVelocityThreshold) {
+ transitionManager.transitionExit();
+ } else {
+ switch (edge) {
+ case Qt::LeftEdge:
+ if (releasePoint.x() - pressPoint.x() > 0)
+ transitionManager.transitionEnter();
+ else
+ transitionManager.transitionExit();
+ break;
+ case Qt::RightEdge:
+ if (releasePoint.x() - pressPoint.x() < 0)
+ transitionManager.transitionEnter();
+ else
+ transitionManager.transitionExit();
+ break;
+ case Qt::TopEdge:
+ if (releasePoint.y() - pressPoint.y() > 0)
+ transitionManager.transitionEnter();
+ else
+ transitionManager.transitionExit();
+ break;
+ case Qt::BottomEdge:
+ if (releasePoint.y() - pressPoint.y() < 0)
+ transitionManager.transitionEnter();
+ else
+ transitionManager.transitionExit();
+ break;
+ }
+ }
+ }
+ return wasGrabbed;
+}
+
+bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
+{
+ offset = 0;
+ pressPoint = event->windowPos();
+ velocityCalculator.startMeasuring(pressPoint, event->timestamp());
+
+ // don't block press events
+ // a) outside a non-modal drawer,
+ // b) to drawer children, or
+ // c) outside a modal drawer's background dimming
+ event->setAccepted(modal && !popupItem->isAncestorOf(item) && (!dimmer || dimmer->contains(dimmer->mapFromScene(pressPoint))));
+ return event->isAccepted();
+}
+
+bool QQuickDrawerPrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickDrawer);
+ Q_UNUSED(item);
+
+ // Don't react to synthesized mouse move events at INF,INF coordinates.
+ // QQuickWindowPrivate::translateTouchToMouse() uses them to clear hover
+ // on touch release (QTBUG-55995).
+ if (qIsInf(event->screenPos().x()) || qIsInf(event->screenPos().y()))
+ return true;
+
+ const QPointF movePoint = event->windowPos();
+
+ if (grabMouse(event)) {
+ QQuickItem *grabber = window->mouseGrabberItem();
+ if (!grabber || !grabber->keepMouseGrab()) {
+ popupItem->grabMouse();
+ popupItem->setKeepMouseGrab(true);
+ offset = qMin<qreal>(0.0, positionAt(movePoint) - position);
+ }
+ }
+
+ if (popupItem->keepMouseGrab())
+ q->setPosition(positionAt(movePoint) - offset);
+ event->accept();
+
+ return popupItem->keepMouseGrab();
+}
+
+bool QQuickDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_UNUSED(item);
+
+ const bool wasGrabbed = ungrabMouse(event);
+
+ popupItem->setKeepMouseGrab(false);
+ pressPoint = QPoint();
+ event->accept();
+
+ return wasGrabbed;
+}
+
+static QList<QQuickStateAction> prepareTransition(QQuickDrawer *drawer, QQuickTransition *transition, qreal to)
+{
+ QList<QQuickStateAction> actions;
+ if (!transition || !QQuickPopupPrivate::get(drawer)->window || !transition->enabled())
+ return actions;
+
+ qmlExecuteDeferred(transition);
+
+ QQmlProperty defaultTarget(drawer, QLatin1String("position"));
+ QQmlListProperty<QQuickAbstractAnimation> animations = transition->animations();
+ int count = animations.count(&animations);
+ for (int i = 0; i < count; ++i) {
+ QQuickAbstractAnimation *anim = animations.at(&animations, i);
+ anim->setDefaultTarget(defaultTarget);
+ }
+
+ actions << QQuickStateAction(drawer, QLatin1String("position"), to);
+ return actions;
+}
+
+bool QQuickDrawerPrivate::prepareEnterTransition()
+{
+ Q_Q(QQuickDrawer);
+ enterActions = prepareTransition(q, enter, 1.0);
+ return QQuickPopupPrivate::prepareEnterTransition();
+}
+
+bool QQuickDrawerPrivate::prepareExitTransition()
+{
+ Q_Q(QQuickDrawer);
+ exitActions = prepareTransition(q, exit, 0.0);
+ return QQuickPopupPrivate::prepareExitTransition();
+}
+
+void QQuickDrawerPrivate::setEdge(Qt::Edge e)
+{
+ edge = e;
+ if (edge == Qt::LeftEdge || edge == Qt::RightEdge) {
+ allowVerticalMove = true;
+ allowVerticalResize = true;
+ allowHorizontalMove = false;
+ allowHorizontalResize = false;
+ } else {
+ allowVerticalMove = false;
+ allowVerticalResize = false;
+ allowHorizontalMove = true;
+ allowHorizontalResize = true;
+ }
+}
+
+QQuickDrawer::QQuickDrawer(QObject *parent) :
+ QQuickPopup(*(new QQuickDrawerPrivate), parent)
+{
+ setFocus(true);
+ setModal(true);
+ setFiltersChildMouseEvents(true);
+ setClosePolicy(CloseOnEscape | CloseOnReleaseOutside);
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Drawer::edge
+
+ This property holds the edge of the window at which the drawer will
+ open from. The acceptable values are:
+
+ \value Qt.TopEdge The top edge of the window.
+ \value Qt.LeftEdge The left edge of the window (default).
+ \value Qt.RightEdge The right edge of the window.
+ \value Qt.BottomEdge The bottom edge of the window.
+*/
+Qt::Edge QQuickDrawer::edge() const
+{
+ Q_D(const QQuickDrawer);
+ return d->edge;
+}
+
+void QQuickDrawer::setEdge(Qt::Edge edge)
+{
+ Q_D(QQuickDrawer);
+ if (d->edge == edge)
+ return;
+
+ d->setEdge(edge);
+ if (isComponentComplete())
+ d->reposition();
+ emit edgeChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Drawer::position
+
+ This property holds the position of the drawer relative to its final
+ destination. That is, the position will be \c 0.0 when the drawer
+ is fully closed, and \c 1.0 when fully open.
+*/
+qreal QQuickDrawer::position() const
+{
+ Q_D(const QQuickDrawer);
+ return d->position;
+}
+
+void QQuickDrawer::setPosition(qreal position)
+{
+ Q_D(QQuickDrawer);
+ position = qBound<qreal>(0.0, position, 1.0);
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ if (isComponentComplete())
+ d->reposition();
+ if (d->dimmer)
+ d->dimmer->setOpacity(position);
+ emit positionChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Drawer::dragMargin
+
+ This property holds the distance from the screen edge within which
+ drag actions will open the drawer. Setting the value to \c 0 or less
+ prevents opening the drawer by dragging.
+
+ The default value is \c Qt.styleHints.startDragDistance.
+*/
+qreal QQuickDrawer::dragMargin() const
+{
+ Q_D(const QQuickDrawer);
+ return d->dragMargin;
+}
+
+void QQuickDrawer::setDragMargin(qreal margin)
+{
+ Q_D(QQuickDrawer);
+ if (qFuzzyCompare(d->dragMargin, margin))
+ return;
+
+ d->dragMargin = margin;
+ emit dragMarginChanged();
+}
+
+void QQuickDrawer::resetDragMargin()
+{
+ setDragMargin(QGuiApplication::styleHints()->startDragDistance());
+}
+
+bool QQuickDrawer::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ Q_D(QQuickDrawer);
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseMove:
+ return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseButtonRelease:
+ return d->handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
+ default:
+ return false;
+ }
+}
+
+void QQuickDrawer::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickDrawer);
+ QQuickPopup::mousePressEvent(event);
+ d->handleMousePressEvent(d->popupItem, event);
+}
+
+void QQuickDrawer::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickDrawer);
+ QQuickPopup::mouseMoveEvent(event);
+ d->handleMouseMoveEvent(d->popupItem, event);
+}
+
+void QQuickDrawer::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickDrawer);
+ QQuickPopup::mouseReleaseEvent(event);
+ d->handleMouseReleaseEvent(d->popupItem, event);
+}
+
+void QQuickDrawer::mouseUngrabEvent()
+{
+ Q_D(QQuickDrawer);
+ QQuickPopup::mouseUngrabEvent();
+ d->pressPoint = QPoint();
+ d->velocityCalculator.reset();
+}
+
+bool QQuickDrawer::overlayEvent(QQuickItem *item, QEvent *event)
+{
+ Q_D(QQuickDrawer);
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ d->tryClose(item, static_cast<QMouseEvent *>(event));
+ return d->handleMousePressEvent(item, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseMove:
+ return d->handleMouseMoveEvent(item, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseButtonRelease:
+ d->tryClose(item, static_cast<QMouseEvent *>(event));
+ return d->handleMouseReleaseEvent(item, static_cast<QMouseEvent *>(event));
+ default:
+ return QQuickPopup::overlayEvent(item, event);
+ }
+}
+
+void QQuickDrawer::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickDrawer);
+ QQuickPopup::geometryChanged(newGeometry, oldGeometry);
+ d->resizeOverlay();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickdrawer_p.h b/src/quicktemplates2/qquickdrawer_p.h
new file mode 100644
index 00000000..bada1344
--- /dev/null
+++ b/src/quicktemplates2/qquickdrawer_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDRAWER_P_H
+#define QQUICKDRAWER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickpopup_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDrawerPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDrawer : public QQuickPopup
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged FINAL)
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal dragMargin READ dragMargin WRITE setDragMargin RESET resetDragMargin NOTIFY dragMarginChanged FINAL)
+
+public:
+ explicit QQuickDrawer(QObject *parent = nullptr);
+
+ Qt::Edge edge() const;
+ void setEdge(Qt::Edge edge);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ qreal dragMargin() const;
+ void setDragMargin(qreal margin);
+ void resetDragMargin();
+
+Q_SIGNALS:
+ void edgeChanged();
+ void positionChanged();
+ void dragMarginChanged();
+
+protected:
+ 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;
+ bool overlayEvent(QQuickItem *item, QEvent *event) override;
+
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+private:
+ Q_DISABLE_COPY(QQuickDrawer)
+ Q_DECLARE_PRIVATE(QQuickDrawer)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickDrawer)
+
+#endif // QQUICKDRAWER_P_H
diff --git a/src/quicktemplates2/qquickdrawer_p_p.h b/src/quicktemplates2/qquickdrawer_p_p.h
new file mode 100644
index 00000000..b7555c3e
--- /dev/null
+++ b/src/quicktemplates2/qquickdrawer_p_p.h
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKDRAWER_P_P_H
+#define QQUICKDRAWER_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickdrawer_p.h"
+#include "qquickpopup_p_p.h"
+#include "qquickvelocitycalculator_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDrawerPrivate : public QQuickPopupPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDrawer)
+
+public:
+ QQuickDrawerPrivate();
+
+ static QQuickDrawerPrivate *get(QQuickDrawer *drawer)
+ {
+ return drawer->d_func();
+ }
+
+ qreal positionAt(const QPointF &point) const;
+ void reposition() override;
+ void resizeOverlay() override;
+
+ bool startDrag(QQuickWindow *window, QMouseEvent *event);
+ bool grabMouse(QMouseEvent *event);
+ bool ungrabMouse(QMouseEvent *event);
+
+ bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
+
+ bool prepareEnterTransition() override;
+ bool prepareExitTransition() override;
+
+ void setEdge(Qt::Edge edge);
+
+ Qt::Edge edge;
+ qreal offset;
+ qreal position;
+ qreal dragMargin;
+ QPointF pressPoint;
+ QQuickVelocityCalculator velocityCalculator;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDRAWER_P_P_H
diff --git a/src/quicktemplates2/qquickframe.cpp b/src/quicktemplates2/qquickframe.cpp
new file mode 100644
index 00000000..9deef6be
--- /dev/null
+++ b/src/quicktemplates2/qquickframe.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickframe_p.h"
+#include "qquickframe_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Frame
+ \inherits Pane
+ \instantiates QQuickFrame
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \brief Visual frame for a logical group of controls.
+
+ 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
+ you to position its contents, for instance by creating a \l RowLayout
+ or a \l ColumnLayout.
+
+ Items declared as children of a Frame are automatically parented to the
+ Frame's \l {Control::}{contentItem}. Items created dynamically need to be
+ explicitly parented to the contentItem.
+
+ If only a single item is used within a Frame, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \image qtquickcontrols2-frame.png
+
+ \snippet qtquickcontrols2-frame.qml 1
+
+ \sa {Customizing Frame}, {Container Controls}
+*/
+
+QQuickFrame::QQuickFrame(QQuickItem *parent) :
+ QQuickPane(*(new QQuickFramePrivate), parent)
+{
+}
+
+QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
+ QQuickPane(dd, parent)
+{
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickFrame::accessibleRole() const
+{
+ return QAccessible::Border;
+}
+#endif // QT_NO_ACCESSIBILITY
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickframe_p.h b/src/quicktemplates2/qquickframe_p.h
new file mode 100644
index 00000000..093da248
--- /dev/null
+++ b/src/quicktemplates2/qquickframe_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFRAME_P_H
+#define QQUICKFRAME_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickpane_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFramePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickFrame : public QQuickPane
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickFrame(QQuickItem *parent = nullptr);
+
+protected:
+ QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickFrame)
+ Q_DECLARE_PRIVATE(QQuickFrame)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickFrame)
+
+#endif // QQUICKFRAME_P_H
diff --git a/src/quicktemplates2/qquickframe_p_p.h b/src/quicktemplates2/qquickframe_p_p.h
new file mode 100644
index 00000000..6939be6c
--- /dev/null
+++ b/src/quicktemplates2/qquickframe_p_p.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFRAME_P_P_H
+#define QQUICKFRAME_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickpane_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFrame;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickFramePrivate : public QQuickPanePrivate
+{
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKFRAME_P_P_H
diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp
new file mode 100644
index 00000000..dd6d1883
--- /dev/null
+++ b/src/quicktemplates2/qquickgroupbox.cpp
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickgroupbox_p.h"
+#include "qquickframe_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype GroupBox
+ \inherits Frame
+ \instantiates QQuickGroupBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \brief Visual frame and title for a logical group of controls.
+
+ GroupBox is used to layout a logical group of controls together, within
+ a \l {title}{titled} visual frame. GroupBox does not provide a layout of its own, but
+ requires you to position its contents, for instance by creating a \l RowLayout
+ or a \l ColumnLayout.
+
+ Items declared as children of a GroupBox are automatically parented to the
+ GroupBox's \l {Control::}{contentItem}. Items created dynamically need to be
+ explicitly parented to the contentItem.
+
+ If only a single item is used within a GroupBox, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \image qtquickcontrols2-groupbox.png
+
+ \snippet qtquickcontrols2-groupbox.qml 1
+
+ \section2 Checkable GroupBox
+
+ Even though GroupBox has no built-in check box, it is straightforward
+ to create a checkable GroupBox by pairing it with a CheckBox.
+
+ \image qtquickcontrols2-groupbox-checkable.png
+
+ It is a common pattern to enable or disable the groupbox's children when
+ its checkbox is toggled on or off, but it is up to the application to decide
+ on the behavior of the checkbox.
+
+ \snippet qtquickcontrols2-groupbox-checkable.qml 1
+
+ \sa CheckBox, {Customizing GroupBox}, {Container Controls}
+*/
+
+class QQuickGroupBoxPrivate : public QQuickFramePrivate
+{
+public:
+ QQuickGroupBoxPrivate() : label(nullptr) { }
+
+ QString title;
+ QQuickItem *label;
+};
+
+QQuickGroupBox::QQuickGroupBox(QQuickItem *parent) :
+ QQuickFrame(*(new QQuickGroupBoxPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::GroupBox::title
+
+ This property holds the title.
+
+ The title is typically displayed above the groupbox to
+ summarize its contents.
+*/
+QString QQuickGroupBox::title() const
+{
+ Q_D(const QQuickGroupBox);
+ return d->title;
+}
+
+void QQuickGroupBox::setTitle(const QString &title)
+{
+ Q_D(QQuickGroupBox);
+ if (d->title == title)
+ return;
+
+ d->title = title;
+ setAccessibleName(title);
+ emit titleChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::GroupBox::label
+
+ This property holds the label item that visualizes \l title.
+
+ \sa {Customizing GroupBox}
+*/
+QQuickItem *QQuickGroupBox::label() const
+{
+ Q_D(const QQuickGroupBox);
+ return d->label;
+}
+
+void QQuickGroupBox::setLabel(QQuickItem *label)
+{
+ Q_D(QQuickGroupBox);
+ if (d->label == label)
+ return;
+
+ d->deleteDelegate(d->label);
+ d->label = label;
+ if (label && !label->parentItem())
+ label->setParentItem(this);
+ emit labelChanged();
+}
+
+QFont QQuickGroupBox::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::GroupBoxTitleFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickGroupBox::accessibleRole() const
+{
+ return QAccessible::Grouping;
+}
+
+void QQuickGroupBox::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickGroupBox);
+ QQuickFrame::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->title);
+}
+#endif // QT_NO_ACCESSIBILITY
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickgroupbox_p.h b/src/quicktemplates2/qquickgroupbox_p.h
new file mode 100644
index 00000000..98f6ad06
--- /dev/null
+++ b/src/quicktemplates2/qquickgroupbox_p.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKGROUPBOX_P_H
+#define QQUICKGROUPBOX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickframe_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickGroupBoxPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickGroupBox : public QQuickFrame
+{
+ Q_OBJECT
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
+
+public:
+ explicit QQuickGroupBox(QQuickItem *parent = nullptr);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QQuickItem *label() const;
+ void setLabel(QQuickItem *label);
+
+Q_SIGNALS:
+ void titleChanged();
+ void labelChanged();
+
+protected:
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickGroupBox)
+ Q_DECLARE_PRIVATE(QQuickGroupBox)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickGroupBox)
+
+#endif // QQUICKGROUPBOX_P_H
diff --git a/src/quicktemplates2/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp
new file mode 100644
index 00000000..411cb224
--- /dev/null
+++ b/src/quicktemplates2/qquickitemdelegate.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickitemdelegate_p.h"
+#include "qquickitemdelegate_p_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ItemDelegate
+ \inherits AbstractButton
+ \instantiates QQuickItemDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \brief Basic item delegate that can be used in various views and controls.
+
+ \image qtquickcontrols2-itemdelegate.gif
+
+ 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.
+
+ ItemDelegate inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
+ using the AbstractButton API.
+
+ \snippet qtquickcontrols2-itemdelegate.qml 1
+
+ \sa {Customizing ItemDelegate}, {Delegate Controls}
+*/
+
+QQuickItemDelegatePrivate::QQuickItemDelegatePrivate() :
+ highlighted(false)
+{
+}
+
+QQuickItemDelegate::QQuickItemDelegate(QQuickItem *parent) :
+ QQuickAbstractButton(*(new QQuickItemDelegatePrivate), parent)
+{
+ setFocusPolicy(Qt::NoFocus);
+}
+
+QQuickItemDelegate::QQuickItemDelegate(QQuickItemDelegatePrivate &dd, QQuickItem *parent) :
+ QQuickAbstractButton(dd, parent)
+{
+ setFocusPolicy(Qt::NoFocus);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::ItemDelegate::highlighted
+
+ This property holds whether the delegate is highlighted.
+
+ A delegate can be highlighted in order to draw the user's attention towards
+ it. It has no effect on keyboard interaction. For example, you can
+ highlight the current item in a ListView using the following code:
+
+ \code
+ ListView {
+ id: listView
+ model: 10
+ delegate: ItemDelegate {
+ text: modelData
+ highlighted: ListView.isCurrentItem
+ onClicked: listView.currentIndex = index
+ }
+ }
+ \endcode
+
+ The default value is \c false.
+*/
+bool QQuickItemDelegate::isHighlighted() const
+{
+ Q_D(const QQuickItemDelegate);
+ return d->highlighted;
+}
+
+void QQuickItemDelegate::setHighlighted(bool highlighted)
+{
+ Q_D(QQuickItemDelegate);
+ if (highlighted == d->highlighted)
+ return;
+
+ d->highlighted = highlighted;
+ emit highlightedChanged();
+}
+
+QFont QQuickItemDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ItemViewFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickItemDelegate::accessibleRole() const
+{
+ return QAccessible::ListItem;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickitemdelegate_p.h b/src/quicktemplates2/qquickitemdelegate_p.h
new file mode 100644
index 00000000..429b0ca9
--- /dev/null
+++ b/src/quicktemplates2/qquickitemdelegate_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKITEMDELEGATE_P_H
+#define QQUICKITEMDELEGATE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItemDelegatePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickItemDelegate : public QQuickAbstractButton
+{
+ Q_OBJECT
+ Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
+
+public:
+ explicit QQuickItemDelegate(QQuickItem *parent = nullptr);
+
+ bool isHighlighted() const;
+ void setHighlighted(bool highlighted);
+
+Q_SIGNALS:
+ void highlightedChanged();
+
+protected:
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+protected:
+ QQuickItemDelegate(QQuickItemDelegatePrivate &dd, QQuickItem *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickItemDelegate)
+ Q_DECLARE_PRIVATE(QQuickItemDelegate)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickItemDelegate)
+
+#endif // QQUICKITEMDELEGATE_P_H
diff --git a/src/quicktemplates2/qquickitemdelegate_p_p.h b/src/quicktemplates2/qquickitemdelegate_p_p.h
new file mode 100644
index 00000000..c69f3d46
--- /dev/null
+++ b/src/quicktemplates2/qquickitemdelegate_p_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKITEMDELEGATE_P_P_H
+#define QQUICKITEMDELEGATE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItemDelegatePrivate : public QQuickAbstractButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickItemDelegate)
+
+public:
+ QQuickItemDelegatePrivate();
+
+ bool highlighted;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKITEMDELEGATE_P_P_H
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
new file mode 100644
index 00000000..ebd1755a
--- /dev/null
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -0,0 +1,275 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicklabel_p.h"
+#include "qquicklabel_p_p.h"
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickclipnode_p.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Label
+ \inherits Text
+ \instantiates QQuickLabel
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup text
+ \brief Styled text label with inherited font.
+
+ Label extends \l Text with styling and \l {Control::font}{font}
+ inheritance. The default colors and font are style specific. Label
+ can also have a visual \l background item.
+
+ \image qtquickcontrols2-label.png
+
+ \snippet qtquickcontrols2-label.qml 1
+
+ You can use the properties of \l Text to change the appearance of the text as desired:
+
+ \qml
+ Label {
+ text: "Hello world"
+ font.pixelSize: 22
+ font.italic: true
+ }
+ \endqml
+
+ \sa {Customizing Label}
+*/
+
+QQuickLabel::QQuickLabel(QQuickItem *parent) :
+ QQuickText(*(new QQuickLabelPrivate), parent)
+{
+ Q_D(QQuickLabel);
+ QObjectPrivate::connect(this, &QQuickText::textChanged,
+ d, &QQuickLabelPrivate::_q_textChanged);
+}
+
+QQuickLabel::~QQuickLabel()
+{
+}
+
+QQuickLabelPrivate::QQuickLabelPrivate()
+ : background(nullptr), accessibleAttached(nullptr)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::installActivationObserver(this);
+#endif
+}
+
+QQuickLabelPrivate::~QQuickLabelPrivate()
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::removeActivationObserver(this);
+#endif
+}
+
+/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickLabelPrivate::resolveFont()
+{
+ Q_Q(QQuickLabel);
+ inheritFont(QQuickControlPrivate::parentFont(q));
+}
+
+void QQuickLabelPrivate::inheritFont(const QFont &f)
+{
+ Q_Q(QQuickLabel);
+ QFont parentFont = font.resolve(f);
+ parentFont.resolve(font.resolve() | f.resolve());
+
+ const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::LabelFont);
+ const QFont resolvedFont = parentFont.resolve(defaultFont);
+
+ const bool changed = resolvedFont != sourceFont;
+ q->QQuickText::setFont(resolvedFont);
+ if (changed)
+ emit q->fontChanged();
+}
+
+void QQuickLabelPrivate::_q_textChanged(const QString &text)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleAttached)
+ accessibleAttached->setName(text);
+#else
+ Q_UNUSED(text)
+#endif
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
+{
+ if (accessibleAttached || !active)
+ return;
+
+ Q_Q(QQuickLabel);
+ accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+ if (accessibleAttached) {
+ accessibleAttached->setRole(accessibleRole());
+ accessibleAttached->setName(text);
+ } else {
+ qWarning() << "QQuickLabel: " << q << " QQuickAccessibleAttached object creation failed!";
+ }
+}
+
+QAccessible::Role QQuickLabelPrivate::accessibleRole() const
+{
+ return QAccessible::StaticText;
+}
+#endif
+
+/*
+ Deletes "delegate" if Component.completed() has been emitted,
+ otherwise stores it in pendingDeletions.
+*/
+void QQuickLabelPrivate::deleteDelegate(QObject *delegate)
+{
+ if (componentComplete)
+ delete delegate;
+ else
+ pendingDeletions.append(delegate);
+}
+
+QFont QQuickLabel::font() const
+{
+ return QQuickText::font();
+}
+
+void QQuickLabel::setFont(const QFont &font)
+{
+ Q_D(QQuickLabel);
+ if (d->font.resolve() == font.resolve() && d->font == font)
+ return;
+
+ d->font = font;
+ d->resolveFont();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Label::background
+
+ This property holds the background item.
+
+ \note If the background item has no explicit size specified, it automatically
+ follows the control's size. In most cases, there is no need to specify
+ width or height for a background item.
+
+ \sa {Customizing Label}
+*/
+QQuickItem *QQuickLabel::background() const
+{
+ Q_D(const QQuickLabel);
+ return d->background;
+}
+
+void QQuickLabel::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickLabel);
+ if (d->background == background)
+ return;
+
+ d->deleteDelegate(d->background);
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ }
+ emit backgroundChanged();
+}
+
+void QQuickLabel::classBegin()
+{
+ Q_D(QQuickLabel);
+ QQuickText::classBegin();
+ d->resolveFont();
+}
+
+void QQuickLabel::componentComplete()
+{
+ Q_D(QQuickLabel);
+ QQuickText::componentComplete();
+#ifndef QT_NO_ACCESSIBILITY
+ if (!d->accessibleAttached && QAccessible::isActive())
+ d->accessibilityActiveChanged(true);
+#endif
+
+ qDeleteAll(d->pendingDeletions);
+ d->pendingDeletions.clear();
+}
+
+void QQuickLabel::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
+{
+ Q_D(QQuickLabel);
+ QQuickText::itemChange(change, value);
+ if (change == ItemParentHasChanged && value.item)
+ d->resolveFont();
+}
+
+void QQuickLabel::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickLabel);
+ QQuickText::geometryChanged(newGeometry, oldGeometry);
+ if (d->background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->background);
+ if (!p->widthValid) {
+ d->background->setWidth(newGeometry.width());
+ p->widthValid = false;
+ }
+ if (!p->heightValid) {
+ d->background->setHeight(newGeometry.height());
+ p->heightValid = false;
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicklabel_p.h b/src/quicktemplates2/qquicklabel_p.h
new file mode 100644
index 00000000..c4484d26
--- /dev/null
+++ b/src/quicktemplates2/qquicklabel_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKLABEL_P_H
+#define QQUICKLABEL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickLabelPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickLabel : public QQuickText
+{
+ Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+
+public:
+ explicit QQuickLabel(QQuickItem *parent = nullptr);
+ ~QQuickLabel();
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+Q_SIGNALS:
+ void fontChanged();
+ void backgroundChanged();
+
+protected:
+ void classBegin() override;
+ void componentComplete() override;
+
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+private:
+ Q_DISABLE_COPY(QQuickLabel)
+ Q_DECLARE_PRIVATE(QQuickLabel)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickLabel)
+
+#endif // QQUICKLABEL_P_H
diff --git a/src/quicktemplates2/qquicklabel_p_p.h b/src/quicktemplates2/qquicklabel_p_p.h
new file mode 100644
index 00000000..f5185768
--- /dev/null
+++ b/src/quicktemplates2/qquicklabel_p_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKLABEL_P_P_H
+#define QQUICKLABEL_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktext_p_p.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtGui/qaccessible.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAccessibleAttached;
+
+class QQuickLabelPrivate : public QQuickTextPrivate
+#ifndef QT_NO_ACCESSIBILITY
+ , public QAccessible::ActivationObserver
+#endif
+{
+ Q_DECLARE_PUBLIC(QQuickLabel)
+
+public:
+ QQuickLabelPrivate();
+ ~QQuickLabelPrivate();
+
+ static QQuickLabelPrivate *get(QQuickLabel *item) {
+ return static_cast<QQuickLabelPrivate *>(QObjectPrivate::get(item)); }
+
+ void resizeBackground();
+ void resolveFont();
+ void inheritFont(const QFont &f);
+
+ void _q_textChanged(const QString &text);
+
+#ifndef QT_NO_ACCESSIBILITY
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+ void deleteDelegate(QObject *object);
+
+ QFont font;
+ QQuickItem *background;
+ QQuickAccessibleAttached *accessibleAttached;
+ // This list contains the default delegates which were
+ // replaced with custom ones via declarative assignments
+ // before Component.completed() was emitted. See QTBUG-50992.
+ QVector<QObject *> pendingDeletions;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKLABEL_P_P_H
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
new file mode 100644
index 00000000..2203e574
--- /dev/null
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -0,0 +1,532 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmenu_p.h"
+#include "qquickmenu_p_p.h"
+#include "qquickmenuitem_p.h"
+
+#include <QtGui/qevent.h>
+#include <QtQml/private/qqmlobjectmodel_p.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQuick/private/qquickitemview_p.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+#include <QtQuick/private/qquickwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Menu
+ \inherits Popup
+ \instantiates QQuickMenu
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-menus
+ \ingroup qtquickcontrols2-popups
+ \brief Menu popup that can be used as a context menu or popup menu.
+
+ \image qtquickcontrols2-menu.png
+
+ Menu has two main use cases:
+ \list
+ \li Context menus; for example, a menu that is shown after right clicking
+ \li Popup menus; for example, a menu that is shown after clicking a button
+ \endlist
+
+ \code
+ Button {
+ id: fileButton
+ text: "File"
+ onClicked: menu.open()
+
+ Menu {
+ id: menu
+ y: fileButton.height
+
+ MenuItem {
+ text: "New..."
+ }
+ MenuItem {
+ text: "Open..."
+ }
+ MenuItem {
+ text: "Save"
+ }
+ }
+ }
+ \endcode
+
+ Typically, menu items are statically declared as children of the menu, but
+ Menu also provides API to \l {addItem}{add}, \l {insertItem}{insert},
+ \l {moveItem}{move} and \l {removeItem}{remove} items dynamically. The
+ items in a menu can be accessed using \l itemAt() or
+ \l {Popup::}{contentChildren}.
+
+ Although \l {MenuItem}{MenuItems} are most commonly used with Menu, it can
+ contain any type of item.
+
+ \sa {Customizing Menu}, {Menu Controls}, {Popup Controls}
+*/
+
+QQuickMenuPrivate::QQuickMenuPrivate() :
+ contentItem(nullptr),
+ contentModel(nullptr)
+{
+ Q_Q(QQuickMenu);
+ contentModel = new QQmlObjectModel(q);
+}
+
+QQuickItem *QQuickMenuPrivate::itemAt(int index) const
+{
+ return qobject_cast<QQuickItem *>(contentModel->get(index));
+}
+
+void QQuickMenuPrivate::insertItem(int index, QQuickItem *item)
+{
+ contentData.append(item);
+ item->setParentItem(contentItem);
+ if (qobject_cast<QQuickItemView *>(contentItem))
+ QQuickItemPrivate::get(item)->setCulled(true); // QTBUG-53262
+ if (complete)
+ resizeItem(item);
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
+ contentModel->insert(index, item);
+
+ QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(item);
+ if (menuItem) {
+ Q_Q(QQuickMenu);
+ QObjectPrivate::connect(menuItem, &QQuickMenuItem::pressed, this, &QQuickMenuPrivate::onItemPressed);
+ QObject::connect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPopup::close);
+ QObjectPrivate::connect(menuItem, &QQuickItem::activeFocusChanged, this, &QQuickMenuPrivate::onItemActiveFocusChanged);
+ }
+}
+
+void QQuickMenuPrivate::moveItem(int from, int to)
+{
+ contentModel->move(from, to);
+}
+
+void QQuickMenuPrivate::removeItem(int index, QQuickItem *item)
+{
+ contentData.removeOne(item);
+
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
+ item->setParentItem(nullptr);
+ contentModel->remove(index);
+
+ QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(item);
+ if (menuItem) {
+ Q_Q(QQuickMenu);
+ QObjectPrivate::disconnect(menuItem, &QQuickMenuItem::pressed, this, &QQuickMenuPrivate::onItemPressed);
+ QObject::disconnect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPopup::close);
+ QObjectPrivate::disconnect(menuItem, &QQuickItem::activeFocusChanged, this, &QQuickMenuPrivate::onItemActiveFocusChanged);
+ }
+}
+
+void QQuickMenuPrivate::resizeItem(QQuickItem *item)
+{
+ if (!item || !contentItem)
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ if (!p->widthValid) {
+ item->setWidth(contentItem->width());
+ p->widthValid = false;
+ }
+}
+
+void QQuickMenuPrivate::resizeItems()
+{
+ if (!contentModel)
+ return;
+
+ for (int i = 0; i < contentModel->count(); ++i)
+ resizeItem(itemAt(i));
+}
+
+void QQuickMenuPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
+{
+ // add dynamically reparented items (eg. by a Repeater)
+ if (!QQuickItemPrivate::get(child)->isTransparentForPositioner() && !contentData.contains(child))
+ insertItem(contentModel->count(), child);
+}
+
+void QQuickMenuPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+{
+ // remove dynamically unparented items (eg. by a Repeater)
+ if (!parent)
+ removeItem(contentModel->indexOf(item, nullptr), item);
+}
+
+void QQuickMenuPrivate::itemSiblingOrderChanged(QQuickItem *)
+{
+ // reorder the restacked items (eg. by a Repeater)
+ Q_Q(QQuickMenu);
+ QList<QQuickItem *> siblings = contentItem->childItems();
+ for (int i = 0; i < siblings.count(); ++i) {
+ QQuickItem* sibling = siblings.at(i);
+ int index = contentModel->indexOf(sibling, nullptr);
+ q->moveItem(index, i);
+ }
+}
+
+void QQuickMenuPrivate::itemDestroyed(QQuickItem *item)
+{
+ QQuickPopupPrivate::itemDestroyed(item);
+ int index = contentModel->indexOf(item, nullptr);
+ if (index != -1)
+ removeItem(index, item);
+}
+
+void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+{
+ if (complete)
+ resizeItems();
+}
+
+void QQuickMenuPrivate::onItemPressed()
+{
+ Q_Q(QQuickMenu);
+ QQuickItem *item = qobject_cast<QQuickItem*>(q->sender());
+ if (item)
+ item->forceActiveFocus();
+}
+
+void QQuickMenuPrivate::onItemActiveFocusChanged()
+{
+ Q_Q(QQuickMenu);
+ QQuickItem *item = qobject_cast<QQuickItem*>(q->sender());
+ if (!item->hasActiveFocus())
+ return;
+
+ int indexOfItem = contentModel->indexOf(item, nullptr);
+ setCurrentIndex(indexOfItem);
+}
+
+int QQuickMenuPrivate::currentIndex() const
+{
+ QVariant index = contentItem->property("currentIndex");
+ if (!index.isValid())
+ return -1;
+ return index.toInt();
+}
+
+void QQuickMenuPrivate::setCurrentIndex(int index)
+{
+ contentItem->setProperty("currentIndex", index);
+}
+
+void QQuickMenuPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
+{
+ QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
+ QQuickMenu *q = static_cast<QQuickMenu *>(prop->object);
+ QQuickItem *item = qobject_cast<QQuickItem *>(obj);
+ if (item) {
+ if (QQuickItemPrivate::get(item)->isTransparentForPositioner()) {
+ QQuickItemPrivate::get(item)->addItemChangeListener(p, QQuickItemPrivate::SiblingOrder);
+ item->setParentItem(p->contentItem);
+ } else if (p->contentModel->indexOf(item, nullptr) == -1) {
+ q->addItem(item);
+ }
+ } else {
+ p->contentData.append(obj);
+ }
+}
+
+int QQuickMenuPrivate::contentData_count(QQmlListProperty<QObject> *prop)
+{
+ QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
+ return p->contentData.count();
+}
+
+QObject *QQuickMenuPrivate::contentData_at(QQmlListProperty<QObject> *prop, int index)
+{
+ QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
+ return p->contentData.value(index);
+}
+
+void QQuickMenuPrivate::contentData_clear(QQmlListProperty<QObject> *prop)
+{
+ QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
+ p->contentData.clear();
+}
+
+QQuickMenu::QQuickMenu(QObject *parent) :
+ QQuickPopup(*(new QQuickMenuPrivate), parent)
+{
+ setFocus(true);
+ setClosePolicy(CloseOnEscape | CloseOnPressOutside | CloseOnReleaseOutside);
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::Menu::itemAt(int index)
+
+ Returns the item at \a index, or \c null if it does not exist.
+*/
+QQuickItem *QQuickMenu::itemAt(int index) const
+{
+ Q_D(const QQuickMenu);
+ return d->itemAt(index);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Menu::addItem(Item item)
+
+ Adds \a item to the end of the list of items.
+*/
+void QQuickMenu::addItem(QQuickItem *item)
+{
+ Q_D(QQuickMenu);
+ insertItem(d->contentModel->count(), item);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Menu::insertItem(int index, Item item)
+
+ Inserts \a item at \a index.
+*/
+void QQuickMenu::insertItem(int index, QQuickItem *item)
+{
+ Q_D(QQuickMenu);
+ if (!item)
+ return;
+ const int count = d->contentModel->count();
+ if (index < 0 || index > count)
+ index = count;
+
+ int oldIndex = d->contentModel->indexOf(item, nullptr);
+ if (oldIndex != -1) {
+ if (oldIndex < index)
+ --index;
+ if (oldIndex != index)
+ d->moveItem(oldIndex, index);
+ } else {
+ d->insertItem(index, item);
+ }
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Menu::moveItem(int from, int to)
+
+ Moves an item \a from one index \a to another.
+*/
+void QQuickMenu::moveItem(int from, int to)
+{
+ Q_D(QQuickMenu);
+ const int count = d->contentModel->count();
+ if (from < 0 || from > count - 1)
+ return;
+ if (to < 0 || to > count - 1)
+ to = count - 1;
+
+ if (from != to)
+ d->moveItem(from, to);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Menu::removeItem(int index)
+
+ Removes the item at \a index.
+
+ \note The ownership of the item is transferred to the caller.
+*/
+void QQuickMenu::removeItem(int index)
+{
+ Q_D(QQuickMenu);
+ const int count = d->contentModel->count();
+ if (index < 0 || index >= count)
+ return;
+
+ QQuickItem *item = itemAt(index);
+ if (item)
+ d->removeItem(index, item);
+}
+
+/*!
+ \qmlproperty model QtQuick.Controls::Menu::contentModel
+ \readonly
+
+ This property holds the model used to display menu items.
+
+ The content model is provided for visualization purposes. It can be assigned
+ as a model to a content item that presents the contents of the menu.
+
+ \code
+ Menu {
+ id: menu
+ contentItem: ListView {
+ model: menu.contentModel
+ }
+ }
+ \endcode
+
+ The model allows menu items to be statically declared as children of the
+ menu.
+*/
+QVariant QQuickMenu::contentModel() const
+{
+ Q_D(const QQuickMenu);
+ return QVariant::fromValue(d->contentModel);
+}
+
+/*!
+ \qmlproperty list<Object> QtQuick.Controls::Menu::contentData
+ \default
+
+ This property holds the list of content data.
+
+ The list contains all objects that have been declared in QML as children
+ of the menu, and also items that have been dynamically added or
+ inserted using the \l addItem() and \l insertItem() methods, respectively.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects. It is not re-ordered when items are inserted or moved.
+
+ \sa Item::data, {Popup::}{contentChildren}
+*/
+QQmlListProperty<QObject> QQuickMenu::contentData()
+{
+ Q_D(QQuickMenu);
+ return QQmlListProperty<QObject>(this, d,
+ QQuickMenuPrivate::contentData_append,
+ QQuickMenuPrivate::contentData_count,
+ QQuickMenuPrivate::contentData_at,
+ QQuickMenuPrivate::contentData_clear);
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::Menu::title
+
+ This property holds the title for the menu.
+
+ The title of a menu is often displayed in the text of a menu item when the
+ menu is a submenu, and in the text of a tool button when it is in a
+ menubar.
+*/
+QString QQuickMenu::title() const
+{
+ Q_D(const QQuickMenu);
+ return d->title;
+}
+
+void QQuickMenu::setTitle(QString &title)
+{
+ Q_D(QQuickMenu);
+ if (title == d->title)
+ return;
+ d->title = title;
+ emit titleChanged();
+}
+
+void QQuickMenu::componentComplete()
+{
+ Q_D(QQuickMenu);
+ QQuickPopup::componentComplete();
+ d->resizeItems();
+}
+
+void QQuickMenu::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_D(QQuickMenu);
+ Q_UNUSED(oldItem);
+ QQuickPopup::contentItemChange(newItem, oldItem);
+ d->contentItem = newItem;
+}
+
+void QQuickMenu::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
+{
+ Q_D(QQuickMenu);
+ QQuickPopup::itemChange(change, data);
+
+ if (change == QQuickItem::ItemVisibleHasChanged) {
+ if (!data.boolValue) {
+ // Ensure that when the menu isn't visible, there's no current item
+ // the next time it's opened.
+ QQuickItem *focusItem = QQuickItemPrivate::get(d->contentItem)->subFocusItem;
+ if (focusItem) {
+ QQuickWindow *window = QQuickPopup::window();
+ if (window)
+ QQuickWindowPrivate::get(window)->clearFocusInScope(d->contentItem, focusItem, Qt::OtherFocusReason);
+ }
+ d->setCurrentIndex(-1);
+ }
+ }
+}
+
+void QQuickMenu::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickMenu);
+ QQuickPopup::keyReleaseEvent(event);
+ if (d->contentModel->count() == 0)
+ return;
+
+ // QTBUG-17051
+ // Work around the fact that ListView has no way of distinguishing between
+ // mouse and keyboard interaction, thanks to the "interactive" bool in Flickable.
+ // What we actually want is to have a way to always allow keyboard interaction but
+ // only allow flicking with the mouse when there are too many menu items to be
+ // shown at once.
+ switch (event->key()) {
+ case Qt::Key_Up:
+ if (d->contentItem->metaObject()->indexOfMethod("decrementCurrentIndex()") != -1)
+ QMetaObject::invokeMethod(d->contentItem, "decrementCurrentIndex");
+ break;
+
+ case Qt::Key_Down:
+ if (d->contentItem->metaObject()->indexOfMethod("incrementCurrentIndex()") != -1)
+ QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex");
+ break;
+
+ default:
+ break;
+ }
+
+ int index = d->currentIndex();
+ QQuickItem *item = itemAt(index);
+ if (item)
+ item->forceActiveFocus();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickMenu::accessibleRole() const
+{
+ return QAccessible::PopupMenu;
+}
+#endif // QT_NO_ACCESSIBILITY
+
+QT_END_NAMESPACE
+
+#include "moc_qquickmenu_p.cpp"
diff --git a/src/quicktemplates2/qquickmenu_p.h b/src/quicktemplates2/qquickmenu_p.h
new file mode 100644
index 00000000..3a815b41
--- /dev/null
+++ b/src/quicktemplates2/qquickmenu_p.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMENU_P_H
+#define QQUICKMENU_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQml/qqmllist.h>
+#include <QtQml/qqml.h>
+
+#include "qquickpopup_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMenuItem;
+class QQuickMenuPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenu : public QQuickPopup
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
+ Q_CLASSINFO("DefaultProperty", "contentData")
+
+public:
+ explicit QQuickMenu(QObject *parent = nullptr);
+
+ Q_INVOKABLE QQuickItem *itemAt(int index) const;
+ Q_INVOKABLE void addItem(QQuickItem *item);
+ Q_INVOKABLE void insertItem(int index, QQuickItem *item);
+ Q_INVOKABLE void moveItem(int from, int to);
+ Q_INVOKABLE void removeItem(int index);
+
+ QVariant contentModel() const;
+ QQmlListProperty<QObject> contentData();
+
+ QString title() const;
+ void setTitle(QString &title);
+
+protected:
+ void componentComplete() override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
+ void keyReleaseEvent(QKeyEvent *event) override;
+
+Q_SIGNALS:
+ void titleChanged();
+
+protected:
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif // QT_NO_ACCESSIBILITY
+
+private:
+ Q_DISABLE_COPY(QQuickMenu)
+ Q_DECLARE_PRIVATE(QQuickMenu)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickMenu)
+
+#endif // QQUICKMENU_P_H
diff --git a/src/quicktemplates2/qquickmenu_p_p.h b/src/quicktemplates2/qquickmenu_p_p.h
new file mode 100644
index 00000000..c27e6631
--- /dev/null
+++ b/src/quicktemplates2/qquickmenu_p_p.h
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMENU_P_P_H
+#define QQUICKMENU_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qvector.h>
+#include <QtCore/qpointer.h>
+
+#include <QtQuickTemplates2/private/qquickpopup_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlObjectModel;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuPrivate : public QQuickPopupPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickMenu)
+
+public:
+ QQuickMenuPrivate();
+
+ QQuickItem *itemAt(int index) const;
+ void insertItem(int index, QQuickItem *item);
+ void moveItem(int from, int to);
+ void removeItem(int index, QQuickItem *item);
+
+ void resizeItem(QQuickItem *item);
+ void resizeItems();
+
+ 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();
+
+ int currentIndex() const;
+ void setCurrentIndex(int index);
+
+ static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
+ static int contentData_count(QQmlListProperty<QObject> *prop);
+ static QObject *contentData_at(QQmlListProperty<QObject> *prop, int index);
+ static void contentData_clear(QQmlListProperty<QObject> *prop);
+
+ QQuickItem *contentItem; // TODO: cleanup
+ QVector<QObject *> contentData;
+ QQmlObjectModel *contentModel;
+ QString title;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKMENU_P_P_H
+
diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
new file mode 100644
index 00000000..564d3f38
--- /dev/null
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickmenuitem_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuItem
+ \inherits AbstractButton
+ \instantiates QQuickMenuItem
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-menus
+ \brief Presents an item within a Menu.
+
+ MenuItem is a convenience type that implements the AbstractButton API,
+ providing a familiar way to respond to menu items being \l triggered, for
+ example.
+
+ \code
+ Button {
+ id: fileButton
+ text: "File"
+ onClicked: menu.open()
+
+ Menu {
+ id: menu
+
+ MenuItem {
+ text: "New..."
+ onTriggered: document.reset()
+ }
+ MenuItem {
+ text: "Open..."
+ onTriggered: openDialog.open()
+ }
+ MenuItem {
+ text: "Save"
+ onTriggered: saveDialog.open()
+ }
+ }
+ }
+ \endcode
+
+ \sa {Customizing MenuItem}, {Menu Controls}
+*/
+
+class QQuickMenuItemPrivate : public QQuickAbstractButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickMenuItem)
+
+public:
+ QQuickMenuItemPrivate();
+
+ bool highlighted;
+};
+
+QQuickMenuItemPrivate::QQuickMenuItemPrivate() :
+ highlighted(false)
+{
+}
+
+/*!
+ \qmlsignal void QtQuick.Controls::MenuItem::triggered()
+
+ This signal is emitted when the menu item is triggered by the user.
+*/
+
+QQuickMenuItem::QQuickMenuItem(QQuickItem *parent) :
+ QQuickAbstractButton(*(new QQuickMenuItemPrivate), parent)
+{
+ connect(this, &QQuickAbstractButton::clicked, this, &QQuickMenuItem::triggered);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::MenuItem::checkable
+
+ This property holds whether the menu item is checkable.
+
+ A checkable menu item toggles between checked (on) and unchecked (off) when
+ the user clicks on it or interacts with it via the keyboard.
+
+ \sa {AbstractButton::}{checked}
+*/
+
+void QQuickMenuItem::checkableChange()
+{
+ emit checkableChanged();
+}
+
+QFont QQuickMenuItem::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::MenuItemFont);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::MenuItem::highlighted
+
+ This property holds whether the menu item is highlighted.
+
+ A menu item can be highlighted in order to draw the user's attention
+ towards it. It has no effect on keyboard interaction.
+
+ The default value is \c false.
+*/
+bool QQuickMenuItem::isHighlighted() const
+{
+ Q_D(const QQuickMenuItem);
+ return d->highlighted;
+}
+
+void QQuickMenuItem::setHighlighted(bool highlighted)
+{
+ Q_D(QQuickMenuItem);
+ if (highlighted == d->highlighted)
+ return;
+
+ d->highlighted = highlighted;
+ emit highlightedChanged();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickMenuItem::accessibleRole() const
+{
+ return QAccessible::MenuItem;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickmenuitem_p.h b/src/quicktemplates2/qquickmenuitem_p.h
new file mode 100644
index 00000000..6c717e13
--- /dev/null
+++ b/src/quicktemplates2/qquickmenuitem_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKMENUITEM_P_H
+#define QQUICKMENUITEM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickMenuItemPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuItem : public QQuickAbstractButton
+{
+ Q_OBJECT
+ Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
+ Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
+
+public:
+ explicit QQuickMenuItem(QQuickItem *parent = nullptr);
+
+ bool isHighlighted() const;
+ void setHighlighted(bool highlighted);
+
+Q_SIGNALS:
+ void checkableChanged();
+ void triggered();
+ void highlightedChanged();
+
+protected:
+ void checkableChange() override;
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickMenuItem)
+ Q_DECLARE_PRIVATE(QQuickMenuItem)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickMenuItem)
+
+#endif // QQUICKMENUITEM_P_H
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
new file mode 100644
index 00000000..4a95244f
--- /dev/null
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -0,0 +1,433 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickoverlay_p.h"
+#include "qquickoverlay_p_p.h"
+#include "qquickpopup_p_p.h"
+#include "qquickdrawer_p_p.h"
+#include "qquickapplicationwindow_p.h"
+#include <QtQml/qqmlinfo.h>
+#include <QtQml/qqmlproperty.h>
+#include <QtQml/qqmlcomponent.h>
+#include <algorithm>
+
+QT_BEGIN_NAMESPACE
+
+void QQuickOverlayPrivate::popupAboutToShow()
+{
+ Q_Q(QQuickOverlay);
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
+ if (!popup || !popup->dim())
+ return;
+
+ // use QQmlProperty instead of QQuickItem::setOpacity() to trigger QML Behaviors
+ QQuickPopupPrivate *p = QQuickPopupPrivate::get(popup);
+ if (p->dimmer)
+ QQmlProperty::write(p->dimmer, QStringLiteral("opacity"), 1.0);
+}
+
+void QQuickOverlayPrivate::popupAboutToHide()
+{
+ Q_Q(QQuickOverlay);
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
+ if (!popup || !popup->dim())
+ return;
+
+ // use QQmlProperty instead of QQuickItem::setOpacity() to trigger QML Behaviors
+ QQuickPopupPrivate *p = QQuickPopupPrivate::get(popup);
+ if (p->dimmer)
+ QQmlProperty::write(p->dimmer, QStringLiteral("opacity"), 0.0);
+}
+
+static QQuickItem *createDimmer(QQmlComponent *component, QQuickPopup *popup, QQuickItem *parent)
+{
+ QQuickItem *item = nullptr;
+ if (component) {
+ QQmlContext *creationContext = component->creationContext();
+ if (!creationContext)
+ creationContext = qmlContext(parent);
+ QQmlContext *context = new QQmlContext(creationContext);
+ context->setContextObject(popup);
+ item = qobject_cast<QQuickItem*>(component->beginCreate(context));
+ }
+
+ // when there is no overlay component available (with plain QQuickWindow),
+ // use a plain QQuickItem as a fallback to block hover events
+ if (!item && popup->isModal())
+ item = new QQuickItem;
+
+ if (item) {
+ item->setOpacity(popup->isVisible() ? 1.0 : 0.0);
+ item->setParentItem(parent);
+ item->stackBefore(popup->popupItem());
+ item->setZ(popup->z());
+ if (popup->isModal()) {
+ item->setAcceptedMouseButtons(Qt::AllButtons);
+ // TODO: switch to QStyleHints::useHoverEffects in Qt 5.8
+ item->setAcceptHoverEvents(true);
+ // item->setAcceptHoverEvents(QGuiApplication::styleHints()->useHoverEffects());
+ // connect(QGuiApplication::styleHints(), &QStyleHints::useHoverEffectsChanged, item, &QQuickItem::setAcceptHoverEvents);
+ }
+ if (component)
+ component->completeCreate();
+ }
+ return item;
+}
+
+void QQuickOverlayPrivate::createOverlay(QQuickPopup *popup)
+{
+ Q_Q(QQuickOverlay);
+ QQuickPopupPrivate *p = QQuickPopupPrivate::get(popup);
+ if (!p->dimmer)
+ p->dimmer = createDimmer(popup->isModal() ? modal : modeless, popup, q);
+ p->resizeOverlay();
+}
+
+void QQuickOverlayPrivate::destroyOverlay(QQuickPopup *popup)
+{
+ QQuickPopupPrivate *p = QQuickPopupPrivate::get(popup);
+ if (p->dimmer) {
+ p->dimmer->setParentItem(nullptr);
+ p->dimmer->deleteLater();
+ p->dimmer = nullptr;
+ }
+}
+
+void QQuickOverlayPrivate::toggleOverlay()
+{
+ Q_Q(QQuickOverlay);
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
+ if (!popup)
+ return;
+
+ destroyOverlay(popup);
+ if (popup->dim())
+ createOverlay(popup);
+}
+
+QVector<QQuickPopup *> QQuickOverlayPrivate::stackingOrderPopups() const
+{
+ const QList<QQuickItem *> children = paintOrderChildItems();
+
+ QVector<QQuickPopup *> popups;
+ popups.reserve(children.count());
+
+ for (auto it = children.crbegin(), end = children.crend(); it != end; ++it) {
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>((*it)->parent());
+ if (popup)
+ popups += popup;
+ }
+
+ return popups;
+}
+
+QVector<QQuickDrawer *> QQuickOverlayPrivate::stackingOrderDrawers() const
+{
+ QVector<QQuickDrawer *> sorted(allDrawers);
+ std::sort(sorted.begin(), sorted.end(), [](const QQuickDrawer *one, const QQuickDrawer *another) {
+ return one->z() > another->z();
+ });
+ return sorted;
+}
+
+void QQuickOverlayPrivate::itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &)
+{
+ Q_Q(QQuickOverlay);
+ q->setSize(newGeometry.size());
+}
+
+QQuickOverlayPrivate::QQuickOverlayPrivate() :
+ modal(nullptr),
+ modeless(nullptr)
+{
+}
+
+void QQuickOverlayPrivate::addPopup(QQuickPopup *popup)
+{
+ Q_Q(QQuickOverlay);
+ allPopups += popup;
+ if (QQuickDrawer *drawer = qobject_cast<QQuickDrawer *>(popup)) {
+ allDrawers += drawer;
+ q->setVisible(!allDrawers.isEmpty() || !q->childItems().isEmpty());
+ }
+}
+
+void QQuickOverlayPrivate::removePopup(QQuickPopup *popup)
+{
+ Q_Q(QQuickOverlay);
+ allPopups.removeOne(popup);
+ if (allDrawers.removeOne(static_cast<QQuickDrawer *>(popup)))
+ q->setVisible(!allDrawers.isEmpty() || !q->childItems().isEmpty());
+}
+
+void QQuickOverlayPrivate::setMouseGrabberPopup(QQuickPopup *popup)
+{
+ if (popup && !popup->isVisible())
+ popup = nullptr;
+ mouseGrabberPopup = popup;
+}
+
+QQuickOverlay::QQuickOverlay(QQuickItem *parent)
+ : QQuickItem(*(new QQuickOverlayPrivate), parent)
+{
+ Q_D(QQuickOverlay);
+ setZ(1000001); // DefaultWindowDecoration+1
+ setAcceptedMouseButtons(Qt::AllButtons);
+ setFiltersChildMouseEvents(true);
+ setVisible(false);
+
+ if (parent) {
+ setSize(QSizeF(parent->width(), parent->height()));
+ QQuickItemPrivate::get(parent)->addItemChangeListener(d, QQuickItemPrivate::Geometry);
+ }
+}
+
+QQuickOverlay::~QQuickOverlay()
+{
+ Q_D(QQuickOverlay);
+ if (QQuickItem *parent = parentItem())
+ QQuickItemPrivate::get(parent)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+}
+
+QQmlComponent *QQuickOverlay::modal() const
+{
+ Q_D(const QQuickOverlay);
+ return d->modal;
+}
+
+void QQuickOverlay::setModal(QQmlComponent *modal)
+{
+ Q_D(QQuickOverlay);
+ if (d->modal == modal)
+ return;
+
+ delete d->modal;
+ d->modal = modal;
+ emit modalChanged();
+}
+
+QQmlComponent *QQuickOverlay::modeless() const
+{
+ Q_D(const QQuickOverlay);
+ return d->modeless;
+}
+
+void QQuickOverlay::setModeless(QQmlComponent *modeless)
+{
+ Q_D(QQuickOverlay);
+ if (d->modeless == modeless)
+ return;
+
+ delete d->modeless;
+ d->modeless = modeless;
+ emit modelessChanged();
+}
+
+QQuickOverlay *QQuickOverlay::overlay(QQuickWindow *window)
+{
+ if (!window)
+ return nullptr;
+
+ QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow *>(window);
+ if (applicationWindow)
+ return applicationWindow->overlay();
+
+ const char *name = "_q_QQuickOverlay";
+ QQuickOverlay *overlay = window->property(name).value<QQuickOverlay *>();
+ if (!overlay) {
+ QQuickItem *content = window->contentItem();
+ // Do not re-create the overlay if the window is being destroyed
+ // and thus, its content item no longer has a window associated.
+ if (content->window()) {
+ overlay = new QQuickOverlay(window->contentItem());
+ window->setProperty(name, QVariant::fromValue(overlay));
+ }
+ }
+ return overlay;
+}
+
+void QQuickOverlay::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ Q_D(QQuickOverlay);
+ QQuickItem::itemChange(change, data);
+
+ QQuickPopup *popup = nullptr;
+ if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
+ popup = qobject_cast<QQuickPopup *>(data.item->parent());
+ setVisible(!d->allDrawers.isEmpty() || !childItems().isEmpty());
+ }
+ if (!popup)
+ return;
+
+ if (change == ItemChildAddedChange) {
+ if (popup->dim())
+ d->createOverlay(popup);
+ QObjectPrivate::connect(popup, &QQuickPopup::dimChanged, d, &QQuickOverlayPrivate::toggleOverlay);
+ QObjectPrivate::connect(popup, &QQuickPopup::modalChanged, d, &QQuickOverlayPrivate::toggleOverlay);
+ if (!qobject_cast<QQuickDrawer *>(popup)) {
+ QObjectPrivate::connect(popup, &QQuickPopup::aboutToShow, d, &QQuickOverlayPrivate::popupAboutToShow);
+ QObjectPrivate::connect(popup, &QQuickPopup::aboutToHide, d, &QQuickOverlayPrivate::popupAboutToHide);
+ }
+ } else if (change == ItemChildRemovedChange) {
+ d->destroyOverlay(popup);
+ QObjectPrivate::disconnect(popup, &QQuickPopup::dimChanged, d, &QQuickOverlayPrivate::toggleOverlay);
+ QObjectPrivate::disconnect(popup, &QQuickPopup::modalChanged, d, &QQuickOverlayPrivate::toggleOverlay);
+ if (!qobject_cast<QQuickDrawer *>(popup)) {
+ QObjectPrivate::disconnect(popup, &QQuickPopup::aboutToShow, d, &QQuickOverlayPrivate::popupAboutToShow);
+ QObjectPrivate::disconnect(popup, &QQuickPopup::aboutToHide, d, &QQuickOverlayPrivate::popupAboutToHide);
+ }
+ }
+}
+
+void QQuickOverlay::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickOverlay);
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+ for (QQuickPopup *popup : qAsConst(d->allPopups))
+ QQuickPopupPrivate::get(popup)->resizeOverlay();
+}
+
+void QQuickOverlay::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickOverlay);
+ emit pressed();
+
+ if (!d->allDrawers.isEmpty()) {
+ // the overlay background was pressed, so there are no modal popups open.
+ // test if the press point lands on any drawer's drag margin
+
+ const QVector<QQuickDrawer *> drawers = d->stackingOrderDrawers();
+ for (QQuickDrawer *drawer : drawers) {
+ QQuickDrawerPrivate *p = QQuickDrawerPrivate::get(drawer);
+ if (p->startDrag(window(), event)) {
+ d->setMouseGrabberPopup(drawer);
+ return;
+ }
+ }
+ }
+
+ if (!d->mouseGrabberPopup) {
+ const auto popups = d->stackingOrderPopups();
+ for (QQuickPopup *popup : popups) {
+ if (popup->overlayEvent(this, event)) {
+ d->setMouseGrabberPopup(popup);
+ return;
+ }
+ }
+ }
+
+ event->ignore();
+}
+
+void QQuickOverlay::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickOverlay);
+ if (d->mouseGrabberPopup)
+ d->mouseGrabberPopup->overlayEvent(this, event);
+}
+
+void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickOverlay);
+ emit released();
+
+ if (d->mouseGrabberPopup) {
+ d->mouseGrabberPopup->overlayEvent(this, event);
+ d->setMouseGrabberPopup(nullptr);
+ } else {
+ const auto popups = d->stackingOrderPopups();
+ for (QQuickPopup *popup : popups) {
+ if (popup->overlayEvent(this, event))
+ break;
+ }
+ }
+}
+
+void QQuickOverlay::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickOverlay);
+ if (d->mouseGrabberPopup) {
+ d->mouseGrabberPopup->overlayEvent(this, event);
+ return;
+ } else {
+ const auto popups = d->stackingOrderPopups();
+ for (QQuickPopup *popup : popups) {
+ if (popup->overlayEvent(this, event))
+ return;
+ }
+ }
+ event->ignore();
+}
+
+bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event)
+{
+ Q_D(QQuickOverlay);
+ const auto popups = d->stackingOrderPopups();
+ for (QQuickPopup *popup : popups) {
+ QQuickPopupPrivate *p = QQuickPopupPrivate::get(popup);
+
+ // Stop filtering overlay events when reaching a popup item or an item
+ // that is inside the popup. Let the popup content handle its events.
+ if (item == p->popupItem || p->popupItem->isAncestorOf(item))
+ break;
+
+ // Let the popup try closing itself when pressing or releasing over its
+ // background dimming OR over another popup underneath, in case the popup
+ // does not have background dimming.
+ if (item == p->dimmer || !p->popupItem->isAncestorOf(item)) {
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ emit pressed();
+ if (popup->overlayEvent(item, event)) {
+ d->setMouseGrabberPopup(popup);
+ return true;
+ }
+ break;
+ case QEvent::MouseMove:
+ return popup->overlayEvent(item, event);
+ case QEvent::MouseButtonRelease:
+ emit released();
+ d->setMouseGrabberPopup(nullptr);
+ return popup->overlayEvent(item, event);
+ default:
+ break;
+ }
+ }
+ }
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickoverlay_p.h b/src/quicktemplates2/qquickoverlay_p.h
new file mode 100644
index 00000000..af16900f
--- /dev/null
+++ b/src/quicktemplates2/qquickoverlay_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKOVERLAY_P_H
+#define QQUICKOVERLAY_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlComponent;
+class QQuickOverlayPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickOverlay : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QQmlComponent *modal READ modal WRITE setModal NOTIFY modalChanged FINAL)
+ Q_PROPERTY(QQmlComponent *modeless READ modeless WRITE setModeless NOTIFY modelessChanged FINAL)
+
+public:
+ explicit QQuickOverlay(QQuickItem *parent = nullptr);
+ ~QQuickOverlay();
+
+ QQmlComponent *modal() const;
+ void setModal(QQmlComponent *modal);
+
+ QQmlComponent *modeless() const;
+ void setModeless(QQmlComponent *modeless);
+
+ static QQuickOverlay *overlay(QQuickWindow *window);
+
+Q_SIGNALS:
+ void modalChanged();
+ void modelessChanged();
+ void pressed();
+ void released();
+
+protected:
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void geometryChanged(const QRectF &oldGeometry, const QRectF &newGeometry) 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)
+ Q_DECLARE_PRIVATE(QQuickOverlay)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickOverlay)
+
+#endif // QQUICKOVERLAY_P_H
diff --git a/src/quicktemplates2/qquickoverlay_p_p.h b/src/quicktemplates2/qquickoverlay_p_p.h
new file mode 100644
index 00000000..6e72b39a
--- /dev/null
+++ b/src/quicktemplates2/qquickoverlay_p_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKOVERLAY_P_P_H
+#define QQUICKOVERLAY_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickoverlay_p.h"
+
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPopup;
+class QQuickDrawer;
+
+class QQuickOverlayPrivate : public QQuickItemPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickOverlay)
+
+public:
+ QQuickOverlayPrivate();
+
+ static QQuickOverlayPrivate *get(QQuickOverlay *overlay)
+ {
+ return overlay->d_func();
+ }
+
+ void addPopup(QQuickPopup *popup);
+ void removePopup(QQuickPopup *popup);
+ void setMouseGrabberPopup(QQuickPopup *popup);
+
+ void popupAboutToShow();
+ void popupAboutToHide();
+
+ void createOverlay(QQuickPopup *popup);
+ void destroyOverlay(QQuickPopup *popup);
+ void toggleOverlay();
+
+ QVector<QQuickPopup *> stackingOrderPopups() const;
+ QVector<QQuickDrawer *> stackingOrderDrawers() const;
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+ QQmlComponent *modal;
+ QQmlComponent *modeless;
+ QVector<QQuickPopup *> allPopups;
+ QVector<QQuickDrawer *> allDrawers;
+ QPointer<QQuickPopup> mouseGrabberPopup;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKOVERLAY_P_P_H
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp
new file mode 100644
index 00000000..c71ecd42
--- /dev/null
+++ b/src/quicktemplates2/qquickpage.cpp
@@ -0,0 +1,397 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpage_p.h"
+#include "qquickcontrol_p_p.h"
+#include "qquicktoolbar_p.h"
+#include "qquicktabbar_p.h"
+
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Page
+ \inherits Control
+ \instantiates QQuickPage
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \brief Styled page control with support for a header and footer.
+
+ Page is a container control which makes it convenient to add
+ a \l header and \l footer item to a page.
+
+ \image qtquickcontrols2-page-wireframe.png
+
+ The following example snippet illustrates how to use a page-specific
+ toolbar header and an application-wide tabbar footer.
+
+ \qml
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ visible: true
+
+ StackView {
+ anchors.fill: parent
+
+ initialItem: Page {
+ header: ToolBar {
+ // ...
+ }
+ }
+ }
+
+ footer: TabBar {
+ // ...
+ }
+ }
+ \endqml
+
+ \sa ApplicationWindow, {Container Controls}
+*/
+
+class QQuickPagePrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickPage)
+
+public:
+ QQuickPagePrivate();
+
+ void relayout();
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect) override;
+ void itemVisibilityChanged(QQuickItem *item) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
+ QString title;
+ QQuickItem *header;
+ QQuickItem *footer;
+};
+
+QQuickPagePrivate::QQuickPagePrivate() : header(nullptr), footer(nullptr)
+{
+}
+
+void QQuickPagePrivate::relayout()
+{
+ Q_Q(QQuickPage);
+ QQuickItem *content = q->contentItem();
+ const qreal hh = header && header->isVisible() ? header->height() : 0;
+ const qreal fh = footer && footer->isVisible() ? footer->height() : 0;
+
+ content->setY(hh + q->topPadding());
+ content->setX(q->leftPadding());
+ content->setWidth(q->availableWidth());
+ content->setHeight(q->availableHeight() - hh - fh);
+
+ if (header)
+ header->setWidth(q->width());
+
+ if (footer) {
+ footer->setY(q->height() - fh);
+ footer->setWidth(q->width());
+ }
+}
+
+void QQuickPagePrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect)
+{
+ Q_UNUSED(item)
+ Q_UNUSED(newRect)
+ Q_UNUSED(oldRect)
+ relayout();
+}
+
+void QQuickPagePrivate::itemVisibilityChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+void QQuickPagePrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+void QQuickPagePrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ relayout();
+}
+
+QQuickPage::QQuickPage(QQuickItem *parent) :
+ QQuickControl(*(new QQuickPagePrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::AllButtons);
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::Page::title
+
+ This property holds the page title.
+
+ The title is often displayed at the top of a page to give
+ the user context about the page they are viewing.
+
+ \code
+ ApplicationWindow {
+ visible: true
+ width: 400
+ height: 400
+
+ header: Label {
+ text: view.currentItem.title
+ horizontalAlignment: Text.AlignHCenter
+ }
+
+ SwipeView {
+ id: view
+ anchors.fill: parent
+
+ Page {
+ title: qsTr("Home")
+ }
+ Page {
+ title: qsTr("Discover")
+ }
+ Page {
+ title: qsTr("Activity")
+ }
+ }
+ }
+ \endcode
+*/
+
+QString QQuickPage::title() const
+{
+ return d_func()->title;
+}
+
+void QQuickPage::setTitle(const QString &title)
+{
+ Q_D(QQuickPage);
+ if (d->title == title)
+ return;
+
+ d->title = title;
+ setAccessibleName(title);
+ emit titleChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Page::header
+
+ 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
+{
+ Q_D(const QQuickPage);
+ return d->header;
+}
+
+void QQuickPage::setHeader(QQuickItem *header)
+{
+ Q_D(QQuickPage);
+ if (d->header == header)
+ return;
+
+ if (d->header) {
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
+ 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::Geometry | QQuickItemPrivate::Visibility |
+ 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();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Page::footer
+
+ 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
+{
+ Q_D(const QQuickPage);
+ return d->footer;
+}
+
+void QQuickPage::setFooter(QQuickItem *footer)
+{
+ Q_D(QQuickPage);
+ if (d->footer == footer)
+ return;
+
+ if (d->footer) {
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility |
+ 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::Geometry | QQuickItemPrivate::Visibility |
+ 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();
+}
+
+/*!
+ \qmlproperty list<Object> QtQuick.Controls::Page::contentData
+ \default
+
+ This property holds the list of content data.
+
+ The list contains all objects that have been declared in QML as children
+ of the container.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects.
+
+ \sa Item::data, contentChildren
+*/
+QQmlListProperty<QObject> QQuickPage::contentData()
+{
+ Q_D(QQuickPage);
+ return QQmlListProperty<QObject>(d->contentItem, nullptr,
+ QQuickItemPrivate::data_append,
+ QQuickItemPrivate::data_count,
+ QQuickItemPrivate::data_at,
+ QQuickItemPrivate::data_clear);
+}
+
+/*!
+ \qmlproperty list<Item> QtQuick.Controls::Page::contentChildren
+
+ This property holds the list of content children.
+
+ The list contains all items that have been declared in QML as children
+ of the page.
+
+ \note Unlike \c contentData, \c contentChildren does not include non-visual
+ QML objects.
+
+ \sa Item::children, contentData
+*/
+QQmlListProperty<QQuickItem> QQuickPage::contentChildren()
+{
+ Q_D(QQuickPage);
+ return QQmlListProperty<QQuickItem>(d->contentItem, nullptr,
+ QQuickItemPrivate::children_append,
+ QQuickItemPrivate::children_count,
+ QQuickItemPrivate::children_at,
+ QQuickItemPrivate::children_clear);
+}
+
+void QQuickPage::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ QQuickControl::contentItemChange(newItem, oldItem);
+ if (oldItem)
+ disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged);
+ if (newItem)
+ connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged);
+ emit contentChildrenChanged();
+}
+
+void QQuickPage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickPage);
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+ d->relayout();
+}
+
+void QQuickPage::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
+{
+ Q_D(QQuickPage);
+ QQuickControl::paddingChange(newPadding, oldPadding);
+ d->relayout();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPage::accessibleRole() const
+{
+ return QAccessible::PageTab;
+}
+
+void QQuickPage::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickPage);
+ QQuickControl::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->title);
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h
new file mode 100644
index 00000000..64f7602f
--- /dev/null
+++ b/src/quicktemplates2/qquickpage_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPAGE_P_H
+#define QQUICKPAGE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQml/qqmllist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPagePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPage : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
+ Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "contentData")
+
+public:
+ explicit QQuickPage(QQuickItem *parent = nullptr);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QQuickItem *header() const;
+ void setHeader(QQuickItem *header);
+
+ QQuickItem *footer() const;
+ void setFooter(QQuickItem *footer);
+
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
+Q_SIGNALS:
+ void titleChanged();
+ void headerChanged();
+ void footerChanged();
+ void contentChildrenChanged();
+
+protected:
+ 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 override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickPage)
+ Q_DECLARE_PRIVATE(QQuickPage)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPage)
+
+#endif // QQUICKPAGE_P_H
diff --git a/src/quicktemplates2/qquickpageindicator.cpp b/src/quicktemplates2/qquickpageindicator.cpp
new file mode 100644
index 00000000..0c1ed616
--- /dev/null
+++ b/src/quicktemplates2/qquickpageindicator.cpp
@@ -0,0 +1,330 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpageindicator_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtCore/qmath.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype PageIndicator
+ \inherits Control
+ \instantiates QQuickPageIndicator
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-indicators
+ \brief Indicates the currently active page.
+
+ PageIndicator is used to indicate the currently active page
+ in a container of multiple pages. PageIndicator consists of
+ delegate items that present pages.
+
+ \image qtquickcontrols2-pageindicator.png
+
+ \code
+ Column {
+ StackLayout {
+ id: stackLayout
+
+ Page {
+ // ...
+ }
+ Page {
+ // ...
+ }
+ Page {
+ // ...
+ }
+ }
+
+ PageIndicator {
+ currentIndex: stackLayout.currentIndex
+ count: stackLayout.count
+ }
+ }
+ \endcode
+
+ \sa SwipeView, {Customizing PageIndicator}, {Indicator Controls}
+*/
+
+class QQuickPageIndicatorPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickPageIndicator)
+
+public:
+ QQuickPageIndicatorPrivate() : count(0), currentIndex(0),
+ interactive(false), delegate(nullptr), pressedItem(nullptr)
+ {
+ }
+
+ QQuickItem *itemAt(const QPoint &pos) const;
+ void updatePressed(bool pressed, const QPoint &pos = QPoint());
+ void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
+
+ void itemChildAdded(QQuickItem *, QQuickItem *child);
+
+ int count;
+ int currentIndex;
+ bool interactive;
+ QQmlComponent *delegate;
+ QQuickItem *pressedItem;
+};
+
+QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
+{
+ Q_Q(const QQuickPageIndicator);
+ if (!contentItem || !q->contains(pos))
+ return nullptr;
+
+ QPointF contentPos = q->mapToItem(contentItem, pos);
+ QQuickItem *item = contentItem->childAt(contentPos.x(), contentPos.y());
+ while (item && item->parentItem() != contentItem)
+ item = item->parentItem();
+ if (item && !QQuickItemPrivate::get(item)->isTransparentForPositioner())
+ return item;
+
+ // find the nearest
+ qreal distance = qInf();
+ QQuickItem *nearest = nullptr;
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *child : childItems) {
+ if (QQuickItemPrivate::get(child)->isTransparentForPositioner())
+ continue;
+
+ QPointF center = child->boundingRect().center();
+ QPointF pt = contentItem->mapToItem(child, contentPos);
+
+ qreal len = QLineF(center, pt).length();
+ if (len < distance) {
+ distance = len;
+ nearest = child;
+ }
+ }
+ return nearest;
+}
+
+void QQuickPageIndicatorPrivate::updatePressed(bool pressed, const QPoint &pos)
+{
+ QQuickItem *prevItem = pressedItem;
+ pressedItem = pressed ? itemAt(pos) : nullptr;
+ if (prevItem != pressedItem) {
+ setContextProperty(prevItem, QStringLiteral("pressed"), false);
+ setContextProperty(pressedItem, QStringLiteral("pressed"), pressed);
+ }
+}
+
+void QQuickPageIndicatorPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
+{
+ QQmlContext *context = qmlContext(item);
+ if (context && context->isValid()) {
+ context = context->parentContext();
+ if (context && context->isValid())
+ context->setContextProperty(name, value);
+ }
+}
+
+void QQuickPageIndicatorPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
+{
+ if (!QQuickItemPrivate::get(child)->isTransparentForPositioner())
+ setContextProperty(child, QStringLiteral("pressed"), false);
+}
+
+QQuickPageIndicator::QQuickPageIndicator(QQuickItem *parent) :
+ QQuickControl(*(new QQuickPageIndicatorPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::PageIndicator::count
+
+ This property holds the number of pages.
+*/
+int QQuickPageIndicator::count() const
+{
+ Q_D(const QQuickPageIndicator);
+ return d->count;
+}
+
+void QQuickPageIndicator::setCount(int count)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->count == count)
+ return;
+
+ d->count = count;
+ emit countChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::PageIndicator::currentIndex
+
+ This property holds the index of the current page.
+*/
+int QQuickPageIndicator::currentIndex() const
+{
+ Q_D(const QQuickPageIndicator);
+ return d->currentIndex;
+}
+
+void QQuickPageIndicator::setCurrentIndex(int index)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->currentIndex == index)
+ return;
+
+ d->currentIndex = index;
+ emit currentIndexChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::PageIndicator::interactive
+
+ This property holds whether the control is interactive. An interactive page indicator
+ reacts to presses and automatically changes the \l {currentIndex}{current index}
+ appropriately.
+
+ \snippet qtquickcontrols2-pageindicator-interactive.qml 1
+
+ \note Page indicators are typically quite small (in order to avoid
+ distracting the user from the actual content of the user interface). They
+ can be hard to click, and might not be easily recognized as interactive by
+ the user. For these reasons, they are best used to complement primary
+ methods of navigation (such as \l SwipeView), not replace them.
+
+ The default value is \c false.
+*/
+bool QQuickPageIndicator::isInteractive() const
+{
+ Q_D(const QQuickPageIndicator);
+ return d->interactive;
+}
+
+void QQuickPageIndicator::setInteractive(bool interactive)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->interactive == interactive)
+ return;
+
+ d->interactive = interactive;
+ setAcceptedMouseButtons(interactive ? Qt::LeftButton : Qt::NoButton);
+ emit interactiveChanged();
+}
+
+/*!
+ \qmlproperty Component QtQuick.Controls::PageIndicator::delegate
+
+ This property holds a delegate that presents a page.
+
+ The following properties are available in the context of each delegate:
+ \table
+ \row \li \b index : int \li The index of the item
+ \row \li \b pressed : bool \li Whether the item is pressed
+ \endtable
+*/
+QQmlComponent *QQuickPageIndicator::delegate() const
+{
+ Q_D(const QQuickPageIndicator);
+ return d->delegate;
+}
+
+void QQuickPageIndicator::setDelegate(QQmlComponent *delegate)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->delegate == delegate)
+ return;
+
+ d->delegate = delegate;
+ emit delegateChanged();
+}
+
+void QQuickPageIndicator::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_D(QQuickPageIndicator);
+ QQuickControl::contentItemChange(newItem, oldItem);
+ if (oldItem)
+ QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
+ if (newItem)
+ QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
+}
+
+void QQuickPageIndicator::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->interactive) {
+ d->updatePressed(true, event->pos());
+ event->accept();
+ }
+}
+
+void QQuickPageIndicator::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->interactive) {
+ d->updatePressed(true, event->pos());
+ event->accept();
+ }
+}
+
+void QQuickPageIndicator::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPageIndicator);
+ if (d->interactive) {
+ if (d->pressedItem)
+ setCurrentIndex(d->contentItem->childItems().indexOf(d->pressedItem));
+ d->updatePressed(false);
+ event->accept();
+ }
+}
+
+void QQuickPageIndicator::mouseUngrabEvent()
+{
+ Q_D(QQuickPageIndicator);
+ if (d->interactive)
+ d->updatePressed(false);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPageIndicator::accessibleRole() const
+{
+ return QAccessible::Indicator;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpageindicator_p.h b/src/quicktemplates2/qquickpageindicator_p.h
new file mode 100644
index 00000000..b5833835
--- /dev/null
+++ b/src/quicktemplates2/qquickpageindicator_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPAGEINDICATOR_P_H
+#define QQUICKPAGEINDICATOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlComponent;
+class QQuickPageIndicatorPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPageIndicator : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+ Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL)
+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
+
+public:
+ explicit QQuickPageIndicator(QQuickItem *parent = nullptr);
+
+ int count() const;
+ void setCount(int count);
+
+ int currentIndex() const;
+ void setCurrentIndex(int index);
+
+ bool isInteractive() const;
+ void setInteractive(bool interactive);
+
+ QQmlComponent *delegate() const;
+ void setDelegate(QQmlComponent *delegate);
+
+Q_SIGNALS:
+ void countChanged();
+ void currentIndexChanged();
+ void interactiveChanged();
+ void delegateChanged();
+
+protected:
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) 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 override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickPageIndicator)
+ Q_DECLARE_PRIVATE(QQuickPageIndicator)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPageIndicator)
+
+#endif // QQUICKPAGEINDICATOR_P_H
diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp
new file mode 100644
index 00000000..9f9c139b
--- /dev/null
+++ b/src/quicktemplates2/qquickpane.cpp
@@ -0,0 +1,241 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpane_p.h"
+#include "qquickpane_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Pane
+ \inherits Control
+ \instantiates QQuickPane
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \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
+ position its contents, for instance by creating a \l RowLayout or a
+ \l ColumnLayout.
+
+ Items declared as children of a Pane are automatically parented to the
+ Pane's \l {Control::}{contentItem}. Items created dynamically need to be
+ explicitly parented to the contentItem.
+
+ \section1 Content Sizing
+
+ If only a single item is used within a Pane, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \image qtquickcontrols2-pane.png
+
+ \snippet qtquickcontrols2-pane.qml 1
+
+ Sometimes there might be two items within the pane:
+
+ \code
+ Pane {
+ SwipeView {
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
+ In this case, Pane cannot calculate a sensible implicit size. Since we're
+ anchoring the \l PageIndicator over the \l SwipeView, we can simply set the
+ content size to the view's implicit size:
+
+ \code
+ Pane {
+ contentWidth: view.implicitWidth
+ contentHeight: view.implicitHeight
+
+ SwipeView {
+ id: view
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
+ \sa {Customizing Pane}, {Container Controls}
+*/
+
+QQuickPanePrivate::QQuickPanePrivate() : contentWidth(0), contentHeight(0)
+{
+}
+
+QQuickPane::QQuickPane(QQuickItem *parent) :
+ QQuickControl(*(new QQuickPanePrivate), parent)
+{
+ setFlag(QQuickItem::ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::AllButtons);
+}
+
+QQuickPane::QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ setFlag(QQuickItem::ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::AllButtons);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Pane::contentWidth
+
+ This property holds the content width. It is used for calculating the total
+ implicit width of the pane.
+
+ For more information, see \l {Content Sizing}.
+
+ \sa contentHeight
+*/
+qreal QQuickPane::contentWidth() const
+{
+ Q_D(const QQuickPane);
+ return d->contentWidth;
+}
+
+void QQuickPane::setContentWidth(qreal width)
+{
+ Q_D(QQuickPane);
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Pane::contentHeight
+
+ This property holds the content height. It is used for calculating the total
+ implicit height of the pane.
+
+ For more information, see \l {Content Sizing}.
+
+ \sa contentWidth
+*/
+qreal QQuickPane::contentHeight() const
+{
+ Q_D(const QQuickPane);
+ return d->contentHeight;
+}
+
+void QQuickPane::setContentHeight(qreal height)
+{
+ Q_D(QQuickPane);
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
+}
+
+/*!
+ \qmlproperty list<Object> QtQuick.Controls::Pane::contentData
+ \default
+
+ This property holds the list of content data.
+
+ The list contains all objects that have been declared in QML as children
+ of the pane.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects.
+
+ \sa Item::data, contentChildren
+*/
+QQmlListProperty<QObject> QQuickPane::contentData()
+{
+ Q_D(QQuickPane);
+ return QQmlListProperty<QObject>(d->contentItem, nullptr,
+ QQuickItemPrivate::data_append,
+ QQuickItemPrivate::data_count,
+ QQuickItemPrivate::data_at,
+ QQuickItemPrivate::data_clear);
+}
+
+/*!
+ \qmlproperty list<Item> QtQuick.Controls::Pane::contentChildren
+
+ This property holds the list of content children.
+
+ The list contains all items that have been declared in QML as children
+ of the pane.
+
+ \note Unlike \c contentData, \c contentChildren does not include non-visual
+ QML objects.
+
+ \sa Item::children, contentData
+*/
+QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
+{
+ Q_D(QQuickPane);
+ return QQmlListProperty<QQuickItem>(d->contentItem, nullptr,
+ QQuickItemPrivate::children_append,
+ QQuickItemPrivate::children_count,
+ QQuickItemPrivate::children_at,
+ QQuickItemPrivate::children_clear);
+}
+
+void QQuickPane::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ QQuickControl::contentItemChange(newItem, oldItem);
+ if (oldItem)
+ disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
+ if (newItem)
+ connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
+ emit contentChildrenChanged();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPane::accessibleRole() const
+{
+ return QAccessible::Pane;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpane_p.h b/src/quicktemplates2/qquickpane_p.h
new file mode 100644
index 00000000..95834bdc
--- /dev/null
+++ b/src/quicktemplates2/qquickpane_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPANE_P_H
+#define QQUICKPANE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQml/qqmllist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPanePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPane : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "contentData")
+
+public:
+ explicit QQuickPane(QQuickItem *parent = nullptr);
+
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
+Q_SIGNALS:
+ void contentWidthChanged();
+ void contentHeightChanged();
+ void contentChildrenChanged();
+
+protected:
+ QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent);
+
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickPane)
+ Q_DECLARE_PRIVATE(QQuickPane)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPane)
+
+#endif // QQUICKPANE_P_H
diff --git a/src/quicktemplates2/qquickpane_p_p.h b/src/quicktemplates2/qquickpane_p_p.h
new file mode 100644
index 00000000..acc0d0ab
--- /dev/null
+++ b/src/quicktemplates2/qquickpane_p_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPANE_P_P_H
+#define QQUICKPANE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPane;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPanePrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPane)
+
+public:
+ QQuickPanePrivate();
+
+ qreal contentWidth;
+ qreal contentHeight;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPANE_P_P_H
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
new file mode 100644
index 00000000..bdcfe6ca
--- /dev/null
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -0,0 +1,2398 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpopup_p.h"
+#include "qquickpopup_p_p.h"
+#include "qquickapplicationwindow_p.h"
+#include "qquickshortcutcontext_p_p.h"
+#include "qquickoverlay_p_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/private/qshortcutmap_p.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquicktransition_p.h>
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Popup
+ \inherits QtObject
+ \instantiates QQuickPopup
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-popups
+ \brief Base type of popup-like user interface controls.
+
+ Popup is the base type of popup-like user interface controls. It can be
+ used with \l Window or \l ApplicationWindow.
+
+ \qml
+ import QtQuick.Window 2.2
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ id: window
+ width: 400
+ height: 400
+ visible: true
+
+ Button {
+ text: "Open"
+ onClicked: popup.open()
+ }
+
+ Popup {
+ id: popup
+ x: 100
+ y: 100
+ width: 200
+ height: 300
+ modal: true
+ focus: true
+ closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
+ }
+ }
+ \endqml
+
+ In order to ensure that a popup is displayed above other items in the
+ scene, it is recommended to use ApplicationWindow. ApplicationWindow also
+ provides background dimming effects.
+
+ Popup does not provide a layout of its own, but requires you to position
+ its contents, for instance by creating a \l RowLayout or a \l ColumnLayout.
+
+ Items declared as children of a Popup are automatically parented to the
+ Popups's \l contentItem. Items created dynamically need to be explicitly
+ parented to the contentItem.
+
+ \section1 Popup Layout
+
+ The following diagram illustrates the layout of a typical popup:
+
+ \image qtquickcontrols2-popup.png
+
+ The \l implicitWidth and \l implicitHeight of a popup are typically based
+ on the implicit sizes of the background and the content item plus any
+ \l padding. These properties determine how large the popup will be when no
+ explicit \l width or \l height is specified.
+
+ The \l background item fills the entire width and height of the popup,
+ unless an explicit size has been given for it.
+
+ The geometry of the \l contentItem is determined by the \l padding.
+
+ \section1 Popup Sizing
+
+ If only a single item is used within a Popup, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \code
+ Popup {
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+ }
+ \endcode
+
+ Sometimes there might be two items within the popup:
+
+ \code
+ Popup {
+ SwipeView {
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
+ In this case, Popup cannot calculate a sensible implicit size. Since we're
+ anchoring the \l PageIndicator over the \l SwipeView, we can simply set the
+ content size to the view's implicit size:
+
+ \code
+ Popup {
+ contentWidth: view.implicitWidth
+ contentHeight: view.implicitHeight
+
+ SwipeView {
+ id: view
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
+ \sa {Popup Controls}, {Customizing Popup}, ApplicationWindow
+*/
+
+/*!
+ \qmlsignal void QtQuick.Controls::Popup::opened()
+
+ This signal is emitted when the popup is opened.
+
+ \sa closed
+*/
+
+/*!
+ \qmlsignal void QtQuick.Controls::Popup::closed()
+
+ This signal is emitted when the popup is closed.
+
+ \sa opened
+*/
+
+static const QQuickItemPrivate::ChangeTypes AncestorChangeTypes = QQuickItemPrivate::Geometry
+ | QQuickItemPrivate::Parent
+ | QQuickItemPrivate::Children;
+
+static const QQuickItemPrivate::ChangeTypes ItemChangeTypes = QQuickItemPrivate::Geometry
+ | QQuickItemPrivate::Parent;
+
+QQuickPopupPrivate::QQuickPopupPrivate()
+ : QObjectPrivate()
+ , focus(false)
+ , modal(false)
+ , dim(false)
+ , hasDim(false)
+ , visible(false)
+ , complete(false)
+ , positioning(false)
+ , hasWidth(false)
+ , hasHeight(false)
+ , hasTopMargin(false)
+ , hasLeftMargin(false)
+ , hasRightMargin(false)
+ , hasBottomMargin(false)
+ , allowVerticalFlip(false)
+ , allowHorizontalFlip(false)
+ , allowVerticalMove(true)
+ , allowHorizontalMove(true)
+ , allowVerticalResize(true)
+ , allowHorizontalResize(true)
+ , hadActiveFocusBeforeExitTransition(false)
+ , x(0)
+ , y(0)
+ , effectiveX(0)
+ , effectiveY(0)
+ , margins(-1)
+ , topMargin(0)
+ , leftMargin(0)
+ , rightMargin(0)
+ , bottomMargin(0)
+ , contentWidth(0)
+ , contentHeight(0)
+ , transitionState(QQuickPopupPrivate::NoTransition)
+ , closePolicy(QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutside)
+ , parentItem(nullptr)
+ , dimmer(nullptr)
+ , window(nullptr)
+ , enter(nullptr)
+ , exit(nullptr)
+ , popupItem(nullptr)
+ , positioner(this)
+ , transitionManager(this)
+{
+}
+
+QQuickPopupPrivate::~QQuickPopupPrivate()
+{
+}
+
+void QQuickPopupPrivate::init()
+{
+ Q_Q(QQuickPopup);
+ popupItem = new QQuickPopupItem(q);
+ q->setParentItem(qobject_cast<QQuickItem *>(parent));
+ QObject::connect(popupItem, &QQuickControl::paddingChanged, q, &QQuickPopup::paddingChanged);
+}
+
+bool QQuickPopupPrivate::tryClose(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickPopup);
+ const bool isPress = event->type() == QEvent::MouseButtonPress;
+ const bool onOutside = closePolicy.testFlag(isPress ? QQuickPopup::CloseOnPressOutside : QQuickPopup::CloseOnReleaseOutside);
+ const bool onOutsideParent = closePolicy.testFlag(isPress ? QQuickPopup::CloseOnPressOutsideParent : QQuickPopup::CloseOnReleaseOutsideParent);
+ if (onOutside || onOutsideParent) {
+ if (!popupItem->contains(item->mapToItem(popupItem, event->pos()))) {
+ if (!onOutsideParent || !parentItem || !parentItem->contains(item->mapToItem(parentItem, event->pos()))) {
+ q->close();
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool QQuickPopupPrivate::prepareEnterTransition()
+{
+ Q_Q(QQuickPopup);
+ if (!window) {
+ qmlInfo(q) << "cannot find any window to open popup in.";
+ return false;
+ }
+
+ if (transitionState == EnterTransition && transitionManager.isRunning())
+ return false;
+
+ if (transitionState != EnterTransition) {
+ popupItem->setParentItem(QQuickOverlay::overlay(window));
+ emit q->aboutToShow();
+ visible = true;
+ transitionState = EnterTransition;
+ popupItem->setVisible(true);
+ positioner.setParentItem(parentItem);
+ emit q->visibleChanged();
+ }
+ return true;
+}
+
+bool QQuickPopupPrivate::prepareExitTransition()
+{
+ Q_Q(QQuickPopup);
+ if (transitionState == ExitTransition && transitionManager.isRunning())
+ return false;
+
+ if (transitionState != ExitTransition) {
+ if (focus) {
+ // The setFocus(false) call below removes any active focus before we're
+ // able to check it in finalizeExitTransition.
+ hadActiveFocusBeforeExitTransition = popupItem->hasActiveFocus();
+ popupItem->setFocus(false);
+ }
+ transitionState = ExitTransition;
+ emit q->aboutToHide();
+ }
+ return true;
+}
+
+void QQuickPopupPrivate::finalizeEnterTransition()
+{
+ Q_Q(QQuickPopup);
+ if (focus)
+ popupItem->setFocus(true);
+ transitionState = NoTransition;
+ emit q->opened();
+}
+
+void QQuickPopupPrivate::finalizeExitTransition()
+{
+ Q_Q(QQuickPopup);
+ positioner.setParentItem(nullptr);
+ popupItem->setParentItem(nullptr);
+ popupItem->setVisible(false);
+
+ if (hadActiveFocusBeforeExitTransition && window) {
+ if (!qobject_cast<QQuickPopupItem *>(window->activeFocusItem())) {
+ QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
+ if (applicationWindow)
+ applicationWindow->contentItem()->setFocus(true);
+ else
+ window->contentItem()->setFocus(true);
+ }
+ }
+
+ visible = false;
+ transitionState = NoTransition;
+ hadActiveFocusBeforeExitTransition = false;
+ emit q->visibleChanged();
+ emit q->closed();
+}
+
+QMarginsF QQuickPopupPrivate::getMargins() const
+{
+ Q_Q(const QQuickPopup);
+ return QMarginsF(q->leftMargin(), q->topMargin(), q->rightMargin(), q->bottomMargin());
+}
+
+void QQuickPopupPrivate::setTopMargin(qreal value, bool reset)
+{
+ Q_Q(QQuickPopup);
+ qreal oldMargin = q->topMargin();
+ topMargin = value;
+ hasTopMargin = !reset;
+ if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
+ emit q->topMarginChanged();
+ q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
+ QMarginsF(leftMargin, oldMargin, rightMargin, bottomMargin));
+ }
+}
+
+void QQuickPopupPrivate::setLeftMargin(qreal value, bool reset)
+{
+ Q_Q(QQuickPopup);
+ qreal oldMargin = q->leftMargin();
+ leftMargin = value;
+ hasLeftMargin = !reset;
+ if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
+ emit q->leftMarginChanged();
+ q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
+ QMarginsF(oldMargin, topMargin, rightMargin, bottomMargin));
+ }
+}
+
+void QQuickPopupPrivate::setRightMargin(qreal value, bool reset)
+{
+ Q_Q(QQuickPopup);
+ qreal oldMargin = q->rightMargin();
+ rightMargin = value;
+ hasRightMargin = !reset;
+ if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
+ emit q->rightMarginChanged();
+ q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
+ QMarginsF(leftMargin, topMargin, oldMargin, bottomMargin));
+ }
+}
+
+void QQuickPopupPrivate::setBottomMargin(qreal value, bool reset)
+{
+ Q_Q(QQuickPopup);
+ qreal oldMargin = q->bottomMargin();
+ bottomMargin = value;
+ hasBottomMargin = !reset;
+ if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
+ emit q->bottomMarginChanged();
+ q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
+ QMarginsF(leftMargin, topMargin, rightMargin, oldMargin));
+ }
+}
+
+void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow)
+{
+ Q_Q(QQuickPopup);
+ if (window == newWindow)
+ return;
+
+ if (window) {
+ QQuickOverlay *overlay = QQuickOverlay::overlay(window);
+ if (overlay)
+ QQuickOverlayPrivate::get(overlay)->removePopup(q);
+ }
+
+ if (newWindow) {
+ QQuickOverlay *overlay = QQuickOverlay::overlay(newWindow);
+ if (overlay)
+ QQuickOverlayPrivate::get(overlay)->addPopup(q);
+ }
+
+ window = newWindow;
+ emit q->windowChanged(newWindow);
+}
+
+class QQuickPopupItemPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPopupItem)
+
+public:
+ QQuickPopupItemPrivate(QQuickPopup *popup);
+
+ void implicitWidthChanged() override;
+ void implicitHeightChanged() override;
+
+ void resolveFont() override;
+
+ int backId;
+ int escapeId;
+ QQuickPopup *popup;
+};
+
+QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup)
+ : backId(0),
+ escapeId(0),
+ popup(popup)
+{
+ isTabFence = true;
+}
+
+void QQuickPopupItemPrivate::implicitWidthChanged()
+{
+ QQuickControlPrivate::implicitWidthChanged();
+ emit popup->implicitWidthChanged();
+}
+
+void QQuickPopupItemPrivate::implicitHeightChanged()
+{
+ QQuickControlPrivate::implicitHeightChanged();
+ emit popup->implicitHeightChanged();
+}
+
+void QQuickPopupItemPrivate::resolveFont()
+{
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(popup->window()))
+ inheritFont(window->font());
+}
+
+QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup) :
+ QQuickControl(*(new QQuickPopupItemPrivate(popup)), nullptr)
+{
+ setParent(popup);
+ setVisible(false);
+ setFlag(ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::AllButtons);
+
+ // TODO: switch to QStyleHints::useHoverEffects in Qt 5.8
+ setAcceptHoverEvents(true);
+ // setAcceptHoverEvents(QGuiApplication::styleHints()->useHoverEffects());
+ // connect(QGuiApplication::styleHints(), &QStyleHints::useHoverEffectsChanged, this, &QQuickItem::setAcceptHoverEvents);
+}
+
+void QQuickPopupItem::updatePolish()
+{
+ Q_D(QQuickPopupItem);
+ return QQuickPopupPrivate::get(d->popup)->reposition();
+}
+
+void QQuickPopupItem::grabShortcut()
+{
+#ifndef QT_NO_SHORTCUT
+ Q_D(QQuickPopupItem);
+ QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance();
+ if (!d->backId)
+ d->backId = pApp->shortcutMap.addShortcut(this, Qt::Key_Back, Qt::WindowShortcut, QQuickShortcutContext::matcher);
+ if (!d->escapeId)
+ d->escapeId = pApp->shortcutMap.addShortcut(this, Qt::Key_Escape, Qt::WindowShortcut, QQuickShortcutContext::matcher);
+#endif // QT_NO_SHORTCUT
+}
+
+void QQuickPopupItem::ungrabShortcut()
+{
+#ifndef QT_NO_SHORTCUT
+ Q_D(QQuickPopupItem);
+ QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance();
+ if (d->backId) {
+ pApp->shortcutMap.removeShortcut(d->backId, this);
+ d->backId = 0;
+ }
+ if (d->escapeId) {
+ pApp->shortcutMap.removeShortcut(d->escapeId, this);
+ d->escapeId = 0;
+ }
+#endif // QT_NO_SHORTCUT
+}
+
+bool QQuickPopupItem::event(QEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ if (event->type() == QEvent::Shortcut) {
+ QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
+ if (se->shortcutId() == d->escapeId || se->shortcutId() == d->backId) {
+ d->popup->close();
+ return true;
+ }
+ }
+ return QQuickItem::event(event);
+}
+
+bool QQuickPopupItem::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ return d->popup->childMouseEventFilter(child, event);
+}
+
+void QQuickPopupItem::focusInEvent(QFocusEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->focusInEvent(event);
+}
+
+void QQuickPopupItem::focusOutEvent(QFocusEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->focusOutEvent(event);
+}
+
+void QQuickPopupItem::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->keyPressEvent(event);
+}
+
+void QQuickPopupItem::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->keyReleaseEvent(event);
+}
+
+void QQuickPopupItem::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->mousePressEvent(event);
+}
+
+void QQuickPopupItem::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->mouseMoveEvent(event);
+}
+
+void QQuickPopupItem::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->mouseReleaseEvent(event);
+}
+
+void QQuickPopupItem::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->mouseDoubleClickEvent(event);
+}
+
+void QQuickPopupItem::mouseUngrabEvent()
+{
+ Q_D(QQuickPopupItem);
+ d->popup->mouseUngrabEvent();
+}
+
+void QQuickPopupItem::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ d->popup->wheelEvent(event);
+}
+
+void QQuickPopupItem::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::contentItemChange(newItem, oldItem);
+ d->popup->contentItemChange(newItem, oldItem);
+}
+
+void QQuickPopupItem::fontChange(const QFont &newFont, const QFont &oldFont)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::fontChange(newFont, oldFont);
+ d->popup->fontChange(newFont, oldFont);
+}
+
+void QQuickPopupItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+ d->popup->geometryChanged(newGeometry, oldGeometry);
+}
+
+void QQuickPopupItem::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::localeChange(newLocale, oldLocale);
+ d->popup->localeChange(newLocale, oldLocale);
+}
+
+void QQuickPopupItem::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::itemChange(change, data);
+ d->popup->itemChange(change, data);
+}
+
+void QQuickPopupItem::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::paddingChange(newPadding, oldPadding);
+ d->popup->paddingChange(newPadding, oldPadding);
+}
+
+QFont QQuickPopupItem::defaultFont() const
+{
+ Q_D(const QQuickPopupItem);
+ return d->popup->defaultFont();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPopupItem::accessibleRole() const
+{
+ Q_D(const QQuickPopupItem);
+ return d->popup->accessibleRole();
+}
+
+void QQuickPopupItem::accessibilityActiveChanged(bool active)
+{
+ Q_D(const QQuickPopupItem);
+ QQuickControl::accessibilityActiveChanged(active);
+ d->popup->accessibilityActiveChanged(active);
+}
+#endif // QT_NO_ACCESSIBILITY
+
+QQuickPopupPositioner::QQuickPopupPositioner(QQuickPopupPrivate *popup) :
+ m_parentItem(nullptr),
+ m_popup(popup)
+{
+}
+
+QQuickPopupPositioner::~QQuickPopupPositioner()
+{
+ if (m_parentItem) {
+ QQuickItemPrivate::get(m_parentItem)->removeItemChangeListener(this, ItemChangeTypes);
+ removeAncestorListeners(m_parentItem->parentItem());
+ }
+}
+
+QQuickItem *QQuickPopupPositioner::parentItem() const
+{
+ return m_parentItem;
+}
+
+void QQuickPopupPositioner::setParentItem(QQuickItem *parent)
+{
+ if (m_parentItem == parent)
+ return;
+
+ if (m_parentItem) {
+ QQuickItemPrivate::get(m_parentItem)->removeItemChangeListener(this, ItemChangeTypes);
+ removeAncestorListeners(m_parentItem->parentItem());
+ }
+
+ m_parentItem = parent;
+
+ if (!parent)
+ return;
+
+ QQuickItemPrivate::get(parent)->addItemChangeListener(this, ItemChangeTypes);
+ addAncestorListeners(parent->parentItem());
+
+ if (m_popup->popupItem->isVisible())
+ m_popup->reposition();
+}
+
+void QQuickPopupPositioner::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+{
+ if (m_parentItem && m_popup->popupItem->isVisible())
+ m_popup->reposition();
+}
+
+void QQuickPopupPositioner::itemParentChanged(QQuickItem *, QQuickItem *parent)
+{
+ addAncestorListeners(parent);
+}
+
+void QQuickPopupPositioner::itemChildRemoved(QQuickItem *item, QQuickItem *child)
+{
+ if (isAncestor(child))
+ removeAncestorListeners(item);
+}
+
+void QQuickPopupPrivate::itemDestroyed(QQuickItem *item)
+{
+ Q_Q(QQuickPopup);
+ if (item == parentItem)
+ q->setParentItem(nullptr);
+}
+
+void QQuickPopupPrivate::reposition()
+{
+ Q_Q(QQuickPopup);
+ if (!popupItem->isVisible())
+ return;
+
+ if (positioning) {
+ popupItem->polish();
+ return;
+ }
+
+ const qreal w = popupItem->width();
+ const qreal h = popupItem->height();
+ const qreal iw = popupItem->implicitWidth();
+ const qreal ih = popupItem->implicitHeight();
+
+ bool widthAdjusted = false;
+ bool heightAdjusted = false;
+
+ QRectF rect(allowHorizontalMove ? x : popupItem->x(),
+ allowVerticalMove ? y : popupItem->y(),
+ !hasWidth && iw > 0 ? iw : w,
+ !hasHeight && ih > 0 ? ih : h);
+ if (parentItem) {
+ rect = parentItem->mapRectToScene(rect);
+
+ if (window) {
+ const QMarginsF margins = getMargins();
+ const QRectF bounds(qMax<qreal>(0.0, margins.left()),
+ qMax<qreal>(0.0, margins.top()),
+ window->width() - qMax<qreal>(0.0, margins.left()) - qMax<qreal>(0.0, margins.right()),
+ window->height() - qMax<qreal>(0.0, margins.top()) - qMax<qreal>(0.0, margins.bottom()));
+
+ // if the popup doesn't fit horizontally inside the window, try flipping it around (left <-> right)
+ if (allowHorizontalFlip && (rect.left() < bounds.left() || rect.right() > bounds.right())) {
+ const QRectF flipped = parentItem->mapRectToScene(QRectF(parentItem->width() - x - rect.width(), y, rect.width(), rect.height()));
+ if (flipped.intersected(bounds).width() > rect.intersected(bounds).width())
+ rect.moveLeft(flipped.left());
+ }
+
+ // if the popup doesn't fit vertically inside the window, try flipping it around (above <-> below)
+ if (allowVerticalFlip && (rect.top() < bounds.top() || rect.bottom() > bounds.bottom())) {
+ const QRectF flipped = parentItem->mapRectToScene(QRectF(x, parentItem->height() - y - rect.height(), rect.width(), rect.height()));
+ if (flipped.intersected(bounds).height() > rect.intersected(bounds).height())
+ rect.moveTop(flipped.top());
+ }
+
+ // push inside the margins if specified
+ if (allowVerticalMove) {
+ if (margins.top() >= 0 && rect.top() < bounds.top())
+ rect.moveTop(margins.top());
+ if (margins.bottom() >= 0 && rect.bottom() > bounds.bottom())
+ rect.moveBottom(bounds.bottom());
+ }
+ if (allowHorizontalMove) {
+ if (margins.left() >= 0 && rect.left() < bounds.left())
+ rect.moveLeft(margins.left());
+ if (margins.right() >= 0 && rect.right() > bounds.right())
+ rect.moveRight(bounds.right());
+ }
+
+ if (iw > 0 && (rect.left() < bounds.left() || rect.right() > bounds.right())) {
+ // neither the flipped or pushed geometry fits inside the window, choose
+ // whichever side (left vs. right) fits larger part of the popup
+ if (allowHorizontalMove && allowHorizontalFlip) {
+ if (rect.left() < bounds.left() && bounds.left() + rect.width() <= bounds.right())
+ rect.moveLeft(bounds.left());
+ else if (rect.right() > bounds.right() && bounds.right() - rect.width() >= bounds.left())
+ rect.moveRight(bounds.right());
+ }
+
+ // as a last resort, adjust the width to fit the window
+ if (allowHorizontalResize) {
+ if (rect.left() < bounds.left()) {
+ rect.setLeft(bounds.left());
+ widthAdjusted = true;
+ }
+ if (rect.right() > bounds.right()) {
+ rect.setRight(bounds.right());
+ widthAdjusted = true;
+ }
+ }
+ } else if (iw > 0 && rect.left() >= bounds.left() && rect.right() <= bounds.right()
+ && iw != w) {
+ // restore original width
+ rect.setWidth(iw);
+ widthAdjusted = true;
+ }
+
+ if (ih > 0 && (rect.top() < bounds.top() || rect.bottom() > bounds.bottom())) {
+ // neither the flipped or pushed geometry fits inside the window, choose
+ // whichever side (above vs. below) fits larger part of the popup
+ if (allowVerticalMove && allowVerticalFlip) {
+ if (rect.top() < bounds.top() && bounds.top() + rect.height() <= bounds.bottom())
+ rect.moveTop(bounds.top());
+ else if (rect.bottom() > bounds.bottom() && bounds.bottom() - rect.height() >= bounds.top())
+ rect.moveBottom(bounds.bottom());
+ }
+
+ // as a last resort, adjust the height to fit the window
+ if (allowVerticalResize) {
+ if (rect.top() < bounds.top()) {
+ rect.setTop(bounds.top());
+ heightAdjusted = true;
+ }
+ if (rect.bottom() > bounds.bottom()) {
+ rect.setBottom(bounds.bottom());
+ heightAdjusted = true;
+ }
+ }
+ } else if (ih > 0 && rect.top() >= bounds.top() && rect.bottom() <= bounds.bottom()
+ && ih != h) {
+ // restore original height
+ rect.setHeight(ih);
+ heightAdjusted = true;
+ }
+ }
+ }
+
+ positioning = true;
+
+ popupItem->setPosition(rect.topLeft());
+
+ const QPointF effectivePos = parentItem ? parentItem->mapFromScene(rect.topLeft()) : rect.topLeft();
+ if (!qFuzzyCompare(effectiveX, effectivePos.x())) {
+ effectiveX = effectivePos.x();
+ emit q->xChanged();
+ }
+ if (!qFuzzyCompare(effectiveY, effectivePos.y())) {
+ effectiveY = effectivePos.y();
+ emit q->yChanged();
+ }
+
+ if (!hasWidth && widthAdjusted && rect.width() > 0)
+ popupItem->setWidth(rect.width());
+ if (!hasHeight && heightAdjusted && rect.height() > 0)
+ popupItem->setHeight(rect.height());
+
+ positioning = false;
+}
+
+void QQuickPopupPrivate::resizeOverlay()
+{
+ if (!dimmer)
+ return;
+
+ qreal w = window ? window->width() : 0;
+ qreal h = window ? window->height() : 0;
+ dimmer->setSize(QSizeF(w, h));
+}
+
+void QQuickPopupPositioner::removeAncestorListeners(QQuickItem *item)
+{
+ if (item == m_parentItem)
+ return;
+
+ QQuickItem *p = item;
+ while (p) {
+ QQuickItemPrivate::get(p)->removeItemChangeListener(this, AncestorChangeTypes);
+ p = p->parentItem();
+ }
+}
+
+void QQuickPopupPositioner::addAncestorListeners(QQuickItem *item)
+{
+ if (item == m_parentItem)
+ return;
+
+ QQuickItem *p = item;
+ while (p) {
+ QQuickItemPrivate::get(p)->addItemChangeListener(this, AncestorChangeTypes);
+ p = p->parentItem();
+ }
+}
+
+// TODO: use QQuickItem::isAncestorOf() in dev/5.7
+bool QQuickPopupPositioner::isAncestor(QQuickItem *item) const
+{
+ if (!m_parentItem)
+ return false;
+
+ QQuickItem *parent = m_parentItem;
+ while (parent) {
+ if (parent == item)
+ return true;
+ parent = parent->parentItem();
+ }
+ return false;
+}
+
+QQuickPopupTransitionManager::QQuickPopupTransitionManager(QQuickPopupPrivate *popup)
+ : QQuickTransitionManager(), popup(popup)
+{
+}
+
+void QQuickPopupTransitionManager::transitionEnter()
+{
+ if (popup->transitionState == QQuickPopupPrivate::ExitTransition)
+ cancel();
+
+ if (!popup->prepareEnterTransition())
+ return;
+
+ if (popup->window)
+ transition(popup->enterActions, popup->enter, popup->q_func());
+ else
+ finished();
+}
+
+void QQuickPopupTransitionManager::transitionExit()
+{
+ if (!popup->prepareExitTransition())
+ return;
+
+ if (popup->window)
+ transition(popup->exitActions, popup->exit, popup->q_func());
+ else
+ finished();
+}
+
+void QQuickPopupTransitionManager::finished()
+{
+ if (popup->transitionState == QQuickPopupPrivate::EnterTransition)
+ popup->finalizeEnterTransition();
+ else if (popup->transitionState == QQuickPopupPrivate::ExitTransition)
+ popup->finalizeExitTransition();
+}
+
+QQuickPopup::QQuickPopup(QObject *parent)
+ : QObject(*(new QQuickPopupPrivate), parent)
+{
+ Q_D(QQuickPopup);
+ d->init();
+}
+
+QQuickPopup::QQuickPopup(QQuickPopupPrivate &dd, QObject *parent)
+ : QObject(dd, parent)
+{
+ Q_D(QQuickPopup);
+ d->init();
+}
+
+QQuickPopup::~QQuickPopup()
+{
+ Q_D(QQuickPopup);
+ setParentItem(nullptr);
+ d->popupItem->ungrabShortcut();
+ delete d->popupItem;
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Popup::open()
+
+ Opens the popup.
+
+ \sa visible
+*/
+void QQuickPopup::open()
+{
+ setVisible(true);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Popup::close()
+
+ Closes the popup.
+
+ \sa visible
+*/
+void QQuickPopup::close()
+{
+ setVisible(false);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::x
+
+ This property holds the x-coordinate of the popup.
+
+ \sa y, z
+*/
+qreal QQuickPopup::x() const
+{
+ Q_D(const QQuickPopup);
+ return d->effectiveX;
+}
+
+void QQuickPopup::setX(qreal x)
+{
+ Q_D(QQuickPopup);
+ setPosition(QPointF(x, d->y));
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::y
+
+ This property holds the y-coordinate of the popup.
+
+ \sa x, z
+*/
+qreal QQuickPopup::y() const
+{
+ Q_D(const QQuickPopup);
+ return d->effectiveY;
+}
+
+void QQuickPopup::setY(qreal y)
+{
+ Q_D(QQuickPopup);
+ setPosition(QPointF(d->x, y));
+}
+
+QPointF QQuickPopup::position() const
+{
+ Q_D(const QQuickPopup);
+ return QPointF(d->effectiveX, d->effectiveY);
+}
+
+void QQuickPopup::setPosition(const QPointF &pos)
+{
+ Q_D(QQuickPopup);
+ const bool xChange = !qFuzzyCompare(d->x, pos.x());
+ const bool yChange = !qFuzzyCompare(d->y, pos.y());
+ if (!xChange && !yChange)
+ return;
+
+ d->x = pos.x();
+ d->y = pos.y();
+ if (d->popupItem->isVisible()) {
+ d->reposition();
+ } else {
+ if (xChange)
+ emit xChanged();
+ if (yChange)
+ emit yChanged();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::z
+
+ This property holds the z-value of the popup. Z-value determines
+ the stacking order of popups.
+
+ If two visible popups have the same z-value, the last one that
+ was opened will be on top.
+
+ The default z-value is \c 0.
+
+ \sa x, y
+*/
+qreal QQuickPopup::z() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->z();
+}
+
+void QQuickPopup::setZ(qreal z)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(z, d->popupItem->z()))
+ return;
+ d->popupItem->setZ(z);
+ emit zChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::width
+
+ This property holds the width of the popup.
+*/
+qreal QQuickPopup::width() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->width();
+}
+
+void QQuickPopup::setWidth(qreal width)
+{
+ Q_D(QQuickPopup);
+ d->hasWidth = true;
+ d->popupItem->setWidth(width);
+}
+
+void QQuickPopup::resetWidth()
+{
+ Q_D(QQuickPopup);
+ if (!d->hasWidth)
+ return;
+
+ d->hasWidth = false;
+ d->popupItem->resetWidth();
+ if (d->popupItem->isVisible())
+ d->reposition();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::height
+
+ This property holds the height of the popup.
+*/
+qreal QQuickPopup::height() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->height();
+}
+
+void QQuickPopup::setHeight(qreal height)
+{
+ Q_D(QQuickPopup);
+ d->hasHeight = true;
+ d->popupItem->setHeight(height);
+}
+
+void QQuickPopup::resetHeight()
+{
+ Q_D(QQuickPopup);
+ if (!d->hasHeight)
+ return;
+
+ d->hasHeight = false;
+ d->popupItem->resetHeight();
+ if (d->popupItem->isVisible())
+ d->reposition();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::implicitWidth
+
+ This property holds the implicit width of the popup.
+*/
+qreal QQuickPopup::implicitWidth() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->implicitWidth();
+}
+
+void QQuickPopup::setImplicitWidth(qreal width)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setImplicitWidth(width);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::implicitHeight
+
+ This property holds the implicit height of the popup.
+*/
+qreal QQuickPopup::implicitHeight() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->implicitHeight();
+}
+
+void QQuickPopup::setImplicitHeight(qreal height)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setImplicitHeight(height);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::contentWidth
+
+ This property holds the content width. It is used for calculating the
+ total implicit width of the Popup.
+
+ For more information, see \l {Popup Sizing}.
+
+ \sa contentHeight
+*/
+qreal QQuickPopup::contentWidth() const
+{
+ Q_D(const QQuickPopup);
+ return d->contentWidth;
+}
+
+void QQuickPopup::setContentWidth(qreal width)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::contentHeight
+
+ This property holds the content height. It is used for calculating the
+ total implicit height of the Popup.
+
+ For more information, see \l {Popup Sizing}.
+
+ \sa contentWidth
+*/
+qreal QQuickPopup::contentHeight() const
+{
+ Q_D(const QQuickPopup);
+ return d->contentHeight;
+}
+
+void QQuickPopup::setContentHeight(qreal height)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::availableWidth
+ \readonly
+
+ This property holds the width available to the \l contentItem after
+ deducting horizontal padding from the \l {Item::}{width} of the popup.
+
+ \sa padding, leftPadding, rightPadding
+*/
+qreal QQuickPopup::availableWidth() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->availableWidth();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::availableHeight
+ \readonly
+
+ This property holds the height available to the \l contentItem after
+ deducting vertical padding from the \l {Item::}{height} of the popup.
+
+ \sa padding, topPadding, bottomPadding
+*/
+qreal QQuickPopup::availableHeight() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->availableHeight();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::margins
+
+ This property holds the default margins around the popup.
+
+ A popup with negative margins is not pushed within the bounds
+ of the enclosing window. The default value is \c -1.
+
+ \sa topMargin, leftMargin, rightMargin, bottomMargin
+*/
+qreal QQuickPopup::margins() const
+{
+ Q_D(const QQuickPopup);
+ return d->margins;
+}
+
+void QQuickPopup::setMargins(qreal margins)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(d->margins, margins))
+ return;
+ QMarginsF oldMargins(leftMargin(), topMargin(), rightMargin(), bottomMargin());
+ d->margins = margins;
+ emit marginsChanged();
+ QMarginsF newMargins(leftMargin(), topMargin(), rightMargin(), bottomMargin());
+ if (!qFuzzyCompare(newMargins.top(), oldMargins.top()))
+ emit topMarginChanged();
+ if (!qFuzzyCompare(newMargins.left(), oldMargins.left()))
+ emit leftMarginChanged();
+ if (!qFuzzyCompare(newMargins.right(), oldMargins.right()))
+ emit rightMarginChanged();
+ if (!qFuzzyCompare(newMargins.bottom(), oldMargins.bottom()))
+ emit bottomMarginChanged();
+ marginsChange(newMargins, oldMargins);
+}
+
+void QQuickPopup::resetMargins()
+{
+ setMargins(-1);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::topMargin
+
+ This property holds the top margin around the popup.
+
+ A popup with a negative top margin is not pushed within the top edge
+ of the enclosing window. The default value is \c -1.
+
+ \sa margins, bottomMargin
+*/
+qreal QQuickPopup::topMargin() const
+{
+ Q_D(const QQuickPopup);
+ if (d->hasTopMargin)
+ return d->topMargin;
+ return d->margins;
+}
+
+void QQuickPopup::setTopMargin(qreal margin)
+{
+ Q_D(QQuickPopup);
+ d->setTopMargin(margin);
+}
+
+void QQuickPopup::resetTopMargin()
+{
+ Q_D(QQuickPopup);
+ d->setTopMargin(-1, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::leftMargin
+
+ This property holds the left margin around the popup.
+
+ A popup with a negative left margin is not pushed within the left edge
+ of the enclosing window. The default value is \c -1.
+
+ \sa margins, rightMargin
+*/
+qreal QQuickPopup::leftMargin() const
+{
+ Q_D(const QQuickPopup);
+ if (d->hasLeftMargin)
+ return d->leftMargin;
+ return d->margins;
+}
+
+void QQuickPopup::setLeftMargin(qreal margin)
+{
+ Q_D(QQuickPopup);
+ d->setLeftMargin(margin);
+}
+
+void QQuickPopup::resetLeftMargin()
+{
+ Q_D(QQuickPopup);
+ d->setLeftMargin(-1, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::rightMargin
+
+ This property holds the right margin around the popup.
+
+ A popup with a negative right margin is not pushed within the right edge
+ of the enclosing window. The default value is \c -1.
+
+ \sa margins, leftMargin
+*/
+qreal QQuickPopup::rightMargin() const
+{
+ Q_D(const QQuickPopup);
+ if (d->hasRightMargin)
+ return d->rightMargin;
+ return d->margins;
+}
+
+void QQuickPopup::setRightMargin(qreal margin)
+{
+ Q_D(QQuickPopup);
+ d->setRightMargin(margin);
+}
+
+void QQuickPopup::resetRightMargin()
+{
+ Q_D(QQuickPopup);
+ d->setRightMargin(-1, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::bottomMargin
+
+ This property holds the bottom margin around the popup.
+
+ A popup with a negative bottom margin is not pushed within the bottom edge
+ of the enclosing window. The default value is \c -1.
+
+ \sa margins, topMargin
+*/
+qreal QQuickPopup::bottomMargin() const
+{
+ Q_D(const QQuickPopup);
+ if (d->hasBottomMargin)
+ return d->bottomMargin;
+ return d->margins;
+}
+
+void QQuickPopup::setBottomMargin(qreal margin)
+{
+ Q_D(QQuickPopup);
+ d->setBottomMargin(margin);
+}
+
+void QQuickPopup::resetBottomMargin()
+{
+ Q_D(QQuickPopup);
+ d->setBottomMargin(-1, true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::padding
+
+ This property holds the default padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa availableWidth, availableHeight, topPadding, leftPadding, rightPadding, bottomPadding
+*/
+qreal QQuickPopup::padding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->padding();
+}
+
+void QQuickPopup::setPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setPadding(padding);
+}
+
+void QQuickPopup::resetPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetPadding();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::topPadding
+
+ This property holds the top padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa padding, bottomPadding, availableHeight
+*/
+qreal QQuickPopup::topPadding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->topPadding();
+}
+
+void QQuickPopup::setTopPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setTopPadding(padding);
+}
+
+void QQuickPopup::resetTopPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetTopPadding();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::leftPadding
+
+ This property holds the left padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa padding, rightPadding, availableWidth
+*/
+qreal QQuickPopup::leftPadding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->leftPadding();
+}
+
+void QQuickPopup::setLeftPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setLeftPadding(padding);
+}
+
+void QQuickPopup::resetLeftPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetLeftPadding();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::rightPadding
+
+ This property holds the right padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa padding, leftPadding, availableWidth
+*/
+qreal QQuickPopup::rightPadding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->rightPadding();
+}
+
+void QQuickPopup::setRightPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setRightPadding(padding);
+}
+
+void QQuickPopup::resetRightPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetRightPadding();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::bottomPadding
+
+ This property holds the bottom padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa padding, topPadding, availableHeight
+*/
+qreal QQuickPopup::bottomPadding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->bottomPadding();
+}
+
+void QQuickPopup::setBottomPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setBottomPadding(padding);
+}
+
+void QQuickPopup::resetBottomPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetBottomPadding();
+}
+
+/*!
+ \qmlproperty Locale QtQuick.Controls::Popup::locale
+
+ This property holds the locale of the popup.
+
+ \sa {LayoutMirroring}{LayoutMirroring}
+*/
+QLocale QQuickPopup::locale() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->locale();
+}
+
+void QQuickPopup::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setLocale(locale);
+}
+
+void QQuickPopup::resetLocale()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetLocale();
+}
+
+/*!
+ \qmlproperty font QtQuick.Controls::Popup::font
+
+ This property holds the font currently set for the popup.
+
+ Popup propagates explicit font properties to its children. If you change a specific
+ property on a popup's font, that property propagates to all of the popup's children,
+ overriding any system defaults for that property.
+
+ \code
+ Popup {
+ font.family: "Courier"
+
+ Column {
+ Label {
+ text: qsTr("This will use Courier...")
+ }
+
+ Switch {
+ text: qsTr("... and so will this")
+ }
+ }
+ }
+ \endcode
+
+ \sa Control::font, ApplicationWindow::font
+*/
+QFont QQuickPopup::font() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->font();
+}
+
+void QQuickPopup::setFont(const QFont &font)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setFont(font);
+}
+
+void QQuickPopup::resetFont()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetFont();
+}
+
+QQuickWindow *QQuickPopup::window() const
+{
+ Q_D(const QQuickPopup);
+ return d->window;
+}
+
+QQuickItem *QQuickPopup::popupItem() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem;
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Popup::parent
+
+ This property holds the parent item.
+*/
+QQuickItem *QQuickPopup::parentItem() const
+{
+ Q_D(const QQuickPopup);
+ return d->parentItem;
+}
+
+void QQuickPopup::setParentItem(QQuickItem *parent)
+{
+ Q_D(QQuickPopup);
+ if (d->parentItem == parent)
+ return;
+
+ if (d->parentItem) {
+ QObjectPrivate::disconnect(d->parentItem, &QQuickItem::windowChanged, d, &QQuickPopupPrivate::setWindow);
+ QQuickItemPrivate::get(d->parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Destroyed);
+ }
+ d->parentItem = parent;
+ if (d->positioner.parentItem())
+ d->positioner.setParentItem(parent);
+ if (parent) {
+ QObjectPrivate::connect(parent, &QQuickItem::windowChanged, d, &QQuickPopupPrivate::setWindow);
+ QQuickItemPrivate::get(d->parentItem)->addItemChangeListener(d, QQuickItemPrivate::Destroyed);
+
+ QQuickControlPrivate *p = QQuickControlPrivate::get(d->popupItem);
+ p->resolveFont();
+ if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(parent->window()))
+ p->updateLocale(window->locale(), false); // explicit=false
+ } else {
+ close();
+ }
+ d->setWindow(parent ? parent->window() : nullptr);
+ emit parentChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Popup::background
+
+ This property holds the background item.
+
+ \note If the background item has no explicit size specified, it automatically
+ follows the popup's size. In most cases, there is no need to specify
+ width or height for a background item.
+
+ \note Most popups use the implicit size of the background item to calculate
+ the implicit size of the popup itself. If you replace the background item
+ with a custom one, you should also consider providing a sensible implicit
+ size for it (unless it is an item like \l Image which has its own implicit
+ size).
+
+ \sa {Customizing Popup}
+*/
+QQuickItem *QQuickPopup::background() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->background();
+}
+
+void QQuickPopup::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickPopup);
+ if (d->popupItem->background() == background)
+ return;
+
+ d->popupItem->setBackground(background);
+ emit backgroundChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Popup::contentItem
+
+ This property holds the content item of the popup.
+
+ The content item is the visual implementation of the popup. When the
+ popup is made visible, the content item is automatically reparented to
+ the \l {ApplicationWindow::overlay}{overlay item} of its application
+ window.
+
+ \note The content item is automatically resized to fit within the
+ \l padding of the popup.
+
+ \note Most popups use the implicit size of the content item to calculate
+ the implicit size of the popup itself. If you replace the content item
+ with a custom one, you should also consider providing a sensible implicit
+ size for it (unless it is an item like \l Text which has its own implicit
+ size).
+
+ \sa {Customizing Popup}
+*/
+QQuickItem *QQuickPopup::contentItem() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->contentItem();
+}
+
+void QQuickPopup::setContentItem(QQuickItem *item)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setContentItem(item);
+}
+
+/*!
+ \qmlproperty list<Object> QtQuick.Controls::Popup::contentData
+ \default
+
+ This property holds the list of content data.
+
+ The list contains all objects that have been declared in QML as children
+ of the popup.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects.
+
+ \sa Item::data, contentChildren
+*/
+QQmlListProperty<QObject> QQuickPopup::contentData()
+{
+ Q_D(QQuickPopup);
+ return QQmlListProperty<QObject>(d->popupItem->contentItem(), nullptr,
+ QQuickItemPrivate::data_append,
+ QQuickItemPrivate::data_count,
+ QQuickItemPrivate::data_at,
+ QQuickItemPrivate::data_clear);
+}
+
+/*!
+ \qmlproperty list<Item> QtQuick.Controls::Popup::contentChildren
+
+ This property holds the list of content children.
+
+ The list contains all items that have been declared in QML as children
+ of the popup.
+
+ \note Unlike \c contentData, \c contentChildren does not include non-visual
+ QML objects.
+
+ \sa Item::children, contentData
+*/
+QQmlListProperty<QQuickItem> QQuickPopup::contentChildren()
+{
+ Q_D(QQuickPopup);
+ return QQmlListProperty<QQuickItem>(d->popupItem->contentItem(), nullptr,
+ QQuickItemPrivate::children_append,
+ QQuickItemPrivate::children_count,
+ QQuickItemPrivate::children_at,
+ QQuickItemPrivate::children_clear);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::clip
+
+ This property holds whether clipping is enabled. The default value is \c false.
+*/
+bool QQuickPopup::clip() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->clip();
+}
+
+void QQuickPopup::setClip(bool clip)
+{
+ Q_D(QQuickPopup);
+ if (clip == d->popupItem->clip())
+ return;
+ d->popupItem->setClip(clip);
+ emit clipChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::focus
+
+ This property holds whether the popup wants focus.
+
+ When the popup actually receives focus, \l activeFocus will be \c true.
+ For more information, see \l {Keyboard Focus in Qt Quick}.
+
+ The default value is \c false.
+
+ \sa activeFocus
+*/
+bool QQuickPopup::hasFocus() const
+{
+ Q_D(const QQuickPopup);
+ return d->focus;
+}
+
+void QQuickPopup::setFocus(bool focus)
+{
+ Q_D(QQuickPopup);
+ if (d->focus == focus)
+ return;
+ d->focus = focus;
+ emit focusChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::activeFocus
+ \readonly
+
+ This property holds whether the popup has active focus.
+
+ \sa focus, {Keyboard Focus in Qt Quick}
+*/
+bool QQuickPopup::hasActiveFocus() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->hasActiveFocus();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::modal
+
+ This property holds whether the popup is modal. The default value is \c false.
+*/
+bool QQuickPopup::isModal() const
+{
+ Q_D(const QQuickPopup);
+ return d->modal;
+}
+
+void QQuickPopup::setModal(bool modal)
+{
+ Q_D(QQuickPopup);
+ if (d->modal == modal)
+ return;
+ d->modal = modal;
+ emit modalChanged();
+
+ if (!d->hasDim) {
+ setDim(modal);
+ d->hasDim = false;
+ }
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::dim
+
+ This property holds whether the popup dims the background.
+
+ Unless explicitly set, this property follows the value of \l modal. To
+ return to the default value, set this property to \c undefined.
+
+ \sa modal
+*/
+bool QQuickPopup::dim() const
+{
+ Q_D(const QQuickPopup);
+ return d->dim;
+}
+
+void QQuickPopup::setDim(bool dim)
+{
+ Q_D(QQuickPopup);
+ d->hasDim = true;
+
+ if (d->dim == dim)
+ return;
+
+ d->dim = dim;
+ emit dimChanged();
+}
+
+void QQuickPopup::resetDim()
+{
+ Q_D(QQuickPopup);
+ if (!d->hasDim)
+ return;
+
+ setDim(d->modal);
+ d->hasDim = false;
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Popup::visible
+
+ This property holds whether the popup is visible. The default value is \c false.
+
+ \sa open(), close()
+*/
+bool QQuickPopup::isVisible() const
+{
+ Q_D(const QQuickPopup);
+ return d->visible && d->popupItem->isVisible();
+}
+
+void QQuickPopup::setVisible(bool visible)
+{
+ Q_D(QQuickPopup);
+ if (d->visible == visible && d->transitionState != QQuickPopupPrivate::ExitTransition)
+ return;
+
+ if (d->complete) {
+ if (visible)
+ d->transitionManager.transitionEnter();
+ else
+ d->transitionManager.transitionExit();
+ } else {
+ d->visible = visible;
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::opacity
+
+ This property holds the opacity of the popup. Opacity is specified as a number between
+ \c 0.0 (fully transparent) and \c 1.0 (fully opaque). The default value is \c 1.0.
+
+ \sa visible
+*/
+qreal QQuickPopup::opacity() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->opacity();
+}
+
+void QQuickPopup::setOpacity(qreal opacity)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setOpacity(opacity);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Popup::scale
+
+ This property holds the scale factor of the popup. The default value is \c 1.0.
+
+ A scale of less than \c 1.0 causes the popup to be rendered at a smaller size,
+ and a scale greater than \c 1.0 renders the popup at a larger size. A negative
+ scale causes the popup to be mirrored when rendered.
+*/
+qreal QQuickPopup::scale() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->scale();
+}
+
+void QQuickPopup::setScale(qreal scale)
+{
+ Q_D(QQuickPopup);
+ if (qFuzzyCompare(scale, d->popupItem->scale()))
+ return;
+ d->popupItem->setScale(scale);
+ emit scaleChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Popup::closePolicy
+
+ This property determines the circumstances under which the popup closes.
+ The flags can be combined to allow several ways of closing the popup.
+
+ The available values are:
+ \value Popup.NoAutoClose The popup will only close when manually instructed to do so.
+ \value Popup.CloseOnPressOutside The popup will close when the mouse is pressed outside of it.
+ \value Popup.CloseOnPressOutsideParent The popup will close when the mouse is pressed outside of its parent.
+ \value Popup.CloseOnReleaseOutside The popup will close when the mouse is released outside of it.
+ \value Popup.CloseOnReleaseOutsideParent The popup will close when the mouse is released outside of its parent.
+ \value Popup.CloseOnEscape The popup will close when the escape key is pressed while the popup
+ has active focus.
+
+ The default value is \c {Popup.CloseOnEscape | Popup.CloseOnPressOutside}.
+
+ \note There is a known limitation that the \c Popup.CloseOnReleaseOutside
+ and \c Popup.CloseOnReleaseOutsideParent policies only work with
+ \l modal popups.
+*/
+QQuickPopup::ClosePolicy QQuickPopup::closePolicy() const
+{
+ Q_D(const QQuickPopup);
+ return d->closePolicy;
+}
+
+void QQuickPopup::setClosePolicy(ClosePolicy policy)
+{
+ Q_D(QQuickPopup);
+ if (d->closePolicy == policy)
+ return;
+ d->closePolicy = policy;
+ if (isVisible()) {
+ if (policy & QQuickPopup::CloseOnEscape)
+ d->popupItem->grabShortcut();
+ else
+ d->popupItem->ungrabShortcut();
+ }
+ emit closePolicyChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Popup::transformOrigin
+
+ This property holds the origin point for transformations in enter and exit transitions.
+
+ Nine transform origins are available, as shown in the image below.
+ The default transform origin is \c Popup.Center.
+
+ \image qtquickcontrols2-popup-transformorigin.png
+
+ \sa enter, exit, Item::transformOrigin
+*/
+QQuickPopup::TransformOrigin QQuickPopup::transformOrigin() const
+{
+ Q_D(const QQuickPopup);
+ return static_cast<TransformOrigin>(d->popupItem->transformOrigin());
+}
+
+void QQuickPopup::setTransformOrigin(TransformOrigin origin)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setTransformOrigin(static_cast<QQuickItem::TransformOrigin>(origin));
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::Popup::enter
+
+ This property holds the transition that is applied to the popup item
+ when the popup is opened and enters the screen.
+
+ The following example animates the opacity of the popup when it enters
+ the screen:
+ \code
+ Popup {
+ enter: Transition {
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
+ }
+ }
+ \endcode
+
+ \sa exit
+*/
+QQuickTransition *QQuickPopup::enter() const
+{
+ Q_D(const QQuickPopup);
+ return d->enter;
+}
+
+void QQuickPopup::setEnter(QQuickTransition *transition)
+{
+ Q_D(QQuickPopup);
+ if (d->enter == transition)
+ return;
+ d->enter = transition;
+ emit enterChanged();
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::Popup::exit
+
+ This property holds the transition that is applied to the popup item
+ when the popup is closed and exits the screen.
+
+ The following example animates the opacity of the popup when it exits
+ the screen:
+ \code
+ Popup {
+ exit: Transition {
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
+ }
+ }
+ \endcode
+
+ \sa enter
+*/
+QQuickTransition *QQuickPopup::exit() const
+{
+ Q_D(const QQuickPopup);
+ return d->exit;
+}
+
+void QQuickPopup::setExit(QQuickTransition *transition)
+{
+ Q_D(QQuickPopup);
+ if (d->exit == transition)
+ return;
+ d->exit = transition;
+ emit exitChanged();
+}
+
+bool QQuickPopup::filtersChildMouseEvents() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->filtersChildMouseEvents();
+}
+
+void QQuickPopup::setFiltersChildMouseEvents(bool filter)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setFiltersChildMouseEvents(filter);
+}
+
+/*!
+ \qmlmethod QtQuick.Controls::Popup::forceActiveFocus(reason = Qt.OtherFocusReason)
+
+ Forces active focus on the popup with the given \a reason.
+
+ This method sets focus on the popup and ensures that all ancestor
+ \l FocusScope objects in the object hierarchy are also given \l focus.
+
+ \sa activeFocus, Qt::FocusReason
+*/
+void QQuickPopup::forceActiveFocus(Qt::FocusReason reason)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->forceActiveFocus(reason);
+}
+
+void QQuickPopup::classBegin()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->classBegin();
+}
+
+void QQuickPopup::componentComplete()
+{
+ Q_D(QQuickPopup);
+ d->complete = true;
+ if (!parentItem())
+ setParentItem(qobject_cast<QQuickItem *>(parent()));
+ if (d->visible)
+ d->transitionManager.transitionEnter();
+ d->popupItem->componentComplete();
+}
+
+bool QQuickPopup::isComponentComplete() const
+{
+ Q_D(const QQuickPopup);
+ return d->complete;
+}
+
+bool QQuickPopup::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ Q_UNUSED(child);
+ Q_UNUSED(event);
+ return false;
+}
+
+void QQuickPopup::focusInEvent(QFocusEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::focusOutEvent(QFocusEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickPopup);
+ event->accept();
+
+ if (hasActiveFocus() && (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab))
+ QQuickItemPrivate::focusNextPrev(d->popupItem, event->key() == Qt::Key_Tab);
+}
+
+void QQuickPopup::keyReleaseEvent(QKeyEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::mousePressEvent(QMouseEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::mouseMoveEvent(QMouseEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::mouseReleaseEvent(QMouseEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::mouseUngrabEvent()
+{
+ QQuickOverlay *overlay = QQuickOverlay::overlay(window());
+ if (overlay) {
+ QQuickOverlayPrivate *p = QQuickOverlayPrivate::get(overlay);
+ if (p->mouseGrabberPopup == this)
+ p->mouseGrabberPopup = nullptr;
+ }
+}
+
+bool QQuickPopup::overlayEvent(QQuickItem *item, QEvent *event)
+{
+ Q_D(QQuickPopup);
+ switch (event->type()) {
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ case QEvent::MouseMove:
+ case QEvent::Wheel:
+ if (d->modal)
+ event->accept();
+ return d->modal;
+
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ if (d->modal)
+ event->accept();
+ d->tryClose(item, static_cast<QMouseEvent *>(event));
+ return d->modal;
+
+ default:
+ return false;
+ }
+}
+
+void QQuickPopup::wheelEvent(QWheelEvent *event)
+{
+ event->accept();
+}
+
+void QQuickPopup::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_UNUSED(newItem);
+ Q_UNUSED(oldItem);
+ emit contentItemChanged();
+}
+
+void QQuickPopup::fontChange(const QFont &newFont, const QFont &oldFont)
+{
+ Q_UNUSED(newFont);
+ Q_UNUSED(oldFont);
+ emit fontChanged();
+}
+
+void QQuickPopup::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickPopup);
+ d->reposition();
+ if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
+ emit widthChanged();
+ emit availableWidthChanged();
+ }
+ if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height())) {
+ emit heightChanged();
+ emit availableHeightChanged();
+ }
+}
+
+void QQuickPopup::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
+{
+ Q_D(QQuickPopup);
+
+ switch (change) {
+ case QQuickItem::ItemActiveFocusHasChanged:
+ emit activeFocusChanged();
+ break;
+ case QQuickItem::ItemOpacityHasChanged:
+ emit opacityChanged();
+ break;
+ case QQuickItem::ItemVisibleHasChanged:
+ if (isComponentComplete() && d->closePolicy & CloseOnEscape) {
+ if (data.boolValue)
+ d->popupItem->grabShortcut();
+ else
+ d->popupItem->ungrabShortcut();
+ }
+ default:
+ break;
+ }
+}
+
+void QQuickPopup::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_UNUSED(newLocale);
+ Q_UNUSED(oldLocale);
+ emit localeChanged();
+}
+
+void QQuickPopup::marginsChange(const QMarginsF &newMargins, const QMarginsF &oldMargins)
+{
+ Q_D(QQuickPopup);
+ Q_UNUSED(newMargins);
+ Q_UNUSED(oldMargins);
+ d->reposition();
+}
+
+void QQuickPopup::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
+{
+ const bool tp = !qFuzzyCompare(newPadding.top(), oldPadding.top());
+ const bool lp = !qFuzzyCompare(newPadding.left(), oldPadding.left());
+ const bool rp = !qFuzzyCompare(newPadding.right(), oldPadding.right());
+ const bool bp = !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom());
+
+ if (tp)
+ emit topPaddingChanged();
+ if (lp)
+ emit leftPaddingChanged();
+ if (rp)
+ emit rightPaddingChanged();
+ if (bp)
+ emit bottomPaddingChanged();
+
+ if (lp || rp)
+ emit availableWidthChanged();
+ if (tp || bp)
+ emit availableHeightChanged();
+}
+
+QFont QQuickPopup::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPopup::accessibleRole() const
+{
+ return QAccessible::Dialog;
+}
+
+void QQuickPopup::accessibilityActiveChanged(bool active)
+{
+ Q_UNUSED(active);
+}
+#endif // QT_NO_ACCESSIBILITY
+
+QString QQuickPopup::accessibleName() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->accessibleName();
+}
+
+void QQuickPopup::setAccessibleName(const QString &name)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setAccessibleName(name);
+}
+
+QVariant QQuickPopup::accessibleProperty(const char *propertyName)
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->accessibleProperty(propertyName);
+}
+
+bool QQuickPopup::setAccessibleProperty(const char *propertyName, const QVariant &value)
+{
+ Q_D(QQuickPopup);
+ return d->popupItem->setAccessibleProperty(propertyName, value);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquickpopup_p.cpp"
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
new file mode 100644
index 00000000..6393dcdc
--- /dev/null
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -0,0 +1,384 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPOPUP_P_H
+#define QQUICKPOPUP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtCore/qmargins.h>
+#include <QtGui/qevent.h>
+#include <QtCore/qlocale.h>
+#include <QtGui/qfont.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+#include <QtQml/qqml.h>
+#include <QtQml/qqmllist.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQuick/qquickitem.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtGui/qaccessible.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class QQuickWindow;
+class QQuickPopupPrivate;
+class QQuickTransition;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
+ Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
+ Q_PROPERTY(qreal z READ z WRITE setZ NOTIFY zChanged FINAL)
+ Q_PROPERTY(qreal width READ width WRITE setWidth RESET resetWidth NOTIFY widthChanged FINAL)
+ Q_PROPERTY(qreal height READ height WRITE setHeight RESET resetHeight NOTIFY heightChanged FINAL)
+ Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged FINAL)
+ Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged FINAL)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
+ Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL)
+ Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL)
+ Q_PROPERTY(qreal margins READ margins WRITE setMargins RESET resetMargins NOTIFY marginsChanged FINAL)
+ Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin RESET resetTopMargin NOTIFY topMarginChanged FINAL)
+ Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin RESET resetLeftMargin NOTIFY leftMarginChanged FINAL)
+ Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin RESET resetRightMargin NOTIFY rightMarginChanged FINAL)
+ Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin RESET resetBottomMargin NOTIFY bottomMarginChanged FINAL)
+ Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
+ Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
+ Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
+ Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
+ Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
+ Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged FINAL)
+ Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem NOTIFY parentChanged FINAL)
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged FINAL)
+ Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
+ Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL)
+ Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged FINAL)
+ Q_PROPERTY(bool dim READ dim WRITE setDim RESET resetDim NOTIFY dimChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
+ Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged FINAL)
+ Q_PROPERTY(ClosePolicy closePolicy READ closePolicy WRITE setClosePolicy NOTIFY closePolicyChanged FINAL)
+ Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin)
+ Q_PROPERTY(QQuickTransition *enter READ enter WRITE setEnter NOTIFY enterChanged FINAL)
+ Q_PROPERTY(QQuickTransition *exit READ exit WRITE setExit NOTIFY exitChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "contentData")
+
+public:
+ explicit QQuickPopup(QObject *parent = nullptr);
+ ~QQuickPopup();
+
+ qreal x() const;
+ void setX(qreal x);
+
+ qreal y() const;
+ void setY(qreal y);
+
+ QPointF position() const;
+ void setPosition(const QPointF &pos);
+
+ qreal z() const;
+ void setZ(qreal z);
+
+ qreal width() const;
+ void setWidth(qreal width);
+ void resetWidth();
+
+ qreal height() const;
+ void setHeight(qreal height);
+ void resetHeight();
+
+ qreal implicitWidth() const;
+ void setImplicitWidth(qreal width);
+
+ qreal implicitHeight() const;
+ void setImplicitHeight(qreal height);
+
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
+ qreal availableWidth() const;
+ qreal availableHeight() const;
+
+ qreal margins() const;
+ void setMargins(qreal margins);
+ void resetMargins();
+
+ qreal topMargin() const;
+ void setTopMargin(qreal margin);
+ void resetTopMargin();
+
+ qreal leftMargin() const;
+ void setLeftMargin(qreal margin);
+ void resetLeftMargin();
+
+ qreal rightMargin() const;
+ void setRightMargin(qreal margin);
+ void resetRightMargin();
+
+ qreal bottomMargin() const;
+ void setBottomMargin(qreal margin);
+ void resetBottomMargin();
+
+ qreal padding() const;
+ void setPadding(qreal padding);
+ void resetPadding();
+
+ qreal topPadding() const;
+ void setTopPadding(qreal padding);
+ void resetTopPadding();
+
+ qreal leftPadding() const;
+ void setLeftPadding(qreal padding);
+ void resetLeftPadding();
+
+ qreal rightPadding() const;
+ void setRightPadding(qreal padding);
+ void resetRightPadding();
+
+ qreal bottomPadding() const;
+ void setBottomPadding(qreal padding);
+ void resetBottomPadding();
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+ void resetLocale();
+
+ QFont font() const;
+ void setFont(const QFont &font);
+ void resetFont();
+
+ QQuickWindow *window() const;
+ QQuickItem *popupItem() const;
+
+ QQuickItem *parentItem() const;
+ void setParentItem(QQuickItem *parent);
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+ QQuickItem *contentItem() const;
+ void setContentItem(QQuickItem *item);
+
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
+ bool clip() const;
+ void setClip(bool clip);
+
+ bool hasFocus() const;
+ void setFocus(bool focus);
+
+ bool hasActiveFocus() const;
+
+ bool isModal() const;
+ void setModal(bool modal);
+
+ bool dim() const;
+ void setDim(bool dim);
+ void resetDim();
+
+ bool isVisible() const;
+ virtual void setVisible(bool visible);
+
+ qreal opacity() const;
+ void setOpacity(qreal opacity);
+
+ qreal scale() const;
+ void setScale(qreal scale);
+
+ enum ClosePolicyFlag {
+ NoAutoClose = 0x00,
+ CloseOnPressOutside = 0x01,
+ CloseOnPressOutsideParent = 0x02,
+ CloseOnReleaseOutside = 0x04,
+ CloseOnReleaseOutsideParent = 0x08,
+ CloseOnEscape = 0x10
+ };
+ Q_DECLARE_FLAGS(ClosePolicy, ClosePolicyFlag)
+ Q_FLAG(ClosePolicy)
+
+ ClosePolicy closePolicy() const;
+ void setClosePolicy(ClosePolicy policy);
+
+ // keep in sync with Item.TransformOrigin
+ enum TransformOrigin {
+ TopLeft, Top, TopRight,
+ Left, Center, Right,
+ BottomLeft, Bottom, BottomRight
+ };
+ Q_ENUM(TransformOrigin)
+
+ TransformOrigin transformOrigin() const;
+ void setTransformOrigin(TransformOrigin);
+
+ QQuickTransition *enter() const;
+ void setEnter(QQuickTransition *transition);
+
+ QQuickTransition *exit() const;
+ void setExit(QQuickTransition *transition);
+
+ bool filtersChildMouseEvents() const;
+ void setFiltersChildMouseEvents(bool filter);
+
+ Q_INVOKABLE void forceActiveFocus(Qt::FocusReason reason = Qt::OtherFocusReason);
+
+public Q_SLOTS:
+ void open();
+ void close();
+
+Q_SIGNALS:
+ void xChanged();
+ void yChanged();
+ void zChanged();
+ void widthChanged();
+ void heightChanged();
+ void implicitWidthChanged();
+ void implicitHeightChanged();
+ void contentWidthChanged();
+ void contentHeightChanged();
+ void availableWidthChanged();
+ void availableHeightChanged();
+ void marginsChanged();
+ void topMarginChanged();
+ void leftMarginChanged();
+ void rightMarginChanged();
+ void bottomMarginChanged();
+ void paddingChanged();
+ void topPaddingChanged();
+ void leftPaddingChanged();
+ void rightPaddingChanged();
+ void bottomPaddingChanged();
+ void fontChanged();
+ void localeChanged();
+ void parentChanged();
+ void backgroundChanged();
+ void contentItemChanged();
+ void contentChildrenChanged();
+ void clipChanged();
+ void focusChanged();
+ void activeFocusChanged();
+ void modalChanged();
+ void dimChanged();
+ void visibleChanged();
+ void opacityChanged();
+ void scaleChanged();
+ void closePolicyChanged();
+ void enterChanged();
+ void exitChanged();
+ void windowChanged(QQuickWindow *window);
+
+ void aboutToShow();
+ void aboutToHide();
+ void opened();
+ void closed();
+
+protected:
+ QQuickPopup(QQuickPopupPrivate &dd, QObject *parent);
+
+ void classBegin() override;
+ void componentComplete() override;
+ bool isComponentComplete() const;
+
+ virtual bool childMouseEventFilter(QQuickItem *child, QEvent *event);
+ virtual void focusInEvent(QFocusEvent *event);
+ virtual void focusOutEvent(QFocusEvent *event);
+ virtual void keyPressEvent(QKeyEvent *event);
+ virtual void keyReleaseEvent(QKeyEvent *event);
+ virtual void mousePressEvent(QMouseEvent *event);
+ virtual void mouseMoveEvent(QMouseEvent *event);
+ virtual void mouseReleaseEvent(QMouseEvent *event);
+ virtual void mouseDoubleClickEvent(QMouseEvent *event);
+ virtual void mouseUngrabEvent();
+ virtual bool overlayEvent(QQuickItem *item, QEvent *event);
+ virtual void wheelEvent(QWheelEvent *event);
+
+ virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
+ virtual void fontChange(const QFont &newFont, const QFont &oldFont);
+ virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
+ virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
+ virtual void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data);
+ virtual void marginsChange(const QMarginsF &newMargins, const QMarginsF &oldMargins);
+ virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
+
+ virtual QFont defaultFont() const;
+
+#ifndef QT_NO_ACCESSIBILITY
+ virtual QAccessible::Role accessibleRole() const;
+ virtual void accessibilityActiveChanged(bool active);
+#endif
+
+ QString accessibleName() const;
+ void setAccessibleName(const QString &name);
+
+ QVariant accessibleProperty(const char *propertyName);
+ bool setAccessibleProperty(const char *propertyName, const QVariant &value);
+
+private:
+ Q_DISABLE_COPY(QQuickPopup)
+ Q_DECLARE_PRIVATE(QQuickPopup)
+ friend class QQuickPopupItem;
+ friend class QQuickOverlay;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickPopup::ClosePolicy)
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPopup)
+
+#endif // QQUICKPOPUP_P_H
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
new file mode 100644
index 00000000..0c12b077
--- /dev/null
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -0,0 +1,238 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPOPUP_P_P_H
+#define QQUICKPOPUP_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickpopup_p.h"
+#include "qquickcontrol_p.h"
+
+#include <QtCore/private/qobject_p.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQuick/private/qquicktransitionmanager_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTransition;
+class QQuickTransitionManager;
+class QQuickPopup;
+class QQuickPopupPrivate;
+class QQuickPopupItemPrivate;
+
+class QQuickPopupTransitionManager : public QQuickTransitionManager
+{
+public:
+ QQuickPopupTransitionManager(QQuickPopupPrivate *popup);
+
+ void transitionEnter();
+ void transitionExit();
+
+protected:
+ void finished() override;
+
+private:
+ QQuickPopupPrivate *popup;
+};
+
+class QQuickPopupItem : public QQuickControl
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickPopupItem(QQuickPopup *popup);
+
+ void grabShortcut();
+ void ungrabShortcut();
+
+protected:
+ void updatePolish() override;
+
+ bool event(QEvent *event) override;
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) 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 fontChange(const QFont &newFont, const QFont &oldFont) override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
+
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
+private:
+ Q_DECLARE_PRIVATE(QQuickPopupItem)
+
+ friend class QQuickPopup;
+};
+
+class QQuickPopupPositioner : public QQuickItemChangeListener
+{
+public:
+ explicit QQuickPopupPositioner(QQuickPopupPrivate *popup);
+ ~QQuickPopupPositioner();
+
+ QQuickItem *parentItem() const;
+ void setParentItem(QQuickItem *parent);
+
+protected:
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) override;
+ void itemParentChanged(QQuickItem *, QQuickItem *parent) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *child) override;
+
+private:
+ void removeAncestorListeners(QQuickItem *item);
+ void addAncestorListeners(QQuickItem *item);
+
+ bool isAncestor(QQuickItem *item) const;
+
+ QQuickItem *m_parentItem;
+ QQuickPopupPrivate *m_popup;
+};
+
+class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickPopup)
+
+public:
+ QQuickPopupPrivate();
+ ~QQuickPopupPrivate();
+
+ static QQuickPopupPrivate *get(QQuickPopup *popup)
+ {
+ return popup->d_func();
+ }
+
+ void init();
+ bool tryClose(QQuickItem *item, QMouseEvent *event);
+ virtual void reposition();
+ virtual void resizeOverlay();
+
+ virtual bool prepareEnterTransition();
+ virtual bool prepareExitTransition();
+ virtual void finalizeEnterTransition();
+ virtual void finalizeExitTransition();
+
+ QMarginsF getMargins() const;
+
+ void setTopMargin(qreal value, bool reset = false);
+ void setLeftMargin(qreal value, bool reset = false);
+ void setRightMargin(qreal value, bool reset = false);
+ void setBottomMargin(qreal value, bool reset = false);
+
+ void setWindow(QQuickWindow *window);
+ void itemDestroyed(QQuickItem *item) override;
+
+ enum TransitionState {
+ NoTransition, EnterTransition, ExitTransition
+ };
+
+ bool focus;
+ bool modal;
+ bool dim;
+ bool hasDim;
+ bool visible;
+ bool complete;
+ bool positioning;
+ bool hasWidth;
+ bool hasHeight;
+ bool hasTopMargin;
+ bool hasLeftMargin;
+ bool hasRightMargin;
+ bool hasBottomMargin;
+ bool allowVerticalFlip;
+ bool allowHorizontalFlip;
+ bool allowVerticalMove;
+ bool allowHorizontalMove;
+ bool allowVerticalResize;
+ bool allowHorizontalResize;
+ bool hadActiveFocusBeforeExitTransition;
+ qreal x;
+ qreal y;
+ qreal effectiveX;
+ qreal effectiveY;
+ qreal margins;
+ qreal topMargin;
+ qreal leftMargin;
+ qreal rightMargin;
+ qreal bottomMargin;
+ qreal contentWidth;
+ qreal contentHeight;
+ TransitionState transitionState;
+ QQuickPopup::ClosePolicy closePolicy;
+ QQuickItem *parentItem;
+ QQuickItem *dimmer;
+ QQuickWindow *window;
+ QQuickTransition *enter;
+ QQuickTransition *exit;
+ QQuickPopupItem *popupItem;
+ QQuickPopupPositioner positioner;
+ QList<QQuickStateAction> enterActions;
+ QList<QQuickStateAction> exitActions;
+ QQuickPopupTransitionManager transitionManager;
+
+ friend class QQuickPopupTransitionManager;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPOPUP_P_P_H
diff --git a/src/quicktemplates2/qquickpresshandler.cpp b/src/quicktemplates2/qquickpresshandler.cpp
new file mode 100644
index 00000000..1e1a17bc
--- /dev/null
+++ b/src/quicktemplates2/qquickpresshandler.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpresshandler_p_p.h"
+
+#include <QtCore/private/qobject_p.h>
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qstylehints.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickPressHandler::QQuickPressHandler()
+ : control(nullptr)
+ , longPress(false)
+ , pressAndHoldSignalIndex(-1)
+ , delayedMousePressEvent(nullptr)
+{ }
+
+void QQuickPressHandler::mousePressEvent(QMouseEvent *event)
+{
+ longPress = false;
+ pressPos = event->localPos();
+ if (Qt::LeftButton == (event->buttons() & Qt::LeftButton)) {
+ timer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), control);
+ delayedMousePressEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers());
+ } else {
+ timer.stop();
+ }
+}
+
+void QQuickPressHandler::mouseMoveEvent(QMouseEvent *event)
+{
+ if (qAbs(int(event->localPos().x() - pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
+ timer.stop();
+}
+
+void QQuickPressHandler::mouseReleaseEvent(QMouseEvent *)
+{
+ if (!longPress)
+ timer.stop();
+}
+
+void QQuickPressHandler::timerEvent(QTimerEvent *)
+{
+ timer.stop();
+ clearDelayedMouseEvent();
+
+ if (pressAndHoldSignalIndex == -1)
+ pressAndHoldSignalIndex = control->metaObject()->indexOfSignal("pressAndHold(QQuickMouseEvent*)");
+ Q_ASSERT(pressAndHoldSignalIndex != -1);
+
+ longPress = QObjectPrivate::get(control)->isSignalConnected(pressAndHoldSignalIndex);
+ if (longPress) {
+ QQuickMouseEvent mev(pressPos.x(), pressPos.y(), Qt::LeftButton, Qt::LeftButton,
+ QGuiApplication::keyboardModifiers(), false/*isClick*/, true/*wasHeld*/);
+ mev.setAccepted(true);
+ // Use fast signal invocation since we already got its index
+ QQuickMouseEvent *mevPtr = &mev;
+ void *args[] = { nullptr, &mevPtr };
+ QMetaObject::metacall(control, QMetaObject::InvokeMetaMethod, pressAndHoldSignalIndex, args);
+ if (!mev.isAccepted())
+ longPress = false;
+ }
+}
+
+void QQuickPressHandler::clearDelayedMouseEvent()
+{
+ if (delayedMousePressEvent) {
+ delete delayedMousePressEvent;
+ delayedMousePressEvent = 0;
+ }
+}
+
+bool QQuickPressHandler::isActive()
+{
+ return !(timer.isActive() || longPress);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpresshandler_p_p.h b/src/quicktemplates2/qquickpresshandler_p_p.h
new file mode 100644
index 00000000..dec6f202
--- /dev/null
+++ b/src/quicktemplates2/qquickpresshandler_p_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPRESSHANDLER_P_P_H
+#define QQUICKPRESSHANDLER_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qpoint.h>
+#include <QtCore/qbasictimer.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QMouseEvent;
+class QTimerEvent;
+
+struct QQuickPressHandler
+{
+ QQuickPressHandler();
+
+ void mousePressEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
+ void timerEvent(QTimerEvent *event);
+
+ void clearDelayedMouseEvent();
+ bool isActive();
+
+ QQuickItem *control;
+ QBasicTimer timer;
+ QPointF pressPos;
+ bool longPress;
+ int pressAndHoldSignalIndex;
+ QMouseEvent *delayedMousePressEvent;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPRESSHANDLER_P_P_H
diff --git a/src/quicktemplates2/qquickprogressbar.cpp b/src/quicktemplates2/qquickprogressbar.cpp
new file mode 100644
index 00000000..d8ada6f4
--- /dev/null
+++ b/src/quicktemplates2/qquickprogressbar.cpp
@@ -0,0 +1,276 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickprogressbar_p.h"
+#include "qquickcontrol_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ProgressBar
+ \inherits Control
+ \instantiates QQuickProgressBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-indicators
+ \brief Indicates the progress of an operation.
+
+ \image qtquickcontrols2-progressbar.gif
+
+ ProgressBar indicates the progress of an operation. The value should be updated
+ regularly. The range is defined by \l from and \l to, which both can contain any value.
+
+ \code
+ ProgressBar {
+ value: 0.5
+ }
+ \endcode
+
+ ProgressBar also supports a special \l indeterminate mode, which is useful,
+ for example, when unable to determine the size of the item being downloaded,
+ or if the download progress gets interrupted due to a network disconnection.
+
+ \image qtquickcontrols2-progressbar-indeterminate.gif
+
+ \code
+ ProgressBar {
+ indeterminate: true
+ }
+ \endcode
+
+ The indeterminate mode is similar to a \l BusyIndicator. Both can be used
+ to indicate background activity. The main difference is visual, and that
+ ProgressBar can also present a concrete amount of progress (when it can be
+ determined). Due to the visual difference, indeterminate progress bars and
+ busy indicators fit different places in user interfaces. Typical places for
+ an indeterminate progress bar:
+ \list
+ \li at the bottom of a \l ToolBar
+ \li inline within the content of a \l Page
+ \li in an \l ItemDelegate to show the progress of a particular item
+ \endlist
+
+ \sa {Customizing ProgressBar}, BusyIndicator, {Indicator Controls}
+*/
+
+class QQuickProgressBarPrivate : public QQuickControlPrivate
+{
+public:
+ QQuickProgressBarPrivate() : from(0), to(1.0), value(0), indeterminate(false)
+ {
+ }
+
+ qreal from;
+ qreal to;
+ qreal value;
+ bool indeterminate;
+};
+
+QQuickProgressBar::QQuickProgressBar(QQuickItem *parent) :
+ QQuickControl(*(new QQuickProgressBarPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ProgressBar::from
+
+ This property holds the starting value for the progress. The default value is \c 0.0.
+
+ \sa to, value
+*/
+qreal QQuickProgressBar::from() const
+{
+ Q_D(const QQuickProgressBar);
+ return d->from;
+}
+
+void QQuickProgressBar::setFrom(qreal from)
+{
+ Q_D(QQuickProgressBar);
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ emit positionChanged();
+ emit visualPositionChanged();
+ if (isComponentComplete())
+ setValue(d->value);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ProgressBar::to
+
+ This property holds the end value for the progress. The default value is \c 1.0.
+
+ \sa from, value
+*/
+qreal QQuickProgressBar::to() const
+{
+ Q_D(const QQuickProgressBar);
+ return d->to;
+}
+
+void QQuickProgressBar::setTo(qreal to)
+{
+ Q_D(QQuickProgressBar);
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+ emit positionChanged();
+ emit visualPositionChanged();
+ if (isComponentComplete())
+ setValue(d->value);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ProgressBar::value
+
+ This property holds the progress value. The default value is \c 0.0.
+
+ \sa from, to, position
+*/
+qreal QQuickProgressBar::value() const
+{
+ Q_D(const QQuickProgressBar);
+ return d->value;
+}
+
+void QQuickProgressBar::setValue(qreal value)
+{
+ Q_D(QQuickProgressBar);
+ if (isComponentComplete())
+ value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
+
+ if (qFuzzyCompare(d->value, value))
+ return;
+
+ d->value = value;
+ emit valueChanged();
+ emit positionChanged();
+ emit visualPositionChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ProgressBar::position
+ \readonly
+
+ This property holds the logical position of the progress.
+
+ The position is expressed as a fraction of the value, in the range
+ \c {0.0 - 1.0}. For visualizing the progress, the right-to-left
+ aware \l visualPosition should be used instead.
+
+ \sa value, visualPosition
+*/
+qreal QQuickProgressBar::position() const
+{
+ Q_D(const QQuickProgressBar);
+ if (qFuzzyCompare(d->from, d->to))
+ return 0;
+ return (d->value - d->from) / (d->to - d->from);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ProgressBar::visualPosition
+ \readonly
+
+ This property holds the visual position of the progress.
+
+ The position is expressed as a fraction of the value, in the range \c {0.0 - 1.0}.
+ When the control is \l {Control::mirrored}{mirrored}, \c visuaPosition is equal
+ to \c {1.0 - position}. This makes \c visualPosition suitable for visualizing
+ the progress, taking right-to-left support into account.
+
+ \sa position, value
+*/
+qreal QQuickProgressBar::visualPosition() const
+{
+ if (isMirrored())
+ return 1.0 - position();
+ return position();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::ProgressBar::indeterminate
+
+ This property holds whether the progress bar is in indeterminate mode.
+ A progress bar in indeterminate mode displays that an operation is in progress, but it
+ doesn't show how much progress has been made.
+
+ \image qtquickcontrols2-progressbar-indeterminate.gif
+
+*/
+bool QQuickProgressBar::isIndeterminate() const
+{
+ Q_D(const QQuickProgressBar);
+ return d->indeterminate;
+}
+
+void QQuickProgressBar::setIndeterminate(bool indeterminate)
+{
+ Q_D(QQuickProgressBar);
+ if (d->indeterminate == indeterminate)
+ return;
+
+ d->indeterminate = indeterminate;
+ emit indeterminateChanged();
+}
+
+void QQuickProgressBar::mirrorChange()
+{
+ QQuickControl::mirrorChange();
+ if (!qFuzzyCompare(position(), qreal(0.5)))
+ emit visualPositionChanged();
+}
+
+void QQuickProgressBar::componentComplete()
+{
+ Q_D(QQuickProgressBar);
+ QQuickControl::componentComplete();
+ setValue(d->value);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickProgressBar::accessibleRole() const
+{
+ return QAccessible::ProgressBar;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickprogressbar_p.h b/src/quicktemplates2/qquickprogressbar_p.h
new file mode 100644
index 00000000..82adee77
--- /dev/null
+++ b/src/quicktemplates2/qquickprogressbar_p.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPROGRESSBAR_P_H
+#define QQUICKPROGRESSBAR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickProgressBarPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickProgressBar : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+ Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate NOTIFY indeterminateChanged FINAL)
+
+public:
+ explicit QQuickProgressBar(QQuickItem *parent = nullptr);
+
+ qreal from() const;
+ void setFrom(qreal from);
+
+ qreal to() const;
+ void setTo(qreal to);
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal position() const;
+ qreal visualPosition() const;
+
+ bool isIndeterminate() const;
+ void setIndeterminate(bool indeterminate);
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void valueChanged();
+ void positionChanged();
+ void visualPositionChanged();
+ void indeterminateChanged();
+
+protected:
+ void mirrorChange() override;
+ void componentComplete() override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickProgressBar)
+ Q_DECLARE_PRIVATE(QQuickProgressBar)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickProgressBar)
+
+#endif // QQUICKPROGRESSBAR_P_H
diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp
new file mode 100644
index 00000000..acddb50d
--- /dev/null
+++ b/src/quicktemplates2/qquickradiobutton.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickradiobutton_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype RadioButton
+ \inherits AbstractButton
+ \instantiates QQuickRadioButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-buttons
+ \brief Exclusive radio button that can be toggled on or off.
+
+ \image qtquickcontrols2-radiobutton.gif
+
+ RadioButton presents an option button that can be toggled on (checked) or
+ off (unchecked). Radio buttons are typically used to select one option
+ from a set of options.
+
+ RadioButton inherits its API from \l AbstractButton. For instance,
+ you can set \l {AbstractButton::text}{text} and react to
+ \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
+ The state of the radio button can be set with the
+ \l {AbstractButton::}{checked} property.
+
+ Radio buttons are \l {AbstractButton::autoExclusive}{auto-exclusive}
+ by default. Only one button can be checked at any time amongst radio
+ buttons that belong to the same parent item; checking another button
+ automatically unchecks the previously checked one. For radio buttons
+ that do not share a common parent, ButtonGroup can be used to manage
+ exclusivity.
+
+ \l RadioDelegate is similar to RadioButton, except that it is typically
+ used in views.
+
+ \code
+ ColumnLayout {
+ RadioButton {
+ checked: true
+ text: qsTr("First")
+ }
+ RadioButton {
+ text: qsTr("Second")
+ }
+ RadioButton {
+ text: qsTr("Third")
+ }
+ }
+ \endcode
+
+ \sa ButtonGroup, {Customizing RadioButton}, {Button Controls}, RadioDelegate
+*/
+
+QQuickRadioButton::QQuickRadioButton(QQuickItem *parent) :
+ QQuickAbstractButton(parent)
+{
+ setCheckable(true);
+ setAutoExclusive(true);
+}
+
+QFont QQuickRadioButton::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::RadioButtonFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickRadioButton::accessibleRole() const
+{
+ return QAccessible::RadioButton;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickradiobutton_p.h b/src/quicktemplates2/qquickradiobutton_p.h
new file mode 100644
index 00000000..c9d9d8ea
--- /dev/null
+++ b/src/quicktemplates2/qquickradiobutton_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKRADIOBUTTON_P_H
+#define QQUICKRADIOBUTTON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRadioButton : public QQuickAbstractButton
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickRadioButton(QQuickItem *parent = nullptr);
+
+protected:
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickRadioButton)
+
+#endif // QQUICKRADIOBUTTON_P_H
diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp
new file mode 100644
index 00000000..4580dcf2
--- /dev/null
+++ b/src/quicktemplates2/qquickradiodelegate.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickradiodelegate_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype RadioDelegate
+ \inherits ItemDelegate
+ \instantiates QQuickRadioDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-delegates
+ \brief Exclusive item delegate with a radio indicator that can be toggled on or off.
+
+ \image qtquickcontrols2-radiodelegate.gif
+
+ RadioDelegate presents an item delegate that can be toggled on (checked) or
+ off (unchecked). Radio delegates are typically used to select one option
+ from a set of options.
+
+ RadioDelegate inherits its API from \l ItemDelegate, which is inherited
+ from AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton
+ API. The state of the radio delegate can be set with the
+ \l {AbstractButton::}{checked} property.
+
+ Radio delegates are \l {AbstractButton::autoExclusive}{auto-exclusive}
+ by default. Only one delegate can be checked at any time amongst radio
+ delegates that belong to the same parent item; checking another delegate
+ automatically unchecks the previously checked one. For radio delegates
+ that do not share a common parent, ButtonGroup can be used to manage
+ exclusivity.
+
+ \l RadioButton is similar to RadioDelegate, except that it is typically
+ not used in views, but rather when there are only a few options, and often
+ with the requirement that each button is uniquely identifiable.
+
+ \code
+ ButtonGroup {
+ id: buttonGroup
+ }
+
+ ListView {
+ model: ["Option 1", "Option 2", "Option 3"]
+ delegate: RadioDelegate {
+ text: modelData
+ checked: index == 0
+ ButtonGroup.group: buttonGroup
+ }
+ }
+ \endcode
+
+ \sa {Customizing RadioDelegate}, {Delegate Controls}, RadioButton
+*/
+
+QQuickRadioDelegate::QQuickRadioDelegate(QQuickItem *parent) :
+ QQuickItemDelegate(parent)
+{
+ setCheckable(true);
+ setAutoExclusive(true);
+}
+
+QFont QQuickRadioDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickRadioDelegate::accessibleRole() const
+{
+ return QAccessible::RadioButton;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickradiodelegate_p.h b/src/quicktemplates2/qquickradiodelegate_p.h
new file mode 100644
index 00000000..3f231fd7
--- /dev/null
+++ b/src/quicktemplates2/qquickradiodelegate_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKRADIODELEGATE_P_H
+#define QQUICKRADIODELEGATE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickRadioDelegatePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRadioDelegate : public QQuickItemDelegate
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickRadioDelegate(QQuickItem *parent = nullptr);
+
+protected:
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickRadioDelegate)
+
+#endif // QQUICKRADIODELEGATE_P_H
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
new file mode 100644
index 00000000..26a5b010
--- /dev/null
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -0,0 +1,932 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickrangeslider_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtCore/qscopedpointer.h>
+#include <QtQuick/private/qquickwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype RangeSlider
+ \inherits Control
+ \instantiates QQuickRangeSlider
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Used to select a range of values by sliding two handles along a track.
+
+ \image qtquickcontrols2-rangeslider.gif
+
+ RangeSlider is used to select a range specified by two values, by sliding
+ each handle along a track.
+
+ In the example below, custom \l from and \l to values are set, and the
+ initial positions of the \l first and \l second handles are set:
+
+ \code
+ RangeSlider {
+ from: 1
+ to: 100
+ first.value: 25
+ second.value: 75
+ }
+ \endcode
+
+ The \l {first.position} and \l {second.position} properties are expressed as
+ fractions of the control's size, in the range \c {0.0 - 1.0}.
+ The \l {first.visualPosition} and \l {second.visualPosition} properties are
+ the same, except that they are reversed in a
+ \l {Right-to-left User Interfaces}{right-to-left} application.
+ The \c visualPosition is useful for positioning the handles when styling
+ RangeSlider. In the example above, \l {first.visualPosition} will be \c 0.24
+ in a left-to-right application, and \c 0.76 in a right-to-left application.
+
+ \sa {Customizing RangeSlider}, {Input Controls}
+*/
+
+class QQuickRangeSliderNodePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickRangeSliderNode)
+public:
+ QQuickRangeSliderNodePrivate(qreal value, QQuickRangeSlider *slider) :
+ value(value),
+ isPendingValue(false),
+ pendingValue(0),
+ position(0),
+ handle(nullptr),
+ slider(slider),
+ pressed(false)
+ {
+ }
+
+ bool isFirst() const;
+
+ void setPosition(qreal position, bool ignoreOtherPosition = false);
+ void updatePosition(bool ignoreOtherPosition = false);
+
+ static QQuickRangeSliderNodePrivate *get(QQuickRangeSliderNode *node);
+
+private:
+ friend class QQuickRangeSlider;
+
+ qreal value;
+ bool isPendingValue;
+ qreal pendingValue;
+ qreal position;
+ QQuickItem *handle;
+ QQuickRangeSlider *slider;
+ bool pressed;
+};
+
+bool QQuickRangeSliderNodePrivate::isFirst() const
+{
+ return this == get(slider->first());
+}
+
+void QQuickRangeSliderNodePrivate::setPosition(qreal position, bool ignoreOtherPosition)
+{
+ Q_Q(QQuickRangeSliderNode);
+
+ const qreal min = isFirst() || ignoreOtherPosition ? 0.0 : qMax<qreal>(0.0, slider->first()->position());
+ const qreal max = !isFirst() || ignoreOtherPosition ? 1.0 : qMin<qreal>(1.0, slider->second()->position());
+ position = qBound(min, position, max);
+ if (!qFuzzyCompare(this->position, position)) {
+ this->position = position;
+ emit q->positionChanged();
+ emit q->visualPositionChanged();
+ }
+}
+
+void QQuickRangeSliderNodePrivate::updatePosition(bool ignoreOtherPosition)
+{
+ qreal pos = 0;
+ if (!qFuzzyCompare(slider->from(), slider->to()))
+ pos = (value - slider->from()) / (slider->to() - slider->from());
+ setPosition(pos, ignoreOtherPosition);
+}
+
+QQuickRangeSliderNodePrivate *QQuickRangeSliderNodePrivate::get(QQuickRangeSliderNode *node)
+{
+ return node->d_func();
+}
+
+QQuickRangeSliderNode::QQuickRangeSliderNode(qreal value, QQuickRangeSlider *slider) :
+ QObject(*(new QQuickRangeSliderNodePrivate(value, slider)), slider)
+{
+}
+
+QQuickRangeSliderNode::~QQuickRangeSliderNode()
+{
+}
+
+qreal QQuickRangeSliderNode::value() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ return d->value;
+}
+
+void QQuickRangeSliderNode::setValue(qreal value)
+{
+ Q_D(QQuickRangeSliderNode);
+ if (!d->slider->isComponentComplete()) {
+ d->pendingValue = value;
+ d->isPendingValue = true;
+ return;
+ }
+
+ // First, restrict the first value to be within to and from.
+ const qreal smaller = qMin(d->slider->to(), d->slider->from());
+ const qreal larger = qMax(d->slider->to(), d->slider->from());
+ value = qBound(smaller, value, larger);
+
+ // Then, ensure that it doesn't go past the other value,
+ // a check that depends on whether or not the range is inverted.
+ const bool invertedRange = d->slider->from() > d->slider->to();
+ if (d->isFirst()) {
+ if (invertedRange) {
+ if (value < d->slider->second()->value())
+ value = d->slider->second()->value();
+ } else {
+ if (value > d->slider->second()->value())
+ value = d->slider->second()->value();
+ }
+ } else {
+ if (invertedRange) {
+ if (value > d->slider->first()->value())
+ value = d->slider->first()->value();
+ } else {
+ if (value < d->slider->first()->value())
+ value = d->slider->first()->value();
+ }
+ }
+
+ if (!qFuzzyCompare(d->value, value)) {
+ d->value = value;
+ d->updatePosition();
+ emit valueChanged();
+ }
+}
+
+qreal QQuickRangeSliderNode::position() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ return d->position;
+}
+
+qreal QQuickRangeSliderNode::visualPosition() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ if (d->slider->orientation() == Qt::Vertical || d->slider->isMirrored())
+ return 1.0 - d->position;
+ return d->position;
+}
+
+QQuickItem *QQuickRangeSliderNode::handle() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ return d->handle;
+}
+
+void QQuickRangeSliderNode::setHandle(QQuickItem *handle)
+{
+ Q_D(QQuickRangeSliderNode);
+ if (d->handle == handle)
+ return;
+
+ QQuickControlPrivate::get(d->slider)->deleteDelegate(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);
+ }
+ }
+
+ handle->setActiveFocusOnTab(true);
+ }
+ emit handleChanged();
+}
+
+bool QQuickRangeSliderNode::isPressed() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ return d->pressed;
+}
+
+void QQuickRangeSliderNode::setPressed(bool pressed)
+{
+ Q_D(QQuickRangeSliderNode);
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ d->slider->setAccessibleProperty("pressed", pressed || d->slider->second()->isPressed());
+ emit pressedChanged();
+}
+
+void QQuickRangeSliderNode::increase()
+{
+ Q_D(QQuickRangeSliderNode);
+ qreal step = qFuzzyIsNull(d->slider->stepSize()) ? 0.1 : d->slider->stepSize();
+ setValue(d->value + step);
+}
+
+void QQuickRangeSliderNode::decrease()
+{
+ Q_D(QQuickRangeSliderNode);
+ qreal step = qFuzzyIsNull(d->slider->stepSize()) ? 0.1 : d->slider->stepSize();
+ setValue(d->value - step);
+}
+
+static const qreal defaultFrom = 0.0;
+static const qreal defaultTo = 1.0;
+
+class QQuickRangeSliderPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickRangeSlider)
+
+public:
+ QQuickRangeSliderPrivate() :
+ from(defaultFrom),
+ to(defaultTo),
+ stepSize(0),
+ first(nullptr),
+ second(nullptr),
+ orientation(Qt::Horizontal),
+ snapMode(QQuickRangeSlider::NoSnap)
+ {
+ }
+
+ qreal from;
+ qreal to;
+ qreal stepSize;
+ QQuickRangeSliderNode *first;
+ QQuickRangeSliderNode *second;
+ QPoint pressPoint;
+ Qt::Orientation orientation;
+ QQuickRangeSlider::SnapMode snapMode;
+};
+
+static qreal valueAt(const QQuickRangeSlider *slider, qreal position)
+{
+ return slider->from() + (slider->to() - slider->from()) * position;
+}
+
+static qreal snapPosition(const QQuickRangeSlider *slider, qreal position)
+{
+ const qreal range = slider->to() - slider->from();
+ if (qFuzzyIsNull(range))
+ return position;
+
+ const qreal effectiveStep = slider->stepSize() / range;
+ if (qFuzzyIsNull(effectiveStep))
+ return position;
+
+ return qRound(position / effectiveStep) * effectiveStep;
+}
+
+static qreal positionAt(const QQuickRangeSlider *slider, QQuickItem *handle, const QPoint &point)
+{
+ if (slider->orientation() == Qt::Horizontal) {
+ const qreal hw = handle ? handle->width() : 0;
+ const qreal offset = hw / 2;
+ const qreal extent = slider->availableWidth() - hw;
+ if (!qFuzzyIsNull(extent)) {
+ if (slider->isMirrored())
+ return (slider->width() - point.x() - slider->rightPadding() - offset) / extent;
+ return (point.x() - slider->leftPadding() - offset) / extent;
+ }
+ } else {
+ const qreal hh = handle ? handle->height() : 0;
+ const qreal offset = hh / 2;
+ const qreal extent = slider->availableHeight() - hh;
+ if (!qFuzzyIsNull(extent))
+ return (slider->height() - point.y() - slider->bottomPadding() - offset) / extent;
+ }
+ return 0;
+}
+
+QQuickRangeSlider::QQuickRangeSlider(QQuickItem *parent) :
+ QQuickControl(*(new QQuickRangeSliderPrivate), parent)
+{
+ Q_D(QQuickRangeSlider);
+ d->first = new QQuickRangeSliderNode(0.0, this);
+ d->second = new QQuickRangeSliderNode(1.0, this);
+
+ setAcceptedMouseButtons(Qt::LeftButton);
+ setFlag(QQuickItem::ItemIsFocusScope);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::RangeSlider::from
+
+ This property holds the starting value for the range. The default value is \c 0.0.
+
+ \sa to, first.value, second.value
+*/
+qreal QQuickRangeSlider::from() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->from;
+}
+
+void QQuickRangeSlider::setFrom(qreal from)
+{
+ Q_D(QQuickRangeSlider);
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+
+ if (isComponentComplete()) {
+ d->first->setValue(d->first->value());
+ d->second->setValue(d->second->value());
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::RangeSlider::to
+
+ This property holds the end value for the range. The default value is \c 1.0.
+
+ \sa from, first.value, second.value
+*/
+qreal QQuickRangeSlider::to() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->to;
+}
+
+void QQuickRangeSlider::setTo(qreal to)
+{
+ Q_D(QQuickRangeSlider);
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+
+ if (isComponentComplete()) {
+ d->first->setValue(d->first->value());
+ d->second->setValue(d->second->value());
+ }
+}
+
+/*!
+ \qmlpropertygroup QtQuick.Controls::RangeSlider::first
+ \qmlproperty real QtQuick.Controls::RangeSlider::first.value
+ \qmlproperty real QtQuick.Controls::RangeSlider::first.position
+ \qmlproperty real QtQuick.Controls::RangeSlider::first.visualPosition
+ \qmlproperty Item QtQuick.Controls::RangeSlider::first.handle
+ \qmlproperty bool QtQuick.Controls::RangeSlider::first.pressed
+
+ \table
+ \header
+ \li Property
+ \li Description
+ \row
+ \li value
+ \li This property holds the value of the first handle in the range
+ \c from - \c to.
+
+ If \l to is greater than \l from, the value of the first handle
+ must be greater than the second, and vice versa.
+
+ Unlike \l {first.position}{position}, value is not updated while the
+ handle is dragged, but rather when it has been released.
+
+ The default value is \c 0.0.
+ \row
+ \li handle
+ \li This property holds the first handle item.
+ \row
+ \li visualPosition
+ \li This property holds the visual position of the first handle.
+
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
+ value is equal to \c {1.0 - position}. This makes the value suitable for
+ visualizing the slider, taking right-to-left support into account.
+ \row
+ \li position
+ \li This property holds the logical position of the first handle.
+
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike \l {first.value}{value}, position is
+ continuously updated while the handle is dragged. For visualizing a
+ slider, the right-to-left aware
+ \l {first.visualPosition}{visualPosition} should be used instead.
+ \row
+ \li pressed
+ \li This property holds whether the first handle is pressed.
+ \endtable
+
+ \sa first.increase(), first.decrease()
+*/
+QQuickRangeSliderNode *QQuickRangeSlider::first() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->first;
+}
+
+/*!
+ \qmlpropertygroup QtQuick.Controls::RangeSlider::second
+ \qmlproperty real QtQuick.Controls::RangeSlider::second.value
+ \qmlproperty real QtQuick.Controls::RangeSlider::second.position
+ \qmlproperty real QtQuick.Controls::RangeSlider::second.visualPosition
+ \qmlproperty Item QtQuick.Controls::RangeSlider::second.handle
+ \qmlproperty bool QtQuick.Controls::RangeSlider::second.pressed
+
+ \table
+ \header
+ \li Property
+ \li Description
+ \row
+ \li value
+ \li This property holds the value of the second handle in the range
+ \c from - \c to.
+
+ If \l to is greater than \l from, the value of the first handle
+ must be greater than the second, and vice versa.
+
+ Unlike \l {second.position}{position}, value is not updated while the
+ handle is dragged, but rather when it has been released.
+
+ The default value is \c 0.0.
+ \row
+ \li handle
+ \li This property holds the second handle item.
+ \row
+ \li visualPosition
+ \li This property holds the visual position of the second handle.
+
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
+ value is equal to \c {1.0 - position}. This makes the value suitable for
+ visualizing the slider, taking right-to-left support into account.
+ \row
+ \li position
+ \li This property holds the logical position of the second handle.
+
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike \l {second.value}{value}, position is
+ continuously updated while the handle is dragged. For visualizing a
+ slider, the right-to-left aware
+ \l {second.visualPosition}{visualPosition} should be used instead.
+ \row
+ \li pressed
+ \li This property holds whether the second handle is pressed.
+ \endtable
+
+ \sa second.increase(), second.decrease()
+*/
+QQuickRangeSliderNode *QQuickRangeSlider::second() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->second;
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::RangeSlider::stepSize
+
+ This property holds the step size. The default value is \c 0.0.
+
+ \sa snapMode, first.increase(), first.decrease()
+*/
+qreal QQuickRangeSlider::stepSize() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->stepSize;
+}
+
+void QQuickRangeSlider::setStepSize(qreal step)
+{
+ Q_D(QQuickRangeSlider);
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::RangeSlider::snapMode
+
+ This property holds the snap mode.
+
+ Possible values:
+ \value RangeSlider.NoSnap The slider does not snap (default).
+ \value RangeSlider.SnapAlways The slider snaps while the handle is dragged.
+ \value RangeSlider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
+
+ For visual explanations of the various modes, see the
+ \l {Slider::}{snapMode} documentation of \l Slider.
+
+ \sa stepSize
+*/
+QQuickRangeSlider::SnapMode QQuickRangeSlider::snapMode() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->snapMode;
+}
+
+void QQuickRangeSlider::setSnapMode(SnapMode mode)
+{
+ Q_D(QQuickRangeSlider);
+ if (d->snapMode == mode)
+ return;
+
+ d->snapMode = mode;
+ emit snapModeChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::RangeSlider::orientation
+
+ This property holds the orientation.
+
+ Possible values:
+ \value Qt.Horizontal Horizontal (default)
+ \value Qt.Vertical Vertical
+*/
+Qt::Orientation QQuickRangeSlider::orientation() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->orientation;
+}
+
+void QQuickRangeSlider::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickRangeSlider);
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::RangeSlider::setValues(real firstValue, real secondValue)
+
+ Sets \l first.value and \l second.value with the given arguments.
+
+ If \a to is larger than \a from and \a firstValue is larger than
+ \a secondValue, \a firstValue will be clamped to \a secondValue.
+
+ If \a from is larger than \a to and \a secondValue is larger than
+ \a firstValue, \a secondValue will be clamped to \a firstValue.
+
+ This function may be necessary to set the first and second values
+ after the control has been completed, as there is a circular
+ dependency between firstValue and secondValue which can cause
+ assigned values to be clamped to each other.
+
+ \sa stepSize
+*/
+void QQuickRangeSlider::setValues(qreal firstValue, qreal secondValue)
+{
+ Q_D(QQuickRangeSlider);
+ // Restrict the values to be within to and from.
+ const qreal smaller = qMin(d->to, d->from);
+ const qreal larger = qMax(d->to, d->from);
+ firstValue = qBound(smaller, firstValue, larger);
+ secondValue = qBound(smaller, secondValue, larger);
+
+ if (d->from > d->to) {
+ // If the from and to values are reversed, the secondValue
+ // might be less than the first value, which is not allowed.
+ if (secondValue > firstValue)
+ secondValue = firstValue;
+ } else {
+ // Otherwise, clamp first to second if it's too large.
+ if (firstValue > secondValue)
+ firstValue = secondValue;
+ }
+
+ // Then set both values. If they didn't change, no change signal will be emitted.
+ QQuickRangeSliderNodePrivate *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first);
+ if (firstValue != firstPrivate->value) {
+ firstPrivate->value = firstValue;
+ emit d->first->valueChanged();
+ }
+
+ QQuickRangeSliderNodePrivate *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second);
+ if (secondValue != secondPrivate->value) {
+ secondPrivate->value = secondValue;
+ emit d->second->valueChanged();
+ }
+
+ // After we've set both values, then we can update the positions.
+ // If we don't do this last, the positions may be incorrect.
+ firstPrivate->updatePosition(true);
+ secondPrivate->updatePosition();
+}
+
+void QQuickRangeSlider::focusInEvent(QFocusEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::focusInEvent(event);
+
+ // The active focus ends up to RangeSlider when using forceActiveFocus()
+ // or QML KeyNavigation. We must forward the focus to one of the handles,
+ // because RangeSlider handles key events for the focused handle. If
+ // neither handle has active focus, RangeSlider doesn't do anything.
+ QQuickItem *handle = nextItemInFocusChain();
+ // QQuickItem::nextItemInFocusChain() only works as desired with
+ // Qt::TabFocusAllControls. otherwise pick the first handle
+ if (!handle || handle == this)
+ handle = d->first->handle();
+ if (handle)
+ handle->forceActiveFocus(event->reason());
+}
+
+void QQuickRangeSlider::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::keyPressEvent(event);
+
+ QQuickRangeSliderNode *focusNode = d->first->handle()->hasActiveFocus()
+ ? d->first : (d->second->handle()->hasActiveFocus() ? d->second : nullptr);
+ if (!focusNode)
+ return;
+
+ if (d->orientation == Qt::Horizontal) {
+ if (event->key() == Qt::Key_Left) {
+ focusNode->setPressed(true);
+ if (isMirrored())
+ focusNode->increase();
+ else
+ focusNode->decrease();
+ event->accept();
+ } else if (event->key() == Qt::Key_Right) {
+ focusNode->setPressed(true);
+ if (isMirrored())
+ focusNode->decrease();
+ else
+ focusNode->increase();
+ event->accept();
+ }
+ } else {
+ if (event->key() == Qt::Key_Up) {
+ focusNode->setPressed(true);
+ focusNode->increase();
+ event->accept();
+ } else if (event->key() == Qt::Key_Down) {
+ focusNode->setPressed(true);
+ focusNode->decrease();
+ event->accept();
+ }
+ }
+}
+
+void QQuickRangeSlider::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::keyReleaseEvent(event);
+ d->first->setPressed(false);
+ d->second->setPressed(false);
+}
+
+void QQuickRangeSlider::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::mousePressEvent(event);
+ d->pressPoint = event->pos();
+
+ QQuickItem *firstHandle = d->first->handle();
+ 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 = nullptr;
+ QQuickRangeSliderNode *otherNode = nullptr;
+
+ if (firstHit && secondHit) {
+ // choose highest
+ hitNode = firstHandle->z() > secondHandle->z() ? d->first : d->second;
+ otherNode = firstHandle->z() > secondHandle->z() ? d->second : d->first;
+ } else if (firstHit) {
+ hitNode = d->first;
+ otherNode = d->second;
+ } else if (secondHit) {
+ hitNode = d->second;
+ otherNode = d->first;
+ } else {
+ // find the nearest
+ const qreal firstDistance = QLineF(firstHandle->boundingRect().center(),
+ mapToItem(firstHandle, event->pos())).length();
+ const qreal secondDistance = QLineF(secondHandle->boundingRect().center(),
+ mapToItem(secondHandle, event->pos())).length();
+
+ if (qFuzzyCompare(firstDistance, secondDistance)) {
+ // same distance => choose the one that can be moved towards the press position
+ const bool inverted = d->from > d->to;
+ const qreal pos = positionAt(this, firstHandle, event->pos());
+ if ((!inverted && pos < d->first->position()) || (inverted && pos > d->first->position())) {
+ hitNode = d->first;
+ otherNode = d->second;
+ } else {
+ hitNode = d->second;
+ otherNode = d->first;
+ }
+ } else if (firstDistance < secondDistance) {
+ hitNode = d->first;
+ otherNode = d->second;
+ } else {
+ hitNode = d->second;
+ otherNode = d->first;
+ }
+ }
+
+ if (hitNode) {
+ hitNode->setPressed(true);
+ hitNode->handle()->setZ(1);
+ }
+ if (otherNode)
+ otherNode->handle()->setZ(0);
+}
+
+void QQuickRangeSlider::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::mouseMoveEvent(event);
+ if (!keepMouseGrab()) {
+ if (d->orientation == Qt::Horizontal)
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event));
+ else
+ 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 : nullptr);
+ if (pressedNode) {
+ qreal pos = positionAt(this, pressedNode->handle(), event->pos());
+ if (d->snapMode == SnapAlways)
+ pos = snapPosition(this, pos);
+ QQuickRangeSliderNodePrivate::get(pressedNode)->setPosition(pos);
+ }
+ }
+}
+
+void QQuickRangeSlider::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::mouseReleaseEvent(event);
+
+ d->pressPoint = QPoint();
+ if (!keepMouseGrab())
+ return;
+
+ QQuickRangeSliderNode *pressedNode = d->first->isPressed() ? d->first : (d->second->isPressed() ? d->second : nullptr);
+ if (!pressedNode)
+ return;
+
+ qreal pos = positionAt(this, pressedNode->handle(), event->pos());
+ if (d->snapMode != NoSnap)
+ pos = snapPosition(this, pos);
+ qreal val = valueAt(this, pos);
+ if (!qFuzzyCompare(val, pressedNode->value()))
+ pressedNode->setValue(val);
+ else if (d->snapMode != NoSnap)
+ QQuickRangeSliderNodePrivate::get(pressedNode)->setPosition(pos);
+ setKeepMouseGrab(false);
+ pressedNode->setPressed(false);
+}
+
+void QQuickRangeSlider::mouseUngrabEvent()
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::mouseUngrabEvent();
+ d->pressPoint = QPoint();
+ d->first->setPressed(false);
+ d->second->setPressed(false);
+}
+
+void QQuickRangeSlider::mirrorChange()
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::mirrorChange();
+ emit d->first->visualPositionChanged();
+ emit d->second->visualPositionChanged();
+}
+
+void QQuickRangeSlider::componentComplete()
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::componentComplete();
+
+ QQuickRangeSliderNodePrivate *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first);
+ QQuickRangeSliderNodePrivate *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second);
+
+ if (firstPrivate->isPendingValue || secondPrivate->isPendingValue
+ || !qFuzzyCompare(d->from, defaultFrom) || !qFuzzyCompare(d->to, defaultTo)) {
+ // Properties were set while we were loading. To avoid clamping issues that occur when setting the
+ // values of first and second overriding values set by the user, set them all at once at the end.
+ // Another reason that we must set these values here is that the from and to values might have made the old range invalid.
+ setValues(firstPrivate->isPendingValue ? firstPrivate->pendingValue : firstPrivate->value,
+ secondPrivate->isPendingValue ? secondPrivate->pendingValue : secondPrivate->value);
+
+ firstPrivate->pendingValue = 0;
+ firstPrivate->isPendingValue = false;
+ secondPrivate->pendingValue = 0;
+ secondPrivate->isPendingValue = false;
+ } else {
+ // If there was no pending data, we must still update the positions,
+ // as first.setValue()/second.setValue() won't be called as part of default construction.
+ // Don't need to ignore the second position when updating the first position here,
+ // as our default values are guaranteed to be valid.
+ firstPrivate->updatePosition();
+ secondPrivate->updatePosition();
+ }
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::RangeSlider::first.increase()
+
+ Increases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
+
+ \sa first
+*/
+
+/*!
+ \qmlmethod void QtQuick.Controls::RangeSlider::first.decrease()
+
+ Decreases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
+
+ \sa first
+*/
+
+/*!
+ \qmlmethod void QtQuick.Controls::RangeSlider::second.increase()
+
+ Increases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
+
+ \sa second
+*/
+
+/*!
+ \qmlmethod void QtQuick.Controls::RangeSlider::second.decrease()
+
+ Decreases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
+
+ \sa second
+*/
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickRangeSlider::accessibleRole() const
+{
+ return QAccessible::Slider;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h
new file mode 100644
index 00000000..4c2eb4bb
--- /dev/null
+++ b/src/quicktemplates2/qquickrangeslider_p.h
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKRANGESLIDER_P_H
+#define QQUICKRANGESLIDER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickRangeSliderPrivate;
+class QQuickRangeSliderNode;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSlider : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(QQuickRangeSliderNode *first READ first CONSTANT)
+ Q_PROPERTY(QQuickRangeSliderNode *second READ second CONSTANT)
+ Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
+ Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+
+public:
+ explicit QQuickRangeSlider(QQuickItem *parent = nullptr);
+
+ qreal from() const;
+ void setFrom(qreal from);
+
+ qreal to() const;
+ void setTo(qreal to);
+
+ QQuickRangeSliderNode *first() const;
+ QQuickRangeSliderNode *second() const;
+
+ qreal stepSize() const;
+ void setStepSize(qreal step);
+
+ enum SnapMode {
+ NoSnap,
+ SnapAlways,
+ SnapOnRelease
+ };
+ Q_ENUM(SnapMode)
+
+ SnapMode snapMode() const;
+ void setSnapMode(SnapMode mode);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue);
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void stepSizeChanged();
+ void snapModeChanged();
+ void orientationChanged();
+
+protected:
+ void focusInEvent(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 mirrorChange() override;
+ void componentComplete() override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ friend class QQuickRangeSliderNode;
+
+ Q_DISABLE_COPY(QQuickRangeSlider)
+ Q_DECLARE_PRIVATE(QQuickRangeSlider)
+};
+
+class QQuickRangeSliderNodePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSliderNode : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+ Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+
+public:
+ explicit QQuickRangeSliderNode(qreal value, QQuickRangeSlider *slider);
+ ~QQuickRangeSliderNode();
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal position() const;
+ qreal visualPosition() const;
+
+ QQuickItem *handle() const;
+ void setHandle(QQuickItem *handle);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+public Q_SLOTS:
+ void increase();
+ void decrease();
+
+Q_SIGNALS:
+ void valueChanged();
+ void positionChanged();
+ void visualPositionChanged();
+ void handleChanged();
+ void pressedChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickRangeSliderNode)
+ Q_DECLARE_PRIVATE(QQuickRangeSliderNode)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickRangeSlider)
+
+#endif // QQUICKRANGESLIDER_P_H
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
new file mode 100644
index 00000000..7ac1df34
--- /dev/null
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -0,0 +1,717 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickscrollbar_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ScrollBar
+ \inherits Control
+ \instantiates QQuickScrollBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-indicators
+ \brief Vertical or horizontal interactive scroll bar.
+
+ \image qtquickcontrols2-scrollbar.gif
+
+ ScrollBar is an interactive bar that can be used to scroll to a specific
+ position. A scroll bar can be either \l vertical or \l horizontal, and can
+ be attached to any \l Flickable, such as \l ListView and \l GridView.
+
+ \code
+ Flickable {
+ // ...
+ ScrollBar.vertical: ScrollBar { }
+ }
+ \endcode
+
+ \section1 Attaching ScrollBar to a Flickable
+
+ When ScrollBar is attached \l {ScrollBar::vertical}{vertically} or
+ \l {ScrollBar::horizontal}{horizontally} to a Flickable, its geometry and
+ the following properties are automatically set and updated as appropriate:
+
+ \list
+ \li \l orientation
+ \li \l position
+ \li \l size
+ \li \l active
+ \endlist
+
+ An attached ScrollBar re-parents itself to the target Flickable. A vertically
+ attached ScrollBar resizes itself to the height of the Flickable, and positions
+ itself to either side of it based on the \l {Control::mirrored}{layout direction}.
+ A horizontally attached ScrollBar resizes itself to the width of the Flickable,
+ and positions itself to the bottom. The automatic geometry management can be disabled
+ by specifying another parent for the attached ScrollBar. This can be useful, for
+ example, if the ScrollBar should be placed outside a clipping Flickable. This is
+ demonstrated by the following example:
+
+ \code
+ Flickable {
+ id: flickable
+ clip: true
+ // ...
+ ScrollBar.vertical: ScrollBar {
+ parent: flickable.parent
+ anchors.top: flickable.top
+ anchors.left: flickable.right
+ anchors.bottom: flickable.bottom
+ }
+ }
+ \endcode
+
+ Notice that ScrollBar does not filter key events of the Flickable it is
+ attached to. The following example illustrates how to implement scrolling
+ with up and down keys:
+
+ \code
+ Flickable {
+ focus: true
+
+ Keys.onUpPressed: scrollBar.decrease()
+ Keys.onDownPressed: scrollBar.increase()
+
+ ScrollBar.vertical: ScrollBar { id: scrollBar }
+ }
+ \endcode
+
+ \section1 Binding the Active State of Horizontal and Vertical Scroll Bars
+
+ Horizontal and vertical scroll bars do not share the \l active state with
+ each other by default. In order to keep both bars visible whilst scrolling
+ to either direction, establish a two-way binding between the active states
+ as presented by the following example:
+
+ \snippet qtquickcontrols2-scrollbar-active.qml 1
+
+ \section1 Non-attached Scroll Bars
+
+ It is possible to create an instance of ScrollBar without using the
+ attached property API. This is useful when the behavior of the attached
+ scoll bar is not sufficient or a \l Flickable is not in use. In the
+ following example, horizontal and vertical scroll bars are used to
+ scroll over the text without using \l Flickable:
+
+ \snippet qtquickcontrols2-scrollbar-non-attached.qml 1
+
+ \image qtquickcontrols2-scrollbar-non-attached.png
+
+ When using a non-attached ScrollBar, the following must be done manually:
+
+ \list
+ \li Layout the scroll bar (with the \l {Item::}{x} and \l {Item::}{y} or
+ \l {Item::anchors}{anchor} properties, for example).
+ \li Set the \l size and \l position properties to determine the size and position
+ of the scroll bar in relation to the scrolled item.
+ \li Set the \l active property to determine when the scroll bar will be
+ visible.
+ \endlist
+
+ \sa ScrollIndicator, {Customizing ScrollBar}, {Indicator Controls}
+*/
+
+class QQuickScrollBarPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickScrollBar)
+
+public:
+ QQuickScrollBarPrivate() : size(0), position(0), stepSize(0), offset(0),
+ active(false), pressed(false), moving(false),
+ orientation(Qt::Vertical)
+ {
+ }
+
+ static QQuickScrollBarPrivate *get(QQuickScrollBar *bar)
+ {
+ return bar->d_func();
+ }
+
+ qreal positionAt(const QPoint &point) const;
+
+ void resizeContent() override;
+
+ qreal size;
+ qreal position;
+ qreal stepSize;
+ qreal offset;
+ bool active;
+ bool pressed;
+ bool moving;
+ Qt::Orientation orientation;
+};
+
+qreal QQuickScrollBarPrivate::positionAt(const QPoint &point) const
+{
+ Q_Q(const QQuickScrollBar);
+ if (orientation == Qt::Horizontal)
+ return (point.x() - q->leftPadding()) / q->availableWidth();
+ else
+ return (point.y() - q->topPadding()) / q->availableHeight();
+}
+
+void QQuickScrollBarPrivate::resizeContent()
+{
+ Q_Q(QQuickScrollBar);
+ if (!contentItem)
+ return;
+
+ if (orientation == Qt::Horizontal) {
+ contentItem->setPosition(QPointF(q->leftPadding() + position * q->availableWidth(), q->topPadding()));
+ contentItem->setSize(QSizeF(q->availableWidth() * size, q->availableHeight()));
+ } else {
+ contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding() + position * q->availableHeight()));
+ contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight() * size));
+ }
+}
+
+QQuickScrollBar::QQuickScrollBar(QQuickItem *parent) :
+ QQuickControl(*(new QQuickScrollBarPrivate), parent)
+{
+ setKeepMouseGrab(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+QQuickScrollBarAttached *QQuickScrollBar::qmlAttachedProperties(QObject *object)
+{
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(object);
+ if (!flickable)
+ qmlInfo(object) << "ScrollBar must be attached to a Flickable";
+
+ return new QQuickScrollBarAttached(flickable);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ScrollBar::size
+
+ This property holds the size of the scroll bar, scaled to \c {0.0 - 1.0}.
+
+ \sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
+*/
+qreal QQuickScrollBar::size() const
+{
+ Q_D(const QQuickScrollBar);
+ return d->size;
+}
+
+void QQuickScrollBar::setSize(qreal size)
+{
+ Q_D(QQuickScrollBar);
+ size = qBound<qreal>(0.0, size, 1.0 - d->position);
+ if (qFuzzyCompare(d->size, size))
+ return;
+
+ d->size = size;
+ if (isComponentComplete())
+ d->resizeContent();
+ emit sizeChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ScrollBar::position
+
+ This property holds the position of the scroll bar, scaled to \c {0.0 - 1.0}.
+
+ \sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
+*/
+qreal QQuickScrollBar::position() const
+{
+ Q_D(const QQuickScrollBar);
+ return d->position;
+}
+
+void QQuickScrollBar::setPosition(qreal position)
+{
+ Q_D(QQuickScrollBar);
+ position = qBound<qreal>(0.0, position, 1.0 - d->size);
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ if (isComponentComplete())
+ d->resizeContent();
+ emit positionChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ScrollBar::stepSize
+
+ This property holds the step size. The default value is \c 0.0.
+
+ \sa increase(), decrease()
+*/
+qreal QQuickScrollBar::stepSize() const
+{
+ Q_D(const QQuickScrollBar);
+ return d->stepSize;
+}
+
+void QQuickScrollBar::setStepSize(qreal step)
+{
+ Q_D(QQuickScrollBar);
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::ScrollBar::active
+
+ This property holds whether the scroll bar is active, i.e. when it's \l pressed
+ or the attached Flickable is \l {Flickable::moving}{moving}.
+
+ It is possible to keep \l {Binding the Active State of Horizontal and Vertical Scroll Bars}
+ {both horizontal and vertical bars visible} while scrolling in either direction.
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
+*/
+bool QQuickScrollBar::isActive() const
+{
+ Q_D(const QQuickScrollBar);
+ return d->active;
+}
+
+void QQuickScrollBar::setActive(bool active)
+{
+ Q_D(QQuickScrollBar);
+ if (d->active == active)
+ return;
+
+ d->active = active;
+ emit activeChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::ScrollBar::pressed
+
+ This property holds whether the scroll bar is pressed.
+*/
+bool QQuickScrollBar::isPressed() const
+{
+ Q_D(const QQuickScrollBar);
+ return d->pressed;
+}
+
+void QQuickScrollBar::setPressed(bool pressed)
+{
+ Q_D(QQuickScrollBar);
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ setAccessibleProperty("pressed", pressed);
+ setActive(d->pressed || d->moving);
+ emit pressedChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::ScrollBar::orientation
+
+ This property holds the orientation of the scroll bar.
+
+ Possible values:
+ \value Qt.Horizontal Horizontal
+ \value Qt.Vertical Vertical (default)
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
+*/
+Qt::Orientation QQuickScrollBar::orientation() const
+{
+ Q_D(const QQuickScrollBar);
+ return d->orientation;
+}
+
+void QQuickScrollBar::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickScrollBar);
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ if (isComponentComplete())
+ d->resizeContent();
+ emit orientationChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::ScrollBar::increase()
+
+ Increases the position by \l stepSize or \c 0.1 if stepSize is \c 0.0.
+
+ \sa stepSize
+*/
+void QQuickScrollBar::increase()
+{
+ Q_D(QQuickScrollBar);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ bool wasActive = d->active;
+ setActive(true);
+ setPosition(d->position + step);
+ setActive(wasActive);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::ScrollBar::decrease()
+
+ Decreases the position by \l stepSize or \c 0.1 if stepSize is \c 0.0.
+
+ \sa stepSize
+*/
+void QQuickScrollBar::decrease()
+{
+ Q_D(QQuickScrollBar);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ bool wasActive = d->active;
+ setActive(true);
+ setPosition(d->position - step);
+ setActive(wasActive);
+}
+
+void QQuickScrollBar::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickScrollBar);
+ QQuickControl::mousePressEvent(event);
+ d->offset = d->positionAt(event->pos()) - d->position;
+ if (d->offset < 0 || d->offset > d->size)
+ d->offset = d->size / 2;
+ setPressed(true);
+}
+
+void QQuickScrollBar::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickScrollBar);
+ QQuickControl::mouseMoveEvent(event);
+ setPosition(qBound<qreal>(0.0, d->positionAt(event->pos()) - d->offset, 1.0 - d->size));
+}
+
+void QQuickScrollBar::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickScrollBar);
+ QQuickControl::mouseReleaseEvent(event);
+ setPosition(qBound<qreal>(0.0, d->positionAt(event->pos()) - d->offset, 1.0 - d->size));
+ d->offset = 0.0;
+ setPressed(false);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickScrollBar::accessibilityActiveChanged(bool active)
+{
+ QQuickControl::accessibilityActiveChanged(active);
+
+ Q_D(QQuickScrollBar);
+ if (active)
+ setAccessibleProperty("pressed", d->pressed);
+}
+
+QAccessible::Role QQuickScrollBar::accessibleRole() const
+{
+ return QAccessible::ScrollBar;
+}
+#endif
+
+class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+public:
+ QQuickScrollBarAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(nullptr), vertical(nullptr) { }
+
+ void activateHorizontal();
+ void activateVertical();
+ void scrollHorizontal();
+ void scrollVertical();
+ void mirrorVertical();
+
+ void layoutHorizontal(bool move = true);
+ void layoutVertical(bool move = true);
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemDestroyed(QQuickItem *item) override;
+
+ QQuickFlickable *flickable;
+ QQuickScrollBar *horizontal;
+ QQuickScrollBar *vertical;
+};
+
+void QQuickScrollBarAttachedPrivate::activateHorizontal()
+{
+ QQuickScrollBarPrivate *p = QQuickScrollBarPrivate::get(horizontal);
+ p->moving = flickable->isMovingHorizontally();
+ horizontal->setActive(p->moving || p->pressed);
+}
+
+void QQuickScrollBarAttachedPrivate::activateVertical()
+{
+ QQuickScrollBarPrivate *p = QQuickScrollBarPrivate::get(vertical);
+ p->moving = flickable->isMovingVertically();
+ vertical->setActive(p->moving || p->pressed);
+}
+
+// TODO: QQuickFlickable::maxXYExtent()
+class QQuickFriendlyFlickable : public QQuickFlickable
+{
+ friend class QQuickScrollBarAttachedPrivate;
+};
+
+void QQuickScrollBarAttachedPrivate::scrollHorizontal()
+{
+ QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
+
+ const qreal viewwidth = f->width();
+ const qreal maxxextent = -f->maxXExtent() + f->minXExtent();
+ qreal cx = horizontal->position() * (maxxextent + viewwidth) - f->minXExtent();
+ if (!qIsNaN(cx) && !qFuzzyCompare(cx, flickable->contentX()))
+ flickable->setContentX(cx);
+}
+
+void QQuickScrollBarAttachedPrivate::scrollVertical()
+{
+ QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
+
+ const qreal viewheight = f->height();
+ const qreal maxyextent = -f->maxYExtent() + f->minYExtent();
+ qreal cy = vertical->position() * (maxyextent + viewheight) - f->minYExtent();
+ if (!qIsNaN(cy) && !qFuzzyCompare(cy, flickable->contentY()))
+ flickable->setContentY(cy);
+}
+
+void QQuickScrollBarAttachedPrivate::mirrorVertical()
+{
+ layoutVertical(true);
+}
+
+void QQuickScrollBarAttachedPrivate::layoutHorizontal(bool move)
+{
+ Q_ASSERT(horizontal && flickable);
+ if (horizontal->parentItem() != flickable)
+ return;
+ horizontal->setWidth(flickable->width());
+ if (move)
+ horizontal->setY(flickable->height() - horizontal->height());
+}
+
+void QQuickScrollBarAttachedPrivate::layoutVertical(bool move)
+{
+ Q_ASSERT(vertical && flickable);
+ if (vertical->parentItem() != flickable)
+ return;
+ vertical->setHeight(flickable->height());
+ if (move)
+ vertical->setX(vertical->isMirrored() ? 0 : flickable->width() - vertical->width());
+}
+
+void QQuickScrollBarAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_UNUSED(item);
+ Q_UNUSED(newGeometry);
+ if (horizontal && horizontal->height() > 0) {
+ bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
+ layoutHorizontal(move);
+ }
+ if (vertical && vertical->width() > 0) {
+ bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
+ layoutVertical(move);
+ }
+}
+
+void QQuickScrollBarAttachedPrivate::itemDestroyed(QQuickItem *item)
+{
+ if (item == horizontal)
+ horizontal = nullptr;
+ if (item == vertical)
+ vertical = nullptr;
+}
+
+QQuickScrollBarAttached::QQuickScrollBarAttached(QQuickFlickable *flickable) :
+ QObject(*(new QQuickScrollBarAttachedPrivate(flickable)), flickable)
+{
+ Q_D(QQuickScrollBarAttached);
+ if (flickable) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
+ p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ }
+}
+
+QQuickScrollBarAttached::~QQuickScrollBarAttached()
+{
+ Q_D(QQuickScrollBarAttached);
+ if (d->flickable) {
+ if (d->horizontal)
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ if (d->vertical)
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ QQuickItemPrivate::get(d->flickable)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ }
+}
+
+/*!
+ \qmlattachedproperty ScrollBar QtQuick.Controls::ScrollBar::horizontal
+
+ This property attaches a horizontal scroll bar to a \l Flickable.
+
+ \code
+ Flickable {
+ contentWidth: 2000
+ ScrollBar.horizontal: ScrollBar { }
+ }
+ \endcode
+
+ \sa {Attaching ScrollBar to a Flickable}
+*/
+QQuickScrollBar *QQuickScrollBarAttached::horizontal() const
+{
+ Q_D(const QQuickScrollBarAttached);
+ return d->horizontal;
+}
+
+void QQuickScrollBarAttached::setHorizontal(QQuickScrollBar *horizontal)
+{
+ Q_D(QQuickScrollBarAttached);
+ if (d->horizontal == horizontal)
+ return;
+
+ if (d->horizontal && d->flickable) {
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ 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 && d->flickable) {
+ if (!horizontal->parentItem())
+ horizontal->setParentItem(d->flickable);
+ horizontal->setOrientation(Qt::Horizontal);
+
+ QQuickItemPrivate::get(horizontal)->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ 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();
+}
+
+/*!
+ \qmlattachedproperty ScrollBar QtQuick.Controls::ScrollBar::vertical
+
+ This property attaches a vertical scroll bar to a \l Flickable.
+
+ \code
+ Flickable {
+ contentHeight: 2000
+ ScrollBar.vertical: ScrollBar { }
+ }
+ \endcode
+
+ \sa {Attaching ScrollBar to a Flickable}
+*/
+QQuickScrollBar *QQuickScrollBarAttached::vertical() const
+{
+ Q_D(const QQuickScrollBarAttached);
+ return d->vertical;
+}
+
+void QQuickScrollBarAttached::setVertical(QQuickScrollBar *vertical)
+{
+ Q_D(QQuickScrollBarAttached);
+ if (d->vertical == vertical)
+ return;
+
+ if (d->vertical && d->flickable) {
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ QObjectPrivate::disconnect(d->vertical, &QQuickScrollBar::mirroredChanged, d, &QQuickScrollBarAttachedPrivate::mirrorVertical);
+ 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 && d->flickable) {
+ if (!vertical->parentItem())
+ vertical->setParentItem(d->flickable);
+ vertical->setOrientation(Qt::Vertical);
+
+ QQuickItemPrivate::get(vertical)->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ QObjectPrivate::connect(vertical, &QQuickScrollBar::mirroredChanged, d, &QQuickScrollBarAttachedPrivate::mirrorVertical);
+ 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/quicktemplates2/qquickscrollbar_p.h b/src/quicktemplates2/qquickscrollbar_p.h
new file mode 100644
index 00000000..8feba604
--- /dev/null
+++ b/src/quicktemplates2/qquickscrollbar_p.h
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSCROLLBAR_P_H
+#define QQUICKSCROLLBAR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFlickable;
+class QQuickScrollBarAttached;
+class QQuickScrollBarPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollBar : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal size READ size WRITE setSize NOTIFY sizeChanged FINAL)
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
+ Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+
+public:
+ explicit QQuickScrollBar(QQuickItem *parent = nullptr);
+
+ static QQuickScrollBarAttached *qmlAttachedProperties(QObject *object);
+
+ qreal size() const;
+ qreal position() const;
+
+ qreal stepSize() const;
+ void setStepSize(qreal step);
+
+ bool isActive() const;
+ void setActive(bool active);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+public Q_SLOTS:
+ void increase();
+ void decrease();
+ void setSize(qreal size);
+ void setPosition(qreal position);
+
+Q_SIGNALS:
+ void sizeChanged();
+ void positionChanged();
+ void stepSizeChanged();
+ void activeChanged();
+ void pressedChanged();
+ void orientationChanged();
+
+protected:
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickScrollBar)
+ Q_DECLARE_PRIVATE(QQuickScrollBar)
+};
+
+class QQuickScrollBarAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollBarAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickScrollBar *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
+ Q_PROPERTY(QQuickScrollBar *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
+
+public:
+ explicit QQuickScrollBarAttached(QQuickFlickable *flickable);
+ ~QQuickScrollBarAttached();
+
+ QQuickScrollBar *horizontal() const;
+ void setHorizontal(QQuickScrollBar *horizontal);
+
+ QQuickScrollBar *vertical() const;
+ void setVertical(QQuickScrollBar *vertical);
+
+Q_SIGNALS:
+ void horizontalChanged();
+ void verticalChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickScrollBarAttached)
+ Q_DECLARE_PRIVATE(QQuickScrollBarAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickScrollBar)
+QML_DECLARE_TYPEINFO(QQuickScrollBar, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKSCROLLBAR_P_H
diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp
new file mode 100644
index 00000000..7d93215d
--- /dev/null
+++ b/src/quicktemplates2/qquickscrollindicator.cpp
@@ -0,0 +1,511 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickscrollindicator_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ScrollIndicator
+ \inherits Control
+ \instantiates QQuickScrollIndicator
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-indicators
+ \brief Vertical or horizontal non-interactive scroll indicator.
+
+ \image qtquickcontrols2-scrollindicator.gif
+
+ ScrollIndicator is a non-interactive indicator that indicates the current scroll
+ position. A scroll indicator can be either \l vertical or \l horizontal, and can
+ be attached to any \l Flickable, such as \l ListView and \l GridView.
+
+ \code
+ Flickable {
+ // ...
+ ScrollIndicator.vertical: ScrollIndicator { }
+ }
+ \endcode
+
+ \section1 Attaching ScrollIndicator to a Flickable
+
+ \note When ScrollIndicator is attached \l {ScrollIndicator::vertical}{vertically}
+ or \l {ScrollIndicator::horizontal}{horizontally} to a Flickable, its geometry and
+ the following properties are automatically set and updated as appropriate:
+
+ \list
+ \li \l orientation
+ \li \l position
+ \li \l size
+ \li \l active
+ \endlist
+
+ An attached ScrollIndicator re-parents itself to the target Flickable. A vertically
+ attached ScrollIndicator resizes itself to the height of the Flickable, and positions
+ itself to either side of it based on the \l {Control::mirrored}{layout direction}.
+ A horizontally attached ScrollIndicator resizes itself to the width of the Flickable,
+ and positions itself to the bottom. The automatic geometry management can be disabled
+ by specifying another parent for the attached ScrollIndicator. This can be useful, for
+ example, if the ScrollIndicator should be placed outside a clipping Flickable. This is
+ demonstrated by the following example:
+
+ \code
+ Flickable {
+ id: flickable
+ clip: true
+ // ...
+ ScrollIndicator.vertical: ScrollIndicator {
+ parent: flickable.parent
+ anchors.top: flickable.top
+ anchors.left: flickable.right
+ anchors.bottom: flickable.bottom
+ }
+ }
+ \endcode
+
+ \section1 Binding the Active State of Horizontal and Vertical Scroll Indicators
+
+ Horizontal and vertical scroll indicators do not share the \l active state with
+ each other by default. In order to keep both indicators visible whilst scrolling
+ to either direction, establish a two-way binding between the active states as
+ presented by the following example:
+
+ \snippet qtquickcontrols2-scrollindicator-active.qml 1
+
+ \section1 Non-attached Scroll Indicators
+
+ It is possible to create an instance of ScrollIndicator without using the
+ attached property API. This is useful when the behavior of the attached
+ scoll indicator is not sufficient or a \l Flickable is not in use. In the
+ following example, horizontal and vertical scroll indicators are used to
+ indicate how far the user has scrolled over the text (using \l MouseArea
+ instead of \l Flickable):
+
+ \snippet qtquickcontrols2-scrollindicator-non-attached.qml 1
+
+ \image qtquickcontrols2-scrollindicator-non-attached.png
+
+ \sa ScrollBar, {Customizing ScrollIndicator}, {Indicator Controls}
+*/
+
+class QQuickScrollIndicatorPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickScrollIndicator)
+
+public:
+ QQuickScrollIndicatorPrivate() : size(0), position(0),
+ active(false), orientation(Qt::Vertical)
+ {
+ }
+
+ void resizeContent() override;
+
+ qreal size;
+ qreal position;
+ bool active;
+ Qt::Orientation orientation;
+};
+
+void QQuickScrollIndicatorPrivate::resizeContent()
+{
+ Q_Q(QQuickScrollIndicator);
+ if (!contentItem)
+ return;
+
+ // - negative overshoot (pos < 0): clamp the pos to 0, and deduct the overshoot from the size
+ // - positive overshoot (pos + size > 1): clamp the size to 1-pos
+ const qreal clampedSize = qBound<qreal>(0, size + qMin<qreal>(0, position), 1.0 - position);
+ const qreal clampedPos = qBound<qreal>(0, position, 1.0 - clampedSize);
+
+ if (orientation == Qt::Horizontal) {
+ contentItem->setPosition(QPointF(q->leftPadding() + clampedPos * q->availableWidth(), q->topPadding()));
+ contentItem->setSize(QSizeF(q->availableWidth() * clampedSize, q->availableHeight()));
+ } else {
+ contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding() + clampedPos * q->availableHeight()));
+ contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight() * clampedSize));
+ }
+}
+
+QQuickScrollIndicator::QQuickScrollIndicator(QQuickItem *parent) :
+ QQuickControl(*(new QQuickScrollIndicatorPrivate), parent)
+{
+}
+
+QQuickScrollIndicatorAttached *QQuickScrollIndicator::qmlAttachedProperties(QObject *object)
+{
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(object);
+ if (!flickable)
+ qmlInfo(object) << "ScrollIndicator must be attached to a Flickable";
+
+ return new QQuickScrollIndicatorAttached(flickable);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ScrollIndicator::size
+
+ This property holds the size of the indicator, scaled to \c {0.0 - 1.0}.
+
+ \sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
+*/
+qreal QQuickScrollIndicator::size() const
+{
+ Q_D(const QQuickScrollIndicator);
+ return d->size;
+}
+
+void QQuickScrollIndicator::setSize(qreal size)
+{
+ Q_D(QQuickScrollIndicator);
+ if (qFuzzyCompare(d->size, size))
+ return;
+
+ d->size = size;
+ if (isComponentComplete())
+ d->resizeContent();
+ emit sizeChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::ScrollIndicator::position
+
+ This property holds the position of the indicator, scaled to \c {0.0 - 1.0}.
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
+
+ \sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
+*/
+qreal QQuickScrollIndicator::position() const
+{
+ Q_D(const QQuickScrollIndicator);
+ return d->position;
+}
+
+void QQuickScrollIndicator::setPosition(qreal position)
+{
+ Q_D(QQuickScrollIndicator);
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ if (isComponentComplete())
+ d->resizeContent();
+ emit positionChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::ScrollIndicator::active
+
+ This property holds whether the indicator is active, that is, when the
+ attached Flickable is \l {Flickable::moving}{moving}.
+
+ It is possible to keep \l {Binding the Active State of Horizontal and Vertical Scroll Indicators}
+ {both horizontal and vertical indicators visible} while scrolling in either direction.
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
+*/
+bool QQuickScrollIndicator::isActive() const
+{
+ Q_D(const QQuickScrollIndicator);
+ return d->active;
+}
+
+void QQuickScrollIndicator::setActive(bool active)
+{
+ Q_D(QQuickScrollIndicator);
+ if (d->active == active)
+ return;
+
+ d->active = active;
+ emit activeChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::ScrollIndicator::orientation
+
+ This property holds the orientation of the indicator.
+
+ Possible values:
+ \value Qt.Horizontal Horizontal
+ \value Qt.Vertical Vertical (default)
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
+*/
+Qt::Orientation QQuickScrollIndicator::orientation() const
+{
+ Q_D(const QQuickScrollIndicator);
+ return d->orientation;
+}
+
+void QQuickScrollIndicator::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickScrollIndicator);
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ if (isComponentComplete())
+ d->resizeContent();
+ emit orientationChanged();
+}
+
+class QQuickScrollIndicatorAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+public:
+ QQuickScrollIndicatorAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(nullptr), vertical(nullptr) { }
+
+ void activateHorizontal();
+ void activateVertical();
+
+ void layoutHorizontal(bool move = true);
+ void layoutVertical(bool move = true);
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemDestroyed(QQuickItem *item) override;
+
+ QQuickFlickable *flickable;
+ QQuickScrollIndicator *horizontal;
+ QQuickScrollIndicator *vertical;
+};
+
+void QQuickScrollIndicatorAttachedPrivate::activateHorizontal()
+{
+ horizontal->setActive(flickable->isMovingHorizontally());
+}
+
+void QQuickScrollIndicatorAttachedPrivate::activateVertical()
+{
+ vertical->setActive(flickable->isMovingVertically());
+}
+
+void QQuickScrollIndicatorAttachedPrivate::layoutHorizontal(bool move)
+{
+ Q_ASSERT(horizontal && flickable);
+ if (horizontal->parentItem() != flickable)
+ return;
+ horizontal->setWidth(flickable->width());
+ if (move)
+ horizontal->setY(flickable->height() - horizontal->height());
+}
+
+void QQuickScrollIndicatorAttachedPrivate::layoutVertical(bool move)
+{
+ Q_ASSERT(vertical && flickable);
+ if (vertical->parentItem() != flickable)
+ return;
+ vertical->setHeight(flickable->height());
+ if (move && !QQuickItemPrivate::get(vertical)->isMirrored())
+ vertical->setX(flickable->width() - vertical->width());
+}
+
+void QQuickScrollIndicatorAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_UNUSED(item);
+ Q_UNUSED(newGeometry);
+ if (horizontal && horizontal->height() > 0) {
+ bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
+ layoutHorizontal(move);
+ }
+ if (vertical && vertical->width() > 0) {
+ bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
+ layoutVertical(move);
+ }
+}
+
+void QQuickScrollIndicatorAttachedPrivate::itemDestroyed(QQuickItem *item)
+{
+ if (item == horizontal)
+ horizontal = nullptr;
+ if (item == vertical)
+ vertical = nullptr;
+}
+
+QQuickScrollIndicatorAttached::QQuickScrollIndicatorAttached(QQuickFlickable *flickable) :
+ QObject(*(new QQuickScrollIndicatorAttachedPrivate(flickable)), flickable)
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (flickable) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
+ p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ }
+}
+
+QQuickScrollIndicatorAttached::~QQuickScrollIndicatorAttached()
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (d->flickable) {
+ if (d->horizontal)
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ if (d->vertical)
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d,QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ QQuickItemPrivate::get(d->flickable)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ }
+}
+
+/*!
+ \qmlattachedproperty ScrollIndicator QtQuick.Controls::ScrollIndicator::horizontal
+
+ This property attaches a horizontal scroll indicator to a \l Flickable.
+
+ \code
+ Flickable {
+ contentWidth: 2000
+ ScrollIndicator.horizontal: ScrollIndicator { }
+ }
+ \endcode
+
+ \sa {Attaching ScrollIndicator to a Flickable}
+*/
+QQuickScrollIndicator *QQuickScrollIndicatorAttached::horizontal() const
+{
+ Q_D(const QQuickScrollIndicatorAttached);
+ return d->horizontal;
+}
+
+void QQuickScrollIndicatorAttached::setHorizontal(QQuickScrollIndicator *horizontal)
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (d->horizontal == horizontal)
+ return;
+
+ if (d->horizontal && d->flickable) {
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ 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 && d->flickable) {
+ if (!horizontal->parentItem())
+ horizontal->setParentItem(d->flickable);
+ horizontal->setOrientation(Qt::Horizontal);
+
+ QQuickItemPrivate::get(horizontal)->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ 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();
+}
+
+/*!
+ \qmlattachedproperty ScrollIndicator QtQuick.Controls::ScrollIndicator::vertical
+
+ This property attaches a vertical scroll indicator to a \l Flickable.
+
+ \code
+ Flickable {
+ contentHeight: 2000
+ ScrollIndicator.vertical: ScrollIndicator { }
+ }
+ \endcode
+
+ \sa {Attaching ScrollIndicator to a Flickable}
+*/
+QQuickScrollIndicator *QQuickScrollIndicatorAttached::vertical() const
+{
+ Q_D(const QQuickScrollIndicatorAttached);
+ return d->vertical;
+}
+
+void QQuickScrollIndicatorAttached::setVertical(QQuickScrollIndicator *vertical)
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (d->vertical == vertical)
+ return;
+
+ if (d->vertical && d->flickable) {
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ 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 && d->flickable) {
+ if (!vertical->parentItem())
+ vertical->setParentItem(d->flickable);
+ vertical->setOrientation(Qt::Vertical);
+
+ QQuickItemPrivate::get(vertical)->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Destroyed);
+ 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
+QAccessible::Role QQuickScrollIndicator::accessibleRole() const
+{
+ return QAccessible::Indicator;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickscrollindicator_p.h b/src/quicktemplates2/qquickscrollindicator_p.h
new file mode 100644
index 00000000..1e120928
--- /dev/null
+++ b/src/quicktemplates2/qquickscrollindicator_p.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSCROLLINDICATOR_P_H
+#define QQUICKSCROLLINDICATOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFlickable;
+class QQuickScrollIndicatorAttached;
+class QQuickScrollIndicatorPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicator : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal size READ size WRITE setSize NOTIFY sizeChanged FINAL)
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+
+public:
+ explicit QQuickScrollIndicator(QQuickItem *parent = nullptr);
+
+ static QQuickScrollIndicatorAttached *qmlAttachedProperties(QObject *object);
+
+ qreal size() const;
+ qreal position() const;
+
+ bool isActive() const;
+ void setActive(bool active);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+public Q_SLOTS:
+ void setSize(qreal size);
+ void setPosition(qreal position);
+
+Q_SIGNALS:
+ void sizeChanged();
+ void positionChanged();
+ void activeChanged();
+ void orientationChanged();
+
+protected:
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickScrollIndicator)
+ Q_DECLARE_PRIVATE(QQuickScrollIndicator)
+};
+
+class QQuickScrollIndicatorAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollIndicatorAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickScrollIndicator *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
+ Q_PROPERTY(QQuickScrollIndicator *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
+
+public:
+ explicit QQuickScrollIndicatorAttached(QQuickFlickable *flickable);
+ ~QQuickScrollIndicatorAttached();
+
+ QQuickScrollIndicator *horizontal() const;
+ void setHorizontal(QQuickScrollIndicator *horizontal);
+
+ QQuickScrollIndicator *vertical() const;
+ void setVertical(QQuickScrollIndicator *vertical);
+
+Q_SIGNALS:
+ void horizontalChanged();
+ void verticalChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickScrollIndicatorAttached)
+ Q_DECLARE_PRIVATE(QQuickScrollIndicatorAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickScrollIndicator)
+QML_DECLARE_TYPEINFO(QQuickScrollIndicator, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKSCROLLINDICATOR_P_H
diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp
new file mode 100644
index 00000000..04aa4f4d
--- /dev/null
+++ b/src/quicktemplates2/qquickshortcutcontext.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickshortcutcontext_p_p.h"
+#include "qquickoverlay_p_p.h"
+#include "qquickpopup_p.h"
+
+#include <QtGui/qguiapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+static bool isBlockedByPopup(QQuickItem *item)
+{
+ if (!item || !item->window())
+ return false;
+
+ QQuickOverlay *overlay = QQuickOverlay::overlay(item->window());
+ const auto popups = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups();
+ for (QQuickPopup *popup : popups) {
+ if (popup->isModal() || popup->closePolicy() & QQuickPopup::CloseOnEscape)
+ return item != popup->popupItem() && !popup->popupItem()->isAncestorOf(item);
+ }
+
+ return false;
+}
+
+bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context)
+{
+ QQuickItem *item = nullptr;
+ switch (context) {
+ case Qt::ApplicationShortcut:
+ return true;
+ case Qt::WindowShortcut:
+ while (obj && !obj->isWindowType()) {
+ obj = obj->parent();
+ item = qobject_cast<QQuickItem *>(obj);
+ if (item) {
+ obj = item->window();
+ } else if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(obj)) {
+ obj = popup->window();
+ item = popup->popupItem();
+ }
+ }
+ return obj && obj == QGuiApplication::focusWindow() && !isBlockedByPopup(item);
+ default:
+ return false;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickshortcutcontext_p_p.h b/src/quicktemplates2/qquickshortcutcontext_p_p.h
new file mode 100644
index 00000000..3866dfd8
--- /dev/null
+++ b/src/quicktemplates2/qquickshortcutcontext_p_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSHORTCUTCONTEXT_P_P_H
+#define QQUICKSHORTCUTCONTEXT_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qnamespace.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QObject;
+
+struct Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickShortcutContext
+{
+ static bool matcher(QObject *object, Qt::ShortcutContext context);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSHORTCUTCONTEXT_P_P_H
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
new file mode 100644
index 00000000..454002c2
--- /dev/null
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -0,0 +1,598 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickslider_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtQuick/private/qquickwindow_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Slider
+ \inherits Control
+ \instantiates QQuickSlider
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Used to select a value by sliding a handle along a track.
+
+ \image qtquickcontrols2-slider.gif
+
+ Slider is used to select a value by sliding a handle along a track.
+
+ In the example below, custom \l from, \l value, and \l to values are set:
+
+ \code
+ Slider {
+ from: 1
+ value: 25
+ to: 100
+ }
+ \endcode
+
+ The \l position property is expressed as a fraction of the control's size,
+ in the range \c {0.0 - 1.0}. The \l visualPosition property is
+ the same, except that it is reversed in a
+ \l {Right-to-left User Interfaces}{right-to-left} application. The
+ visualPosition is useful for positioning the handle when styling Slider.
+ In the example above, \l visualPosition will be \c 0.24 in a left-to-right
+ application, and \c 0.76 in a right-to-left application.
+
+ \sa {Customizing Slider}, {Input Controls}
+*/
+
+class QQuickSliderPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSlider)
+
+public:
+ QQuickSliderPrivate() : from(0), to(1), value(0), position(0), stepSize(0), pressed(false),
+ orientation(Qt::Horizontal), snapMode(QQuickSlider::NoSnap),
+ handle(nullptr)
+ {
+ }
+
+ qreal valueAt(qreal position) const;
+ qreal snapPosition(qreal position) const;
+ qreal positionAt(const QPoint &point) const;
+ void setPosition(qreal position);
+ void updatePosition();
+
+ qreal from;
+ qreal to;
+ qreal value;
+ qreal position;
+ qreal stepSize;
+ bool pressed;
+ QPoint pressPoint;
+ Qt::Orientation orientation;
+ QQuickSlider::SnapMode snapMode;
+ QQuickItem *handle;
+};
+
+qreal QQuickSliderPrivate::valueAt(qreal position) const
+{
+ return from + (to - from) * position;
+}
+
+qreal QQuickSliderPrivate::snapPosition(qreal position) const
+{
+ const qreal range = to - from;
+ if (qFuzzyIsNull(range))
+ return position;
+
+ const qreal effectiveStep = stepSize / range;
+ if (qFuzzyIsNull(effectiveStep))
+ return position;
+
+ return qRound(position / effectiveStep) * effectiveStep;
+}
+
+qreal QQuickSliderPrivate::positionAt(const QPoint &point) const
+{
+ Q_Q(const QQuickSlider);
+ if (orientation == Qt::Horizontal) {
+ const qreal hw = handle ? handle->width() : 0;
+ const qreal offset = hw / 2;
+ const qreal extent = q->availableWidth() - hw;
+ if (!qFuzzyIsNull(extent)) {
+ if (q->isMirrored())
+ return (q->width() - point.x() - q->rightPadding() - offset) / extent;
+ return (point.x() - q->leftPadding() - offset) / extent;
+ }
+ } else {
+ const qreal hh = handle ? handle->height() : 0;
+ const qreal offset = hh / 2;
+ const qreal extent = q->availableHeight() - hh;
+ if (!qFuzzyIsNull(extent))
+ return (q->height() - point.y() - q->bottomPadding() - offset) / extent;
+ }
+ return 0;
+}
+
+void QQuickSliderPrivate::setPosition(qreal pos)
+{
+ Q_Q(QQuickSlider);
+ pos = qBound<qreal>(0.0, pos, 1.0);
+ if (qFuzzyCompare(position, pos))
+ return;
+
+ position = pos;
+ emit q->positionChanged();
+ emit q->visualPositionChanged();
+}
+
+void QQuickSliderPrivate::updatePosition()
+{
+ qreal pos = 0;
+ if (!qFuzzyCompare(from, to))
+ pos = (value - from) / (to - from);
+ setPosition(pos);
+}
+
+QQuickSlider::QQuickSlider(QQuickItem *parent) :
+ QQuickControl(*(new QQuickSliderPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setFocusPolicy(Qt::StrongFocus);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Slider::from
+
+ This property holds the starting value for the range. The default value is \c 0.0.
+
+ \sa to, value
+*/
+qreal QQuickSlider::from() const
+{
+ Q_D(const QQuickSlider);
+ return d->from;
+}
+
+void QQuickSlider::setFrom(qreal from)
+{
+ Q_D(QQuickSlider);
+ if (qFuzzyCompare(d->from, from))
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Slider::to
+
+ This property holds the end value for the range. The default value is \c 1.0.
+
+ \sa from, value
+*/
+qreal QQuickSlider::to() const
+{
+ Q_D(const QQuickSlider);
+ return d->to;
+}
+
+void QQuickSlider::setTo(qreal to)
+{
+ Q_D(QQuickSlider);
+ if (qFuzzyCompare(d->to, to))
+ return;
+
+ d->to = to;
+ emit toChanged();
+ if (isComponentComplete()) {
+ setValue(d->value);
+ d->updatePosition();
+ }
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Slider::value
+
+ This property holds the value in the range \c from - \c to. The default value is \c 0.0.
+
+ Unlike the \l position property, the \c value is not updated while the
+ handle is dragged. The value is updated after the value has been chosen
+ and the slider has been released.
+
+ \sa position
+*/
+qreal QQuickSlider::value() const
+{
+ Q_D(const QQuickSlider);
+ return d->value;
+}
+
+void QQuickSlider::setValue(qreal value)
+{
+ Q_D(QQuickSlider);
+ if (isComponentComplete())
+ value = d->from > d->to ? qBound(d->to, value, d->from) : qBound(d->from, value, d->to);
+
+ if (qFuzzyCompare(d->value, value))
+ return;
+
+ d->value = value;
+ d->updatePosition();
+ emit valueChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Slider::position
+ \readonly
+
+ This property holds the logical position of the handle.
+
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike the \l value property, the \c position is
+ continuously updated while the handle is dragged. For visualizing a
+ slider, the right-to-left aware \l visualPosition should be used instead.
+
+ \sa value, visualPosition
+*/
+qreal QQuickSlider::position() const
+{
+ Q_D(const QQuickSlider);
+ return d->position;
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Slider::visualPosition
+ \readonly
+
+ This property holds the visual position of the handle.
+
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
+ value is equal to \c {1.0 - position}. This makes the value suitable for
+ visualizing the slider, taking right-to-left support into account.
+
+ \sa position
+*/
+qreal QQuickSlider::visualPosition() const
+{
+ Q_D(const QQuickSlider);
+ if (d->orientation == Qt::Vertical || isMirrored())
+ return 1.0 - d->position;
+ return d->position;
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Slider::stepSize
+
+ This property holds the step size. The default value is \c 0.0.
+
+ \sa snapMode, increase(), decrease()
+*/
+qreal QQuickSlider::stepSize() const
+{
+ Q_D(const QQuickSlider);
+ return d->stepSize;
+}
+
+void QQuickSlider::setStepSize(qreal step)
+{
+ Q_D(QQuickSlider);
+ if (qFuzzyCompare(d->stepSize, step))
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Slider::snapMode
+
+ This property holds the snap mode.
+
+ Possible values:
+ \value Slider.NoSnap The slider does not snap (default).
+ \value Slider.SnapAlways The slider snaps while the handle is dragged.
+ \value Slider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
+
+ In the following table, the various modes are illustrated with animations.
+ The movement of the mouse cursor and the \l stepSize (\c 0.2) are identical
+ in each animation.
+
+ \table
+ \header
+ \row \li \b Value \li \b Example
+ \row \li \c Slider.NoSnap \li \image qtquickcontrols2-slider-nosnap.gif
+ \row \li \c Slider.SnapAlways \li \image qtquickcontrols2-slider-snapalways.gif
+ \row \li \c Slider.SnapOnRelease \li \image qtquickcontrols2-slider-snaponrelease.gif
+ \endtable
+
+ \sa stepSize
+*/
+QQuickSlider::SnapMode QQuickSlider::snapMode() const
+{
+ Q_D(const QQuickSlider);
+ return d->snapMode;
+}
+
+void QQuickSlider::setSnapMode(SnapMode mode)
+{
+ Q_D(QQuickSlider);
+ if (d->snapMode == mode)
+ return;
+
+ d->snapMode = mode;
+ emit snapModeChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::Slider::pressed
+
+ This property holds whether the slider is pressed.
+*/
+bool QQuickSlider::isPressed() const
+{
+ Q_D(const QQuickSlider);
+ return d->pressed;
+}
+
+void QQuickSlider::setPressed(bool pressed)
+{
+ Q_D(QQuickSlider);
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ setAccessibleProperty("pressed", pressed);
+ emit pressedChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Slider::orientation
+
+ This property holds the orientation.
+
+ Possible values:
+ \value Qt.Horizontal Horizontal (default)
+ \value Qt.Vertical Vertical
+*/
+Qt::Orientation QQuickSlider::orientation() const
+{
+ Q_D(const QQuickSlider);
+ return d->orientation;
+}
+
+void QQuickSlider::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickSlider);
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Slider::handle
+
+ This property holds the handle item.
+
+ \sa {Customizing Slider}
+*/
+QQuickItem *QQuickSlider::handle() const
+{
+ Q_D(const QQuickSlider);
+ return d->handle;
+}
+
+void QQuickSlider::setHandle(QQuickItem *handle)
+{
+ Q_D(QQuickSlider);
+ if (d->handle == handle)
+ return;
+
+ d->deleteDelegate(d->handle);
+ d->handle = handle;
+ if (handle && !handle->parentItem())
+ handle->setParentItem(this);
+ emit handleChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Slider::increase()
+
+ Increases the value by \l stepSize or \c 0.1 if stepSize is not defined.
+
+ \sa stepSize
+*/
+void QQuickSlider::increase()
+{
+ Q_D(QQuickSlider);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(d->value + step);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Slider::decrease()
+
+ Decreases the value by \l stepSize or \c 0.1 if stepSize is not defined.
+
+ \sa stepSize
+*/
+void QQuickSlider::decrease()
+{
+ Q_D(QQuickSlider);
+ qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(d->value - step);
+}
+
+void QQuickSlider::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickSlider);
+ QQuickControl::keyPressEvent(event);
+ if (d->orientation == Qt::Horizontal) {
+ if (event->key() == Qt::Key_Left) {
+ setPressed(true);
+ if (isMirrored())
+ increase();
+ else
+ decrease();
+ event->accept();
+ } else if (event->key() == Qt::Key_Right) {
+ setPressed(true);
+ if (isMirrored())
+ decrease();
+ else
+ increase();
+ event->accept();
+ }
+ } else {
+ if (event->key() == Qt::Key_Up) {
+ setPressed(true);
+ increase();
+ event->accept();
+ } else if (event->key() == Qt::Key_Down) {
+ setPressed(true);
+ decrease();
+ event->accept();
+ }
+ }
+}
+
+void QQuickSlider::keyReleaseEvent(QKeyEvent *event)
+{
+ QQuickControl::keyReleaseEvent(event);
+ setPressed(false);
+}
+
+void QQuickSlider::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSlider);
+ QQuickControl::mousePressEvent(event);
+ d->pressPoint = event->pos();
+ setPressed(true);
+}
+
+void QQuickSlider::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSlider);
+ QQuickControl::mouseMoveEvent(event);
+ if (!keepMouseGrab()) {
+ if (d->orientation == Qt::Horizontal)
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event));
+ else
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().y() - d->pressPoint.y(), Qt::YAxis, event));
+ }
+ if (keepMouseGrab()) {
+ qreal pos = d->positionAt(event->pos());
+ if (d->snapMode == SnapAlways)
+ pos = d->snapPosition(pos);
+ d->setPosition(pos);
+ }
+}
+
+void QQuickSlider::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSlider);
+ QQuickControl::mouseReleaseEvent(event);
+ d->pressPoint = QPoint();
+ qreal pos = d->positionAt(event->pos());
+ if (d->snapMode != NoSnap)
+ pos = d->snapPosition(pos);
+ qreal val = d->valueAt(pos);
+ if (!qFuzzyCompare(val, d->value))
+ setValue(val);
+ else if (d->snapMode != NoSnap)
+ d->setPosition(pos);
+ setKeepMouseGrab(false);
+ setPressed(false);
+}
+
+void QQuickSlider::mouseUngrabEvent()
+{
+ Q_D(QQuickSlider);
+ QQuickControl::mouseUngrabEvent();
+ d->pressPoint = QPoint();
+ setPressed(false);
+}
+
+void QQuickSlider::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickSlider);
+ QQuickControl::wheelEvent(event);
+ if (d->wheelEnabled) {
+ const qreal oldValue = d->value;
+ const QPointF angle = event->angleDelta();
+ const qreal delta = (qFuzzyIsNull(angle.y()) ? angle.x() : angle.y()) / QWheelEvent::DefaultDeltasPerStep;
+ const qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ setValue(oldValue + step * delta);
+ event->setAccepted(!qFuzzyCompare(d->value, oldValue));
+ }
+}
+
+void QQuickSlider::mirrorChange()
+{
+ QQuickControl::mirrorChange();
+ emit visualPositionChanged();
+}
+
+void QQuickSlider::componentComplete()
+{
+ Q_D(QQuickSlider);
+ QQuickControl::componentComplete();
+ setValue(d->value);
+ d->updatePosition();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickSlider::accessibilityActiveChanged(bool active)
+{
+ QQuickControl::accessibilityActiveChanged(active);
+
+ Q_D(QQuickSlider);
+ if (active)
+ setAccessibleProperty("pressed", d->pressed);
+}
+
+QAccessible::Role QQuickSlider::accessibleRole() const
+{
+ return QAccessible::Slider;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickslider_p.h b/src/quicktemplates2/qquickslider_p.h
new file mode 100644
index 00000000..f6c1401a
--- /dev/null
+++ b/src/quicktemplates2/qquickslider_p.h
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSLIDER_P_H
+#define QQUICKSLIDER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSliderPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSlider : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+ Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
+ Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
+
+public:
+ explicit QQuickSlider(QQuickItem *parent = nullptr);
+
+ qreal from() const;
+ void setFrom(qreal from);
+
+ qreal to() const;
+ void setTo(qreal to);
+
+ qreal value() const;
+ void setValue(qreal value);
+
+ qreal position() const;
+ qreal visualPosition() const;
+
+ qreal stepSize() const;
+ void setStepSize(qreal step);
+
+ enum SnapMode {
+ NoSnap,
+ SnapAlways,
+ SnapOnRelease
+ };
+ Q_ENUM(SnapMode)
+
+ SnapMode snapMode() const;
+ void setSnapMode(SnapMode mode);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ QQuickItem *handle() const;
+ void setHandle(QQuickItem *handle);
+
+public Q_SLOTS:
+ void increase();
+ void decrease();
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void valueChanged();
+ void positionChanged();
+ void visualPositionChanged();
+ void stepSizeChanged();
+ void snapModeChanged();
+ void pressedChanged();
+ void orientationChanged();
+ void handleChanged();
+
+protected:
+ 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 wheelEvent(QWheelEvent *event) override;
+
+ void mirrorChange() override;
+ void componentComplete() override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickSlider)
+ Q_DECLARE_PRIVATE(QQuickSlider)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickSlider)
+
+#endif // QQUICKSLIDER_P_H
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
new file mode 100644
index 00000000..473b6643
--- /dev/null
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -0,0 +1,814 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickspinbox_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qguiapplication.h>
+#include <QtGui/qstylehints.h>
+
+#include <QtQml/qqmlinfo.h>
+#include <QtQml/private/qqmllocale_p.h>
+#include <QtQml/private/qqmlengine_p.h>
+
+QT_BEGIN_NAMESPACE
+
+// copied from qabstractbutton.cpp
+static const int AUTO_REPEAT_DELAY = 300;
+static const int AUTO_REPEAT_INTERVAL = 100;
+
+/*!
+ \qmltype SpinBox
+ \inherits Control
+ \instantiates QQuickSpinBox
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup input
+ \brief Allows the user to select from a set of preset values.
+
+ \image qtquickcontrols2-spinbox.png
+
+ SpinBox allows the user to choose an integer value by clicking the up
+ or down indicator buttons, or by pressing up or down on the keyboard.
+ Optionally, SpinBox can be also made \l editable, so the user can enter
+ a text value in the input field.
+
+ By default, SpinBox provides discrete values in the range of \c [0-99]
+ with a \l stepSize of \c 1.
+
+ \snippet qtquickcontrols2-spinbox.qml 1
+
+ \section2 Custom Values
+
+ \image qtquickcontrols2-spinbox-textual.png
+
+ Even though SpinBox works on integer values, it can be customized to
+ accept arbitrary input values. The following snippet demonstrates how
+ \l validator, \l textFromValue and \l valueFromText can be used to
+ customize the default behavior.
+
+ \snippet qtquickcontrols2-spinbox-textual.qml 1
+
+ In the same manner, SpinBox can be customized to accept floating point
+ numbers:
+
+ \image qtquickcontrols2-spinbox-double.png
+
+ \snippet qtquickcontrols2-spinbox-double.qml 1
+
+ \sa Tumbler, {Customizing SpinBox}
+*/
+
+class QQuickSpinBoxPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSpinBox)
+
+public:
+ QQuickSpinBoxPrivate() : editable(false), from(0), to(99), value(0), stepSize(1),
+ delayTimer(0), repeatTimer(0), up(nullptr), down(nullptr), validator(nullptr) { }
+
+ int boundValue(int value) const;
+ void updateValue();
+
+ int effectiveStepSize() const;
+
+ bool upEnabled() const;
+ void updateUpEnabled();
+ bool downEnabled() const;
+ void updateDownEnabled();
+
+ void startRepeatDelay();
+ void startPressRepeat();
+ void stopPressRepeat();
+
+ bool handleMousePressEvent(QQuickItem *child, QMouseEvent *event);
+ bool handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event);
+ bool handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event);
+ bool handleMouseUngrabEvent(QQuickItem *child);
+
+ bool editable;
+ int from;
+ int to;
+ int value;
+ int stepSize;
+ int delayTimer;
+ int repeatTimer;
+ QQuickSpinButton *up;
+ QQuickSpinButton *down;
+ QValidator *validator;
+ mutable QJSValue textFromValue;
+ mutable QJSValue valueFromText;
+};
+
+int QQuickSpinBoxPrivate::boundValue(int value) const
+{
+ return from > to ? qBound(to, value, from) : qBound(from, value, to);
+}
+
+void QQuickSpinBoxPrivate::updateValue()
+{
+ Q_Q(QQuickSpinBox);
+ if (contentItem) {
+ QVariant text = contentItem->property("text");
+ if (text.isValid()) {
+ QQmlEngine *engine = qmlEngine(q);
+ if (engine) {
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine);
+ QJSValue loc(v4, QQmlLocale::wrap(v4, locale));
+ QJSValue val = q->valueFromText().call(QJSValueList() << text.toString() << loc);
+ q->setValue(val.toInt());
+ }
+ }
+ }
+}
+
+int QQuickSpinBoxPrivate::effectiveStepSize() const
+{
+ return from > to ? -1 * stepSize : stepSize;
+}
+
+bool QQuickSpinBoxPrivate::upEnabled() const
+{
+ const QQuickItem *upIndicator = up->indicator();
+ return upIndicator && upIndicator->isEnabled();
+}
+
+void QQuickSpinBoxPrivate::updateUpEnabled()
+{
+ QQuickItem *upIndicator = up->indicator();
+ if (!upIndicator)
+ return;
+
+ upIndicator->setEnabled(from < to ? value < to : value > to);
+}
+
+bool QQuickSpinBoxPrivate::downEnabled() const
+{
+ const QQuickItem *downIndicator = down->indicator();
+ return downIndicator && downIndicator->isEnabled();
+}
+
+void QQuickSpinBoxPrivate::updateDownEnabled()
+{
+ QQuickItem *downIndicator = down->indicator();
+ if (!downIndicator)
+ return;
+
+ downIndicator->setEnabled(from < to ? value > from : value < from);
+}
+
+void QQuickSpinBoxPrivate::startRepeatDelay()
+{
+ Q_Q(QQuickSpinBox);
+ stopPressRepeat();
+ delayTimer = q->startTimer(AUTO_REPEAT_DELAY);
+}
+
+void QQuickSpinBoxPrivate::startPressRepeat()
+{
+ Q_Q(QQuickSpinBox);
+ stopPressRepeat();
+ repeatTimer = q->startTimer(AUTO_REPEAT_INTERVAL);
+}
+
+void QQuickSpinBoxPrivate::stopPressRepeat()
+{
+ Q_Q(QQuickSpinBox);
+ if (delayTimer > 0) {
+ q->killTimer(delayTimer);
+ delayTimer = 0;
+ }
+ if (repeatTimer > 0) {
+ q->killTimer(repeatTimer);
+ repeatTimer = 0;
+ }
+}
+
+bool QQuickSpinBoxPrivate::handleMousePressEvent(QQuickItem *child, QMouseEvent *event)
+{
+ Q_Q(QQuickSpinBox);
+ QQuickItem *ui = up->indicator();
+ QQuickItem *di = down->indicator();
+ up->setPressed(ui && ui->isEnabled() && ui->contains(ui->mapFromItem(child, event->pos())));
+ down->setPressed(di && di->isEnabled() && di->contains(di->mapFromItem(child, event->pos())));
+
+ bool pressed = up->isPressed() || down->isPressed();
+ q->setAccessibleProperty("pressed", pressed);
+ if (pressed)
+ startRepeatDelay();
+ return pressed;
+}
+
+bool QQuickSpinBoxPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event)
+{
+ Q_Q(QQuickSpinBox);
+ QQuickItem *ui = up->indicator();
+ QQuickItem *di = down->indicator();
+ up->setPressed(ui && ui->isEnabled() && ui->contains(ui->mapFromItem(child, event->pos())));
+ down->setPressed(di && di->isEnabled() && di->contains(di->mapFromItem(child, event->pos())));
+
+ bool pressed = up->isPressed() || down->isPressed();
+ q->setAccessibleProperty("pressed", pressed);
+ if (!pressed)
+ stopPressRepeat();
+ return pressed;
+}
+
+bool QQuickSpinBoxPrivate::handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event)
+{
+ Q_Q(QQuickSpinBox);
+ QQuickItem *ui = up->indicator();
+ QQuickItem *di = down->indicator();
+ bool wasPressed = up->isPressed() || down->isPressed();
+ if (up->isPressed()) {
+ up->setPressed(false);
+ if (repeatTimer <= 0 && ui && ui->contains(ui->mapFromItem(child, event->pos())))
+ q->increase();
+ } else if (down->isPressed()) {
+ down->setPressed(false);
+ if (repeatTimer <= 0 && di && di->contains(di->mapFromItem(child, event->pos())))
+ q->decrease();
+ }
+
+ q->setAccessibleProperty("pressed", false);
+ stopPressRepeat();
+ return wasPressed;
+}
+
+bool QQuickSpinBoxPrivate::handleMouseUngrabEvent(QQuickItem *)
+{
+ Q_Q(QQuickSpinBox);
+ up->setPressed(false);
+ down->setPressed(false);
+
+ q->setAccessibleProperty("pressed", false);
+ stopPressRepeat();
+ return false;
+}
+
+QQuickSpinBox::QQuickSpinBox(QQuickItem *parent) :
+ QQuickControl(*(new QQuickSpinBoxPrivate), parent)
+{
+ Q_D(QQuickSpinBox);
+ d->up = new QQuickSpinButton(this);
+ d->down = new QQuickSpinButton(this);
+
+ setFlag(ItemIsFocusScope);
+ setFiltersChildMouseEvents(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::SpinBox::from
+
+ This property holds the starting value for the range. The default value is \c 0.
+
+ \sa to, value
+*/
+int QQuickSpinBox::from() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->from;
+}
+
+void QQuickSpinBox::setFrom(int from)
+{
+ Q_D(QQuickSpinBox);
+ if (d->from == from)
+ return;
+
+ d->from = from;
+ emit fromChanged();
+ if (isComponentComplete())
+ setValue(d->value);
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::SpinBox::to
+
+ This property holds the end value for the range. The default value is \c 99.
+
+ \sa from, value
+*/
+int QQuickSpinBox::to() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->to;
+}
+
+void QQuickSpinBox::setTo(int to)
+{
+ Q_D(QQuickSpinBox);
+ if (d->to == to)
+ return;
+
+ d->to = to;
+ emit toChanged();
+ if (isComponentComplete())
+ setValue(d->value);
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::SpinBox::value
+
+ This property holds the value in the range \c from - \c to. The default value is \c 0.
+*/
+int QQuickSpinBox::value() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->value;
+}
+
+void QQuickSpinBox::setValue(int value)
+{
+ Q_D(QQuickSpinBox);
+ if (isComponentComplete())
+ value = d->boundValue(value);
+
+ if (d->value == value)
+ return;
+
+ d->value = value;
+
+ d->updateUpEnabled();
+ d->updateDownEnabled();
+
+ emit valueChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::SpinBox::stepSize
+
+ This property holds the step size. The default value is \c 1.
+
+ \sa increase(), decrease()
+*/
+int QQuickSpinBox::stepSize() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->stepSize;
+}
+
+void QQuickSpinBox::setStepSize(int step)
+{
+ Q_D(QQuickSpinBox);
+ if (d->stepSize == step)
+ return;
+
+ d->stepSize = step;
+ emit stepSizeChanged();
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::SpinBox::editable
+
+ This property holds whether the spinbox is editable. The default value is \c false.
+
+ \sa validator
+*/
+bool QQuickSpinBox::isEditable() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->editable;
+}
+
+void QQuickSpinBox::setEditable(bool editable)
+{
+ Q_D(QQuickSpinBox);
+ if (d->editable == editable)
+ return;
+
+ d->editable = editable;
+ emit editableChanged();
+}
+
+/*!
+ \qmlproperty Validator QtQuick.Controls::SpinBox::validator
+
+ This property holds the input text validator for editable spinboxes. By
+ default, SpinBox uses \l IntValidator to accept input of integer numbers.
+
+ \code
+ SpinBox {
+ id: control
+ validator: IntValidator {
+ locale: control.locale.name
+ bottom: Math.min(control.from, control.to)
+ top: Math.max(control.from, control.to)
+ }
+ }
+ \endcode
+
+ \sa editable, textFromValue, valueFromText, {Control::locale}{locale}
+*/
+QValidator *QQuickSpinBox::validator() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->validator;
+}
+
+void QQuickSpinBox::setValidator(QValidator *validator)
+{
+ Q_D(QQuickSpinBox);
+ if (d->validator == validator)
+ return;
+
+ d->validator = validator;
+ emit validatorChanged();
+}
+
+/*!
+ \qmlproperty function QtQuick.Controls::SpinBox::textFromValue
+
+ This property holds a callback function that is called whenever
+ an integer value needs to be converted to display text.
+
+ The default function can be overridden to display custom text for a given
+ value. This applies to both editable and non-editable spinboxes;
+ for example, when using the up and down buttons or a mouse wheel to
+ increment and decrement the value, the new value is converted to display
+ text using this function.
+
+ The callback function signature is \c {string function(value, locale)}.
+ The function can have one or two arguments, where the first argument
+ is the value to be converted, and the optional second argument is the
+ locale that should be used for the conversion, if applicable.
+
+ The default implementation does the conversion using \l {QtQml::Locale}{Number.toLocaleString()}:
+
+ \code
+ textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }
+ \endcode
+
+ \note When applying a custom \c textFromValue implementation for editable
+ spinboxes, a matching \l valueFromText implementation must be provided
+ to be able to convert the custom text back to an integer value.
+
+ \sa valueFromText, validator, {Control::locale}{locale}
+*/
+QJSValue QQuickSpinBox::textFromValue() const
+{
+ Q_D(const QQuickSpinBox);
+ if (!d->textFromValue.isCallable()) {
+ QQmlEngine *engine = qmlEngine(this);
+ if (engine)
+ d->textFromValue = engine->evaluate(QStringLiteral("function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }"));
+ }
+ return d->textFromValue;
+}
+
+void QQuickSpinBox::setTextFromValue(const QJSValue &callback)
+{
+ Q_D(QQuickSpinBox);
+ if (!callback.isCallable()) {
+ qmlInfo(this) << "textFromValue must be a callable function";
+ return;
+ }
+ d->textFromValue = callback;
+ emit textFromValueChanged();
+}
+
+/*!
+ \qmlproperty function QtQuick.Controls::SpinBox::valueFromText
+
+ This property holds a callback function that is called whenever
+ input text needs to be converted to an integer value.
+
+ This function only needs to be overridden when \l textFromValue
+ is overridden for an editable spinbox.
+
+ The callback function signature is \c {int function(text, locale)}.
+ The function can have one or two arguments, where the first argument
+ is the text to be converted, and the optional second argument is the
+ locale that should be used for the conversion, if applicable.
+
+ The default implementation does the conversion using \l {QtQml::Locale}{Number.fromLocaleString()}:
+
+ \code
+ valueFromText: function(text, locale) { return Number.fromLocaleString(locale, text); }
+ \endcode
+
+ \note When applying a custom \l textFromValue implementation for editable
+ spinboxes, a matching \c valueFromText implementation must be provided
+ to be able to convert the custom text back to an integer value.
+
+ \sa textFromValue, validator, {Control::locale}{locale}
+*/
+QJSValue QQuickSpinBox::valueFromText() const
+{
+ Q_D(const QQuickSpinBox);
+ if (!d->valueFromText.isCallable()) {
+ QQmlEngine *engine = qmlEngine(this);
+ if (engine)
+ d->valueFromText = engine->evaluate(QStringLiteral("function(text, locale) { return Number.fromLocaleString(locale, text); }"));
+ }
+ return d->valueFromText;
+}
+
+void QQuickSpinBox::setValueFromText(const QJSValue &callback)
+{
+ Q_D(QQuickSpinBox);
+ if (!callback.isCallable()) {
+ qmlInfo(this) << "valueFromText must be a callable function";
+ return;
+ }
+ d->valueFromText = callback;
+ emit valueFromTextChanged();
+}
+
+/*!
+ \qmlpropertygroup QtQuick.Controls::SpinBox::up
+ \qmlproperty bool QtQuick.Controls::SpinBox::up.pressed
+ \qmlproperty Item QtQuick.Controls::SpinBox::up.indicator
+
+ These properties hold the up indicator item and whether it is pressed.
+
+ \sa increase()
+*/
+QQuickSpinButton *QQuickSpinBox::up() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->up;
+}
+
+/*!
+ \qmlpropertygroup QtQuick.Controls::SpinBox::down
+ \qmlproperty bool QtQuick.Controls::SpinBox::down.pressed
+ \qmlproperty Item QtQuick.Controls::SpinBox::down.indicator
+
+ These properties hold the down indicator item and whether it is pressed.
+
+ \sa decrease()
+*/
+QQuickSpinButton *QQuickSpinBox::down() const
+{
+ Q_D(const QQuickSpinBox);
+ return d->down;
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::SpinBox::increase()
+
+ Increases the value by \l stepSize, or \c 1 if stepSize is not defined.
+
+ \sa stepSize
+*/
+void QQuickSpinBox::increase()
+{
+ Q_D(QQuickSpinBox);
+ setValue(d->value + d->effectiveStepSize());
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::SpinBox::decrease()
+
+ Decreases the value by \l stepSize, or \c 1 if stepSize is not defined.
+
+ \sa stepSize
+*/
+void QQuickSpinBox::decrease()
+{
+ Q_D(QQuickSpinBox);
+ setValue(d->value - d->effectiveStepSize());
+}
+
+void QQuickSpinBox::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::keyPressEvent(event);
+
+ switch (event->key()) {
+ case Qt::Key_Up:
+ if (d->upEnabled()) {
+ increase();
+ d->up->setPressed(true);
+ event->accept();
+ }
+ break;
+
+ case Qt::Key_Down:
+ if (d->downEnabled()) {
+ decrease();
+ d->down->setPressed(true);
+ event->accept();
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ setAccessibleProperty("pressed", d->up->isPressed() || d->down->isPressed());
+}
+
+void QQuickSpinBox::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::keyReleaseEvent(event);
+
+ if (d->editable && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return))
+ d->updateValue();
+
+ d->up->setPressed(false);
+ d->down->setPressed(false);
+ setAccessibleProperty("pressed", false);
+}
+
+bool QQuickSpinBox::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseMove:
+ return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::MouseButtonRelease:
+ return d->handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
+ case QEvent::UngrabMouse:
+ return d->handleMouseUngrabEvent(child);
+ default:
+ return false;
+ }
+}
+
+void QQuickSpinBox::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mousePressEvent(event);
+ d->handleMousePressEvent(this, event);
+}
+
+void QQuickSpinBox::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mouseMoveEvent(event);
+ d->handleMouseMoveEvent(this, event);
+}
+
+void QQuickSpinBox::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mouseReleaseEvent(event);
+ d->handleMouseReleaseEvent(this, event);
+}
+
+void QQuickSpinBox::mouseUngrabEvent()
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mouseUngrabEvent();
+ d->handleMouseUngrabEvent(this);
+}
+
+void QQuickSpinBox::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::timerEvent(event);
+ if (event->timerId() == d->delayTimer) {
+ d->startPressRepeat();
+ } else if (event->timerId() == d->repeatTimer) {
+ if (d->up->isPressed())
+ increase();
+ else if (d->down->isPressed())
+ decrease();
+ }
+}
+
+void QQuickSpinBox::wheelEvent(QWheelEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::wheelEvent(event);
+ if (d->wheelEnabled) {
+ const int oldValue = d->value;
+ const QPointF angle = event->angleDelta();
+ const qreal delta = (qFuzzyIsNull(angle.y()) ? angle.x() : angle.y()) / QWheelEvent::DefaultDeltasPerStep;
+ setValue(oldValue + qRound(d->effectiveStepSize() * delta));
+ event->setAccepted(d->value != oldValue);
+ }
+}
+
+void QQuickSpinBox::componentComplete()
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::componentComplete();
+ d->updateUpEnabled();
+ d->updateDownEnabled();
+}
+
+void QQuickSpinBox::itemChange(ItemChange change, const ItemChangeData &value)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::itemChange(change, value);
+ if (d->editable && change == ItemActiveFocusHasChanged && !value.boolValue)
+ d->updateValue();
+}
+
+void QQuickSpinBox::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_UNUSED(oldItem);
+ if (newItem)
+ newItem->setActiveFocusOnTab(true);
+}
+
+QFont QQuickSpinBox::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::EditorFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickSpinBox::accessibleRole() const
+{
+ return QAccessible::SpinBox;
+}
+#endif
+
+class QQuickSpinButtonPrivate : public QObjectPrivate
+{
+public:
+ QQuickSpinButtonPrivate() : pressed(false), indicator(nullptr) { }
+ bool pressed;
+ QQuickItem *indicator;
+};
+
+QQuickSpinButton::QQuickSpinButton(QQuickSpinBox *parent) :
+ QObject(*(new QQuickSpinButtonPrivate), parent)
+{
+}
+
+bool QQuickSpinButton::isPressed() const
+{
+ Q_D(const QQuickSpinButton);
+ return d->pressed;
+}
+
+void QQuickSpinButton::setPressed(bool pressed)
+{
+ Q_D(QQuickSpinButton);
+ if (d->pressed == pressed)
+ return;
+
+ d->pressed = pressed;
+ emit pressedChanged();
+}
+
+QQuickItem *QQuickSpinButton::indicator() const
+{
+ Q_D(const QQuickSpinButton);
+ return d->indicator;
+}
+
+void QQuickSpinButton::setIndicator(QQuickItem *indicator)
+{
+ Q_D(QQuickSpinButton);
+ if (d->indicator == indicator)
+ return;
+
+ QQuickControl *control = qobject_cast<QQuickControl*>(d->parent);
+ if (control)
+ QQuickControlPrivate::get(control)->deleteDelegate(d->indicator);
+ else
+ 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/quicktemplates2/qquickspinbox_p.h b/src/quicktemplates2/qquickspinbox_p.h
new file mode 100644
index 00000000..3898a28b
--- /dev/null
+++ b/src/quicktemplates2/qquickspinbox_p.h
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSPINBOX_P_H
+#define QQUICKSPINBOX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQml/qjsvalue.h>
+
+QT_BEGIN_NAMESPACE
+
+class QValidator;
+class QQuickSpinButton;
+class QQuickSpinButtonPrivate;
+class QQuickSpinBoxPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinBox : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(int from READ from WRITE setFrom NOTIFY fromChanged FINAL)
+ Q_PROPERTY(int to READ to WRITE setTo NOTIFY toChanged FINAL)
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged FINAL)
+ Q_PROPERTY(int stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
+ Q_PROPERTY(bool editable READ isEditable WRITE setEditable NOTIFY editableChanged FINAL)
+ Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL)
+ Q_PROPERTY(QJSValue textFromValue READ textFromValue WRITE setTextFromValue NOTIFY textFromValueChanged FINAL)
+ Q_PROPERTY(QJSValue valueFromText READ valueFromText WRITE setValueFromText NOTIFY valueFromTextChanged FINAL)
+ Q_PROPERTY(QQuickSpinButton *up READ up CONSTANT FINAL)
+ Q_PROPERTY(QQuickSpinButton *down READ down CONSTANT FINAL)
+
+public:
+ explicit QQuickSpinBox(QQuickItem *parent = nullptr);
+
+ int from() const;
+ void setFrom(int from);
+
+ int to() const;
+ void setTo(int to);
+
+ int value() const;
+ void setValue(int value);
+
+ int stepSize() const;
+ void setStepSize(int step);
+
+ bool isEditable() const;
+ void setEditable(bool editable);
+
+ QValidator *validator() const;
+ void setValidator(QValidator *validator);
+
+ QJSValue textFromValue() const;
+ void setTextFromValue(const QJSValue &callback);
+
+ QJSValue valueFromText() const;
+ void setValueFromText(const QJSValue &callback);
+
+ QQuickSpinButton *up() const;
+ QQuickSpinButton *down() const;
+
+public Q_SLOTS:
+ void increase();
+ void decrease();
+
+Q_SIGNALS:
+ void fromChanged();
+ void toChanged();
+ void valueChanged();
+ void stepSizeChanged();
+ void editableChanged();
+ void validatorChanged();
+ void textFromValueChanged();
+ void valueFromTextChanged();
+
+protected:
+ 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 wheelEvent(QWheelEvent *event) override;
+
+ void componentComplete() override;
+ void itemChange(ItemChange change, const ItemChangeData &value) override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickSpinBox)
+ Q_DECLARE_PRIVATE(QQuickSpinBox)
+};
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinButton : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
+
+public:
+ explicit QQuickSpinButton(QQuickSpinBox *parent);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ QQuickItem *indicator() const;
+ void setIndicator(QQuickItem *indicator);
+
+Q_SIGNALS:
+ void pressedChanged();
+ void indicatorChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickSpinButton)
+ Q_DECLARE_PRIVATE(QQuickSpinButton)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickSpinBox)
+
+#endif // QQUICKSPINBOX_P_H
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
new file mode 100644
index 00000000..df9ab74f
--- /dev/null
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -0,0 +1,1041 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstackview_p.h"
+#include "qquickstackview_p_p.h"
+
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlinfo.h>
+
+#include <private/qv4qobjectwrapper_p.h>
+#include <private/qqmlengine_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype StackView
+ \inherits Control
+ \instantiates QQuickStackView
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-navigation
+ \ingroup qtquickcontrols2-containers
+ \brief Provides a stack-based navigation model.
+
+ \image qtquickcontrols2-stackview-wireframe.png
+
+ StackView can be used with a set of inter-linked information pages. For
+ example, an email application with separate views to list the latest emails,
+ view a specific email, and list/view the attachments. The email list view
+ is pushed onto the stack as users open an email, and popped out as they
+ choose to go back.
+
+ The following snippet demonstrates a simple use case, where the \c mainView
+ is pushed onto and popped out of the stack on relevant button click:
+
+ \qml
+ ApplicationWindow {
+ title: qsTr("Hello World")
+ width: 640
+ height: 480
+ visible: true
+
+ StackView {
+ id: stack
+ initialItem: mainView
+ anchors.fill: parent
+ }
+
+ Component {
+ id: mainView
+
+ Row {
+ spacing: 10
+
+ Button {
+ text: "Push"
+ onClicked: stack.push(mainView)
+ }
+ Button {
+ text: "Pop"
+ enabled: stack.depth > 1
+ onClicked: stack.pop()
+
+ }
+ Text {
+ text: stack.depth
+ }
+ }
+ }
+ }
+ \endqml
+
+ \section1 Using StackView in an Application
+
+ Using StackView in an application is as simple as adding it as a child to
+ a Window. The stack is usually anchored to the edges of the window, except
+ at the top or bottom where it might be anchored to a status bar, or some
+ other similar UI component. The stack can then be used by invoking its
+ navigation methods. The first item to show in the StackView is the one
+ that was assigned to \l initialItem, or the topmost item if \l initialItem
+ is not set.
+
+ \section1 Basic Navigation
+
+ StackView supports three primary navigation operations: push(), pop(), and
+ replace(). These correspond to classic stack operations where "push" adds
+ an item to the top of a stack, "pop" removes the top item from the
+ stack, and "replace" is like a pop followed by a push, which replaces the
+ topmost item with the new item. The topmost item in the stack
+ corresponds to the one that is \l{StackView::currentItem}{currently}
+ visible on screen. Logically, "push" navigates forward or deeper into the
+ application UI, "pop" navigates backward, and "replace" replaces the
+ \l currentItem.
+
+ \section2 Pushing Items
+
+ In the following animation, three \l Label controls are pushed onto a
+ stack view with the \l push() function:
+
+ \image qtquickcontrols2-stackview-push.gif
+
+ The stack now contains the following items: \c [A, B, C].
+
+ \note When the stack is empty, a push() operation will not have a
+ transition animation because there is nothing to transition from (typically
+ on application start-up).
+
+ \section2 Popping Items
+
+ Continuing on from the example above, the topmost item on the stack is
+ removed with a call to \l pop():
+
+ \image qtquickcontrols2-stackview-pop.gif
+
+ The stack now contains the following items: \c [A, B].
+
+ \note A pop() operation on a stack with depth 1 or 0 does nothing. In such
+ cases, the stack can be emptied using the \l clear() method.
+
+ \section3 Unwinding Items via Pop
+
+ Sometimes, it is necessary to go back more than a single step in the stack.
+ For example, to return to a "main" item or some kind of section item in the
+ application. In such cases, it is possible to specify an item as a
+ parameter for pop(). This is called an "unwind" operation, where the stack
+ unwinds till the specified item. If the item is not found, stack unwinds
+ until it is left with one item, which becomes the \l currentItem. To
+ explicitly unwind to the bottom of the stack, it is recommended to use
+ \l{pop()}{pop(null)}, although any non-existent item will do.
+
+ In the following animation, we unwind the stack to the first item by
+ calling \c pop(null):
+
+ \image qtquickcontrols2-stackview-unwind.gif
+
+ The stack now contains a single item: \c [A].
+
+ \section2 Replacing Items
+
+ In the following animation, we \l replace the topmost item with \c D:
+
+ \image qtquickcontrols2-stackview-replace.gif
+
+ The stack now contains the following items: \c [A, B, D].
+
+ \section1 Deep Linking
+
+ \e{Deep linking} means launching an application into a particular state. For
+ example, a newspaper application could be launched into showing a
+ particular article, bypassing the topmost item. In terms of StackView, deep linking means the ability to modify
+ the state of the stack, so much so that it is possible to push a set of
+ items to the top of the stack, or to completely reset the stack to a given
+ state.
+
+ The API for deep linking in StackView is the same as for basic navigation.
+ Pushing an array instead of a single item adds all the items in that array
+ to the stack. The transition animation, however, is applied only for the
+ last item in the array. The normal semantics of push() apply for deep
+ linking, that is, it adds whatever is pushed onto the stack.
+
+ \note Only the last item of the array is loaded. The rest of the items are
+ loaded only when needed, either on subsequent calls to pop or on request to
+ get an item using get().
+
+ This gives us the following result, given the stack [A, B, C]:
+
+ \list
+ \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition
+ animation between C and F
+ \li \l{replace()}{replace([D, E, F])} => [A, B, D, E, F] - "replace"
+ transition animation between C and F
+ \li \l{clear()} followed by \l{push()}{push([D, E, F])} => [D, E, F] - no
+ transition animation for pushing items as the stack was empty.
+ \endlist
+
+ \section1 Finding Items
+
+ An Item for which the application does not have a reference can be found
+ by calling find(). The method needs a callback function, which is invoked
+ for each item in the stack (starting at the top) until a match is found.
+ If the callback returns \c true, find() stops and returns the matching
+ item, otherwise \c null is returned.
+
+ The code below searches the stack for an item named "order_id" and unwinds
+ to that item.
+
+ \badcode
+ stackView.pop(stackView.find(function(item) {
+ return item.name == "order_id";
+ }));
+ \endcode
+
+ You can also get to an item in the stack using \l {get()}{get(index)}.
+
+ \badcode
+ previousItem = stackView.get(myItem.StackView.index - 1));
+ \endcode
+
+ \section1 Transitions
+
+ For each push or pop operation, different transition animations are applied
+ to entering and exiting items. These animations define how the entering item
+ should animate in, and the exiting item should animate out. The animations
+ can be customized by assigning different \l{Transition}s for the
+ \l pushEnter, \l pushExit, \l popEnter, \l popExit, \l replaceEnter, and
+ \l replaceExit properties of StackView.
+
+ \note The transition animations affect each others' transitional behavior.
+ Customizing the animation for one and leaving the other may give unexpected
+ results.
+
+ The following snippet defines a simple fade transition for push and pop
+ operations:
+
+ \qml
+ StackView {
+ id: stackview
+ anchors.fill: parent
+
+ pushEnter: Transition {
+ PropertyAnimation {
+ property: "opacity"
+ from: 0
+ to:1
+ duration: 200
+ }
+ }
+ pushExit: Transition {
+ PropertyAnimation {
+ property: "opacity"
+ from: 1
+ to:0
+ duration: 200
+ }
+ }
+ popEnter: Transition {
+ PropertyAnimation {
+ property: "opacity"
+ from: 0
+ to:1
+ duration: 200
+ }
+ }
+ popExit: Transition {
+ PropertyAnimation {
+ property: "opacity"
+ from: 1
+ to:0
+ duration: 200
+ }
+ }
+ }
+ \endqml
+
+ \note Using anchors on the items added to a StackView is not supported.
+ Typically push, pop, and replace transitions animate the position,
+ which is not possible when anchors are applied. Notice that this
+ only applies to the root of the item. Using anchors for its children
+ works as expected.
+
+ \sa {Customizing StackView}, {Navigation Controls}, {Container Controls}
+*/
+
+QQuickStackView::QQuickStackView(QQuickItem *parent) :
+ QQuickControl(*(new QQuickStackViewPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+}
+
+QQuickStackView::~QQuickStackView()
+{
+ Q_D(QQuickStackView);
+ if (d->transitioner) {
+ d->transitioner->setChangeListener(nullptr);
+ delete d->transitioner;
+ }
+ qDeleteAll(d->removals);
+ qDeleteAll(d->elements);
+}
+
+QQuickStackAttached *QQuickStackView::qmlAttachedProperties(QObject *object)
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (!item) {
+ qmlInfo(object) << "StackView must be attached to an Item";
+ return nullptr;
+ }
+ return new QQuickStackAttached(item);
+}
+
+/*!
+ \qmlproperty bool QtQuick.Controls::StackView::busy
+ \readonly
+ This property holds whether a transition is running.
+*/
+bool QQuickStackView::isBusy() const
+{
+ Q_D(const QQuickStackView);
+ return d->busy;
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::StackView::depth
+ \readonly
+ This property holds the number of items currently pushed onto the stack.
+*/
+int QQuickStackView::depth() const
+{
+ Q_D(const QQuickStackView);
+ return d->elements.count();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::StackView::currentItem
+ \readonly
+ This property holds the current top-most item in the stack.
+*/
+QQuickItem *QQuickStackView::currentItem() const
+{
+ Q_D(const QQuickStackView);
+ return d->currentItem;
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::StackView::get(index, behavior)
+
+ Returns the item at position \a index in the stack, or \c null if the index
+ is out of bounds.
+
+ Supported behavior values:
+ \value StackView.DontLoad The item is not forced to load (and \c null is returned if not yet loaded).
+ \value StackView.ForceLoad The item is forced to load.
+*/
+QQuickItem *QQuickStackView::get(int index, LoadBehavior behavior)
+{
+ Q_D(QQuickStackView);
+ QQuickStackElement *element = d->elements.value(index);
+ if (element) {
+ if (behavior == ForceLoad)
+ element->load(this);
+ return element->item;
+ }
+ return nullptr;
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::StackView::find(callback, behavior)
+
+ Search for a specific item inside the stack. The \a callback function is called
+ for each item in the stack (with the item and index as arguments) until the callback
+ function returns \c true. The return value is the item found. For example:
+
+ \code
+ stackView.find(function(item, index) {
+ return item.isTheOne
+ })
+ \endcode
+
+ Supported behavior values:
+ \value StackView.DontLoad Unloaded items are skipped (the callback function is not called for them).
+ \value StackView.ForceLoad Unloaded items are forced to load.
+*/
+QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavior)
+{
+ Q_D(QQuickStackView);
+ QJSValue func(callback);
+ QQmlEngine *engine = qmlEngine(this);
+ if (!engine || !func.isCallable()) // TODO: warning?
+ return nullptr;
+
+ for (int i = d->elements.count() - 1; i >= 0; --i) {
+ QQuickStackElement *element = d->elements.at(i);
+ if (behavior == ForceLoad)
+ element->load(this);
+ if (element->item) {
+ QJSValue rv = func.call(QJSValueList() << engine->newQObject(element->item) << i);
+ if (rv.toBool())
+ return element->item;
+ }
+ }
+
+ return nullptr;
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::StackView::push(item, properties, operation)
+
+ Pushes an \a item onto the stack using the specified \a operation, and
+ optionally applies a set of \a properties on the item. The item can be
+ an \l Item, \l Component, or a \l [QML] url. Returns the item that became
+ current.
+
+ StackView creates an instance automatically if the pushed item is a \l Component,
+ or a \l [QML] url. The optional \a properties argument specifies a map of initial
+ property values for the pushed item. For dynamically created items, these values
+ are applied before the creation is finalized. This is more efficient than setting
+ property values after creation, particularly where large sets of property values
+ are defined, and also allows property bindings to be set up (using \l{Qt::binding}
+ {Qt.binding()}) before the item is created.
+
+ Pushing a single item:
+ \code
+ stackView.push(rect)
+
+ // or with properties:
+ stackView.push(rect, {"color": "red"})
+ \endcode
+
+ Multiple items can be pushed at the same time either by passing them as
+ additional arguments, or as an array. The last item becomes the current
+ item. Each item can be followed by a set of properties to apply.
+
+ Passing a variable amount of arguments:
+ \code
+ stackView.push(rect1, rect2, rect3)
+
+ // or with properties:
+ stackView.push(rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"})
+ \endcode
+
+ Pushing an array of items:
+ \code
+ stackView.push([rect1, rect2, rect3])
+
+ // or with properties:
+ stackView.push([rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"}])
+ \endcode
+
+ An \a operation can be optionally specified as the last argument. Supported
+ operations:
+
+ \value StackView.Transition An operation with transitions.
+ \value StackView.Immediate An immediate operation without transitions.
+
+ \sa initialItem, {Pushing Items}
+*/
+void QQuickStackView::push(QQmlV4Function *args)
+{
+ Q_D(QQuickStackView);
+ if (args->length() <= 0) {
+ qmlInfo(this) << "push: missing arguments";
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+
+ Operation operation = d->elements.isEmpty() ? Immediate : Transition;
+ QV4::ScopedValue lastArg(scope, (*args)[args->length() - 1]);
+ if (lastArg->isInt32())
+ operation = static_cast<Operation>(lastArg->toInt32());
+
+ QList<QQuickStackElement *> elements = d->parseElements(args);
+ if (elements.isEmpty()) {
+ qmlInfo(this) << "push: nothing to push";
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QQuickStackElement *exit = nullptr;
+ if (!d->elements.isEmpty())
+ exit = d->elements.top();
+
+ if (d->pushElements(elements)) {
+ emit depthChanged();
+ QQuickStackElement *enter = d->elements.top();
+ d->pushTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->setCurrentItem(enter->item);
+ }
+
+ if (d->currentItem) {
+ QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, d->currentItem));
+ args->setReturnValue(rv->asReturnedValue());
+ } else {
+ args->setReturnValue(QV4::Encode::null());
+ }
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::StackView::pop(item, operation)
+
+ Pops one or more items off the stack. Returns the last item removed from the stack.
+
+ If the \a item argument is specified, all items down to (but not
+ including) \a item will be popped. If \a item is \c null, all
+ items down to (but not including) the first item is popped.
+ If not specified, only the current item is popped.
+
+ An \a operation can be optionally specified as the last argument. Supported
+ operations:
+
+ \value StackView.Transition An operation with transitions.
+ \value StackView.Immediate An immediate operation without transitions.
+
+ Examples:
+ \code
+ stackView.pop()
+ stackView.pop(someItem, StackView.Immediate)
+ stackView.pop(StackView.Immediate)
+ stackView.pop(null)
+ \endcode
+
+ \sa clear(), {Popping Items}, {Unwinding Items via Pop}
+*/
+void QQuickStackView::pop(QQmlV4Function *args)
+{
+ Q_D(QQuickStackView);
+ int argc = args->length();
+ if (d->elements.count() <= 1 || argc > 2) {
+ if (argc > 2)
+ qmlInfo(this) << "pop: too many arguments";
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QQuickStackElement *exit = d->elements.pop();
+ QQuickStackElement *enter = d->elements.top();
+
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+
+ if (argc > 0) {
+ QV4::ScopedValue value(scope, (*args)[0]);
+ if (value->isNull()) {
+ enter = d->elements.value(0);
+ } else if (const QV4::QObjectWrapper *o = value->as<QV4::QObjectWrapper>()) {
+ QQuickItem *item = qobject_cast<QQuickItem *>(o->object());
+ enter = d->findElement(item);
+ if (!enter) {
+ if (item != d->currentItem)
+ qmlInfo(this) << "pop: unknown argument: " << value->toQString(); // TODO: safe?
+ args->setReturnValue(QV4::Encode::null());
+ d->elements.push(exit); // restore
+ return;
+ }
+ }
+ }
+
+ Operation operation = Transition;
+ if (argc > 0) {
+ QV4::ScopedValue lastArg(scope, (*args)[argc - 1]);
+ if (lastArg->isInt32())
+ operation = static_cast<Operation>(lastArg->toInt32());
+ }
+
+ QQuickItem *previousItem = nullptr;
+
+ if (d->popElements(enter)) {
+ if (exit)
+ previousItem = exit->item;
+ emit depthChanged();
+ d->popTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->setCurrentItem(enter->item);
+ }
+
+ if (previousItem) {
+ QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, previousItem));
+ args->setReturnValue(rv->asReturnedValue());
+ } else {
+ args->setReturnValue(QV4::Encode::null());
+ }
+}
+
+/*!
+ \qmlmethod Item QtQuick.Controls::StackView::replace(target, item, properties, operation)
+
+ Replaces one or more items on the stack with the specified \a item and
+ \a operation, and optionally applies a set of \a properties on the
+ item. The item can be an \l Item, \l Component, or a \l [QML] url.
+ Returns the item that became current.
+
+ If the \a target argument is specified, all items down to the \target
+ item will be replaced. If \a target is \c null, all items in the stack
+ will be replaced. If not specified, only the top item will be replaced.
+
+ StackView creates an instance automatically if the replacing item is a \l Component,
+ or a \l [QML] url. The optional \a properties argument specifies a map of initial
+ property values for the replacing item. For dynamically created items, these values
+ are applied before the creation is finalized. This is more efficient than setting
+ property values after creation, particularly where large sets of property values
+ are defined, and also allows property bindings to be set up (using \l{Qt::binding}
+ {Qt.binding()}) before the item is created.
+
+ Replace the top item:
+ \code
+ stackView.replace(rect)
+
+ // or with properties:
+ stackView.replace(rect, {"color": "red"})
+ \endcode
+
+ Multiple items can be replaced at the same time either by passing them as
+ additional arguments, or as an array. Each item can be followed by a set
+ of properties to apply.
+
+ Passing a variable amount of arguments:
+ \code
+ stackView.replace(rect1, rect2, rect3)
+
+ // or with properties:
+ stackView.replace(rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"})
+ \endcode
+
+ Replacing an array of items:
+ \code
+ stackView.replace([rect1, rect2, rect3])
+
+ // or with properties:
+ stackView.replace([rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"}])
+ \endcode
+
+ An \a operation can be optionally specified as the last argument. Supported
+ operations:
+
+ \value StackView.Transition An operation with transitions.
+ \value StackView.Immediate An immediate operation without transitions.
+
+ \sa push(), {Replacing Items}
+*/
+void QQuickStackView::replace(QQmlV4Function *args)
+{
+ Q_D(QQuickStackView);
+ if (args->length() <= 0) {
+ qmlInfo(this) << "replace: missing arguments";
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+
+ Operation operation = d->elements.isEmpty() ? Immediate : Transition;
+ QV4::ScopedValue lastArg(scope, (*args)[args->length() - 1]);
+ if (lastArg->isInt32())
+ operation = static_cast<Operation>(lastArg->toInt32());
+
+ QQuickStackElement *target = nullptr;
+ QV4::ScopedValue firstArg(scope, (*args)[0]);
+ if (firstArg->isNull())
+ target = d->elements.value(0);
+ else if (!firstArg->isInt32())
+ target = d->findElement(firstArg);
+
+ QList<QQuickStackElement *> elements = d->parseElements(args, target ? 1 : 0);
+ if (elements.isEmpty()) {
+ qmlInfo(this) << "replace: nothing to push";
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ int depth = d->elements.count();
+ QQuickStackElement* exit = nullptr;
+ if (!d->elements.isEmpty())
+ exit = d->elements.pop();
+
+ if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) {
+ if (depth != d->elements.count())
+ emit depthChanged();
+ QQuickStackElement *enter = d->elements.top();
+ d->replaceTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->setCurrentItem(enter->item);
+ }
+
+ if (d->currentItem) {
+ QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, d->currentItem));
+ args->setReturnValue(rv->asReturnedValue());
+ } else {
+ args->setReturnValue(QV4::Encode::null());
+ }
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::StackView::clear()
+
+ Removes all items from the stack. No animations are applied.
+*/
+void QQuickStackView::clear()
+{
+ Q_D(QQuickStackView);
+ d->setCurrentItem(nullptr);
+ qDeleteAll(d->elements);
+ d->elements.clear();
+ emit depthChanged();
+}
+
+/*!
+ \qmlproperty var QtQuick.Controls::StackView::initialItem
+
+ This property holds the initial item that should be shown when the StackView
+ is created. The initial item can be an \l Item, \l Component, or a \l [QML] url.
+ Specifying an initial item is equivalent to:
+ \code
+ Component.onCompleted: stackView.push(myInitialItem)
+ \endcode
+
+ \sa push()
+*/
+QVariant QQuickStackView::initialItem() const
+{
+ Q_D(const QQuickStackView);
+ return d->initialItem;
+}
+
+void QQuickStackView::setInitialItem(const QVariant &item)
+{
+ Q_D(QQuickStackView);
+ d->initialItem = item;
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::StackView::popEnter
+
+ This property holds the transition that is applied to the item that
+ enters the stack when another item is popped off of it.
+
+ \sa {Customizing StackView}
+*/
+QQuickTransition *QQuickStackView::popEnter() const
+{
+ Q_D(const QQuickStackView);
+ if (d->transitioner)
+ return d->transitioner->removeDisplacedTransition;
+ return nullptr;
+}
+
+void QQuickStackView::setPopEnter(QQuickTransition *enter)
+{
+ Q_D(QQuickStackView);
+ d->ensureTransitioner();
+ if (d->transitioner->removeDisplacedTransition == enter)
+ return;
+
+ d->transitioner->removeDisplacedTransition = enter;
+ emit popEnterChanged();
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::StackView::popExit
+
+ This property holds the transition that is applied to the item that
+ exits the stack when the item is popped off of it.
+
+ \sa {Customizing StackView}
+*/
+QQuickTransition *QQuickStackView::popExit() const
+{
+ Q_D(const QQuickStackView);
+ if (d->transitioner)
+ return d->transitioner->removeTransition;
+ return nullptr;
+}
+
+void QQuickStackView::setPopExit(QQuickTransition *exit)
+{
+ Q_D(QQuickStackView);
+ d->ensureTransitioner();
+ if (d->transitioner->removeTransition == exit)
+ return;
+
+ d->transitioner->removeTransition = exit;
+ emit popExitChanged();
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::StackView::pushEnter
+
+ This property holds the transition that is applied to the item that
+ enters the stack when the item is pushed onto it.
+
+ \sa {Customizing StackView}
+*/
+QQuickTransition *QQuickStackView::pushEnter() const
+{
+ Q_D(const QQuickStackView);
+ if (d->transitioner)
+ return d->transitioner->addTransition;
+ return nullptr;
+}
+
+void QQuickStackView::setPushEnter(QQuickTransition *enter)
+{
+ Q_D(QQuickStackView);
+ d->ensureTransitioner();
+ if (d->transitioner->addTransition == enter)
+ return;
+
+ d->transitioner->addTransition = enter;
+ emit pushEnterChanged();
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::StackView::pushExit
+
+ This property holds the transition that is applied to the item that
+ exits the stack when another item is pushed onto it.
+
+ \sa {Customizing StackView}
+*/
+QQuickTransition *QQuickStackView::pushExit() const
+{
+ Q_D(const QQuickStackView);
+ if (d->transitioner)
+ return d->transitioner->addDisplacedTransition;
+ return nullptr;
+}
+
+void QQuickStackView::setPushExit(QQuickTransition *exit)
+{
+ Q_D(QQuickStackView);
+ d->ensureTransitioner();
+ if (d->transitioner->addDisplacedTransition == exit)
+ return;
+
+ d->transitioner->addDisplacedTransition = exit;
+ emit pushExitChanged();
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::StackView::replaceEnter
+
+ This property holds the transition that is applied to the item that
+ enters the stack when another item is replaced by it.
+
+ \sa {Customizing StackView}
+*/
+QQuickTransition *QQuickStackView::replaceEnter() const
+{
+ Q_D(const QQuickStackView);
+ if (d->transitioner)
+ return d->transitioner->moveTransition;
+ return nullptr;
+}
+
+void QQuickStackView::setReplaceEnter(QQuickTransition *enter)
+{
+ Q_D(QQuickStackView);
+ d->ensureTransitioner();
+ if (d->transitioner->moveTransition == enter)
+ return;
+
+ d->transitioner->moveTransition = enter;
+ emit replaceEnterChanged();
+}
+
+/*!
+ \qmlproperty Transition QtQuick.Controls::StackView::replaceExit
+
+ This property holds the transition that is applied to the item that
+ exits the stack when it is replaced by another item.
+
+ \sa {Customizing StackView}
+*/
+QQuickTransition *QQuickStackView::replaceExit() const
+{
+ Q_D(const QQuickStackView);
+ if (d->transitioner)
+ return d->transitioner->moveDisplacedTransition;
+ return nullptr;
+}
+
+void QQuickStackView::setReplaceExit(QQuickTransition *exit)
+{
+ Q_D(QQuickStackView);
+ d->ensureTransitioner();
+ if (d->transitioner->moveDisplacedTransition == exit)
+ return;
+
+ d->transitioner->moveDisplacedTransition = exit;
+ emit replaceExitChanged();
+}
+
+void QQuickStackView::componentComplete()
+{
+ QQuickControl::componentComplete();
+
+ Q_D(QQuickStackView);
+ QQuickStackElement *element = nullptr;
+ if (QObject *o = d->initialItem.value<QObject *>())
+ element = QQuickStackElement::fromObject(o, this);
+ else if (d->initialItem.canConvert<QString>())
+ element = QQuickStackElement::fromString(d->initialItem.toString(), this);
+ if (d->pushElement(element)) {
+ emit depthChanged();
+ d->setCurrentItem(element->item);
+ element->setStatus(QQuickStackView::Active);
+ }
+}
+
+void QQuickStackView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+
+ Q_D(QQuickStackView);
+ for (QQuickStackElement *element : qAsConst(d->elements)) {
+ if (element->item) {
+ if (!element->widthValid)
+ element->item->setWidth(newGeometry.width());
+ if (!element->heightValid)
+ element->item->setHeight(newGeometry.height());
+ }
+ }
+}
+
+bool QQuickStackView::childMouseEventFilter(QQuickItem *item, QEvent *event)
+{
+ // in order to block accidental user interaction while busy/transitioning,
+ // StackView filters out childrens' mouse events. therefore we block all
+ // press events. however, since push() may be called from signal handlers
+ // such as onPressed or onDoubleClicked, we must let the current mouse
+ // grabber item receive the respective mouse release event to avoid
+ // breaking its state (QTBUG-50305).
+ if (event->type() == QEvent::MouseButtonPress)
+ return true;
+ QQuickWindow *window = item->window();
+ return window && !window->mouseGrabberItem();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickStackView::accessibleRole() const
+{
+ return QAccessible::LayeredPane;
+}
+#endif
+
+void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+{
+ Q_Q(QQuickStackAttached);
+ int oldIndex = element ? element->index : -1;
+ 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) : nullptr;
+
+ int newIndex = element ? element->index : -1;
+ QQuickStackView::Status newStatus = element ? element->status : QQuickStackView::Inactive;
+
+ if (oldIndex != newIndex)
+ emit q->indexChanged();
+ if (oldView != newView)
+ emit q->viewChanged();
+ if (oldStatus != newStatus)
+ emit q->statusChanged();
+}
+
+QQuickStackAttached::QQuickStackAttached(QQuickItem *parent) :
+ QObject(*(new QQuickStackAttachedPrivate), parent)
+{
+ Q_D(QQuickStackAttached);
+ QQuickItemPrivate::get(parent)->addItemChangeListener(d, QQuickItemPrivate::Parent);
+ d->itemParentChanged(parent, parent->parentItem());
+}
+
+QQuickStackAttached::~QQuickStackAttached()
+{
+ Q_D(QQuickStackAttached);
+ QQuickItem *parentItem = static_cast<QQuickItem *>(parent());
+ QQuickItemPrivate::get(parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Parent);
+}
+
+/*!
+ \qmlattachedproperty int QtQuick.Controls::StackView::index
+ \readonly
+
+ This attached property holds the stack index of the item it's
+ attached to, or \c -1 if the item is not in a stack.
+*/
+int QQuickStackAttached::index() const
+{
+ Q_D(const QQuickStackAttached);
+ return d->element ? d->element->index : -1;
+}
+
+/*!
+ \qmlattachedproperty StackView QtQuick.Controls::StackView::view
+ \readonly
+
+ This attached property holds the stack view of the item it's
+ attached to, or \c null if the item is not in a stack.
+*/
+QQuickStackView *QQuickStackAttached::view() const
+{
+ Q_D(const QQuickStackAttached);
+ return d->element ? d->element->view : nullptr;
+}
+
+/*!
+ \qmlattachedproperty enumeration QtQuick.Controls::StackView::status
+ \readonly
+
+ This attached property holds the stack status of the item it's
+ attached to, or \c StackView.Inactive if the item is not in a stack.
+
+ Available values:
+ \value StackView.Inactive The item is inactive (or not in a stack).
+ \value StackView.Deactivating The item is being deactivated (popped off).
+ \value StackView.Activating The item is being activated (becoming the current item).
+ \value StackView.Active The item is active, that is, the current item.
+*/
+QQuickStackView::Status QQuickStackAttached::status() const
+{
+ Q_D(const QQuickStackAttached);
+ return d->element ? d->element->status : QQuickStackView::Inactive;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
new file mode 100644
index 00000000..050bfde9
--- /dev/null
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -0,0 +1,557 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickstackview_p_p.h"
+
+#include <QtQml/qqmlinfo.h>
+#include <QtQml/qqmllist.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQml/qqmlincubator.h>
+#include <QtQml/private/qv4qobjectwrapper_p.h>
+#include <QtQml/private/qqmlcomponent_p.h>
+#include <QtQml/private/qqmlengine_p.h>
+#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQuick/private/qquicktransition_p.h>
+#include <QtQuick/private/qquickitemviewtransition_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static QQuickStackAttached *attachedStackObject(QQuickStackElement *element)
+{
+ QQuickStackAttached *attached = qobject_cast<QQuickStackAttached *>(qmlAttachedPropertiesObject<QQuickStackView>(element->item, false));
+ if (attached)
+ QQuickStackAttachedPrivate::get(attached)->element = element;
+ return attached;
+}
+
+class QQuickStackIncubator : public QQmlIncubator
+{
+public:
+ QQuickStackIncubator(QQuickStackElement *element) : QQmlIncubator(Synchronous), element(element) { }
+
+protected:
+ void setInitialState(QObject *object) override { element->incubate(object); }
+
+private:
+ QQuickStackElement *element;
+};
+
+QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(nullptr),
+ index(-1), init(false), removal(false), ownItem(false), ownComponent(false), widthValid(false), heightValid(false),
+ context(nullptr), component(nullptr), incubator(nullptr), view(nullptr),
+ status(QQuickStackView::Inactive)
+{
+}
+
+QQuickStackElement::~QQuickStackElement()
+{
+ if (item)
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed);
+
+ if (ownComponent)
+ delete component;
+
+ if (item) {
+ if (ownItem) {
+ item->setParentItem(nullptr);
+ item->deleteLater();
+ item = nullptr;
+ } else {
+ item->setVisible(false);
+ if (!widthValid)
+ item->resetWidth();
+ if (!heightValid)
+ item->resetHeight();
+ if (item->parentItem() != originalParent) {
+ item->setParentItem(originalParent);
+ } else {
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ QQuickStackAttachedPrivate::get(attached)->itemParentChanged(item, nullptr);
+ }
+ }
+ }
+
+ delete context;
+ delete incubator;
+}
+
+QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickStackView *view)
+{
+ QQuickStackElement *element = new QQuickStackElement;
+ element->component = new QQmlComponent(qmlEngine(view), QUrl(str), view);
+ element->ownComponent = true;
+ return element;
+}
+
+QQuickStackElement *QQuickStackElement::fromObject(QObject *object, QQuickStackView *view)
+{
+ QQuickStackElement *element = new QQuickStackElement;
+ element->component = qobject_cast<QQmlComponent *>(object);
+ if (!element->component) {
+ element->component = new QQmlComponent(qmlEngine(view), view);
+ element->ownComponent = true;
+ }
+ element->item = qobject_cast<QQuickItem *>(object);
+ if (element->item)
+ element->originalParent = element->item->parentItem();
+ return element;
+}
+
+bool QQuickStackElement::load(QQuickStackView *parent)
+{
+ setView(parent);
+ if (!item) {
+ ownItem = true;
+
+ if (component->isLoading()) {
+ QObject::connect(component, &QQmlComponent::statusChanged, [this](QQmlComponent::Status status) {
+ if (status == QQmlComponent::Ready)
+ load(view);
+ else if (status == QQmlComponent::Error)
+ qWarning() << qPrintable(component->errorString().trimmed());
+ });
+ return true;
+ }
+
+ QQmlContext *creationContext = component->creationContext();
+ if (!creationContext)
+ creationContext = qmlContext(parent);
+ context = new QQmlContext(creationContext);
+ context->setContextObject(parent);
+
+ delete incubator;
+ incubator = new QQuickStackIncubator(this);
+ component->create(*incubator, context);
+ if (component->isError())
+ qWarning() << qPrintable(component->errorString().trimmed());
+ } else {
+ initialize();
+ }
+ return item;
+}
+
+void QQuickStackElement::incubate(QObject *object)
+{
+ item = qmlobject_cast<QQuickItem *>(object);
+ if (item) {
+ QQmlEngine::setObjectOwnership(item, QQmlEngine::CppOwnership);
+ item->setParent(view);
+ initialize();
+ }
+}
+
+void QQuickStackElement::initialize()
+{
+ if (!item || init)
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ if (!(widthValid = p->widthValid))
+ item->setWidth(view->width());
+ if (!(heightValid = p->heightValid))
+ item->setHeight(view->height());
+ item->setParentItem(view);
+ p->addItemChangeListener(this, QQuickItemPrivate::Destroyed);
+
+ if (!properties.isUndefined()) {
+ QQmlComponentPrivate *d = QQmlComponentPrivate::get(component);
+ Q_ASSERT(d && d->engine);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(d->engine);
+ Q_ASSERT(v4);
+ QV4::Scope scope(v4);
+ QV4::ScopedValue ipv(scope, properties.value());
+ QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value());
+ d->initializeObjectWithInitialProperties(qmlContext, ipv, item);
+ properties.clear();
+ }
+
+ init = true;
+}
+
+void QQuickStackElement::setIndex(int value)
+{
+ if (index == value)
+ return;
+
+ index = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->indexChanged();
+}
+
+void QQuickStackElement::setView(QQuickStackView *value)
+{
+ if (view == value)
+ return;
+
+ view = value;
+ QQuickStackAttached *attached = attachedStackObject(this);
+ if (attached)
+ emit attached->viewChanged();
+}
+
+void QQuickStackElement::setStatus(QQuickStackView::Status value)
+{
+ 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)
+{
+ if (transitioner)
+ transitioner->transitionNextReposition(this, type, asTarget);
+}
+
+bool QQuickStackElement::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds)
+{
+ if (transitioner) {
+ if (item) {
+ QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
+ // TODO: expose QQuickAnchorLine so we can test for other conflicting anchors
+ if (anchors && (anchors->fill() || anchors->centerIn()))
+ qmlInfo(item) << "StackView has detected conflicting anchors. Transitions may not execute properly.";
+ }
+
+ // TODO: add force argument to QQuickItemViewTransitionableItem::prepareTransition()?
+ nextTransitionToSet = true;
+ nextTransitionFromSet = true;
+ nextTransitionFrom += QPointF(1, 1);
+ return QQuickItemViewTransitionableItem::prepareTransition(transitioner, index, viewBounds);
+ }
+ return false;
+}
+
+void QQuickStackElement::startTransition(QQuickItemViewTransitioner *transitioner, QQuickStackView::Status status)
+{
+ setStatus(status);
+ if (transitioner)
+ QQuickItemViewTransitionableItem::startTransition(transitioner, index);
+}
+
+void QQuickStackElement::itemDestroyed(QQuickItem *)
+{
+ item = nullptr;
+}
+
+QQuickStackViewPrivate::QQuickStackViewPrivate() : busy(false), currentItem(nullptr), transitioner(nullptr)
+{
+}
+
+void QQuickStackViewPrivate::setCurrentItem(QQuickItem *item)
+{
+ Q_Q(QQuickStackView);
+ 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)
+{
+ if (props.isObject()) {
+ const QV4::QObjectWrapper *wrapper = props.as<QV4::QObjectWrapper>();
+ if (!wrapper) {
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ element->properties.set(v4, props);
+ element->qmlCallingContext.set(v4, v4->qmlContext());
+ return true;
+ }
+ }
+ return false;
+}
+
+QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function *args, int from)
+{
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+
+ QList<QQuickStackElement *> elements;
+
+ int argc = args->length();
+ for (int i = from; i < argc; ++i) {
+ QV4::ScopedValue arg(scope, (*args)[i]);
+ if (QV4::ArrayObject *array = arg->as<QV4::ArrayObject>()) {
+ int len = array->getLength();
+ for (int j = 0; j < len; ++j) {
+ QV4::ScopedValue value(scope, array->getIndexed(j));
+ QQuickStackElement *element = createElement(value);
+ if (element) {
+ if (j < len - 1) {
+ QV4::ScopedValue props(scope, array->getIndexed(j + 1));
+ if (initProperties(element, props, args))
+ ++j;
+ }
+ elements += element;
+ }
+ }
+ } else {
+ QQuickStackElement *element = createElement(arg);
+ if (element) {
+ if (i < argc - 1) {
+ QV4::ScopedValue props(scope, (*args)[i + 1]);
+ if (initProperties(element, props, args))
+ ++i;
+ }
+ elements += element;
+ }
+ }
+ }
+ return elements;
+}
+
+QQuickStackElement *QQuickStackViewPrivate::findElement(QQuickItem *item) const
+{
+ if (item) {
+ for (QQuickStackElement *e : qAsConst(elements)) {
+ if (e->item == item)
+ return e;
+ }
+ }
+ 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 nullptr;
+}
+
+QQuickStackElement *QQuickStackViewPrivate::createElement(const QV4::Value &value)
+{
+ Q_Q(QQuickStackView);
+ if (const QV4::String *s = value.as<QV4::String>())
+ return QQuickStackElement::fromString(s->toQString(), q);
+ if (const QV4::QObjectWrapper *o = value.as<QV4::QObjectWrapper>())
+ return QQuickStackElement::fromObject(o->object(), q);
+ return nullptr;
+}
+
+bool QQuickStackViewPrivate::pushElements(const QList<QQuickStackElement *> &elems)
+{
+ Q_Q(QQuickStackView);
+ if (!elems.isEmpty()) {
+ for (QQuickStackElement *e : elems) {
+ e->setIndex(elements.count());
+ elements += e;
+ }
+ return elements.top()->load(q);
+ }
+ return false;
+}
+
+bool QQuickStackViewPrivate::pushElement(QQuickStackElement *element)
+{
+ if (element)
+ return pushElements(QList<QQuickStackElement *>() << element);
+ return false;
+}
+
+bool QQuickStackViewPrivate::popElements(QQuickStackElement *element)
+{
+ Q_Q(QQuickStackView);
+ while (elements.count() > 1 && elements.top() != element) {
+ delete elements.pop();
+ if (!element)
+ break;
+ }
+ return elements.top()->load(q);
+}
+
+bool QQuickStackViewPrivate::replaceElements(QQuickStackElement *target, const QList<QQuickStackElement *> &elems)
+{
+ if (target) {
+ while (!elements.isEmpty()) {
+ QQuickStackElement* top = elements.pop();
+ delete top;
+ if (top == target)
+ break;
+ }
+ }
+ return pushElements(elems);
+}
+
+void QQuickStackViewPrivate::ensureTransitioner()
+{
+ if (!transitioner) {
+ transitioner = new QQuickItemViewTransitioner;
+ transitioner->setChangeListener(this);
+ }
+}
+
+void QQuickStackViewPrivate::popTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
+{
+ ensureTransitioner();
+
+ if (exit)
+ exit->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, true);
+ if (enter)
+ enter->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false);
+
+ if (exit) {
+ exit->removal = true;
+ if (immediate || !exit->item || !exit->prepareTransition(transitioner, viewBounds))
+ completeTransition(exit, transitioner->removeTransition, QQuickStackView::Deactivating);
+ else
+ exit->startTransition(transitioner, QQuickStackView::Deactivating);
+ }
+ if (enter) {
+ if (immediate || !enter->item || !enter->prepareTransition(transitioner, QRectF()))
+ completeTransition(enter, transitioner->removeDisplacedTransition, QQuickStackView::Activating);
+ else
+ enter->startTransition(transitioner, QQuickStackView::Activating);
+ }
+
+ if (transitioner) {
+ setBusy(!transitioner->runningJobs.isEmpty());
+ transitioner->resetTargetLists();
+ }
+}
+
+void QQuickStackViewPrivate::pushTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
+{
+ ensureTransitioner();
+
+ if (enter)
+ enter->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);
+ if (exit)
+ exit->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
+
+ if (enter) {
+ if (immediate || !enter->item || !enter->prepareTransition(transitioner, viewBounds))
+ completeTransition(enter, transitioner->addTransition, QQuickStackView::Activating);
+ else
+ enter->startTransition(transitioner, QQuickStackView::Activating);
+ }
+ if (exit) {
+ if (immediate || !exit->item || !exit->prepareTransition(transitioner, QRectF()))
+ completeTransition(exit, transitioner->addDisplacedTransition, QQuickStackView::Deactivating);
+ else
+ exit->startTransition(transitioner, QQuickStackView::Deactivating);
+ }
+
+ if (transitioner) {
+ setBusy(!transitioner->runningJobs.isEmpty());
+ transitioner->resetTargetLists();
+ }
+}
+
+void QQuickStackViewPrivate::replaceTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
+{
+ ensureTransitioner();
+
+ if (exit)
+ exit->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
+ if (enter)
+ enter->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
+
+ if (exit) {
+ exit->removal = true;
+ if (immediate || !exit->item || !exit->prepareTransition(transitioner, QRectF()))
+ completeTransition(exit, transitioner->moveDisplacedTransition, QQuickStackView::Deactivating);
+ else
+ exit->startTransition(transitioner, QQuickStackView::Deactivating);
+ }
+ if (enter) {
+ if (immediate || !enter->item || !enter->prepareTransition(transitioner, viewBounds))
+ completeTransition(enter, transitioner->moveTransition, QQuickStackView::Activating);
+ else
+ enter->startTransition(transitioner, QQuickStackView::Activating);
+ }
+
+ if (transitioner) {
+ setBusy(!transitioner->runningJobs.isEmpty());
+ transitioner->resetTargetLists();
+ }
+}
+
+void QQuickStackViewPrivate::completeTransition(QQuickStackElement *element, QQuickTransition *transition, QQuickStackView::Status status)
+{
+ element->setStatus(status);
+ if (transition) {
+ // TODO: add a proper way to complete a transition
+ QQmlListProperty<QQuickAbstractAnimation> animations = transition->animations();
+ int count = animations.count(&animations);
+ for (int i = 0; i < count; ++i) {
+ QQuickAbstractAnimation *anim = animations.at(&animations, i);
+ anim->complete();
+ }
+ }
+ viewItemTransitionFinished(element);
+}
+
+void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransitionableItem *transitionable)
+{
+ QQuickStackElement *element = static_cast<QQuickStackElement *>(transitionable);
+ if (element->status == QQuickStackView::Activating) {
+ element->setStatus(QQuickStackView::Active);
+ } else if (element->status == QQuickStackView::Deactivating) {
+ element->setStatus(QQuickStackView::Inactive);
+ if (element->item)
+ element->item->setVisible(false);
+ if (element->removal || element->isPendingRemoval())
+ removals += element;
+ }
+
+ if (transitioner->runningJobs.isEmpty()) {
+ qDeleteAll(removals);
+ removals.clear();
+ setBusy(false);
+ }
+}
+
+void QQuickStackViewPrivate::setBusy(bool b)
+{
+ Q_Q(QQuickStackView);
+ if (busy == b)
+ return;
+
+ busy = b;
+ q->setFiltersChildMouseEvents(busy);
+ emit q->busyChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h
new file mode 100644
index 00000000..f994f361
--- /dev/null
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTACKVIEW_P_H
+#define QQUICKSTACKVIEW_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlV4Function;
+class QQuickTransition;
+class QQuickStackElement;
+class QQuickStackAttached;
+class QQuickStackViewPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackView : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(bool busy READ isBusy NOTIFY busyChanged FINAL)
+ Q_PROPERTY(int depth READ depth NOTIFY depthChanged FINAL)
+ Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
+ Q_PROPERTY(QVariant initialItem READ initialItem WRITE setInitialItem FINAL)
+ Q_PROPERTY(QQuickTransition *popEnter READ popEnter WRITE setPopEnter NOTIFY popEnterChanged FINAL)
+ Q_PROPERTY(QQuickTransition *popExit READ popExit WRITE setPopExit NOTIFY popExitChanged FINAL)
+ Q_PROPERTY(QQuickTransition *pushEnter READ pushEnter WRITE setPushEnter NOTIFY pushEnterChanged FINAL)
+ Q_PROPERTY(QQuickTransition *pushExit READ pushExit WRITE setPushExit NOTIFY pushExitChanged FINAL)
+ Q_PROPERTY(QQuickTransition *replaceEnter READ replaceEnter WRITE setReplaceEnter NOTIFY replaceEnterChanged FINAL)
+ Q_PROPERTY(QQuickTransition *replaceExit READ replaceExit WRITE setReplaceExit NOTIFY replaceExitChanged FINAL)
+
+public:
+ explicit QQuickStackView(QQuickItem *parent = nullptr);
+ ~QQuickStackView();
+
+ static QQuickStackAttached *qmlAttachedProperties(QObject *object);
+
+ bool isBusy() const;
+ int depth() const;
+ QQuickItem *currentItem() const;
+
+ enum Status {
+ Inactive = 0,
+ Deactivating = 1,
+ Activating = 2,
+ Active = 3
+ };
+ Q_ENUM(Status)
+
+ QVariant initialItem() const;
+ void setInitialItem(const QVariant &item);
+
+ QQuickTransition *popEnter() const;
+ void setPopEnter(QQuickTransition *enter);
+
+ QQuickTransition *popExit() const;
+ void setPopExit(QQuickTransition *exit);
+
+ QQuickTransition *pushEnter() const;
+ void setPushEnter(QQuickTransition *enter);
+
+ QQuickTransition *pushExit() const;
+ void setPushExit(QQuickTransition *exit);
+
+ QQuickTransition *replaceEnter() const;
+ void setReplaceEnter(QQuickTransition *enter);
+
+ QQuickTransition *replaceExit() const;
+ void setReplaceExit(QQuickTransition *exit);
+
+ enum LoadBehavior {
+ DontLoad,
+ ForceLoad
+ };
+ Q_ENUM(LoadBehavior)
+
+ Q_INVOKABLE QQuickItem *get(int index, LoadBehavior behavior = DontLoad);
+ Q_INVOKABLE QQuickItem *find(const QJSValue &callback, LoadBehavior behavior = DontLoad);
+
+ enum Operation {
+ Transition,
+ Immediate
+ };
+ Q_ENUM(Operation)
+
+ Q_INVOKABLE void push(QQmlV4Function *args);
+ Q_INVOKABLE void pop(QQmlV4Function *args);
+ Q_INVOKABLE void replace(QQmlV4Function *args);
+
+public Q_SLOTS:
+ void clear();
+
+Q_SIGNALS:
+ void busyChanged();
+ void depthChanged();
+ void currentItemChanged();
+ void popEnterChanged();
+ void popExitChanged();
+ void pushEnterChanged();
+ void pushExitChanged();
+ void replaceEnterChanged();
+ void replaceExitChanged();
+
+protected:
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ bool childMouseEventFilter(QQuickItem *, QEvent *) override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickStackView)
+ Q_DECLARE_PRIVATE(QQuickStackView)
+};
+
+class QQuickStackAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
+ Q_PROPERTY(QQuickStackView *view READ view NOTIFY viewChanged FINAL)
+ Q_PROPERTY(QQuickStackView::Status status READ status NOTIFY statusChanged FINAL)
+
+public:
+ explicit QQuickStackAttached(QQuickItem *parent = nullptr);
+ ~QQuickStackAttached();
+
+ int index() const;
+ QQuickStackView *view() const;
+ QQuickStackView::Status status() const;
+
+Q_SIGNALS:
+ void indexChanged();
+ void viewChanged();
+ void statusChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickStackAttached)
+ Q_DECLARE_PRIVATE(QQuickStackAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickStackView)
+QML_DECLARE_TYPEINFO(QQuickStackView, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKSTACKVIEW_P_H
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
new file mode 100644
index 00000000..6abaaad6
--- /dev/null
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -0,0 +1,163 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSTACKVIEW_P_P_H
+#define QQUICKSTACKVIEW_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickstackview_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+#include <QtQuick/private/qquickitemviewtransition_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQml/private/qv4persistent_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlContext;
+class QQmlComponent;
+class QQmlIncubator;
+
+class QQuickStackElement : public QQuickItemViewTransitionableItem, public QQuickItemChangeListener
+{
+ QQuickStackElement();
+
+public:
+ ~QQuickStackElement();
+
+ static QQuickStackElement *fromString(const QString &str, QQuickStackView *view);
+ static QQuickStackElement *fromObject(QObject *object, QQuickStackView *view);
+
+ bool load(QQuickStackView *parent);
+ void incubate(QObject *object);
+ void initialize();
+
+ void setIndex(int index);
+ void setView(QQuickStackView *view);
+ void setStatus(QQuickStackView::Status status);
+
+ void transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget);
+ bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds);
+ void startTransition(QQuickItemViewTransitioner *transitioner, QQuickStackView::Status status);
+
+ void itemDestroyed(QQuickItem *item) override;
+
+ int index;
+ bool init;
+ bool removal;
+ bool ownItem;
+ bool ownComponent;
+ bool widthValid;
+ bool heightValid;
+ QQmlContext *context;
+ QQmlComponent *component;
+ QQmlIncubator *incubator;
+ QQuickStackView *view;
+ QPointer<QQuickItem> originalParent;
+ QQuickStackView::Status status;
+ QV4::PersistentValue properties;
+ QV4::PersistentValue qmlCallingContext;
+};
+
+class QQuickStackViewPrivate : public QQuickControlPrivate, public QQuickItemViewTransitionChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickStackView)
+
+public:
+ QQuickStackViewPrivate();
+
+ static QQuickStackViewPrivate *get(QQuickStackView *view)
+ {
+ return view->d_func();
+ }
+
+ void setCurrentItem(QQuickItem *item);
+
+ QList<QQuickStackElement *> parseElements(QQmlV4Function *args, int from = 0);
+ QQuickStackElement *findElement(QQuickItem *item) const;
+ QQuickStackElement *findElement(const QV4::Value &value) const;
+ QQuickStackElement *createElement(const QV4::Value &value);
+ bool pushElements(const QList<QQuickStackElement *> &elements);
+ bool pushElement(QQuickStackElement *element);
+ bool popElements(QQuickStackElement *element);
+ bool replaceElements(QQuickStackElement *element, const QList<QQuickStackElement *> &elements);
+
+ void ensureTransitioner();
+ void popTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate);
+ void pushTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate);
+ void replaceTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate);
+ void completeTransition(QQuickStackElement *element, QQuickTransition *transition, QQuickStackView::Status status);
+
+ void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) override;
+ void setBusy(bool busy);
+
+ bool busy;
+ QVariant initialItem;
+ QQuickItem *currentItem;
+ QList<QQuickStackElement*> removals;
+ QStack<QQuickStackElement *> elements;
+ QQuickItemViewTransitioner *transitioner;
+};
+
+class QQuickStackAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickStackAttached)
+
+public:
+ QQuickStackAttachedPrivate() : element(nullptr) { }
+
+ static QQuickStackAttachedPrivate *get(QQuickStackAttached *attached)
+ {
+ return attached->d_func();
+ }
+
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent);
+
+ QQuickStackElement *element;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTACKVIEW_P_P_H
diff --git a/src/quicktemplates2/qquickswipe_p.h b/src/quicktemplates2/qquickswipe_p.h
new file mode 100644
index 00000000..f701c63c
--- /dev/null
+++ b/src/quicktemplates2/qquickswipe_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWIPE_P_H
+#define QQUICKSWIPE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlComponent;
+class QQuickItem;
+class QQuickSwipeDelegate;
+class QQuickSwipePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(bool complete READ isComplete NOTIFY completeChanged FINAL)
+ Q_PROPERTY(QQmlComponent *left READ left WRITE setLeft NOTIFY leftChanged FINAL)
+ Q_PROPERTY(QQmlComponent *behind READ behind WRITE setBehind NOTIFY behindChanged FINAL)
+ Q_PROPERTY(QQmlComponent *right READ right WRITE setRight NOTIFY rightChanged FINAL)
+ Q_PROPERTY(QQuickItem *leftItem READ leftItem NOTIFY leftItemChanged FINAL)
+ Q_PROPERTY(QQuickItem *behindItem READ behindItem NOTIFY behindItemChanged FINAL)
+ Q_PROPERTY(QQuickItem *rightItem READ rightItem NOTIFY rightItemChanged FINAL)
+
+public:
+ explicit QQuickSwipe(QQuickSwipeDelegate *control);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ bool isComplete() const;
+ void setComplete(bool complete);
+
+ QQmlComponent *left() const;
+ void setLeft(QQmlComponent *left);
+
+ QQmlComponent *behind() const;
+ void setBehind(QQmlComponent *behind);
+
+ QQmlComponent *right() const;
+ void setRight(QQmlComponent *right);
+
+ QQuickItem *leftItem() const;
+ void setLeftItem(QQuickItem *item);
+
+ QQuickItem *behindItem() const;
+ void setBehindItem(QQuickItem *item);
+
+ QQuickItem *rightItem() const;
+ void setRightItem(QQuickItem *item);
+
+Q_SIGNALS:
+ void positionChanged();
+ void completeChanged();
+ void leftChanged();
+ void behindChanged();
+ void rightChanged();
+ void leftItemChanged();
+ void behindItemChanged();
+ void rightItemChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickSwipe)
+ Q_DECLARE_PRIVATE(QQuickSwipe)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSWIPE_P_H
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
new file mode 100644
index 00000000..0eac7fe1
--- /dev/null
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -0,0 +1,930 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickswipedelegate_p.h"
+#include "qquickswipedelegate_p_p.h"
+#include "qquickcontrol_p_p.h"
+#include "qquickitemdelegate_p_p.h"
+#include "qquickvelocitycalculator_p_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQml/qqmlinfo.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype SwipeDelegate
+ \inherits ItemDelegate
+ \instantiates QQuickSwipeDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-delegates
+ \brief Swipable item delegate.
+
+ SwipeDelegate presents a view item that can be swiped left or right to
+ expose more options or information. It is used as a delegate in views such
+ as \l ListView.
+
+ In the following example, SwipeDelegate is used in a \l ListView to allow
+ items to be removed from it by swiping to the left:
+
+ \snippet qtquickcontrols2-swipedelegate.qml 1
+
+ SwipeDelegate inherits its API from \l ItemDelegate, which is inherited
+ from AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton
+ API.
+
+ Information regarding the progress of a swipe, as well as the components
+ that should be shown upon swiping, are both available through the
+ \l {SwipeDelegate::}{swipe} grouped property object. For example,
+ \c swipe.position holds the position of the
+ swipe within the range \c -1.0 to \c 1.0. The \c swipe.left
+ property determines which item will be displayed when the control is swiped
+ to the right, and vice versa for \c swipe.right. The positioning of these
+ components is left to applications to decide. For example, without specifying
+ any position for \c swipe.left or \c swipe.right, the following will
+ occur:
+
+ \image qtquickcontrols2-swipedelegate.gif
+
+ If \c swipe.left and \c swipe.right are anchored to the left and
+ right of the \l {Control::}{background} item (respectively), they'll behave like this:
+
+ \image qtquickcontrols2-swipedelegate-leading-trailing.gif
+
+ When using \c swipe.left and \c swipe.right, the control cannot be
+ swiped past the left and right edges. To achieve this type of "wrapping"
+ behavior, set \c swipe.behind instead. This will result in the same
+ item being shown regardless of which direction the control is swiped. For
+ example, in the image below, we set \c swipe.behind and then swipe the
+ control repeatedly in both directions:
+
+ \image qtquickcontrols2-swipedelegate-behind.gif
+
+ \sa {Customizing SwipeDelegate}, {Delegate Controls}
+*/
+
+namespace {
+ enum PositionAnimation {
+ DontAnimatePosition,
+ AnimatePosition
+ };
+}
+
+class QQuickSwipePrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwipe)
+
+public:
+ QQuickSwipePrivate(QQuickSwipeDelegate *control) :
+ control(control),
+ positionBeforePress(0),
+ position(0),
+ wasComplete(false),
+ complete(false),
+ left(nullptr),
+ behind(nullptr),
+ right(nullptr),
+ leftItem(nullptr),
+ behindItem(nullptr),
+ rightItem(nullptr)
+ {
+ }
+
+ static QQuickSwipePrivate *get(QQuickSwipe *swipe);
+
+ QQuickItem *createDelegateItem(QQmlComponent *component);
+ QQuickItem *showRelevantItemForPosition(qreal position);
+ QQuickItem *createRelevantItemForDistance(qreal distance);
+ void reposition(PositionAnimation animationPolicy);
+ void createLeftItem();
+ void createBehindItem();
+ void createRightItem();
+ void createAndShowLeftItem();
+ void createAndShowBehindItem();
+ void createAndShowRightItem();
+
+ void warnAboutMixingDelegates();
+ void warnAboutSettingDelegatesWhileVisible();
+
+ bool hasDelegates() const;
+
+ QQuickSwipeDelegate *control;
+ // Same range as position, but is set before press events so that we can
+ // keep track of which direction the user must swipe when using left and right delegates.
+ qreal positionBeforePress;
+ qreal position;
+ // A "less strict" version of complete that is true if complete was true
+ // before the last press event.
+ bool wasComplete;
+ bool complete;
+ QQuickVelocityCalculator velocityCalculator;
+ QQmlComponent *left;
+ QQmlComponent *behind;
+ QQmlComponent *right;
+ QQuickItem *leftItem;
+ QQuickItem *behindItem;
+ QQuickItem *rightItem;
+};
+
+QQuickSwipePrivate *QQuickSwipePrivate::get(QQuickSwipe *swipe)
+{
+ return swipe->d_func();
+}
+
+QQuickItem *QQuickSwipePrivate::createDelegateItem(QQmlComponent *component)
+{
+ // If we don't use the correct context, it won't be possible to refer to
+ // the control's id from within the delegates.
+ QQmlContext *creationContext = component->creationContext();
+ // The component might not have been created in QML, in which case
+ // the creation context will be null and we have to create it ourselves.
+ if (!creationContext)
+ creationContext = qmlContext(control);
+ QQmlContext *context = new QQmlContext(creationContext);
+ context->setContextObject(control);
+ QQuickItem *item = qobject_cast<QQuickItem*>(component->beginCreate(context));
+ if (item) {
+ item->setParentItem(control);
+ component->completeCreate();
+ }
+ return item;
+}
+
+QQuickItem *QQuickSwipePrivate::showRelevantItemForPosition(qreal position)
+{
+ if (qFuzzyIsNull(position))
+ return nullptr;
+
+ if (behind) {
+ createAndShowBehindItem();
+ return behindItem;
+ }
+
+ if (right && position < 0.0) {
+ createAndShowRightItem();
+ return rightItem;
+ }
+
+ if (left && position > 0.0) {
+ createAndShowLeftItem();
+ return leftItem;
+ }
+
+ return nullptr;
+}
+
+QQuickItem *QQuickSwipePrivate::createRelevantItemForDistance(qreal distance)
+{
+ if (qFuzzyIsNull(distance))
+ return nullptr;
+
+ if (behind) {
+ createBehindItem();
+ return behindItem;
+ }
+
+ // a) If the position before the press was 0.0, we know that *any* movement
+ // whose distance is negative will result in the right item being shown and
+ // vice versa.
+ // b) Once the control has been exposed (that is, swiped to the left or right,
+ // and hence the position is either -1.0 or 1.0), we must use the width of the
+ // relevant item to determine if the distance is larger than that item,
+ // in order to know whether or not to display it.
+ // c) If the control has been exposed, and the swipe is larger than the width
+ // of the relevant item from which the swipe started from, we must show the
+ // item on the other side (if any).
+
+ if (right) {
+ if ((distance < 0.0 && positionBeforePress == 0.0) /* a) */
+ || (rightItem && positionBeforePress == -1.0 && distance < rightItem->width()) /* b) */
+ || (leftItem && positionBeforePress == 1.0 && qAbs(distance) > leftItem->width())) /* c) */ {
+ createRightItem();
+ return rightItem;
+ }
+ }
+
+ if (left) {
+ if ((distance > 0.0 && positionBeforePress == 0.0) /* a) */
+ || (leftItem && positionBeforePress == 1.0 && qAbs(distance) < leftItem->width()) /* b) */
+ || (rightItem && positionBeforePress == -1.0 && qAbs(distance) > rightItem->width())) /* c) */ {
+ createLeftItem();
+ return leftItem;
+ }
+ }
+
+ return nullptr;
+}
+
+void QQuickSwipePrivate::reposition(PositionAnimation animationPolicy)
+{
+ QQuickItem *relevantItem = showRelevantItemForPosition(position);
+ const qreal relevantWidth = relevantItem ? relevantItem->width() : 0.0;
+ const qreal contentItemX = position * relevantWidth + control->leftPadding();
+
+ // "Behavior on x" relies on the property system to know when it should update,
+ // so we can prevent it from animating by setting the x position directly.
+ if (animationPolicy == AnimatePosition) {
+ if (QQuickItem *contentItem = control->contentItem())
+ contentItem->setProperty("x", contentItemX);
+ if (QQuickItem *background = control->background())
+ background->setProperty("x", position * relevantWidth);
+ } else {
+ if (QQuickItem *contentItem = control->contentItem())
+ contentItem->setX(contentItemX);
+ if (QQuickItem *background = control->background())
+ background->setX(position * relevantWidth);
+ }
+}
+
+void QQuickSwipePrivate::createLeftItem()
+{
+ if (!leftItem) {
+ Q_Q(QQuickSwipe);
+ q->setLeftItem(createDelegateItem(left));
+ if (!leftItem)
+ qmlInfo(control) << "Failed to create left item:" << left->errors();
+ }
+}
+
+void QQuickSwipePrivate::createBehindItem()
+{
+ if (!behindItem) {
+ Q_Q(QQuickSwipe);
+ q->setBehindItem(createDelegateItem(behind));
+ if (!behindItem)
+ qmlInfo(control) << "Failed to create behind item:" << behind->errors();
+ }
+}
+
+void QQuickSwipePrivate::createRightItem()
+{
+ if (!rightItem) {
+ Q_Q(QQuickSwipe);
+ q->setRightItem(createDelegateItem(right));
+ if (!rightItem)
+ qmlInfo(control) << "Failed to create right item:" << right->errors();
+ }
+}
+
+void QQuickSwipePrivate::createAndShowLeftItem()
+{
+ createLeftItem();
+
+ if (leftItem)
+ leftItem->setVisible(true);
+
+ if (rightItem)
+ rightItem->setVisible(false);
+}
+
+void QQuickSwipePrivate::createAndShowBehindItem()
+{
+ createBehindItem();
+
+ if (behindItem)
+ behindItem->setVisible(true);
+}
+
+void QQuickSwipePrivate::createAndShowRightItem()
+{
+ createRightItem();
+
+ // This item may have already existed but was hidden.
+ if (rightItem)
+ rightItem->setVisible(true);
+
+ // The left item isn't visible when the right item is visible, so save rendering effort by hiding it.
+ if (leftItem)
+ leftItem->setVisible(false);
+}
+
+void QQuickSwipePrivate::warnAboutMixingDelegates()
+{
+ qmlInfo(control) << "cannot set both behind and left/right properties";
+}
+
+void QQuickSwipePrivate::warnAboutSettingDelegatesWhileVisible()
+{
+ qmlInfo(control) << "left/right/behind properties may only be set when swipe.position is 0";
+}
+
+bool QQuickSwipePrivate::hasDelegates() const
+{
+ return left || right || behind;
+}
+
+QQuickSwipe::QQuickSwipe(QQuickSwipeDelegate *control) :
+ QObject(*(new QQuickSwipePrivate(control)))
+{
+}
+
+QQmlComponent *QQuickSwipe::left() const
+{
+ Q_D(const QQuickSwipe);
+ return d->left;
+}
+
+void QQuickSwipe::setLeft(QQmlComponent *left)
+{
+ Q_D(QQuickSwipe);
+ if (left == d->left)
+ return;
+
+ if (d->behind) {
+ d->warnAboutMixingDelegates();
+ return;
+ }
+
+ if (!qFuzzyIsNull(d->position)) {
+ d->warnAboutSettingDelegatesWhileVisible();
+ return;
+ }
+
+ d->left = left;
+
+ if (!d->left) {
+ delete d->leftItem;
+ d->leftItem = nullptr;
+ }
+
+ d->control->setFiltersChildMouseEvents(d->hasDelegates());
+
+ emit leftChanged();
+}
+
+QQmlComponent *QQuickSwipe::behind() const
+{
+ Q_D(const QQuickSwipe);
+ return d->behind;
+}
+
+void QQuickSwipe::setBehind(QQmlComponent *behind)
+{
+ Q_D(QQuickSwipe);
+ if (behind == d->behind)
+ return;
+
+ if (d->left || d->right) {
+ d->warnAboutMixingDelegates();
+ return;
+ }
+
+ if (!qFuzzyIsNull(d->position)) {
+ d->warnAboutSettingDelegatesWhileVisible();
+ return;
+ }
+
+ d->behind = behind;
+
+ if (!d->behind) {
+ delete d->behindItem;
+ d->behindItem = nullptr;
+ }
+
+ d->control->setFiltersChildMouseEvents(d->hasDelegates());
+
+ emit behindChanged();
+}
+
+QQmlComponent *QQuickSwipe::right() const
+{
+ Q_D(const QQuickSwipe);
+ return d->right;
+}
+
+void QQuickSwipe::setRight(QQmlComponent *right)
+{
+ Q_D(QQuickSwipe);
+ if (right == d->right)
+ return;
+
+ if (d->behind) {
+ d->warnAboutMixingDelegates();
+ return;
+ }
+
+ if (!qFuzzyIsNull(d->position)) {
+ d->warnAboutSettingDelegatesWhileVisible();
+ return;
+ }
+
+ d->right = right;
+
+ if (!d->right) {
+ delete d->rightItem;
+ d->rightItem = nullptr;
+ }
+
+ d->control->setFiltersChildMouseEvents(d->hasDelegates());
+
+ emit rightChanged();
+}
+
+QQuickItem *QQuickSwipe::leftItem() const
+{
+ Q_D(const QQuickSwipe);
+ return d->leftItem;
+}
+
+void QQuickSwipe::setLeftItem(QQuickItem *item)
+{
+ Q_D(QQuickSwipe);
+ if (item == d->leftItem)
+ return;
+
+ delete d->leftItem;
+ d->leftItem = item;
+
+ if (d->leftItem) {
+ d->leftItem->setParentItem(d->control);
+
+ if (qFuzzyIsNull(d->leftItem->z()))
+ d->leftItem->setZ(-2);
+ }
+
+ emit leftItemChanged();
+}
+
+QQuickItem *QQuickSwipe::behindItem() const
+{
+ Q_D(const QQuickSwipe);
+ return d->behindItem;
+}
+
+void QQuickSwipe::setBehindItem(QQuickItem *item)
+{
+ Q_D(QQuickSwipe);
+ if (item == d->behindItem)
+ return;
+
+ delete d->behindItem;
+ d->behindItem = item;
+
+ if (d->behindItem) {
+ d->behindItem->setParentItem(d->control);
+
+ if (qFuzzyIsNull(d->behindItem->z()))
+ d->behindItem->setZ(-2);
+ }
+
+ emit behindItemChanged();
+}
+
+QQuickItem *QQuickSwipe::rightItem() const
+{
+ Q_D(const QQuickSwipe);
+ return d->rightItem;
+}
+
+void QQuickSwipe::setRightItem(QQuickItem *item)
+{
+ Q_D(QQuickSwipe);
+ if (item == d->rightItem)
+ return;
+
+ delete d->rightItem;
+ d->rightItem = item;
+
+ if (d->rightItem) {
+ d->rightItem->setParentItem(d->control);
+
+ if (qFuzzyIsNull(d->rightItem->z()))
+ d->rightItem->setZ(-2);
+ }
+
+ emit rightItemChanged();
+}
+
+qreal QQuickSwipe::position() const
+{
+ Q_D(const QQuickSwipe);
+ return d->position;
+}
+
+void QQuickSwipe::setPosition(qreal position)
+{
+ Q_D(QQuickSwipe);
+ const qreal adjustedPosition = qBound<qreal>(-1.0, position, 1.0);
+ if (adjustedPosition == d->position)
+ return;
+
+ d->position = adjustedPosition;
+ d->reposition(AnimatePosition);
+ emit positionChanged();
+}
+
+bool QQuickSwipe::isComplete() const
+{
+ Q_D(const QQuickSwipe);
+ return d->complete;
+}
+
+void QQuickSwipe::setComplete(bool complete)
+{
+ Q_D(QQuickSwipe);
+ if (complete == d->complete)
+ return;
+
+ d->complete = complete;
+ emit completeChanged();
+}
+
+QQuickSwipeDelegatePrivate::QQuickSwipeDelegatePrivate(QQuickSwipeDelegate *control) :
+ swipe(control)
+{
+}
+
+bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickSwipeDelegate);
+ QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
+ // If the position is 0, we want to handle events ourselves - we don't want child items to steal them.
+ // This code will only get called when a child item has been created;
+ // events will go through the regular channels (mousePressEvent()) until then.
+ if (qFuzzyIsNull(swipePrivate->position)) {
+ q->mousePressEvent(event);
+ return true;
+ }
+
+ swipePrivate->positionBeforePress = swipePrivate->position;
+ swipePrivate->velocityCalculator.startMeasuring(event->pos(), event->timestamp());
+ pressPoint = item->mapToItem(q, event->pos());
+ return false;
+}
+
+bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
+{
+ Q_Q(QQuickSwipeDelegate);
+
+ if (holdTimer > 0) {
+ if (QLineF(pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance())
+ stopPressAndHold();
+ }
+
+ // Protect against division by zero.
+ if (width == 0)
+ return false;
+
+ // Don't bother reacting to events if we don't have any delegates.
+ QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
+ if (!swipePrivate->left && !swipePrivate->right && !swipePrivate->behind)
+ return false;
+
+ // Don't handle move events for the control if it wasn't pressed.
+ if (item == q && !pressed)
+ return false;
+
+ const qreal distance = (event->pos() - pressPoint).x();
+ if (!q->keepMouseGrab()) {
+ // Taken from QQuickDrawerPrivate::grabMouse; see comments there.
+ int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
+ const bool overThreshold = QQuickWindowPrivate::dragOverThreshold(distance, Qt::XAxis, event, threshold);
+ if (window && overThreshold) {
+ QQuickItem *grabber = q->window()->mouseGrabberItem();
+ if (!grabber || !grabber->keepMouseGrab()) {
+ q->grabMouse();
+ q->setKeepMouseGrab(overThreshold);
+ q->setPressed(true);
+ swipe.setComplete(false);
+ }
+ }
+ }
+
+ if (q->keepMouseGrab()) {
+ // Ensure we don't try to calculate a position when the user tried to drag
+ // to the left when the left item is already exposed, and vice versa.
+ // The code below assumes that the drag is valid, so if we don't have this check,
+ // the wrong items are visible and the swiping wraps.
+ if (swipePrivate->behind
+ || ((swipePrivate->left || swipePrivate->right)
+ && (qFuzzyIsNull(swipePrivate->positionBeforePress)
+ || (swipePrivate->positionBeforePress == -1.0 && distance >= 0.0)
+ || (swipePrivate->positionBeforePress == 1.0 && distance <= 0.0)))) {
+
+ // We must instantiate the items here so that we can calculate the
+ // position against the width of the relevant item.
+ QQuickItem *relevantItem = swipePrivate->createRelevantItemForDistance(distance);
+ // If there isn't any relevant item, the user may have swiped back to the 0 position,
+ // or they swiped back to a position that is equal to positionBeforePress.
+ const qreal normalizedDistance = relevantItem ? distance / relevantItem->width() : 0.0;
+ qreal position = 0;
+
+ // If the control was exposed before the drag begun, the distance should be inverted.
+ // For example, if the control had been swiped to the right, the position would be 1.0.
+ // If the control was then swiped to the left by a distance of -20 pixels, the normalized
+ // distance might be -0.2, for example, which cannot be used as the position; the swipe
+ // started from the right, so we account for that by adding the position.
+ if (qFuzzyIsNull(normalizedDistance)) {
+ // There are two cases when the normalizedDistance can be 0,
+ // and we must distinguish between them:
+ //
+ // a) The swipe returns to the position that it was at before the press event.
+ // In this case, the distance will be 0.
+ // There would have been many position changes in the meantime, so we can't just
+ // ignore the move event; we have to set position to what it was before the press.
+ //
+ // b) If the position was at, 1.0, for example, and the control was then swiped
+ // to the left by the exact width of the left item, there won't be any relevant item
+ // (because the swipe's position would be at 0.0). In turn, the normalizedDistance
+ // would be 0 (because of the lack of a relevant item), but the distance will be non-zero.
+ position = qFuzzyIsNull(distance) ? swipePrivate->positionBeforePress : 0;
+ } else if (!swipePrivate->wasComplete) {
+ position = normalizedDistance;
+ } else {
+ position = distance > 0 ? normalizedDistance - 1.0 : normalizedDistance + 1.0;
+ }
+
+ swipe.setPosition(position);
+ }
+ } else {
+ // The swipe wasn't initiated.
+ if (event->pos().y() < 0 || event->pos().y() > height) {
+ // The mouse went outside the vertical bounds of the control, so
+ // we should no longer consider it pressed.
+ q->setPressed(false);
+ }
+ }
+
+ event->accept();
+
+ return q->keepMouseGrab();
+}
+
+static const qreal exposeVelocityThreshold = 300.0;
+
+bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *, QMouseEvent *event)
+{
+ Q_Q(QQuickSwipeDelegate);
+ QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
+ swipePrivate->velocityCalculator.stopMeasuring(event->pos(), event->timestamp());
+
+ const bool hadGrabbedMouse = q->keepMouseGrab();
+ q->setKeepMouseGrab(false);
+
+ // The control can be exposed by either swiping past the halfway mark, or swiping fast enough.
+ const qreal swipeVelocity = swipePrivate->velocityCalculator.velocity().x();
+ if (swipePrivate->position > 0.5 ||
+ (swipePrivate->position > 0.0 && swipeVelocity > exposeVelocityThreshold)) {
+ swipe.setPosition(1.0);
+ swipe.setComplete(true);
+ swipePrivate->wasComplete = true;
+ } else if (swipePrivate->position < -0.5 ||
+ (swipePrivate->position < 0.0 && swipeVelocity < -exposeVelocityThreshold)) {
+ swipe.setPosition(-1.0);
+ swipe.setComplete(true);
+ swipePrivate->wasComplete = true;
+ } else {
+ swipe.setPosition(0.0);
+ swipe.setComplete(false);
+ swipePrivate->wasComplete = false;
+ }
+
+ // Only consume child events if we had grabbed the mouse.
+ return hadGrabbedMouse;
+}
+
+static void warnIfHorizontallyAnchored(QQuickItem *item, const QString &itemName)
+{
+ if (!item)
+ return;
+
+ QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
+ if (anchors && (anchors->fill() || anchors->centerIn() || anchors->left().item || anchors->right().item)
+ && !item->property("_q_QQuickSwipeDelegate_warned").toBool()) {
+ qmlInfo(item) << QString::fromLatin1("SwipeDelegate: cannot use horizontal anchors with %1; unable to layout the item.").arg(itemName);
+ item->setProperty("_q_QQuickSwipeDelegate_warned", true);
+ }
+}
+
+void QQuickSwipeDelegatePrivate::resizeContent()
+{
+ warnIfHorizontallyAnchored(background, QStringLiteral("background"));
+ warnIfHorizontallyAnchored(contentItem, QStringLiteral("contentItem"));
+
+ // If the background and contentItem are repositioned due to a swipe,
+ // we don't want to call QQuickControlPrivate's implementation of this function,
+ // as it repositions the contentItem to be visible.
+ // However, we still want to resize the control vertically.
+ QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
+ if (!swipePrivate->complete) {
+ QQuickItemDelegatePrivate::resizeContent();
+ } else if (contentItem) {
+ Q_Q(QQuickSwipeDelegate);
+ contentItem->setY(q->topPadding());
+ contentItem->setHeight(q->availableHeight());
+ }
+}
+
+QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
+ QQuickItemDelegate(*(new QQuickSwipeDelegatePrivate(this)), parent)
+{
+}
+
+/*!
+ \qmlpropertygroup QtQuick.Controls::SwipeDelegate::swipe
+ \qmlproperty real QtQuick.Controls::SwipeDelegate::swipe.position
+ \qmlproperty bool QtQuick.Controls::SwipeDelegate::swipe.complete
+ \qmlproperty Component QtQuick.Controls::SwipeDelegate::swipe.left
+ \qmlproperty Component QtQuick.Controls::SwipeDelegate::swipe.behind
+ \qmlproperty Component QtQuick.Controls::SwipeDelegate::swipe.right
+ \qmlproperty Item QtQuick.Controls::SwipeDelegate::swipe.leftItem
+ \qmlproperty Item QtQuick.Controls::SwipeDelegate::swipe.behindItem
+ \qmlproperty Item QtQuick.Controls::SwipeDelegate::swipe.rightItem
+
+ \table
+ \header
+ \li Property
+ \li Description
+ \row
+ \li position
+ \li This read-only property holds the position of the swipe relative to either
+ side of the control. When this value reaches either
+ \c -1.0 (left side) or \c 1.0 (right side) and the mouse button is
+ released, \c complete will be \c true.
+ \row
+ \li complete
+ \li This read-only property holds whether the control is fully exposed after
+ having been swiped to the left or right.
+
+ When complete is \c true, any interactive items declared in \c left,
+ \c right, or \c behind will receive mouse events.
+ \row
+ \li left
+ \li This property holds the left delegate.
+
+ The left delegate sits behind both \l {Control::}{contentItem} and
+ \l {Control::}{background}. When the SwipeDelegate is swiped to the right,
+ this item will be gradually revealed.
+
+ \include qquickswipedelegate-interaction.qdocinc
+ \row
+ \li behind
+ \li This property holds the delegate that is shown when the
+ SwipeDelegate is swiped to both the left and right.
+
+ As with the \c left and \c right delegates, it sits behind both
+ \l {Control::}{contentItem} and \l {Control::}{background}. However, a
+ SwipeDelegate whose \c behind has been set can be continuously swiped
+ from either side, and will always show the same item.
+
+ \include qquickswipedelegate-interaction.qdocinc
+ \row
+ \li right
+ \li This property holds the right delegate.
+
+ The right delegate sits behind both \l {Control::}{contentItem} and
+ \l {Control::}{background}. When the SwipeDelegate is swiped to the left,
+ this item will be gradually revealed.
+
+ \include qquickswipedelegate-interaction.qdocinc
+ \row
+ \li leftItem
+ \li This read-only property holds the item instantiated from the \c left component.
+
+ If \c left has not been set, or the position hasn't changed since
+ creation of the SwipeDelegate, this property will be \c null.
+ \row
+ \li behindItem
+ \li This read-only property holds the item instantiated from the \c behind component.
+
+ If \c behind has not been set, or the position hasn't changed since
+ creation of the SwipeDelegate, this property will be \c null.
+ \row
+ \li rightItem
+ \li This read-only property holds the item instantiated from the \c right component.
+
+ If \c right has not been set, or the position hasn't changed since
+ creation of the SwipeDelegate, this property will be \c null.
+ \endtable
+
+ \sa {Control::}{contentItem}, {Control::}{background}
+*/
+QQuickSwipe *QQuickSwipeDelegate::swipe() const
+{
+ Q_D(const QQuickSwipeDelegate);
+ return const_cast<QQuickSwipe*>(&d->swipe);
+}
+
+static bool isChildOrGrandchildOf(QQuickItem *child, QQuickItem *item)
+{
+ return item && (child == item || item->isAncestorOf(child));
+}
+
+bool QQuickSwipeDelegate::childMouseEventFilter(QQuickItem *child, QEvent *event)
+{
+ Q_D(QQuickSwipeDelegate);
+ // The contentItem is, by default, usually a non-interactive item like Text, and
+ // the same applies to the background. This means that simply stacking the left/right/behind
+ // items before these items won't allow us to get mouse events when the control is not currently exposed
+ // but has been previously. Therefore, we instead call setFiltersChildMouseEvents(true) in the constructor
+ // and filter out child events only when the child is the left/right/behind item.
+ const QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
+ if (!isChildOrGrandchildOf(child, swipePrivate->leftItem) && !isChildOrGrandchildOf(child, swipePrivate->behindItem)
+ && !isChildOrGrandchildOf(child, swipePrivate->rightItem)) {
+ return false;
+ }
+
+ switch (event->type()) {
+ case QEvent::MouseButtonPress: {
+ return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
+ } case QEvent::MouseMove: {
+ return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
+ } case QEvent::MouseButtonRelease: {
+ // Make sure that the control gets release events if it has created child
+ // items that are stealing events from it.
+ QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
+ QQuickItemDelegate::mouseReleaseEvent(mouseEvent);
+ return d->handleMouseReleaseEvent(child, mouseEvent);
+ } default:
+ return false;
+ }
+}
+
+// We only override this to set positionBeforePress;
+// otherwise, it's the same as the base class implementation.
+void QQuickSwipeDelegate::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSwipeDelegate);
+ QQuickItemDelegate::mousePressEvent(event);
+ QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
+ swipePrivate->positionBeforePress = swipePrivate->position;
+ swipePrivate->velocityCalculator.startMeasuring(event->pos(), event->timestamp());
+}
+
+void QQuickSwipeDelegate::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSwipeDelegate);
+ if (filtersChildMouseEvents())
+ d->handleMouseMoveEvent(this, event);
+ else
+ QQuickItemDelegate::mouseMoveEvent(event);
+}
+
+void QQuickSwipeDelegate::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSwipeDelegate);
+ if (!filtersChildMouseEvents() || !d->handleMouseReleaseEvent(this, event))
+ QQuickItemDelegate::mouseReleaseEvent(event);
+}
+
+void QQuickSwipeDelegate::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickSwipeDelegate);
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+
+ if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
+ QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
+ swipePrivate->reposition(DontAnimatePosition);
+ }
+}
+
+QFont QQuickSwipeDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickSwipeDelegate::accessibleRole() const
+{
+ return QAccessible::ListItem;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswipedelegate_p.h b/src/quicktemplates2/qquickswipedelegate_p.h
new file mode 100644
index 00000000..2e1c515d
--- /dev/null
+++ b/src/quicktemplates2/qquickswipedelegate_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWIPEDELEGATE_P_H
+#define QQUICKSWIPEDELEGATE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSwipeDelegatePrivate;
+class QQuickSwipe;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeDelegate : public QQuickItemDelegate
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickSwipe *swipe READ swipe CONSTANT)
+
+public:
+ explicit QQuickSwipeDelegate(QQuickItem *parent = nullptr);
+
+ QQuickSwipe *swipe() const;
+
+protected:
+ bool childMouseEventFilter(QQuickItem *child, QEvent *event) 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;
+
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickSwipeDelegate)
+ Q_DECLARE_PRIVATE(QQuickSwipeDelegate)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickSwipeDelegate)
+
+#endif // QQUICKSWIPEDELEGATE_P_H
diff --git a/src/quicktemplates2/qquickswipedelegate_p_p.h b/src/quicktemplates2/qquickswipedelegate_p_p.h
new file mode 100644
index 00000000..0387ad70
--- /dev/null
+++ b/src/quicktemplates2/qquickswipedelegate_p_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWIPEDELEGATE_P_P_H
+#define QQUICKSWIPEDELEGATE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickitemdelegate_p_p.h>
+#include <QtQuickTemplates2/private/qquickswipe_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSwipeDelegate;
+
+class QQuickSwipeDelegatePrivate : public QQuickItemDelegatePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwipeDelegate)
+
+public:
+ QQuickSwipeDelegatePrivate(QQuickSwipeDelegate *control);
+
+ bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
+
+ void resizeContent() override;
+
+ QQuickSwipe swipe;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSWIPEDELEGATE_P_P_H
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
new file mode 100644
index 00000000..82d05fbe
--- /dev/null
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -0,0 +1,363 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickswipeview_p.h"
+
+#include <QtQml/qqmlinfo.h>
+#include <QtQuickTemplates2/private/qquickcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype SwipeView
+ \inherits Container
+ \instantiates QQuickSwipeView
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-navigation
+ \ingroup qtquickcontrols2-containers
+ \brief Enables the user to navigate pages by swiping sideways.
+
+ SwipeView provides a swipe-based navigation model.
+
+ \image qtquickcontrols2-swipeview.gif
+
+ SwipeView is populated with a set of pages. One page is visible at a time.
+ The user can navigate between the pages by swiping sideways. Notice that
+ SwipeView itself is entirely non-visual. It is recommended to combine it
+ with PageIndicator, to give the user a visual clue that there are multiple
+ pages.
+
+ \snippet qtquickcontrols2-swipeview-indicator.qml 1
+
+ As shown above, SwipeView is typically populated with a static set of
+ pages that are defined inline as children of the view. It is also possible
+ to \l {Container::addItem()}{add}, \l {Container::insertItem()}{insert},
+ \l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove}
+ pages dynamically at run time.
+
+ \note SwipeView takes over the geometry management of items added to the
+ view. Using anchors on the items is not supported, and any \c width
+ or \c height assignment will be overridden by the view. Notice that
+ this only applies to the root of the item. Specifying width and height,
+ or using anchors for its children works as expected.
+
+ \sa TabBar, PageIndicator, {Customizing SwipeView}, {Navigation Controls}, {Container Controls}
+*/
+
+class QQuickSwipeViewPrivate : public QQuickContainerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwipeView)
+
+public:
+ void resizeItem(QQuickItem *item);
+ void resizeItems();
+
+ static QQuickSwipeViewPrivate *get(QQuickSwipeView *view);
+};
+
+void QQuickSwipeViewPrivate::resizeItems()
+{
+ Q_Q(QQuickSwipeView);
+ const int count = q->count();
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = itemAt(i);
+ if (item) {
+ QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
+ // TODO: expose QQuickAnchorLine so we can test for other conflicting anchors
+ if (anchors && (anchors->fill() || anchors->centerIn()) && !item->property("_q_QQuickSwipeView_warned").toBool()) {
+ qmlInfo(item) << "SwipeView has detected conflicting anchors. Unable to layout the item.";
+ item->setProperty("_q_QQuickSwipeView_warned", true);
+ }
+
+ item->setSize(QSizeF(contentItem->width(), contentItem->height()));
+ }
+ }
+}
+
+QQuickSwipeViewPrivate *QQuickSwipeViewPrivate::get(QQuickSwipeView *view)
+{
+ return view->d_func();
+}
+
+QQuickSwipeView::QQuickSwipeView(QQuickItem *parent) :
+ QQuickContainer(*(new QQuickSwipeViewPrivate), parent)
+{
+ setFlag(ItemIsFocusScope);
+ setActiveFocusOnTab(true);
+}
+
+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 nullptr;
+ }
+
+ return new QQuickSwipeViewAttached(item);
+}
+
+void QQuickSwipeView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickSwipeView);
+ QQuickContainer::geometryChanged(newGeometry, oldGeometry);
+ d->resizeItems();
+}
+
+void QQuickSwipeView::itemAdded(int, QQuickItem *item)
+{
+ Q_D(QQuickSwipeView);
+ QQuickItemPrivate::get(item)->setCulled(true); // QTBUG-51078, QTBUG-51669
+ if (isComponentComplete())
+ item->setSize(QSizeF(d->contentItem->width(), d->contentItem->height()));
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickSwipeView::accessibleRole() const
+{
+ return QAccessible::PageTabList;
+}
+#endif
+
+/*!
+ \qmlattachedproperty int QtQuick.Controls::SwipeView::index
+ \readonly
+
+ This attached property holds the index of each child item in the SwipeView.
+
+ It is attached to each child item of the SwipeView.
+*/
+
+/*!
+ \qmlattachedproperty bool QtQuick.Controls::SwipeView::isCurrentItem
+ \readonly
+
+ This attached property is \c true if this child is the current item.
+
+ It is attached to each child item of the SwipeView.
+*/
+
+/*!
+ \qmlattachedproperty SwipeView QtQuick.Controls::SwipeView::view
+ \readonly
+
+ This attached property holds the view that manages this child item.
+
+ It is attached to each child item of the SwipeView.
+*/
+
+class QQuickSwipeViewAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickSwipeViewAttached)
+public:
+ QQuickSwipeViewAttachedPrivate(QQuickItem *item) :
+ item(item),
+ swipeView(nullptr),
+ index(-1),
+ isCurrent(false)
+ {
+ }
+
+ ~QQuickSwipeViewAttachedPrivate() {
+ }
+
+ void updateView(QQuickItem *parent);
+
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
+ void itemParentChanged(QQuickItem *, QQuickItem *) override;
+ void itemDestroyed(QQuickItem *) override;
+
+ void updateIndex();
+ void updateIsCurrent();
+
+ void setView(QQuickSwipeView *view);
+ void setIndex(int i);
+ void setIsCurrent(bool current);
+
+ QQuickItem *item;
+ QQuickSwipeView *swipeView;
+ int index;
+ // Better to store this so that we don't need to lump its calculation
+ // together with index's calculation, as it would otherwise need to know
+ // the old index to know if it should emit the change signal.
+ bool isCurrent;
+};
+
+void QQuickSwipeViewAttachedPrivate::updateIndex()
+{
+ setIndex(swipeView ? QQuickSwipeViewPrivate::get(swipeView)->contentModel->indexOf(item, nullptr) : -1);
+}
+
+void QQuickSwipeViewAttachedPrivate::updateIsCurrent()
+{
+ setIsCurrent(swipeView ? swipeView->currentIndex() == index : false);
+}
+
+void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
+{
+ if (view == swipeView)
+ return;
+
+ if (swipeView) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(swipeView);
+ p->removeItemChangeListener(this, QQuickItemPrivate::Children);
+
+ disconnect(swipeView, &QQuickSwipeView::currentIndexChanged,
+ this, &QQuickSwipeViewAttachedPrivate::updateIsCurrent);
+ disconnect(swipeView, &QQuickSwipeView::contentChildrenChanged,
+ this, &QQuickSwipeViewAttachedPrivate::updateIndex);
+ }
+
+ swipeView = view;
+
+ if (swipeView) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(swipeView);
+ p->addItemChangeListener(this, QQuickItemPrivate::Children);
+
+ connect(swipeView, &QQuickSwipeView::currentIndexChanged,
+ this, &QQuickSwipeViewAttachedPrivate::updateIsCurrent);
+ connect(swipeView, &QQuickSwipeView::contentChildrenChanged,
+ this, &QQuickSwipeViewAttachedPrivate::updateIndex);
+ }
+
+ Q_Q(QQuickSwipeViewAttached);
+ emit q->viewChanged();
+
+ updateIndex();
+ updateIsCurrent();
+}
+
+void QQuickSwipeViewAttachedPrivate::setIsCurrent(bool current)
+{
+ if (current == isCurrent)
+ return;
+
+ isCurrent = current;
+ Q_Q(QQuickSwipeViewAttached);
+ emit q->isCurrentItemChanged();
+}
+
+void QQuickSwipeViewAttachedPrivate::setIndex(int i)
+{
+ if (i == index)
+ return;
+
+ index = i;
+ Q_Q(QQuickSwipeViewAttached);
+ emit q->indexChanged();
+}
+
+void QQuickSwipeViewAttachedPrivate::updateView(QQuickItem *parent)
+{
+ // parent can be, e.g.:
+ // - The contentItem of a ListView (typically the case)
+ // - 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 = nullptr;
+ if (parent) {
+ view = qobject_cast<QQuickSwipeView*>(parent);
+ if (!view) {
+ if (parent->parentItem() && parent->parentItem()->property("contentItem").isValid()) {
+ // The parent is the contentItem of some kind of view.
+ view = qobject_cast<QQuickSwipeView*>(parent->parentItem()->parentItem());
+ }
+ }
+ }
+
+ setView(view);
+}
+
+void QQuickSwipeViewAttachedPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
+{
+ updateIndex();
+}
+
+void QQuickSwipeViewAttachedPrivate::itemChildRemoved(QQuickItem *, QQuickItem *)
+{
+ updateIndex();
+}
+
+void QQuickSwipeViewAttachedPrivate::itemParentChanged(QQuickItem *, QQuickItem *parent)
+{
+ updateView(parent);
+}
+
+void QQuickSwipeViewAttachedPrivate::itemDestroyed(QQuickItem *item)
+{
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
+}
+
+QQuickSwipeViewAttached::QQuickSwipeViewAttached(QQuickItem *item) :
+ QObject(*(new QQuickSwipeViewAttachedPrivate(item)), item)
+{
+ Q_D(QQuickSwipeViewAttached);
+ if (item->parentItem())
+ d->updateView(item->parentItem());
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ p->addItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
+}
+
+QQuickSwipeViewAttached::~QQuickSwipeViewAttached()
+{
+ Q_D(QQuickSwipeViewAttached);
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent());
+ if (item)
+ QQuickItemPrivate::get(item)->removeItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
+}
+
+QQuickSwipeView *QQuickSwipeViewAttached::view() const
+{
+ Q_D(const QQuickSwipeViewAttached);
+ return d->swipeView;
+}
+
+int QQuickSwipeViewAttached::index() const
+{
+ Q_D(const QQuickSwipeViewAttached);
+ return d->index;
+}
+
+bool QQuickSwipeViewAttached::isCurrentItem() const
+{
+ Q_D(const QQuickSwipeViewAttached);
+ return d->swipeView ? d->swipeView->currentIndex() == d->index : false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswipeview_p.h b/src/quicktemplates2/qquickswipeview_p.h
new file mode 100644
index 00000000..c6cb62ba
--- /dev/null
+++ b/src/quicktemplates2/qquickswipeview_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWIPEVIEW_P_H
+#define QQUICKSWIPEVIEW_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSwipeViewAttached;
+class QQuickSwipeViewPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickSwipeView(QQuickItem *parent = nullptr);
+
+ static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object);
+
+protected:
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemAdded(int index, QQuickItem *item) override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickSwipeView)
+ Q_DECLARE_PRIVATE(QQuickSwipeView)
+};
+
+class QQuickSwipeViewAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeViewAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
+ Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL)
+ Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL)
+
+public:
+ explicit QQuickSwipeViewAttached(QQuickItem *delegateItem);
+ ~QQuickSwipeViewAttached();
+
+ int index() const;
+ bool isCurrentItem() const;
+ QQuickSwipeView *view() const;
+
+Q_SIGNALS:
+ void indexChanged();
+ void isCurrentItemChanged();
+ void viewChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickSwipeViewAttached)
+ Q_DECLARE_PRIVATE(QQuickSwipeViewAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickSwipeView)
+QML_DECLARE_TYPEINFO(QQuickSwipeView, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKSWIPEVIEW_P_H
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
new file mode 100644
index 00000000..fa08a1d8
--- /dev/null
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -0,0 +1,201 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickswitch_p.h"
+#include "qquickabstractbutton_p_p.h"
+
+#include <QtGui/qstylehints.h>
+#include <QtGui/qguiapplication.h>
+#include <QtQuick/private/qquickwindow_p.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Switch
+ \inherits AbstractButton
+ \instantiates QQuickSwitch
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-buttons
+ \brief Switch button that can be toggled on or off.
+
+ \image qtquickcontrols2-switch.gif
+
+ Switch is an option button that can be dragged or toggled on (checked) or
+ off (unchecked). Switches are typically used to select between two states.
+ For larger sets of options, such as those in a list, consider using
+ \l SwitchDelegate instead.
+
+ Switch inherits its API from \l AbstractButton. For instance, the state
+ of the switch can be set with the \l {AbstractButton::}{checked} property.
+
+ \code
+ ColumnLayout {
+ Switch {
+ text: qsTr("Wi-Fi")
+ }
+ Switch {
+ text: qsTr("Bluetooth")
+ }
+ }
+ \endcode
+
+ \sa {Customizing Switch}, {Button Controls}
+*/
+
+class QQuickSwitchPrivate : public QQuickAbstractButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwitch)
+
+public:
+ QQuickSwitchPrivate() : position(0) { }
+
+ qreal positionAt(const QPointF &point) const;
+
+ qreal position;
+};
+
+qreal QQuickSwitchPrivate::positionAt(const QPointF &point) const
+{
+ Q_Q(const QQuickSwitch);
+ qreal pos = 0.0;
+ if (indicator)
+ pos = indicator->mapFromItem(q, point).x() / indicator->width();
+ if (q->isMirrored())
+ return 1.0 - pos;
+ return pos;
+}
+
+QQuickSwitch::QQuickSwitch(QQuickItem *parent) :
+ QQuickAbstractButton(*(new QQuickSwitchPrivate), parent)
+{
+ Q_D(QQuickSwitch);
+ d->keepPressed = true;
+ setCheckable(true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Switch::position
+ \readonly
+
+ \input includes/qquickswitch.qdocinc position
+*/
+qreal QQuickSwitch::position() const
+{
+ Q_D(const QQuickSwitch);
+ return d->position;
+}
+
+void QQuickSwitch::setPosition(qreal position)
+{
+ Q_D(QQuickSwitch);
+ position = qBound<qreal>(0.0, position, 1.0);
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ emit positionChanged();
+ emit visualPositionChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Switch::visualPosition
+ \readonly
+
+ \input includes/qquickswitch.qdocinc visualPosition
+*/
+qreal QQuickSwitch::visualPosition() const
+{
+ Q_D(const QQuickSwitch);
+ if (isMirrored())
+ return 1.0 - d->position;
+ return d->position;
+}
+
+void QQuickSwitch::mousePressEvent(QMouseEvent *event)
+{
+ QQuickAbstractButton::mousePressEvent(event);
+}
+
+void QQuickSwitch::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSwitch);
+ QQuickAbstractButton::mouseMoveEvent(event);
+
+ const QPointF movePoint = event->localPos();
+ if (!keepMouseGrab()) {
+ // don't start dragging the handle unless the initial press was at the indicator,
+ // or the drag has reached the indicator area. this prevents unnatural jumps when
+ // dragging far outside the indicator.
+ const qreal pressPos = d->positionAt(d->pressPoint);
+ const qreal movePos = d->positionAt(movePoint);
+ if ((pressPos >= 0.0 && pressPos <= 1.0) || (movePos >= 0.0 && movePos <= 1.0))
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(movePoint.x() - d->pressPoint.x(), Qt::XAxis, event));
+ }
+
+ if (keepMouseGrab())
+ setPosition(d->positionAt(movePoint));
+}
+
+void QQuickSwitch::mouseReleaseEvent(QMouseEvent *event)
+{
+ QQuickAbstractButton::mouseReleaseEvent(event);
+ setKeepMouseGrab(false);
+}
+
+void QQuickSwitch::mirrorChange()
+{
+ QQuickAbstractButton::mirrorChange();
+ emit visualPositionChanged();
+}
+
+void QQuickSwitch::nextCheckState()
+{
+ Q_D(QQuickSwitch);
+ if (keepMouseGrab())
+ setChecked(d->position > 0.5);
+ else
+ QQuickAbstractButton::nextCheckState();
+}
+
+void QQuickSwitch::checkStateSet()
+{
+ Q_D(QQuickSwitch);
+ setPosition(d->checked ? 1.0 : 0.0);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswitch_p.h b/src/quicktemplates2/qquickswitch_p.h
new file mode 100644
index 00000000..27a065b4
--- /dev/null
+++ b/src/quicktemplates2/qquickswitch_p.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWITCH_P_H
+#define QQUICKSWITCH_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSwitchPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwitch : public QQuickAbstractButton
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+
+public:
+ explicit QQuickSwitch(QQuickItem *parent = nullptr);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ qreal visualPosition() const;
+
+Q_SIGNALS:
+ void positionChanged();
+ void visualPositionChanged();
+
+protected:
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+
+ void mirrorChange() override;
+
+ void nextCheckState() override;
+ void checkStateSet() override;
+
+private:
+ Q_DISABLE_COPY(QQuickSwitch)
+ Q_DECLARE_PRIVATE(QQuickSwitch)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickSwitch)
+
+#endif // QQUICKSWITCH_P_H
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
new file mode 100644
index 00000000..81e282d9
--- /dev/null
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -0,0 +1,206 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickswitchdelegate_p.h"
+
+#include "qquickitemdelegate_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype SwitchDelegate
+ \inherits ItemDelegate
+ \instantiates QQuickSwitchDelegate
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-delegates
+ \brief Item delegate with a switch indicator that can be toggled on or off.
+
+ \image qtquickcontrols2-switchdelegate.gif
+
+ SwitchDelegate presents an item delegate that can be toggled on (checked) or
+ off (unchecked). Switch delegates are typically used to select one or more
+ options from a set of options. For smaller sets of options, or for options
+ that need to be uniquely identifiable, consider using \l Switch instead.
+
+ SwitchDelegate inherits its API from \l ItemDelegate, which is inherited
+ from \l AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the \l AbstractButton
+ API. The state of the switch delegate can be set with the
+ \l {AbstractButton::}{checked} property.
+
+ \code
+ ListView {
+ model: ["Option 1", "Option 2", "Option 3"]
+ delegate: SwitchDelegate {
+ text: modelData
+ }
+ }
+ \endcode
+
+ \sa {Customizing SwitchDelegate}, {Delegate Controls}
+*/
+
+class QQuickSwitchDelegatePrivate : public QQuickItemDelegatePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwitchDelegate)
+
+public:
+ QQuickSwitchDelegatePrivate() :
+ position(0)
+ {
+ }
+
+ qreal positionAt(const QPointF &point) const;
+
+ qreal position;
+};
+
+qreal QQuickSwitchDelegatePrivate::positionAt(const QPointF &point) const
+{
+ Q_Q(const QQuickSwitchDelegate);
+ qreal pos = 0.0;
+ if (indicator)
+ pos = indicator->mapFromItem(q, point).x() / indicator->width();
+ if (q->isMirrored())
+ return 1.0 - pos;
+ return pos;
+}
+
+QQuickSwitchDelegate::QQuickSwitchDelegate(QQuickItem *parent) :
+ QQuickItemDelegate(*(new QQuickSwitchDelegatePrivate), parent)
+{
+ Q_D(QQuickSwitchDelegate);
+ d->keepPressed = true;
+ setCheckable(true);
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::SwitchDelegate::position
+ \readonly
+
+ \input includes/qquickswitch.qdocinc position
+*/
+qreal QQuickSwitchDelegate::position() const
+{
+ Q_D(const QQuickSwitchDelegate);
+ return d->position;
+}
+
+void QQuickSwitchDelegate::setPosition(qreal position)
+{
+ Q_D(QQuickSwitchDelegate);
+ position = qBound<qreal>(0.0, position, 1.0);
+ if (qFuzzyCompare(d->position, position))
+ return;
+
+ d->position = position;
+ emit positionChanged();
+ emit visualPositionChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::SwitchDelegate::visualPosition
+ \readonly
+
+ \input includes/qquickswitch.qdocinc visualPosition
+*/
+qreal QQuickSwitchDelegate::visualPosition() const
+{
+ Q_D(const QQuickSwitchDelegate);
+ if (isMirrored())
+ return 1.0 - d->position;
+ return d->position;
+}
+
+void QQuickSwitchDelegate::mousePressEvent(QMouseEvent *event)
+{
+ QQuickItemDelegate::mousePressEvent(event);
+}
+
+void QQuickSwitchDelegate::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSwitchDelegate);
+ QQuickItemDelegate::mouseMoveEvent(event);
+
+ const QPointF movePoint = event->localPos();
+ if (!keepMouseGrab()) {
+ // don't start dragging the handle unless the initial press was at the indicator,
+ // or the drag has reached the indicator area. this prevents unnatural jumps when
+ // dragging far outside the indicator.
+ const qreal pressPos = d->positionAt(d->pressPoint);
+ const qreal movePos = d->positionAt(movePoint);
+ if ((pressPos >= 0.0 && pressPos <= 1.0) || (movePos >= 0.0 && movePos <= 1.0))
+ setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(movePoint.x() - d->pressPoint.x(), Qt::XAxis, event));
+ }
+
+ if (keepMouseGrab())
+ setPosition(d->positionAt(movePoint));
+}
+
+void QQuickSwitchDelegate::mouseReleaseEvent(QMouseEvent *event)
+{
+ QQuickItemDelegate::mouseReleaseEvent(event);
+ setKeepMouseGrab(false);
+}
+
+QFont QQuickSwitchDelegate::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+}
+
+void QQuickSwitchDelegate::mirrorChange()
+{
+ QQuickItemDelegate::mirrorChange();
+ emit visualPositionChanged();
+}
+
+void QQuickSwitchDelegate::nextCheckState()
+{
+ Q_D(QQuickSwitchDelegate);
+ if (keepMouseGrab())
+ setChecked(d->position > 0.5);
+ else
+ QQuickItemDelegate::nextCheckState();
+}
+
+void QQuickSwitchDelegate::checkStateSet()
+{
+ Q_D(QQuickSwitchDelegate);
+ setPosition(d->checked ? 1.0 : 0.0);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswitchdelegate_p.h b/src/quicktemplates2/qquickswitchdelegate_p.h
new file mode 100644
index 00000000..c0cc21ac
--- /dev/null
+++ b/src/quicktemplates2/qquickswitchdelegate_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWITCHDELEGATE_P_H
+#define QQUICKSWITCHDELEGATE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickitemdelegate_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSwitchDelegatePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwitchDelegate : public QQuickItemDelegate
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
+
+public:
+ explicit QQuickSwitchDelegate(QQuickItem *parent = nullptr);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ qreal visualPosition() const;
+
+Q_SIGNALS:
+ void positionChanged();
+ void visualPositionChanged();
+
+protected:
+ void mousePressEvent(QMouseEvent *event) override;
+ void mouseMoveEvent(QMouseEvent *event) override;
+ void mouseReleaseEvent(QMouseEvent *event) override;
+
+ QFont defaultFont() const override;
+ void mirrorChange() override;
+
+ void nextCheckState() override;
+ void checkStateSet() override;
+
+private:
+ Q_DISABLE_COPY(QQuickSwitchDelegate)
+ Q_DECLARE_PRIVATE(QQuickSwitchDelegate)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickSwitchDelegate)
+
+#endif // QQUICKSWITCHDELEGATE_P_H
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
new file mode 100644
index 00000000..ee3436f9
--- /dev/null
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -0,0 +1,268 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktabbar_p.h"
+#include "qquicktabbutton_p.h"
+#include "qquickcontainer_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TabBar
+ \inherits Container
+ \instantiates QQuickTabBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-navigation
+ \ingroup qtquickcontrols2-containers
+ \brief Allows the user to switch between different views or subtasks.
+
+ TabBar provides a tab-based navigation model.
+
+ \image qtquickcontrols2-tabbar-wireframe.png
+
+ TabBar is populated with TabButton controls, and can be used together with
+ any layout or container control that provides \c currentIndex -property,
+ such as \l StackLayout or \l SwipeView
+
+ \snippet qtquickcontrols2-tabbar.qml 1
+
+ As shown above, TabBar is typically populated with a static set of tab buttons
+ that are defined inline as children of the tab bar. It is also possible to
+ \l {Container::addItem()}{add}, \l {Container::insertItem()}{insert},
+ \l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove}
+ items dynamically at run time. The items can be accessed using
+ \l {Container::}{itemAt()} or \l {Container::}{contentChildren}.
+
+ \section2 Resizing Tabs
+
+ By default, TabBar resizes its buttons to fit the width of the control.
+ The available space is distributed equally to each button. The default
+ resizing behavior can be overridden by setting an explicit width for the
+ buttons.
+
+ The following example illustrates how to keep each tab button at their
+ implicit size instead of being resized to fit the tabbar:
+
+ \borderedimage qtquickcontrols2-tabbar-explicit.png
+
+ \snippet qtquickcontrols2-tabbar-explicit.qml 1
+
+ \section2 Flickable Tabs
+
+ If the total width of the buttons exceeds the available width of the tab bar,
+ it automatically becomes flickable.
+
+ \image qtquickcontrols2-tabbar-flickable.png
+
+ \snippet qtquickcontrols2-tabbar-flickable.qml 1
+
+ \sa TabButton, {Customizing TabBar}, {Navigation Controls}, {Container Controls}
+*/
+
+class QQuickTabBarPrivate : public QQuickContainerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickTabBar)
+
+public:
+ QQuickTabBarPrivate();
+
+ void updateCurrentItem();
+ void updateCurrentIndex();
+ void updateLayout();
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+ bool updatingLayout;
+ QQuickTabBar::Position position;
+};
+
+QQuickTabBarPrivate::QQuickTabBarPrivate() : updatingLayout(false), position(QQuickTabBar::Header)
+{
+ changeTypes |= Geometry;
+}
+
+void QQuickTabBarPrivate::updateCurrentItem()
+{
+ QQuickTabButton *button = qobject_cast<QQuickTabButton *>(contentModel->get(currentIndex));
+ if (button)
+ button->setChecked(true);
+}
+
+void QQuickTabBarPrivate::updateCurrentIndex()
+{
+ Q_Q(QQuickTabBar);
+ QQuickTabButton *button = qobject_cast<QQuickTabButton *>(q->sender());
+ if (button && button->isChecked())
+ q->setCurrentIndex(contentModel->indexOf(button, nullptr));
+}
+
+void QQuickTabBarPrivate::updateLayout()
+{
+ Q_Q(QQuickTabBar);
+ const int count = contentModel->count();
+ if (count > 0 && contentItem) {
+ qreal reservedWidth = 0;
+ QVector<QQuickItem *> resizableItems;
+ resizableItems.reserve(count);
+
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ if (!p->widthValid)
+ resizableItems += item;
+ else
+ reservedWidth += item->width();
+ }
+ }
+
+ if (!resizableItems.isEmpty()) {
+ const qreal totalSpacing = qMax(0, count - 1) * spacing;
+ const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / resizableItems.count();
+
+ updatingLayout = true;
+ for (QQuickItem *item : qAsConst(resizableItems)) {
+ item->setWidth(itemWidth);
+ QQuickItemPrivate::get(item)->widthValid = false;
+ }
+ updatingLayout = false;
+ }
+ }
+}
+
+void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+{
+ if (!updatingLayout)
+ updateLayout();
+}
+
+QQuickTabBar::QQuickTabBar(QQuickItem *parent) :
+ QQuickContainer(*(new QQuickTabBarPrivate), parent)
+{
+ Q_D(QQuickTabBar);
+ setFlag(ItemIsFocusScope);
+ QObjectPrivate::connect(this, &QQuickTabBar::currentIndexChanged, d, &QQuickTabBarPrivate::updateCurrentItem);
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.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 \l ApplicationWindow
+ or \l 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);
+ QQuickContainer::updatePolish();
+ d->updateLayout();
+}
+
+void QQuickTabBar::componentComplete()
+{
+ Q_D(QQuickTabBar);
+ QQuickContainer::componentComplete();
+ d->updateCurrentItem();
+ d->updateLayout();
+}
+
+void QQuickTabBar::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickTabBar);
+ QQuickContainer::geometryChanged(newGeometry, oldGeometry);
+ d->updateLayout();
+}
+
+bool QQuickTabBar::isContent(QQuickItem *item) const
+{
+ return qobject_cast<QQuickTabButton *>(item);
+}
+
+void QQuickTabBar::itemAdded(int index, QQuickItem *item)
+{
+ Q_D(QQuickTabBar);
+ Q_UNUSED(index);
+ QQuickItemPrivate::get(item)->setCulled(true); // QTBUG-55129
+ if (QQuickTabButton *button = qobject_cast<QQuickTabButton *>(item))
+ QObjectPrivate::connect(button, &QQuickTabButton::checkedChanged, d, &QQuickTabBarPrivate::updateCurrentIndex);
+ if (isComponentComplete())
+ polish();
+}
+
+void QQuickTabBar::itemRemoved(int index, QQuickItem *item)
+{
+ Q_D(QQuickTabBar);
+ Q_UNUSED(index);
+ if (QQuickTabButton *button = qobject_cast<QQuickTabButton *>(item))
+ QObjectPrivate::disconnect(button, &QQuickTabButton::checkedChanged, d, &QQuickTabBarPrivate::updateCurrentIndex);
+ if (isComponentComplete())
+ polish();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickTabBar::accessibleRole() const
+{
+ return QAccessible::PageTabList;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktabbar_p.h b/src/quicktemplates2/qquicktabbar_p.h
new file mode 100644
index 00000000..7e590009
--- /dev/null
+++ b/src/quicktemplates2/qquicktabbar_p.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTABBAR_P_H
+#define QQUICKTABBAR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickcontainer_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTabBarPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBar : public QQuickContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+
+public:
+ 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() 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 override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickTabBar)
+ Q_DECLARE_PRIVATE(QQuickTabBar)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickTabBar)
+
+#endif // QQUICKTABBAR_P_H
diff --git a/src/quicktemplates2/qquicktabbutton.cpp b/src/quicktemplates2/qquicktabbutton.cpp
new file mode 100644
index 00000000..b5cbdd12
--- /dev/null
+++ b/src/quicktemplates2/qquicktabbutton.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktabbutton_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TabButton
+ \inherits AbstractButton
+ \instantiates QQuickTabButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-navigation
+ \brief Button with a look suitable for a TabBar.
+
+ \image qtquickcontrols2-tabbutton.png
+
+ TabButton is used in conjunction with a \l TabBar.
+
+ \snippet qtquickcontrols2-tabbutton.qml 1
+
+ TabButton inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
+ using the AbstractButton API.
+
+ \sa TabBar, {Customizing TabButton}, {Button Controls}, {Navigation Controls}
+*/
+
+QQuickTabButton::QQuickTabButton(QQuickItem *parent) :
+ QQuickAbstractButton(parent)
+{
+ setCheckable(true);
+ setAutoExclusive(true);
+}
+
+QFont QQuickTabButton::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::TabButtonFont);
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickTabButton::accessibleRole() const
+{
+ return QAccessible::PageTab;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktabbutton_p.h b/src/quicktemplates2/qquicktabbutton_p.h
new file mode 100644
index 00000000..951a02b2
--- /dev/null
+++ b/src/quicktemplates2/qquicktabbutton_p.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTABBUTTON_P_H
+#define QQUICKTABBUTTON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabButton : public QQuickAbstractButton
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickTabButton(QQuickItem *parent = nullptr);
+
+protected:
+ QFont defaultFont() const override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickTabButton)
+
+#endif // QQUICKTABBUTTON_P_H
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
new file mode 100644
index 00000000..a66d7bf5
--- /dev/null
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -0,0 +1,666 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktextarea_p.h"
+#include "qquicktextarea_p_p.h"
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qguiapplication.h>
+#include <QtQml/qqmlinfo.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquickclipnode_p.h>
+#include <QtQuick/private/qquickflickable_p.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TextArea
+ \inherits TextEdit
+ \instantiates QQuickTextArea
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Multi-line text input area.
+
+ TextArea is a multi-line text editor. TextArea extends TextEdit with
+ a \l {placeholderText}{placeholder text} functionality, and adds decoration.
+
+ \image qtquickcontrols2-textarea.png
+
+ \code
+ TextArea {
+ placeholderText: qsTr("Enter description")
+ }
+ \endcode
+
+ TextArea is not scrollable by itself. Especially on screen-size constrained
+ platforms, it is often preferable to make entire application pages scrollable.
+ On such a scrollable page, a non-scrollable TextArea might behave better than
+ nested scrollable controls. Notice, however, that in such a scenario, the background
+ decoration of the TextArea scrolls together with the rest of the scrollable
+ content.
+
+ \section2 Scrollable TextArea
+
+ If you want to make a TextArea scrollable, for example, when it covers
+ an entire application page, attach it to a \l Flickable and combine with a
+ \l ScrollBar or \l ScrollIndicator.
+
+ \image qtquickcontrols2-textarea-flickable.png
+
+ \snippet qtquickcontrols2-textarea-flickable.qml 1
+
+ A TextArea that is attached to a \l Flickable does the following:
+
+ \list
+ \li Sets the content size automatically
+ \li Ensures that the background decoration stays in place
+ \li Clips the content
+ \endlist
+
+ \sa TextField, {Customizing TextArea}, {Input Controls}
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::TextArea::pressAndHold(MouseEvent mouse)
+
+ This signal is emitted when there is a long press (the delay depends on the platform plugin).
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position of the press, and which button is pressed.
+*/
+
+QQuickTextAreaPrivate::QQuickTextAreaPrivate()
+ : background(nullptr), focusReason(Qt::OtherFocusReason), accessibleAttached(nullptr), flickable(nullptr)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::installActivationObserver(this);
+#endif
+}
+
+QQuickTextAreaPrivate::~QQuickTextAreaPrivate()
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::removeActivationObserver(this);
+#endif
+}
+
+void QQuickTextAreaPrivate::resizeBackground()
+{
+ Q_Q(QQuickTextArea);
+ if (background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (!p->widthValid && qFuzzyIsNull(background->x())) {
+ if (flickable)
+ background->setWidth(flickable->width());
+ else
+ background->setWidth(q->width());
+ p->widthValid = false;
+ }
+ if (!p->heightValid && qFuzzyIsNull(background->y())) {
+ if (flickable)
+ background->setHeight(flickable->height());
+ else
+ background->setHeight(q->height());
+ p->heightValid = false;
+ }
+ }
+}
+
+void QQuickTextAreaPrivate::attachFlickable(QQuickFlickable *item)
+{
+ Q_Q(QQuickTextArea);
+ flickable = item;
+ q->setParentItem(flickable->contentItem());
+
+ if (background)
+ background->setParentItem(flickable);
+
+ QObjectPrivate::connect(q, &QQuickTextArea::contentSizeChanged, this, &QQuickTextAreaPrivate::resizeFlickableContent);
+ QObjectPrivate::connect(q, &QQuickTextEdit::cursorRectangleChanged, this, &QQuickTextAreaPrivate::ensureCursorVisible);
+
+ QObject::connect(flickable, &QQuickFlickable::contentXChanged, q, &QQuickItem::update);
+ QObject::connect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
+
+ QQuickItemPrivate::get(flickable)->updateOrAddGeometryChangeListener(this, QQuickItemPrivate::SizeChange);
+ QObjectPrivate::connect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
+ QObjectPrivate::connect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
+
+ resizeFlickableControl();
+}
+
+void QQuickTextAreaPrivate::detachFlickable()
+{
+ Q_Q(QQuickTextArea);
+ q->setParentItem(nullptr);
+ if (background && background->parentItem() == flickable)
+ background->setParentItem(q);
+
+ QObjectPrivate::disconnect(q, &QQuickTextArea::contentSizeChanged, this, &QQuickTextAreaPrivate::resizeFlickableContent);
+ QObjectPrivate::disconnect(q, &QQuickTextEdit::cursorRectangleChanged, this, &QQuickTextAreaPrivate::ensureCursorVisible);
+
+ QObject::disconnect(flickable, &QQuickFlickable::contentXChanged, q, &QQuickItem::update);
+ QObject::disconnect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
+
+ QQuickItemPrivate::get(flickable)->updateOrRemoveGeometryChangeListener(this, QQuickItemPrivate::SizeChange);
+ QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
+ QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
+
+ flickable = nullptr;
+}
+
+void QQuickTextAreaPrivate::ensureCursorVisible()
+{
+ Q_Q(QQuickTextArea);
+ if (!flickable)
+ return;
+
+ const qreal cx = flickable->contentX();
+ const qreal cy = flickable->contentY();
+ const qreal w = flickable->width();
+ const qreal h = flickable->height();
+
+ const qreal tp = q->topPadding();
+ const qreal lp = q->leftPadding();
+ const QRectF cr = q->cursorRectangle();
+
+ if (cr.left() <= cx + lp) {
+ flickable->setContentX(cr.left() - lp);
+ } else {
+ // calculate the rectangle of the next character and ensure that
+ // it's visible if it's on the same line with the cursor
+ const qreal rp = q->rightPadding();
+ const QRectF nr = q->cursorPosition() < q->length() ? q->positionToRectangle(q->cursorPosition() + 1) : QRectF();
+ if (qFuzzyCompare(nr.y(), cr.y()) && nr.right() >= cx + lp + w - rp)
+ flickable->setContentX(nr.right() - w + rp);
+ else if (cr.right() >= cx + lp + w - rp)
+ flickable->setContentX(cr.right() - w + rp);
+ }
+
+ if (cr.top() <= cy + tp) {
+ flickable->setContentY(cr.top() - tp);
+ } else {
+ const qreal bp = q->bottomPadding();
+ if (cr.bottom() >= cy + tp + h - bp)
+ flickable->setContentY(cr.bottom() - h + bp);
+ }
+}
+
+void QQuickTextAreaPrivate::resizeFlickableControl()
+{
+ Q_Q(QQuickTextArea);
+ if (!flickable)
+ return;
+
+ const qreal w = wrapMode == QQuickTextArea::NoWrap ? qMax(flickable->width(), flickable->contentWidth()) : flickable->width();
+ const qreal h = qMax(flickable->height(), flickable->contentHeight());
+ q->setSize(QSizeF(w, h));
+
+ resizeBackground();
+}
+
+void QQuickTextAreaPrivate::resizeFlickableContent()
+{
+ Q_Q(QQuickTextArea);
+ if (!flickable)
+ return;
+
+ flickable->setContentWidth(q->contentWidth() + q->leftPadding() + q->rightPadding());
+ flickable->setContentHeight(q->contentHeight() + q->topPadding() + q->bottomPadding());
+}
+
+void QQuickTextAreaPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_UNUSED(item);
+ Q_UNUSED(newGeometry);
+ Q_UNUSED(oldGeometry);
+
+ resizeFlickableControl();
+}
+
+qreal QQuickTextAreaPrivate::getImplicitWidth() const
+{
+ return QQuickItemPrivate::getImplicitWidth();
+}
+
+qreal QQuickTextAreaPrivate::getImplicitHeight() const
+{
+ return QQuickItemPrivate::getImplicitHeight();
+}
+
+void QQuickTextAreaPrivate::implicitWidthChanged()
+{
+ Q_Q(QQuickTextArea);
+ QQuickItemPrivate::implicitWidthChanged();
+ emit q->implicitWidthChanged3();
+}
+
+void QQuickTextAreaPrivate::implicitHeightChanged()
+{
+ Q_Q(QQuickTextArea);
+ QQuickItemPrivate::implicitHeightChanged();
+ emit q->implicitHeightChanged3();
+}
+
+QQuickTextArea::QQuickTextArea(QQuickItem *parent) :
+ QQuickTextEdit(*(new QQuickTextAreaPrivate), parent)
+{
+ Q_D(QQuickTextArea);
+ setActiveFocusOnTab(true);
+ d->setImplicitResizeEnabled(false);
+ d->pressHandler.control = this;
+#ifndef QT_NO_CURSOR
+ setCursor(Qt::IBeamCursor);
+#endif
+ QObjectPrivate::connect(this, &QQuickTextEdit::readOnlyChanged,
+ d, &QQuickTextAreaPrivate::_q_readOnlyChanged);
+}
+
+QQuickTextArea::~QQuickTextArea()
+{
+}
+
+QQuickTextAreaAttached *QQuickTextArea::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickTextAreaAttached(object);
+}
+
+/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickTextAreaPrivate::resolveFont()
+{
+ Q_Q(QQuickTextArea);
+ inheritFont(QQuickControlPrivate::parentFont(q));
+}
+
+void QQuickTextAreaPrivate::inheritFont(const QFont &f)
+{
+ Q_Q(QQuickTextArea);
+ QFont parentFont = font.resolve(f);
+ parentFont.resolve(font.resolve() | f.resolve());
+
+ const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::EditorFont);
+ const QFont resolvedFont = parentFont.resolve(defaultFont);
+
+ const bool changed = resolvedFont != sourceFont;
+ q->QQuickTextEdit::setFont(resolvedFont);
+ if (changed)
+ emit q->fontChanged();
+}
+
+void QQuickTextAreaPrivate::_q_readOnlyChanged(bool isReadOnly)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleAttached)
+ accessibleAttached->set_readOnly(isReadOnly);
+#else
+ Q_UNUSED(isReadOnly)
+#endif
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickTextAreaPrivate::accessibilityActiveChanged(bool active)
+{
+ if (accessibleAttached || !active)
+ return;
+
+ Q_Q(QQuickTextArea);
+ accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+ if (accessibleAttached) {
+ accessibleAttached->setRole(accessibleRole());
+ accessibleAttached->set_readOnly(q->isReadOnly());
+ accessibleAttached->setDescription(placeholder);
+ } else {
+ qWarning() << "QQuickTextArea: " << q << " QQuickAccessibleAttached object creation failed!";
+ }
+}
+
+QAccessible::Role QQuickTextAreaPrivate::accessibleRole() const
+{
+ return QAccessible::EditableText;
+}
+#endif
+
+void QQuickTextAreaPrivate::deleteDelegate(QObject *delegate)
+{
+ if (componentComplete)
+ delete delegate;
+ else
+ pendingDeletions.append(delegate);
+}
+
+QFont QQuickTextArea::font() const
+{
+ return QQuickTextEdit::font();
+}
+
+void QQuickTextArea::setFont(const QFont &font)
+{
+ Q_D(QQuickTextArea);
+ if (d->font.resolve() == font.resolve() && d->font == font)
+ return;
+
+ d->font = font;
+ d->resolveFont();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::TextArea::background
+
+ This property holds the background item.
+
+ \input qquickcontrol-background.qdocinc notes
+
+ \sa {Customizing TextArea}
+*/
+QQuickItem *QQuickTextArea::background() const
+{
+ Q_D(const QQuickTextArea);
+ return d->background;
+}
+
+void QQuickTextArea::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickTextArea);
+ if (d->background == background)
+ return;
+
+ d->deleteDelegate(d->background);
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
+ }
+ emit backgroundChanged();
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::TextArea::placeholderText
+
+ This property holds the short hint that is displayed in the text area before
+ the user enters a value.
+*/
+QString QQuickTextArea::placeholderText() const
+{
+ Q_D(const QQuickTextArea);
+ return d->placeholder;
+}
+
+void QQuickTextArea::setPlaceholderText(const QString &text)
+{
+ Q_D(QQuickTextArea);
+ if (d->placeholder == text)
+ return;
+
+ d->placeholder = text;
+#ifndef QT_NO_ACCESSIBILITY
+ if (d->accessibleAttached)
+ d->accessibleAttached->setDescription(text);
+#endif
+ emit placeholderTextChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::TextArea::focusReason
+
+ \include qquickcontrol-focusreason.qdocinc
+*/
+Qt::FocusReason QQuickTextArea::focusReason() const
+{
+ Q_D(const QQuickTextArea);
+ return d->focusReason;
+}
+
+void QQuickTextArea::setFocusReason(Qt::FocusReason reason)
+{
+ Q_D(QQuickTextArea);
+ if (d->focusReason == reason)
+ return;
+
+ d->focusReason = reason;
+ emit focusReasonChanged();
+}
+
+bool QQuickTextArea::contains(const QPointF &point) const
+{
+ Q_D(const QQuickTextArea);
+ if (d->flickable && !d->flickable->contains(d->flickable->mapFromItem(this, point)))
+ return false;
+ return QQuickTextEdit::contains(point);
+}
+
+void QQuickTextArea::classBegin()
+{
+ Q_D(QQuickTextArea);
+ QQuickTextEdit::classBegin();
+ d->resolveFont();
+}
+
+void QQuickTextArea::componentComplete()
+{
+ Q_D(QQuickTextArea);
+ QQuickTextEdit::componentComplete();
+#ifndef QT_NO_ACCESSIBILITY
+ if (!d->accessibleAttached && QAccessible::isActive())
+ d->accessibilityActiveChanged(true);
+#endif
+
+ qDeleteAll(d->pendingDeletions);
+ d->pendingDeletions.clear();
+}
+
+void QQuickTextArea::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
+{
+ Q_D(QQuickTextArea);
+ QQuickTextEdit::itemChange(change, value);
+ if (change == ItemParentHasChanged && value.item)
+ d->resolveFont();
+}
+
+void QQuickTextArea::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickTextArea);
+ QQuickTextEdit::geometryChanged(newGeometry, oldGeometry);
+ d->resizeBackground();
+}
+
+QSGNode *QQuickTextArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
+{
+ Q_D(QQuickTextArea);
+ QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
+ if (!clipNode)
+ clipNode = new QQuickDefaultClipNode(QRectF());
+
+ QQuickItem *clipper = this;
+ if (d->flickable)
+ clipper = d->flickable;
+
+ const QRectF cr = clipper->clipRect().adjusted(leftPadding(), topPadding(), -rightPadding(), -bottomPadding());
+ clipNode->setRect(!d->flickable ? cr : cr.translated(d->flickable->contentX(), d->flickable->contentY()));
+ clipNode->update();
+
+ QSGNode *textNode = QQuickTextEdit::updatePaintNode(clipNode->firstChild(), data);
+ if (!textNode->parent())
+ clipNode->appendChildNode(textNode);
+
+ if (d->cursorItem) {
+ QQuickDefaultClipNode *cursorNode = QQuickItemPrivate::get(d->cursorItem)->clipNode();
+ if (cursorNode)
+ cursorNode->setClipRect(d->cursorItem->mapRectFromItem(clipper, cr));
+ }
+
+ return clipNode;
+}
+
+void QQuickTextArea::focusInEvent(QFocusEvent *event)
+{
+ QQuickTextEdit::focusInEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickTextArea::focusOutEvent(QFocusEvent *event)
+{
+ QQuickTextEdit::focusOutEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickTextArea::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextArea);
+ d->pressHandler.mousePressEvent(event);
+ if (d->pressHandler.isActive()) {
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextEdit::mousePressEvent(event);
+ }
+}
+
+void QQuickTextArea::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextArea);
+ d->pressHandler.mouseMoveEvent(event);
+ if (d->pressHandler.isActive()) {
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextEdit::mouseMoveEvent(event);
+ }
+}
+
+void QQuickTextArea::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextArea);
+ d->pressHandler.mouseReleaseEvent(event);
+ if (d->pressHandler.isActive()) {
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextEdit::mouseReleaseEvent(event);
+ }
+}
+
+void QQuickTextArea::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextArea);
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextEdit::mouseDoubleClickEvent(event);
+}
+
+void QQuickTextArea::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickTextArea);
+ if (event->timerId() == d->pressHandler.timer.timerId()) {
+ d->pressHandler.timerEvent(event);
+ } else {
+ QQuickTextEdit::timerEvent(event);
+ }
+}
+
+class QQuickTextAreaAttachedPrivate : public QObjectPrivate
+{
+public:
+ QQuickTextAreaAttachedPrivate() : control(nullptr) { }
+
+ QQuickTextArea *control;
+};
+
+QQuickTextAreaAttached::QQuickTextAreaAttached(QObject *parent) :
+ QObject(*(new QQuickTextAreaAttachedPrivate), parent)
+{
+}
+
+QQuickTextAreaAttached::~QQuickTextAreaAttached()
+{
+}
+
+/*!
+ \qmlattachedproperty TextArea QtQuick.Controls::TextArea::flickable
+
+ This property attaches a text area to a \l Flickable.
+
+ \sa ScrollBar, ScrollIndicator, {Scrollable TextArea}
+*/
+QQuickTextArea *QQuickTextAreaAttached::flickable() const
+{
+ Q_D(const QQuickTextAreaAttached);
+ return d->control;
+}
+
+void QQuickTextAreaAttached::setFlickable(QQuickTextArea *control)
+{
+ Q_D(QQuickTextAreaAttached);
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(parent());
+ if (!flickable) {
+ qmlInfo(parent()) << "TextArea must be attached to a Flickable";
+ return;
+ }
+
+ if (d->control == control)
+ return;
+
+ if (d->control)
+ QQuickTextAreaPrivate::get(d->control)->detachFlickable();
+
+ d->control = control;
+
+ if (control)
+ QQuickTextAreaPrivate::get(control)->attachFlickable(flickable);
+
+ emit flickableChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
new file mode 100644
index 00000000..f00943aa
--- /dev/null
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTAREA_P_H
+#define QQUICKTEXTAREA_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktextedit_p.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickText;
+class QQuickTextAreaPrivate;
+class QQuickTextAreaAttached;
+class QQuickMouseEvent;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit
+{
+ Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
+ Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged3 FINAL)
+ Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged3 FINAL)
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
+ Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
+
+public:
+ explicit QQuickTextArea(QQuickItem *parent = nullptr);
+ ~QQuickTextArea();
+
+ static QQuickTextAreaAttached *qmlAttachedProperties(QObject *object);
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+ QString placeholderText() const;
+ void setPlaceholderText(const QString &text);
+
+ Qt::FocusReason focusReason() const;
+ void setFocusReason(Qt::FocusReason reason);
+
+ bool contains(const QPointF &point) const override;
+
+Q_SIGNALS:
+ void fontChanged();
+ void implicitWidthChanged3();
+ void implicitHeightChanged3();
+ void backgroundChanged();
+ void placeholderTextChanged();
+ void focusReasonChanged();
+ void pressAndHold(QQuickMouseEvent *event);
+
+protected:
+ void classBegin() override;
+ void componentComplete() 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 mouseDoubleClickEvent(QMouseEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
+
+private:
+ Q_DISABLE_COPY(QQuickTextArea)
+ Q_DECLARE_PRIVATE(QQuickTextArea)
+};
+
+class QQuickTextAreaAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextAreaAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickTextArea *flickable READ flickable WRITE setFlickable NOTIFY flickableChanged FINAL)
+
+public:
+ explicit QQuickTextAreaAttached(QObject *parent);
+ ~QQuickTextAreaAttached();
+
+ QQuickTextArea *flickable() const;
+ void setFlickable(QQuickTextArea *control);
+
+Q_SIGNALS:
+ void flickableChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickTextAreaAttached)
+ Q_DECLARE_PRIVATE(QQuickTextAreaAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickTextArea)
+QML_DECLARE_TYPEINFO(QQuickTextArea, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKTEXTAREA_P_H
diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h
new file mode 100644
index 00000000..1598a87e
--- /dev/null
+++ b/src/quicktemplates2/qquicktextarea_p_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTAREA_P_P_H
+#define QQUICKTEXTAREA_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktextedit_p_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQuickTemplates2/private/qquickpresshandler_p_p.h>
+
+#include "qquicktextarea_p.h"
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtGui/qaccessible.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class QQuickFlickable;
+class QQuickAccessibleAttached;
+
+class QQuickTextAreaPrivate : public QQuickTextEditPrivate, public QQuickItemChangeListener
+#ifndef QT_NO_ACCESSIBILITY
+ , public QAccessible::ActivationObserver
+#endif
+{
+ Q_DECLARE_PUBLIC(QQuickTextArea)
+
+public:
+ QQuickTextAreaPrivate();
+ ~QQuickTextAreaPrivate();
+
+ static QQuickTextAreaPrivate *get(QQuickTextArea *item) {
+ return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(item)); }
+
+ void resizeBackground();
+ void resolveFont();
+ void inheritFont(const QFont &f);
+
+ void attachFlickable(QQuickFlickable *flickable);
+ void detachFlickable();
+ void ensureCursorVisible();
+ void resizeFlickableControl();
+ void resizeFlickableContent();
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+ qreal getImplicitWidth() const override;
+ qreal getImplicitHeight() const override;
+
+ void implicitWidthChanged() override;
+ void implicitHeightChanged() override;
+
+ void _q_readOnlyChanged(bool isReadOnly);
+
+#ifndef QT_NO_ACCESSIBILITY
+ void accessibilityActiveChanged(bool active) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+ void deleteDelegate(QObject *object);
+
+ QFont font;
+ QQuickItem *background;
+ QString placeholder;
+ Qt::FocusReason focusReason;
+ QQuickPressHandler pressHandler;
+ QQuickAccessibleAttached *accessibleAttached;
+ QQuickFlickable *flickable;
+ // This list contains the default delegates which were
+ // replaced with custom ones via declarative assignments
+ // before Component.completed() was emitted. See QTBUG-50992.
+ QVector<QObject *> pendingDeletions;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKTEXTAREA_P_P_H
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
new file mode 100644
index 00000000..610df907
--- /dev/null
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -0,0 +1,471 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktextfield_p.h"
+#include "qquicktextfield_p_p.h"
+#include "qquickcontrol_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtCore/qbasictimer.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicktext_p.h>
+#include <QtQuick/private/qquicktextinput_p.h>
+#include <QtQuick/private/qquickclipnode_p.h>
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype TextField
+ \inherits TextInput
+ \instantiates QQuickTextField
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Single-line text input field.
+
+ TextField is a single line text editor. TextField extends TextInput with
+ a \l {placeholderText}{placeholder text} functionality, and adds decoration.
+
+ \table
+ \row \li \image qtquickcontrols2-textfield-normal.png
+ \li A text field in its normal state.
+ \row \li \image qtquickcontrols2-textfield-focused.png
+ \li A text field that has active focus.
+ \row \li \image qtquickcontrols2-textfield-disabled.png
+ \li A text field that is disabled.
+ \endtable
+
+ \code
+ TextField {
+ placeholderText: qsTr("Enter name")
+ }
+ \endcode
+
+ \sa TextArea, {Customizing TextField}, {Input Controls}
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::TextField::pressAndHold(MouseEvent mouse)
+
+ This signal is emitted when there is a long press (the delay depends on the platform plugin).
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position of the press, and which button is pressed.
+*/
+
+QQuickTextFieldPrivate::QQuickTextFieldPrivate()
+ : background(nullptr)
+ , focusReason(Qt::OtherFocusReason)
+ , accessibleAttached(nullptr)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::installActivationObserver(this);
+#endif
+}
+
+QQuickTextFieldPrivate::~QQuickTextFieldPrivate()
+{
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::removeActivationObserver(this);
+#endif
+}
+
+void QQuickTextFieldPrivate::resizeBackground()
+{
+ Q_Q(QQuickTextField);
+ if (background) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (!p->widthValid && qFuzzyIsNull(background->x())) {
+ background->setWidth(q->width());
+ p->widthValid = false;
+ }
+ if (!p->heightValid && qFuzzyIsNull(background->y())) {
+ background->setHeight(q->height());
+ p->heightValid = false;
+ }
+ }
+}
+
+qreal QQuickTextFieldPrivate::getImplicitWidth() const
+{
+ return QQuickItemPrivate::getImplicitWidth();
+}
+
+qreal QQuickTextFieldPrivate::getImplicitHeight() const
+{
+ return QQuickItemPrivate::getImplicitHeight();
+}
+
+void QQuickTextFieldPrivate::implicitWidthChanged()
+{
+ Q_Q(QQuickTextField);
+ QQuickItemPrivate::implicitWidthChanged();
+ emit q->implicitWidthChanged3();
+}
+
+void QQuickTextFieldPrivate::implicitHeightChanged()
+{
+ Q_Q(QQuickTextField);
+ QQuickItemPrivate::implicitHeightChanged();
+ emit q->implicitHeightChanged3();
+}
+
+QQuickTextField::QQuickTextField(QQuickItem *parent) :
+ QQuickTextInput(*(new QQuickTextFieldPrivate), parent)
+{
+ Q_D(QQuickTextField);
+ d->pressHandler.control = this;
+ d->setImplicitResizeEnabled(false);
+ setActiveFocusOnTab(true);
+#ifndef QT_NO_CURSOR
+ setCursor(Qt::IBeamCursor);
+#endif
+ QObjectPrivate::connect(this, &QQuickTextInput::readOnlyChanged,
+ d, &QQuickTextFieldPrivate::_q_readOnlyChanged);
+ QObjectPrivate::connect(this, &QQuickTextInput::echoModeChanged,
+ d, &QQuickTextFieldPrivate::_q_echoModeChanged);
+}
+
+QQuickTextField::~QQuickTextField()
+{
+}
+
+/*!
+ \internal
+
+ Determine which font is implicitly imposed on this control by its ancestors
+ and QGuiApplication::font, resolve this against its own font (attributes from
+ the implicit font are copied over). Then propagate this font to this
+ control's children.
+*/
+void QQuickTextFieldPrivate::resolveFont()
+{
+ Q_Q(QQuickTextField);
+ inheritFont(QQuickControlPrivate::parentFont(q));
+}
+
+void QQuickTextFieldPrivate::inheritFont(const QFont &f)
+{
+ Q_Q(QQuickTextField);
+ QFont parentFont = font.resolve(f);
+ parentFont.resolve(font.resolve() | f.resolve());
+
+ const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::EditorFont);
+ const QFont resolvedFont = parentFont.resolve(defaultFont);
+
+ const bool changed = resolvedFont != sourceFont;
+ q->QQuickTextInput::setFont(resolvedFont);
+ if (changed)
+ emit q->fontChanged();
+}
+
+void QQuickTextFieldPrivate::_q_readOnlyChanged(bool isReadOnly)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleAttached)
+ accessibleAttached->set_readOnly(isReadOnly);
+#else
+ Q_UNUSED(isReadOnly)
+#endif
+}
+
+void QQuickTextFieldPrivate::_q_echoModeChanged(QQuickTextField::EchoMode echoMode)
+{
+#ifndef QT_NO_ACCESSIBILITY
+ if (accessibleAttached)
+ accessibleAttached->set_passwordEdit((echoMode == QQuickTextField::Password || echoMode == QQuickTextField::PasswordEchoOnEdit) ? true : false);
+#else
+ Q_UNUSED(echoMode)
+#endif
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+void QQuickTextFieldPrivate::accessibilityActiveChanged(bool active)
+{
+ if (accessibleAttached || !active)
+ return;
+
+ Q_Q(QQuickTextField);
+ accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+ if (accessibleAttached) {
+ accessibleAttached->setRole(accessibleRole());
+ accessibleAttached->set_readOnly(m_readOnly);
+ accessibleAttached->set_passwordEdit((m_echoMode == QQuickTextField::Password || m_echoMode == QQuickTextField::PasswordEchoOnEdit) ? true : false);
+ accessibleAttached->setDescription(placeholder);
+ } else {
+ qWarning() << "QQuickTextField: " << q << " QQuickAccessibleAttached object creation failed!";
+ }
+}
+
+QAccessible::Role QQuickTextFieldPrivate::accessibleRole() const
+{
+ return QAccessible::EditableText;
+}
+#endif
+
+/*
+ Deletes "delegate" if Component.completed() has been emitted,
+ otherwise stores it in pendingDeletions.
+*/
+void QQuickTextFieldPrivate::deleteDelegate(QObject *delegate)
+{
+ if (componentComplete)
+ delete delegate;
+ else
+ pendingDeletions.append(delegate);
+}
+
+QFont QQuickTextField::font() const
+{
+ return QQuickTextInput::font();
+}
+
+void QQuickTextField::setFont(const QFont &font)
+{
+ Q_D(QQuickTextField);
+ if (d->font.resolve() == font.resolve() && d->font == font)
+ return;
+
+ d->font = font;
+ d->resolveFont();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::TextField::background
+
+ This property holds the background item.
+
+ \input qquickcontrol-background.qdocinc notes
+
+ \sa {Customizing TextField}
+*/
+QQuickItem *QQuickTextField::background() const
+{
+ Q_D(const QQuickTextField);
+ return d->background;
+}
+
+void QQuickTextField::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickTextField);
+ if (d->background == background)
+ return;
+
+ d->deleteDelegate(d->background);
+ d->background = background;
+ if (background) {
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
+ }
+ emit backgroundChanged();
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::TextField::placeholderText
+
+ This property holds the hint that is displayed in the TextField before the user
+ enters text.
+*/
+QString QQuickTextField::placeholderText() const
+{
+ Q_D(const QQuickTextField);
+ return d->placeholder;
+}
+
+void QQuickTextField::setPlaceholderText(const QString &text)
+{
+ Q_D(QQuickTextField);
+ if (d->placeholder == text)
+ return;
+
+ d->placeholder = text;
+#ifndef QT_NO_ACCESSIBILITY
+ if (d->accessibleAttached)
+ d->accessibleAttached->setDescription(text);
+#endif
+ emit placeholderTextChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::TextField::focusReason
+
+ \include qquickcontrol-focusreason.qdocinc
+*/
+Qt::FocusReason QQuickTextField::focusReason() const
+{
+ Q_D(const QQuickTextField);
+ return d->focusReason;
+}
+
+void QQuickTextField::setFocusReason(Qt::FocusReason reason)
+{
+ Q_D(QQuickTextField);
+ if (d->focusReason == reason)
+ return;
+
+ d->focusReason = reason;
+ emit focusReasonChanged();
+}
+
+void QQuickTextField::classBegin()
+{
+ Q_D(QQuickTextField);
+ QQuickTextInput::classBegin();
+ d->resolveFont();
+}
+
+void QQuickTextField::componentComplete()
+{
+ Q_D(QQuickTextField);
+ QQuickTextInput::componentComplete();
+#ifndef QT_NO_ACCESSIBILITY
+ if (!d->accessibleAttached && QAccessible::isActive())
+ d->accessibilityActiveChanged(true);
+#endif
+
+ qDeleteAll(d->pendingDeletions);
+ d->pendingDeletions.clear();
+}
+
+void QQuickTextField::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
+{
+ Q_D(QQuickTextField);
+ QQuickTextInput::itemChange(change, value);
+ if (change == ItemParentHasChanged && value.item)
+ d->resolveFont();
+}
+
+void QQuickTextField::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickTextField);
+ QQuickTextInput::geometryChanged(newGeometry, oldGeometry);
+ d->resizeBackground();
+}
+
+QSGNode *QQuickTextField::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
+{
+ QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
+ if (!clipNode)
+ clipNode = new QQuickDefaultClipNode(QRectF());
+
+ clipNode->setRect(clipRect().adjusted(leftPadding(), topPadding(), -rightPadding(), -bottomPadding()));
+ clipNode->update();
+
+ QSGNode *textNode = QQuickTextInput::updatePaintNode(clipNode->firstChild(), data);
+ if (!textNode->parent())
+ clipNode->appendChildNode(textNode);
+
+ return clipNode;
+}
+
+void QQuickTextField::focusInEvent(QFocusEvent *event)
+{
+ QQuickTextInput::focusInEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickTextField::focusOutEvent(QFocusEvent *event)
+{
+ QQuickTextInput::focusOutEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickTextField::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextField);
+ d->pressHandler.mousePressEvent(event);
+ if (d->pressHandler.isActive()) {
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextInput::mousePressEvent(event);
+ }
+}
+
+void QQuickTextField::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextField);
+ d->pressHandler.mouseMoveEvent(event);
+ if (d->pressHandler.isActive()) {
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextInput::mouseMoveEvent(event);
+ }
+}
+
+void QQuickTextField::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextField);
+ d->pressHandler.mouseReleaseEvent(event);
+ if (d->pressHandler.isActive()) {
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextInput::mouseReleaseEvent(event);
+ }
+}
+
+void QQuickTextField::mouseDoubleClickEvent(QMouseEvent *event)
+{
+ Q_D(QQuickTextField);
+ if (d->pressHandler.delayedMousePressEvent) {
+ QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent);
+ d->pressHandler.clearDelayedMouseEvent();
+ }
+ QQuickTextInput::mouseDoubleClickEvent(event);
+}
+
+void QQuickTextField::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickTextField);
+ if (event->timerId() == d->pressHandler.timer.timerId()) {
+ d->pressHandler.timerEvent(event);
+ } else {
+ QQuickTextInput::timerEvent(event);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktextfield_p.h b/src/quicktemplates2/qquicktextfield_p.h
new file mode 100644
index 00000000..591d6edd
--- /dev/null
+++ b/src/quicktemplates2/qquicktextfield_p.h
@@ -0,0 +1,120 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTFIELD_P_H
+#define QQUICKTEXTFIELD_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktextinput_p.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickText;
+class QQuickTextFieldPrivate;
+class QQuickMouseEvent;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextField : public QQuickTextInput
+{
+ Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
+ Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged3 FINAL)
+ Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged3 FINAL)
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
+ Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
+ Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
+
+public:
+ explicit QQuickTextField(QQuickItem *parent = nullptr);
+ ~QQuickTextField();
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
+ QString placeholderText() const;
+ void setPlaceholderText(const QString &text);
+
+ Qt::FocusReason focusReason() const;
+ void setFocusReason(Qt::FocusReason reason);
+
+Q_SIGNALS:
+ void fontChanged();
+ void implicitWidthChanged3();
+ void implicitHeightChanged3();
+ void backgroundChanged();
+ void placeholderTextChanged();
+ void focusReasonChanged();
+ void pressAndHold(QQuickMouseEvent *mouse);
+
+protected:
+ void classBegin() override;
+ void componentComplete() 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 mouseDoubleClickEvent(QMouseEvent *event) override;
+ void timerEvent(QTimerEvent *event) override;
+
+private:
+ Q_DISABLE_COPY(QQuickTextField)
+ Q_DECLARE_PRIVATE(QQuickTextField)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickTextField)
+
+#endif // QQUICKTEXTFIELD_P_H
diff --git a/src/quicktemplates2/qquicktextfield_p_p.h b/src/quicktemplates2/qquicktextfield_p_p.h
new file mode 100644
index 00000000..5800f448
--- /dev/null
+++ b/src/quicktemplates2/qquicktextfield_p_p.h
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTEXTFIELD_P_P_H
+#define QQUICKTEXTFIELD_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/private/qquicktextinput_p_p.h>
+#include <QtQuickTemplates2/private/qquickpresshandler_p_p.h>
+
+#include "qquicktextfield_p.h"
+
+#ifndef QT_NO_ACCESSIBILITY
+#include <QtGui/qaccessible.h>
+#endif
+
+QT_BEGIN_NAMESPACE
+
+class QQuickAccessibleAttached;
+
+class QQuickTextFieldPrivate : public QQuickTextInputPrivate
+#ifndef QT_NO_ACCESSIBILITY
+ , public QAccessible::ActivationObserver
+#endif
+{
+ Q_DECLARE_PUBLIC(QQuickTextField)
+
+public:
+ QQuickTextFieldPrivate();
+ ~QQuickTextFieldPrivate();
+
+ static QQuickTextFieldPrivate *get(QQuickTextField *item) {
+ return static_cast<QQuickTextFieldPrivate *>(QObjectPrivate::get(item)); }
+
+ void resizeBackground();
+ void resolveFont();
+ void inheritFont(const QFont &f);
+
+ qreal getImplicitWidth() const override;
+ qreal getImplicitHeight() const 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) override;
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+ void deleteDelegate(QObject *object);
+
+ QFont font;
+ QQuickItem *background;
+ QString placeholder;
+ Qt::FocusReason focusReason;
+ QQuickPressHandler pressHandler;
+ QQuickAccessibleAttached *accessibleAttached;
+ // This list contains the default delegates which were
+ // replaced with custom ones via declarative assignments
+ // before Component.completed() was emitted. See QTBUG-50992.
+ QVector<QObject *> pendingDeletions;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKTEXTFIELD_P_P_H
diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp
new file mode 100644
index 00000000..12ecb702
--- /dev/null
+++ b/src/quicktemplates2/qquicktoolbar.cpp
@@ -0,0 +1,151 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktoolbar_p.h"
+#include "qquickpane_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ToolBar
+ \inherits Pane
+ \instantiates QQuickToolBar
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-containers
+ \brief Container for context-sensitive controls.
+
+ ToolBar is a container of application-wide and context sensitive
+ actions and controls, such as navigation buttons and search fields.
+ ToolBar is commonly used as a \l {ApplicationWindow::header}{header}
+ or a \l {ApplicationWindow::footer}{footer} of an \l ApplicationWindow.
+
+ ToolBar does not provide a layout of its own, but requires you to
+ position its contents, for instance by creating a \l RowLayout. If only
+ a single item is used within the ToolBar, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \image qtquickcontrols2-toolbar.png
+
+ \code
+ ApplicationWindow {
+ visible:true
+
+ header: ToolBar {
+ RowLayout {
+ anchors.fill: parent
+ ToolButton {
+ text: qsTr("‹")
+ onClicked: stack.pop()
+ }
+ Label {
+ text: "Title"
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: qsTr("â‹®")
+ onClicked: menu.open()
+ }
+ }
+ }
+
+ StackView {
+ id: stack
+ anchors.fill: parent
+ }
+ }
+ \endcode
+
+ \sa ApplicationWindow, ToolButton, {Customizing ToolBar}, {Container Controls}
+*/
+
+class QQuickToolBarPrivate : public QQuickPanePrivate
+{
+public:
+ QQuickToolBarPrivate() : position(QQuickToolBar::Header) { }
+
+ QQuickToolBar::Position position;
+};
+
+QQuickToolBar::QQuickToolBar(QQuickItem *parent) :
+ QQuickPane(*(new QQuickToolBarPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::ToolBar::position
+
+ This property holds the position of the toolbar.
+
+ \note If the toolbar is assigned as a header or footer of \l ApplicationWindow
+ or \l 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
+{
+ return QAccessible::ToolBar;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktoolbar_p.h b/src/quicktemplates2/qquicktoolbar_p.h
new file mode 100644
index 00000000..9fd85e40
--- /dev/null
+++ b/src/quicktemplates2/qquicktoolbar_p.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTOOLBAR_P_H
+#define QQUICKTOOLBAR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickpane_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickToolBarPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolBar : public QQuickPane
+{
+ Q_OBJECT
+ Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+
+public:
+ 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 override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickToolBar)
+ Q_DECLARE_PRIVATE(QQuickToolBar)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickToolBar)
+
+#endif // QQUICKTOOLBAR_P_H
diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp
new file mode 100644
index 00000000..e8827b4c
--- /dev/null
+++ b/src/quicktemplates2/qquicktoolbutton.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktoolbutton_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ToolButton
+ \inherits Button
+ \instantiates QQuickToolButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-buttons
+ \brief Button with a look suitable for a ToolBar.
+
+ ToolButton is functionally similar to \l Button, but provides a look that
+ is more suitable within a \l ToolBar.
+
+ \image qtquickcontrols2-toolbar.png
+
+ \snippet qtquickcontrols2-toolbar.qml 1
+
+ ToolButton inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
+ using the AbstractButton API.
+
+ \sa ToolBar, {Customizing ToolButton}, {Button Controls}
+*/
+
+QQuickToolButton::QQuickToolButton(QQuickItem *parent) :
+ QQuickButton(parent)
+{
+}
+
+QFont QQuickToolButton::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::ToolButtonFont);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktoolbutton_p.h b/src/quicktemplates2/qquicktoolbutton_p.h
new file mode 100644
index 00000000..0041e9c9
--- /dev/null
+++ b/src/quicktemplates2/qquicktoolbutton_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTOOLBUTTON_P_H
+#define QQUICKTOOLBUTTON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickbutton_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolButton : public QQuickButton
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickToolButton(QQuickItem *parent = nullptr);
+
+protected:
+ QFont defaultFont() const override;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickToolButton)
+
+#endif // QQUICKTOOLBUTTON_P_H
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
new file mode 100644
index 00000000..3bd47457
--- /dev/null
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -0,0 +1,531 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktooltip_p.h"
+#include "qquickpopup_p_p.h"
+#include "qquickcontrol_p_p.h"
+
+#include <QtCore/qbasictimer.h>
+#include <QtQml/qqmlinfo.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ToolTip
+ \inherits Popup
+ \instantiates QQuickToolTip
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-popups
+ \brief Provides tool tips for any control.
+
+ A tool tip is a short piece of text that informs the user of a control's
+ function. It is typically placed above or below the parent control. The
+ tip text can be any \l{Rich Text Processing}{rich text} formatted string.
+
+ \image qtquickcontrols2-tooltip.png
+
+ \section2 Attached Tool Tips
+
+ The most straight-forward way to setup tool tips for controls is to
+ specify \l text and \l {visible}{visibility} via attached properties.
+ The following example illustrates this approach:
+
+ \snippet qtquickcontrols2-tooltip.qml 1
+
+ Under normal circumstances, there is only one tool tip visible at a time.
+ In order to save resources, all items that use the ToolTip attached property
+ share the same visual tool tip label instance. Even though the visuals are
+ shared, \c text, \c timeout and \c delay are stored individually for each item
+ that uses the respective attached property. However, multiple items cannot
+ make the shared tool tip visible at the same time. The shared tool tip is only
+ shown for the last item that made it visible. The position of the shared tool
+ tip is determined by the framework.
+
+ \section2 Delay and Timeout
+
+ Tool tips are typically transient in a sense that they are shown as a
+ result of a certain external event or user interaction, and they usually
+ hide after a certain timeout. It is possible to control the delay when
+ a tool tip is shown, and the timeout when it is hidden. This makes it
+ possible to implement varying strategies for showing and hiding tool tips.
+
+ For example, on touch screens, it is a common pattern to show a tool tip
+ as a result of pressing and holding down a button. The following example
+ demonstrates how to delay showing a tool tip until the press-and-hold
+ interval is reached. In this example, the tool tip hides as soon as the
+ button is released.
+
+ \snippet qtquickcontrols2-tooltip-pressandhold.qml 1
+
+ With pointer devices, however, it might be desired to show a tool tip as
+ a result of hovering a button for a while. The following example presents
+ how to show a tool tip after hovering a button for a second, and hide it
+ after a timeout of five seconds.
+
+ \snippet qtquickcontrols2-tooltip-hover.qml 1
+
+ \section2 Custom Tool Tips
+
+ Should one need more fine-grained control over the tool tip position, or
+ multiple simultaneous tool tip instances are needed, it is also possible
+ to create local tool tip instances. This way, it is possible to
+ \l {Customizing ToolTip}{customize} the tool tip, and the whole \l Popup
+ API is available. The following example presents a tool tip that presents
+ the value of a slider when the handle is dragged.
+
+ \image qtquickcontrols2-tooltip-slider.png
+
+ \snippet qtquickcontrols2-tooltip-slider.qml 1
+
+ \sa {Customizing ToolTip}, {Popup Controls}
+*/
+
+class QQuickToolTipPrivate : public QQuickPopupPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickToolTip)
+
+public:
+ QQuickToolTipPrivate() : delay(0), timeout(-1) { }
+
+ void startDelay();
+ void stopDelay();
+
+ void startTimeout();
+ void stopTimeout();
+
+ int delay;
+ int timeout;
+ QString text;
+ QBasicTimer delayTimer;
+ QBasicTimer timeoutTimer;
+};
+
+void QQuickToolTipPrivate::startDelay()
+{
+ Q_Q(QQuickToolTip);
+ if (delay > 0)
+ delayTimer.start(delay, q);
+}
+
+void QQuickToolTipPrivate::stopDelay()
+{
+ delayTimer.stop();
+}
+
+void QQuickToolTipPrivate::startTimeout()
+{
+ Q_Q(QQuickToolTip);
+ if (timeout > 0)
+ timeoutTimer.start(timeout, q);
+}
+
+void QQuickToolTipPrivate::stopTimeout()
+{
+ timeoutTimer.stop();
+}
+
+QQuickToolTip::QQuickToolTip(QQuickItem *parent) :
+ QQuickPopup(*(new QQuickToolTipPrivate), parent)
+{
+ Q_D(QQuickToolTip);
+ d->allowVerticalFlip = true;
+ d->allowHorizontalFlip = true;
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::ToolTip::text
+
+ This property holds the text shown on the tool tip.
+*/
+QString QQuickToolTip::text() const
+{
+ Q_D(const QQuickToolTip);
+ return d->text;
+}
+
+void QQuickToolTip::setText(const QString &text)
+{
+ Q_D(QQuickToolTip);
+ if (d->text == text)
+ return;
+
+ d->text = text;
+ setAccessibleName(text);
+ emit textChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::ToolTip::delay
+
+ This property holds the delay (milliseconds) after which the tool tip is
+ shown. A tooltip with a negative delay is shown immediately. The default
+ value is \c 0.
+
+ \sa {Delay and Timeout}
+*/
+int QQuickToolTip::delay() const
+{
+ Q_D(const QQuickToolTip);
+ return d->delay;
+}
+
+void QQuickToolTip::setDelay(int delay)
+{
+ Q_D(QQuickToolTip);
+ if (d->delay == delay)
+ return;
+
+ d->delay = delay;
+ emit delayChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::ToolTip::timeout
+
+ This property holds the timeout (milliseconds) after which the tool tip is
+ hidden. A tooltip with a negative timeout does not hide automatically. The
+ default value is \c -1.
+
+ \sa {Delay and Timeout}
+*/
+int QQuickToolTip::timeout() const
+{
+ Q_D(const QQuickToolTip);
+ return d->timeout;
+}
+
+void QQuickToolTip::setTimeout(int timeout)
+{
+ Q_D(QQuickToolTip);
+ if (d->timeout == timeout)
+ return;
+
+ if (timeout <= 0)
+ d->stopTimeout();
+ else if (isVisible())
+ d->startTimeout();
+
+ d->timeout = timeout;
+ emit timeoutChanged();
+}
+
+void QQuickToolTip::setVisible(bool visible)
+{
+ Q_D(QQuickToolTip);
+ if (visible) {
+ if (!d->visible && d->delay > 0) {
+ d->startDelay();
+ return;
+ }
+ } else {
+ d->stopDelay();
+ }
+ QQuickPopup::setVisible(visible);
+}
+
+QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (!item)
+ qmlInfo(object) << "ToolTip must be attached to an Item";
+
+ return new QQuickToolTipAttached(object);
+}
+
+QFont QQuickToolTip::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::TipLabelFont);
+}
+
+void QQuickToolTip::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
+{
+ Q_D(QQuickToolTip);
+ QQuickPopup::itemChange(change, data);
+ if (change == QQuickItem::ItemVisibleHasChanged) {
+ if (data.boolValue)
+ d->startTimeout();
+ else
+ d->stopTimeout();
+
+ QQuickToolTipAttached *attached = qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(d->parentItem, false));
+ if (attached)
+ emit attached->visibleChanged();
+ }
+}
+
+void QQuickToolTip::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickToolTip);
+ if (event->timerId() == d->timeoutTimer.timerId()) {
+ d->stopTimeout();
+ QQuickPopup::setVisible(false);
+ } else if (event->timerId() == d->delayTimer.timerId()) {
+ d->stopDelay();
+ QQuickPopup::setVisible(true);
+ }
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickToolTip::accessibleRole() const
+{
+ return QAccessible::ToolTip;
+}
+
+void QQuickToolTip::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickToolTip);
+ QQuickPopup::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->text);
+}
+#endif
+
+class QQuickToolTipAttachedPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickToolTipAttached)
+
+public:
+ QQuickToolTipAttachedPrivate() : delay(0), timeout(-1) { }
+
+ QQuickToolTip *instance(bool create) const;
+
+ int delay;
+ int timeout;
+ QString text;
+};
+
+QQuickToolTip *QQuickToolTipAttachedPrivate::instance(bool create) const
+{
+ QQmlEngine *engine = qmlEngine(parent);
+ if (!engine)
+ return nullptr;
+
+ static const char *name = "_q_QQuickToolTip";
+
+ QQuickToolTip *tip = engine->property(name).value<QQuickToolTip *>();
+ if (!tip && create) {
+ // TODO: a cleaner way to create the instance? QQml(Meta)Type?
+ QQmlComponent component(engine);
+ component.setData("import QtQuick.Controls 2.0; ToolTip { }", QUrl());
+
+ QObject *object = component.create();
+ if (object)
+ object->setParent(engine);
+
+ tip = qobject_cast<QQuickToolTip *>(object);
+ if (!tip)
+ delete object;
+ else
+ engine->setProperty(name, QVariant::fromValue(object));
+ }
+ return tip;
+}
+
+QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) :
+ QObject(*(new QQuickToolTipAttachedPrivate), parent)
+{
+}
+
+/*!
+ \qmlattachedproperty string QtQuick.Controls::ToolTip::text
+
+ This attached property holds the text of the shared tool tip.
+ The property can be attached to any item.
+
+ \sa {Attached Tool Tips}
+*/
+QString QQuickToolTipAttached::text() const
+{
+ Q_D(const QQuickToolTipAttached);
+ return d->text;
+}
+
+void QQuickToolTipAttached::setText(const QString &text)
+{
+ Q_D(QQuickToolTipAttached);
+ if (d->text == text)
+ return;
+
+ d->text = text;
+ emit textChanged();
+
+ if (isVisible())
+ d->instance(true)->setText(text);
+}
+
+/*!
+ \qmlattachedproperty int QtQuick.Controls::ToolTip::delay
+
+ This attached property holds the delay (milliseconds) of the shared tool tip.
+ The property can be attached to any item.
+
+ \sa {Attached Tool Tips}, {Delay and Timeout}
+*/
+int QQuickToolTipAttached::delay() const
+{
+ Q_D(const QQuickToolTipAttached);
+ return d->delay;
+}
+
+void QQuickToolTipAttached::setDelay(int delay)
+{
+ Q_D(QQuickToolTipAttached);
+ if (d->delay == delay)
+ return;
+
+ d->delay = delay;
+ emit delayChanged();
+
+ if (isVisible())
+ d->instance(true)->setDelay(delay);
+}
+
+/*!
+ \qmlattachedproperty int QtQuick.Controls::ToolTip::timeout
+
+ This attached property holds the timeout (milliseconds) of the shared tool tip.
+ The property can be attached to any item.
+
+ \sa {Attached Tool Tips}, {Delay and Timeout}
+*/
+int QQuickToolTipAttached::timeout() const
+{
+ Q_D(const QQuickToolTipAttached);
+ return d->timeout;
+}
+
+void QQuickToolTipAttached::setTimeout(int timeout)
+{
+ Q_D(QQuickToolTipAttached);
+ if (d->timeout == timeout)
+ return;
+
+ d->timeout = timeout;
+ emit timeoutChanged();
+
+ if (isVisible())
+ d->instance(true)->setTimeout(timeout);
+}
+
+/*!
+ \qmlattachedproperty bool QtQuick.Controls::ToolTip::visible
+
+ This attached property holds whether the shared tool tip is visible.
+ The property can be attached to any item.
+
+ \sa {Attached Tool Tips}
+*/
+bool QQuickToolTipAttached::isVisible() const
+{
+ Q_D(const QQuickToolTipAttached);
+ QQuickToolTip *tip = d->instance(false);
+ if (!tip)
+ return false;
+
+ return tip->isVisible() && tip->parentItem() == parent();
+}
+
+void QQuickToolTipAttached::setVisible(bool visible)
+{
+ Q_D(QQuickToolTipAttached);
+ if (visible)
+ show(d->text);
+ else
+ hide();
+}
+
+/*!
+ \qmlattachedproperty ToolTip QtQuick.Controls::ToolTip::toolTip
+
+ This attached property holds the shared tool tip instance. The property
+ can be attached to any item.
+
+ \sa {Attached Tool Tips}
+*/
+QQuickToolTip *QQuickToolTipAttached::toolTip() const
+{
+ Q_D(const QQuickToolTipAttached);
+ return d->instance(true);
+}
+
+/*!
+ \qmlattachedmethod void QtQuick.Controls::ToolTip::show(string text, int timeout = -1)
+
+ This attached method shows the shared tooltip with \a text and \a timeout (milliseconds).
+ The method can be attached to any item.
+
+ \sa {Attached Tool Tips}
+*/
+void QQuickToolTipAttached::show(const QString &text, int ms)
+{
+ Q_D(QQuickToolTipAttached);
+ QQuickToolTip *tip = d->instance(true);
+ if (!tip)
+ return;
+
+ tip->resetWidth();
+ tip->resetHeight();
+ tip->setParentItem(qobject_cast<QQuickItem *>(parent()));
+ tip->setTimeout(ms >= 0 ? ms : d->timeout);
+ tip->setDelay(d->delay);
+ tip->setText(text);
+ tip->open();
+}
+
+/*!
+ \qmlattachedmethod void QtQuick.Controls::ToolTip::hide()
+
+ This attached method hides the shared tooltip. The method can be attached to any item.
+
+ \sa {Attached Tool Tips}
+*/
+void QQuickToolTipAttached::hide()
+{
+ Q_D(QQuickToolTipAttached);
+ QQuickToolTip *tip = d->instance(false);
+ if (!tip)
+ return;
+
+ tip->close();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h
new file mode 100644
index 00000000..9b628747
--- /dev/null
+++ b/src/quicktemplates2/qquicktooltip_p.h
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTOOLTIP_P_H
+#define QQUICKTOOLTIP_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickpopup_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickToolTipPrivate;
+class QQuickToolTipAttached;
+class QQuickToolTipAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolTip : public QQuickPopup
+{
+ Q_OBJECT
+ Q_PROPERTY(int delay READ delay WRITE setDelay NOTIFY delayChanged FINAL)
+ Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged FINAL)
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+
+public:
+ explicit QQuickToolTip(QQuickItem *parent = nullptr);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ int delay() const;
+ void setDelay(int delay);
+
+ int timeout() const;
+ void setTimeout(int timeout);
+
+ void setVisible(bool visible) override;
+
+ static QQuickToolTipAttached *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void textChanged();
+ void delayChanged();
+ void timeoutChanged();
+
+protected:
+ QFont defaultFont() const override;
+
+ void itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data) override;
+ void timerEvent(QTimerEvent *event) override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickToolTip)
+ Q_DECLARE_PRIVATE(QQuickToolTip)
+};
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolTipAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(int delay READ delay WRITE setDelay NOTIFY delayChanged FINAL)
+ Q_PROPERTY(int timeout READ timeout WRITE setTimeout NOTIFY timeoutChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(QQuickToolTip *toolTip READ toolTip CONSTANT FINAL)
+
+public:
+ explicit QQuickToolTipAttached(QObject *parent);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ int delay() const;
+ void setDelay(int delay);
+
+ int timeout() const;
+ void setTimeout(int timeout);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ QQuickToolTip *toolTip() const;
+
+Q_SIGNALS:
+ void textChanged();
+ void delayChanged();
+ void timeoutChanged();
+ void visibleChanged();
+
+public Q_SLOTS:
+ void show(const QString &text, int ms = -1);
+ void hide();
+
+private:
+ Q_DISABLE_COPY(QQuickToolTipAttached)
+ Q_DECLARE_PRIVATE(QQuickToolTipAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickToolTip)
+QML_DECLARE_TYPEINFO(QQuickToolTip, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKTOOLTIP_P_H
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
new file mode 100644
index 00000000..9f19f661
--- /dev/null
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -0,0 +1,603 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktumbler_p.h"
+
+#include <QtQuick/private/qquickflickable_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Tumbler
+ \inherits Control
+ \instantiates QQuickTumbler
+ \inqmlmodule QtQuick.Controls
+ \since 5.7
+ \ingroup qtquickcontrols2-input
+ \brief Spinnable wheel of items that can be selected.
+
+ \image qtquickcontrols2-tumbler-wrap.gif
+
+ \code
+ Tumbler {
+ model: 5
+ // ...
+ }
+ \endcode
+
+ \section1 Non-wrapping Tumbler
+
+ The default contentItem of Tumbler is a \l PathView, which wraps when it
+ reaches the top and bottom. To achieve a non-wrapping Tumbler, use ListView
+ as the contentItem:
+
+ \snippet tst_tumbler.qml contentItem
+
+ \sa {Customizing Tumbler}, {Input Controls}
+*/
+
+class QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickTumbler)
+
+public:
+ QQuickTumblerPrivate() :
+ delegate(nullptr),
+ visibleItemCount(3)
+ {
+ }
+
+ ~QQuickTumblerPrivate()
+ {
+ }
+
+ QVariant model;
+ QQmlComponent *delegate;
+ int visibleItemCount;
+
+ void _q_updateItemHeights();
+ void _q_updateItemWidths();
+
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
+};
+
+static QList<QQuickItem *> contentItemChildItems(QQuickItem *contentItem)
+{
+ if (!contentItem)
+ return QList<QQuickItem *>();
+
+ // PathView has no contentItem property, but ListView does.
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(contentItem);
+ return flickable ? flickable->contentItem()->childItems() : contentItem->childItems();
+}
+
+namespace {
+ static inline qreal delegateHeight(const QQuickTumbler *tumbler)
+ {
+ return tumbler->availableHeight() / tumbler->visibleItemCount();
+ }
+
+ enum ContentItemType {
+ UnsupportedContentItemType,
+ PathViewContentItem,
+ ListViewContentItem
+ };
+
+ static inline QQuickItem *actualContentItem(QQuickItem *rootContentItem, ContentItemType contentType)
+ {
+ if (contentType == PathViewContentItem)
+ return rootContentItem;
+ else if (contentType == ListViewContentItem)
+ return qobject_cast<QQuickFlickable*>(rootContentItem)->contentItem();
+
+ return nullptr;
+ }
+
+ static inline ContentItemType contentItemType(QQuickItem *rootContentItem)
+ {
+ if (rootContentItem->inherits("QQuickPathView"))
+ return PathViewContentItem;
+ else if (rootContentItem->inherits("QQuickListView"))
+ return ListViewContentItem;
+
+ return UnsupportedContentItemType;
+ }
+
+ static inline ContentItemType contentItemTypeFromDelegate(QQuickItem *delegateItem)
+ {
+ if (delegateItem->parentItem()->inherits("QQuickPathView")) {
+ return PathViewContentItem;
+ } else if (delegateItem->parentItem()->parentItem()
+ && delegateItem->parentItem()->parentItem()->inherits("QQuickListView")) {
+ return ListViewContentItem;
+ }
+
+ return UnsupportedContentItemType;
+ }
+}
+
+void QQuickTumblerPrivate::_q_updateItemHeights()
+{
+ // Can't use our own private padding members here, as the padding property might be set,
+ // which doesn't affect them, only their getters.
+ Q_Q(const QQuickTumbler);
+ const qreal itemHeight = delegateHeight(q);
+ const auto items = contentItemChildItems(contentItem);
+ for (QQuickItem *childItem : items)
+ childItem->setHeight(itemHeight);
+}
+
+void QQuickTumblerPrivate::_q_updateItemWidths()
+{
+ Q_Q(const QQuickTumbler);
+ const qreal availableWidth = q->availableWidth();
+ const auto items = contentItemChildItems(contentItem);
+ for (QQuickItem *childItem : items)
+ childItem->setWidth(availableWidth);
+}
+
+void QQuickTumblerPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
+{
+ _q_updateItemWidths();
+ _q_updateItemHeights();
+}
+
+void QQuickTumblerPrivate::itemChildRemoved(QQuickItem *, QQuickItem *)
+{
+ _q_updateItemWidths();
+ _q_updateItemHeights();
+}
+
+QQuickTumbler::QQuickTumbler(QQuickItem *parent) :
+ QQuickControl(*(new QQuickTumblerPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+
+ connect(this, SIGNAL(leftPaddingChanged()), this, SLOT(_q_updateItemWidths()));
+ connect(this, SIGNAL(rightPaddingChanged()), this, SLOT(_q_updateItemWidths()));
+ connect(this, SIGNAL(topPaddingChanged()), this, SLOT(_q_updateItemHeights()));
+ connect(this, SIGNAL(bottomPaddingChanged()), this, SLOT(_q_updateItemHeights()));
+}
+
+QQuickTumbler::~QQuickTumbler()
+{
+}
+
+/*!
+ \qmlproperty variant QtQuick.Controls::Tumbler::model
+
+ This property holds the model that provides data for this tumbler.
+*/
+QVariant QQuickTumbler::model() const
+{
+ Q_D(const QQuickTumbler);
+ return d->model;
+}
+
+void QQuickTumbler::setModel(const QVariant &model)
+{
+ Q_D(QQuickTumbler);
+ if (model == d->model)
+ return;
+
+ d->model = model;
+ emit modelChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::Tumbler::count
+ \readonly
+
+ This property holds the number of items in the model.
+*/
+int QQuickTumbler::count() const
+{
+ Q_D(const QQuickTumbler);
+ return d->contentItem->property("count").toInt();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::Tumbler::currentIndex
+
+ This property holds the index of the current item.
+*/
+int QQuickTumbler::currentIndex() const
+{
+ Q_D(const QQuickTumbler);
+ return d->contentItem ? d->contentItem->property("currentIndex").toInt() : -1;
+}
+
+void QQuickTumbler::setCurrentIndex(int currentIndex)
+{
+ Q_D(QQuickTumbler);
+ d->contentItem->setProperty("currentIndex", currentIndex);
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Tumbler::currentItem
+ \readonly
+
+ This property holds the item at the current index.
+*/
+QQuickItem *QQuickTumbler::currentItem() const
+{
+ Q_D(const QQuickTumbler);
+ return d->contentItem ? d->contentItem->property("currentItem").value<QQuickItem*>() : nullptr;
+}
+
+/*!
+ \qmlproperty Component QtQuick.Controls::Tumbler::delegate
+
+ This property holds the delegate used to display each item.
+*/
+QQmlComponent *QQuickTumbler::delegate() const
+{
+ Q_D(const QQuickTumbler);
+ return d->delegate;
+}
+
+void QQuickTumbler::setDelegate(QQmlComponent *delegate)
+{
+ Q_D(QQuickTumbler);
+ if (delegate == d->delegate)
+ return;
+
+ d->delegate = delegate;
+ emit delegateChanged();
+}
+
+/*!
+ \qmlproperty int QtQuick.Controls::Tumbler::visibleItemCount
+
+ This property holds the number of items visible in the tumbler. It must be
+ an odd number, as the current item is always vertically centered.
+*/
+int QQuickTumbler::visibleItemCount() const
+{
+ Q_D(const QQuickTumbler);
+ return d->visibleItemCount;
+}
+
+void QQuickTumbler::setVisibleItemCount(int visibleItemCount)
+{
+ Q_D(QQuickTumbler);
+ if (visibleItemCount == d->visibleItemCount)
+ return;
+
+ d->visibleItemCount = visibleItemCount;
+ d->_q_updateItemHeights();
+ emit visibleItemCountChanged();
+}
+
+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 nullptr;
+ }
+
+ return new QQuickTumblerAttached(delegateItem);
+}
+
+void QQuickTumbler::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickTumbler);
+
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+
+ d->_q_updateItemHeights();
+
+ if (newGeometry.width() != oldGeometry.width())
+ d->_q_updateItemWidths();
+}
+
+void QQuickTumbler::componentComplete()
+{
+ Q_D(QQuickTumbler);
+ QQuickControl::componentComplete();
+ d->_q_updateItemHeights();
+ d->_q_updateItemWidths();
+}
+
+void QQuickTumbler::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_D(QQuickTumbler);
+
+ QQuickControl::contentItemChange(newItem, oldItem);
+
+ // Since we use the currentIndex of the contentItem directly, we must
+ // ensure that we keep track of the currentIndex so it doesn't get lost
+ // between contentItem changes.
+ const int previousCurrentIndex = currentIndex();
+
+ if (oldItem) {
+ disconnect(oldItem, SIGNAL(currentIndexChanged()), this, SIGNAL(currentIndexChanged()));
+ disconnect(oldItem, SIGNAL(currentItemChanged()), this, SIGNAL(currentItemChanged()));
+ disconnect(oldItem, SIGNAL(countChanged()), this, SIGNAL(countChanged()));
+
+ ContentItemType oldContentItemType = contentItemType(oldItem);
+ QQuickItem *actualOldContentItem = actualContentItem(oldItem, oldContentItemType);
+ QQuickItemPrivate *actualContentItemPrivate = QQuickItemPrivate::get(actualOldContentItem);
+ actualContentItemPrivate->removeItemChangeListener(d, QQuickItemPrivate::Children);
+ }
+
+ if (newItem) {
+ ContentItemType contentType = contentItemType(newItem);
+ if (contentType == UnsupportedContentItemType) {
+ qWarning() << "Tumbler: contentItems other than PathView and ListView are not supported";
+ return;
+ }
+
+ connect(newItem, SIGNAL(currentIndexChanged()), this, SIGNAL(currentIndexChanged()));
+ connect(newItem, SIGNAL(currentItemChanged()), this, SIGNAL(currentItemChanged()));
+ connect(newItem, SIGNAL(countChanged()), this, SIGNAL(countChanged()));
+
+ QQuickItem *actualNewContentItem = actualContentItem(newItem, contentType);
+ QQuickItemPrivate *actualContentItemPrivate = QQuickItemPrivate::get(actualNewContentItem);
+ actualContentItemPrivate->addItemChangeListener(d, QQuickItemPrivate::Children);
+
+ // If the previous currentIndex is -1, it means we had no contentItem previously.
+ if (previousCurrentIndex != -1) {
+ // Can't call setCurrentIndex here, as contentItemChange() is
+ // called *before* the contentItem is set.
+ newItem->setProperty("currentIndex", previousCurrentIndex);
+ }
+ }
+}
+
+void QQuickTumbler::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickTumbler);
+
+ QQuickControl::keyPressEvent(event);
+
+ if (event->isAutoRepeat())
+ return;
+
+ if (event->key() == Qt::Key_Up) {
+ QMetaObject::invokeMethod(d->contentItem, "decrementCurrentIndex");
+ } else if (event->key() == Qt::Key_Down) {
+ QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex");
+ }
+}
+
+class QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickTumblerAttached)
+public:
+ QQuickTumblerAttachedPrivate(QQuickItem *delegateItem) :
+ tumbler(nullptr),
+ index(-1),
+ displacement(0)
+ {
+ if (!delegateItem->parentItem()) {
+ qWarning() << "Tumbler: attached properties must be accessed from within a delegate item that has a parent";
+ return;
+ }
+
+ QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
+ if (!indexContextProperty.isValid()) {
+ qWarning() << "Tumbler: attempting to access attached property on item without an \"index\" property";
+ return;
+ }
+
+ index = indexContextProperty.toInt();
+ const ContentItemType contentItemType = contentItemTypeFromDelegate(delegateItem);
+ if (contentItemType == UnsupportedContentItemType)
+ return;
+
+ // ListView has an "additional" content item.
+ tumbler = qobject_cast<QQuickTumbler* >(contentItemType == PathViewContentItem
+ ? delegateItem->parentItem()->parentItem() : delegateItem->parentItem()->parentItem()->parentItem());
+ Q_ASSERT(tumbler);
+ }
+
+ ~QQuickTumblerAttachedPrivate() {
+ }
+
+ void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
+
+ void _q_calculateDisplacement();
+ void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
+
+ // The Tumbler that contains the delegate. Required to calculated the displacement.
+ QPointer<QQuickTumbler> tumbler;
+ // The index of the delegate. Used to calculate the displacement.
+ int index;
+ // The displacement for our delegate.
+ qreal displacement;
+};
+
+void QQuickTumblerAttachedPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+{
+ _q_calculateDisplacement();
+}
+
+void QQuickTumblerAttachedPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
+{
+ _q_calculateDisplacement();
+}
+
+void QQuickTumblerAttachedPrivate::itemChildRemoved(QQuickItem *item, QQuickItem *child)
+{
+ _q_calculateDisplacement();
+
+ if (parent == child) {
+ // The child that was removed from the contentItem was the delegate
+ // that our properties are attached to. If we don't remove the change
+ // listener, the contentItem will attempt to notify a destroyed
+ // listener, causing a crash.
+
+ // item is the "actual content item" of Tumbler's contentItem, i.e. a PathView or ListView.contentItem
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ p->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
+ }
+}
+
+void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
+{
+ const int previousDisplacement = displacement;
+ displacement = 0;
+
+ if (!tumbler) {
+ emitIfDisplacementChanged(previousDisplacement, displacement);
+ return;
+ }
+
+ const int count = tumbler->count();
+ // This can happen in tests, so it may happen in normal usage too.
+ if (count == 0) {
+ emitIfDisplacementChanged(previousDisplacement, displacement);
+ return;
+ }
+
+ ContentItemType contentType = contentItemType(tumbler->contentItem());
+ if (contentType == UnsupportedContentItemType) {
+ emitIfDisplacementChanged(previousDisplacement, displacement);
+ return;
+ }
+
+ qreal offset = 0;
+
+ if (contentType == PathViewContentItem) {
+ offset = tumbler->contentItem()->property("offset").toReal();
+
+ displacement = count > 1 ? count - index - offset : 0;
+ // Don't add 1 if count <= visibleItemCount
+ const int visibleItems = tumbler->visibleItemCount();
+ int halfVisibleItems = visibleItems / 2 + (visibleItems < count ? 1 : 0);
+ if (displacement > halfVisibleItems)
+ displacement -= count;
+ else if (displacement < -halfVisibleItems)
+ displacement += count;
+ } else {
+ const qreal contentY = tumbler->contentItem()->property("contentY").toReal();
+ const qreal delegateH = delegateHeight(tumbler);
+ const qreal preferredHighlightBegin = tumbler->contentItem()->property("preferredHighlightBegin").toReal();
+ // Tumbler's displacement goes from negative at the top to positive towards the bottom, so we must switch this around.
+ const qreal reverseDisplacement = (contentY + preferredHighlightBegin) / delegateH;
+ displacement = reverseDisplacement - index;
+ }
+
+ emitIfDisplacementChanged(previousDisplacement, displacement);
+}
+
+void QQuickTumblerAttachedPrivate::emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement)
+{
+ Q_Q(QQuickTumblerAttached);
+ if (newDisplacement != oldDisplacement)
+ emit q->displacementChanged();
+}
+
+QQuickTumblerAttached::QQuickTumblerAttached(QQuickItem *delegateItem) :
+ QObject(*(new QQuickTumblerAttachedPrivate(delegateItem)), delegateItem)
+{
+ Q_D(QQuickTumblerAttached);
+ if (d->tumbler) {
+ QQuickItem *rootContentItem = d->tumbler->contentItem();
+ const ContentItemType contentType = contentItemType(rootContentItem);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(actualContentItem(rootContentItem, contentType));
+ p->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
+
+ const char *contentItemSignal = contentType == PathViewContentItem
+ ? SIGNAL(offsetChanged()) : SIGNAL(contentYChanged());
+ connect(d->tumbler->contentItem(), contentItemSignal, this, SLOT(_q_calculateDisplacement()));
+
+ d->_q_calculateDisplacement();
+ }
+}
+
+QQuickTumblerAttached::~QQuickTumblerAttached()
+{
+ Q_D(QQuickTumblerAttached);
+ if (!d->tumbler || !d->tumbler->contentItem())
+ return;
+
+ QQuickItem *rootContentItem = d->tumbler->contentItem();
+ const ContentItemType contentType = contentItemType(rootContentItem);
+ QQuickItem *actualItem = actualContentItem(rootContentItem, contentType);
+ if (!actualItem)
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(actualItem);
+ p->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
+}
+
+/*!
+ \qmlattachedproperty Tumbler QtQuick.Controls::Tumbler::tumbler
+ \readonly
+
+ This attached property holds the tumbler. The property can be attached to
+ a tumbler delegate. The value is \c null if the item is not a tumbler delegate.
+*/
+QQuickTumbler *QQuickTumblerAttached::tumbler() const
+{
+ Q_D(const QQuickTumblerAttached);
+ return d->tumbler;
+}
+
+/*!
+ \qmlattachedproperty real QtQuick.Controls::Tumbler::displacement
+ \readonly
+
+ This attached property holds a value from \c {-visibleItemCount / 2} to
+ \c {visibleItemCount / 2}, which represents how far away this item is from
+ being the current item, with \c 0 being completely current.
+
+ For example, the item below will be 40% opaque when it is not the current item,
+ and transition to 100% opacity when it becomes the current item:
+
+ \code
+ delegate: Text {
+ text: modelData
+ opacity: 0.4 + Math.max(0, 1 - Math.abs(Tumbler.displacement)) * 0.6
+ }
+ \endcode
+*/
+qreal QQuickTumblerAttached::displacement() const
+{
+ Q_D(const QQuickTumblerAttached);
+ return d->displacement;
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qquicktumbler_p.cpp"
diff --git a/src/quicktemplates2/qquicktumbler_p.h b/src/quicktemplates2/qquicktumbler_p.h
new file mode 100644
index 00000000..e28102e4
--- /dev/null
+++ b/src/quicktemplates2/qquicktumbler_p.h
@@ -0,0 +1,143 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKTUMBLER_P_H
+#define QQUICKTUMBLER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qvariant.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTumblerAttached;
+class QQuickTumblerPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumbler : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
+ Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+ Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
+ Q_PROPERTY(int visibleItemCount READ visibleItemCount WRITE setVisibleItemCount NOTIFY visibleItemCountChanged FINAL)
+
+public:
+ explicit QQuickTumbler(QQuickItem *parent = nullptr);
+ ~QQuickTumbler();
+
+ QVariant model() const;
+ void setModel(const QVariant &model);
+
+ int count() const;
+
+ int currentIndex() const;
+ void setCurrentIndex(int currentIndex);
+ QQuickItem *currentItem() const;
+
+ QQmlComponent *delegate() const;
+ void setDelegate(QQmlComponent *delegate);
+
+ int visibleItemCount() const;
+ void setVisibleItemCount(int visibleItemCount);
+
+ static QQuickTumblerAttached *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void modelChanged();
+ void countChanged();
+ void currentIndexChanged();
+ void currentItemChanged();
+ void delegateChanged();
+ void visibleItemCountChanged();
+
+protected:
+ 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)
+ Q_DECLARE_PRIVATE(QQuickTumbler)
+
+ Q_PRIVATE_SLOT(d_func(), void _q_updateItemWidths())
+ Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
+};
+
+class QQuickTumblerAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickTumbler *tumbler READ tumbler CONSTANT)
+ Q_PROPERTY(qreal displacement READ displacement NOTIFY displacementChanged FINAL)
+
+public:
+ explicit QQuickTumblerAttached(QQuickItem *delegateItem);
+ ~QQuickTumblerAttached();
+
+ QQuickTumbler *tumbler() const;
+ qreal displacement() const;
+
+Q_SIGNALS:
+ void displacementChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickTumblerAttached)
+ Q_DECLARE_PRIVATE(QQuickTumblerAttached)
+
+ Q_PRIVATE_SLOT(d_func(), void _q_calculateDisplacement())
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickTumbler)
+QML_DECLARE_TYPEINFO(QQuickTumbler, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKTUMBLER_P_H
diff --git a/src/quicktemplates2/qquickvelocitycalculator.cpp b/src/quicktemplates2/qquickvelocitycalculator.cpp
new file mode 100644
index 00000000..be3b2fef
--- /dev/null
+++ b/src/quicktemplates2/qquickvelocitycalculator.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickvelocitycalculator_p_p.h"
+
+#include <QtCore/qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+/*
+ Usage:
+
+ QQuickVelocityCalculator velocityCalculator;
+
+ // ...
+
+ velocityCalcular.startMeasuring(event->pos(), event->timestamp());
+ velocityCalcular.stopMeasuring(event->pos(), event->timestamp());
+
+ // ...
+
+ if (velocityCalculator.velocity().x() > someAmount)
+ doSomething();
+ else if (velocityCalculator.velocity().x() < -someAmount)
+ doSomethingElse();
+*/
+
+QQuickVelocityCalculator::QQuickVelocityCalculator() :
+ m_point1Timestamp(0),
+ m_point2Timestamp(0)
+{
+}
+
+void QQuickVelocityCalculator::startMeasuring(const QPointF &point1, qint64 timestamp)
+{
+ m_point1 = point1;
+
+ if (timestamp != 0)
+ m_point1Timestamp = timestamp;
+ else
+ m_timer.start();
+}
+
+void QQuickVelocityCalculator::stopMeasuring(const QPointF &point2, qint64 timestamp)
+{
+ if (timestamp == 0 && !m_timer.isValid()) {
+ qWarning() << "QQuickVelocityCalculator: a call to stopMeasuring() must be preceded by a call to startMeasuring()";
+ return;
+ }
+
+ m_point2 = point2;
+ m_point2Timestamp = timestamp != 0 ? timestamp : m_timer.elapsed();
+ m_timer.invalidate();
+}
+
+void QQuickVelocityCalculator::reset()
+{
+ m_point1 = QPointF();
+ m_point2 = QPointF();
+ m_point1Timestamp = 0;
+ m_point2Timestamp = 0;
+ m_timer.invalidate();
+}
+
+QPointF QQuickVelocityCalculator::velocity() const
+{
+ if ((m_point2Timestamp == 0 || m_point1Timestamp == m_point2Timestamp) && !m_timer.isValid())
+ return QPointF();
+
+ const qreal secondsElapsed = (m_point2Timestamp != 0 ? m_point2Timestamp - m_point1Timestamp : m_timer.elapsed()) / 1000.0;
+ const QPointF distance = m_point2 - m_point1;
+ return distance / secondsElapsed;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickvelocitycalculator_p_p.h b/src/quicktemplates2/qquickvelocitycalculator_p_p.h
new file mode 100644
index 00000000..c89fc10e
--- /dev/null
+++ b/src/quicktemplates2/qquickvelocitycalculator_p_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKVELOCITYCALCULATOR_P_P_H
+#define QQUICKVELOCITYCALCULATOR_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qpoint.h>
+#include <QtCore/qelapsedtimer.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickVelocityCalculator
+{
+public:
+ QQuickVelocityCalculator();
+
+ void startMeasuring(const QPointF &point1, qint64 timestamp = 0);
+ void stopMeasuring(const QPointF &m_point2, qint64 timestamp = 0);
+ void reset();
+ QPointF velocity() const;
+
+private:
+ QPointF m_point1;
+ QPointF m_point2;
+ qint64 m_point1Timestamp;
+ qint64 m_point2Timestamp;
+ // When a timestamp isn't available, we must use a timer.
+ // When stopMeasuring() has been called, we store the elapsed time in point2timestamp.
+ QElapsedTimer m_timer;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKVELOCITYCALCULATOR_P_P_H
diff --git a/src/quicktemplates2/qtquicktemplates2global_p.h b/src/quicktemplates2/qtquicktemplates2global_p.h
new file mode 100644
index 00000000..50430b38
--- /dev/null
+++ b/src/quicktemplates2/qtquicktemplates2global_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTQUICKTEMPLATES2GLOBAL_P_H
+#define QTQUICKTEMPLATES2GLOBAL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qglobal.h>
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_STATIC
+# if defined(QT_BUILD_QUICKTEMPLATES2_LIB)
+# define Q_QUICKTEMPLATES2_PRIVATE_EXPORT Q_DECL_EXPORT
+# else
+# define Q_QUICKTEMPLATES2_PRIVATE_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_QUICKTEMPLATES2_PRIVATE_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // QTQUICKTEMPLATES2GLOBAL_P_H
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
new file mode 100644
index 00000000..5caa1bd7
--- /dev/null
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -0,0 +1,116 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qquickabstractbutton_p.h \
+ $$PWD/qquickabstractbutton_p_p.h \
+ $$PWD/qquickapplicationwindow_p.h \
+ $$PWD/qquickbusyindicator_p.h \
+ $$PWD/qquickbutton_p.h \
+ $$PWD/qquickbuttongroup_p.h \
+ $$PWD/qquickcheckbox_p.h \
+ $$PWD/qquickcheckdelegate_p.h \
+ $$PWD/qquickcombobox_p.h \
+ $$PWD/qquickcontainer_p.h \
+ $$PWD/qquickcontainer_p_p.h \
+ $$PWD/qquickcontrol_p.h \
+ $$PWD/qquickcontrol_p_p.h \
+ $$PWD/qquickdial_p.h \
+ $$PWD/qquickdrawer_p.h \
+ $$PWD/qquickdrawer_p_p.h \
+ $$PWD/qquickframe_p.h \
+ $$PWD/qquickframe_p_p.h \
+ $$PWD/qquickgroupbox_p.h \
+ $$PWD/qquickitemdelegate_p.h \
+ $$PWD/qquickitemdelegate_p_p.h \
+ $$PWD/qquicklabel_p.h \
+ $$PWD/qquicklabel_p_p.h \
+ $$PWD/qquickmenu_p.h \
+ $$PWD/qquickmenu_p_p.h \
+ $$PWD/qquickmenuitem_p.h \
+ $$PWD/qquickoverlay_p.h \
+ $$PWD/qquickoverlay_p_p.h \
+ $$PWD/qquickpage_p.h \
+ $$PWD/qquickpageindicator_p.h \
+ $$PWD/qquickpane_p.h \
+ $$PWD/qquickpane_p_p.h \
+ $$PWD/qquickpopup_p.h \
+ $$PWD/qquickpopup_p_p.h \
+ $$PWD/qquickpresshandler_p_p.h \
+ $$PWD/qquickprogressbar_p.h \
+ $$PWD/qquickradiobutton_p.h \
+ $$PWD/qquickradiodelegate_p.h \
+ $$PWD/qquickrangeslider_p.h \
+ $$PWD/qquickscrollbar_p.h \
+ $$PWD/qquickscrollindicator_p.h \
+ $$PWD/qquickshortcutcontext_p_p.h \
+ $$PWD/qquickslider_p.h \
+ $$PWD/qquickspinbox_p.h \
+ $$PWD/qquickstackview_p.h \
+ $$PWD/qquickstackview_p_p.h \
+ $$PWD/qquickswipe_p.h \
+ $$PWD/qquickswipedelegate_p.h \
+ $$PWD/qquickswipedelegate_p_p.h \
+ $$PWD/qquickswipeview_p.h \
+ $$PWD/qquickswitch_p.h \
+ $$PWD/qquickswitchdelegate_p.h \
+ $$PWD/qquicktabbar_p.h \
+ $$PWD/qquicktabbutton_p.h \
+ $$PWD/qquicktextarea_p.h \
+ $$PWD/qquicktextarea_p_p.h \
+ $$PWD/qquicktextfield_p.h \
+ $$PWD/qquicktextfield_p_p.h \
+ $$PWD/qquicktoolbar_p.h \
+ $$PWD/qquicktoolbutton_p.h \
+ $$PWD/qquicktooltip_p.h \
+ $$PWD/qquicktumbler_p.h \
+ $$PWD/qquickvelocitycalculator_p_p.h
+
+SOURCES += \
+ $$PWD/qquickabstractbutton.cpp \
+ $$PWD/qquickapplicationwindow.cpp \
+ $$PWD/qquickbusyindicator.cpp \
+ $$PWD/qquickbutton.cpp \
+ $$PWD/qquickbuttongroup.cpp \
+ $$PWD/qquickcheckbox.cpp \
+ $$PWD/qquickcheckdelegate.cpp \
+ $$PWD/qquickcombobox.cpp \
+ $$PWD/qquickcontainer.cpp \
+ $$PWD/qquickcontrol.cpp \
+ $$PWD/qquickdial.cpp \
+ $$PWD/qquickdrawer.cpp \
+ $$PWD/qquickframe.cpp \
+ $$PWD/qquickgroupbox.cpp \
+ $$PWD/qquickitemdelegate.cpp \
+ $$PWD/qquicklabel.cpp \
+ $$PWD/qquickmenu.cpp \
+ $$PWD/qquickmenuitem.cpp \
+ $$PWD/qquickoverlay.cpp \
+ $$PWD/qquickpage.cpp \
+ $$PWD/qquickpageindicator.cpp \
+ $$PWD/qquickpane.cpp \
+ $$PWD/qquickpopup.cpp \
+ $$PWD/qquickpresshandler.cpp \
+ $$PWD/qquickprogressbar.cpp \
+ $$PWD/qquickradiobutton.cpp \
+ $$PWD/qquickradiodelegate.cpp \
+ $$PWD/qquickrangeslider.cpp \
+ $$PWD/qquickscrollbar.cpp \
+ $$PWD/qquickscrollindicator.cpp \
+ $$PWD/qquickshortcutcontext.cpp \
+ $$PWD/qquickslider.cpp \
+ $$PWD/qquickspinbox.cpp \
+ $$PWD/qquickstackview.cpp \
+ $$PWD/qquickstackview_p.cpp \
+ $$PWD/qquickswipedelegate.cpp \
+ $$PWD/qquickswipeview.cpp \
+ $$PWD/qquickswitch.cpp \
+ $$PWD/qquickswitchdelegate.cpp \
+ $$PWD/qquicktabbar.cpp \
+ $$PWD/qquicktabbutton.cpp \
+ $$PWD/qquicktextarea.cpp \
+ $$PWD/qquicktextfield.cpp \
+ $$PWD/qquicktoolbar.cpp \
+ $$PWD/qquicktoolbutton.cpp \
+ $$PWD/qquicktooltip.cpp \
+ $$PWD/qquicktumbler.cpp \
+ $$PWD/qquickvelocitycalculator.cpp
diff --git a/src/quicktemplates2/quicktemplates2.pro b/src/quicktemplates2/quicktemplates2.pro
new file mode 100644
index 00000000..59871a54
--- /dev/null
+++ b/src/quicktemplates2/quicktemplates2.pro
@@ -0,0 +1,14 @@
+TARGET = QtQuickTemplates2
+MODULE = quicktemplates2
+CONFIG += internal_module
+
+QT += quick
+QT_PRIVATE += core-private gui-private qml-private quick-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+HEADERS += \
+ $$PWD/qtquicktemplates2global_p.h
+
+include(quicktemplates2.pri)
+load(qt_module)
diff --git a/src/src.pro b/src/src.pro
index 38778fe1..7f945ffb 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,8 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += \
- templates \
- controls \
+ quicktemplates2 \
+ quickcontrols2 \
imports
-controls.depends = templates
-imports.depends = controls templates
+quickcontrols2.depends = quicktemplates2
+imports.depends = quickcontrols2 quicktemplates2
diff --git a/src/templates/qquickabstractbutton.cpp b/src/templates/qquickabstractbutton.cpp
deleted file mode 100644
index 95afc09d..00000000
--- a/src/templates/qquickabstractbutton.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickabstractbutton_p.h"
-#include "qquickabstractbutton_p_p.h"
-#include "qquickbuttongroup_p.h"
-
-#include <QtGui/qstylehints.h>
-#include <QtGui/qguiapplication.h>
-#include <QtQuick/private/qquickevents_p_p.h>
-#include <QtQml/qqmllist.h>
-
-QT_BEGIN_NAMESPACE
-
-// copied from qabstractbutton.cpp
-static const int AUTO_REPEAT_DELAY = 300;
-static const int AUTO_REPEAT_INTERVAL = 100;
-
-/*!
- \qmltype AbstractButton
- \inherits Control
- \instantiates QQuickAbstractButton
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-buttons
- \brief The base of all button controls.
-
- AbstractButton provides the interface for controls with button-like
- behavior; for example, push buttons and checkable controls like
- radio buttons and check boxes. As an abstract control, it has no delegate
- implementations, leaving them to the types that derive from it.
-
- TODO: ButtonGroup usage
-
- \labs
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::AbstractButton::pressed()
-
- This signal is emitted when the button is interactively pressed by the user.
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::AbstractButton::released()
-
- This signal is emitted when the button is interactively released by the user.
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::AbstractButton::canceled()
-
- This signal is emitted when the button loses mouse grab
- while being pressed, or when it would emit the \l released
- signal but the mouse cursor is not inside the button.
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::AbstractButton::clicked()
-
- This signal is emitted when the button is interactively clicked by the user.
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::AbstractButton::pressAndHold()
-
- This signal is emitted when the button is interactively perssed and held down by the user.
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::AbstractButton::doubleClicked()
-
- This signal is emitted when the button is interactively double clicked by the user.
-*/
-
-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)
-{
-}
-
-bool QQuickAbstractButtonPrivate::isPressAndHoldConnected()
-{
- Q_Q(QQuickAbstractButton);
- IS_SIGNAL_CONNECTED(q, QQuickAbstractButton, pressAndHold, ());
-}
-
-void QQuickAbstractButtonPrivate::startPressAndHold()
-{
- Q_Q(QQuickAbstractButton);
- wasHeld = false;
- stopPressAndHold();
- if (isPressAndHoldConnected())
- holdTimer = q->startTimer(QGuiApplication::styleHints()->mousePressAndHoldInterval());
-}
-
-void QQuickAbstractButtonPrivate::stopPressAndHold()
-{
- Q_Q(QQuickAbstractButton);
- if (holdTimer > 0) {
- q->killTimer(holdTimer);
- holdTimer = 0;
- }
-}
-
-void QQuickAbstractButtonPrivate::startRepeatDelay()
-{
- Q_Q(QQuickAbstractButton);
- stopPressRepeat();
- delayTimer = q->startTimer(AUTO_REPEAT_DELAY);
-}
-
-void QQuickAbstractButtonPrivate::startPressRepeat()
-{
- Q_Q(QQuickAbstractButton);
- stopPressRepeat();
- repeatTimer = q->startTimer(AUTO_REPEAT_INTERVAL);
-}
-
-void QQuickAbstractButtonPrivate::stopPressRepeat()
-{
- Q_Q(QQuickAbstractButton);
- if (delayTimer > 0) {
- q->killTimer(delayTimer);
- delayTimer = 0;
- }
- if (repeatTimer > 0) {
- q->killTimer(repeatTimer);
- repeatTimer = 0;
- }
-}
-
-QQuickAbstractButton *QQuickAbstractButtonPrivate::findCheckedButton() const
-{
- Q_Q(const QQuickAbstractButton);
- if (group)
- return qobject_cast<QQuickAbstractButton *>(group->checkedButton());
-
- 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
- // that QQuickRadioButton adopted. Uncommenting the following count check
- // gives the QRadioButton behavior. Notice that tst_radiobutton.qml needs
- // to be updated.
- if (!autoExclusive /*|| buttons.count() == 1*/)
- return Q_NULLPTR;
-
- foreach (QQuickAbstractButton *button, buttons) {
- if (button->isChecked() && button != q)
- return button;
- }
- return checked ? const_cast<QQuickAbstractButton *>(q) : Q_NULLPTR;
-}
-
-QList<QQuickAbstractButton *> QQuickAbstractButtonPrivate::findExclusiveButtons() const
-{
- QList<QQuickAbstractButton *> buttons;
- if (group) {
- QQmlListProperty<QQuickAbstractButton> groupButtons = group->buttons();
- int count = groupButtons.count(&groupButtons);
- for (int i = 0; i < count; ++i) {
- QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(groupButtons.at(&groupButtons, i));
- if (button)
- buttons += button;
- }
- } else if (parentItem) {
- foreach (QQuickItem *child, parentItem->childItems()) {
- QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(child);
- if (button && button->autoExclusive() && !QQuickAbstractButtonPrivate::get(button)->group)
- buttons += button;
- }
- }
- return buttons;
-}
-
-QQuickAbstractButton::QQuickAbstractButton(QQuickItem *parent) :
- QQuickControl(*(new QQuickAbstractButtonPrivate), parent)
-{
- setActiveFocusOnTab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-QQuickAbstractButton::QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent) :
- QQuickControl(dd, parent)
-{
- setActiveFocusOnTab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-QQuickAbstractButton::~QQuickAbstractButton()
-{
- Q_D(QQuickAbstractButton);
- if (d->group)
- d->group->removeButton(this);
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::AbstractButton::text
-
- 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.
-
- \sa label
-*/
-QString QQuickAbstractButton::text() const
-{
- Q_D(const QQuickAbstractButton);
- return d->text;
-}
-
-void QQuickAbstractButton::setText(const QString &text)
-{
- Q_D(QQuickAbstractButton);
- if (d->text != text) {
- d->text = text;
- setAccessibleName(text);
- emit textChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::AbstractButton::pressed
-
- This property holds whether the button is pressed.
-*/
-bool QQuickAbstractButton::isPressed() const
-{
- Q_D(const QQuickAbstractButton);
- return d->pressed;
-}
-
-void QQuickAbstractButton::setPressed(bool isPressed)
-{
- Q_D(QQuickAbstractButton);
- if (d->pressed != isPressed) {
- d->pressed = isPressed;
- setAccessibleProperty("pressed", isPressed);
- emit pressedChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::AbstractButton::checked
-
- This property holds whether the button is checked.
-*/
-bool QQuickAbstractButton::isChecked() const
-{
- Q_D(const QQuickAbstractButton);
- return d->checked;
-}
-
-void QQuickAbstractButton::setChecked(bool checked)
-{
- Q_D(QQuickAbstractButton);
- if (checked && !d->checkable)
- setCheckable(true);
-
- if (d->checked != checked) {
- d->checked = checked;
- setAccessibleProperty("checked", checked);
- checkStateSet();
- emit checkedChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::AbstractButton::checkable
-
- This property holds whether the button is checkable.
-*/
-bool QQuickAbstractButton::isCheckable() const
-{
- Q_D(const QQuickAbstractButton);
- return d->checkable;
-}
-
-void QQuickAbstractButton::setCheckable(bool checkable)
-{
- Q_D(QQuickAbstractButton);
- if (d->checkable != checkable) {
- d->checkable = checkable;
- setAccessibleProperty("checkable", checkable);
- emit checkableChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::AbstractButton::highlighted
-
- This property holds whether the button is highlighted.
-
- A button can be highlighted in order to draw the user's attention towards
- it. It has no effect on keyboard interaction.
-
- The default value is \c false.
-*/
-bool QQuickAbstractButton::isHighlighted() const
-{
- Q_D(const QQuickAbstractButton);
- return d->highlighted;
-}
-
-void QQuickAbstractButton::setHighlighted(bool highlighted)
-{
- Q_D(QQuickAbstractButton);
- if (highlighted != d->highlighted) {
- d->highlighted = highlighted;
- emit highlightedChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::AbstractButton::autoExclusive
-
- This property holds whether auto-exclusivity is enabled.
-
- If auto-exclusivity is enabled, checkable buttons that belong to the same
- parent item behave as if they were part of the same ButtonGroup. Only
- one button can be checked at any time; checking another button automatically
- unchecks the previously checked one.
-
- \note The property has no effect on buttons that belong to an ButtonGroup.
-
- RadioButton and TabButton are auto-exclusive by default.
-*/
-bool QQuickAbstractButton::autoExclusive() const
-{
- Q_D(const QQuickAbstractButton);
- return d->autoExclusive;
-}
-
-void QQuickAbstractButton::setAutoExclusive(bool exclusive)
-{
- Q_D(QQuickAbstractButton);
- if (d->autoExclusive != exclusive) {
- d->autoExclusive = exclusive;
- emit autoExclusiveChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::AbstractButton::autoRepeat
-
- This property holds whether the button repeats pressed(), released()
- and clicked() signals while the button is pressed and held down.
-
- The default value is \c false.
-*/
-bool QQuickAbstractButton::autoRepeat() const
-{
- Q_D(const QQuickAbstractButton);
- return d->autoRepeat;
-}
-
-void QQuickAbstractButton::setAutoRepeat(bool repeat)
-{
- Q_D(QQuickAbstractButton);
- if (d->autoRepeat != repeat) {
- d->stopPressRepeat();
- d->autoRepeat = repeat;
- emit autoRepeatChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::AbstractButton::indicator
-
- This property holds the indicator item.
-*/
-QQuickItem *QQuickAbstractButton::indicator() const
-{
- Q_D(const QQuickAbstractButton);
- return d->indicator;
-}
-
-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();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Button::toggle()
-
- Toggles the checked state of the button.
-*/
-void QQuickAbstractButton::toggle()
-{
- Q_D(QQuickAbstractButton);
- setChecked(!d->checked);
-}
-
-void QQuickAbstractButton::focusOutEvent(QFocusEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::focusOutEvent(event);
- if (d->pressed) {
- setPressed(false);
- emit canceled();
- }
-}
-
-void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::keyPressEvent(event);
- if (event->key() == Qt::Key_Space) {
- setPressed(true);
- d->pressPoint = QPoint(qRound(width() / 2), qRound(height() / 2));
-
- if (d->autoRepeat) {
- d->startRepeatDelay();
- d->repeatButton = Qt::NoButton;
- }
-
- emit pressed();
- }
-}
-
-void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::keyReleaseEvent(event);
- if (event->key() == Qt::Key_Space) {
- setPressed(false);
-
- emit released();
- emit clicked();
- nextCheckState();
-
- if (d->autoRepeat)
- d->stopPressRepeat();
- }
-}
-
-void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::mousePressEvent(event);
- setPressed(true);
- d->pressPoint = event->pos();
-
- emit pressed();
-
- if (d->autoRepeat) {
- d->startRepeatDelay();
- d->repeatButton = event->button();
- } else if (Qt::LeftButton == (event->buttons() & Qt::LeftButton)) {
- d->startPressAndHold();
- } else {
- d->stopPressAndHold();
- }
-}
-
-void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::mouseMoveEvent(event);
- setPressed(contains(event->pos()));
-
- if (d->autoRepeat)
- d->stopPressRepeat();
- else if (d->holdTimer > 0 && QLineF(d->pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance())
- d->stopPressAndHold();
-}
-
-void QQuickAbstractButton::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::mouseReleaseEvent(event);
- bool wasPressed = d->pressed;
- setPressed(false);
-
- if (wasPressed) {
- emit released();
- if (!d->wasHeld)
- emit clicked();
- } else {
- emit canceled();
- }
-
- if (contains(event->pos()))
- nextCheckState();
-
- if (d->autoRepeat)
- d->stopPressRepeat();
- else
- d->stopPressAndHold();
-}
-
-void QQuickAbstractButton::mouseDoubleClickEvent(QMouseEvent *event)
-{
- QQuickControl::mouseDoubleClickEvent(event);
- emit doubleClicked();
-}
-
-void QQuickAbstractButton::mouseUngrabEvent()
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::mouseUngrabEvent();
- if (d->pressed) {
- setPressed(false);
- d->stopPressRepeat();
- d->stopPressAndHold();
- emit canceled();
- }
-}
-
-void QQuickAbstractButton::timerEvent(QTimerEvent *event)
-{
- Q_D(QQuickAbstractButton);
- QQuickControl::timerEvent(event);
- if (event->timerId() == d->holdTimer) {
- d->stopPressAndHold();
- d->wasHeld = true;
- emit pressAndHold();
- } else if (event->timerId() == d->delayTimer) {
- d->startPressRepeat();
- } else if (event->timerId() == d->repeatTimer) {
- emit released();
- emit clicked();
- emit pressed();
- }
-}
-
-void QQuickAbstractButton::checkStateSet()
-{
- Q_D(QQuickAbstractButton);
- if (d->checked) {
- QQuickAbstractButton *button = d->findCheckedButton();
- if (button && button != this)
- button->setChecked(false);
- }
-}
-
-void QQuickAbstractButton::nextCheckState()
-{
- Q_D(QQuickAbstractButton);
- if (d->checkable && (!d->checked || d->findCheckedButton() != this))
- setChecked(!d->checked);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickAbstractButton::accessibilityActiveChanged(bool active)
-{
- QQuickControl::accessibilityActiveChanged(active);
-
- Q_D(QQuickAbstractButton);
- if (active) {
- setAccessibleName(d->text);
- setAccessibleProperty("pressed", d->pressed);
- setAccessibleProperty("checked", d->checked);
- setAccessibleProperty("checkable", d->checkable);
- }
-}
-
-QAccessible::Role QQuickAbstractButton::accessibleRole() const
-{
- return QAccessible::Button;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickabstractbutton_p.h b/src/templates/qquickabstractbutton_p.h
deleted file mode 100644
index f3020bc3..00000000
--- a/src/templates/qquickabstractbutton_p.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTBUTTON_P_H
-#define QQUICKABSTRACTBUTTON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractButtonPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickAbstractButton : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
- Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
- Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
- Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
- Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
- 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);
- ~QQuickAbstractButton();
-
- QString text() const;
- void setText(const QString &text);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- bool isChecked() const;
- void setChecked(bool checked);
-
- bool isCheckable() const;
- void setCheckable(bool checkable);
-
- bool isHighlighted() const;
- void setHighlighted(bool highlighted);
-
- bool autoExclusive() const;
- void setAutoExclusive(bool exclusive);
-
- bool autoRepeat() const;
- void setAutoRepeat(bool repeat);
-
- QQuickItem *indicator() const;
- void setIndicator(QQuickItem *indicator);
-
- QQuickItem *label() const;
- void setLabel(QQuickItem *label);
-
-public Q_SLOTS:
- void toggle();
-
-Q_SIGNALS:
- void pressed();
- void released();
- void canceled();
- void clicked();
- void pressAndHold();
- void doubleClicked();
- void textChanged();
- void pressedChanged();
- void checkedChanged();
- void checkableChanged();
- void highlightedChanged();
- 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;
-
- virtual void checkStateSet();
- virtual void nextCheckState();
-
-#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickAbstractButton)
- Q_DECLARE_PRIVATE(QQuickAbstractButton)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickAbstractButton)
-
-#endif // QQUICKABSTRACTBUTTON_P_H
diff --git a/src/templates/qquickabstractbutton_p_p.h b/src/templates/qquickabstractbutton_p_p.h
deleted file mode 100644
index cdc77f19..00000000
--- a/src/templates/qquickabstractbutton_p_p.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKABSTRACTBUTTON_P_P_H
-#define QQUICKABSTRACTBUTTON_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickButtonGroup;
-
-class QQuickAbstractButtonPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickAbstractButton)
-
-public:
- QQuickAbstractButtonPrivate();
-
- static QQuickAbstractButtonPrivate *get(QQuickAbstractButton *button)
- {
- return button->d_func();
- }
-
- bool isPressAndHoldConnected();
- void startPressAndHold();
- void stopPressAndHold();
-
- void startRepeatDelay();
- void startPressRepeat();
- void stopPressRepeat();
-
- QQuickAbstractButton *findCheckedButton() const;
- QList<QQuickAbstractButton *> findExclusiveButtons() const;
-
- QString text;
- bool pressed;
- bool checked;
- bool checkable;
- bool highlighted;
- bool autoExclusive;
- bool autoRepeat;
- bool wasHeld;
- int holdTimer;
- int delayTimer;
- int repeatTimer;
- QPointF pressPoint;
- Qt::MouseButton repeatButton;
- QQuickItem *label;
- QQuickItem *indicator;
- QQuickButtonGroup *group;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKABSTRACTBUTTON_P_P_H
diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp
deleted file mode 100644
index 3edc6cc9..00000000
--- a/src/templates/qquickapplicationwindow.cpp
+++ /dev/null
@@ -1,638 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickapplicationwindow_p.h"
-#include "qquickoverlay_p.h"
-#include "qquickcontrol_p_p.h"
-#include "qquicktextarea_p.h"
-#include "qquicktextfield_p.h"
-
-#include <QtCore/private/qobject_p.h>
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ApplicationWindow
- \inherits Window
- \instantiates QQuickApplicationWindow
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief Provides a top-level application window.
-
- ApplicationWindow is a \l Window which makes it convenient to add
- a \l header and \l footer item to the window.
-
- \image qtlabscontrols-applicationwindow-wireframe.png
-
- \qml
- import Qt.labs.controls 1.0
-
- ApplicationWindow {
- visible: true
-
- header: ToolBar {
- // ...
- }
-
- footer: TabBar {
- // ...
- }
-
- StackView {
- anchors.fill: parent
- }
- }
- \endqml
-
- ApplicationWindow supports popups via its \l overlay property, which
- ensures that popups are displayed above other content and that the
- background is dimmed when a modal popup is visible.
-
- \note By default, an ApplicationWindow is not visible.
-
- \labs
-
- \sa Page, {Container Controls}
-*/
-
-class QQuickApplicationWindowPrivate : public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickApplicationWindow)
-
-public:
- QQuickApplicationWindowPrivate()
- : complete(false)
- , contentItem(Q_NULLPTR)
- , header(Q_NULLPTR)
- , footer(Q_NULLPTR)
- , overlay(Q_NULLPTR)
- , activeFocusControl(Q_NULLPTR)
- { }
-
- static QQuickApplicationWindowPrivate *get(QQuickApplicationWindow *window)
- {
- return window->d_func();
- }
-
- void relayout();
-
- void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
-
- void updateFont(const QFont &);
- inline void setFont_helper(const QFont &f) {
- if (font.resolve() == f.resolve() && font == f)
- return;
- updateFont(f);
- }
- void resolveFont();
-
- void _q_updateActiveFocus();
- void setActiveFocusControl(QQuickItem *item);
-
- bool complete;
- QQuickItem *contentItem;
- QQuickItem *header;
- QQuickItem *footer;
- QQuickOverlay *overlay;
- QFont font;
- QLocale locale;
- QQuickItem *activeFocusControl;
- QQuickApplicationWindow *q_ptr;
-};
-
-void QQuickApplicationWindowPrivate::relayout()
-{
- Q_Q(QQuickApplicationWindow);
- QQuickItem *content = q->contentItem();
- qreal hh = header ? header->height() : 0;
- qreal fh = footer ? footer->height() : 0;
-
- content->setY(hh);
- content->setWidth(q->width());
- content->setHeight(q->height() - hh - fh);
-
- if (overlay) {
- overlay->setWidth(q->width());
- overlay->setHeight(q->height());
- overlay->stackAfter(content);
- }
-
- if (header) {
- header->setY(-hh);
- QQuickItemPrivate *p = QQuickItemPrivate::get(header);
- if (!p->widthValid) {
- header->setWidth(q->width());
- p->widthValid = false;
- }
- }
-
- if (footer) {
- footer->setY(content->height());
- QQuickItemPrivate *p = QQuickItemPrivate::get(footer);
- if (!p->widthValid) {
- footer->setWidth(q->width());
- p->widthValid = false;
- }
- }
-}
-
-void QQuickApplicationWindowPrivate::itemImplicitWidthChanged(QQuickItem *item)
-{
- Q_UNUSED(item);
- relayout();
-}
-
-void QQuickApplicationWindowPrivate::itemImplicitHeightChanged(QQuickItem *item)
-{
- Q_UNUSED(item);
- relayout();
-}
-
-void QQuickApplicationWindowPrivate::_q_updateActiveFocus()
-{
- Q_Q(QQuickApplicationWindow);
- QQuickItem *item = q->activeFocusItem();
- while (item) {
- QQuickControl *control = qobject_cast<QQuickControl *>(item);
- if (control) {
- setActiveFocusControl(control);
- break;
- }
- QQuickTextField *textField = qobject_cast<QQuickTextField *>(item);
- if (textField) {
- setActiveFocusControl(textField);
- break;
- }
- QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(item);
- if (textArea) {
- setActiveFocusControl(textArea);
- break;
- }
- item = item->parentItem();
- }
-}
-
-void QQuickApplicationWindowPrivate::setActiveFocusControl(QQuickItem *control)
-{
- Q_Q(QQuickApplicationWindow);
- if (activeFocusControl != control) {
- activeFocusControl = control;
- emit q->activeFocusControlChanged();
- }
-}
-
-QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent) :
- QQuickWindowQmlImpl(parent), d_ptr(new QQuickApplicationWindowPrivate)
-{
- d_ptr->q_ptr = this;
- connect(this, SIGNAL(activeFocusItemChanged()), this, SLOT(_q_updateActiveFocus()));
-}
-
-QQuickApplicationWindow::~QQuickApplicationWindow()
-{
- Q_D(QQuickApplicationWindow);
- if (d->header)
- QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- if (d->footer)
- QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
- d_ptr.reset();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::ApplicationWindow::header
-
- 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.
-
- \sa footer, Page::header
-*/
-QQuickItem *QQuickApplicationWindow::header() const
-{
- Q_D(const QQuickApplicationWindow);
- return d->header;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::ApplicationWindow::footer
-
- 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.
-
- \sa header, Page::footer
-*/
-QQuickItem *QQuickApplicationWindow::footer() const
-{
- Q_D(const QQuickApplicationWindow);
- return d->footer;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty list<Object> Qt.labs.controls::ApplicationWindow::contentData
- \default
-
- This default property holds the list of all objects declared as children of
- the window.
-
- \sa contentItem
-*/
-QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
-{
- return QQuickItemPrivate::get(contentItem())->data();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::ApplicationWindow::contentItem
- \readonly
-
- This property holds the window content item.
-*/
-QQuickItem *QQuickApplicationWindow::contentItem() const
-{
- QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
- if (!d->contentItem) {
- d->contentItem = new QQuickItem(QQuickWindow::contentItem());
- d->relayout();
- }
- return d->contentItem;
-}
-
-/*!
- \qmlproperty Control Qt.labs.controls::ApplicationWindow::activeFocusControl
- \readonly
-
- This property holds the control that currently has active focus, or \c null if there is
- no control with active focus.
-
- The difference between \l Window::activeFocusItem and ApplicationWindow::activeFocusControl
- is that the former may point to a building block of a control, whereas the latter points
- to the enclosing control. For example, when SpinBox has focus, activeFocusItem points to
- the editor and acticeFocusControl to the SpinBox itself.
-
- \sa Window::activeFocusItem
-*/
-QQuickItem *QQuickApplicationWindow::activeFocusControl() const
-{
- Q_D(const QQuickApplicationWindow);
- return d->activeFocusControl;
-}
-
-/*!
- \qmlpropertygroup Qt.labs.controls::ApplicationWindow::overlay
- \qmlproperty Item Qt.labs.controls::ApplicationWindow::overlay
- \qmlproperty Item Qt.labs.controls::ApplicationWindow::overlay.background
-
- This property holds the window overlay item and its background that implements the
- background dimming when any modal popups are open. Popups are automatically
- reparented to the overlay.
-
- \sa Popup
-*/
-QQuickOverlay *QQuickApplicationWindow::overlay() const
-{
- QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
- if (!d->overlay) {
- d->overlay = new QQuickOverlay(QQuickWindow::contentItem());
- d->relayout();
- }
- return d->overlay;
-}
-
-/*!
- \qmlproperty font Qt.labs.controls::ApplicationWindow::font
-
- This property holds the font currently set for the window.
-
- The default font depends on the system environment. QGuiApplication maintains a system/theme
- font which serves as a default for all application windows. You can also set the default font
- for windows by passing a custom font to QGuiApplication::setFont(), before loading any QML.
- Finally, the font is matched against Qt's font database to find the best match.
-
- ApplicationWindow propagates explicit font properties to child controls. If you change a specific
- property on the window's font, that property propagates to all child controls in the window,
- overriding any system defaults for that property.
-
- \sa Control::font
-*/
-QFont QQuickApplicationWindow::font() const
-{
- Q_D(const QQuickApplicationWindow);
- return d->font;
-}
-
-void QQuickApplicationWindow::setFont(const QFont &f)
-{
- Q_D(QQuickApplicationWindow);
- if (d->font.resolve() == f.resolve() && d->font == f)
- return;
-
- QFont resolvedFont = f.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
- d->setFont_helper(resolvedFont);
-}
-
-void QQuickApplicationWindow::resetFont()
-{
- setFont(QFont());
-}
-
-void QQuickApplicationWindowPrivate::resolveFont()
-{
- QFont resolvedFont = font.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
- setFont_helper(resolvedFont);
-}
-
-void QQuickApplicationWindowPrivate::updateFont(const QFont &f)
-{
- Q_Q(QQuickApplicationWindow);
- const bool changed = font != f;
- font = f;
-
- QQuickControlPrivate::updateFontRecur(q->QQuickWindow::contentItem(), f);
-
- if (changed)
- emit q->fontChanged();
-}
-
-QLocale QQuickApplicationWindow::locale() const
-{
- Q_D(const QQuickApplicationWindow);
- return d->locale;
-}
-
-void QQuickApplicationWindow::setLocale(const QLocale &locale)
-{
- Q_D(QQuickApplicationWindow);
- if (d->locale == locale)
- return;
-
- d->locale = locale;
- QQuickControlPrivate::updateLocaleRecur(QQuickWindow::contentItem(), locale);
- emit localeChanged();
-}
-
-void QQuickApplicationWindow::resetLocale()
-{
- setLocale(QLocale());
-}
-
-QQuickApplicationWindowAttached *QQuickApplicationWindow::qmlAttachedProperties(QObject *object)
-{
- return new QQuickApplicationWindowAttached(object);
-}
-
-bool QQuickApplicationWindow::isComponentComplete() const
-{
- Q_D(const QQuickApplicationWindow);
- return d->complete;
-}
-
-void QQuickApplicationWindow::classBegin()
-{
- Q_D(QQuickApplicationWindow);
- QQuickWindowQmlImpl::classBegin();
- d->resolveFont();
-}
-
-void QQuickApplicationWindow::componentComplete()
-{
- Q_D(QQuickApplicationWindow);
- d->complete = true;
- QQuickWindowQmlImpl::componentComplete();
-}
-
-void QQuickApplicationWindow::resizeEvent(QResizeEvent *event)
-{
- Q_D(QQuickApplicationWindow);
- QQuickWindowQmlImpl::resizeEvent(event);
- d->relayout();
-}
-
-class QQuickApplicationWindowAttachedPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QQuickApplicationWindowAttached)
-
-public:
- QQuickApplicationWindowAttachedPrivate() : window(Q_NULLPTR) { }
-
- void windowChange(QQuickWindow *wnd);
-
- QQuickApplicationWindow *window;
-};
-
-void QQuickApplicationWindowAttachedPrivate::windowChange(QQuickWindow *wnd)
-{
- Q_Q(QQuickApplicationWindowAttached);
- if (window && !QQuickApplicationWindowPrivate::get(window))
- window = Q_NULLPTR; // being deleted (QTBUG-52731)
-
- QQuickApplicationWindow *newWindow = qobject_cast<QQuickApplicationWindow *>(wnd);
- if (window != newWindow) {
- QQuickApplicationWindow *oldWindow = window;
- if (oldWindow) {
- QObject::disconnect(oldWindow, &QQuickApplicationWindow::activeFocusControlChanged,
- q, &QQuickApplicationWindowAttached::activeFocusControlChanged);
- QObject::disconnect(oldWindow, &QQuickApplicationWindow::headerChanged,
- q, &QQuickApplicationWindowAttached::headerChanged);
- QObject::disconnect(oldWindow, &QQuickApplicationWindow::footerChanged,
- q, &QQuickApplicationWindowAttached::footerChanged);
- }
- if (newWindow) {
- QObject::connect(newWindow, &QQuickApplicationWindow::activeFocusControlChanged,
- q, &QQuickApplicationWindowAttached::activeFocusControlChanged);
- QObject::connect(newWindow, &QQuickApplicationWindow::headerChanged,
- q, &QQuickApplicationWindowAttached::headerChanged);
- QObject::connect(newWindow, &QQuickApplicationWindow::footerChanged,
- q, &QQuickApplicationWindowAttached::footerChanged);
- }
-
- window = newWindow;
- emit q->windowChanged();
- emit q->contentItemChanged();
- emit q->overlayChanged();
-
- if ((oldWindow && oldWindow->activeFocusControl()) || (newWindow && newWindow->activeFocusControl()))
- emit q->activeFocusControlChanged();
- if ((oldWindow && oldWindow->header()) || (newWindow && newWindow->header()))
- emit q->headerChanged();
- if ((oldWindow && oldWindow->footer()) || (newWindow && newWindow->footer()))
- emit q->footerChanged();
- }
-}
-
-QQuickApplicationWindowAttached::QQuickApplicationWindowAttached(QObject *parent)
- : QObject(*(new QQuickApplicationWindowAttachedPrivate), parent)
-{
- Q_D(QQuickApplicationWindowAttached);
- QQuickItem *item = qobject_cast<QQuickItem *>(parent);
- if (item) {
- d->windowChange(item->window());
- QObjectPrivate::connect(item, &QQuickItem::windowChanged, d, &QQuickApplicationWindowAttachedPrivate::windowChange);
- }
-}
-
-/*!
- \qmlattachedproperty ApplicationWindow Qt.labs.controls::ApplicationWindow::window
- \readonly
-
- This attached property holds the application window. The property can be attached
- to any item. The value is \c null if the item is not in an ApplicationWindow.
-*/
-QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const
-{
- Q_D(const QQuickApplicationWindowAttached);
- return d->window;
-}
-
-/*!
- \qmlattachedproperty Item Qt.labs.controls::ApplicationWindow::contentItem
- \readonly
-
- This attached property holds the window content item. The property can be attached
- to any item. The value is \c null if the item is not in an ApplicationWindow.
-*/
-QQuickItem *QQuickApplicationWindowAttached::contentItem() const
-{
- Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->contentItem() : Q_NULLPTR;
-}
-
-/*!
- \qmlattachedproperty Control Qt.labs.controls::ApplicationWindow::activeFocusControl
- \readonly
-
- This attached property holds the control that currently has active focus, or \c null
- if there is no control with active focus. The property can be attached to any item.
- The value is \c null if the item is not in an ApplicationWindow, or the window has
- no active focus.
-
- \sa Window::activeFocusItem
-*/
-QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
-{
- Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->activeFocusControl() : Q_NULLPTR;
-}
-
-/*!
- \qmlattachedproperty Item Qt.labs.controls::ApplicationWindow::header
- \readonly
-
- This attached property holds the window header item. The property can be attached
- to any item. The value is \c null if the item is not in an ApplicationWindow, or
- the window has no header item.
-*/
-QQuickItem *QQuickApplicationWindowAttached::header() const
-{
- Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->header() : Q_NULLPTR;
-}
-
-/*!
- \qmlattachedproperty Item Qt.labs.controls::ApplicationWindow::footer
- \readonly
-
- This attached property holds the window footer item. The property can be attached
- to any item. The value is \c null if the item is not in an ApplicationWindow, or
- the window has no footer item.
-*/
-QQuickItem *QQuickApplicationWindowAttached::footer() const
-{
- Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->footer() : Q_NULLPTR;
-}
-
-/*!
- \qmlattachedproperty Item Qt.labs.controls::ApplicationWindow::overlay
- \readonly
-
- This attached property holds the window overlay item. The property can be attached
- to any item. The value is \c null if the item is not in an ApplicationWindow.
-*/
-QQuickOverlay *QQuickApplicationWindowAttached::overlay() const
-{
- Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->overlay() : Q_NULLPTR;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qquickapplicationwindow_p.cpp"
diff --git a/src/templates/qquickapplicationwindow_p.h b/src/templates/qquickapplicationwindow_p.h
deleted file mode 100644
index f62ddee3..00000000
--- a/src/templates/qquickapplicationwindow_p.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKAPPLICATIONWINDOW_P_H
-#define QQUICKAPPLICATIONWINDOW_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquickwindowmodule_p.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-#include <QtGui/qfont.h>
-#include <QtCore/qlocale.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickOverlay;
-class QQuickApplicationWindowPrivate;
-class QQuickApplicationWindowAttached;
-class QQuickApplicationWindowAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImpl
-{
- Q_OBJECT
- Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> data READ contentData FINAL)
- Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
- Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
- Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQuickOverlay *overlay READ overlay CONSTANT FINAL)
- Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "data")
-
-public:
- explicit QQuickApplicationWindow(QWindow *parent = Q_NULLPTR);
- ~QQuickApplicationWindow();
-
- QQuickItem *contentItem() const;
- QQmlListProperty<QObject> contentData();
-
- QQuickItem *activeFocusControl() const;
-
- QQuickItem *header() const;
- void setHeader(QQuickItem *header);
-
- QQuickItem *footer() const;
- void setFooter(QQuickItem *footer);
-
- QQuickOverlay *overlay() const;
-
- QFont font() const;
- void setFont(const QFont &);
- void resetFont();
-
- QLocale locale() const;
- void setLocale(const QLocale &locale);
- void resetLocale();
-
- static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object);
-
-Q_SIGNALS:
- void activeFocusControlChanged();
- void headerChanged();
- void footerChanged();
- void fontChanged();
- void localeChanged();
-
-protected:
- bool isComponentComplete() const;
- void classBegin() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
- void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
-
-private:
- Q_DISABLE_COPY(QQuickApplicationWindow)
- Q_DECLARE_PRIVATE(QQuickApplicationWindow)
- Q_PRIVATE_SLOT(d_func(), void _q_updateActiveFocus())
- QScopedPointer<QQuickApplicationWindowPrivate> d_ptr;
-};
-
-class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindowAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQuickApplicationWindow *window READ window NOTIFY windowChanged FINAL)
- Q_PROPERTY(QQuickItem *contentItem READ contentItem NOTIFY contentItemChanged FINAL)
- Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
- Q_PROPERTY(QQuickItem *header READ header NOTIFY headerChanged FINAL)
- Q_PROPERTY(QQuickItem *footer READ footer NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL)
-
-public:
- explicit QQuickApplicationWindowAttached(QObject *parent = Q_NULLPTR);
-
- QQuickApplicationWindow *window() const;
- QQuickItem *contentItem() const;
- QQuickItem *activeFocusControl() const;
- QQuickItem *header() const;
- QQuickItem *footer() const;
- QQuickOverlay *overlay() const;
-
-Q_SIGNALS:
- void windowChanged();
- void contentItemChanged();
- void activeFocusControlChanged();
- void headerChanged();
- void footerChanged();
- void overlayChanged();
-
-private:
- Q_DISABLE_COPY(QQuickApplicationWindowAttached)
- Q_DECLARE_PRIVATE(QQuickApplicationWindowAttached)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickApplicationWindow)
-QML_DECLARE_TYPEINFO(QQuickApplicationWindow, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKAPPLICATIONWINDOW_P_H
diff --git a/src/templates/qquickbusyindicator.cpp b/src/templates/qquickbusyindicator.cpp
deleted file mode 100644
index 381ac5c7..00000000
--- a/src/templates/qquickbusyindicator.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickbusyindicator_p.h"
-#include "qquickcontrol_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype BusyIndicator
- \inherits Control
- \instantiates QQuickBusyIndicator
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-indicators
- \brief A busy indicator.
-
- \image qtlabscontrols-busyindicator.gif
-
- The busy indicator should be used to indicate activity while content is
- being loaded or the UI is blocked waiting for a resource to become available.
-
- The following snippet shows how to use the BusyIndicator:
-
- \qml
- BusyIndicator {
- running: image.status === Image.Loading
- }
- \endqml
-
- \labs
-
- \sa {Customizing BusyIndicator}, {Indicator Controls}
-*/
-
-class QQuickBusyIndicatorPrivate : public QQuickControlPrivate
-{
-public:
- QQuickBusyIndicatorPrivate() : running(true) { }
-
- bool running;
-};
-
-QQuickBusyIndicator::QQuickBusyIndicator(QQuickItem *parent) :
- QQuickControl(*(new QQuickBusyIndicatorPrivate), parent)
-{
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::BusyIndicator::running
-
- This property holds whether the busy indicator is currently indicating
- activity.
-
- \note The indicator is only visible when this property is set to \c true.
-
- The default value is \c true.
-
-*/
-bool QQuickBusyIndicator::isRunning() const
-{
- Q_D(const QQuickBusyIndicator);
- return d->running;
-}
-
-void QQuickBusyIndicator::setRunning(bool running)
-{
- Q_D(QQuickBusyIndicator);
- if (d->running != running) {
- d->running = running;
- emit runningChanged();
- }
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickBusyIndicator::accessibleRole() const
-{
- return QAccessible::Indicator;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickbusyindicator_p.h b/src/templates/qquickbusyindicator_p.h
deleted file mode 100644
index 8be19d5c..00000000
--- a/src/templates/qquickbusyindicator_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKBUSYINDICATOR_P_H
-#define QQUICKBUSYINDICATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickBusyIndicatorPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickBusyIndicator : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged FINAL)
-
-public:
- explicit QQuickBusyIndicator(QQuickItem *parent = Q_NULLPTR);
-
- bool isRunning() const;
- void setRunning(bool running);
-
-Q_SIGNALS:
- void runningChanged();
-
-protected:
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickBusyIndicator)
- Q_DECLARE_PRIVATE(QQuickBusyIndicator)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickBusyIndicator)
-
-#endif // QQUICKBUSYINDICATOR_P_H
diff --git a/src/templates/qquickbutton.cpp b/src/templates/qquickbutton.cpp
deleted file mode 100644
index 1e40ec05..00000000
--- a/src/templates/qquickbutton.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickbutton_p.h"
-#include "qquickabstractbutton_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Button
- \inherits AbstractButton
- \instantiates QQuickButton
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-buttons
- \brief A button control.
-
- \image qtlabscontrols-button.gif
-
- Button presents a push-button control that can be pushed or clicked by
- the user. Buttons are normally used to perform an action, or to answer
- a question. Typical buttons are \e OK, \e Apply, \e Cancel, \e Close,
- \e Yes, \e No, and \e Help.
-
- \table
- \row \li \image qtlabscontrols-button-normal.png
- \li A button in its normal state.
- \row \li \image qtlabscontrols-button-pressed.png
- \li A button that is pressed.
- \row \li \image qtlabscontrols-button-focused.png
- \li A button that has active focus.
- \row \li \image qtlabscontrols-button-disabled.png
- \li A button that is disabled.
- \endtable
-
- \code
- RowLayout {
- Button {
- text: "Ok"
- onClicked: model.submit()
- }
- Button {
- text: "Cancel"
- onClicked: model.revert()
- }
- }
- \endcode
-
- \labs
-
- \sa {Customizing Button}, {Button Controls}
-*/
-
-QQuickButton::QQuickButton(QQuickItem *parent) : QQuickAbstractButton(parent)
-{
-}
-
-QFont QQuickButton::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::PushButtonFont);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickbutton_p.h b/src/templates/qquickbutton_p.h
deleted file mode 100644
index 83d22fb8..00000000
--- a/src/templates/qquickbutton_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKBUTTON_P_H
-#define QQUICKBUTTON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LABSTEMPLATES_EXPORT QQuickButton : public QQuickAbstractButton
-{
- Q_OBJECT
-
-public:
- explicit QQuickButton(QQuickItem *parent = Q_NULLPTR);
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickButton)
-
-#endif // QQUICKBUTTON_P_H
diff --git a/src/templates/qquickbuttongroup.cpp b/src/templates/qquickbuttongroup.cpp
deleted file mode 100644
index 2cbb5ece..00000000
--- a/src/templates/qquickbuttongroup.cpp
+++ /dev/null
@@ -1,381 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickbuttongroup_p.h"
-
-#include <QtCore/private/qobject_p.h>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qvariant.h>
-#include <QtQml/qqmlinfo.h>
-
-#include "qquickabstractbutton_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ButtonGroup
- \inherits QtObject
- \instantiates QQuickButtonGroup
- \inqmlmodule Qt.labs.controls
- \ingroup utilities
- \brief An 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
- can be selected at a time.
-
- The most straight-forward way to use ButtonGroup is to assign
- a list of buttons. For example, the list of children of a
- \l{Item Positioners}{positioner} or a \l{Qt Quick Layouts}{layout}
- that manages a group of mutually exclusive buttons.
-
- \code
- ButtonGroup {
- buttons: column.children
- }
-
- Column {
- id: column
-
- RadioButton {
- checked: true
- text: qsTr("DAB")
- }
-
- RadioButton {
- text: qsTr("FM")
- }
-
- RadioButton {
- text: qsTr("AM")
- }
- }
- \endcode
-
- Mutually exclusive buttons do not always share the same parent item,
- or the parent layout may sometimes contain items that should not be
- included in the button group. Such cases are best handled using
- the \l group attached property.
-
- \code
- ButtonGroup { id: radioGroup }
-
- Column {
- Label {
- text: qsTr("Radio:")
- }
-
- RadioButton {
- checked: true
- text: qsTr("DAB")
- ButtonGroup.group: radioGroup
- }
-
- RadioButton {
- text: qsTr("FM")
- ButtonGroup.group: radioGroup
- }
-
- RadioButton {
- text: qsTr("AM")
- ButtonGroup.group: radioGroup
- }
- }
- \endcode
-
- More advanced use cases can be handled using the addButton() and
- removeButton() methods.
-
- \labs
-
- \sa RadioButton
-*/
-
-class QQuickButtonGroupPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QQuickButtonGroup)
-
-public:
- QQuickButtonGroupPrivate() : checkedButton(Q_NULLPTR) { }
-
- void clear();
- void updateCurrent();
-
- static void buttons_append(QQmlListProperty<QQuickAbstractButton> *prop, QQuickAbstractButton *obj);
- static int buttons_count(QQmlListProperty<QQuickAbstractButton> *prop);
- static QQuickAbstractButton *buttons_at(QQmlListProperty<QQuickAbstractButton> *prop, int index);
- static void buttons_clear(QQmlListProperty<QQuickAbstractButton> *prop);
-
- QQuickAbstractButton *checkedButton;
- QVector<QQuickAbstractButton*> buttons;
-};
-
-void QQuickButtonGroupPrivate::clear()
-{
- foreach (QQuickAbstractButton *button, buttons) {
- QQuickAbstractButtonPrivate::get(button)->group = Q_NULLPTR;
- QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, this, &QQuickButtonGroupPrivate::updateCurrent);
- }
- buttons.clear();
-}
-
-void QQuickButtonGroupPrivate::updateCurrent()
-{
- Q_Q(QQuickButtonGroup);
- QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(q->sender());
- if (button && button->isChecked())
- q->setCheckedButton(button);
-}
-
-void QQuickButtonGroupPrivate::buttons_append(QQmlListProperty<QQuickAbstractButton> *prop, QQuickAbstractButton *obj)
-{
- QQuickButtonGroup *q = static_cast<QQuickButtonGroup *>(prop->object);
- q->addButton(obj);
-}
-
-int QQuickButtonGroupPrivate::buttons_count(QQmlListProperty<QQuickAbstractButton> *prop)
-{
- QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data);
- return p->buttons.count();
-}
-
-QQuickAbstractButton *QQuickButtonGroupPrivate::buttons_at(QQmlListProperty<QQuickAbstractButton> *prop, int index)
-{
- QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data);
- return p->buttons.value(index);
-}
-
-void QQuickButtonGroupPrivate::buttons_clear(QQmlListProperty<QQuickAbstractButton> *prop)
-{
- QQuickButtonGroupPrivate *p = static_cast<QQuickButtonGroupPrivate *>(prop->data);
- if (!p->buttons.isEmpty()) {
- p->clear();
- QQuickButtonGroup *q = static_cast<QQuickButtonGroup *>(prop->object);
- q->setCheckedButton(Q_NULLPTR);
- emit q->buttonsChanged();
- }
-}
-
-QQuickButtonGroup::QQuickButtonGroup(QObject *parent)
- : QObject(*(new QQuickButtonGroupPrivate), parent)
-{
-}
-
-QQuickButtonGroup::~QQuickButtonGroup()
-{
- Q_D(QQuickButtonGroup);
- d->clear();
-}
-
-QQuickButtonGroupAttached *QQuickButtonGroup::qmlAttachedProperties(QObject *object)
-{
- return new QQuickButtonGroupAttached(object);
-}
-
-/*!
- \qmlproperty AbstractButton Qt.labs.controls::ButtonGroup::current
-
- This property holds the currently selected button, or \c null if there is none.
-
- By default, it is the first checked button added to the button group.
-*/
-QQuickAbstractButton *QQuickButtonGroup::checkedButton() const
-{
- Q_D(const QQuickButtonGroup);
- return d->checkedButton;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty list<AbstractButton> Qt.labs.controls::ButtonGroup::buttons
- \default
-
- This property holds the list of buttons.
-
- \code
- ButtonGroup {
- buttons: column.children
- }
-
- Column {
- id: column
-
- RadioButton {
- checked: true
- text: qsTr("Option A")
- }
-
- RadioButton {
- text: qsTr("Option B")
- }
- }
- \endcode
-
- \sa group
-*/
-QQmlListProperty<QQuickAbstractButton> QQuickButtonGroup::buttons()
-{
- Q_D(QQuickButtonGroup);
- return QQmlListProperty<QQuickAbstractButton>(this, d,
- QQuickButtonGroupPrivate::buttons_append,
- QQuickButtonGroupPrivate::buttons_count,
- QQuickButtonGroupPrivate::buttons_at,
- QQuickButtonGroupPrivate::buttons_clear);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::ButtonGroup::addButton(AbstractButton button)
-
- Adds a \a button to the button group.
-
- \note Manually adding objects to a button group is typically unnecessary.
- The \l buttons property and the \l group attached property provide a
- convenient and declarative syntax.
-
- \sa buttons, group
-*/
-void QQuickButtonGroup::addButton(QQuickAbstractButton *button)
-{
- Q_D(QQuickButtonGroup);
- if (!button || d->buttons.contains(button))
- return;
-
- QQuickAbstractButtonPrivate::get(button)->group = this;
- QObjectPrivate::connect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::updateCurrent);
-
- if (button->isChecked())
- setCheckedButton(button);
-
- d->buttons.append(button);
- emit buttonsChanged();
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::ButtonGroup::removeButton(AbstractButton button)
-
- Removes a \a button from the button group.
-
- \note Manually removing objects from a button group is typically unnecessary.
- The \l buttons property and the \l group attached property provide a
- convenient and declarative syntax.
-
- \sa buttons, group
-*/
-void QQuickButtonGroup::removeButton(QQuickAbstractButton *button)
-{
- Q_D(QQuickButtonGroup);
- if (!button || !d->buttons.contains(button))
- return;
-
- QQuickAbstractButtonPrivate::get(button)->group = Q_NULLPTR;
- QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::updateCurrent);
-
- if (d->checkedButton == button)
- setCheckedButton(Q_NULLPTR);
-
- d->buttons.removeOne(button);
- emit buttonsChanged();
-}
-
-class QQuickButtonGroupAttachedPrivate : public QObjectPrivate
-{
-public:
- QQuickButtonGroupAttachedPrivate() : group(Q_NULLPTR) { }
-
- QQuickButtonGroup *group;
-};
-
-QQuickButtonGroupAttached::QQuickButtonGroupAttached(QObject *parent) :
- QObject(*(new QQuickButtonGroupAttachedPrivate), parent)
-{
-}
-
-/*!
- \qmlattachedproperty ButtonGroup Qt.labs.controls::ButtonGroup::group
-
- This property attaches a button to a button group.
-
- \code
- ButtonGroup { id: group }
-
- RadioButton {
- checked: true
- text: qsTr("Option A")
- ButtonGroup.group: group
- }
-
- RadioButton {
- text: qsTr("Option B")
- ButtonGroup.group: group
- }
- \endcode
-
- \sa buttons
-*/
-QQuickButtonGroup *QQuickButtonGroupAttached::group() const
-{
- Q_D(const QQuickButtonGroupAttached);
- return d->group;
-}
-
-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();
- }
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qquickbuttongroup_p.cpp"
diff --git a/src/templates/qquickbuttongroup_p.h b/src/templates/qquickbuttongroup_p.h
deleted file mode 100644
index 6210079d..00000000
--- a/src/templates/qquickbuttongroup_p.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKBUTTONGROUP_P_H
-#define QQUICKBUTTONGROUP_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-#include <QtQml/qqml.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAbstractButton;
-class QQuickButtonGroupPrivate;
-class QQuickButtonGroupAttached;
-class QQuickButtonGroupAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickButtonGroup : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQuickAbstractButton *checkedButton READ checkedButton WRITE setCheckedButton NOTIFY checkedButtonChanged)
- Q_PROPERTY(QQmlListProperty<QQuickAbstractButton> buttons READ buttons NOTIFY buttonsChanged FINAL)
-
-public:
- explicit QQuickButtonGroup(QObject *parent = Q_NULLPTR);
- ~QQuickButtonGroup();
-
- static QQuickButtonGroupAttached *qmlAttachedProperties(QObject *object);
-
- QQuickAbstractButton *checkedButton() const;
- void setCheckedButton(QQuickAbstractButton *checkedButton);
-
- QQmlListProperty<QQuickAbstractButton> buttons();
-
-public Q_SLOTS:
- void addButton(QQuickAbstractButton *button);
- void removeButton(QQuickAbstractButton *button);
-
-Q_SIGNALS:
- void checkedButtonChanged();
- void buttonsChanged();
-
-private:
- Q_DISABLE_COPY(QQuickButtonGroup)
- Q_DECLARE_PRIVATE(QQuickButtonGroup)
-};
-
-class Q_LABSTEMPLATES_EXPORT QQuickButtonGroupAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQuickButtonGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL)
-
-public:
- explicit QQuickButtonGroupAttached(QObject *parent = Q_NULLPTR);
-
- QQuickButtonGroup *group() const;
- void setGroup(QQuickButtonGroup *group);
-
-Q_SIGNALS:
- void groupChanged();
-
-private:
- Q_DISABLE_COPY(QQuickButtonGroupAttached)
- Q_DECLARE_PRIVATE(QQuickButtonGroupAttached)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickButtonGroup)
-QML_DECLARE_TYPEINFO(QQuickButtonGroup, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQuickButtonGroup_H
diff --git a/src/templates/qquickcheckbox.cpp b/src/templates/qquickcheckbox.cpp
deleted file mode 100644
index 644e151e..00000000
--- a/src/templates/qquickcheckbox.cpp
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcheckbox_p.h"
-#include "qquickabstractbutton_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype CheckBox
- \inherits AbstractButton
- \instantiates QQuickCheckBox
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-buttons
- \brief A check box control.
-
- CheckBox presents an option button that can be toggled on (checked) or
- off (unchecked). Check boxes are typically used to select one or more
- options from a set of options.
-
- \table
- \row \li \image qtlabscontrols-checkbox-normal.png
- \li A check box in its normal state.
- \row \li \image qtlabscontrols-checkbox-checked.png
- \li A check box that is checked.
- \row \li \image qtlabscontrols-checkbox-focused.png
- \li A check box that has active focus.
- \row \li \image qtlabscontrols-checkbox-disabled.png
- \li A check box that is disabled.
- \endtable
-
- \code
- ColumnLayout {
- CheckBox {
- checked: true
- text: qsTr("First")
- }
- CheckBox {
- text: qsTr("Second")
- }
- CheckBox {
- checked: true
- text: qsTr("Third")
- }
- }
- \endcode
-
- \labs
-
- \sa {Customizing CheckBox}, {Button Controls}
-*/
-
-class QQuickCheckBoxPrivate : public QQuickAbstractButtonPrivate
-{
- Q_DECLARE_PUBLIC(QQuickCheckBox)
-
-public:
- QQuickCheckBoxPrivate()
- : tristate(false), checkState(Qt::Unchecked)
- {
- }
-
- bool tristate;
- Qt::CheckState checkState;
-};
-
-QQuickCheckBox::QQuickCheckBox(QQuickItem *parent) :
- QQuickAbstractButton(*(new QQuickCheckBoxPrivate), parent)
-{
- setCheckable(true);
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::CheckBox::tristate
-
- This property holds whether the checkbox is a tri-state checkbox.
-
- The default is \c false, i.e., the checkbox has only two states.
-*/
-bool QQuickCheckBox::isTristate() const
-{
- Q_D(const QQuickCheckBox);
- return d->tristate;
-}
-
-void QQuickCheckBox::setTristate(bool tristate)
-{
- Q_D(QQuickCheckBox);
- if (d->tristate != tristate) {
- d->tristate = tristate;
- emit tristateChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::CheckBox::checkState
-
- This property holds the check state of the checkbox.
-
- Available states:
- \value Qt.Unchecked The checkbox is unchecked.
- \value Qt.PartiallyChecked The checkbox is partially checked. This state is only used when \l tristate is enabled.
- \value Qt.Checked The checkbox is checked.
-
- \sa tristate, {AbstractButton::checked}{checked}
-*/
-Qt::CheckState QQuickCheckBox::checkState() const
-{
- Q_D(const QQuickCheckBox);
- return d->checkState;
-}
-
-void QQuickCheckBox::setCheckState(Qt::CheckState state)
-{
- Q_D(QQuickCheckBox);
- 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();
- }
-}
-
-QFont QQuickCheckBox::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::CheckBoxFont);
-}
-
-void QQuickCheckBox::checkStateSet()
-{
- setCheckState(isChecked() ? Qt::Checked : Qt::Unchecked);
-}
-
-void QQuickCheckBox::nextCheckState()
-{
- Q_D(QQuickCheckBox);
- if (d->tristate)
- setCheckState(static_cast<Qt::CheckState>((d->checkState + 1) % 3));
- else
- QQuickAbstractButton::nextCheckState();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickCheckBox::accessibleRole() const
-{
- return QAccessible::CheckBox;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickcheckbox_p.h b/src/templates/qquickcheckbox_p.h
deleted file mode 100644
index 4c0d505f..00000000
--- a/src/templates/qquickcheckbox_p.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCHECKBOX_P_H
-#define QQUICKCHECKBOX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickCheckBoxPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickCheckBox : public QQuickAbstractButton
-{
- Q_OBJECT
- Q_PROPERTY(bool tristate READ isTristate WRITE setTristate NOTIFY tristateChanged FINAL)
- Q_PROPERTY(Qt::CheckState checkState READ checkState WRITE setCheckState NOTIFY checkStateChanged FINAL)
-
-public:
- explicit QQuickCheckBox(QQuickItem *parent = Q_NULLPTR);
-
- bool isTristate() const;
- void setTristate(bool tristate);
-
- Qt::CheckState checkState() const;
- void setCheckState(Qt::CheckState state);
-
-Q_SIGNALS:
- void tristateChanged();
- void checkStateChanged();
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
- void checkStateSet() Q_DECL_OVERRIDE;
- void nextCheckState() Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickCheckBox)
- Q_DECLARE_PRIVATE(QQuickCheckBox)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickCheckBox)
-
-#endif // QQUICKCHECKBOX_P_H
diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp
deleted file mode 100644
index fb9f6d4d..00000000
--- a/src/templates/qquickcombobox.cpp
+++ /dev/null
@@ -1,823 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcombobox_p.h"
-#include "qquickcontrol_p_p.h"
-#include "qquickabstractbutton_p.h"
-#include "qquickpopup_p.h"
-
-#include <QtCore/qregexp.h>
-#include <QtGui/qpa/qplatformtheme.h>
-#include <QtQml/qjsvalue.h>
-#include <QtQml/qqmlcontext.h>
-#include <QtQml/private/qqmldelegatemodel_p.h>
-#include <QtQuick/private/qquickevents_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ComboBox
- \inherits Control
- \instantiates QQuickComboBox
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A combo box control.
-
- \image qtlabscontrols-combobox.png
-
- ComboBox is a combined button and popup list. It provides a means of
- presenting a list of options to the user in a way that takes up the
- minimum amount of screen space.
-
- ComboBox is populated with a data model. The data model is commonly
- a JavaScript array, a \l ListModel or an integer, but also other types
- of \l {qml-data-models}{data models} are supported.
-
- \code
- ComboBox {
- model: ["First", "Second", "Third"]
- }
- \endcode
-
- ComboBox is able to visualize standard \l {qml-data-models}{data models}
- that provide the \c modelData role:
- \list
- \li models that have only one role
- \li models that do not have named roles (JavaScript array, integer)
- \endlist
-
- When using models that have multiple named roles, ComboBox must be configured
- to use a specific \l {textRole}{text role} for its \l {displayText}{display text}
- and \l delegate instances.
-
- \code
- ComboBox {
- textRole: "key"
- model: ListModel {
- ListElement { key: "First"; value: 123 }
- ListElement { key: "Second"; value: 456 }
- ListElement { key: "Third"; value: 789 }
- }
- }
- \endcode
-
- \note If ComboBox is assigned a data model that has multiple named roles, but
- \l textRole is not defined, ComboBox is unable to visualize it and throws a
- \c {ReferenceError: modelData is not defined}.
-
- \labs
-
- \sa {Customizing ComboBox}, {Input Controls}
-*/
-
-/*!
- \qmlsignal void Qt.labs.controls::ComboBox::activated(int index)
-
- This signal is emitted when the item at \a index is activated by the user.
-
- \sa currentIndex
-*/
-
-/*!
- \qmlsignal void Qt.labs.controls::ComboBox::highlighted(int index)
-
- This signal is emitted when the item at \a index in the popup list is highlighted by the user.
-
- \sa highlightedIndex
-*/
-
-class QQuickComboBoxDelegateModel : public QQmlDelegateModel
-{
-public:
- explicit QQuickComboBoxDelegateModel(QQuickComboBox *combo);
- QString stringValue(int index, const QString &role) Q_DECL_OVERRIDE;
-
-private:
- QQuickComboBox *combo;
-};
-
-QQuickComboBoxDelegateModel::QQuickComboBoxDelegateModel(QQuickComboBox *combo) :
- QQmlDelegateModel(qmlContext(combo), combo), combo(combo)
-{
-}
-
-QString QQuickComboBoxDelegateModel::stringValue(int index, const QString &role)
-{
- QVariant model = combo->model();
- if (model.userType() == QMetaType::QVariantList) {
- QVariant object = model.toList().value(index);
- if (object.userType() == QMetaType::QVariantMap) {
- QVariantMap data = object.toMap();
- if (data.count() == 1 && role == QLatin1String("modelData"))
- return data.first().toString();
- return data.value(role).toString();
- }
- }
- return QQmlDelegateModel::stringValue(index, role);
-}
-
-class QQuickComboBoxPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickComboBox)
-
-public:
- QQuickComboBoxPrivate() : pressed(false), ownModel(false), hasDisplayText(false),
- highlightedIndex(-1), currentIndex(-1), delegateModel(Q_NULLPTR),
- delegate(Q_NULLPTR), popup(Q_NULLPTR) { }
-
- bool isPopupVisible() const;
- void showPopup();
- void hidePopup(bool accept);
- void togglePopup(bool accept);
-
- void itemClicked();
-
- void createdItem(int index, QObject *object);
- void countChanged();
- void updateCurrentText();
- void increase();
- void decrease();
- void setHighlightedIndex(int index);
-
- void createDelegateModel();
-
- bool pressed;
- bool ownModel;
- bool hasDisplayText;
- int highlightedIndex;
- int currentIndex;
- QVariant model;
- QString textRole;
- QString currentText;
- QString displayText;
- QQuickItem *pressedItem;
- QQmlInstanceModel *delegateModel;
- QQmlComponent *delegate;
- QQuickPopup *popup;
-};
-
-bool QQuickComboBoxPrivate::isPopupVisible() const
-{
- return popup && popup->isVisible();
-}
-
-void QQuickComboBoxPrivate::showPopup()
-{
- if (popup && !popup->isVisible())
- popup->open();
- setHighlightedIndex(currentIndex);
-}
-
-void QQuickComboBoxPrivate::hidePopup(bool accept)
-{
- Q_Q(QQuickComboBox);
- if (popup && popup->isVisible())
- popup->close();
- if (accept) {
- q->setCurrentIndex(highlightedIndex);
- emit q->activated(currentIndex);
- }
- setHighlightedIndex(-1);
-}
-
-void QQuickComboBoxPrivate::togglePopup(bool accept)
-{
- if (!popup)
- return;
-
- if (popup->isVisible())
- hidePopup(accept);
- else
- showPopup();
-}
-
-void QQuickComboBoxPrivate::itemClicked()
-{
- Q_Q(QQuickComboBox);
- int index = delegateModel->indexOf(q->sender(), Q_NULLPTR);
- if (index != -1) {
- setHighlightedIndex(index);
- emit q->highlighted(index);
- hidePopup(true);
- }
-}
-
-void QQuickComboBoxPrivate::createdItem(int index, QObject *object)
-{
- QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(object);
- if (button)
- connect(button, &QQuickAbstractButton::clicked, this, &QQuickComboBoxPrivate::itemClicked);
-
- if (index == currentIndex)
- updateCurrentText();
-}
-
-void QQuickComboBoxPrivate::countChanged()
-{
- Q_Q(QQuickComboBox);
- if (q->count() == 0)
- q->setCurrentIndex(-1);
- emit q->countChanged();
-}
-
-void QQuickComboBoxPrivate::updateCurrentText()
-{
- Q_Q(QQuickComboBox);
- QString text = q->textAt(currentIndex);
- if (currentText != text) {
- currentText = text;
- emit q->currentTextChanged();
- }
- if (!hasDisplayText && displayText != text) {
- displayText = text;
- emit q->displayTextChanged();
- }
-}
-
-void QQuickComboBoxPrivate::increase()
-{
- Q_Q(QQuickComboBox);
- if (isPopupVisible()) {
- if (highlightedIndex < q->count() - 1) {
- setHighlightedIndex(highlightedIndex + 1);
- emit q->highlighted(highlightedIndex);
- }
- } else {
- if (currentIndex < q->count() - 1) {
- q->setCurrentIndex(currentIndex + 1);
- emit q->activated(currentIndex);
- }
- }
-}
-
-void QQuickComboBoxPrivate::decrease()
-{
- Q_Q(QQuickComboBox);
- if (isPopupVisible()) {
- if (highlightedIndex > 0) {
- setHighlightedIndex(highlightedIndex - 1);
- emit q->highlighted(highlightedIndex);
- }
- } else {
- if (currentIndex > 0) {
- q->setCurrentIndex(currentIndex - 1);
- emit q->activated(currentIndex);
- }
- }
-}
-
-void QQuickComboBoxPrivate::setHighlightedIndex(int index)
-{
- Q_Q(QQuickComboBox);
- if (highlightedIndex != index) {
- highlightedIndex = index;
- emit q->highlightedIndexChanged();
- }
-}
-
-void QQuickComboBoxPrivate::createDelegateModel()
-{
- Q_Q(QQuickComboBox);
- bool ownedOldModel = ownModel;
- QQmlInstanceModel* oldModel = delegateModel;
- if (oldModel) {
- disconnect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
- disconnect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
- disconnect(delegateModel, &QQmlInstanceModel::createdItem, this, &QQuickComboBoxPrivate::createdItem);
- }
-
- ownModel = false;
- delegateModel = model.value<QQmlInstanceModel *>();
-
- if (!delegateModel && model.isValid()) {
- QQmlDelegateModel *dataModel = new QQuickComboBoxDelegateModel(q);
- dataModel->setModel(model);
- dataModel->setDelegate(delegate);
- if (q->isComponentComplete())
- dataModel->componentComplete();
-
- ownModel = true;
- delegateModel = dataModel;
- }
-
- if (delegateModel) {
- connect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
- connect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
- connect(delegateModel, &QQmlInstanceModel::createdItem, this, &QQuickComboBoxPrivate::createdItem);
- }
-
- emit q->delegateModelChanged();
-
- if (ownedOldModel)
- delete oldModel;
-}
-
-QQuickComboBox::QQuickComboBox(QQuickItem *parent) :
- QQuickControl(*(new QQuickComboBoxPrivate), parent)
-{
- setActiveFocusOnTab(true);
- setFlag(QQuickItem::ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-QQuickComboBox::~QQuickComboBox()
-{
- Q_D(QQuickComboBox);
- delete d->popup;
- d->popup = Q_NULLPTR;
-}
-
-/*!
- \readonly
- \qmlproperty int Qt.labs.controls::ComboBox::count
-
- This property holds the number of items in the combo box.
-*/
-int QQuickComboBox::count() const
-{
- Q_D(const QQuickComboBox);
- return d->delegateModel ? d->delegateModel->count() : 0;
-}
-
-/*!
- \qmlproperty model Qt.labs.controls::ComboBox::model
-
- This property holds the model providing data for the combo box.
-
- \code
- ComboBox {
- textRole: "key"
- model: ListModel {
- ListElement { key: "First"; value: 123 }
- ListElement { key: "Second"; value: 456 }
- ListElement { key: "Third"; value: 789 }
- }
- }
- \endcode
-
- \sa textRole, {qml-data-models}{Data Models}
-*/
-QVariant QQuickComboBox::model() const
-{
- Q_D(const QQuickComboBox);
- return d->model;
-}
-
-void QQuickComboBox::setModel(const QVariant& m)
-{
- Q_D(QQuickComboBox);
- QVariant model = 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();
- }
-}
-
-/*!
- \internal
- \qmlproperty model Qt.labs.controls::ComboBox::delegateModel
-
- This property holds the model providing delegate instances for the combo box.
-*/
-QQmlInstanceModel *QQuickComboBox::delegateModel() const
-{
- Q_D(const QQuickComboBox);
- return d->delegateModel;
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::ComboBox::pressed
-
- This property holds whether the combo box button is pressed.
-*/
-bool QQuickComboBox::isPressed() const
-{
- Q_D(const QQuickComboBox);
- return d->pressed;
-}
-
-void QQuickComboBox::setPressed(bool pressed)
-{
- Q_D(QQuickComboBox);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- emit pressedChanged();
- }
-}
-
-/*!
- \readonly
- \qmlproperty int Qt.labs.controls::ComboBox::highlightedIndex
-
- This property holds the index of the highlighted item in the combo box popup list.
-
- \sa highlighted(), currentIndex
-*/
-int QQuickComboBox::highlightedIndex() const
-{
- Q_D(const QQuickComboBox);
- return d->highlightedIndex;
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::ComboBox::currentIndex
-
- This property holds the index of the current item in the combo box.
-
- \sa activated(), currentText
-*/
-int QQuickComboBox::currentIndex() const
-{
- Q_D(const QQuickComboBox);
- return d->currentIndex;
-}
-
-void QQuickComboBox::setCurrentIndex(int index)
-{
- Q_D(QQuickComboBox);
- if (d->currentIndex != index) {
- d->currentIndex = index;
- emit currentIndexChanged();
- if (isComponentComplete())
- d->updateCurrentText();
- }
-}
-
-/*!
- \readonly
- \qmlproperty string Qt.labs.controls::ComboBox::currentText
-
- This property holds the text of the current item in the combo box.
-
- \sa currentIndex, displayText, textRole
-*/
-QString QQuickComboBox::currentText() const
-{
- Q_D(const QQuickComboBox);
- return d->currentText;
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::ComboBox::displayText
-
- This property holds the text that is displayed on the combo box button.
-
- By default, the display text presents the current selection. That is,
- it follows the text of the current item. However, the default display
- text can be overridden with a custom value.
-
- \code
- ComboBox {
- currentIndex: 1
- displayText: "Size: " + currentText
- model: ["S", "M", "L"]
- }
- \endcode
-
- \sa currentText, textRole
-*/
-QString QQuickComboBox::displayText() const
-{
- Q_D(const QQuickComboBox);
- return d->displayText;
-}
-
-void QQuickComboBox::setDisplayText(const QString &text)
-{
- Q_D(QQuickComboBox);
- d->hasDisplayText = true;
- if (d->displayText != text) {
- d->displayText = text;
- emit displayTextChanged();
- }
-}
-
-void QQuickComboBox::resetDisplayText()
-{
- Q_D(QQuickComboBox);
- if (d->hasDisplayText) {
- d->hasDisplayText = false;
- d->updateCurrentText();
- }
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::ComboBox::textRole
-
- This property holds the model role used for populating the combo box.
-
- \sa model, currentText, displayText
-*/
-QString QQuickComboBox::textRole() const
-{
- Q_D(const QQuickComboBox);
- return d->textRole;
-}
-
-void QQuickComboBox::setTextRole(const QString &role)
-{
- Q_D(QQuickComboBox);
- if (d->textRole != role) {
- d->textRole = role;
- if (isComponentComplete())
- d->updateCurrentText();
- emit textRoleChanged();
- }
-}
-
-/*!
- \qmlproperty Component Qt.labs.controls::ComboBox::delegate
-
- This property holds a delegate that presents an item in the combo box popup.
-
- \sa ItemDelegate, {Customizing ComboBox}
-*/
-QQmlComponent *QQuickComboBox::delegate() const
-{
- Q_D(const QQuickComboBox);
- return d->delegate;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty Popup Qt.labs.controls::ComboBox::popup
-
- This property holds the popup.
-
- \sa {Customizing ComboBox}
-*/
-QQuickPopup *QQuickComboBox::popup() const
-{
- Q_D(const QQuickComboBox);
- return d->popup;
-}
-
-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();
- }
-}
-
-/*!
- \qmlmethod string Qt.labs.controls::ComboBox::textAt(int index)
-
- Returns the text for the specified \a index, or an empty string
- if the index is out of bounds.
-
- \sa textRole
-*/
-QString QQuickComboBox::textAt(int index) const
-{
- Q_D(const QQuickComboBox);
- if (!d->delegateModel || index < 0 || index >= d->delegateModel->count() || !d->delegateModel->object(index))
- return QString();
- return d->delegateModel->stringValue(index, d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole);
-}
-
-/*!
- \qmlmethod int Qt.labs.controls::ComboBox::find(string text, flags = Qt.MatchExactly)
-
- Returns the index of the specified \a text, or \c -1 if no match is found.
-
- The way the search is performed is defined by the specified match \a flags. By default,
- combo box performs case sensitive exact matching (\c Qt.MatchExactly). All other match
- types are case-insensitive unless the \c Qt.MatchCaseSensitive flag is also specified.
-
- \value Qt.MatchExactly The search term matches exactly (default).
- \value Qt.MatchRegExp The search term matches as a regular expression.
- \value Qt.MatchWildcard The search term matches using wildcards.
- \value Qt.MatchFixedString The search term matches as a fixed string.
- \value Qt.MatchStartsWith The search term matches the start of the item.
- \value Qt.MatchEndsWidth The search term matches the end of the item.
- \value Qt.MatchContains The search term is contained in the item.
- \value Qt.MatchCaseSensitive The search is case sensitive.
-
- \sa textRole
-*/
-int QQuickComboBox::find(const QString &text, Qt::MatchFlags flags) const
-{
- int itemCount = count();
- uint matchType = flags & 0x0F;
- Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
-
- for (int idx = 0; idx < itemCount; ++idx) {
- QString t = textAt(idx);
- switch (matchType) {
- case Qt::MatchExactly:
- if (t == text)
- return idx;
- break;
- case Qt::MatchRegExp:
- if (QRegExp(text, cs).exactMatch(t))
- return idx;
- break;
- case Qt::MatchWildcard:
- if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
- return idx;
- break;
- case Qt::MatchStartsWith:
- if (t.startsWith(text, cs))
- return idx;
- break;
- case Qt::MatchEndsWith:
- if (t.endsWith(text, cs))
- return idx;
- break;
- case Qt::MatchFixedString:
- if (t.compare(text, cs) == 0)
- return idx;
- break;
- case Qt::MatchContains:
- default:
- if (t.contains(text, cs))
- return idx;
- break;
- }
- }
- return -1;
-}
-
-void QQuickComboBox::focusOutEvent(QFocusEvent *event)
-{
- Q_D(QQuickComboBox);
- QQuickControl::focusOutEvent(event);
- d->hidePopup(false);
- setPressed(false);
-}
-
-void QQuickComboBox::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickComboBox);
- QQuickControl::keyPressEvent(event);
- if (!d->popup)
- return;
-
- switch (event->key()) {
- case Qt::Key_Escape:
- if (d->isPopupVisible())
- event->accept();
- break;
- case Qt::Key_Space:
- if (!event->isAutoRepeat())
- setPressed(true);
- event->accept();
- break;
- case Qt::Key_Enter:
- case Qt::Key_Return:
- if (d->isPopupVisible())
- setPressed(true);
- event->accept();
- break;
- case Qt::Key_Up:
- d->decrease();
- event->accept();
- break;
- case Qt::Key_Down:
- d->increase();
- event->accept();
- break;
- default:
- break;
- }
-}
-
-void QQuickComboBox::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickComboBox);
- QQuickControl::keyReleaseEvent(event);
- if (!d->popup || event->isAutoRepeat())
- return;
-
- switch (event->key()) {
- case Qt::Key_Space:
- d->togglePopup(true);
- setPressed(false);
- event->accept();
- break;
- case Qt::Key_Enter:
- case Qt::Key_Return:
- d->hidePopup(d->isPopupVisible());
- setPressed(false);
- event->accept();
- break;
- case Qt::Key_Escape:
- d->hidePopup(false);
- setPressed(false);
- event->accept();
- break;
- default:
- break;
- }
-}
-
-void QQuickComboBox::mousePressEvent(QMouseEvent *event)
-{
- QQuickControl::mousePressEvent(event);
- setPressed(true);
-}
-
-void QQuickComboBox::mouseMoveEvent(QMouseEvent* event)
-{
- QQuickControl::mouseMoveEvent(event);
- setPressed(contains(event->pos()));
-}
-
-void QQuickComboBox::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickComboBox);
- QQuickControl::mouseReleaseEvent(event);
- if (d->pressed) {
- setPressed(false);
- if (!d->isPopupVisible())
- forceActiveFocus(Qt::MouseFocusReason);
- d->togglePopup(false);
- }
-}
-
-void QQuickComboBox::mouseUngrabEvent()
-{
- QQuickControl::mouseUngrabEvent();
- setPressed(false);
-}
-
-void QQuickComboBox::componentComplete()
-{
- Q_D(QQuickComboBox);
- QQuickControl::componentComplete();
-
- if (d->delegateModel && d->ownModel)
- static_cast<QQmlDelegateModel *>(d->delegateModel)->componentComplete();
-
- if (count() > 0) {
- if (d->currentIndex == -1)
- setCurrentIndex(0);
- else
- d->updateCurrentText();
- }
-}
-
-QFont QQuickComboBox::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ComboMenuItemFont);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickcombobox_p.h b/src/templates/qquickcombobox_p.h
deleted file mode 100644
index 1d8f498a..00000000
--- a/src/templates/qquickcombobox_p.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCOMBOBOX_P_H
-#define QQUICKCOMBOBOX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPopup;
-class QQmlInstanceModel;
-class QQuickComboBoxPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickComboBox : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
- Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
- Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL)
- Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
- Q_PROPERTY(int highlightedIndex READ highlightedIndex NOTIFY highlightedIndexChanged FINAL)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
- Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged FINAL)
- Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText RESET resetDisplayText NOTIFY displayTextChanged FINAL)
- Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
- Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
- Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
-
-public:
- explicit QQuickComboBox(QQuickItem *parent = Q_NULLPTR);
- ~QQuickComboBox();
-
- int count() const;
-
- QVariant model() const;
- void setModel(const QVariant &model);
- QQmlInstanceModel *delegateModel() const;
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- int highlightedIndex() const;
-
- int currentIndex() const;
- void setCurrentIndex(int index);
-
- QString currentText() const;
-
- QString displayText() const;
- void setDisplayText(const QString &text);
- void resetDisplayText();
-
- QString textRole() const;
- void setTextRole(const QString &role);
-
- QQmlComponent *delegate() const;
- void setDelegate(QQmlComponent *delegate);
-
- QQuickPopup *popup() const;
- void setPopup(QQuickPopup *popup);
-
- Q_INVOKABLE QString textAt(int index) const;
- Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const;
-
-Q_SIGNALS:
- void countChanged();
- void modelChanged();
- void delegateModelChanged();
- void pressedChanged();
- void highlightedIndexChanged();
- void currentIndexChanged();
- void currentTextChanged();
- void displayTextChanged();
- void textRoleChanged();
- void delegateChanged();
- void popupChanged();
-
- void activated(int index);
- 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 componentComplete() Q_DECL_OVERRIDE;
-
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
-private:
- Q_DISABLE_COPY(QQuickComboBox)
- Q_DECLARE_PRIVATE(QQuickComboBox)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickComboBox)
-
-#endif // QQUICKCOMBOBOX_P_H
diff --git a/src/templates/qquickcontainer.cpp b/src/templates/qquickcontainer.cpp
deleted file mode 100644
index 58337752..00000000
--- a/src/templates/qquickcontainer.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcontainer_p.h"
-#include "qquickcontainer_p_p.h"
-
-#include <QtQuick/private/qquickflickable_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Container
- \inherits Control
- \instantiates QQuickContainer
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief A container control base type.
-
- Container is the base type of container-like user interface controls.
-
- \labs
-
- \sa {Container Controls}
-*/
-
-static QQuickItem *effectiveContentItem(QQuickItem *item)
-{
- QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(item);
- if (flickable)
- return flickable->contentItem();
- return item;
-}
-
-QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(Q_NULLPTR), currentIndex(-1), updatingCurrent(false)
-{
-}
-
-void QQuickContainerPrivate::init()
-{
- Q_Q(QQuickContainer);
- contentModel = new QQmlObjectModel(q);
- QObject::connect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged);
- QObject::connect(contentModel, &QQmlObjectModel::childrenChanged, q, &QQuickContainer::contentChildrenChanged);
-}
-
-void QQuickContainerPrivate::cleanup()
-{
- Q_Q(QQuickContainer);
- // ensure correct destruction order (QTBUG-46798)
- const int count = contentModel->count();
- for (int i = 0; i < count; ++i) {
- QQuickItem *item = itemAt(i);
- if (item)
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder);
- }
-
- QQuickItem *focusItem = QQuickItemPrivate::get(contentItem)->subFocusItem;
- if (focusItem && window)
- QQuickWindowPrivate::get(window)->clearFocusInScope(contentItem, focusItem, Qt::OtherFocusReason);
-
- q->contentItemChange(Q_NULLPTR, contentItem);
- delete contentItem;
-
- QObject::disconnect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged);
- QObject::disconnect(contentModel, &QQmlObjectModel::childrenChanged, q, &QQuickContainer::contentChildrenChanged);
- delete contentModel;
-}
-
-QQuickItem *QQuickContainerPrivate::itemAt(int index) const
-{
- return qobject_cast<QQuickItem *>(contentModel->get(index));
-}
-
-void QQuickContainerPrivate::insertItem(int index, QQuickItem *item)
-{
- Q_Q(QQuickContainer);
- if (!q->isContent(item))
- return;
- contentData.append(item);
-
- updatingCurrent = true;
-
- item->setParentItem(effectiveContentItem(contentItem));
- QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder);
- contentModel->insert(index, item);
-
- q->itemAdded(index, item);
-
- if (contentModel->count() == 1 && currentIndex == -1) {
- Q_Q(QQuickContainer);
- q->setCurrentIndex(index);
- }
-
- updatingCurrent = false;
-}
-
-void QQuickContainerPrivate::moveItem(int from, int to)
-{
- Q_Q(QQuickContainer);
- int oldCurrent = currentIndex;
- contentModel->move(from, to);
-
- updatingCurrent = true;
-
- if (from == oldCurrent)
- q->setCurrentIndex(to);
- else if (from < oldCurrent && to >= oldCurrent)
- q->setCurrentIndex(oldCurrent - 1);
- else if (from > oldCurrent && to <= oldCurrent)
- q->setCurrentIndex(oldCurrent + 1);
-
- updatingCurrent = false;
-}
-
-void QQuickContainerPrivate::removeItem(int index, QQuickItem *item)
-{
- Q_Q(QQuickContainer);
- if (!q->isContent(item))
- return;
- contentData.removeOne(item);
-
- updatingCurrent = true;
-
- bool currentChanged = false;
- if (index == currentIndex) {
- q->setCurrentIndex(currentIndex - 1);
- } else if (index < currentIndex) {
- --currentIndex;
- currentChanged = true;
- }
-
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder);
- item->setParentItem(Q_NULLPTR);
- contentModel->remove(index);
-
- q->itemRemoved(index, item);
-
- if (currentChanged)
- emit q->currentIndexChanged();
-
- updatingCurrent = false;
-}
-
-void QQuickContainerPrivate::_q_currentIndexChanged()
-{
- Q_Q(QQuickContainer);
- if (!updatingCurrent)
- q->setCurrentIndex(contentItem ? contentItem->property("currentIndex").toInt() : -1);
-}
-
-void QQuickContainerPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
-{
- // add dynamically reparented items (eg. by a Repeater)
- if (!QQuickItemPrivate::get(child)->isTransparentForPositioner() && !contentData.contains(child))
- insertItem(contentModel->count(), child);
-}
-
-void QQuickContainerPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
-{
- // remove dynamically unparented items (eg. by a Repeater)
- if (!parent)
- removeItem(contentModel->indexOf(item, Q_NULLPTR), item);
-}
-
-void QQuickContainerPrivate::itemSiblingOrderChanged(QQuickItem *)
-{
- // reorder the restacked items (eg. by a Repeater)
- Q_Q(QQuickContainer);
- 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);
- q->moveItem(index, i);
- }
-}
-
-void QQuickContainerPrivate::itemDestroyed(QQuickItem *item)
-{
- int index = contentModel->indexOf(item, Q_NULLPTR);
- if (index != -1)
- removeItem(index, item);
-}
-
-void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
-{
- QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
- QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
- QQuickItem *item = qobject_cast<QQuickItem *>(obj);
- if (item) {
- if (QQuickItemPrivate::get(item)->isTransparentForPositioner())
- item->setParentItem(effectiveContentItem(p->contentItem));
- else if (p->contentModel->indexOf(item, Q_NULLPTR) == -1)
- q->addItem(item);
- } else {
- p->contentData.append(obj);
- }
-}
-
-int QQuickContainerPrivate::contentData_count(QQmlListProperty<QObject> *prop)
-{
- QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
- return p->contentData.count();
-}
-
-QObject *QQuickContainerPrivate::contentData_at(QQmlListProperty<QObject> *prop, int index)
-{
- QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
- return p->contentData.value(index);
-}
-
-void QQuickContainerPrivate::contentData_clear(QQmlListProperty<QObject> *prop)
-{
- QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
- p->contentData.clear();
-}
-
-void QQuickContainerPrivate::contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *item)
-{
- QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
- q->addItem(item);
-}
-
-int QQuickContainerPrivate::contentChildren_count(QQmlListProperty<QQuickItem> *prop)
-{
- QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
- return p->contentModel->count();
-}
-
-QQuickItem *QQuickContainerPrivate::contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index)
-{
- QQuickContainer *q = static_cast<QQuickContainer *>(prop->object);
- return q->itemAt(index);
-}
-
-void QQuickContainerPrivate::contentChildren_clear(QQmlListProperty<QQuickItem> *prop)
-{
- QQuickContainerPrivate *p = static_cast<QQuickContainerPrivate *>(prop->data);
- p->contentModel->clear();
-}
-
-QQuickContainer::QQuickContainer(QQuickItem *parent) :
- QQuickControl(*(new QQuickContainerPrivate), parent)
-{
- Q_D(QQuickContainer);
- d->init();
-}
-
-QQuickContainer::QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent) :
- QQuickControl(dd, parent)
-{
- Q_D(QQuickContainer);
- d->init();
-}
-
-QQuickContainer::~QQuickContainer()
-{
- Q_D(QQuickContainer);
- d->cleanup();
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::Container::count
- \readonly
-
- This property holds the number of items.
-*/
-int QQuickContainer::count() const
-{
- Q_D(const QQuickContainer);
- return d->contentModel->count();
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::Container::itemAt(int index)
-
- Returns the item at \a index, or \c null if it does not exist.
-*/
-QQuickItem *QQuickContainer::itemAt(int index) const
-{
- Q_D(const QQuickContainer);
- return d->itemAt(index);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Container::addItem(Item item)
-
- Adds an \a item.
-*/
-void QQuickContainer::addItem(QQuickItem *item)
-{
- Q_D(QQuickContainer);
- insertItem(d->contentModel->count(), item);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Container::insertItem(int index, Item item)
-
- Inserts an \a item at \a index.
-*/
-void QQuickContainer::insertItem(int index, QQuickItem *item)
-{
- Q_D(QQuickContainer);
- if (!item)
- return;
- const int count = d->contentModel->count();
- if (index < 0 || index > count)
- index = count;
-
- int oldIndex = d->contentModel->indexOf(item, Q_NULLPTR);
- if (oldIndex != -1) {
- if (oldIndex < index)
- --index;
- if (oldIndex != index)
- d->moveItem(oldIndex, index);
- } else {
- d->insertItem(index, item);
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Container::moveItem(int from, int to)
-
- Moves an item \a from one index \a to another.
-*/
-void QQuickContainer::moveItem(int from, int to)
-{
- Q_D(QQuickContainer);
- const int count = d->contentModel->count();
- if (from < 0 || from > count - 1)
- return;
- if (to < 0 || to > count - 1)
- to = count - 1;
-
- if (from != to)
- d->moveItem(from, to);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Container::removeItem(int index)
-
- Removes an item at \a index.
-
- \note The ownership of the item is transferred to the caller.
-*/
-void QQuickContainer::removeItem(int index)
-{
- Q_D(QQuickContainer);
- const int count = d->contentModel->count();
- if (index < 0 || index >= count)
- return;
-
- QQuickItem *item = itemAt(index);
- if (item)
- d->removeItem(index, item);
-}
-
-/*!
- \qmlproperty model Qt.labs.controls::Container::contentModel
- \readonly
-
- This property holds the content model of items.
-*/
-QVariant QQuickContainer::contentModel() const
-{
- Q_D(const QQuickContainer);
- return QVariant::fromValue(d->contentModel);
-}
-
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Container::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickContainer::contentData()
-{
- Q_D(QQuickContainer);
- return QQmlListProperty<QObject>(this, d,
- QQuickContainerPrivate::contentData_append,
- QQuickContainerPrivate::contentData_count,
- QQuickContainerPrivate::contentData_at,
- QQuickContainerPrivate::contentData_clear);
-}
-
-/*!
- \qmlproperty list<Item> Qt.labs.controls::Container::contentChildren
-
- This property holds the list of content children.
-
- \sa Item::children
-*/
-QQmlListProperty<QQuickItem> QQuickContainer::contentChildren()
-{
- Q_D(QQuickContainer);
- return QQmlListProperty<QQuickItem>(this, d,
- QQuickContainerPrivate::contentChildren_append,
- QQuickContainerPrivate::contentChildren_count,
- QQuickContainerPrivate::contentChildren_at,
- QQuickContainerPrivate::contentChildren_clear);
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::Container::currentIndex
-
- This property holds the index of the current item in the container.
-*/
-int QQuickContainer::currentIndex() const
-{
- Q_D(const QQuickContainer);
- return d->currentIndex;
-}
-
-void QQuickContainer::setCurrentIndex(int index)
-{
- Q_D(QQuickContainer);
- if (d->currentIndex != index) {
- d->currentIndex = index;
- emit currentIndexChanged();
- emit currentItemChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Container::currentItem
-
- This property holds the current item.
-*/
-QQuickItem *QQuickContainer::currentItem() const
-{
- Q_D(const QQuickContainer);
- return itemAt(d->currentIndex);
-}
-
-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)
- addItem(data.item);
- }
-}
-
-void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_D(QQuickContainer);
- QQuickControl::contentItemChange(newItem, oldItem);
-
- static const int slotIndex = metaObject()->indexOfSlot("_q_currentIndexChanged()");
-
- if (oldItem) {
- QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
- QQuickItem *oldContentItem = effectiveContentItem(oldItem);
- if (oldContentItem != oldItem)
- QQuickItemPrivate::get(oldContentItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
-
- int signalIndex = oldItem->metaObject()->indexOfSignal("currentIndexChanged()");
- if (signalIndex != -1)
- QMetaObject::disconnect(oldItem, signalIndex, this, slotIndex);
- }
-
- if (newItem) {
- QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
- QQuickItem *newContentItem = effectiveContentItem(newItem);
- if (newContentItem != newItem)
- QQuickItemPrivate::get(newContentItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
-
- int signalIndex = newItem->metaObject()->indexOfSignal("currentIndexChanged()");
- if (signalIndex != -1)
- QMetaObject::connect(newItem, signalIndex, this, slotIndex);
- }
-}
-
-bool QQuickContainer::isContent(QQuickItem *item) const
-{
- // If the item has a QML context associated to it (it was created in QML),
- // we add it to the content model. Otherwise, it's probably the default
- // highlight item that is always created by the item views, which we need
- // to exclude.
- //
- // TODO: Find a better way to identify/exclude the highlight item...
- return qmlContext(item);
-}
-
-void QQuickContainer::itemAdded(int index, QQuickItem *item)
-{
- Q_UNUSED(index);
- Q_UNUSED(item);
-}
-
-void QQuickContainer::itemRemoved(int index, QQuickItem *item)
-{
- Q_UNUSED(index);
- Q_UNUSED(item);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qquickcontainer_p.cpp"
diff --git a/src/templates/qquickcontainer_p.h b/src/templates/qquickcontainer_p.h
deleted file mode 100644
index 83476f66..00000000
--- a/src/templates/qquickcontainer_p.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCONTAINER_P_H
-#define QQUICKCONTAINER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtQml/qqmllist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickContainerPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickContainer : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
- Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
- Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentData")
-
-public:
- explicit QQuickContainer(QQuickItem *parent = Q_NULLPTR);
- ~QQuickContainer();
-
- int count() const;
- Q_INVOKABLE QQuickItem *itemAt(int index) const;
- Q_INVOKABLE void addItem(QQuickItem *item);
- Q_INVOKABLE void insertItem(int index, QQuickItem *item);
- Q_INVOKABLE void moveItem(int from, int to);
- Q_INVOKABLE void removeItem(int index);
-
- QVariant contentModel() const;
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
- int currentIndex() const;
- QQuickItem *currentItem() const;
-
-public Q_SLOTS:
- void setCurrentIndex(int index);
-
-Q_SIGNALS:
- void countChanged();
- void contentChildrenChanged();
- void currentIndexChanged();
- void currentItemChanged();
-
-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;
-
- virtual bool isContent(QQuickItem *item) const;
- virtual void itemAdded(int index, QQuickItem *item);
- virtual void itemRemoved(int index, QQuickItem *item);
-
-private:
- Q_DISABLE_COPY(QQuickContainer)
- Q_DECLARE_PRIVATE(QQuickContainer)
- Q_PRIVATE_SLOT(d_func(), void _q_currentIndexChanged())
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickContainer)
-
-#endif // QQUICKCONTAINER_P_H
diff --git a/src/templates/qquickcontainer_p_p.h b/src/templates/qquickcontainer_p_p.h
deleted file mode 100644
index 6eb79c88..00000000
--- a/src/templates/qquickcontainer_p_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCONTAINER_P_P_H
-#define QQUICKCONTAINER_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LABSTEMPLATES_EXPORT QQuickContainerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickContainer)
-
-public:
- QQuickContainerPrivate();
-
- void init();
- void cleanup();
-
- QQuickItem *itemAt(int index) const;
- void insertItem(int index, QQuickItem *item);
- void moveItem(int from, int to);
- void removeItem(int index, QQuickItem *item);
-
- 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;
-
- static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
- static int contentData_count(QQmlListProperty<QObject> *prop);
- static QObject *contentData_at(QQmlListProperty<QObject> *prop, int index);
- static void contentData_clear(QQmlListProperty<QObject> *prop);
-
- static void contentChildren_append(QQmlListProperty<QQuickItem> *prop, QQuickItem *obj);
- static int contentChildren_count(QQmlListProperty<QQuickItem> *prop);
- static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index);
- static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop);
-
- QObjectList contentData;
- QQmlObjectModel *contentModel;
- int currentIndex;
- bool updatingCurrent;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKCONTAINER_P_P_H
diff --git a/src/templates/qquickcontrol.cpp b/src/templates/qquickcontrol.cpp
deleted file mode 100644
index 5522b996..00000000
--- a/src/templates/qquickcontrol.cpp
+++ /dev/null
@@ -1,912 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcontrol_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qguiapplication.h>
-#include "qquicklabel_p.h"
-#include "qquicklabel_p_p.h"
-#include "qquicktextarea_p.h"
-#include "qquicktextarea_p_p.h"
-#include "qquicktextfield_p.h"
-#include "qquicktextfield_p_p.h"
-#include "qquickpopup_p.h"
-#include "qquickpopup_p_p.h"
-#include "qquickapplicationwindow_p.h"
-
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/qpa/qplatformtheme.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtQuick/private/qquickaccessibleattached_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Control
- \inherits Item
- \instantiates QQuickControl
- \inqmlmodule Qt.labs.controls
- \brief A user interface control.
-
- Control is the base type of user interface controls.
-
- \labs
-*/
-
-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)
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::installActivationObserver(this);
-#endif
-}
-
-QQuickControlPrivate::~QQuickControlPrivate()
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::removeActivationObserver(this);
-#endif
-}
-
-void QQuickControlPrivate::mirrorChange()
-{
- Q_Q(QQuickControl);
- if (locale.textDirection() == Qt::LeftToRight)
- q->mirrorChange();
-}
-
-void QQuickControlPrivate::setTopPadding(qreal value, bool reset)
-{
- Q_Q(QQuickControl);
- qreal oldPadding = q->topPadding();
- topPadding = value;
- hasTopPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
- emit q->topPaddingChanged();
- emit q->availableHeightChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(leftPadding, oldPadding, rightPadding, bottomPadding));
- }
-}
-
-void QQuickControlPrivate::setLeftPadding(qreal value, bool reset)
-{
- Q_Q(QQuickControl);
- qreal oldPadding = q->leftPadding();
- leftPadding = value;
- hasLeftPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
- emit q->leftPaddingChanged();
- emit q->availableWidthChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(oldPadding, topPadding, rightPadding, bottomPadding));
- }
-}
-
-void QQuickControlPrivate::setRightPadding(qreal value, bool reset)
-{
- Q_Q(QQuickControl);
- qreal oldPadding = q->rightPadding();
- rightPadding = value;
- hasRightPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
- emit q->rightPaddingChanged();
- emit q->availableWidthChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(leftPadding, topPadding, oldPadding, bottomPadding));
- }
-}
-
-void QQuickControlPrivate::setBottomPadding(qreal value, bool reset)
-{
- Q_Q(QQuickControl);
- qreal oldPadding = q->bottomPadding();
- bottomPadding = value;
- hasBottomPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
- emit q->bottomPaddingChanged();
- emit q->availableHeightChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(leftPadding, topPadding, rightPadding, oldPadding));
- }
-}
-
-void QQuickControlPrivate::resizeBackground()
-{
- Q_Q(QQuickControl);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- background->setHeight(q->height());
- p->heightValid = false;
- }
- }
-}
-
-void QQuickControlPrivate::resizeContent()
-{
- Q_Q(QQuickControl);
- if (contentItem) {
- contentItem->setPosition(QPointF(q->leftPadding(), q->topPadding()));
- contentItem->setSize(QSizeF(q->availableWidth(), q->availableHeight()));
- }
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickControlPrivate::accessibilityActiveChanged(bool active)
-{
- Q_Q(QQuickControl);
- return q->accessibilityActiveChanged(active);
-}
-
-QAccessible::Role QQuickControlPrivate::accessibleRole() const
-{
- Q_Q(const QQuickControl);
- return q->accessibleRole();
-}
-
-QAccessible::Role QQuickControl::accessibleRole() const
-{
- return QAccessible::NoRole;
-}
-
-void QQuickControl::accessibilityActiveChanged(bool active)
-{
- Q_D(QQuickControl);
- if (d->accessibleAttached || !active)
- return;
-
- d->accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(this, true));
-
- // QQuickControl relies on the existence of a QQuickAccessibleAttached object.
- // However, qmlAttachedPropertiesObject(create=true) creates an instance only
- // for items that have been created by a QML engine. Therefore we create the
- // object by hand for items created in C++ (QQuickPopupItem, for instance).
- if (!d->accessibleAttached)
- d->accessibleAttached = new QQuickAccessibleAttached(this);
-
- d->accessibleAttached->setRole(accessibleRole());
-}
-#endif
-
-/*!
- \internal
-
- Returns the font that the control w inherits from its ancestors and
- QGuiApplication::font.
-*/
-QFont QQuickControlPrivate::naturalControlFont(const QQuickItem *q)
-{
- QQuickItem *p = q->parentItem();
- while (p) {
- if (QQuickControl *control = qobject_cast<QQuickControl *>(p))
- return control->font();
- else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(p))
- return label->font();
- else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(p))
- return textField->font();
- else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(p))
- return textArea->font();
-
- p = p->parentItem();
- }
-
- if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(q->window()))
- return window->font();
-
- return themeFont(QPlatformTheme::SystemFont);
-}
-
-QFont QQuickControlPrivate::themeFont(QPlatformTheme::Font type)
-{
- if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
- if (const QFont *font = theme->font(type)) {
- QFont f = *font;
- if (type == QPlatformTheme::SystemFont)
- f.resolve(0);
- return f;
- }
- }
-
- return QFont();
-}
-
-/*!
- \internal
-
- Determine which font is implicitly imposed on this control by its ancestors
- and QGuiApplication::font, resolve this against its own font (attributes from
- the implicit font are copied over). Then propagate this font to this
- control's children.
-*/
-void QQuickControlPrivate::resolveFont()
-{
- Q_Q(QQuickControl);
- inheritFont(naturalControlFont(q));
-}
-
-void QQuickControlPrivate::inheritFont(const QFont &f)
-{
- Q_Q(QQuickControl);
- QFont parentFont = font.resolve(f);
- parentFont.resolve(font.resolve() | f.resolve());
-
- const QFont defaultFont = q->defaultFont();
- const QFont resolvedFont = parentFont.resolve(defaultFont);
-
- setFont_helper(resolvedFont);
-}
-
-/*!
- \internal
-
- Assign \a font to this control, and propagate it to all children.
-*/
-void QQuickControlPrivate::updateFont(const QFont &f)
-{
- Q_Q(QQuickControl);
- const bool changed = resolvedFont != f;
- resolvedFont = f;
-
- QQuickControlPrivate::updateFontRecur(q, f);
-
- if (changed)
- emit q->fontChanged();
-}
-
-void QQuickControlPrivate::updateFontRecur(QQuickItem *item, const QFont &f)
-{
- foreach (QQuickItem *child, item->childItems()) {
- if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
- QQuickControlPrivate::get(control)->inheritFont(f);
- else if (QQuickLabel *label = qobject_cast<QQuickLabel *>(child))
- QQuickLabelPrivate::get(label)->inheritFont(f);
- else if (QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(child))
- QQuickTextAreaPrivate::get(textArea)->inheritFont(f);
- else if (QQuickTextField *textField = qobject_cast<QQuickTextField *>(child))
- QQuickTextFieldPrivate::get(textField)->inheritFont(f);
- else
- QQuickControlPrivate::updateFontRecur(child, f);
- }
-}
-
-QString QQuickControl::accessibleName() const
-{
-#ifndef QT_NO_ACCESSIBILITY
- Q_D(const QQuickControl);
- if (d->accessibleAttached)
- return d->accessibleAttached->name();
-#endif
- return QString();
-}
-
-void QQuickControl::setAccessibleName(const QString &name)
-{
-#ifndef QT_NO_ACCESSIBILITY
- Q_D(QQuickControl);
- if (d->accessibleAttached)
- d->accessibleAttached->setName(name);
-#else
- Q_UNUSED(name)
-#endif
-}
-
-QVariant QQuickControl::accessibleProperty(const char *propertyName)
-{
-#ifndef QT_NO_ACCESSIBILITY
- Q_D(QQuickControl);
- if (d->accessibleAttached)
- return QQuickAccessibleAttached::property(this, propertyName);
-#endif
- Q_UNUSED(propertyName)
- return QVariant();
-}
-
-bool QQuickControl::setAccessibleProperty(const char *propertyName, const QVariant &value)
-{
-#ifndef QT_NO_ACCESSIBILITY
- Q_D(QQuickControl);
- if (d->accessibleAttached)
- return QQuickAccessibleAttached::setProperty(this, propertyName, value);
-#endif
- Q_UNUSED(propertyName)
- Q_UNUSED(value)
- return false;
-}
-
-QQuickControl::QQuickControl(QQuickItem *parent) :
- QQuickItem(*(new QQuickControlPrivate), parent)
-{
-}
-
-QQuickControl::QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent) :
- QQuickItem(dd, parent)
-{
-}
-
-void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
-{
- Q_D(QQuickControl);
- QQuickItem::itemChange(change, value);
- if (change == ItemParentHasChanged && value.item) {
- d->resolveFont();
- if (!d->hasLocale)
- d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
- }
-}
-
-/*!
- \qmlproperty font Qt.labs.controls::Control::font
-
- This property holds the font currently set for the control.
-
- This property describes the control's requested font. The font is used by the control's
- style when rendering standard components, and is available as a means to ensure that custom
- controls can maintain consistency with the native platform's native look and feel. It's common
- that different platforms, or different styles, define different fonts for an application.
-
- The default font depends on the system environment. ApplicationWindow maintains a system/theme
- font which serves as a default for all controls. There may also be special font defaults for
- certain types of controls. You can also set the default font for controls by passing a custom
- font to QGuiApplication::setFont(), before loading the QML. Finally, the font is matched
- against Qt's font database to find the best match.
-
- Control propagates explicit font properties from parent to children. If you change a specific
- property on a control's font, that property propagates to all of the control's children,
- overriding any system defaults for that property.
-*/
-QFont QQuickControl::font() const
-{
- Q_D(const QQuickControl);
- return d->resolvedFont;
-}
-
-void QQuickControl::setFont(const QFont &font)
-{
- Q_D(QQuickControl);
- if (d->font.resolve() == font.resolve() && d->font == font)
- return;
-
- d->font = font;
- d->resolveFont();
-}
-
-void QQuickControl::resetFont()
-{
- setFont(QFont());
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::availableWidth
- \readonly
-
- This property holds the width available after deducting horizontal padding.
-
- \sa padding, leftPadding, rightPadding
-*/
-qreal QQuickControl::availableWidth() const
-{
- return qMax<qreal>(0.0, width() - leftPadding() - rightPadding());
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::availableHeight
- \readonly
-
- This property holds the height available after deducting vertical padding.
-
- \sa padding, topPadding, bottomPadding
-*/
-qreal QQuickControl::availableHeight() const
-{
- return qMax<qreal>(0.0, height() - topPadding() - bottomPadding());
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::padding
-
- This property holds the default padding.
-
- \sa availableWidth, availableHeight, topPadding, leftPadding, rightPadding, bottomPadding
-*/
-qreal QQuickControl::padding() const
-{
- Q_D(const QQuickControl);
- return d->padding;
-}
-
-void QQuickControl::setPadding(qreal padding)
-{
- Q_D(QQuickControl);
- if (qFuzzyCompare(d->padding, padding))
- return;
- QMarginsF oldPadding(leftPadding(), topPadding(), rightPadding(), bottomPadding());
- d->padding = padding;
- emit paddingChanged();
- QMarginsF newPadding(leftPadding(), topPadding(), rightPadding(), bottomPadding());
- if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
- emit topPaddingChanged();
- if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
- emit leftPaddingChanged();
- if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
- emit rightPaddingChanged();
- if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
- emit bottomPaddingChanged();
- if (!qFuzzyCompare(newPadding.top(), oldPadding.top()) || !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
- emit availableHeightChanged();
- if (!qFuzzyCompare(newPadding.left(), oldPadding.left()) || !qFuzzyCompare(newPadding.right(), oldPadding.right()))
- emit availableWidthChanged();
- paddingChange(newPadding, oldPadding);
-}
-
-void QQuickControl::resetPadding()
-{
- setPadding(0);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::topPadding
-
- This property holds the top padding.
-
- \sa padding, bottomPadding, availableHeight
-*/
-qreal QQuickControl::topPadding() const
-{
- Q_D(const QQuickControl);
- if (d->hasTopPadding)
- return d->topPadding;
- return d->padding;
-}
-
-void QQuickControl::setTopPadding(qreal padding)
-{
- Q_D(QQuickControl);
- d->setTopPadding(padding);
-}
-
-void QQuickControl::resetTopPadding()
-{
- Q_D(QQuickControl);
- d->setTopPadding(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::leftPadding
-
- This property holds the left padding.
-
- \sa padding, rightPadding, availableWidth
-*/
-qreal QQuickControl::leftPadding() const
-{
- Q_D(const QQuickControl);
- if (d->hasLeftPadding)
- return d->leftPadding;
- return d->padding;
-}
-
-void QQuickControl::setLeftPadding(qreal padding)
-{
- Q_D(QQuickControl);
- d->setLeftPadding(padding);
-}
-
-void QQuickControl::resetLeftPadding()
-{
- Q_D(QQuickControl);
- d->setLeftPadding(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::rightPadding
-
- This property holds the right padding.
-
- \sa padding, leftPadding, availableWidth
-*/
-qreal QQuickControl::rightPadding() const
-{
- Q_D(const QQuickControl);
- if (d->hasRightPadding)
- return d->rightPadding;
- return d->padding;
-}
-
-void QQuickControl::setRightPadding(qreal padding)
-{
- Q_D(QQuickControl);
- d->setRightPadding(padding);
-}
-
-void QQuickControl::resetRightPadding()
-{
- Q_D(QQuickControl);
- d->setRightPadding(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::bottomPadding
-
- This property holds the bottom padding.
-
- \sa padding, topPadding, availableHeight
-*/
-qreal QQuickControl::bottomPadding() const
-{
- Q_D(const QQuickControl);
- if (d->hasBottomPadding)
- return d->bottomPadding;
- return d->padding;
-}
-
-void QQuickControl::setBottomPadding(qreal padding)
-{
- Q_D(QQuickControl);
- d->setBottomPadding(padding);
-}
-
-void QQuickControl::resetBottomPadding()
-{
- Q_D(QQuickControl);
- d->setBottomPadding(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Control::spacing
-
- This property holds the spacing.
-*/
-qreal QQuickControl::spacing() const
-{
- Q_D(const QQuickControl);
- return d->spacing;
-}
-
-void QQuickControl::setSpacing(qreal spacing)
-{
- Q_D(QQuickControl);
- if (!qFuzzyCompare(d->spacing, spacing)) {
- d->spacing = spacing;
- emit spacingChanged();
- }
-}
-
-void QQuickControl::resetSpacing()
-{
- setSpacing(0);
-}
-
-/*!
- \qmlproperty Locale Qt.labs.controls::Control::locale
-
- This property holds the locale of the control.
-
- \sa mirrored, {LayoutMirroring}{LayoutMirroring}
-*/
-QLocale QQuickControl::locale() const
-{
- Q_D(const QQuickControl);
- return d->locale;
-}
-
-void QQuickControl::setLocale(const QLocale &locale)
-{
- Q_D(QQuickControl);
- if (d->hasLocale && d->locale == locale)
- return;
-
- d->updateLocale(locale, true); // explicit=true
-}
-
-void QQuickControl::resetLocale()
-{
- Q_D(QQuickControl);
- if (!d->hasLocale)
- return;
-
- d->hasLocale = false;
- d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
-}
-
-QLocale QQuickControlPrivate::calcLocale(const QQuickItem *item)
-{
- const QQuickItem *p = item;
- while (p) {
- if (const QQuickPopupItem *popup = qobject_cast<const QQuickPopupItem *>(p)) {
- item = popup;
- break;
- }
-
- if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
- return control->locale();
-
- QVariant v = p->property("locale");
- if (v.isValid() && v.userType() == QMetaType::QLocale)
- return v.toLocale();
-
- p = p->parentItem();
- }
-
- if (item) {
- if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
- return window->locale();
- }
-
- return QLocale();
-}
-
-void QQuickControlPrivate::updateLocale(const QLocale &l, bool e)
-{
- Q_Q(QQuickControl);
- if (!e && hasLocale)
- return;
-
- QLocale old = q->locale();
- hasLocale = e;
- if (old != l) {
- bool wasMirrored = q->isMirrored();
- q->localeChange(l, old);
- locale = l;
- QQuickControlPrivate::updateLocaleRecur(q, l);
- emit q->localeChanged();
- if (wasMirrored != q->isMirrored())
- q->mirrorChange();
- }
-}
-
-void QQuickControlPrivate::updateLocaleRecur(QQuickItem *item, const QLocale &l)
-{
- foreach (QQuickItem *child, item->childItems()) {
- if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
- QQuickControlPrivate::get(control)->updateLocale(l, false);
- else
- updateLocaleRecur(child, l);
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Control::mirrored
- \readonly
-
- This property holds whether the control is mirrored.
-
- This property is provided for convenience. A control is considered mirrored
- when its visual layout direction is right-to-left.
-
- \sa locale, {LayoutMirroring}{LayoutMirroring}
-*/
-bool QQuickControl::isMirrored() const
-{
- Q_D(const QQuickControl);
- return d->isMirrored() || d->locale.textDirection() == Qt::RightToLeft;
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Control::focusReason
- \readonly
-
- This property holds the reason of the last focus change.
-
- \note This property does not indicate whether the control has \l {Item::activeFocus}
- {active focus}, but the reason why the control either gained or lost focus.
-
- \value Qt.MouseFocusReason A mouse action occurred.
- \value Qt.TabFocusReason The Tab key was pressed.
- \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
- \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
- \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
- \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
- \value Qt.MenuBarFocusReason The menu bar took focus.
- \value Qt.OtherFocusReason Another reason, usually application-specific.
-
- \sa Item::activeFocus
-*/
-Qt::FocusReason QQuickControl::focusReason() const
-{
- Q_D(const QQuickControl);
- return d->focusReason;
-}
-
-void QQuickControl::setFocusReason(Qt::FocusReason reason)
-{
- Q_D(QQuickControl);
- if (d->focusReason != reason) {
- d->focusReason = reason;
- emit focusReasonChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Control::background
-
- This property holds the background item.
-
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
-*/
-QQuickItem *QQuickControl::background() const
-{
- Q_D(const QQuickControl);
- return d->background;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Control::contentItem
-
- This property holds the visual content item.
-
- \note The content item is automatically resized inside the \l padding of the control.
-*/
-QQuickItem *QQuickControl::contentItem() const
-{
- Q_D(const QQuickControl);
- return d->contentItem;
-}
-
-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();
- }
-}
-
-void QQuickControl::classBegin()
-{
- Q_D(QQuickControl);
- QQuickItem::classBegin();
- d->resolveFont();
-}
-
-void QQuickControl::componentComplete()
-{
- Q_D(QQuickControl);
- QQuickItem::componentComplete();
- if (!d->hasLocale)
- d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
-#ifndef QT_NO_ACCESSIBILITY
- if (!d->accessibleAttached && QAccessible::isActive())
- accessibilityActiveChanged(true);
-#endif
-}
-
-QFont QQuickControl::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
-}
-
-void QQuickControl::focusInEvent(QFocusEvent *event)
-{
- QQuickItem::focusInEvent(event);
- setFocusReason(event->reason());
-}
-
-void QQuickControl::focusOutEvent(QFocusEvent *event)
-{
- QQuickItem::focusOutEvent(event);
- setFocusReason(event->reason());
-}
-
-void QQuickControl::mousePressEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickControl::mouseMoveEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickControl::mouseReleaseEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickControl::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickControl);
- QQuickItem::geometryChanged(newGeometry, oldGeometry);
- d->resizeBackground();
- d->resizeContent();
- if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width()))
- emit availableWidthChanged();
- if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height()))
- emit availableHeightChanged();
-}
-
-void QQuickControl::mirrorChange()
-{
- emit mirroredChanged();
-}
-
-void QQuickControl::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
-{
- Q_D(QQuickControl);
- Q_UNUSED(newPadding);
- Q_UNUSED(oldPadding);
- d->resizeContent();
-}
-
-void QQuickControl::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_UNUSED(newItem);
- Q_UNUSED(oldItem);
-}
-
-void QQuickControl::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
-{
- Q_UNUSED(newLocale);
- Q_UNUSED(oldLocale);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickcontrol_p.h b/src/templates/qquickcontrol_p.h
deleted file mode 100644
index 8d4055e5..00000000
--- a/src/templates/qquickcontrol_p.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCONTROL_P_H
-#define QQUICKCONTROL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qlocale.h>
-#include <QtQuick/qquickitem.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickControlPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickControl : public QQuickItem
-{
- Q_OBJECT
- Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged)
- Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL)
- Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL)
- Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
- Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
- Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
- Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
- Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
- Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
- Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL)
- Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
- Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
- Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
-
-public:
- explicit QQuickControl(QQuickItem *parent = Q_NULLPTR);
-
- QFont font() const;
- void setFont(const QFont &);
- void resetFont();
-
- qreal availableWidth() const;
- qreal availableHeight() const;
-
- qreal padding() const;
- void setPadding(qreal padding);
- void resetPadding();
-
- qreal topPadding() const;
- void setTopPadding(qreal padding);
- void resetTopPadding();
-
- qreal leftPadding() const;
- void setLeftPadding(qreal padding);
- void resetLeftPadding();
-
- qreal rightPadding() const;
- void setRightPadding(qreal padding);
- void resetRightPadding();
-
- qreal bottomPadding() const;
- void setBottomPadding(qreal padding);
- void resetBottomPadding();
-
- qreal spacing() const;
- void setSpacing(qreal spacing);
- void resetSpacing();
-
- QLocale locale() const;
- void setLocale(const QLocale &locale);
- void resetLocale();
-
- bool isMirrored() const;
-
- Qt::FocusReason focusReason() const;
- void setFocusReason(Qt::FocusReason reason);
-
- QQuickItem *background() const;
- void setBackground(QQuickItem *background);
-
- QQuickItem *contentItem() const;
- void setContentItem(QQuickItem *item);
-
-Q_SIGNALS:
- void fontChanged();
- void availableWidthChanged();
- void availableHeightChanged();
- void paddingChanged();
- void topPaddingChanged();
- void leftPaddingChanged();
- void rightPaddingChanged();
- void bottomPaddingChanged();
- void spacingChanged();
- void localeChanged();
- void mirroredChanged();
- void focusReasonChanged();
- void backgroundChanged();
- void contentItemChanged();
-
-protected:
- virtual QFont defaultFont() const;
-
- QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent);
-
- void classBegin() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
-
- void itemChange(ItemChange change, const ItemChangeData &value) 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 geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
-
- virtual void mirrorChange();
- virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
- virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
- virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
-
-#ifndef QT_NO_ACCESSIBILITY
- virtual void accessibilityActiveChanged(bool active);
- virtual QAccessible::Role accessibleRole() const;
-#endif
-
- // helper functions which avoid to check QT_NO_ACCESSIBILITY
- QString accessibleName() const;
- void setAccessibleName(const QString &name);
-
- QVariant accessibleProperty(const char *propertyName);
- bool setAccessibleProperty(const char *propertyName, const QVariant &value);
-
-private:
- Q_DISABLE_COPY(QQuickControl)
- Q_DECLARE_PRIVATE(QQuickControl)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickControl)
-
-#endif // QQUICKCONTROL_P_H
diff --git a/src/templates/qquickcontrol_p_p.h b/src/templates/qquickcontrol_p_p.h
deleted file mode 100644
index fff2487b..00000000
--- a/src/templates/qquickcontrol_p_p.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCONTROL_P_P_H
-#define QQUICKCONTROL_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickcontrol_p.h"
-
-#include <QtQuick/private/qquickitem_p.h>
-#include <qpa/qplatformtheme.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtGui/qaccessible.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAccessibleAttached;
-
-class Q_LABSTEMPLATES_EXPORT QQuickControlPrivate : public QQuickItemPrivate
-#ifndef QT_NO_ACCESSIBILITY
- , public QAccessible::ActivationObserver
-#endif
-{
- Q_DECLARE_PUBLIC(QQuickControl)
-
-public:
- QQuickControlPrivate();
- virtual ~QQuickControlPrivate();
-
- static QQuickControlPrivate *get(QQuickControl *control)
- {
- return control->d_func();
- }
-
- void mirrorChange() Q_DECL_OVERRIDE;
-
- void setTopPadding(qreal value, bool reset = false);
- void setLeftPadding(qreal value, bool reset = false);
- void setRightPadding(qreal value, bool reset = false);
- void setBottomPadding(qreal value, bool reset = false);
-
- void resizeBackground();
- void resizeContent();
-
-#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
- void updateFont(const QFont &);
- static void updateFontRecur(QQuickItem *item, const QFont &);
- inline void setFont_helper(const QFont &f) {
- if (resolvedFont.resolve() == f.resolve() && resolvedFont == f)
- return;
- updateFont(f);
- }
- void resolveFont();
- void inheritFont(const QFont &f);
- static QFont naturalControlFont(const QQuickItem *);
- static QFont themeFont(QPlatformTheme::Font type);
-
- void updateLocale(const QLocale &l, bool e);
- static void updateLocaleRecur(QQuickItem *item, const QLocale &l);
- static QLocale calcLocale(const QQuickItem *item);
-
- // TODO: QLazilyAllocated<ExtraData>
- QFont font;
- QFont resolvedFont;
- bool hasTopPadding;
- bool hasLeftPadding;
- bool hasRightPadding;
- bool hasBottomPadding;
- bool hasLocale;
- qreal padding;
- qreal topPadding;
- qreal leftPadding;
- qreal rightPadding;
- qreal bottomPadding;
- qreal spacing;
- QLocale locale;
- Qt::FocusReason focusReason;
- QQuickItem *background;
- QQuickItem *contentItem;
- QQuickAccessibleAttached *accessibleAttached;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKCONTROL_P_P_H
diff --git a/src/templates/qquickdial.cpp b/src/templates/qquickdial.cpp
deleted file mode 100644
index 8d6e655a..00000000
--- a/src/templates/qquickdial.cpp
+++ /dev/null
@@ -1,558 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickdial_p.h"
-
-#include <QtCore/qmath.h>
-#include <QtQuick/private/qquickflickable_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Dial
- \inherits Control
- \instantiates QQuickDial
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A circular dial that is rotated to set a value.
-
- The Dial is similar to a traditional dial knob that is found on devices
- such as stereos or industrial equipment. It allows the user to specify a
- value within a range.
-
- The value of the dial is set with the \l value property. The range is
- set with the \l from and \l to properties.
-
- The dial can be manipulated with a keyboard. It supports the following
- actions:
-
- \table
- \header \li \b {Action} \li \b {Key}
- \row \li Decrease \l value by \l stepSize \li \c Qt.Key_Left
- \row \li Decrease \l value by \l stepSize \li \c Qt.Key_Down
- \row \li Set \l value to \l from \li \c Qt.Key_Home
- \row \li Increase \l value by \l stepSize \li \c Qt.Key_Right
- \row \li Increase \l value by \l stepSize \li \c Qt.Key_Up
- \row \li Set \l value to \l to \li \c Qt.Key_End
- \endtable
-
- \labs
-
- \sa {Customizing Dial}, {Input Controls}
-*/
-
-static const qreal startAngle = -140;
-static const qreal endAngle = 140;
-
-class QQuickDialPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickDial)
-
-public:
- QQuickDialPrivate() :
- from(0),
- to(1),
- value(0),
- position(0),
- angle(startAngle),
- stepSize(0),
- pressed(false),
- snapMode(QQuickDial::NoSnap),
- handle(Q_NULLPTR)
- {
- }
-
- qreal valueAt(qreal position) const;
- qreal snapPosition(qreal position) const;
- qreal positionAt(const QPoint &point) const;
- void setPosition(qreal position);
- void updatePosition();
-
- qreal from;
- qreal to;
- qreal value;
- qreal position;
- qreal angle;
- qreal stepSize;
- bool pressed;
- QPoint pressPoint;
- QQuickDial::SnapMode snapMode;
- QQuickItem *handle;
-};
-
-qreal QQuickDialPrivate::valueAt(qreal position) const
-{
- return from + (to - from) * position;
-}
-
-qreal QQuickDialPrivate::snapPosition(qreal position) const
-{
- if (qFuzzyIsNull(stepSize))
- return position;
- return qRound(position / stepSize) * stepSize;
-}
-
-qreal QQuickDialPrivate::positionAt(const QPoint &point) const
-{
- qreal yy = height / 2.0 - point.y();
- qreal xx = point.x() - width / 2.0;
- qreal angle = (xx || yy) ? atan2(yy, xx) : 0;
-
- if (angle < M_PI / -2)
- angle = angle + M_PI * 2;
-
- qreal normalizedAngle = (M_PI * 4 / 3 - angle) / (M_PI * 10 / 6);
- return normalizedAngle;
-}
-
-void QQuickDialPrivate::setPosition(qreal pos)
-{
- Q_Q(QQuickDial);
- pos = qBound<qreal>(0.0, pos, 1.0);
- if (!qFuzzyCompare(position, pos)) {
- position = pos;
-
- angle = startAngle + position * qAbs(endAngle - startAngle);
-
- emit q->positionChanged();
- emit q->angleChanged();
- }
-}
-
-void QQuickDialPrivate::updatePosition()
-{
- qreal pos = 0;
- if (!qFuzzyCompare(from, to))
- pos = (value - from) / (to - from);
- setPosition(pos);
-}
-
-QQuickDial::QQuickDial(QQuickItem *parent) :
- QQuickControl(*(new QQuickDialPrivate), parent)
-{
- setActiveFocusOnTab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Dial::from
-
- This property holds the starting value for the range. The default value is \c 0.0.
-
- \sa to, value
-*/
-qreal QQuickDial::from() const
-{
- Q_D(const QQuickDial);
- return d->from;
-}
-
-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();
- }
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Dial::to
-
- This property holds the end value for the range. The default value is
- \c 1.0.
-
- \sa from, value
-*/
-qreal QQuickDial::to() const
-{
- Q_D(const QQuickDial);
- return d->to;
-}
-
-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();
- }
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Dial::value
-
- This property holds the value in the range \c from - \c to. The default
- value is \c 0.0.
-
- Unlike the \l position property, the \c value is not updated while the
- handle is dragged. The value is updated after the value has been chosen
- and the dial has been released.
-
- \sa position
-*/
-qreal QQuickDial::value() const
-{
- Q_D(const QQuickDial);
- return d->value;
-}
-
-void QQuickDial::setValue(qreal value)
-{
- Q_D(QQuickDial);
- 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();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Dial::position
- \readonly
-
- This property holds the logical position of the handle.
-
- The position is defined as a percentage of the control's angle range (the
- range within which the handle can be moved) scaled to \c {0.0 - 1.0}.
- Unlike the \l value property, the \c position is continuously updated while
- the handle is dragged.
-
- \sa value, angle
-*/
-qreal QQuickDial::position() const
-{
- Q_D(const QQuickDial);
- return d->position;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Dial::angle
- \readonly
-
- This property holds the angle of the handle.
-
- Like the \l position property, angle is continuously updated while the
- handle is dragged.
-
- \sa position
-*/
-qreal QQuickDial::angle() const
-{
- Q_D(const QQuickDial);
- return d->angle;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Dial::stepSize
-
- This property holds the step size. The default value is \c 0.0.
-
- \sa snapMode, increase(), decrease()
-*/
-qreal QQuickDial::stepSize() const
-{
- Q_D(const QQuickDial);
- return d->stepSize;
-}
-
-void QQuickDial::setStepSize(qreal step)
-{
- Q_D(QQuickDial);
- if (!qFuzzyCompare(d->stepSize, step)) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Dial::snapMode
-
- This property holds the snap mode.
-
- The snap mode works with the \l stepSize to allow the handle to snap to
- certain points along the dial.
-
- Possible values:
- \value Dial.NoSnap The dial does not snap (default).
- \value Dial.SnapAlways The dial snaps while the handle is dragged.
- \value Dial.SnapOnRelease The dial does not snap while being dragged, but only after the handle is released.
-
- \sa stepSize
-*/
-QQuickDial::SnapMode QQuickDial::snapMode() const
-{
- Q_D(const QQuickDial);
- return d->snapMode;
-}
-
-void QQuickDial::setSnapMode(SnapMode mode)
-{
- Q_D(QQuickDial);
- if (d->snapMode != mode) {
- d->snapMode = mode;
- emit snapModeChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Dial::pressed
-
- This property holds whether the dial is pressed.
-
- The dial will be pressed when either the mouse is pressed over it, or a key
- such as \c Qt.Key_Left is held down. If you'd prefer not to have the dial
- be pressed upon key presses (due to styling reasons, for example), you can
- use the \l {Keys}{Keys attached property}:
-
- \code
- Dial {
- Keys.onLeftPressed: {}
- }
- \endcode
-
- This will result in pressed only being \c true upon mouse presses.
-*/
-bool QQuickDial::isPressed() const
-{
- Q_D(const QQuickDial);
- return d->pressed;
-}
-
-void QQuickDial::setPressed(bool pressed)
-{
- Q_D(QQuickDial);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- setAccessibleProperty("pressed", pressed);
- emit pressedChanged();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Dial::increase()
-
- Increases the value by \l stepSize, or \c 0.1 if stepSize is not defined.
-
- \sa stepSize
-*/
-void QQuickDial::increase()
-{
- Q_D(QQuickDial);
- qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
- setValue(d->value + step);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Dial::decrease()
-
- Decreases the value by \l stepSize, or \c 0.1 if stepSize is not defined.
-
- \sa stepSize
-*/
-void QQuickDial::decrease()
-{
- Q_D(QQuickDial);
- qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
- setValue(d->value - step);
-}
-
-/*!
- \qmlproperty component Qt.labs.controls::Dial::handle
-
- This property holds the handle of the dial.
-
- The handle acts as a visual indicator of the position of the dial.
-
- \sa {Customizing Dial}
-*/
-QQuickItem *QQuickDial::handle() const
-{
- Q_D(const QQuickDial);
- return d->handle;
-}
-
-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();
- }
-}
-
-void QQuickDial::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickDial);
- switch (event->key()) {
- case Qt::Key_Left:
- case Qt::Key_Down:
- setPressed(true);
- if (isMirrored())
- increase();
- else
- decrease();
- break;
-
- case Qt::Key_Right:
- case Qt::Key_Up:
- setPressed(true);
- if (isMirrored())
- decrease();
- else
- increase();
- break;
-
- case Qt::Key_Home:
- setPressed(true);
- setValue(isMirrored() ? d->to : d->from);
- break;
-
- case Qt::Key_End:
- setPressed(true);
- setValue(isMirrored() ? d->from : d->to);
- break;
-
- default:
- event->ignore();
- QQuickControl::keyPressEvent(event);
- break;
- }
-}
-
-void QQuickDial::keyReleaseEvent(QKeyEvent *event)
-{
- QQuickControl::keyReleaseEvent(event);
- setPressed(false);
-}
-
-void QQuickDial::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickDial);
- QQuickControl::mousePressEvent(event);
- d->pressPoint = event->pos();
- setPressed(true);
-}
-
-void QQuickDial::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickDial);
- QQuickControl::mouseMoveEvent(event);
- if (!keepMouseGrab()) {
- bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event);
- setKeepMouseGrab(overXDragThreshold);
-
- if (!overXDragThreshold) {
- bool overYDragThreshold = QQuickWindowPrivate::dragOverThreshold(event->pos().y() - d->pressPoint.y(), Qt::YAxis, event);
- setKeepMouseGrab(overYDragThreshold);
- }
- }
- if (keepMouseGrab()) {
- qreal pos = d->positionAt(event->pos());
- if (d->snapMode == SnapAlways)
- pos = d->snapPosition(pos);
- d->setPosition(pos);
- }
-}
-
-void QQuickDial::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickDial);
- QQuickControl::mouseReleaseEvent(event);
- d->pressPoint = QPoint();
- if (keepMouseGrab()) {
- qreal pos = d->positionAt(event->pos());
- if (d->snapMode != NoSnap)
- pos = d->snapPosition(pos);
- setValue(d->valueAt(pos));
- setKeepMouseGrab(false);
- }
- setPressed(false);
-}
-
-void QQuickDial::mouseUngrabEvent()
-{
- Q_D(QQuickDial);
- QQuickControl::mouseUngrabEvent();
- d->pressPoint = QPoint();
- setPressed(false);
-}
-
-void QQuickDial::mirrorChange()
-{
- QQuickControl::mirrorChange();
- emit angleChanged();
-}
-
-void QQuickDial::componentComplete()
-{
- Q_D(QQuickDial);
- QQuickControl::componentComplete();
- setValue(d->value);
- d->updatePosition();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickDial::accessibilityActiveChanged(bool active)
-{
- QQuickControl::accessibilityActiveChanged(active);
-
- Q_D(QQuickDial);
- if (active)
- setAccessibleProperty("pressed", d->pressed);
-}
-
-QAccessible::Role QQuickDial::accessibleRole() const
-{
- return QAccessible::Dial;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickdial_p.h b/src/templates/qquickdial_p.h
deleted file mode 100644
index 19d37547..00000000
--- a/src/templates/qquickdial_p.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKDIAL_H
-#define QQUICKDIAL_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qvariant.h>
-#include <QtQml/qqmlcomponent.h>
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickDialAttached;
-class QQuickDialPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickDial : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
- Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
- Q_PROPERTY(qreal angle READ angle NOTIFY angleChanged FINAL)
- Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
- Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
- Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
- Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
-
-public:
- explicit QQuickDial(QQuickItem *parent = Q_NULLPTR);
-
- qreal from() const;
- void setFrom(qreal from);
-
- qreal to() const;
- void setTo(qreal to);
-
- qreal value() const;
- void setValue(qreal value);
-
- qreal position() const;
-
- qreal angle() const;
-
- qreal stepSize() const;
- void setStepSize(qreal step);
-
- enum SnapMode {
- NoSnap,
- SnapAlways,
- SnapOnRelease
- };
- Q_ENUM(SnapMode)
-
- SnapMode snapMode() const;
- void setSnapMode(SnapMode mode);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- QQuickItem *handle() const;
- void setHandle(QQuickItem *handle);
-
-public Q_SLOTS:
- void increase();
- void decrease();
-
-Q_SIGNALS:
- void fromChanged();
- void toChanged();
- void valueChanged();
- void positionChanged();
- void angleChanged();
- void stepSizeChanged();
- void snapModeChanged();
- void pressedChanged();
- 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;
-
-#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickDial)
- Q_DECLARE_PRIVATE(QQuickDial)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickDial)
-
-#endif // QQUICKDIAL_H
diff --git a/src/templates/qquickdrawer.cpp b/src/templates/qquickdrawer.cpp
deleted file mode 100644
index 5f3d95c9..00000000
--- a/src/templates/qquickdrawer.cpp
+++ /dev/null
@@ -1,501 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickdrawer_p.h"
-
-#include <QtGui/qstylehints.h>
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtQuick/private/qquickwindow_p.h>
-#include <QtQuick/private/qquickanimation_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Drawer
- \inherits Container
- \instantiates QQuickDrawer
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-navigation
- \ingroup qtlabscontrols-containers
- \brief A side panel control.
-
- Drawer provides a swipe-based side panel, similar to those often used in
- touch interfaces to provide a central location for navigation.
-
- \table
- \row
- \li \image qtlabscontrols-drawer-wireframe.png
- Drawer can be positioned at any of the four edges of the content item. \br
- In this image, it is against the left edge of the window.
-
- \li \image qtlabscontrols-drawer-expanded-wireframe.png
- The drawer is then opened by \e "dragging" it out from the left edge \br
- of the window.
- \endtable
-
- In the image above, the application's contents are \e "pushed" across the
- screen. This is achieved by applying a translation to the contents:
-
- \code
- transform: Translate {
- x: (1.0 - drawer.position) * listview.width
- }
- \endcode
-
- If you would like the application's contents to stay where they are when
- the drawer is opened, don't apply a translation.
-
- \labs
-
- \sa SwipeView, {Customizing Drawer}, {Navigation Controls}, {Container Controls}
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::Drawer::clicked()
-
- This signal is emitted when the drawer is clicked.
-*/
-
-class QQuickDrawerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickDrawer)
-
-public:
- QQuickDrawerPrivate() : edge(Qt::LeftEdge), offset(0), position(0),
- content(Q_NULLPTR), animation(Q_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;
-
- Qt::Edge edge;
- qreal offset;
- qreal position;
- QPointF pressPoint;
- QQuickItem *content;
- QQuickPropertyAnimation *animation;
-};
-
-void QQuickDrawerPrivate::updateContent()
-{
- Q_Q(QQuickDrawer);
- if (!content)
- return;
-
- switch (edge) {
- case Qt::LeftEdge:
- content->setX((position - 1.0) * content->width());
- break;
- case Qt::RightEdge:
- content->setX(q->width() + - position * content->width());
- break;
- case Qt::TopEdge:
- content->setY((position - 1.0) * content->height());
- break;
- case Qt::BottomEdge:
- content->setY(q->height() + - position * content->height());
- break;
- }
-}
-
-static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int threshold = -1)
-{
- return QQuickWindowPrivate::dragOverThreshold(d, axis, event, threshold);
-}
-
-bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
-{
- Q_Q(QQuickDrawer);
- pressPoint = event->windowPos();
- offset = 0;
-
- if (qFuzzyIsNull(position)) {
- // only accept pressing at drag margins when fully closed
- switch (edge) {
- case Qt::LeftEdge:
- event->setAccepted(!dragOverThreshold(event->windowPos().x(), Qt::XAxis, event));
- break;
- case Qt::RightEdge:
- event->setAccepted(!dragOverThreshold(q->width() - event->windowPos().x(), Qt::XAxis, event));
- break;
- case Qt::TopEdge:
- event->setAccepted(!dragOverThreshold(event->windowPos().y(), Qt::YAxis, event));
- break;
- case Qt::BottomEdge:
- event->setAccepted(!dragOverThreshold(q->height() - event->windowPos().y(), Qt::YAxis, event));
- break;
- }
- } else {
- event->accept();
- }
-
- return item == q;
-}
-
-bool QQuickDrawerPrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
-{
- Q_Q(QQuickDrawer);
- Q_UNUSED(item);
- QPointF movePoint = event->windowPos();
-
- if (!q->keepMouseGrab()) {
- // Flickable uses a hard-coded threshold of 15 for flicking, and
- // QStyleHints::startDragDistance for dragging. Drawer uses a bit
- // larger threshold to avoid being too eager to steal touch (QTBUG-50045)
- int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
- bool overThreshold = false;
- if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
- overThreshold = dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event, threshold);
- else
- overThreshold = dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event, threshold);
-
- if (window && overThreshold) {
- QQuickItem *grabber = q->window()->mouseGrabberItem();
- if (!grabber || !grabber->keepMouseGrab()) {
- q->grabMouse();
- q->setKeepMouseGrab(overThreshold);
- offset = qMin<qreal>(0.0, q->positionAt(movePoint) - position);
- }
- }
- }
-
- if (q->keepMouseGrab())
- q->setPosition(q->positionAt(movePoint) - offset);
- event->accept();
-
- return q->keepMouseGrab();
-}
-
-bool QQuickDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event)
-{
- Q_Q(QQuickDrawer);
- bool wasGrabbed = q->keepMouseGrab();
- if (wasGrabbed) {
-// int startDragVelocity = QGuiApplication::styleHints()->startDragVelocity();
-// if (startDragVelocity && QGuiApplicationPrivate::mouseEventCaps(event) & QTouchDevice::Velocity) {
-// QVector2D velocity = QGuiApplicationPrivate::mouseEventVelocity(event);
-// qreal vel = (edge == Qt::LeftEdge || edge == Qt::RightEdge) ? velocity.x() : velocity.y();
-// qDebug() << vel << "vs." << startDragVelocity;
-// }
- if (position < 0.3) {
- q->close();
- } else if (position > 0.7) {
- q->open();
- } else {
- switch (edge) {
- case Qt::LeftEdge:
- if (event->x() - pressPoint.x() > 0)
- q->open();
- else
- q->close();
- break;
- case Qt::RightEdge:
- if (event->x() - pressPoint.x() < 0)
- q->open();
- else
- q->close();
- break;
- case Qt::TopEdge:
- if (event->y() - pressPoint.y() > 0)
- q->open();
- else
- q->close();
- break;
- case Qt::BottomEdge:
- if (event->y() - pressPoint.y() < 0)
- q->open();
- else
- q->close();
- break;
- }
- }
- q->setKeepMouseGrab(false);
- } else {
- if (item == q)
- emit q->clicked();
- }
- pressPoint = QPoint();
- event->accept();
- return wasGrabbed;
-}
-
-void QQuickDrawerPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
-{
- updateContent();
-}
-
-QQuickDrawer::QQuickDrawer(QQuickItem *parent) :
- QQuickControl(*(new QQuickDrawerPrivate), parent)
-{
- setZ(1);
- setFiltersChildMouseEvents(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Drawer::edge
-
- This property holds the edge of the content item at which the drawer will
- open from. The acceptable values are:
-
- \value Qt.TopEdge The top edge of the content item.
- \value Qt.LeftEdge The left edge of the content item (default).
- \value Qt.RightEdge The right edge of the content item.
- \value Qt.BottomEdge The bottom edge of the content item.
-*/
-Qt::Edge QQuickDrawer::edge() const
-{
- Q_D(const QQuickDrawer);
- return d->edge;
-}
-
-void QQuickDrawer::setEdge(Qt::Edge edge)
-{
- Q_D(QQuickDrawer);
- if (d->edge != edge) {
- d->edge = edge;
- if (isComponentComplete())
- d->updateContent();
- emit edgeChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Drawer::position
-
- This property holds the position of the drawer relative to its final
- destination. That is, the position will be \c 0 when the drawer
- is fully closed, and \c 1 when fully open.
-*/
-qreal QQuickDrawer::position() const
-{
- Q_D(const QQuickDrawer);
- return d->position;
-}
-
-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();
- }
-}
-
-
-/*!
- \qmlproperty Item Qt.labs.controls::Drawer::contentItem
-
- This property holds the content item that the drawer displays when opened.
-*/
-QQuickItem *QQuickDrawer::contentItem() const
-{
- Q_D(const QQuickDrawer);
- return d->content;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty Animation Qt.labs.controls::Drawer::animation
-
- This property holds the animation for the \l position property. It is used
- to animate the drawer's movement.
-
- If no valid animation is set, the drawer's movement will not be animated.
-*/
-QQuickPropertyAnimation *QQuickDrawer::animation() const
-{
- Q_D(const QQuickDrawer);
- return d->animation;
-}
-
-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();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Drawer::open()
-
- This method opens the drawer, animating the movement if a valid
- \l animation has been set.
-*/
-void QQuickDrawer::open()
-{
- Q_D(QQuickDrawer);
- if (d->animation) {
- d->animation->stop();
- d->animation->setFrom(d->position);
- d->animation->setTo(1.0);
- d->animation->start();
- } else {
- setPosition(1.0);
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Drawer::close()
-
- This method closes the drawer, animating the movement if a valid
- \l animation has been set.
-*/
-void QQuickDrawer::close()
-{
- Q_D(QQuickDrawer);
- if (d->animation) {
- d->animation->stop();
- d->animation->setFrom(d->position);
- d->animation->setTo(0.0);
- d->animation->start();
- } else {
- setPosition(0.0);
- }
-}
-
-bool QQuickDrawer::childMouseEventFilter(QQuickItem *child, QEvent *event)
-{
- Q_D(QQuickDrawer);
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::MouseMove:
- return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::MouseButtonRelease:
- return d->handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
- default:
- return false;
- }
-}
-
-void QQuickDrawer::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickDrawer);
- QQuickControl::mousePressEvent(event);
- d->handleMousePressEvent(this, event);
-}
-
-void QQuickDrawer::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickDrawer);
- QQuickControl::mouseMoveEvent(event);
- d->handleMouseMoveEvent(this, event);
-}
-
-void QQuickDrawer::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickDrawer);
- QQuickControl::mouseReleaseEvent(event);
- d->handleMouseReleaseEvent(this, event);
-}
-
-void QQuickDrawer::mouseUngrabEvent()
-{
- Q_D(QQuickDrawer);
- QQuickControl::mouseUngrabEvent();
- d->pressPoint = QPoint();
-}
-
-void QQuickDrawer::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickDrawer);
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
- if (isComponentComplete())
- d->updateContent();
-}
-
-void QQuickDrawer::componentComplete()
-{
- Q_D(QQuickDrawer);
- QQuickControl::componentComplete();
- d->updateContent();
-}
-
-qreal QQuickDrawer::positionAt(const QPointF &point) const
-{
- Q_D(const QQuickDrawer);
- if (!d->content)
- return 0.0;
-
- switch (d->edge) {
- case Qt::TopEdge:
- return point.y() / d->content->height();
- case Qt::LeftEdge:
- return point.x() / d->content->width();
- case Qt::RightEdge:
- return (width() - point.x()) / d->content->width();
- case Qt::BottomEdge:
- return (height() - point.y()) / d->content->height();
- default:
- return 0;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickdrawer_p.h b/src/templates/qquickdrawer_p.h
deleted file mode 100644
index f953b0fd..00000000
--- a/src/templates/qquickdrawer_p.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKDRAWER_P_H
-#define QQUICKDRAWER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPropertyAnimation;
-class QQuickDrawerPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickDrawer : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(Qt::Edge edge READ edge WRITE setEdge NOTIFY edgeChanged FINAL)
- Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
- Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
- // TODO: make this a proper transition
- Q_PROPERTY(QQuickPropertyAnimation *animation READ animation WRITE setAnimation NOTIFY animationChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentItem")
-
-public:
- explicit QQuickDrawer(QQuickItem *parent = Q_NULLPTR);
-
- Qt::Edge edge() const;
- void setEdge(Qt::Edge edge);
-
- qreal position() const;
- void setPosition(qreal position);
-
- QQuickItem *contentItem() const;
- void setContentItem(QQuickItem *item);
-
- QQuickPropertyAnimation *animation() const;
- void setAnimation(QQuickPropertyAnimation *animation);
-
-public Q_SLOTS:
- void open();
- void close();
-
-Q_SIGNALS:
- void clicked();
- void edgeChanged();
- void positionChanged();
- void contentItemChanged();
- 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;
-
- virtual qreal positionAt(const QPointF &point) const;
-
-private:
- Q_DISABLE_COPY(QQuickDrawer)
- Q_DECLARE_PRIVATE(QQuickDrawer)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickDrawer)
-
-#endif // QQUICKDRAWER_P_H
diff --git a/src/templates/qquickframe.cpp b/src/templates/qquickframe.cpp
deleted file mode 100644
index 67dfe256..00000000
--- a/src/templates/qquickframe.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickframe_p.h"
-#include "qquickframe_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Frame
- \inherits Pane
- \instantiates QQuickFrame
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief A frame control.
-
- 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
- you to position its contents, for instance by creating a \l RowLayout
- or a \l ColumnLayout.
-
- If only a single item is used within a Frame, it will resize to fit the
- implicit size of its contained item. This makes it particularly suitable
- for use together with layouts.
-
- \image qtlabscontrols-frame.png
-
- \snippet qtlabscontrols-frame.qml 1
-
- \labs
-
- \sa {Customizing Frame}, {Container Controls}
-*/
-
-QQuickFramePrivate::QQuickFramePrivate() : frame(Q_NULLPTR)
-{
-}
-
-QQuickFrame::QQuickFrame(QQuickItem *parent) :
- QQuickPane(*(new QQuickFramePrivate), parent)
-{
-}
-
-QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
- QQuickPane(dd, 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
deleted file mode 100644
index 0bfd63e8..00000000
--- a/src/templates/qquickframe_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKFRAME_P_H
-#define QQUICKFRAME_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickpane_p.h>
-
-QT_BEGIN_NAMESPACE
-
-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();
-
-protected:
- QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
-
-private:
- Q_DISABLE_COPY(QQuickFrame)
- Q_DECLARE_PRIVATE(QQuickFrame)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickFrame)
-
-#endif // QQUICKFRAME_P_H
diff --git a/src/templates/qquickframe_p_p.h b/src/templates/qquickframe_p_p.h
deleted file mode 100644
index 3d570572..00000000
--- a/src/templates/qquickframe_p_p.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKFRAME_P_P_H
-#define QQUICKFRAME_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickpane_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickFrame;
-
-class Q_LABSTEMPLATES_EXPORT QQuickFramePrivate : public QQuickPanePrivate
-{
- Q_DECLARE_PUBLIC(QQuickFrame)
-
-public:
- QQuickFramePrivate();
-
- QQuickItem *frame;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKFRAME_P_P_H
diff --git a/src/templates/qquickgroupbox.cpp b/src/templates/qquickgroupbox.cpp
deleted file mode 100644
index 84944987..00000000
--- a/src/templates/qquickgroupbox.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickgroupbox_p.h"
-#include "qquickframe_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype GroupBox
- \inherits Frame
- \instantiates QQuickGroupBox
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief A group box control.
-
- 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
- requires you to position its contents, for instance by creating a \l RowLayout
- or a \l ColumnLayout.
-
- If only a single item is used within a GroupBox, it will resize to fit the
- implicit size of its contained item. This makes it particularly suitable
- for use together with layouts.
-
- \image qtlabscontrols-groupbox.png
-
- \snippet qtlabscontrols-groupbox.qml 1
-
- \section2 Checkable GroupBox
-
- Even though GroupBox has no built-in check box, it is straightforward
- to create a checkable GroupBox by pairing it with a CheckBox.
-
- \image qtlabscontrols-groupbox-checkable.png
-
- It is a common pattern to enable or disable the groupbox's children when
- its check box is toggled on/off, respectively, but the semantics of the
- check box is left to the application to decide.
-
- \snippet qtlabscontrols-groupbox-checkable.qml 1
-
- \labs
-
- \sa CheckBox, {Customizing GroupBox}, {Container Controls}
-*/
-
-class QQuickGroupBoxPrivate : public QQuickFramePrivate
-{
-public:
- QQuickGroupBoxPrivate() : label(Q_NULLPTR) { }
-
- QString title;
- QQuickItem *label;
-};
-
-QQuickGroupBox::QQuickGroupBox(QQuickItem *parent) :
- QQuickFrame(*(new QQuickGroupBoxPrivate), parent)
-{
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::GroupBox::title
-
- This property holds the title.
-*/
-QString QQuickGroupBox::title() const
-{
- Q_D(const QQuickGroupBox);
- return d->title;
-}
-
-void QQuickGroupBox::setTitle(const QString &title)
-{
- Q_D(QQuickGroupBox);
- if (d->title != title) {
- d->title = title;
- emit titleChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::GroupBox::label
-
- This property holds the label item that visualizes \l title.
-
- \sa {Customizing GroupBox}
-*/
-QQuickItem *QQuickGroupBox::label() const
-{
- Q_D(const QQuickGroupBox);
- return d->label;
-}
-
-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();
- }
-}
-
-QFont QQuickGroupBox::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::GroupBoxTitleFont);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickgroupbox_p.h b/src/templates/qquickgroupbox_p.h
deleted file mode 100644
index b81d6534..00000000
--- a/src/templates/qquickgroupbox_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKGROUPBOX_P_H
-#define QQUICKGROUPBOX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickframe_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickGroupBoxPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickGroupBox : public QQuickFrame
-{
- Q_OBJECT
- Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
- Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
-
-public:
- explicit QQuickGroupBox(QQuickItem *parent = Q_NULLPTR);
-
- QString title() const;
- void setTitle(const QString &title);
-
- QQuickItem *label() const;
- void setLabel(QQuickItem *label);
-
-Q_SIGNALS:
- void titleChanged();
- void labelChanged();
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
-private:
- Q_DISABLE_COPY(QQuickGroupBox)
- Q_DECLARE_PRIVATE(QQuickGroupBox)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickGroupBox)
-
-#endif // QQUICKGROUPBOX_P_H
diff --git a/src/templates/qquickitemdelegate.cpp b/src/templates/qquickitemdelegate.cpp
deleted file mode 100644
index 98364fad..00000000
--- a/src/templates/qquickitemdelegate.cpp
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickitemdelegate_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ItemDelegate
- \inherits AbstractButton
- \instantiates QQuickItemDelegate
- \inqmlmodule Qt.labs.controls
- \brief An item delegate.
-
- 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.
-
- ItemDelegate inherits its API from AbstractButton. For instance, you can set
- \l {AbstractButton::text}{text}, make items \l {AbstractButton::checkable}{checkable},
- and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
-
- \snippet qtlabscontrols-itemdelegate.qml 1
-
- \labs
-
- \sa {Customizing ItemDelegate}
-*/
-
-QQuickItemDelegate::QQuickItemDelegate(QQuickItem *parent) : QQuickAbstractButton(parent)
-{
-}
-
-QFont QQuickItemDelegate::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ItemViewFont);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickItemDelegate::accessibleRole() const
-{
- return QAccessible::ListItem;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickitemdelegate_p.h b/src/templates/qquickitemdelegate_p.h
deleted file mode 100644
index 1be909d7..00000000
--- a/src/templates/qquickitemdelegate_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKITEMDELEGATE_P_H
-#define QQUICKITEMDELEGATE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickItemDelegatePrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickItemDelegate : public QQuickAbstractButton
-{
- Q_OBJECT
-
-public:
- explicit QQuickItemDelegate(QQuickItem *parent = Q_NULLPTR);
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickItemDelegate)
- Q_DECLARE_PRIVATE(QQuickItemDelegate)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickItemDelegate)
-
-#endif // QQUICKITEMDELEGATE_P_H
diff --git a/src/templates/qquicklabel.cpp b/src/templates/qquicklabel.cpp
deleted file mode 100644
index 4eec06b3..00000000
--- a/src/templates/qquicklabel.cpp
+++ /dev/null
@@ -1,240 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicklabel_p.h"
-#include "qquicklabel_p_p.h"
-#include "qquickcontrol_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquickclipnode_p.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtQuick/private/qquickaccessibleattached_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Label
- \inherits Text
- \instantiates QQuickLabel
- \inqmlmodule Qt.labs.controls
- \ingroup text
- \brief A text label.
-
- Label extends \l Text with styling and \l {Control::font}{font}
- inheritance. The default colors and font are style specific. Label
- can also have a visual \l background item.
-
- \image qtlabscontrols-label.png
-
- \snippet qtlabscontrols-label.qml 1
-
- \labs
-
- \sa {Customizing Label}
-*/
-
-QQuickLabel::QQuickLabel(QQuickItem *parent) :
- QQuickText(*(new QQuickLabelPrivate), parent)
-{
- Q_D(QQuickLabel);
- QObjectPrivate::connect(this, &QQuickText::textChanged,
- d, &QQuickLabelPrivate::_q_textChanged);
-}
-
-QQuickLabel::~QQuickLabel()
-{
-}
-
-QQuickLabelPrivate::QQuickLabelPrivate()
- : background(Q_NULLPTR), accessibleAttached(Q_NULLPTR)
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::installActivationObserver(this);
-#endif
-}
-
-QQuickLabelPrivate::~QQuickLabelPrivate()
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::removeActivationObserver(this);
-#endif
-}
-
-/*!
- \internal
-
- Determine which font is implicitly imposed on this control by its ancestors
- and QGuiApplication::font, resolve this against its own font (attributes from
- the implicit font are copied over). Then propagate this font to this
- control's children.
-*/
-void QQuickLabelPrivate::resolveFont()
-{
- Q_Q(QQuickLabel);
- inheritFont(QQuickControlPrivate::naturalControlFont(q));
-}
-
-void QQuickLabelPrivate::inheritFont(const QFont &f)
-{
- Q_Q(QQuickLabel);
- QFont parentFont = font.resolve(f);
- parentFont.resolve(font.resolve() | f.resolve());
-
- const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::LabelFont);
- const QFont resolvedFont = parentFont.resolve(defaultFont);
-
- const bool changed = resolvedFont != sourceFont;
- q->QQuickText::setFont(resolvedFont);
- if (changed)
- emit q->fontChanged();
-}
-
-void QQuickLabelPrivate::_q_textChanged(const QString &text)
-{
-#ifndef QT_NO_ACCESSIBILITY
- if (accessibleAttached)
- accessibleAttached->setName(text);
-#else
- Q_UNUSED(text)
-#endif
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
-{
- if (accessibleAttached || !active)
- return;
-
- Q_Q(QQuickLabel);
- accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
- if (accessibleAttached) {
- accessibleAttached->setRole(accessibleRole());
- accessibleAttached->setName(text);
- } else {
- qWarning() << "QQuickLabel: " << q << " QQuickAccessibleAttached object creation failed!";
- }
-}
-
-QAccessible::Role QQuickLabelPrivate::accessibleRole() const
-{
- return QAccessible::StaticText;
-}
-#endif
-
-QFont QQuickLabel::font() const
-{
- return QQuickText::font();
-}
-
-void QQuickLabel::setFont(const QFont &font)
-{
- Q_D(QQuickLabel);
- if (d->font.resolve() == font.resolve() && d->font == font)
- return;
-
- d->font = font;
- d->resolveFont();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Label::background
-
- This property holds the background item.
-
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
-
- \sa {Customizing Label}
-*/
-QQuickItem *QQuickLabel::background() const
-{
- Q_D(const QQuickLabel);
- return d->background;
-}
-
-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();
- }
-}
-
-void QQuickLabel::classBegin()
-{
- Q_D(QQuickLabel);
- QQuickText::classBegin();
- d->resolveFont();
-}
-
-void QQuickLabel::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
-{
- Q_D(QQuickLabel);
- QQuickText::itemChange(change, value);
- if (change == ItemParentHasChanged && value.item)
- d->resolveFont();
-}
-
-void QQuickLabel::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickLabel);
- QQuickText::geometryChanged(newGeometry, oldGeometry);
- if (d->background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(d->background);
- if (!p->widthValid) {
- d->background->setWidth(newGeometry.width());
- p->widthValid = false;
- }
- if (!p->heightValid) {
- d->background->setHeight(newGeometry.height());
- p->heightValid = false;
- }
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicklabel_p.h b/src/templates/qquicklabel_p.h
deleted file mode 100644
index 26f72840..00000000
--- a/src/templates/qquicklabel_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKLABEL_P_H
-#define QQUICKLABEL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquicktext_p.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickLabelPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickLabel : public QQuickText
-{
- Q_OBJECT
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
- Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
-
-public:
- explicit QQuickLabel(QQuickItem *parent = Q_NULLPTR);
- ~QQuickLabel();
-
- QFont font() const;
- void setFont(const QFont &font);
-
- QQuickItem *background() const;
- void setBackground(QQuickItem *background);
-
-Q_SIGNALS:
- void fontChanged();
- void backgroundChanged();
-
-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;
-
-private:
- Q_DISABLE_COPY(QQuickLabel)
- Q_DECLARE_PRIVATE(QQuickLabel)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickLabel)
-
-#endif // QQUICKLABEL_P_H
diff --git a/src/templates/qquicklabel_p_p.h b/src/templates/qquicklabel_p_p.h
deleted file mode 100644
index 94d74132..00000000
--- a/src/templates/qquicklabel_p_p.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKLABEL_P_P_H
-#define QQUICKLABEL_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquicktext_p_p.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtGui/qaccessible.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAccessibleAttached;
-
-class QQuickLabelPrivate : public QQuickTextPrivate
-#ifndef QT_NO_ACCESSIBILITY
- , public QAccessible::ActivationObserver
-#endif
-{
- Q_DECLARE_PUBLIC(QQuickLabel)
-
-public:
- QQuickLabelPrivate();
- ~QQuickLabelPrivate();
-
- static QQuickLabelPrivate *get(QQuickLabel *item) {
- return static_cast<QQuickLabelPrivate *>(QObjectPrivate::get(item)); }
-
- void resizeBackground();
- void resolveFont();
- void inheritFont(const QFont &f);
-
- void _q_textChanged(const QString &text);
-
-#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
- QFont font;
- QQuickItem *background;
- QQuickAccessibleAttached *accessibleAttached;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKLABEL_P_P_H
diff --git a/src/templates/qquickmenu.cpp b/src/templates/qquickmenu.cpp
deleted file mode 100644
index 24d614c5..00000000
--- a/src/templates/qquickmenu.cpp
+++ /dev/null
@@ -1,531 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickmenu_p.h"
-#include "qquickmenu_p_p.h"
-#include "qquickmenuitem_p.h"
-
-#include <QtGui/qevent.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-#include <QtQuick/private/qquickflickable_p.h>
-#include <QtQuick/private/qquickevents_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Menu
- \inherits Popup
- \instantiates QQuickMenu
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-menus
- \brief A menu control.
-
- \image qtlabscontrols-menu.png
-
- Menu has two main use cases:
- \list
- \li Context menus; for example, a menu that is shown after right clicking
- \li Popup menus; for example, a menu that is shown after clicking a button
- \endlist
-
- \code
- Button {
- id: fileButton
- text: "File"
- onClicked: menu.open()
-
- Menu {
- id: menu
- y: fileButton.height
-
- MenuItem {
- text: "New..."
- }
- MenuItem {
- text: "Open..."
- }
- MenuItem {
- text: "Save"
- }
- }
- }
- \endcode
-
- \labs
-
- \sa {Customizing Menu}, {Menu Controls}
-*/
-
-QQuickMenuPrivate::QQuickMenuPrivate() :
- contentItem(Q_NULLPTR),
- contentModel(Q_NULLPTR),
- dummyFocusItem(Q_NULLPTR),
- ignoreActiveFocusChanges(false)
-{
- Q_Q(QQuickMenu);
- contentModel = new QQmlObjectModel(q);
-}
-
-QQuickItem *QQuickMenuPrivate::itemAt(int index) const
-{
- return qobject_cast<QQuickItem *>(contentModel->get(index));
-}
-
-void QQuickMenuPrivate::insertItem(int index, QQuickItem *item)
-{
- contentData.append(item);
- item->setParentItem(contentItem);
- if (complete)
- resizeItem(item);
- QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
- contentModel->insert(index, item);
-}
-
-void QQuickMenuPrivate::moveItem(int from, int to)
-{
- contentModel->move(from, to);
-}
-
-void QQuickMenuPrivate::removeItem(int index, QQuickItem *item)
-{
- contentData.removeOne(item);
-
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent);
- item->setParentItem(Q_NULLPTR);
- contentModel->remove(index);
-}
-
-void QQuickMenuPrivate::resizeItem(QQuickItem *item)
-{
- if (!item || !contentItem)
- return;
-
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
- item->setWidth(contentItem->width());
- p->widthValid = false;
- }
-}
-
-void QQuickMenuPrivate::resizeItems()
-{
- if (!contentModel)
- return;
-
- for (int i = 0; i < contentModel->count(); ++i)
- resizeItem(itemAt(i));
-}
-
-void QQuickMenuPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
-{
- // add dynamically reparented items (eg. by a Repeater)
- if (!QQuickItemPrivate::get(child)->isTransparentForPositioner() && !contentData.contains(child))
- insertItem(contentModel->count(), child);
-}
-
-void QQuickMenuPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
-{
- // remove dynamically unparented items (eg. by a Repeater)
- if (!parent)
- removeItem(contentModel->indexOf(item, Q_NULLPTR), item);
-}
-
-void QQuickMenuPrivate::itemSiblingOrderChanged(QQuickItem *)
-{
- // reorder the restacked items (eg. by a Repeater)
- Q_Q(QQuickMenu);
- 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);
- q->moveItem(index, i);
- }
-}
-
-void QQuickMenuPrivate::itemDestroyed(QQuickItem *item)
-{
- int index = contentModel->indexOf(item, Q_NULLPTR);
- if (index != -1)
- removeItem(index, item);
-}
-
-void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
-{
- if (complete)
- resizeItems();
-}
-
-void QQuickMenuPrivate::onItemPressed()
-{
- Q_Q(QQuickMenu);
- QQuickItem *item = qobject_cast<QQuickItem*>(q->sender());
- int itemIndex = contentModel->indexOf(item, Q_NULLPTR);
- Q_ASSERT(itemIndex != -1);
-
- if (!contentItem->property("currentIndex").isValid())
- return;
-
- contentItem->setProperty("currentIndex", itemIndex);
-}
-
-void QQuickMenuPrivate::onItemActiveFocusChanged()
-{
- if (ignoreActiveFocusChanges)
- return;
-
- Q_Q(QQuickMenu);
- QQuickItem *item = qobject_cast<QQuickItem*>(q->sender());
- if (!item->hasActiveFocus())
- return;
-
- if (!contentItem->property("currentIndex").isValid())
- return;
-
- int indexOfItem = contentModel->indexOf(item, Q_NULLPTR);
- contentItem->setProperty("currentIndex", indexOfItem);
-}
-
-void QQuickMenuPrivate::onMenuVisibleChanged()
-{
- Q_Q(QQuickMenu);
- if (q->isVisible()) {
- // Don't react to active focus changes here, as we're causing them.
- ignoreActiveFocusChanges = true;
- for (int i = 0; i < contentModel->count(); ++i) {
- QQuickItem *item = qobject_cast<QQuickItem*>(contentModel->get(i));
- item->setFocus(true);
- }
- ignoreActiveFocusChanges = false;
-
- // We must do this last so that none of the menu items have focus.
- dummyFocusItem->forceActiveFocus();
- } else {
- // Ensure that when the menu isn't visible, there's no current item
- // the next time it's opened.
- if (contentItem->property("currentIndex").isValid())
- contentItem->setProperty("currentIndex", -1);
-
- // The menu items are sneaky and will steal the focus if they can.
- for (int i = 0; i < contentModel->count(); ++i) {
- QQuickItem *item = qobject_cast<QQuickItem*>(contentModel->get(i));
- item->setFocus(false);
- }
- }
-
-}
-
-void QQuickMenuPrivate::maybeUnsetDummyFocusOnTab()
-{
- if (!dummyFocusItem->hasActiveFocus()) {
- // Only unset the flag once the dummy item no longer has focus, otherwise we get warnings.
- dummyFocusItem->setActiveFocusOnTab(false);
- }
-}
-
-void QQuickMenuPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
-{
- QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
- QQuickMenu *q = static_cast<QQuickMenu *>(prop->object);
- QQuickItem *item = qobject_cast<QQuickItem *>(obj);
- if (item) {
- 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) {
- q->addItem(item);
-
- QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(item);
- if (menuItem) {
- QObjectPrivate::connect(menuItem, &QQuickMenuItem::pressed, p, &QQuickMenuPrivate::onItemPressed);
- QObject::connect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPopup::close);
- QObjectPrivate::connect(menuItem, &QQuickItem::activeFocusChanged, p, &QQuickMenuPrivate::onItemActiveFocusChanged);
- }
- }
- } else {
- p->contentData.append(obj);
- }
-}
-
-int QQuickMenuPrivate::contentData_count(QQmlListProperty<QObject> *prop)
-{
- QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
- return p->contentData.count();
-}
-
-QObject *QQuickMenuPrivate::contentData_at(QQmlListProperty<QObject> *prop, int index)
-{
- QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
- return p->contentData.value(index);
-}
-
-void QQuickMenuPrivate::contentData_clear(QQmlListProperty<QObject> *prop)
-{
- QQuickMenuPrivate *p = static_cast<QQuickMenuPrivate *>(prop->data);
- p->contentData.clear();
-}
-
-QQuickMenu::QQuickMenu(QObject *parent) :
- QQuickPopup(*(new QQuickMenuPrivate), parent)
-{
- Q_D(QQuickMenu);
- setClosePolicy(OnEscape | OnPressOutside | OnReleaseOutside);
- QObjectPrivate::connect(this, &QQuickMenu::visibleChanged, d, &QQuickMenuPrivate::onMenuVisibleChanged);
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::Menu::itemAt(int index)
-
- Returns the item at \a index, or \c null if it does not exist.
-*/
-QQuickItem *QQuickMenu::itemAt(int index) const
-{
- Q_D(const QQuickMenu);
- return d->itemAt(index);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Menu::addItem(Item item)
-
- Adds \a item to the end of the list of items.
-*/
-void QQuickMenu::addItem(QQuickItem *item)
-{
- Q_D(QQuickMenu);
- insertItem(d->contentModel->count(), item);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Menu::insertItem(int index, Item item)
-
- Inserts \a item at \a index.
-*/
-void QQuickMenu::insertItem(int index, QQuickItem *item)
-{
- Q_D(QQuickMenu);
- if (!item)
- return;
- const int count = d->contentModel->count();
- if (index < 0 || index > count)
- index = count;
-
- int oldIndex = d->contentModel->indexOf(item, Q_NULLPTR);
- if (oldIndex != -1) {
- if (oldIndex < index)
- --index;
- if (oldIndex != index)
- d->moveItem(oldIndex, index);
- } else {
- d->insertItem(index, item);
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Menu::moveItem(int from, int to)
-
- Moves an item \a from one index \a to another.
-*/
-void QQuickMenu::moveItem(int from, int to)
-{
- Q_D(QQuickMenu);
- const int count = d->contentModel->count();
- if (from < 0 || from > count - 1)
- return;
- if (to < 0 || to > count - 1)
- to = count - 1;
-
- if (from != to)
- d->moveItem(from, to);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Menu::removeItem(int index)
-
- Removes an item at \a index.
-
- \note The ownership of the item is transferred to the caller.
-*/
-void QQuickMenu::removeItem(int index)
-{
- Q_D(QQuickMenu);
- const int count = d->contentModel->count();
- if (index < 0 || index >= count)
- return;
-
- QQuickItem *item = itemAt(index);
- if (item)
- d->removeItem(index, item);
-}
-
-/*!
- \qmlproperty model Qt.labs.controls::Menu::contentModel
- \readonly
-
- This property holds the model used to display menu items.
-
- By default, the model is an \l ObjectModel, in order to allow declaring
- menu items as children of the menu.
-*/
-QVariant QQuickMenu::contentModel() const
-{
- Q_D(const QQuickMenu);
- return QVariant::fromValue(d->contentModel);
-}
-
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Menu::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickMenu::contentData()
-{
- Q_D(QQuickMenu);
- return QQmlListProperty<QObject>(this, d,
- QQuickMenuPrivate::contentData_append,
- QQuickMenuPrivate::contentData_count,
- QQuickMenuPrivate::contentData_at,
- QQuickMenuPrivate::contentData_clear);
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::Menu::title
-
- Title for the menu as a submenu or in a menubar.
-
- Its value defaults to an empty string.
-*/
-QString QQuickMenu::title() const
-{
- Q_D(const QQuickMenu);
- return d->title;
-}
-
-void QQuickMenu::setTitle(QString &title)
-{
- Q_D(QQuickMenu);
- if (title == d->title)
- return;
- d->title = title;
- emit titleChanged();
-}
-
-void QQuickMenu::componentComplete()
-{
- Q_D(QQuickMenu);
- QQuickPopup::componentComplete();
- d->resizeItems();
-}
-
-void QQuickMenu::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_D(QQuickMenu);
- QQuickPopup::contentItemChange(newItem, oldItem);
- if (oldItem) {
- oldItem->removeEventFilter(this);
- if (d->dummyFocusItem)
- QObjectPrivate::disconnect(d->dummyFocusItem.data(), &QQuickItem::activeFocusChanged, d, &QQuickMenuPrivate::maybeUnsetDummyFocusOnTab);
- }
-
- if (newItem) {
- newItem->installEventFilter(this);
- newItem->setFlag(QQuickItem::ItemIsFocusScope);
- newItem->setActiveFocusOnTab(true);
-
- // Trying to give active focus to the contentItem (ListView, by default)
- // when the menu first opens, without also giving it to the first delegate item
- // doesn't seem to be possible, but this is what we need to do. QMenu behaves
- // similarly to this; it receives focus if a button that has it as a menu is clicked,
- // and only after pressing tab is the first menu item then given active focus.
- if (!d->dummyFocusItem) {
- d->dummyFocusItem = new QQuickItem(newItem);
- d->dummyFocusItem->setObjectName(QStringLiteral("dummyMenuFocusItem"));
- } else {
- d->dummyFocusItem->setParentItem(newItem);
- }
-
- d->dummyFocusItem->setActiveFocusOnTab(true);
- d->dummyFocusItem->stackBefore(newItem->childItems().first());
-
- QObjectPrivate::connect(d->dummyFocusItem.data(), &QQuickItem::activeFocusChanged, d, &QQuickMenuPrivate::maybeUnsetDummyFocusOnTab);
- }
- d->contentItem = newItem;
-}
-
-bool QQuickMenu::eventFilter(QObject *object, QEvent *event)
-{
- Q_D(QQuickMenu);
- if (object != d->contentItem || event->type() != QEvent::KeyRelease || d->contentModel->count() == 0)
- return QQuickPopup::eventFilter(object, event);
-
- // QTBUG-17051
- // Work around the fact that ListView has no way of distinguishing between
- // mouse and keyboard interaction, thanks to the "interactive" bool in Flickable.
- // What we actually want is to have a way to always allow keyboard interaction but
- // only allow flicking with the mouse when there are too many menu items to be
- // shown at once.
- QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
- switch (keyEvent->key()) {
- case Qt::Key_Up:
- if (d->contentItem->metaObject()->indexOfMethod("decrementCurrentIndex()") != -1)
- QMetaObject::invokeMethod(d->contentItem, "decrementCurrentIndex");
- return true;
-
- case Qt::Key_Down:
- if (d->contentItem->metaObject()->indexOfMethod("incrementCurrentIndex()") != -1)
- QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex");
- return true;
-
- default:
- break;
- }
-
- return QQuickPopup::eventFilter(object, event);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickMenu::accessibleRole() const
-{
- return QAccessible::PopupMenu;
-}
-#endif // QT_NO_ACCESSIBILITY
-
-QT_END_NAMESPACE
-
-#include "moc_qquickmenu_p.cpp"
diff --git a/src/templates/qquickmenu_p.h b/src/templates/qquickmenu_p.h
deleted file mode 100644
index b70ca49f..00000000
--- a/src/templates/qquickmenu_p.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKMENU_P_H
-#define QQUICKMENU_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQml/qqmllist.h>
-#include <QtQml/qqml.h>
-
-#include "qquickpopup_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class QQuickMenuItem;
-class QQuickMenuPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickMenu : public QQuickPopup
-{
- Q_OBJECT
- Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
- Q_CLASSINFO("DefaultProperty", "contentData")
-
-public:
- explicit QQuickMenu(QObject *parent = Q_NULLPTR);
-
- Q_INVOKABLE QQuickItem *itemAt(int index) const;
- Q_INVOKABLE void addItem(QQuickItem *item);
- Q_INVOKABLE void insertItem(int index, QQuickItem *item);
- Q_INVOKABLE void moveItem(int from, int to);
- Q_INVOKABLE void removeItem(int index);
-
- QVariant contentModel() const;
- QQmlListProperty<QObject> contentData();
-
- QString title() const;
- 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;
-
-Q_SIGNALS:
- void titleChanged();
-
-protected:
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif // QT_NO_ACCESSIBILITY
-
-private:
- Q_DISABLE_COPY(QQuickMenu)
- Q_DECLARE_PRIVATE(QQuickMenu)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickMenu)
-
-#endif // QQUICKMENU_P_H
diff --git a/src/templates/qquickmenu_p_p.h b/src/templates/qquickmenu_p_p.h
deleted file mode 100644
index 4c2aed16..00000000
--- a/src/templates/qquickmenu_p_p.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKMENU_P_P_H
-#define QQUICKMENU_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qvector.h>
-#include <QtCore/qpointer.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-#include <QtLabsTemplates/private/qquickpopup_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQmlObjectModel;
-
-class Q_LABSTEMPLATES_EXPORT QQuickMenuPrivate : public QQuickPopupPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickMenu)
-
-public:
- QQuickMenuPrivate();
-
- QQuickItem *itemAt(int index) const;
- void insertItem(int index, QQuickItem *item);
- void moveItem(int from, int to);
- void removeItem(int index, QQuickItem *item);
-
- 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 onItemPressed();
- void onItemActiveFocusChanged();
- void onMenuVisibleChanged();
- void maybeUnsetDummyFocusOnTab();
-
- static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
- static int contentData_count(QQmlListProperty<QObject> *prop);
- static QObject *contentData_at(QQmlListProperty<QObject> *prop, int index);
- static void contentData_clear(QQmlListProperty<QObject> *prop);
-
- QQuickItem *contentItem; // TODO: cleanup
- QVector<QObject *> contentData;
- QQmlObjectModel *contentModel;
- QPointer<QQuickItem> dummyFocusItem;
- bool ignoreActiveFocusChanges;
- QString title;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKMENU_P_P_H
-
diff --git a/src/templates/qquickmenuitem.cpp b/src/templates/qquickmenuitem.cpp
deleted file mode 100644
index d784af02..00000000
--- a/src/templates/qquickmenuitem.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickmenuitem_p.h"
-#include "qquickabstractbutton_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-#include <QtQuick/private/qquickevents_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype MenuItem
- \inherits Control
- \instantiates QQuickMenuItem
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-menus
- \brief A menu item within a Menu.
-
- MenuItem is a convenience type that implements the AbstractButton API,
- providing an easy way to respond to menu items being clicked, for example.
-
- \code
- Button {
- id: fileButton
- text: "File"
- onClicked: menu.open()
- }
- Menu {
- id: menu
- anchor.target: fileButton
-
- MenuItem {
- text: "New..."
- }
- MenuItem {
- text: "Open..."
- }
- MenuItem {
- text: "Save"
- }
- }
- \endcode
-
- \labs
-
- \sa {Customizing MenuItem}, {Menu Controls}
-*/
-
-/*!
- \qmlsignal void Qt.labs.controls::MenuItem::triggered()
-
- This signal is emitted when the menu item is triggered by the user.
-*/
-
-QQuickMenuItem::QQuickMenuItem(QQuickItem *parent) :
- QQuickAbstractButton(parent)
-{
- connect(this, &QQuickAbstractButton::clicked, this, &QQuickMenuItem::triggered);
-}
-
-QFont QQuickMenuItem::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::MenuItemFont);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickMenuItem::accessibleRole() const
-{
- return QAccessible::MenuItem;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickmenuitem_p.h b/src/templates/qquickmenuitem_p.h
deleted file mode 100644
index 91d1e91e..00000000
--- a/src/templates/qquickmenuitem_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKMENUITEM_P_H
-#define QQUICKMENUITEM_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickMenuItemPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickMenuItem : public QQuickAbstractButton
-{
- Q_OBJECT
-
-public:
- explicit QQuickMenuItem(QQuickItem *parent = Q_NULLPTR);
-
-Q_SIGNALS:
- void triggered();
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickMenuItem)
- Q_DECLARE_PRIVATE(QQuickMenuItem)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickMenuItem)
-
-#endif // QQUICKMENUITEM_P_H
diff --git a/src/templates/qquickoverlay.cpp b/src/templates/qquickoverlay.cpp
deleted file mode 100644
index cce10e46..00000000
--- a/src/templates/qquickoverlay.cpp
+++ /dev/null
@@ -1,280 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickoverlay_p.h"
-#include "qquickpopup_p_p.h"
-#include "qquickdrawer_p.h"
-#include <QtQml/qqmlinfo.h>
-#include <QtQml/qqmlproperty.h>
-#include <QtQuick/private/qquickitem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickOverlayPrivate : public QQuickItemPrivate
-{
- Q_DECLARE_PUBLIC(QQuickOverlay)
-
-public:
- QQuickOverlayPrivate();
-
- void popupAboutToShow();
- void popupAboutToHide();
- void drawerPositionChange();
- void resizeBackground();
-
- QQuickItem *background;
- QVector<QQuickDrawer *> drawers;
- QVector<QQuickPopup *> popups;
- int modalPopups;
-};
-
-void QQuickOverlayPrivate::popupAboutToShow()
-{
- Q_Q(QQuickOverlay);
- if (!background)
- return;
-
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
- if (!popup || !popup->isModal())
- return;
-
- // use QQmlProperty instead of QQuickItem::setOpacity() to trigger QML Behaviors
- QQmlProperty::write(background, QStringLiteral("opacity"), 1.0);
-}
-
-void QQuickOverlayPrivate::popupAboutToHide()
-{
- Q_Q(QQuickOverlay);
- if (!background || modalPopups > 1)
- return;
-
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
- if (!popup || !popup->isModal())
- return;
-
- // use QQmlProperty instead of QQuickItem::setOpacity() to trigger QML Behaviors
- QQmlProperty::write(background, QStringLiteral("opacity"), 0.0);
-}
-
-void QQuickOverlayPrivate::drawerPositionChange()
-{
- Q_Q(QQuickOverlay);
- QQuickDrawer *drawer = qobject_cast<QQuickDrawer *>(q->sender());
- if (!background || !drawer || modalPopups > 0)
- return;
-
- // call QQuickItem::setOpacity() directly to avoid triggering QML Behaviors
- // which would make the fading feel laggy compared to the drawer movement
- background->setOpacity(drawer->position());
-}
-
-void QQuickOverlayPrivate::resizeBackground()
-{
- Q_Q(QQuickOverlay);
- background->setWidth(q->width());
- background->setHeight(q->height());
-}
-
-QQuickOverlayPrivate::QQuickOverlayPrivate() :
- background(Q_NULLPTR),
- modalPopups(0)
-{
-}
-
-QQuickOverlay::QQuickOverlay(QQuickItem *parent)
- : QQuickItem(*(new QQuickOverlayPrivate), parent)
-{
- setAcceptedMouseButtons(Qt::AllButtons);
- setFiltersChildMouseEvents(true);
- setVisible(false);
-}
-
-
-QQuickItem *QQuickOverlay::background() const
-{
- Q_D(const QQuickOverlay);
- return d->background;
-}
-
-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();
- }
-}
-
-void QQuickOverlay::itemChange(ItemChange change, const ItemChangeData &data)
-{
- Q_D(QQuickOverlay);
- QQuickItem::itemChange(change, data);
-
- QQuickPopup *popup = Q_NULLPTR;
- if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
- QQuickDrawer *drawer = qobject_cast<QQuickDrawer *>(data.item);
- if (drawer) {
- if (change == ItemChildAddedChange) {
- QObjectPrivate::connect(drawer, &QQuickDrawer::positionChanged, d, &QQuickOverlayPrivate::drawerPositionChange);
- d->drawers.append(drawer);
- } else {
- QObjectPrivate::disconnect(drawer, &QQuickDrawer::positionChanged, d, &QQuickOverlayPrivate::drawerPositionChange);
- d->drawers.removeOne(drawer);
- }
- } else {
- popup = qobject_cast<QQuickPopup *>(data.item->parent());
- }
- setVisible(!childItems().isEmpty());
- }
- if (!popup)
- return;
-
- if (change == ItemChildAddedChange) {
- d->popups.append(popup);
- if (popup->isModal())
- ++d->modalPopups;
-
- QObjectPrivate::connect(popup, &QQuickPopup::aboutToShow, d, &QQuickOverlayPrivate::popupAboutToShow);
- QObjectPrivate::connect(popup, &QQuickPopup::aboutToHide, d, &QQuickOverlayPrivate::popupAboutToHide);
- } else if (change == ItemChildRemovedChange) {
- d->popups.removeOne(popup);
- if (popup->isModal())
- --d->modalPopups;
-
- QObjectPrivate::disconnect(popup, &QQuickPopup::aboutToShow, d, &QQuickOverlayPrivate::popupAboutToShow);
- QObjectPrivate::disconnect(popup, &QQuickPopup::aboutToHide, d, &QQuickOverlayPrivate::popupAboutToHide);
- }
-}
-
-void QQuickOverlay::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickOverlay);
- QQuickItem::geometryChanged(newGeometry, oldGeometry);
- if (d->background)
- d->resizeBackground();
-}
-
-void QQuickOverlay::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickOverlay);
- event->setAccepted(d->modalPopups > 0);
-}
-
-void QQuickOverlay::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickOverlay);
- event->setAccepted(d->modalPopups > 0);
-}
-
-void QQuickOverlay::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickOverlay);
- 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))
- break;
- }
-}
-
-void QQuickOverlay::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickOverlay);
- event->setAccepted(d->modalPopups > 0);
-}
-
-void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickOverlay);
- 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))
- break;
- }
-}
-
-void QQuickOverlay::wheelEvent(QWheelEvent *event)
-{
- Q_D(QQuickOverlay);
- event->setAccepted(d->modalPopups > 0);
-}
-
-bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event)
-{
- Q_D(QQuickOverlay);
- if (d->modalPopups == 0)
- return false;
- // TODO Filter touch events
- if (event->type() != QEvent::MouseButtonPress)
- return false;
- while (item->parentItem() != this)
- item = item->parentItem();
-
- 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];
- if (popupItem == item)
- break;
-
- QQuickPopup *popup = qobject_cast<QQuickPopup *>(popupItem->parent());
- if (popup) {
- QQuickPopup::ClosePolicy policy = popup->closePolicy();
- if (policy.testFlag(QQuickPopup::OnPressOutside) || policy.testFlag(QQuickPopup::OnPressOutsideParent))
- popup->close();
-
- if (!modalBlocked && popup->isModal())
- modalBlocked = true;
- }
- }
-
- return modalBlocked;
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickoverlay_p.h b/src/templates/qquickoverlay_p.h
deleted file mode 100644
index 6a4d56b3..00000000
--- a/src/templates/qquickoverlay_p.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKOVERLAY_P_H
-#define QQUICKOVERLAY_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/qquickitem.h>
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickOverlayPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickOverlay : public QQuickItem
-{
- Q_OBJECT
- Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
-
-public:
- explicit QQuickOverlay(QQuickItem *parent = Q_NULLPTR);
-
- QQuickItem *background() const;
- void setBackground(QQuickItem *background);
-
-Q_SIGNALS:
- void backgroundChanged();
- void pressed();
- 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 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;
-
-private:
- Q_DISABLE_COPY(QQuickOverlay)
- Q_DECLARE_PRIVATE(QQuickOverlay)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickOverlay)
-
-#endif // QQUICKOVERLAY_P_H
diff --git a/src/templates/qquickpage.cpp b/src/templates/qquickpage.cpp
deleted file mode 100644
index 6a65e7c4..00000000
--- a/src/templates/qquickpage.cpp
+++ /dev/null
@@ -1,283 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpage_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Page
- \inherits Control
- \instantiates QQuickPage
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief A page control.
-
- Page is a container control which makes it convenient to add
- a \l header and \l footer item to a page.
-
- \image qtlabscontrols-page-wireframe.png
-
- The following example snippet illustrates how to use a page-specific
- toolbar header and an application-wide tabbar footer.
-
- \qml
- import Qt.labs.controls 1.0
-
- ApplicationWindow {
- visible: true
-
- StackView {
- anchors.fill: parent
-
- initialItem: Page {
- header: ToolBar {
- // ...
- }
- }
- }
-
- footer: TabBar {
- // ...
- }
- }
- \endqml
-
- \sa ApplicationWindow, {Container Controls}
-*/
-
-class QQuickPagePrivate : public QQuickControlPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickPage)
-
-public:
- QQuickPagePrivate();
-
- void relayout();
-
- void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
- void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
-
- QQuickItem *header;
- QQuickItem *footer;
-};
-
-QQuickPagePrivate::QQuickPagePrivate() : header(Q_NULLPTR), footer(Q_NULLPTR)
-{
-}
-
-void QQuickPagePrivate::relayout()
-{
- Q_Q(QQuickPage);
- QQuickItem *content = q->contentItem();
- const qreal hh = header ? header->height() : 0;
- const qreal fh = footer ? footer->height() : 0;
-
- content->setY(hh + q->topPadding());
- content->setX(q->leftPadding());
- content->setWidth(q->availableWidth());
- content->setHeight(q->availableHeight() - hh - fh);
-
- if (header)
- header->setWidth(q->width());
-
- if (footer) {
- footer->setY(q->height() - fh);
- footer->setWidth(q->width());
- }
-}
-
-void QQuickPagePrivate::itemImplicitWidthChanged(QQuickItem *item)
-{
- Q_UNUSED(item);
- relayout();
-}
-
-void QQuickPagePrivate::itemImplicitHeightChanged(QQuickItem *item)
-{
- Q_UNUSED(item);
- relayout();
-}
-
-QQuickPage::QQuickPage(QQuickItem *parent) :
- QQuickControl(*(new QQuickPagePrivate), parent)
-{
- setFlag(ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Page::header
-
- 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.
-
- \sa footer, ApplicationWindow::header
-*/
-QQuickItem *QQuickPage::header() const
-{
- Q_D(const QQuickPage);
- return d->header;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Page::footer
-
- 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.
-
- \sa header, ApplicationWindow::footer
-*/
-QQuickItem *QQuickPage::footer() const
-{
- Q_D(const QQuickPage);
- return d->footer;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Page::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickPage::contentData()
-{
- Q_D(QQuickPage);
- return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::data_append,
- QQuickItemPrivate::data_count,
- QQuickItemPrivate::data_at,
- QQuickItemPrivate::data_clear);
-}
-
-/*!
- \qmlproperty list<Item> Qt.labs.controls::Page::contentChildren
-
- This property holds the list of content children.
-
- \sa Item::children
-*/
-QQmlListProperty<QQuickItem> QQuickPage::contentChildren()
-{
- Q_D(QQuickPage);
- return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::children_append,
- QQuickItemPrivate::children_count,
- QQuickItemPrivate::children_at,
- QQuickItemPrivate::children_clear);
-}
-
-void QQuickPage::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged);
- if (newItem)
- connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged);
- emit contentChildrenChanged();
-}
-
-void QQuickPage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickPage);
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
- d->relayout();
-}
-
-void QQuickPage::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
-{
- Q_D(QQuickPage);
- QQuickControl::paddingChange(newPadding, oldPadding);
- d->relayout();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickPage::accessibleRole() const
-{
- return QAccessible::PageTab;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickpage_p.h b/src/templates/qquickpage_p.h
deleted file mode 100644
index 157f0507..00000000
--- a/src/templates/qquickpage_p.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPAGE_P_H
-#define QQUICKPAGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtQml/qqmllist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPagePrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickPage : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
- Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentData")
-
-public:
- explicit QQuickPage(QQuickItem *parent = Q_NULLPTR);
-
- QQuickItem *header() const;
- void setHeader(QQuickItem *header);
-
- QQuickItem *footer() const;
- void setFooter(QQuickItem *footer);
-
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
-Q_SIGNALS:
- void headerChanged();
- void footerChanged();
- 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;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickPage)
- Q_DECLARE_PRIVATE(QQuickPage)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPage)
-
-#endif // QQUICKPAGE_P_H
diff --git a/src/templates/qquickpageindicator.cpp b/src/templates/qquickpageindicator.cpp
deleted file mode 100644
index a360627e..00000000
--- a/src/templates/qquickpageindicator.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpageindicator_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtCore/qmath.h>
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype PageIndicator
- \inherits Control
- \instantiates QQuickPageIndicator
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-indicators
- \brief A page indicator control.
-
- PageIndicator is used to indicate the currently active page
- in a container of multiple pages. PageIndicator consists of
- delegate items that present pages.
-
- \image qtlabscontrols-pageindicator.png
-
- \snippet qtlabscontrols-pageindicator.qml 1
-
- \labs
-
- \sa SwipeView, {Customizing PageIndicator}, {Indicator Controls}
-*/
-
-class QQuickPageIndicatorPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickPageIndicator)
-
-public:
- QQuickPageIndicatorPrivate() : count(0), currentIndex(0),
- interactive(false), delegate(Q_NULLPTR), pressedItem(Q_NULLPTR)
- {
- }
-
- QQuickItem *itemAt(const QPoint &pos) const;
- void updatePressed(bool pressed, const QPoint &pos = QPoint());
- void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
-
- void itemChildAdded(QQuickItem *, QQuickItem *child);
-
- int count;
- int currentIndex;
- bool interactive;
- QQmlComponent *delegate;
- QQuickItem *pressedItem;
-};
-
-QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
-{
- Q_Q(const QQuickPageIndicator);
- if (!contentItem || !q->contains(pos))
- return Q_NULLPTR;
-
- QPointF contentPos = q->mapToItem(contentItem, pos);
- QQuickItem *item = contentItem->childAt(contentPos.x(), contentPos.y());
- while (item && item->parentItem() != contentItem)
- item = item->parentItem();
- if (item && !QQuickItemPrivate::get(item)->isTransparentForPositioner())
- return item;
-
- // find the nearest
- qreal distance = qInf();
- QQuickItem *nearest = Q_NULLPTR;
- foreach (QQuickItem *child, contentItem->childItems()) {
- if (QQuickItemPrivate::get(child)->isTransparentForPositioner())
- continue;
-
- QPointF center = child->boundingRect().center();
- QPointF pt = contentItem->mapToItem(child, contentPos);
-
- qreal len = QLineF(center, pt).length();
- if (len < distance) {
- distance = len;
- nearest = child;
- }
- }
- return nearest;
-}
-
-void QQuickPageIndicatorPrivate::updatePressed(bool pressed, const QPoint &pos)
-{
- QQuickItem *prevItem = pressedItem;
- pressedItem = pressed ? itemAt(pos) : Q_NULLPTR;
- if (prevItem != pressedItem) {
- setContextProperty(prevItem, QStringLiteral("pressed"), false);
- setContextProperty(pressedItem, QStringLiteral("pressed"), pressed);
- }
-}
-
-void QQuickPageIndicatorPrivate::setContextProperty(QQuickItem *item, const QString &name, const QVariant &value)
-{
- QQmlContext *context = qmlContext(item);
- if (context && context->isValid()) {
- context = context->parentContext();
- if (context && context->isValid())
- context->setContextProperty(name, value);
- }
-}
-
-void QQuickPageIndicatorPrivate::itemChildAdded(QQuickItem *, QQuickItem *child)
-{
- if (!QQuickItemPrivate::get(child)->isTransparentForPositioner())
- setContextProperty(child, QStringLiteral("pressed"), false);
-}
-
-QQuickPageIndicator::QQuickPageIndicator(QQuickItem *parent) :
- QQuickControl(*(new QQuickPageIndicatorPrivate), parent)
-{
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::PageIndicator::count
-
- This property holds the number of pages.
-*/
-int QQuickPageIndicator::count() const
-{
- Q_D(const QQuickPageIndicator);
- return d->count;
-}
-
-void QQuickPageIndicator::setCount(int count)
-{
- Q_D(QQuickPageIndicator);
- if (d->count != count) {
- d->count = count;
- emit countChanged();
- }
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::PageIndicator::currentIndex
-
- This property holds the index of the current page.
-*/
-int QQuickPageIndicator::currentIndex() const
-{
- Q_D(const QQuickPageIndicator);
- return d->currentIndex;
-}
-
-void QQuickPageIndicator::setCurrentIndex(int index)
-{
- Q_D(QQuickPageIndicator);
- if (d->currentIndex != index) {
- d->currentIndex = index;
- emit currentIndexChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::PageIndicator::interactive
-
- This property holds whether the control is interactive. An interactive page indicator
- reacts to presses and automatically changes the \l {currentIndex}{current index}
- appropriately.
-
- The default value is \c false.
-*/
-bool QQuickPageIndicator::isInteractive() const
-{
- Q_D(const QQuickPageIndicator);
- return d->interactive;
-}
-
-void QQuickPageIndicator::setInteractive(bool interactive)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive != interactive) {
- d->interactive = interactive;
- setAcceptedMouseButtons(interactive ? Qt::LeftButton : Qt::NoButton);
- emit interactiveChanged();
- }
-}
-
-/*!
- \qmlproperty Component Qt.labs.controls::PageIndicator::delegate
-
- This property holds a delegate that presents a page.
-
- The following properties are available in the context of each delegate:
- \table
- \row \li \b index : int \li The index of the item
- \row \li \b pressed : bool \li Whether the item is pressed
- \endtable
-*/
-QQmlComponent *QQuickPageIndicator::delegate() const
-{
- Q_D(const QQuickPageIndicator);
- return d->delegate;
-}
-
-void QQuickPageIndicator::setDelegate(QQmlComponent *delegate)
-{
- Q_D(QQuickPageIndicator);
- if (d->delegate != delegate) {
- d->delegate = delegate;
- emit delegateChanged();
- }
-}
-
-void QQuickPageIndicator::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_D(QQuickPageIndicator);
- QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
- if (newItem)
- QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
-}
-
-void QQuickPageIndicator::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive) {
- d->updatePressed(true, event->pos());
- event->accept();
- }
-}
-
-void QQuickPageIndicator::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive) {
- d->updatePressed(true, event->pos());
- event->accept();
- }
-}
-
-void QQuickPageIndicator::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive) {
- if (d->pressedItem)
- setCurrentIndex(d->contentItem->childItems().indexOf(d->pressedItem));
- d->updatePressed(false);
- event->accept();
- }
-}
-
-void QQuickPageIndicator::mouseUngrabEvent()
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive)
- d->updatePressed(false);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickPageIndicator::accessibleRole() const
-{
- return QAccessible::Indicator;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickpageindicator_p.h b/src/templates/qquickpageindicator_p.h
deleted file mode 100644
index 487b4d6e..00000000
--- a/src/templates/qquickpageindicator_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPAGEINDICATOR_P_H
-#define QQUICKPAGEINDICATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQmlComponent;
-class QQuickPageIndicatorPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickPageIndicator : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(int count READ count WRITE setCount NOTIFY countChanged FINAL)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
- Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL)
- Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
-
-public:
- explicit QQuickPageIndicator(QQuickItem *parent = Q_NULLPTR);
-
- int count() const;
- void setCount(int count);
-
- int currentIndex() const;
- void setCurrentIndex(int index);
-
- bool isInteractive() const;
- void setInteractive(bool interactive);
-
- QQmlComponent *delegate() const;
- void setDelegate(QQmlComponent *delegate);
-
-Q_SIGNALS:
- void countChanged();
- void currentIndexChanged();
- void interactiveChanged();
- void delegateChanged();
-
-protected:
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) 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;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickPageIndicator)
- Q_DECLARE_PRIVATE(QQuickPageIndicator)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPageIndicator)
-
-#endif // QQUICKPAGEINDICATOR_P_H
diff --git a/src/templates/qquickpane.cpp b/src/templates/qquickpane.cpp
deleted file mode 100644
index 9bedb150..00000000
--- a/src/templates/qquickpane.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpane_p.h"
-#include "qquickpane_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Pane
- \inherits Control
- \instantiates QQuickPane
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief A pane control.
-
- 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
- position its contents, for instance by creating a \l RowLayout or a
- \l ColumnLayout.
-
- If only a single item is used within a Pane, it will resize to fit the
- implicit size of its contained item. This makes it particularly suitable
- for use together with layouts.
-
- \image qtlabscontrols-pane.png
-
- \snippet qtlabscontrols-pane.qml 1
-
- \labs
-
- \sa {Customizing Pane}, {Container Controls}
-*/
-
-QQuickPanePrivate::QQuickPanePrivate() : contentWidth(0), contentHeight(0)
-{
-}
-
-QQuickPane::QQuickPane(QQuickItem *parent) :
- QQuickControl(*(new QQuickPanePrivate), parent)
-{
- setFlag(QQuickItem::ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-}
-
-QQuickPane::QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent) :
- QQuickControl(dd, parent)
-{
- setFlag(QQuickItem::ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Pane::contentWidth
-
- This property holds the content width. It is used for calculating the
- total implicit width of the pane.
-
- \note If only a single item is used within the pane, the implicit width
- of its contained item is used as the content width.
-*/
-qreal QQuickPane::contentWidth() const
-{
- Q_D(const QQuickPane);
- return d->contentWidth;
-}
-
-void QQuickPane::setContentWidth(qreal width)
-{
- Q_D(QQuickPane);
- if (d->contentWidth != width) {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Pane::contentHeight
-
- This property holds the content height. It is used for calculating the
- total implicit height of the pane.
-
- \note If only a single item is used within the pane, the implicit height
- of its contained item is used as the content height.
-*/
-qreal QQuickPane::contentHeight() const
-{
- Q_D(const QQuickPane);
- return d->contentHeight;
-}
-
-void QQuickPane::setContentHeight(qreal height)
-{
- Q_D(QQuickPane);
- if (d->contentHeight != height) {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
-}
-
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Pane::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickPane::contentData()
-{
- Q_D(QQuickPane);
- return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::data_append,
- QQuickItemPrivate::data_count,
- QQuickItemPrivate::data_at,
- QQuickItemPrivate::data_clear);
-}
-
-/*!
- \qmlproperty list<Item> Qt.labs.controls::Pane::contentChildren
-
- This property holds the list of content children.
-
- \sa Item::children
-*/
-QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
-{
- Q_D(QQuickPane);
- return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::children_append,
- QQuickItemPrivate::children_count,
- QQuickItemPrivate::children_at,
- QQuickItemPrivate::children_clear);
-}
-
-void QQuickPane::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
- if (newItem)
- connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
- emit contentChildrenChanged();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickPane::accessibleRole() const
-{
- return QAccessible::Pane;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickpane_p.h b/src/templates/qquickpane_p.h
deleted file mode 100644
index e599f55f..00000000
--- a/src/templates/qquickpane_p.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPANE_P_H
-#define QQUICKPANE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtQml/qqmllist.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPanePrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickPane : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentData")
-
-public:
- explicit QQuickPane(QQuickItem *parent = Q_NULLPTR);
-
- qreal contentWidth() const;
- void setContentWidth(qreal width);
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
-
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
-Q_SIGNALS:
- void contentWidthChanged();
- void contentHeightChanged();
- void contentChildrenChanged();
-
-protected:
- QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent);
-
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickPane)
- Q_DECLARE_PRIVATE(QQuickPane)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPane)
-
-#endif // QQUICKPANE_P_H
diff --git a/src/templates/qquickpane_p_p.h b/src/templates/qquickpane_p_p.h
deleted file mode 100644
index 477dc0bc..00000000
--- a/src/templates/qquickpane_p_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPANE_P_P_H
-#define QQUICKPANE_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickPane;
-
-class Q_LABSTEMPLATES_EXPORT QQuickPanePrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickPane)
-
-public:
- QQuickPanePrivate();
-
- qreal contentWidth;
- qreal contentHeight;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKPANE_P_P_H
diff --git a/src/templates/qquickpopup.cpp b/src/templates/qquickpopup.cpp
deleted file mode 100644
index ef092bed..00000000
--- a/src/templates/qquickpopup.cpp
+++ /dev/null
@@ -1,1678 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpopup_p.h"
-#include "qquickpopup_p_p.h"
-#include "qquickapplicationwindow_p.h"
-#include "qquickoverlay_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtQml/qqmlinfo.h>
-#include <QtQuick/qquickitem.h>
-#include <QtQuick/private/qquicktransition_p.h>
-#include <QtQuick/private/qquickitem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Popup
- \inherits QtObject
- \instantiates QQuickPopup
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-popups
- \brief A popup control.
-
- Popup is the base type of popup-like user interface controls. It can be
- used with Window or ApplicationWindow.
-
- \qml
- import QtQuick.Window 2.2
- import Qt.labs.controls 1.0
-
- Window {
- id: window
- width: 400
- height: 400
- visible: true
-
- Button {
- text: "Open"
- onClicked: popup.open()
- }
-
- Popup {
- id: popup
- x: 100
- y: 100
- width: 200
- height: 300
- modal: true
- focus: true
- closePolicy: Popup.OnEscape | Popup.OnPressOutside
- }
- }
- \endqml
-
- In order to ensure that a popup is displayed above other items in the
- scene, it is recommended to use ApplicationWindow. ApplicationWindow also
- provides background dimming effects.
-
- \labs
-*/
-
-static const QQuickItemPrivate::ChangeTypes AncestorChangeTypes = QQuickItemPrivate::Geometry
- | QQuickItemPrivate::Parent
- | QQuickItemPrivate::Children;
-
-static const QQuickItemPrivate::ChangeTypes ItemChangeTypes = QQuickItemPrivate::Geometry
- | QQuickItemPrivate::Parent
- | QQuickItemPrivate::Destroyed;
-
-QQuickPopupPrivate::QQuickPopupPrivate()
- : QObjectPrivate()
- , focus(false)
- , modal(false)
- , complete(false)
- , hasTopMargin(false)
- , hasLeftMargin(false)
- , hasRightMargin(false)
- , hasBottomMargin(false)
- , margins(0)
- , topMargin(0)
- , leftMargin(0)
- , rightMargin(0)
- , bottomMargin(0)
- , contentWidth(0)
- , contentHeight(0)
- , closePolicy(QQuickPopup::OnEscape)
- , parentItem(Q_NULLPTR)
- , enter(Q_NULLPTR)
- , exit(Q_NULLPTR)
- , popupItem(Q_NULLPTR)
- , positioner(this)
- , transitionManager(this)
-{
-}
-
-void QQuickPopupPrivate::init()
-{
- Q_Q(QQuickPopup);
- popupItem = new QQuickPopupItem(q);
- q->setParentItem(qobject_cast<QQuickItem *>(parent));
- QObject::connect(popupItem, &QQuickControl::paddingChanged, q, &QQuickPopup::paddingChanged);
-}
-
-bool QQuickPopupPrivate::tryClose(QQuickItem *item, QMouseEvent *event)
-{
- Q_Q(QQuickPopup);
- const bool isPress = event->type() == QEvent::MouseButtonPress;
- const bool onOutside = closePolicy.testFlag(isPress ? QQuickPopup::OnPressOutside : QQuickPopup::OnReleaseOutside);
- const bool onOutsideParent = closePolicy.testFlag(isPress ? QQuickPopup::OnPressOutsideParent : QQuickPopup::OnReleaseOutsideParent);
- if (onOutside || onOutsideParent) {
- if (onOutsideParent) {
- if (!popupItem->contains(item->mapToItem(popupItem, event->pos())) &&
- (!parentItem || !parentItem->contains(item->mapToItem(parentItem, event->pos())))) {
- q->close();
- return true;
- }
- } else if (onOutside) {
- if (!popupItem->contains(item->mapToItem(popupItem, event->pos()))) {
- q->close();
- return true;
- }
- }
- }
- return false;
-}
-
-void QQuickPopupPrivate::finalizeEnterTransition()
-{
- if (focus)
- popupItem->setFocus(true);
-}
-
-void QQuickPopupPrivate::finalizeExitTransition()
-{
- positioner.setParentItem(Q_NULLPTR);
- popupItem->setParentItem(Q_NULLPTR);
- popupItem->setVisible(false);
-}
-
-QMarginsF QQuickPopupPrivate::getMargins() const
-{
- Q_Q(const QQuickPopup);
- return QMarginsF(q->leftMargin(), q->topMargin(), q->rightMargin(), q->bottomMargin());
-}
-
-void QQuickPopupPrivate::setTopMargin(qreal value, bool reset)
-{
- Q_Q(QQuickPopup);
- qreal oldMargin = q->topMargin();
- topMargin = value;
- hasTopMargin = !reset;
- if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
- emit q->topMarginChanged();
- q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
- QMarginsF(leftMargin, oldMargin, rightMargin, bottomMargin));
- }
-}
-
-void QQuickPopupPrivate::setLeftMargin(qreal value, bool reset)
-{
- Q_Q(QQuickPopup);
- qreal oldMargin = q->leftMargin();
- leftMargin = value;
- hasLeftMargin = !reset;
- if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
- emit q->leftMarginChanged();
- q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
- QMarginsF(oldMargin, topMargin, rightMargin, bottomMargin));
- }
-}
-
-void QQuickPopupPrivate::setRightMargin(qreal value, bool reset)
-{
- Q_Q(QQuickPopup);
- qreal oldMargin = q->rightMargin();
- rightMargin = value;
- hasRightMargin = !reset;
- if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
- emit q->rightMarginChanged();
- q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
- QMarginsF(leftMargin, topMargin, oldMargin, bottomMargin));
- }
-}
-
-void QQuickPopupPrivate::setBottomMargin(qreal value, bool reset)
-{
- Q_Q(QQuickPopup);
- qreal oldMargin = q->bottomMargin();
- bottomMargin = value;
- hasBottomMargin = !reset;
- if ((!reset && !qFuzzyCompare(oldMargin, value)) || (reset && !qFuzzyCompare(oldMargin, margins))) {
- emit q->bottomMarginChanged();
- q->marginsChange(QMarginsF(leftMargin, topMargin, rightMargin, bottomMargin),
- QMarginsF(leftMargin, topMargin, rightMargin, oldMargin));
- }
-}
-
-class QQuickPopupItemPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickPopupItem)
-
-public:
- QQuickPopupItemPrivate(QQuickPopup *popup);
-
- void implicitWidthChanged() Q_DECL_OVERRIDE;
- void implicitHeightChanged() Q_DECL_OVERRIDE;
-
- QQuickPopup *popup;
-};
-
-QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup) : popup(popup)
-{
- isTabFence = true;
-}
-
-void QQuickPopupItemPrivate::implicitWidthChanged()
-{
- QQuickControlPrivate::implicitWidthChanged();
- emit popup->implicitWidthChanged();
-}
-
-void QQuickPopupItemPrivate::implicitHeightChanged()
-{
- QQuickControlPrivate::implicitHeightChanged();
- emit popup->implicitHeightChanged();
-}
-
-QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup) :
- QQuickControl(*(new QQuickPopupItemPrivate(popup)), Q_NULLPTR)
-{
- setParent(popup);
- setVisible(false);
- setFlag(ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-}
-
-void QQuickPopupItem::focusInEvent(QFocusEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->focusInEvent(event);
-}
-
-void QQuickPopupItem::focusOutEvent(QFocusEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->focusOutEvent(event);
-}
-
-void QQuickPopupItem::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->keyPressEvent(event);
-}
-
-void QQuickPopupItem::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->keyReleaseEvent(event);
-}
-
-void QQuickPopupItem::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->mousePressEvent(event);
-}
-
-void QQuickPopupItem::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->mouseMoveEvent(event);
-}
-
-void QQuickPopupItem::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->mouseReleaseEvent(event);
-}
-
-void QQuickPopupItem::mouseDoubleClickEvent(QMouseEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->mouseDoubleClickEvent(event);
-}
-
-void QQuickPopupItem::mouseUngrabEvent()
-{
- Q_D(QQuickPopupItem);
- d->popup->mouseUngrabEvent();
-}
-
-void QQuickPopupItem::wheelEvent(QWheelEvent *event)
-{
- Q_D(QQuickPopupItem);
- d->popup->wheelEvent(event);
-}
-
-void QQuickPopupItem::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_D(QQuickPopupItem);
- QQuickControl::contentItemChange(newItem, oldItem);
- d->popup->contentItemChange(newItem, oldItem);
-}
-
-void QQuickPopupItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickPopupItem);
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
- d->popup->geometryChanged(newGeometry, oldGeometry);
-}
-
-void QQuickPopupItem::itemChange(ItemChange change, const ItemChangeData &data)
-{
- Q_D(QQuickPopupItem);
- QQuickControl::itemChange(change, data);
- switch (change) {
- case ItemVisibleHasChanged:
- emit d->popup->visibleChanged();
- break;
- case ItemActiveFocusHasChanged:
- emit d->popup->activeFocusChanged();
- break;
- case ItemOpacityHasChanged:
- emit d->popup->opacityChanged();
- break;
- default:
- break;
- }
-}
-
-void QQuickPopupItem::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
-{
- Q_D(QQuickPopupItem);
- QQuickControl::paddingChange(newPadding, oldPadding);
- d->popup->paddingChange(newPadding, oldPadding);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickPopupItem::accessibleRole() const
-{
- Q_D(const QQuickPopupItem);
- return d->popup->accessibleRole();
-}
-#endif // QT_NO_ACCESSIBILITY
-
-QQuickPopupPositioner::QQuickPopupPositioner(QQuickPopupPrivate *popup) :
- m_x(0),
- m_y(0),
- m_parentItem(Q_NULLPTR),
- m_popup(popup)
-{
-}
-
-QQuickPopupPositioner::~QQuickPopupPositioner()
-{
- if (m_parentItem) {
- QQuickItemPrivate::get(m_parentItem)->removeItemChangeListener(this, ItemChangeTypes);
- removeAncestorListeners(m_parentItem->parentItem());
- }
-}
-
-qreal QQuickPopupPositioner::x() const
-{
- return m_x;
-}
-
-void QQuickPopupPositioner::setX(qreal x)
-{
- if (m_x != x) {
- m_x = x;
- if (m_popup->popupItem->isVisible())
- repositionPopup();
- }
-}
-
-qreal QQuickPopupPositioner::y() const
-{
- return m_y;
-}
-
-void QQuickPopupPositioner::setY(qreal y)
-{
- if (m_y != y) {
- m_y = y;
- if (m_popup->popupItem->isVisible())
- repositionPopup();
- }
-}
-
-QQuickItem *QQuickPopupPositioner::parentItem() const
-{
- return m_parentItem;
-}
-
-void QQuickPopupPositioner::setParentItem(QQuickItem *parent)
-{
- if (m_parentItem == parent)
- return;
-
- if (m_parentItem) {
- QQuickItemPrivate::get(m_parentItem)->removeItemChangeListener(this, ItemChangeTypes);
- removeAncestorListeners(m_parentItem->parentItem());
- }
-
- m_parentItem = parent;
-
- if (!parent)
- return;
-
- QQuickItemPrivate::get(parent)->addItemChangeListener(this, ItemChangeTypes);
- addAncestorListeners(parent->parentItem());
-
- if (m_popup->popupItem->isVisible())
- repositionPopup();
-}
-
-void QQuickPopupPositioner::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
-{
- if (m_popup->popupItem->isVisible())
- repositionPopup();
-}
-
-void QQuickPopupPositioner::itemParentChanged(QQuickItem *, QQuickItem *parent)
-{
- addAncestorListeners(parent);
-}
-
-void QQuickPopupPositioner::itemChildRemoved(QQuickItem *item, QQuickItem *child)
-{
- if (isAncestor(child))
- removeAncestorListeners(item);
-}
-
-void QQuickPopupPositioner::itemDestroyed(QQuickItem *item)
-{
- Q_ASSERT(m_parentItem == item);
-
- m_parentItem = Q_NULLPTR;
- m_popup->parentItem = Q_NULLPTR;
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, ItemChangeTypes);
- removeAncestorListeners(item->parentItem());
-}
-
-void QQuickPopupPositioner::repositionPopup()
-{
- const qreal w = m_popup->popupItem->width();
- const qreal h = m_popup->popupItem->height();
- const qreal iw = m_popup->popupItem->implicitWidth();
- const qreal ih = m_popup->popupItem->implicitHeight();
-
- bool adjusted = false;
- QRectF rect(m_x, m_y, iw > 0 ? iw : w, ih > 0 ? ih : h);
- if (m_parentItem) {
- rect = m_parentItem->mapRectToScene(rect);
-
- QQuickWindow *window = m_parentItem->window();
- if (window) {
- const QMarginsF margins = m_popup->getMargins();
- const QRectF bounds = QRectF(0, 0, window->width(), window->height()).marginsRemoved(margins);
-
- // push inside the margins
- if (margins.top() > 0 && rect.top() < bounds.top())
- rect.moveTop(margins.top());
- if (margins.bottom() > 0 && rect.bottom() > bounds.bottom())
- rect.moveBottom(bounds.bottom());
- if (margins.left() > 0 && rect.left() < bounds.left())
- rect.moveLeft(margins.left());
- if (margins.right() > 0 && rect.right() > bounds.right())
- rect.moveRight(bounds.right());
-
- if (rect.top() < bounds.top() || rect.bottom() > bounds.bottom()) {
- // if the popup doesn't fit inside the window, try flipping it around (below <-> above)
- const QRectF flipped = m_parentItem->mapRectToScene(QRectF(m_x, m_parentItem->height() - m_y - rect.height(), rect.width(), rect.height()));
- if (flipped.top() >= bounds.top() && flipped.bottom() < bounds.bottom()) {
- adjusted = true;
- rect = flipped;
- } else if (ih > 0) {
- // neither the flipped around geometry fits inside the window, choose
- // whichever side (above vs. below) fits larger part of the popup
- const QRectF primary = rect.intersected(bounds);
- const QRectF secondary = flipped.intersected(bounds);
-
- if (primary.height() > secondary.height()) {
- rect.setY(primary.y());
- rect.setHeight(primary.height());
- } else {
- rect.setY(secondary.y());
- rect.setHeight(secondary.height());
- }
- adjusted = true;
- }
- }
- }
- }
-
- m_popup->popupItem->setPosition(rect.topLeft());
- if (adjusted && ih > 0)
- m_popup->popupItem->setHeight(rect.height());
-}
-
-void QQuickPopupPositioner::removeAncestorListeners(QQuickItem *item)
-{
- if (item == m_parentItem)
- return;
-
- QQuickItem *p = item;
- while (p) {
- QQuickItemPrivate::get(p)->removeItemChangeListener(this, AncestorChangeTypes);
- p = p->parentItem();
- }
-}
-
-void QQuickPopupPositioner::addAncestorListeners(QQuickItem *item)
-{
- if (item == m_parentItem)
- return;
-
- QQuickItem *p = item;
- while (p) {
- QQuickItemPrivate::get(p)->addItemChangeListener(this, AncestorChangeTypes);
- p = p->parentItem();
- }
-}
-
-// TODO: use QQuickItem::isAncestorOf() in dev/5.7
-bool QQuickPopupPositioner::isAncestor(QQuickItem *item) const
-{
- if (!m_parentItem)
- return false;
-
- QQuickItem *parent = m_parentItem;
- while (parent) {
- if (parent == item)
- return true;
- parent = parent->parentItem();
- }
- return false;
-}
-
-QQuickPopupTransitionManager::QQuickPopupTransitionManager(QQuickPopupPrivate *popup)
- : QQuickTransitionManager()
- , state(Off)
- , popup(popup)
-{
-}
-
-void QQuickPopupTransitionManager::transitionEnter()
-{
- if (state == Enter && isRunning())
- return;
- QList<QQuickStateAction> actions;
- state = Enter;
- transition(actions, popup->enter, popup->popupItem);
-}
-
-void QQuickPopupTransitionManager::transitionExit()
-{
- if (state == Exit && isRunning())
- return;
- QList<QQuickStateAction> actions;
- state = Exit;
- transition(actions, popup->exit, popup->popupItem);
-}
-
-void QQuickPopupTransitionManager::finished()
-{
- if (state == Enter)
- popup->finalizeEnterTransition();
- else if (state == Exit)
- popup->finalizeExitTransition();
-
- state = Off;
-}
-
-QQuickPopup::QQuickPopup(QObject *parent)
- : QObject(*(new QQuickPopupPrivate), parent)
-{
- Q_D(QQuickPopup);
- d->init();
-}
-
-QQuickPopup::QQuickPopup(QQuickPopupPrivate &dd, QObject *parent)
- : QObject(dd, parent)
-{
- Q_D(QQuickPopup);
- d->init();
-}
-
-QQuickPopup::~QQuickPopup()
-{
- Q_D(QQuickPopup);
- d->positioner.setParentItem(Q_NULLPTR);
- delete d->popupItem;
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Popup::open()
-
- Opens the popup.
-*/
-void QQuickPopup::open()
-{
- Q_D(QQuickPopup);
- if (d->popupItem->isVisible())
- return;
-
- QQuickWindow *window = Q_NULLPTR;
- if (d->parentItem)
- window = d->parentItem->window();
- if (!window) {
- qmlInfo(this) << "cannot find any window to open popup in.";
- return;
- }
-
- QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
- if (!applicationWindow) {
- window->installEventFilter(this);
- d->popupItem->setZ(10001); // DefaultWindowDecoration+1
- d->popupItem->setParentItem(window->contentItem());
- } else {
- d->popupItem->setParentItem(applicationWindow->overlay());
- }
-
- emit aboutToShow();
- d->popupItem->setVisible(true);
- d->positioner.setParentItem(d->parentItem);
- d->transitionManager.transitionEnter();
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Popup::close()
-
- Closes the popup.
-*/
-void QQuickPopup::close()
-{
- Q_D(QQuickPopup);
- if (!d->popupItem->isVisible())
- return;
-
- if (d->parentItem) {
- QQuickWindow *window = d->parentItem->window();
- if (!qobject_cast<QQuickApplicationWindow *>(window)) {
- window->removeEventFilter(this);
- }
- }
-
- d->popupItem->setFocus(false);
- emit aboutToHide();
- d->transitionManager.transitionExit();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::x
-
- This property holds the x-coordinate of the popup.
-*/
-qreal QQuickPopup::x() const
-{
- Q_D(const QQuickPopup);
- return d->positioner.x();
-}
-
-void QQuickPopup::setX(qreal x)
-{
- Q_D(QQuickPopup);
- d->positioner.setX(x);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::y
-
- This property holds the y-coordinate of the popup.
-*/
-qreal QQuickPopup::y() const
-{
- Q_D(const QQuickPopup);
- return d->positioner.y();
-}
-
-void QQuickPopup::setY(qreal y)
-{
- Q_D(QQuickPopup);
- d->positioner.setY(y);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::z
-
- This property holds the z-value of the popup. Z-value determines
- the stacking order of popups. The default z-value is \c 0.
-*/
-qreal QQuickPopup::z() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->z();
-}
-
-void QQuickPopup::setZ(qreal z)
-{
- Q_D(QQuickPopup);
- if (qFuzzyCompare(z, d->popupItem->z()))
- return;
- d->popupItem->setZ(z);
- emit zChanged();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::width
-
- This property holds the width of the popup.
-*/
-qreal QQuickPopup::width() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->width();
-}
-
-void QQuickPopup::setWidth(qreal width)
-{
- Q_D(QQuickPopup);
- d->popupItem->setWidth(width);
-}
-
-void QQuickPopup::resetWidth()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetWidth();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::height
-
- This property holds the height of the popup.
-*/
-qreal QQuickPopup::height() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->height();
-}
-
-void QQuickPopup::setHeight(qreal height)
-{
- Q_D(QQuickPopup);
- d->popupItem->setHeight(height);
-}
-
-void QQuickPopup::resetHeight()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetHeight();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::implicitWidth
-
- This property holds the implicit width of the popup.
-*/
-qreal QQuickPopup::implicitWidth() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->implicitWidth();
-}
-
-void QQuickPopup::setImplicitWidth(qreal width)
-{
- Q_D(QQuickPopup);
- d->popupItem->setImplicitWidth(width);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::implicitHeight
-
- This property holds the implicit height of the popup.
-*/
-qreal QQuickPopup::implicitHeight() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->implicitHeight();
-}
-
-void QQuickPopup::setImplicitHeight(qreal height)
-{
- Q_D(QQuickPopup);
- d->popupItem->setImplicitHeight(height);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::contentWidth
-
- This property holds the content width. It is used for calculating the
- total implicit width of the Popup.
-
- \note If only a single item is used within the Popup, the implicit width
- of its contained item is used as the content width.
-*/
-qreal QQuickPopup::contentWidth() const
-{
- Q_D(const QQuickPopup);
- return d->contentWidth;
-}
-
-void QQuickPopup::setContentWidth(qreal width)
-{
- Q_D(QQuickPopup);
- if (d->contentWidth != width) {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::contentHeight
-
- This property holds the content height. It is used for calculating the
- total implicit height of the Popup.
-
- \note If only a single item is used within the Popup, the implicit height
- of its contained item is used as the content height.
-*/
-qreal QQuickPopup::contentHeight() const
-{
- Q_D(const QQuickPopup);
- return d->contentHeight;
-}
-
-void QQuickPopup::setContentHeight(qreal height)
-{
- Q_D(QQuickPopup);
- if (d->contentHeight != height) {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::availableWidth
- \readonly
-
- This property holds the width available after deducting horizontal padding.
-
- \sa padding, leftPadding, rightPadding
-*/
-qreal QQuickPopup::availableWidth() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->availableWidth();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::availableHeight
- \readonly
-
- This property holds the height available after deducting vertical padding.
-
- \sa padding, topPadding, bottomPadding
-*/
-qreal QQuickPopup::availableHeight() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->availableHeight();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::margins
-
- This property holds the default margins around the popup.
-
- \sa topMargin, leftMargin, rightMargin, bottomMargin
-*/
-qreal QQuickPopup::margins() const
-{
- Q_D(const QQuickPopup);
- return d->margins;
-}
-
-void QQuickPopup::setMargins(qreal margins)
-{
- Q_D(QQuickPopup);
- if (qFuzzyCompare(d->margins, margins))
- return;
- QMarginsF oldMargins(leftMargin(), topMargin(), rightMargin(), bottomMargin());
- d->margins = margins;
- emit marginsChanged();
- QMarginsF newMargins(leftMargin(), topMargin(), rightMargin(), bottomMargin());
- if (!qFuzzyCompare(newMargins.top(), oldMargins.top()))
- emit topMarginChanged();
- if (!qFuzzyCompare(newMargins.left(), oldMargins.left()))
- emit leftMarginChanged();
- if (!qFuzzyCompare(newMargins.right(), oldMargins.right()))
- emit rightMarginChanged();
- if (!qFuzzyCompare(newMargins.bottom(), oldMargins.bottom()))
- emit bottomMarginChanged();
- marginsChange(newMargins, oldMargins);
-}
-
-void QQuickPopup::resetMargins()
-{
- setMargins(0);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::topMargin
-
- This property holds the top margin around the popup.
-
- \sa margins, bottomMargin
-*/
-qreal QQuickPopup::topMargin() const
-{
- Q_D(const QQuickPopup);
- if (d->hasTopMargin)
- return d->topMargin;
- return d->margins;
-}
-
-void QQuickPopup::setTopMargin(qreal margin)
-{
- Q_D(QQuickPopup);
- d->setTopMargin(margin);
-}
-
-void QQuickPopup::resetTopMargin()
-{
- Q_D(QQuickPopup);
- d->setTopMargin(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::leftMargin
-
- This property holds the left margin around the popup.
-
- \sa margins, rightMargin
-*/
-qreal QQuickPopup::leftMargin() const
-{
- Q_D(const QQuickPopup);
- if (d->hasLeftMargin)
- return d->leftMargin;
- return d->margins;
-}
-
-void QQuickPopup::setLeftMargin(qreal margin)
-{
- Q_D(QQuickPopup);
- d->setLeftMargin(margin);
-}
-
-void QQuickPopup::resetLeftMargin()
-{
- Q_D(QQuickPopup);
- d->setLeftMargin(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::rightMargin
-
- This property holds the right margin around the popup.
-
- \sa margins, leftMargin
-*/
-qreal QQuickPopup::rightMargin() const
-{
- Q_D(const QQuickPopup);
- if (d->hasRightMargin)
- return d->rightMargin;
- return d->margins;
-}
-
-void QQuickPopup::setRightMargin(qreal margin)
-{
- Q_D(QQuickPopup);
- d->setRightMargin(margin);
-}
-
-void QQuickPopup::resetRightMargin()
-{
- Q_D(QQuickPopup);
- d->setRightMargin(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::bottomMargin
-
- This property holds the bottom margin around the popup.
-
- \sa margins, topMargin
-*/
-qreal QQuickPopup::bottomMargin() const
-{
- Q_D(const QQuickPopup);
- if (d->hasBottomMargin)
- return d->bottomMargin;
- return d->margins;
-}
-
-void QQuickPopup::setBottomMargin(qreal margin)
-{
- Q_D(QQuickPopup);
- d->setBottomMargin(margin);
-}
-
-void QQuickPopup::resetBottomMargin()
-{
- Q_D(QQuickPopup);
- d->setBottomMargin(0, true);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::padding
-
- This property holds the default padding.
-
- \sa availableWidth, availableHeight, topPadding, leftPadding, rightPadding, bottomPadding
-*/
-qreal QQuickPopup::padding() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->padding();
-}
-
-void QQuickPopup::setPadding(qreal padding)
-{
- Q_D(QQuickPopup);
- d->popupItem->setPadding(padding);
-}
-
-void QQuickPopup::resetPadding()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetPadding();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::topPadding
-
- This property holds the top padding.
-
- \sa padding, bottomPadding, availableHeight
-*/
-qreal QQuickPopup::topPadding() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->topPadding();
-}
-
-void QQuickPopup::setTopPadding(qreal padding)
-{
- Q_D(QQuickPopup);
- d->popupItem->setTopPadding(padding);
-}
-
-void QQuickPopup::resetTopPadding()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetTopPadding();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::leftPadding
-
- This property holds the left padding.
-
- \sa padding, rightPadding, availableWidth
-*/
-qreal QQuickPopup::leftPadding() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->leftPadding();
-}
-
-void QQuickPopup::setLeftPadding(qreal padding)
-{
- Q_D(QQuickPopup);
- d->popupItem->setLeftPadding(padding);
-}
-
-void QQuickPopup::resetLeftPadding()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetLeftPadding();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::rightPadding
-
- This property holds the right padding.
-
- \sa padding, leftPadding, availableWidth
-*/
-qreal QQuickPopup::rightPadding() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->rightPadding();
-}
-
-void QQuickPopup::setRightPadding(qreal padding)
-{
- Q_D(QQuickPopup);
- d->popupItem->setRightPadding(padding);
-}
-
-void QQuickPopup::resetRightPadding()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetRightPadding();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::bottomPadding
-
- This property holds the bottom padding.
-
- \sa padding, topPadding, availableHeight
-*/
-qreal QQuickPopup::bottomPadding() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->bottomPadding();
-}
-
-void QQuickPopup::setBottomPadding(qreal padding)
-{
- Q_D(QQuickPopup);
- d->popupItem->setBottomPadding(padding);
-}
-
-void QQuickPopup::resetBottomPadding()
-{
- Q_D(QQuickPopup);
- d->popupItem->resetBottomPadding();
-}
-
-QQuickItem *QQuickPopup::popupItem() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem;
-}
-
-/*!
- \qmlproperty Item Qt.labs.popups::Popup::parent
-
- This property holds the parent item.
-*/
-QQuickItem *QQuickPopup::parentItem() const
-{
- Q_D(const QQuickPopup);
- return d->parentItem;
-}
-
-void QQuickPopup::setParentItem(QQuickItem *parent)
-{
- Q_D(QQuickPopup);
- if (d->parentItem != parent) {
- d->parentItem = parent;
- if (d->positioner.parentItem())
- d->positioner.setParentItem(parent);
- emit parentChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.popups::Popup::background
-
- This property holds the background item.
-
- \note If the background item has no explicit size specified, it automatically
- follows the popup's size. In most cases, there is no need to specify
- width or height for a background item.
-*/
-QQuickItem *QQuickPopup::background() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->background();
-}
-
-void QQuickPopup::setBackground(QQuickItem *background)
-{
- Q_D(QQuickPopup);
- if (d->popupItem->background() == background)
- return;
-
- d->popupItem->setBackground(background);
- emit backgroundChanged();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Popup::contentItem
-
- This property holds the content item of the popup.
-
- The content item is the visual implementation of the popup. When the
- popup is made visible, the content item is automatically reparented to
- the \l {ApplicationWindow::overlay}{overlay item} of its application
- window.
-*/
-QQuickItem *QQuickPopup::contentItem() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->contentItem();
-}
-
-void QQuickPopup::setContentItem(QQuickItem *item)
-{
- Q_D(QQuickPopup);
- d->popupItem->setContentItem(item);
-}
-
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Popup::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickPopup::contentData()
-{
- Q_D(QQuickPopup);
- return QQmlListProperty<QObject>(d->popupItem->contentItem(), Q_NULLPTR,
- QQuickItemPrivate::data_append,
- QQuickItemPrivate::data_count,
- QQuickItemPrivate::data_at,
- QQuickItemPrivate::data_clear);
-}
-
-/*!
- \qmlproperty list<Item> Qt.labs.controls::Popup::contentChildren
-
- This property holds the list of content children.
-
- \sa Item::children
-*/
-QQmlListProperty<QQuickItem> QQuickPopup::contentChildren()
-{
- Q_D(QQuickPopup);
- return QQmlListProperty<QQuickItem>(d->popupItem->contentItem(), Q_NULLPTR,
- QQuickItemPrivate::children_append,
- QQuickItemPrivate::children_count,
- QQuickItemPrivate::children_at,
- QQuickItemPrivate::children_clear);
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Popup::clip
-
- This property holds whether clipping is enabled. The default value is \c false.
-*/
-bool QQuickPopup::clip() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->clip();
-}
-
-void QQuickPopup::setClip(bool clip)
-{
- Q_D(QQuickPopup);
- if (clip == d->popupItem->clip())
- return;
- d->popupItem->setClip(clip);
- emit clipChanged();
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Popup::focus
-
- This property holds whether the popup has focus. The default value is \c false.
-*/
-bool QQuickPopup::hasFocus() const
-{
- Q_D(const QQuickPopup);
- return d->focus;
-}
-
-void QQuickPopup::setFocus(bool focus)
-{
- Q_D(QQuickPopup);
- if (d->focus == focus)
- return;
- d->focus = focus;
- emit focusChanged();
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Popup::activeFocus
- \readonly
-
- This property holds whether the popup has active focus.
-*/
-bool QQuickPopup::hasActiveFocus() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->hasActiveFocus();
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Popup::modal
-
- This property holds whether the popup is modal. The default value is \c false.
-*/
-bool QQuickPopup::isModal() const
-{
- Q_D(const QQuickPopup);
- return d->modal;
-}
-
-void QQuickPopup::setModal(bool modal)
-{
- Q_D(QQuickPopup);
- if (d->modal == modal)
- return;
- d->modal = modal;
- emit modalChanged();
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Popup::visible
-
- This property holds whether the popup is visible. The default value is \c false.
-*/
-bool QQuickPopup::isVisible() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->isVisible();
-}
-
-void QQuickPopup::setVisible(bool visible)
-{
- if (visible)
- open();
- else
- close();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::opacity
-
- This property holds the opacity of the popup. The default value is \c 1.0.
-*/
-qreal QQuickPopup::opacity() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->opacity();
-}
-
-void QQuickPopup::setOpacity(qreal opacity)
-{
- Q_D(QQuickPopup);
- d->popupItem->setOpacity(opacity);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Popup::scale
-
- This property holds the scale factor of the popup. The default value is \c 1.0.
-*/
-qreal QQuickPopup::scale() const
-{
- Q_D(const QQuickPopup);
- return d->popupItem->scale();
-}
-
-void QQuickPopup::setScale(qreal scale)
-{
- Q_D(QQuickPopup);
- if (qFuzzyCompare(scale, d->popupItem->scale()))
- return;
- d->popupItem->setScale(scale);
- emit scaleChanged();
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Popup::closePolicy
-
- This property determines the circumstances under which the popup closes.
- The flags can be combined to allow several ways of closing the popup.
-
- The available values are:
- \value Popup.NoAutoClose The popup will only close when manually instructed to do so.
- \value Popup.OnPressOutside The popup will close when the mouse is pressed outside of it.
- \value Popup.OnPressOutsideParent The popup will close when the mouse is pressed outside of its parent.
- \value Popup.OnReleaseOutside The popup will close when the mouse is released outside of it.
- \value Popup.OnReleaseOutsideParent The popup will close when the mouse is released outside of its parent.
- \value Popup.OnEscape The popup will close when the escape key is pressed while the popup
- has active focus.
-
- The default value is \c Popup.OnEscape.
-*/
-QQuickPopup::ClosePolicy QQuickPopup::closePolicy() const
-{
- Q_D(const QQuickPopup);
- return d->closePolicy;
-}
-
-void QQuickPopup::setClosePolicy(ClosePolicy policy)
-{
- Q_D(QQuickPopup);
- if (d->closePolicy == policy)
- return;
- d->closePolicy = policy;
- emit closePolicyChanged();
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Popup::transformOrigin
-
- This property holds the origin point for transformations in enter and exit transitions.
-
- Nine transform origins are available, as shown in the image below.
- The default transform origin is \c Popup.Center.
-
- \image qtlabscontrols-popup-transformorigin.png
-
- \sa enter, exit, Item::transformOrigin
-*/
-QQuickPopup::TransformOrigin QQuickPopup::transformOrigin() const
-{
- Q_D(const QQuickPopup);
- return static_cast<TransformOrigin>(d->popupItem->transformOrigin());
-}
-
-void QQuickPopup::setTransformOrigin(TransformOrigin origin)
-{
- Q_D(QQuickPopup);
- d->popupItem->setTransformOrigin(static_cast<QQuickItem::TransformOrigin>(origin));
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::Popup::enter
-
- This property holds the transition that is applied to the content item
- when the popup is opened and enters the screen.
-*/
-QQuickTransition *QQuickPopup::enter() const
-{
- Q_D(const QQuickPopup);
- return d->enter;
-}
-
-void QQuickPopup::setEnter(QQuickTransition *transition)
-{
- Q_D(QQuickPopup);
- if (d->enter == transition)
- return;
- d->enter = transition;
- emit enterChanged();
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::Popup::exit
-
- This property holds the transition that is applied to the content item
- when the popup is closed and exits the screen.
-*/
-QQuickTransition *QQuickPopup::exit() const
-{
- Q_D(const QQuickPopup);
- return d->exit;
-}
-
-void QQuickPopup::setExit(QQuickTransition *transition)
-{
- Q_D(QQuickPopup);
- if (d->exit == transition)
- return;
- d->exit = 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()
-{
-}
-
-void QQuickPopup::componentComplete()
-{
- Q_D(QQuickPopup);
- d->complete = true;
- if (!parentItem())
- setParentItem(qobject_cast<QQuickItem *>(parent()));
-}
-
-bool QQuickPopup::isComponentComplete() const
-{
- Q_D(const QQuickPopup);
- return d->complete;
-}
-
-bool QQuickPopup::eventFilter(QObject *object, QEvent *event)
-{
- Q_D(QQuickPopup);
- Q_UNUSED(object);
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- case QEvent::MouseButtonRelease:
- if (d->modal)
- event->setAccepted(true);
- if (QQuickWindow *window = qobject_cast<QQuickWindow *>(object)) {
- if (d->tryClose(window->contentItem(), static_cast<QMouseEvent *>(event)))
- return true;
- }
- return false;
- case QEvent::KeyPress:
- case QEvent::KeyRelease:
- case QEvent::MouseMove:
- case QEvent::Wheel:
- if (d->modal)
- event->setAccepted(true);
- return false;
- default:
- return false;
- }
-}
-
-void QQuickPopup::focusInEvent(QFocusEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::focusOutEvent(QFocusEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickPopup);
- event->accept();
-
- if (event->key() != Qt::Key_Escape)
- return;
-
- if (d->closePolicy.testFlag(OnEscape))
- close();
-}
-
-void QQuickPopup::keyReleaseEvent(QKeyEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::mousePressEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::mouseMoveEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::mouseReleaseEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::mouseDoubleClickEvent(QMouseEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::mouseUngrabEvent()
-{
-}
-
-void QQuickPopup::wheelEvent(QWheelEvent *event)
-{
- event->accept();
-}
-
-void QQuickPopup::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_UNUSED(newItem);
- Q_UNUSED(oldItem);
- emit contentItemChanged();
-}
-
-void QQuickPopup::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickPopup);
- d->positioner.repositionPopup();
- if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
- emit widthChanged();
- emit availableWidthChanged();
- }
- if (!qFuzzyCompare(newGeometry.height(), oldGeometry.height())) {
- emit heightChanged();
- emit availableHeightChanged();
- }
-}
-
-void QQuickPopup::marginsChange(const QMarginsF &newMargins, const QMarginsF &oldMargins)
-{
- Q_D(QQuickPopup);
- Q_UNUSED(newMargins);
- Q_UNUSED(oldMargins);
- d->positioner.repositionPopup();
-}
-
-void QQuickPopup::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
-{
- const bool tp = !qFuzzyCompare(newPadding.top(), oldPadding.top());
- const bool lp = !qFuzzyCompare(newPadding.left(), oldPadding.left());
- const bool rp = !qFuzzyCompare(newPadding.right(), oldPadding.right());
- const bool bp = !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom());
-
- if (tp)
- emit topPaddingChanged();
- if (lp)
- emit leftPaddingChanged();
- if (rp)
- emit rightPaddingChanged();
- if (bp)
- emit bottomPaddingChanged();
-
- if (lp || rp)
- emit availableWidthChanged();
- if (tp || bp)
- emit availableHeightChanged();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickPopup::accessibleRole() const
-{
- return QAccessible::LayeredPane;
-}
-#endif // QT_NO_ACCESSIBILITY
-
-QT_END_NAMESPACE
-
-#include "moc_qquickpopup_p.cpp"
diff --git a/src/templates/qquickpopup_p.h b/src/templates/qquickpopup_p.h
deleted file mode 100644
index b818ea7f..00000000
--- a/src/templates/qquickpopup_p.h
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPOPUP_P_H
-#define QQUICKPOPUP_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmargins.h>
-#include <QtGui/qevent.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-#include <QtQml/qqml.h>
-#include <QtQml/qqmllist.h>
-#include <QtQml/qqmlparserstatus.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtGui/qaccessible.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QQuickItem;
-class QQuickPopupPrivate;
-class QQuickTransition;
-class QQuickTransform;
-
-class Q_LABSTEMPLATES_EXPORT QQuickPopup : public QObject, public QQmlParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QQmlParserStatus)
- Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL)
- Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL)
- Q_PROPERTY(qreal z READ z WRITE setZ NOTIFY zChanged FINAL)
- Q_PROPERTY(qreal width READ width WRITE setWidth RESET resetWidth NOTIFY widthChanged FINAL)
- Q_PROPERTY(qreal height READ height WRITE setHeight RESET resetHeight NOTIFY heightChanged FINAL)
- Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged FINAL)
- Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged FINAL)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
- Q_PROPERTY(qreal availableWidth READ availableWidth NOTIFY availableWidthChanged FINAL)
- Q_PROPERTY(qreal availableHeight READ availableHeight NOTIFY availableHeightChanged FINAL)
- Q_PROPERTY(qreal margins READ margins WRITE setMargins RESET resetMargins NOTIFY marginsChanged FINAL)
- Q_PROPERTY(qreal topMargin READ topMargin WRITE setTopMargin RESET resetTopMargin NOTIFY topMarginChanged FINAL)
- Q_PROPERTY(qreal leftMargin READ leftMargin WRITE setLeftMargin RESET resetLeftMargin NOTIFY leftMarginChanged FINAL)
- Q_PROPERTY(qreal rightMargin READ rightMargin WRITE setRightMargin RESET resetRightMargin NOTIFY rightMarginChanged FINAL)
- Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin RESET resetBottomMargin NOTIFY bottomMarginChanged FINAL)
- Q_PROPERTY(qreal padding READ padding WRITE setPadding RESET resetPadding NOTIFY paddingChanged FINAL)
- Q_PROPERTY(qreal topPadding READ topPadding WRITE setTopPadding RESET resetTopPadding NOTIFY topPaddingChanged FINAL)
- Q_PROPERTY(qreal leftPadding READ leftPadding WRITE setLeftPadding RESET resetLeftPadding NOTIFY leftPaddingChanged FINAL)
- Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
- Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
- Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem NOTIFY parentChanged FINAL)
- Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
- Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged FINAL)
- Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
- Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL)
- Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged FINAL)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
- Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged FINAL)
- Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged FINAL)
- Q_PROPERTY(ClosePolicy closePolicy READ closePolicy WRITE setClosePolicy NOTIFY closePolicyChanged FINAL)
- Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin)
- Q_PROPERTY(QQuickTransition *enter READ enter WRITE setEnter NOTIFY enterChanged FINAL)
- Q_PROPERTY(QQuickTransition *exit READ exit WRITE setExit NOTIFY exitChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentData")
-
-public:
- explicit QQuickPopup(QObject *parent = Q_NULLPTR);
- ~QQuickPopup();
-
- qreal x() const;
- void setX(qreal x);
-
- qreal y() const;
- void setY(qreal y);
-
- qreal z() const;
- void setZ(qreal z);
-
- qreal width() const;
- void setWidth(qreal width);
- void resetWidth();
-
- qreal height() const;
- void setHeight(qreal height);
- void resetHeight();
-
- qreal implicitWidth() const;
- void setImplicitWidth(qreal width);
-
- qreal implicitHeight() const;
- void setImplicitHeight(qreal height);
-
- qreal contentWidth() const;
- void setContentWidth(qreal width);
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
-
- qreal availableWidth() const;
- qreal availableHeight() const;
-
- qreal margins() const;
- void setMargins(qreal margins);
- void resetMargins();
-
- qreal topMargin() const;
- void setTopMargin(qreal margin);
- void resetTopMargin();
-
- qreal leftMargin() const;
- void setLeftMargin(qreal margin);
- void resetLeftMargin();
-
- qreal rightMargin() const;
- void setRightMargin(qreal margin);
- void resetRightMargin();
-
- qreal bottomMargin() const;
- void setBottomMargin(qreal margin);
- void resetBottomMargin();
-
- qreal padding() const;
- void setPadding(qreal padding);
- void resetPadding();
-
- qreal topPadding() const;
- void setTopPadding(qreal padding);
- void resetTopPadding();
-
- qreal leftPadding() const;
- void setLeftPadding(qreal padding);
- void resetLeftPadding();
-
- qreal rightPadding() const;
- void setRightPadding(qreal padding);
- void resetRightPadding();
-
- qreal bottomPadding() const;
- void setBottomPadding(qreal padding);
- void resetBottomPadding();
-
- QQuickItem *popupItem() const;
-
- QQuickItem *parentItem() const;
- void setParentItem(QQuickItem *parent);
-
- QQuickItem *background() const;
- void setBackground(QQuickItem *background);
-
- QQuickItem *contentItem() const;
- void setContentItem(QQuickItem *item);
-
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
- bool clip() const;
- void setClip(bool clip);
-
- bool hasFocus() const;
- void setFocus(bool focus);
-
- bool hasActiveFocus() const;
-
- bool isModal() const;
- void setModal(bool modal);
-
- bool isVisible() const;
- void setVisible(bool visible);
-
- qreal opacity() const;
- void setOpacity(qreal opacity);
-
- qreal scale() const;
- void setScale(qreal scale);
-
- enum ClosePolicyFlag {
- NoAutoClose = 0x00,
- OnPressOutside = 0x01,
- OnPressOutsideParent = 0x02,
- OnReleaseOutside = 0x04,
- OnReleaseOutsideParent = 0x08,
- OnEscape = 0x10
- };
- Q_DECLARE_FLAGS(ClosePolicy, ClosePolicyFlag)
- Q_FLAG(ClosePolicy)
-
- ClosePolicy closePolicy() const;
- void setClosePolicy(ClosePolicy policy);
-
- // keep in sync with Item.TransformOrigin
- enum TransformOrigin {
- TopLeft, Top, TopRight,
- Left, Center, Right,
- BottomLeft, Bottom, BottomRight
- };
- Q_ENUM(TransformOrigin)
-
- TransformOrigin transformOrigin() const;
- void setTransformOrigin(TransformOrigin);
-
- QQuickTransition *enter() const;
- void setEnter(QQuickTransition *transition);
-
- QQuickTransition *exit() const;
- void setExit(QQuickTransition *transition);
-
- QQmlListProperty<QObject> data();
-
-public Q_SLOTS:
- void open();
- void close();
-
-Q_SIGNALS:
- void xChanged();
- void yChanged();
- void zChanged();
- void widthChanged();
- void heightChanged();
- void implicitWidthChanged();
- void implicitHeightChanged();
- void contentWidthChanged();
- void contentHeightChanged();
- void availableWidthChanged();
- void availableHeightChanged();
- void marginsChanged();
- void topMarginChanged();
- void leftMarginChanged();
- void rightMarginChanged();
- void bottomMarginChanged();
- void paddingChanged();
- void topPaddingChanged();
- void leftPaddingChanged();
- void rightPaddingChanged();
- void bottomPaddingChanged();
- void parentChanged();
- void backgroundChanged();
- void contentItemChanged();
- void contentChildrenChanged();
- void clipChanged();
- void focusChanged();
- void activeFocusChanged();
- void modalChanged();
- void visibleChanged();
- void opacityChanged();
- void scaleChanged();
- void closePolicyChanged();
- void enterChanged();
- void exitChanged();
-
- void aboutToShow();
- void aboutToHide();
-
-protected:
- QQuickPopup(QQuickPopupPrivate &dd, QObject *parent);
-
- void classBegin() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
- bool isComponentComplete() const;
-
- bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
- virtual void focusInEvent(QFocusEvent *event);
- virtual void focusOutEvent(QFocusEvent *event);
- virtual void keyPressEvent(QKeyEvent *event);
- virtual void keyReleaseEvent(QKeyEvent *event);
- virtual void mousePressEvent(QMouseEvent *event);
- virtual void mouseMoveEvent(QMouseEvent *event);
- virtual void mouseReleaseEvent(QMouseEvent *event);
- virtual void mouseDoubleClickEvent(QMouseEvent *event);
- virtual void mouseUngrabEvent();
- virtual void wheelEvent(QWheelEvent *event);
-
- virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
- virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
- virtual void marginsChange(const QMarginsF &newMargins, const QMarginsF &oldMargins);
- virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
-
-#ifndef QT_NO_ACCESSIBILITY
- virtual QAccessible::Role accessibleRole() const;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickPopup)
- Q_DECLARE_PRIVATE(QQuickPopup)
- friend class QQuickPopupItem;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QQuickPopup::ClosePolicy)
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickPopup)
-
-#endif // QQUICKPOPUP_P_H
diff --git a/src/templates/qquickpopup_p_p.h b/src/templates/qquickpopup_p_p.h
deleted file mode 100644
index 017949cd..00000000
--- a/src/templates/qquickpopup_p_p.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPOPUP_P_P_H
-#define QQUICKPOPUP_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qquickpopup_p.h"
-#include "qquickcontrol_p.h"
-
-#include <QtCore/private/qobject_p.h>
-#include <QtQuick/qquickitem.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-#include <QtQuick/private/qquicktransitionmanager_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickTransition;
-class QQuickTransitionManager;
-class QQuickPopup;
-class QQuickPopupPrivate;
-class QQuickPopupItemPrivate;
-
-class QQuickPopupTransitionManager : public QQuickTransitionManager
-{
-public:
- QQuickPopupTransitionManager(QQuickPopupPrivate *popup);
-
- void transitionEnter();
- void transitionExit();
-
-protected:
- void finished() Q_DECL_OVERRIDE;
-
-private:
- enum TransitionState {
- Off, Enter, Exit
- };
-
- TransitionState state;
- QQuickPopupPrivate *popup;
-};
-
-class QQuickPopupItem : public QQuickControl
-{
- Q_OBJECT
-
-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;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DECLARE_PRIVATE(QQuickPopupItem)
-};
-
-class QQuickPopupPositioner : public QQuickItemChangeListener
-{
-public:
- explicit QQuickPopupPositioner(QQuickPopupPrivate *popup);
- ~QQuickPopupPositioner();
-
- qreal x() const;
- void setX(qreal x);
-
- qreal y() const;
- void setY(qreal y);
-
- QQuickItem *parentItem() const;
- void setParentItem(QQuickItem *parent);
-
- void repositionPopup();
-
-protected:
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &);
- void itemParentChanged(QQuickItem *, QQuickItem *parent);
- void itemChildRemoved(QQuickItem *, QQuickItem *child);
- void itemDestroyed(QQuickItem *item);
-
-private:
- void removeAncestorListeners(QQuickItem *item);
- void addAncestorListeners(QQuickItem *item);
-
- bool isAncestor(QQuickItem *item) const;
-
- qreal m_x;
- qreal m_y;
- QQuickItem *m_parentItem;
- QQuickPopupPrivate *m_popup;
-};
-
-class QQuickPopupPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QQuickPopup)
-
-public:
- QQuickPopupPrivate();
-
- static QQuickPopupPrivate *get(QQuickPopup *popup)
- {
- return popup->d_func();
- }
-
- void init();
- bool tryClose(QQuickItem *item, QMouseEvent *event);
-
- void finalizeEnterTransition();
- void finalizeExitTransition();
-
- QMarginsF getMargins() const;
-
- void setTopMargin(qreal value, bool reset = false);
- void setLeftMargin(qreal value, bool reset = false);
- void setRightMargin(qreal value, bool reset = false);
- void setBottomMargin(qreal value, bool reset = false);
-
- bool focus;
- bool modal;
- bool complete;
- bool hasTopMargin;
- bool hasLeftMargin;
- bool hasRightMargin;
- bool hasBottomMargin;
- qreal margins;
- qreal topMargin;
- qreal leftMargin;
- qreal rightMargin;
- qreal bottomMargin;
- qreal contentWidth;
- qreal contentHeight;
- QQuickPopup::ClosePolicy closePolicy;
- QQuickItem *parentItem;
- QQuickTransition *enter;
- QQuickTransition *exit;
- QQuickPopupItem *popupItem;
- QQuickPopupPositioner positioner;
- QQuickPopupTransitionManager transitionManager;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKPOPUP_P_P_H
-
diff --git a/src/templates/qquickpressandholdhelper.cpp b/src/templates/qquickpressandholdhelper.cpp
deleted file mode 100644
index 29b3bb0a..00000000
--- a/src/templates/qquickpressandholdhelper.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpressandholdhelper_p.h"
-
-#include <QtCore/private/qobject_p.h>
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qstylehints.h>
-#include <QtQuick/qquickitem.h>
-#include <QtQuick/private/qquickevents_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QQuickPressAndHoldHelper::QQuickPressAndHoldHelper()
- : control(Q_NULLPTR)
- , longPress(false)
- , pressAndHoldSignalIndex(-1)
- , delayedMousePressEvent(Q_NULLPTR)
-{ }
-
-void QQuickPressAndHoldHelper::mousePressEvent(QMouseEvent *event)
-{
- longPress = false;
- pressPos = event->localPos();
- if (Qt::LeftButton == (event->buttons() & Qt::LeftButton)) {
- timer.start(QGuiApplication::styleHints()->mousePressAndHoldInterval(), control);
- delayedMousePressEvent = new QMouseEvent(event->type(), event->pos(), event->button(), event->buttons(), event->modifiers());
- } else {
- timer.stop();
- }
-}
-
-void QQuickPressAndHoldHelper::mouseMoveEvent(QMouseEvent *event)
-{
- if (qAbs(int(event->localPos().x() - pressPos.x())) > QGuiApplication::styleHints()->startDragDistance())
- timer.stop();
-}
-
-void QQuickPressAndHoldHelper::mouseReleaseEvent(QMouseEvent *)
-{
- if (!longPress)
- timer.stop();
-}
-
-void QQuickPressAndHoldHelper::timerEvent(QTimerEvent *)
-{
- timer.stop();
- clearDelayedMouseEvent();
-
- if (pressAndHoldSignalIndex == -1)
- pressAndHoldSignalIndex = control->metaObject()->indexOfSignal("pressAndHold(QQuickMouseEvent*)");
- Q_ASSERT(pressAndHoldSignalIndex != -1);
-
- longPress = QObjectPrivate::get(control)->isSignalConnected(pressAndHoldSignalIndex);
- if (longPress) {
- QQuickMouseEvent mev(pressPos.x(), pressPos.y(), Qt::LeftButton, Qt::LeftButton,
- QGuiApplication::keyboardModifiers(), false/*isClick*/, true/*wasHeld*/);
- mev.setAccepted(true);
- // Use fast signal invocation since we already got its index
- QQuickMouseEvent *mevPtr = &mev;
- void *args[] = { Q_NULLPTR, &mevPtr };
- QMetaObject::metacall(control, QMetaObject::InvokeMetaMethod, pressAndHoldSignalIndex, args);
- if (!mev.isAccepted())
- longPress = false;
- }
-}
-
-void QQuickPressAndHoldHelper::clearDelayedMouseEvent()
-{
- if (delayedMousePressEvent) {
- delete delayedMousePressEvent;
- delayedMousePressEvent = 0;
- }
-}
-
-bool QQuickPressAndHoldHelper::isActive()
-{
- return !(timer.isActive() || longPress);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickpressandholdhelper_p.h b/src/templates/qquickpressandholdhelper_p.h
deleted file mode 100644
index 7599c6bd..00000000
--- a/src/templates/qquickpressandholdhelper_p.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPRESSANDHOLDHELPER_H
-#define QQUICKPRESSANDHOLDHELPER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qpoint.h>
-#include <QtCore/qbasictimer.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickItem;
-class QMouseEvent;
-class QTimerEvent;
-
-struct QQuickPressAndHoldHelper
-{
- QQuickPressAndHoldHelper();
-
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
- void timerEvent(QTimerEvent *event);
-
- void clearDelayedMouseEvent();
- bool isActive();
-
- QQuickItem *control;
- QBasicTimer timer;
- QPointF pressPos;
- bool longPress;
- int pressAndHoldSignalIndex;
- QMouseEvent *delayedMousePressEvent;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKPRESSANDHOLDHELPER_H
diff --git a/src/templates/qquickprogressbar.cpp b/src/templates/qquickprogressbar.cpp
deleted file mode 100644
index 972654ad..00000000
--- a/src/templates/qquickprogressbar.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickprogressbar_p.h"
-#include "qquickcontrol_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ProgressBar
- \inherits Control
- \instantiates QQuickProgressBar
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-indicators
- \brief A progress bar control.
-
- ProgressBar indicates the progress of an operation.
-
- \table
- \row \li \image qtlabscontrols-progressbar-normal.png
- \li A progress bar in its normal state.
- \row \li \image qtlabscontrols-progressbar-disabled.png
- \li A progress bar that is disabled.
- \endtable
-
- \code
- ProgressBar {
- value: 0.5
- }
- \endcode
-
- \labs
-
- \sa {Customizing ProgressBar}
-*/
-
-class QQuickProgressBarPrivate : public QQuickControlPrivate
-{
-public:
- QQuickProgressBarPrivate() : from(0), to(1.0), value(0), indeterminate(false), indicator(Q_NULLPTR)
- {
- }
-
- qreal from;
- qreal to;
- qreal value;
- bool indeterminate;
- QQuickItem *indicator;
-};
-
-QQuickProgressBar::QQuickProgressBar(QQuickItem *parent) :
- QQuickControl(*(new QQuickProgressBarPrivate), parent)
-{
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ProgressBar::from
-
- This property holds the starting value for the progress. The default value is \c 0.0.
-
- \sa to, value
-*/
-qreal QQuickProgressBar::from() const
-{
- Q_D(const QQuickProgressBar);
- return d->from;
-}
-
-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);
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ProgressBar::to
-
- This property holds the end value for the progress. The default value is \c 1.0.
-
- \sa from, value
-*/
-qreal QQuickProgressBar::to() const
-{
- Q_D(const QQuickProgressBar);
- return d->to;
-}
-
-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);
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ProgressBar::value
-
- This property holds the progress value. The default value is \c 0.0.
-
- \sa from, to, position
-*/
-qreal QQuickProgressBar::value() const
-{
- Q_D(const QQuickProgressBar);
- return d->value;
-}
-
-void QQuickProgressBar::setValue(qreal value)
-{
- Q_D(QQuickProgressBar);
- 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();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ProgressBar::position
- \readonly
-
- This property holds the logical position of the progress.
-
- The position is defined as a percentage of the value, scaled to
- \c {0.0 - 1.0}. For visualizing the progress, the right-to-left
- aware \l visualPosition should be used instead.
-
- \sa value, visualPosition
-*/
-qreal QQuickProgressBar::position() const
-{
- Q_D(const QQuickProgressBar);
- if (qFuzzyCompare(d->from, d->to))
- return 0;
- return (d->value - d->from) / (d->to - d->from);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ProgressBar::visualPosition
- \readonly
-
- This property holds the visual position of the progress.
-
- The position is defined as a percentage of the value, scaled to \c {0.0 - 1.0}.
- When the control is \l {Control::mirrored}{mirrored}, \c visuaPosition is equal
- to \c {1.0 - position}. This makes \c visualPosition suitable for visualizing
- the progress, taking right-to-left support into account.
-
- \sa position, value
-*/
-qreal QQuickProgressBar::visualPosition() const
-{
- if (isMirrored())
- return 1.0 - position();
- return position();
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::ProgressBar::indeterminate
-
- This property holds whether the progress bar is in an indeterminate mode.
-*/
-bool QQuickProgressBar::isIndeterminate() const
-{
- Q_D(const QQuickProgressBar);
- return d->indeterminate;
-}
-
-void QQuickProgressBar::setIndeterminate(bool indeterminate)
-{
- Q_D(QQuickProgressBar);
- if (d->indeterminate != indeterminate) {
- d->indeterminate = indeterminate;
- emit indeterminateChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::ProgressBar::indicator
-
- This property holds the indicator item.
-
- \sa {Customizing ProgressBar}
-*/
-QQuickItem *QQuickProgressBar::indicator() const
-{
- Q_D(const QQuickProgressBar);
- return d->indicator;
-}
-
-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();
- }
-}
-
-void QQuickProgressBar::mirrorChange()
-{
- QQuickControl::mirrorChange();
- if (!qFuzzyCompare(position(), qreal(0.5)))
- emit visualPositionChanged();
-}
-
-void QQuickProgressBar::componentComplete()
-{
- Q_D(QQuickProgressBar);
- QQuickControl::componentComplete();
- setValue(d->value);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickProgressBar::accessibleRole() const
-{
- return QAccessible::ProgressBar;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickprogressbar_p.h b/src/templates/qquickprogressbar_p.h
deleted file mode 100644
index f94c718e..00000000
--- a/src/templates/qquickprogressbar_p.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKPROGRESSBAR_P_H
-#define QQUICKPROGRESSBAR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickProgressBarPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickProgressBar : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
- Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
- Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
- Q_PROPERTY(bool indeterminate READ isIndeterminate WRITE setIndeterminate NOTIFY indeterminateChanged FINAL)
- Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
-
-public:
- explicit QQuickProgressBar(QQuickItem *parent = Q_NULLPTR);
-
- qreal from() const;
- void setFrom(qreal from);
-
- qreal to() const;
- void setTo(qreal to);
-
- qreal value() const;
- void setValue(qreal value);
-
- qreal position() const;
- qreal visualPosition() const;
-
- bool isIndeterminate() const;
- void setIndeterminate(bool indeterminate);
-
- QQuickItem *indicator() const;
- void setIndicator(QQuickItem *indicator);
-
-Q_SIGNALS:
- void fromChanged();
- void toChanged();
- void valueChanged();
- void positionChanged();
- void visualPositionChanged();
- void indeterminateChanged();
- void indicatorChanged();
-
-protected:
- void mirrorChange() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickProgressBar)
- Q_DECLARE_PRIVATE(QQuickProgressBar)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickProgressBar)
-
-#endif // QQUICKPROGRESSBAR_P_H
diff --git a/src/templates/qquickradiobutton.cpp b/src/templates/qquickradiobutton.cpp
deleted file mode 100644
index 7d7a64aa..00000000
--- a/src/templates/qquickradiobutton.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickradiobutton_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype RadioButton
- \inherits AbstractButton
- \instantiates QQuickRadioButton
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-buttons
- \brief A radio button control.
-
- RadioButton presents an option button that can be toggled on (checked) or
- off (unchecked). Radio buttons are typically used to select one option
- from a set of options.
-
- \table
- \row \li \image qtlabscontrols-radiobutton-normal.png
- \li A radio button in its normal state.
- \row \li \image qtlabscontrols-radiobutton-checked.png
- \li A radio button that is checked.
- \row \li \image qtlabscontrols-radiobutton-focused.png
- \li A radio button that has active focus.
- \row \li \image qtlabscontrols-radiobutton-disabled.png
- \li A radio button that is disabled.
- \endtable
-
- Radio buttons are \l {AbstractButton::autoExclusive}{auto-exclusive}
- by default. Only one button can be checked at any time amongst radio
- buttons that belong to the same parent item; checking another button
- automatically unchecks the previously checked one.
-
- \code
- ColumnLayout {
- RadioButton {
- checked: true
- text: qsTr("First")
- }
- RadioButton {
- text: qsTr("Second")
- }
- RadioButton {
- text: qsTr("Third")
- }
- }
- \endcode
-
- \labs
-
- \sa ButtonGroup, {Customizing RadioButton}, {Button Controls}
-*/
-
-QQuickRadioButton::QQuickRadioButton(QQuickItem *parent) :
- QQuickAbstractButton(parent)
-{
- setCheckable(true);
- setAutoExclusive(true);
-}
-
-QFont QQuickRadioButton::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::RadioButtonFont);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickRadioButton::accessibleRole() const
-{
- return QAccessible::RadioButton;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickradiobutton_p.h b/src/templates/qquickradiobutton_p.h
deleted file mode 100644
index 7d664864..00000000
--- a/src/templates/qquickradiobutton_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKRADIOBUTTON_P_H
-#define QQUICKRADIOBUTTON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LABSTEMPLATES_EXPORT QQuickRadioButton : public QQuickAbstractButton
-{
- Q_OBJECT
-
-public:
- explicit QQuickRadioButton(QQuickItem *parent = Q_NULLPTR);
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickRadioButton)
-
-#endif // QQUICKRADIOBUTTON_P_H
diff --git a/src/templates/qquickrangeslider.cpp b/src/templates/qquickrangeslider.cpp
deleted file mode 100644
index 69529f65..00000000
--- a/src/templates/qquickrangeslider.cpp
+++ /dev/null
@@ -1,949 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickrangeslider_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtCore/qscopedpointer.h>
-#include <QtQuick/private/qquickwindow_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype RangeSlider
- \inherits Control
- \instantiates QQuickRangeSlider
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A slider control used to select a range of values.
-
- \image qtlabscontrols-rangeslider.gif
-
- RangeSlider is used to select a range specified by two values, by sliding
- each handle along a track.
-
- \table
- \row \li \image qtlabscontrols-rangeslider-normal.png
- \li A range slider in its normal state.
- \row \li \image qtlabscontrols-rangeslider-first-handle-focused.png
- \li A range slider whose first handle has active focus.
- \row \li \image qtlabscontrols-rangeslider-second-handle-focused.png
- \li A range slider whose second handle has active focus.
- \row \li \image qtlabscontrols-rangeslider-disabled.png
- \li A range slider that is disabled.
- \endtable
-
- \code
- RangeSlider {
- first.value: 0.25
- second.value: 0.75
- }
- \endcode
-
- \labs
-
- \sa {Customizing RangeSlider}, {Input Controls}
-*/
-
-class QQuickRangeSliderNodePrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QQuickRangeSliderNode)
-public:
- QQuickRangeSliderNodePrivate(qreal value, QQuickRangeSlider *slider) :
- value(value),
- isPendingValue(false),
- pendingValue(0),
- position(0),
- handle(Q_NULLPTR),
- slider(slider),
- pressed(false)
- {
- }
-
- bool isFirst() const;
-
- void setPosition(qreal position, bool ignoreOtherPosition = false);
- void updatePosition(bool ignoreOtherPosition = false);
-
- static QQuickRangeSliderNodePrivate *get(QQuickRangeSliderNode *node);
-
-private:
- friend class QQuickRangeSlider;
-
- qreal value;
- bool isPendingValue;
- qreal pendingValue;
- qreal position;
- QQuickItem *handle;
- QQuickRangeSlider *slider;
- bool pressed;
-};
-
-bool QQuickRangeSliderNodePrivate::isFirst() const
-{
- return this == get(slider->first());
-}
-
-void QQuickRangeSliderNodePrivate::setPosition(qreal position, bool ignoreOtherPosition)
-{
- Q_Q(QQuickRangeSliderNode);
-
- const qreal min = isFirst() || ignoreOtherPosition ? 0.0 : qMax<qreal>(0.0, slider->first()->position());
- const qreal max = !isFirst() || ignoreOtherPosition ? 1.0 : qMin<qreal>(1.0, slider->second()->position());
- position = qBound(min, position, max);
- if (!qFuzzyCompare(this->position, position)) {
- this->position = position;
- emit q->positionChanged();
- emit q->visualPositionChanged();
- }
-}
-
-void QQuickRangeSliderNodePrivate::updatePosition(bool ignoreOtherPosition)
-{
- qreal pos = 0;
- if (!qFuzzyCompare(slider->from(), slider->to()))
- pos = (value - slider->from()) / (slider->to() - slider->from());
- setPosition(pos, ignoreOtherPosition);
-}
-
-QQuickRangeSliderNodePrivate *QQuickRangeSliderNodePrivate::get(QQuickRangeSliderNode *node)
-{
- return node->d_func();
-}
-
-QQuickRangeSliderNode::QQuickRangeSliderNode(qreal value, QQuickRangeSlider *slider) :
- QObject(*(new QQuickRangeSliderNodePrivate(value, slider)), slider)
-{
-}
-
-QQuickRangeSliderNode::~QQuickRangeSliderNode()
-{
-}
-
-qreal QQuickRangeSliderNode::value() const
-{
- Q_D(const QQuickRangeSliderNode);
- return d->value;
-}
-
-void QQuickRangeSliderNode::setValue(qreal value)
-{
- Q_D(QQuickRangeSliderNode);
- if (!d->slider->isComponentComplete()) {
- d->pendingValue = value;
- d->isPendingValue = true;
- return;
- }
-
- // First, restrict the first value to be within to and from.
- const qreal smaller = qMin(d->slider->to(), d->slider->from());
- const qreal larger = qMax(d->slider->to(), d->slider->from());
- value = qBound(smaller, value, larger);
-
- // Then, ensure that it doesn't go past the other value,
- // a check that depends on whether or not the range is inverted.
- const bool invertedRange = d->slider->from() > d->slider->to();
- if (d->isFirst()) {
- if (invertedRange) {
- if (value < d->slider->second()->value())
- value = d->slider->second()->value();
- } else {
- if (value > d->slider->second()->value())
- value = d->slider->second()->value();
- }
- } else {
- if (invertedRange) {
- if (value > d->slider->first()->value())
- value = d->slider->first()->value();
- } else {
- if (value < d->slider->first()->value())
- value = d->slider->first()->value();
- }
- }
-
- if (!qFuzzyCompare(d->value, value)) {
- d->value = value;
- d->updatePosition();
- emit valueChanged();
- }
-}
-
-qreal QQuickRangeSliderNode::position() const
-{
- Q_D(const QQuickRangeSliderNode);
- return d->position;
-}
-
-qreal QQuickRangeSliderNode::visualPosition() const
-{
- Q_D(const QQuickRangeSliderNode);
- if (d->slider->orientation() == Qt::Vertical || d->slider->isMirrored())
- return 1.0 - d->position;
- return d->position;
-}
-
-QQuickItem *QQuickRangeSliderNode::handle() const
-{
- Q_D(const QQuickRangeSliderNode);
- return d->handle;
-}
-
-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);
- }
- }
-
- handle->setActiveFocusOnTab(true);
- }
- emit handleChanged();
- }
-}
-
-bool QQuickRangeSliderNode::isPressed() const
-{
- Q_D(const QQuickRangeSliderNode);
- return d->pressed;
-}
-
-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();
- }
-}
-
-void QQuickRangeSliderNode::increase()
-{
- Q_D(QQuickRangeSliderNode);
- qreal step = qFuzzyIsNull(d->slider->stepSize()) ? 0.1 : d->slider->stepSize();
- setValue(d->value + step);
-}
-
-void QQuickRangeSliderNode::decrease()
-{
- Q_D(QQuickRangeSliderNode);
- qreal step = qFuzzyIsNull(d->slider->stepSize()) ? 0.1 : d->slider->stepSize();
- setValue(d->value - step);
-}
-
-static const qreal defaultFrom = 0.0;
-static const qreal defaultTo = 1.0;
-
-class QQuickRangeSliderPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickRangeSlider)
-
-public:
- QQuickRangeSliderPrivate() :
- from(defaultFrom),
- to(defaultTo),
- stepSize(0),
- first(Q_NULLPTR),
- second(Q_NULLPTR),
- orientation(Qt::Horizontal),
- snapMode(QQuickRangeSlider::NoSnap),
- track(Q_NULLPTR)
- {
- }
-
- qreal from;
- qreal to;
- qreal stepSize;
- QQuickRangeSliderNode *first;
- QQuickRangeSliderNode *second;
- QPoint pressPoint;
- Qt::Orientation orientation;
- QQuickRangeSlider::SnapMode snapMode;
- QQuickItem *track;
-};
-
-static qreal valueAt(const QQuickRangeSlider *slider, qreal position)
-{
- return slider->from() + (slider->to() - slider->from()) * position;
-}
-
-static qreal snapPosition(const QQuickRangeSlider *slider, qreal position)
-{
- const qreal range = slider->from() + (slider->to() - slider->from());
- if (qFuzzyIsNull(range))
- return position;
-
- const qreal effectiveStep = slider->stepSize() / range;
- if (qFuzzyIsNull(effectiveStep))
- return position;
-
- return qRound(position / effectiveStep) * effectiveStep;
-}
-
-static qreal positionAt(const QQuickRangeSlider *slider, QQuickItem *handle, const QPoint &point)
-{
- if (slider->orientation() == Qt::Horizontal) {
- const qreal hw = handle ? handle->width() : 0;
- const qreal offset = hw / 2;
- const qreal extent = slider->availableWidth() - hw;
- if (!qFuzzyIsNull(extent)) {
- if (slider->isMirrored())
- return (slider->width() - point.x() - slider->rightPadding() - offset) / extent;
- return (point.x() - slider->leftPadding() - offset) / extent;
- }
- } else {
- const qreal hh = handle ? handle->height() : 0;
- const qreal offset = hh / 2;
- const qreal extent = slider->availableHeight() - hh;
- if (!qFuzzyIsNull(extent))
- return (slider->height() - point.y() - slider->bottomPadding() - offset) / extent;
- }
- return 0;
-}
-
-QQuickRangeSlider::QQuickRangeSlider(QQuickItem *parent) :
- QQuickControl(*(new QQuickRangeSliderPrivate), parent)
-{
- Q_D(QQuickRangeSlider);
- d->first = new QQuickRangeSliderNode(0.0, this);
- d->second = new QQuickRangeSliderNode(1.0, this);
-
- setAcceptedMouseButtons(Qt::LeftButton);
- setFlag(QQuickItem::ItemIsFocusScope);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::RangeSlider::from
-
- This property holds the starting value for the range. The default value is \c 0.0.
-
- \sa to, first.value, second.value
-*/
-qreal QQuickRangeSlider::from() const
-{
- Q_D(const QQuickRangeSlider);
- return d->from;
-}
-
-void QQuickRangeSlider::setFrom(qreal from)
-{
- Q_D(QQuickRangeSlider);
- if (qFuzzyCompare(d->from, from))
- return;
-
- d->from = from;
- emit fromChanged();
-
- if (isComponentComplete()) {
- d->first->setValue(d->first->value());
- d->second->setValue(d->second->value());
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::RangeSlider::to
-
- This property holds the end value for the range. The default value is \c 1.0.
-
- \sa from, first.value, second.value
-*/
-qreal QQuickRangeSlider::to() const
-{
- Q_D(const QQuickRangeSlider);
- return d->to;
-}
-
-void QQuickRangeSlider::setTo(qreal to)
-{
- Q_D(QQuickRangeSlider);
- if (qFuzzyCompare(d->to, to))
- return;
-
- d->to = to;
- emit toChanged();
-
- if (isComponentComplete()) {
- d->first->setValue(d->first->value());
- d->second->setValue(d->second->value());
- }
-}
-
-/*!
- \qmlpropertygroup Qt.labs.controls::RangeSlider::first
- \qmlproperty real Qt.labs.controls::RangeSlider::first.value
- \qmlproperty real Qt.labs.controls::RangeSlider::first.position
- \qmlproperty real Qt.labs.controls::RangeSlider::first.visualPosition
- \qmlproperty Item Qt.labs.controls::RangeSlider::first.handle
- \qmlproperty bool Qt.labs.controls::RangeSlider::first.pressed
-
- \table
- \header
- \li Property
- \li Description
- \row
- \li value
- \li This property holds the value of the first handle in the range
- \c from - \c to.
-
- If \l to is greater than \l from, the value of the first handle
- must be greater than the second, and vice versa.
-
- Unlike \l {first.position}{position}, value is not updated while the
- handle is dragged, but rather when it has been released.
-
- The default value is \c 0.0.
- \row
- \li handle
- \li This property holds the first handle item.
- \row
- \li visualPosition
- \li This property holds the visual position of the first handle.
-
- The position is defined as a percentage of the control's size, scaled to
- \c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
- value is equal to \c {1.0 - position}. This makes the value suitable for
- visualizing the slider, taking right-to-left support into account.
- \row
- \li position
- \li This property holds the logical position of the first handle.
-
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike \l {first.value}{value}, position is
- continuously updated while the handle is dragged. For visualizing a
- slider, the right-to-left aware
- \l {first.visualPosition}{visualPosition} should be used instead.
- \row
- \li pressed
- \li This property holds whether the first handle is pressed.
- \endtable
-
- \sa first.increase(), first.decrease()
-*/
-QQuickRangeSliderNode *QQuickRangeSlider::first() const
-{
- Q_D(const QQuickRangeSlider);
- return d->first;
-}
-
-/*!
- \qmlpropertygroup Qt.labs.controls::RangeSlider::second
- \qmlproperty real Qt.labs.controls::RangeSlider::second.value
- \qmlproperty real Qt.labs.controls::RangeSlider::second.position
- \qmlproperty real Qt.labs.controls::RangeSlider::second.visualPosition
- \qmlproperty Item Qt.labs.controls::RangeSlider::second.handle
- \qmlproperty bool Qt.labs.controls::RangeSlider::second.pressed
-
- \table
- \header
- \li Property
- \li Description
- \row
- \li value
- \li This property holds the value of the second handle in the range
- \c from - \c to.
-
- If \l to is greater than \l from, the value of the first handle
- must be greater than the second, and vice versa.
-
- Unlike \l {second.position}{position}, value is not updated while the
- handle is dragged, but rather when it has been released.
-
- The default value is \c 0.0.
- \row
- \li handle
- \li This property holds the second handle item.
- \row
- \li visualPosition
- \li This property holds the visual position of the second handle.
-
- The position is defined as a percentage of the control's size, scaled to
- \c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
- value is equal to \c {1.0 - position}. This makes the value suitable for
- visualizing the slider, taking right-to-left support into account.
- \row
- \li position
- \li This property holds the logical position of the second handle.
-
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike \l {second.value}{value}, position is
- continuously updated while the handle is dragged. For visualizing a
- slider, the right-to-left aware
- \l {second.visualPosition}{visualPosition} should be used instead.
- \row
- \li pressed
- \li This property holds whether the second handle is pressed.
- \endtable
-
- \sa second.increase(), second.decrease()
-*/
-QQuickRangeSliderNode *QQuickRangeSlider::second() const
-{
- Q_D(const QQuickRangeSlider);
- return d->second;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::RangeSlider::stepSize
-
- This property holds the step size. The default value is \c 0.0.
-
- \sa snapMode, first.increase(), first.decrease()
-*/
-qreal QQuickRangeSlider::stepSize() const
-{
- Q_D(const QQuickRangeSlider);
- return d->stepSize;
-}
-
-void QQuickRangeSlider::setStepSize(qreal step)
-{
- Q_D(QQuickRangeSlider);
- if (!qFuzzyCompare(d->stepSize, step)) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::RangeSlider::snapMode
-
- This property holds the snap mode.
-
- Possible values:
- \value RangeSlider.NoSnap The slider does not snap (default).
- \value RangeSlider.SnapAlways The slider snaps while the handle is dragged.
- \value RangeSlider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
-
- \sa stepSize
-*/
-QQuickRangeSlider::SnapMode QQuickRangeSlider::snapMode() const
-{
- Q_D(const QQuickRangeSlider);
- return d->snapMode;
-}
-
-void QQuickRangeSlider::setSnapMode(SnapMode mode)
-{
- Q_D(QQuickRangeSlider);
- if (d->snapMode != mode) {
- d->snapMode = mode;
- emit snapModeChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::RangeSlider::orientation
-
- This property holds the orientation.
-
- Possible values:
- \value Qt.Horizontal Horizontal (default)
- \value Qt.Vertical Vertical
-*/
-Qt::Orientation QQuickRangeSlider::orientation() const
-{
- Q_D(const QQuickRangeSlider);
- return d->orientation;
-}
-
-void QQuickRangeSlider::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QQuickRangeSlider);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::RangeSlider::track
-
- This property holds the track item.
-
- \sa {Customizing Slider}
-*/
-QQuickItem *QQuickRangeSlider::track() const
-{
- Q_D(const QQuickRangeSlider);
- return d->track;
-}
-
-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();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::RangeSlider::setValues(real firstValue, real secondValue)
-
- Sets \l first.value and \l second.value with the given arguments.
-
- If \a to is larger than \a from and \a firstValue is larger than
- \a secondValue, \a firstValue will be clamped to \a secondValue.
-
- If \a from is larger than \a to and \a secondValue is larger than
- \a firstValue, \a secondValue will be clamped to \a firstValue.
-
- This function may be necessary to set the first and second values
- after the control has been completed, as there is a circular
- dependency between firstValue and secondValue which can cause
- assigned values to be clamped to each other.
-
- \sa stepSize
-*/
-void QQuickRangeSlider::setValues(qreal firstValue, qreal secondValue)
-{
- Q_D(QQuickRangeSlider);
- // Restrict the values to be within to and from.
- const qreal smaller = qMin(d->to, d->from);
- const qreal larger = qMax(d->to, d->from);
- firstValue = qBound(smaller, firstValue, larger);
- secondValue = qBound(smaller, secondValue, larger);
-
- if (d->from > d->to) {
- // If the from and to values are reversed, the secondValue
- // might be less than the first value, which is not allowed.
- if (secondValue > firstValue)
- secondValue = firstValue;
- } else {
- // Otherwise, clamp first to second if it's too large.
- if (firstValue > secondValue)
- firstValue = secondValue;
- }
-
- // Then set both values. If they didn't change, no change signal will be emitted.
- QQuickRangeSliderNodePrivate *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first);
- if (firstValue != firstPrivate->value) {
- firstPrivate->value = firstValue;
- emit d->first->valueChanged();
- }
-
- QQuickRangeSliderNodePrivate *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second);
- if (secondValue != secondPrivate->value) {
- secondPrivate->value = secondValue;
- emit d->second->valueChanged();
- }
-
- // After we've set both values, then we can update the positions.
- // If we don't do this last, the positions may be incorrect.
- firstPrivate->updatePosition(true);
- secondPrivate->updatePosition();
-}
-
-void QQuickRangeSlider::focusInEvent(QFocusEvent *event)
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::focusInEvent(event);
-
- // The active focus ends up to RangeSlider when using forceActiveFocus()
- // or QML KeyNavigation. We must forward the focus to one of the handles,
- // because RangeSlider handles key events for the focused handle. If
- // neither handle has active focus, RangeSlider doesn't do anything.
- QQuickItem *handle = nextItemInFocusChain();
- // QQuickItem::nextItemInFocusChain() only works as desired with
- // Qt::TabFocusAllControls. otherwise pick the first handle
- if (!handle || handle == this)
- handle = d->first->handle();
- if (handle)
- handle->forceActiveFocus(event->reason());
-}
-
-void QQuickRangeSlider::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::keyPressEvent(event);
-
- QQuickRangeSliderNode *focusNode = d->first->handle()->hasActiveFocus()
- ? d->first : (d->second->handle()->hasActiveFocus() ? d->second : Q_NULLPTR);
- if (!focusNode)
- return;
-
- if (d->orientation == Qt::Horizontal) {
- if (event->key() == Qt::Key_Left) {
- focusNode->setPressed(true);
- if (isMirrored())
- focusNode->increase();
- else
- focusNode->decrease();
- event->accept();
- } else if (event->key() == Qt::Key_Right) {
- focusNode->setPressed(true);
- if (isMirrored())
- focusNode->decrease();
- else
- focusNode->increase();
- event->accept();
- }
- } else {
- if (event->key() == Qt::Key_Up) {
- focusNode->setPressed(true);
- focusNode->increase();
- event->accept();
- } else if (event->key() == Qt::Key_Down) {
- focusNode->setPressed(true);
- focusNode->decrease();
- event->accept();
- }
- }
-}
-
-void QQuickRangeSlider::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::keyReleaseEvent(event);
- d->first->setPressed(false);
- d->second->setPressed(false);
-}
-
-void QQuickRangeSlider::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::mousePressEvent(event);
- d->pressPoint = event->pos();
-
- QQuickItem *firstHandle = d->first->handle();
- 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;
-
- if (firstHit && secondHit) {
- // choose highest
- hitNode = firstHandle->z() > secondHandle->z() ? d->first : d->second;
- otherNode = firstHandle->z() > secondHandle->z() ? d->second : d->first;
- } else if (firstHit) {
- hitNode = d->first;
- otherNode = d->second;
- } else if (secondHit) {
- hitNode = d->second;
- otherNode = d->first;
- } else {
- // find the nearest
- const qreal firstDistance = QLineF(firstHandle->boundingRect().center(),
- mapToItem(firstHandle, event->pos())).length();
- const qreal secondDistance = QLineF(secondHandle->boundingRect().center(),
- mapToItem(secondHandle, event->pos())).length();
-
- if (qFuzzyCompare(firstDistance, secondDistance)) {
- // same distance => choose the one that can be moved towards the press position
- const bool inverted = d->from > d->to;
- const qreal pos = positionAt(this, firstHandle, event->pos());
- if ((!inverted && pos < d->first->position()) || (inverted && pos > d->first->position())) {
- hitNode = d->first;
- otherNode = d->second;
- } else {
- hitNode = d->second;
- otherNode = d->first;
- }
- } else if (firstDistance < secondDistance) {
- hitNode = d->first;
- otherNode = d->second;
- } else {
- hitNode = d->second;
- otherNode = d->first;
- }
- }
-
- if (hitNode) {
- hitNode->setPressed(true);
- hitNode->handle()->setZ(1);
- }
- if (otherNode)
- otherNode->handle()->setZ(0);
-}
-
-void QQuickRangeSlider::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::mouseMoveEvent(event);
- if (!keepMouseGrab()) {
- if (d->orientation == Qt::Horizontal)
- setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event));
- else
- 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);
- if (pressedNode) {
- qreal pos = positionAt(this, pressedNode->handle(), event->pos());
- if (d->snapMode == SnapAlways)
- pos = snapPosition(this, pos);
- QQuickRangeSliderNodePrivate::get(pressedNode)->setPosition(pos);
- }
- }
-}
-
-void QQuickRangeSlider::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::mouseReleaseEvent(event);
-
- d->pressPoint = QPoint();
- if (!keepMouseGrab())
- return;
-
- QQuickRangeSliderNode *pressedNode = d->first->isPressed() ? d->first : (d->second->isPressed() ? d->second : Q_NULLPTR);
- if (!pressedNode)
- return;
-
- qreal pos = positionAt(this, pressedNode->handle(), event->pos());
- if (d->snapMode != NoSnap)
- pos = snapPosition(this, pos);
- qreal val = valueAt(this, pos);
- if (!qFuzzyCompare(val, pressedNode->value()))
- pressedNode->setValue(val);
- else if (d->snapMode != NoSnap)
- QQuickRangeSliderNodePrivate::get(pressedNode)->setPosition(pos);
- setKeepMouseGrab(false);
- pressedNode->setPressed(false);
-}
-
-void QQuickRangeSlider::mouseUngrabEvent()
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::mouseUngrabEvent();
- d->pressPoint = QPoint();
- d->first->setPressed(false);
- d->second->setPressed(false);
-}
-
-void QQuickRangeSlider::mirrorChange()
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::mirrorChange();
- emit d->first->visualPositionChanged();
- emit d->second->visualPositionChanged();
-}
-
-void QQuickRangeSlider::componentComplete()
-{
- Q_D(QQuickRangeSlider);
- QQuickControl::componentComplete();
-
- QQuickRangeSliderNodePrivate *firstPrivate = QQuickRangeSliderNodePrivate::get(d->first);
- QQuickRangeSliderNodePrivate *secondPrivate = QQuickRangeSliderNodePrivate::get(d->second);
-
- if (firstPrivate->isPendingValue || secondPrivate->isPendingValue
- || !qFuzzyCompare(d->from, defaultFrom) || !qFuzzyCompare(d->to, defaultTo)) {
- // Properties were set while we were loading. To avoid clamping issues that occur when setting the
- // values of first and second overriding values set by the user, set them all at once at the end.
- // Another reason that we must set these values here is that the from and to values might have made the old range invalid.
- setValues(firstPrivate->isPendingValue ? firstPrivate->pendingValue : firstPrivate->value,
- secondPrivate->isPendingValue ? secondPrivate->pendingValue : secondPrivate->value);
-
- firstPrivate->pendingValue = 0;
- firstPrivate->isPendingValue = false;
- secondPrivate->pendingValue = 0;
- secondPrivate->isPendingValue = false;
- } else {
- // If there was no pending data, we must still update the positions,
- // as first.setValue()/second.setValue() won't be called as part of default construction.
- // Don't need to ignore the second position when updating the first position here,
- // as our default values are guaranteed to be valid.
- firstPrivate->updatePosition();
- secondPrivate->updatePosition();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::RangeSlider::first.increase()
-
- Increases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
-
- \sa first
-*/
-
-/*!
- \qmlmethod void Qt.labs.controls::RangeSlider::first.decrease()
-
- Decreases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
-
- \sa first
-*/
-
-/*!
- \qmlmethod void Qt.labs.controls::RangeSlider::second.increase()
-
- Increases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
-
- \sa second
-*/
-
-/*!
- \qmlmethod void Qt.labs.controls::RangeSlider::second.decrease()
-
- Decreases the value of the handle by stepSize, or \c 0.1 if stepSize is not defined.
-
- \sa second
-*/
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickRangeSlider::accessibleRole() const
-{
- return QAccessible::Slider;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickrangeslider_p.h b/src/templates/qquickrangeslider_p.h
deleted file mode 100644
index 4cf6ffd6..00000000
--- a/src/templates/qquickrangeslider_p.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKRANGESLIDER_H
-#define QQUICKRANGESLIDER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickRangeSliderPrivate;
-class QQuickRangeSliderNode;
-
-class Q_LABSTEMPLATES_EXPORT QQuickRangeSlider : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
- Q_PROPERTY(QQuickRangeSliderNode *first READ first CONSTANT)
- Q_PROPERTY(QQuickRangeSliderNode *second READ second CONSTANT)
- Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
- Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
- Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
- Q_PROPERTY(QQuickItem *track READ track WRITE setTrack NOTIFY trackChanged FINAL)
-
-public:
- explicit QQuickRangeSlider(QQuickItem *parent = Q_NULLPTR);
-
- qreal from() const;
- void setFrom(qreal from);
-
- qreal to() const;
- void setTo(qreal to);
-
- QQuickRangeSliderNode *first() const;
- QQuickRangeSliderNode *second() const;
-
- qreal stepSize() const;
- void setStepSize(qreal step);
-
- enum SnapMode {
- NoSnap,
- SnapAlways,
- SnapOnRelease
- };
- Q_ENUM(SnapMode)
-
- SnapMode snapMode() const;
- void setSnapMode(SnapMode mode);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
- QQuickItem *track() const;
- void setTrack(QQuickItem *track);
-
- Q_INVOKABLE void setValues(qreal firstValue, qreal secondValue);
-
-Q_SIGNALS:
- void fromChanged();
- void toChanged();
- void stepSizeChanged();
- void snapModeChanged();
- void orientationChanged();
- void trackChanged();
-
-protected:
- void focusInEvent(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 mirrorChange() Q_DECL_OVERRIDE;
- void componentComplete() Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- friend class QQuickRangeSliderNode;
-
- Q_DISABLE_COPY(QQuickRangeSlider)
- Q_DECLARE_PRIVATE(QQuickRangeSlider)
-};
-
-class QQuickRangeSliderNodePrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickRangeSliderNode : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
- Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
- Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
- Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
- Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
-
-public:
- explicit QQuickRangeSliderNode(qreal value, QQuickRangeSlider *slider);
- ~QQuickRangeSliderNode();
-
- qreal value() const;
- void setValue(qreal value);
-
- qreal position() const;
- qreal visualPosition() const;
-
- QQuickItem *handle() const;
- void setHandle(QQuickItem *handle);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
-public Q_SLOTS:
- void increase();
- void decrease();
-
-Q_SIGNALS:
- void valueChanged();
- void positionChanged();
- void visualPositionChanged();
- void handleChanged();
- void pressedChanged();
-
-private:
- Q_DISABLE_COPY(QQuickRangeSliderNode)
- Q_DECLARE_PRIVATE(QQuickRangeSliderNode)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickRangeSlider)
-
-#endif // QQUICKRANGESLIDER_H
diff --git a/src/templates/qquickscrollbar.cpp b/src/templates/qquickscrollbar.cpp
deleted file mode 100644
index b3679bf8..00000000
--- a/src/templates/qquickscrollbar.cpp
+++ /dev/null
@@ -1,532 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickscrollbar_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtQuick/private/qquickflickable_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ScrollBar
- \inherits Control
- \instantiates QQuickScrollBar
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-indicators
- \brief An interactive scroll bar control.
-
- ScrollBar is an interactive bar that can be used to scroll to a specific
- position. A scroll bar can be either \l vertical or \l horizontal, and can
- be attached to any \l Flickable, such as \l ListView and \l GridView.
-
- \image qtlabscontrols-scrollbar.png
-
- \code
- Flickable {
- // ...
- ScrollBar.vertical: ScrollBar { }
- }
- \endcode
-
- \note When ScrollBar is attached \l {ScrollBar::vertical}{vertically} or
- \l {ScrollBar::horizontal}{horizontally} to a Flickable, its geometry and
- the following properties are automatically set and updated as appropriate:
- \list
- \li \l orientation
- \li \l position
- \li \l size
- \li \l active
- \endlist
-
- \labs
-
- \sa ScrollIndicator, {Customizing ScrollBar}, {Indicator Controls}
-*/
-
-class QQuickScrollBarPrivate : public QQuickControlPrivate
-{
-public:
- QQuickScrollBarPrivate() : size(0), position(0), offset(0),
- active(false), pressed(false), moving(false),
- orientation(Qt::Vertical), handle(Q_NULLPTR)
- {
- }
-
- static QQuickScrollBarPrivate *get(QQuickScrollBar *bar)
- {
- return bar->d_func();
- }
-
- qreal size;
- qreal position;
- qreal offset;
- bool active;
- bool pressed;
- bool moving;
- Qt::Orientation orientation;
- QQuickItem *handle;
-};
-
-QQuickScrollBar::QQuickScrollBar(QQuickItem *parent) :
- QQuickControl(*(new QQuickScrollBarPrivate), parent)
-{
- setKeepMouseGrab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-QQuickScrollBarAttached *QQuickScrollBar::qmlAttachedProperties(QObject *object)
-{
- QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(object);
- if (flickable)
- return new QQuickScrollBarAttached(flickable);
-
- qWarning() << "ScrollBar must be attached to a Flickable" << object;
- return Q_NULLPTR;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ScrollBar::size
-
- This property holds the size of the scroll bar, scaled to \c {0.0 - 1.0}.
-
- \sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
-*/
-qreal QQuickScrollBar::size() const
-{
- Q_D(const QQuickScrollBar);
- return d->size;
-}
-
-void QQuickScrollBar::setSize(qreal size)
-{
- Q_D(QQuickScrollBar);
- if (!qFuzzyCompare(d->size, size)) {
- d->size = size;
- emit sizeChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ScrollBar::position
-
- This property holds the position of the scroll bar, scaled to \c {0.0 - 1.0}.
-
- \sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
-*/
-qreal QQuickScrollBar::position() const
-{
- Q_D(const QQuickScrollBar);
- return d->position;
-}
-
-void QQuickScrollBar::setPosition(qreal position)
-{
- Q_D(QQuickScrollBar);
- if (!qFuzzyCompare(d->position, position)) {
- d->position = position;
- emit positionChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::ScrollBar::active
-
- This property holds whether the scroll bar is active ie. when its \l pressed
- or the attached Flickable is \l {Flickable::moving}{moving}.
-*/
-bool QQuickScrollBar::isActive() const
-{
- Q_D(const QQuickScrollBar);
- return d->active;
-}
-
-void QQuickScrollBar::setActive(bool active)
-{
- Q_D(QQuickScrollBar);
- if (d->active != active) {
- d->active = active;
- emit activeChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::ScrollBar::pressed
-
- This property holds whether the scroll bar is pressed.
-*/
-bool QQuickScrollBar::isPressed() const
-{
- Q_D(const QQuickScrollBar);
- return d->pressed;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::ScrollBar::orientation
-
- This property holds the orientation of the scroll bar.
-
- Possible values:
- \value Qt.Horizontal Horizontal
- \value Qt.Vertical Vertical (default)
-*/
-Qt::Orientation QQuickScrollBar::orientation() const
-{
- Q_D(const QQuickScrollBar);
- return d->orientation;
-}
-
-void QQuickScrollBar::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QQuickScrollBar);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::ScrollBar::handle
-
- This property holds the handle item.
-
- \sa {Customizing ScrollBar}
-*/
-QQuickItem *QQuickScrollBar::handle() const
-{
- Q_D(const QQuickScrollBar);
- return d->handle;
-}
-
-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();
- }
-}
-
-void QQuickScrollBar::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickScrollBar);
- QQuickControl::mousePressEvent(event);
- d->offset = positionAt(event->pos()) - d->position;
- if (d->offset < 0 || d->offset > d->size)
- d->offset = d->size / 2;
- setPressed(true);
-}
-
-void QQuickScrollBar::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickScrollBar);
- QQuickControl::mouseMoveEvent(event);
- setPosition(qBound<qreal>(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
-}
-
-void QQuickScrollBar::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickScrollBar);
- QQuickControl::mouseReleaseEvent(event);
- setPosition(qBound<qreal>(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
- d->offset = 0.0;
- setPressed(false);
-}
-
-qreal QQuickScrollBar::positionAt(const QPoint &point) const
-{
- Q_D(const QQuickScrollBar);
- if (d->orientation == Qt::Horizontal)
- return (point.x() - leftPadding()) / availableWidth();
- else
- return (point.y() - topPadding()) / availableHeight();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickScrollBar::accessibilityActiveChanged(bool active)
-{
- QQuickControl::accessibilityActiveChanged(active);
-
- Q_D(QQuickScrollBar);
- if (active)
- setAccessibleProperty("pressed", d->pressed);
-}
-
-QAccessible::Role QQuickScrollBar::accessibleRole() const
-{
- return QAccessible::ScrollBar;
-}
-#endif
-
-class QQuickScrollBarAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
-public:
- QQuickScrollBarAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(Q_NULLPTR), vertical(Q_NULLPTR) { }
-
- void activateHorizontal();
- void activateVertical();
- void scrollHorizontal();
- void scrollVertical();
-
- void layoutHorizontal(bool move = true);
- void layoutVertical(bool move = true);
-
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
-
- QQuickFlickable *flickable;
- QQuickScrollBar *horizontal;
- QQuickScrollBar *vertical;
-};
-
-void QQuickScrollBarAttachedPrivate::activateHorizontal()
-{
- QQuickScrollBarPrivate *p = QQuickScrollBarPrivate::get(horizontal);
- p->moving = flickable->isMovingHorizontally();
- horizontal->setActive(p->moving || p->pressed);
-}
-
-void QQuickScrollBarAttachedPrivate::activateVertical()
-{
- QQuickScrollBarPrivate *p = QQuickScrollBarPrivate::get(vertical);
- p->moving = flickable->isMovingVertically();
- vertical->setActive(p->moving || p->pressed);
-}
-
-// TODO: QQuickFlickable::maxXYExtent()
-class QQuickFriendlyFlickable : public QQuickFlickable
-{
- friend class QQuickScrollBarAttachedPrivate;
-};
-
-void QQuickScrollBarAttachedPrivate::scrollHorizontal()
-{
- QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
-
- const qreal viewwidth = f->width();
- const qreal maxxextent = -f->maxXExtent() + f->minXExtent();
- qreal cx = horizontal->position() * (maxxextent + viewwidth) - f->minXExtent();
- if (!qIsNaN(cx) && !qFuzzyCompare(cx, flickable->contentX()))
- flickable->setContentX(cx);
-}
-
-void QQuickScrollBarAttachedPrivate::scrollVertical()
-{
- QQuickFriendlyFlickable *f = reinterpret_cast<QQuickFriendlyFlickable *>(flickable);
-
- const qreal viewheight = f->height();
- const qreal maxyextent = -f->maxYExtent() + f->minYExtent();
- qreal cy = vertical->position() * (maxyextent + viewheight) - f->minYExtent();
- if (!qIsNaN(cy) && !qFuzzyCompare(cy, flickable->contentY()))
- flickable->setContentY(cy);
-}
-
-void QQuickScrollBarAttachedPrivate::layoutHorizontal(bool move)
-{
- Q_ASSERT(horizontal && flickable);
- horizontal->setWidth(flickable->width());
- if (move)
- horizontal->setY(flickable->height() - horizontal->height());
-}
-
-void QQuickScrollBarAttachedPrivate::layoutVertical(bool move)
-{
- Q_ASSERT(vertical && flickable);
- vertical->setHeight(flickable->height());
- if (move && !QQuickItemPrivate::get(vertical)->isMirrored())
- vertical->setX(flickable->width() - vertical->width());
-}
-
-void QQuickScrollBarAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_UNUSED(item);
- Q_UNUSED(newGeometry);
- if (horizontal && horizontal->height() > 0) {
- bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
- layoutHorizontal(move);
- }
- if (vertical && vertical->width() > 0) {
- bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
- layoutVertical(move);
- }
-}
-
-QQuickScrollBarAttached::QQuickScrollBarAttached(QQuickFlickable *flickable) :
- QObject(*(new QQuickScrollBarAttachedPrivate(flickable)), flickable)
-{
- Q_D(QQuickScrollBarAttached);
- QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
- p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
-}
-
-QQuickScrollBarAttached::~QQuickScrollBarAttached()
-{
- Q_D(QQuickScrollBarAttached);
- if (d->horizontal)
- QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- if (d->vertical)
- QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
-}
-
-/*!
- \qmlattachedproperty ScrollBar Qt.labs.controls::ScrollBar::horizontal
-
- This property attaches a horizontal scroll bar to a \l Flickable.
-
- \code
- Flickable {
- contentWidth: 2000
- ScrollBar.horizontal: ScrollBar { }
- }
- \endcode
-*/
-QQuickScrollBar *QQuickScrollBarAttached::horizontal() const
-{
- Q_D(const QQuickScrollBarAttached);
- return d->horizontal;
-}
-
-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();
- }
-}
-
-/*!
- \qmlattachedproperty ScrollBar Qt.labs.controls::ScrollBar::vertical
-
- This property attaches a vertical scroll bar to a \l Flickable.
-
- \code
- Flickable {
- contentHeight: 2000
- ScrollBar.vertical: ScrollBar { }
- }
- \endcode
-*/
-QQuickScrollBar *QQuickScrollBarAttached::vertical() const
-{
- Q_D(const QQuickScrollBarAttached);
- return d->vertical;
-}
-
-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();
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickscrollbar_p.h b/src/templates/qquickscrollbar_p.h
deleted file mode 100644
index b944f92a..00000000
--- a/src/templates/qquickscrollbar_p.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSCROLLBAR_P_H
-#define QQUICKSCROLLBAR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickFlickable;
-class QQuickScrollBarAttached;
-class QQuickScrollBarPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickScrollBar : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal size READ size WRITE setSize NOTIFY sizeChanged FINAL)
- Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
- Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
- Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
- Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
- Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
-
-public:
- explicit QQuickScrollBar(QQuickItem *parent = Q_NULLPTR);
-
- static QQuickScrollBarAttached *qmlAttachedProperties(QObject *object);
-
- qreal size() const;
- qreal position() const;
-
- bool isActive() const;
- void setActive(bool active);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
- QQuickItem *handle() const;
- void setHandle(QQuickItem *handle);
-
-public Q_SLOTS:
- void setSize(qreal size);
- void setPosition(qreal position);
-
-Q_SIGNALS:
- void sizeChanged();
- void positionChanged();
- void activeChanged();
- void pressedChanged();
- void orientationChanged();
- void handleChanged();
-
-protected:
- void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
- void mouseReleaseEvent(QMouseEvent *event) Q_DECL_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;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickScrollBar)
- Q_DECLARE_PRIVATE(QQuickScrollBar)
-};
-
-class QQuickScrollBarAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickScrollBarAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQuickScrollBar *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
- Q_PROPERTY(QQuickScrollBar *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
-
-public:
- explicit QQuickScrollBarAttached(QQuickFlickable *flickable);
- ~QQuickScrollBarAttached();
-
- QQuickScrollBar *horizontal() const;
- void setHorizontal(QQuickScrollBar *horizontal);
-
- QQuickScrollBar *vertical() const;
- void setVertical(QQuickScrollBar *vertical);
-
-Q_SIGNALS:
- void horizontalChanged();
- void verticalChanged();
-
-private:
- Q_DISABLE_COPY(QQuickScrollBarAttached)
- Q_DECLARE_PRIVATE(QQuickScrollBarAttached)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickScrollBar)
-QML_DECLARE_TYPEINFO(QQuickScrollBar, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKSCROLLBAR_P_H
diff --git a/src/templates/qquickscrollindicator.cpp b/src/templates/qquickscrollindicator.cpp
deleted file mode 100644
index 4dc04141..00000000
--- a/src/templates/qquickscrollindicator.cpp
+++ /dev/null
@@ -1,417 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickscrollindicator_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtQuick/private/qquickflickable_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ScrollIndicator
- \inherits Control
- \instantiates QQuickScrollIndicator
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-indicators
- \brief A non-interactive scroll indicator control.
-
- ScrollIndicator is a non-interactive indicator that indicates the current scroll
- position. A scroll indicator can be either \l vertical or \l horizontal, and can
- be attached to any \l Flickable, such as \l ListView and \l GridView.
-
- \image qtlabscontrols-scrollindicator.png
-
- \code
- Flickable {
- // ...
- ScrollIndicator.vertical: ScrollIndicator { }
- }
- \endcode
-
- \note When ScrollIndicator is attached \l {ScrollIndicator::vertical}{vertically}
- or \l {ScrollIndicator::horizontal}{horizontally} to a Flickable, its geometry and
- the following properties are automatically set and updated as appropriate:
- \list
- \li \l orientation
- \li \l position
- \li \l size
- \li \l active
- \endlist
-
- \labs
-
- \sa ScrollBar, {Customizing ScrollIndicator}, {Indicator Controls}
-*/
-
-class QQuickScrollIndicatorPrivate : public QQuickControlPrivate
-{
-public:
- QQuickScrollIndicatorPrivate() : size(0), position(0),
- active(false), orientation(Qt::Vertical), indicator(Q_NULLPTR)
- {
- }
-
- qreal size;
- qreal position;
- bool active;
- Qt::Orientation orientation;
- QQuickItem *indicator;
-};
-
-QQuickScrollIndicator::QQuickScrollIndicator(QQuickItem *parent) :
- QQuickControl(*(new QQuickScrollIndicatorPrivate), parent)
-{
-}
-
-QQuickScrollIndicatorAttached *QQuickScrollIndicator::qmlAttachedProperties(QObject *object)
-{
- QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(object);
- if (flickable)
- return new QQuickScrollIndicatorAttached(flickable);
-
- qWarning() << "ScrollIndicator must be attached to a Flickable" << object;
- return Q_NULLPTR;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ScrollIndicator::size
-
- This property holds the size of the indicator, scaled to \c {0.0 - 1.0}.
-
- \sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
-*/
-qreal QQuickScrollIndicator::size() const
-{
- Q_D(const QQuickScrollIndicator);
- return d->size;
-}
-
-void QQuickScrollIndicator::setSize(qreal size)
-{
- Q_D(QQuickScrollIndicator);
- if (!qFuzzyCompare(d->size, size)) {
- d->size = size;
- emit sizeChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::ScrollIndicator::position
-
- This property holds the position of the indicator, scaled to \c {0.0 - 1.0}.
-
- \sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
-*/
-qreal QQuickScrollIndicator::position() const
-{
- Q_D(const QQuickScrollIndicator);
- return d->position;
-}
-
-void QQuickScrollIndicator::setPosition(qreal position)
-{
- Q_D(QQuickScrollIndicator);
- if (!qFuzzyCompare(d->position, position)) {
- d->position = position;
- emit positionChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::ScrollIndicator::active
-
- This property holds whether the indicator is active, that is, when the
- attached Flickable is \l {Flickable::moving}{moving}.
-*/
-bool QQuickScrollIndicator::isActive() const
-{
- Q_D(const QQuickScrollIndicator);
- return d->active;
-}
-
-void QQuickScrollIndicator::setActive(bool active)
-{
- Q_D(QQuickScrollIndicator);
- if (d->active != active) {
- d->active = active;
- emit activeChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::ScrollIndicator::orientation
-
- This property holds the orientation of the indicator.
-
- Possible values:
- \value Qt.Horizontal Horizontal
- \value Qt.Vertical Vertical (default)
-*/
-Qt::Orientation QQuickScrollIndicator::orientation() const
-{
- Q_D(const QQuickScrollIndicator);
- return d->orientation;
-}
-
-void QQuickScrollIndicator::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QQuickScrollIndicator);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::ScrollIndicator::indicator
-
- This property holds the indicator item.
-
- \sa {Customizing ScrollIndicator}
-*/
-QQuickItem *QQuickScrollIndicator::indicator() const
-{
- Q_D(const QQuickScrollIndicator);
- return d->indicator;
-}
-
-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();
- }
-}
-
-class QQuickScrollIndicatorAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
-public:
- QQuickScrollIndicatorAttachedPrivate(QQuickFlickable *flickable) : flickable(flickable), horizontal(Q_NULLPTR), vertical(Q_NULLPTR) { }
-
- void activateHorizontal();
- void activateVertical();
-
- void layoutHorizontal(bool move = true);
- void layoutVertical(bool move = true);
-
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
-
- QQuickFlickable *flickable;
- QQuickScrollIndicator *horizontal;
- QQuickScrollIndicator *vertical;
-};
-
-void QQuickScrollIndicatorAttachedPrivate::activateHorizontal()
-{
- horizontal->setActive(flickable->isMovingHorizontally());
-}
-
-void QQuickScrollIndicatorAttachedPrivate::activateVertical()
-{
- vertical->setActive(flickable->isMovingVertically());
-}
-
-void QQuickScrollIndicatorAttachedPrivate::layoutHorizontal(bool move)
-{
- Q_ASSERT(horizontal && flickable);
- horizontal->setWidth(flickable->width());
- if (move)
- horizontal->setY(flickable->height() - horizontal->height());
-}
-
-void QQuickScrollIndicatorAttachedPrivate::layoutVertical(bool move)
-{
- Q_ASSERT(vertical && flickable);
- vertical->setHeight(flickable->height());
- if (move && !QQuickItemPrivate::get(vertical)->isMirrored())
- vertical->setX(flickable->width() - vertical->width());
-}
-
-void QQuickScrollIndicatorAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_UNUSED(item);
- Q_UNUSED(newGeometry);
- if (horizontal && horizontal->height() > 0) {
- bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
- layoutHorizontal(move);
- }
- if (vertical && vertical->width() > 0) {
- bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
- layoutVertical(move);
- }
-}
-
-QQuickScrollIndicatorAttached::QQuickScrollIndicatorAttached(QQuickFlickable *flickable) :
- QObject(*(new QQuickScrollIndicatorAttachedPrivate(flickable)), flickable)
-{
- Q_D(QQuickScrollIndicatorAttached);
- QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
- p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
-}
-
-QQuickScrollIndicatorAttached::~QQuickScrollIndicatorAttached()
-{
- Q_D(QQuickScrollIndicatorAttached);
- if (d->horizontal)
- QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
- if (d->vertical)
- QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
-}
-
-/*!
- \qmlattachedproperty ScrollIndicator Qt.labs.controls::ScrollIndicator::horizontal
-
- This property attaches a horizontal scroll indicator to a \l Flickable.
-
- \code
- Flickable {
- contentWidth: 2000
- ScrollIndicator.horizontal: ScrollIndicator { }
- }
- \endcode
-*/
-QQuickScrollIndicator *QQuickScrollIndicatorAttached::horizontal() const
-{
- Q_D(const QQuickScrollIndicatorAttached);
- return d->horizontal;
-}
-
-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();
- }
-}
-
-/*!
- \qmlattachedproperty ScrollIndicator Qt.labs.controls::ScrollIndicator::vertical
-
- This property attaches a vertical scroll indicator to a \l Flickable.
-
- \code
- Flickable {
- contentHeight: 2000
- ScrollIndicator.vertical: ScrollIndicator { }
- }
- \endcode
-*/
-QQuickScrollIndicator *QQuickScrollIndicatorAttached::vertical() const
-{
- Q_D(const QQuickScrollIndicatorAttached);
- return d->vertical;
-}
-
-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();
- }
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickScrollIndicator::accessibleRole() const
-{
- return QAccessible::Indicator;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickscrollindicator_p.h b/src/templates/qquickscrollindicator_p.h
deleted file mode 100644
index 1f5f07b7..00000000
--- a/src/templates/qquickscrollindicator_p.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSCROLLINDICATOR_P_H
-#define QQUICKSCROLLINDICATOR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickFlickable;
-class QQuickScrollIndicatorAttached;
-class QQuickScrollIndicatorPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickScrollIndicator : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal size READ size WRITE setSize NOTIFY sizeChanged FINAL)
- Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
- Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged FINAL)
- Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
- Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
-
-public:
- explicit QQuickScrollIndicator(QQuickItem *parent = Q_NULLPTR);
-
- static QQuickScrollIndicatorAttached *qmlAttachedProperties(QObject *object);
-
- qreal size() const;
- qreal position() const;
-
- bool isActive() const;
- void setActive(bool active);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
- QQuickItem *indicator() const;
- void setIndicator(QQuickItem *indicator);
-
-public Q_SLOTS:
- void setSize(qreal size);
- void setPosition(qreal position);
-
-Q_SIGNALS:
- void sizeChanged();
- void positionChanged();
- void activeChanged();
- void orientationChanged();
- void indicatorChanged();
-
-protected:
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickScrollIndicator)
- Q_DECLARE_PRIVATE(QQuickScrollIndicator)
-};
-
-class QQuickScrollIndicatorAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickScrollIndicatorAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQuickScrollIndicator *horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged FINAL)
- Q_PROPERTY(QQuickScrollIndicator *vertical READ vertical WRITE setVertical NOTIFY verticalChanged FINAL)
-
-public:
- explicit QQuickScrollIndicatorAttached(QQuickFlickable *flickable);
- ~QQuickScrollIndicatorAttached();
-
- QQuickScrollIndicator *horizontal() const;
- void setHorizontal(QQuickScrollIndicator *horizontal);
-
- QQuickScrollIndicator *vertical() const;
- void setVertical(QQuickScrollIndicator *vertical);
-
-Q_SIGNALS:
- void horizontalChanged();
- void verticalChanged();
-
-private:
- Q_DISABLE_COPY(QQuickScrollIndicatorAttached)
- Q_DECLARE_PRIVATE(QQuickScrollIndicatorAttached)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickScrollIndicator)
-QML_DECLARE_TYPEINFO(QQuickScrollIndicator, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKSCROLLINDICATOR_P_H
diff --git a/src/templates/qquickslider.cpp b/src/templates/qquickslider.cpp
deleted file mode 100644
index fac8fb50..00000000
--- a/src/templates/qquickslider.cpp
+++ /dev/null
@@ -1,588 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickslider_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtQuick/private/qquickwindow_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Slider
- \inherits Control
- \instantiates QQuickSlider
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A slider control.
-
- \image qtlabscontrols-slider.gif
-
- Slider is used to select a value by sliding a handle along a track.
-
- \table
- \row \li \image qtlabscontrols-slider-normal.png
- \li A slider in its normal state.
- \row \li \image qtlabscontrols-slider-focused.png
- \li A slider that has active focus.
- \row \li \image qtlabscontrols-slider-disabled.png
- \li A slider that is disabled.
- \endtable
-
- \code
- Slider {
- value: 0.5
- }
- \endcode
-
- \labs
-
- \sa {Customizing Slider}, {Input Controls}
-*/
-
-class QQuickSliderPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickSlider)
-
-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)
- {
- }
-
- qreal valueAt(qreal position) const;
- qreal snapPosition(qreal position) const;
- qreal positionAt(const QPoint &point) const;
- void setPosition(qreal position);
- void updatePosition();
-
- qreal from;
- qreal to;
- qreal value;
- qreal position;
- qreal stepSize;
- bool pressed;
- QPoint pressPoint;
- Qt::Orientation orientation;
- QQuickSlider::SnapMode snapMode;
- QQuickItem *handle;
- QQuickItem *track;
-};
-
-qreal QQuickSliderPrivate::valueAt(qreal position) const
-{
- return from + (to - from) * position;
-}
-
-qreal QQuickSliderPrivate::snapPosition(qreal position) const
-{
- const qreal range = from + (to - from);
- if (qFuzzyIsNull(range))
- return position;
-
- const qreal effectiveStep = stepSize / range;
- if (qFuzzyIsNull(effectiveStep))
- return position;
-
- return qRound(position / effectiveStep) * effectiveStep;
-}
-
-qreal QQuickSliderPrivate::positionAt(const QPoint &point) const
-{
- Q_Q(const QQuickSlider);
- if (orientation == Qt::Horizontal) {
- const qreal hw = handle ? handle->width() : 0;
- const qreal offset = hw / 2;
- const qreal extent = q->availableWidth() - hw;
- if (!qFuzzyIsNull(extent)) {
- if (q->isMirrored())
- return (q->width() - point.x() - q->rightPadding() - offset) / extent;
- return (point.x() - q->leftPadding() - offset) / extent;
- }
- } else {
- const qreal hh = handle ? handle->height() : 0;
- const qreal offset = hh / 2;
- const qreal extent = q->availableHeight() - hh;
- if (!qFuzzyIsNull(extent))
- return (q->height() - point.y() - q->bottomPadding() - offset) / extent;
- }
- return 0;
-}
-
-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();
- }
-}
-
-void QQuickSliderPrivate::updatePosition()
-{
- qreal pos = 0;
- if (!qFuzzyCompare(from, to))
- pos = (value - from) / (to - from);
- setPosition(pos);
-}
-
-QQuickSlider::QQuickSlider(QQuickItem *parent) :
- QQuickControl(*(new QQuickSliderPrivate), parent)
-{
- setActiveFocusOnTab(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Slider::from
-
- This property holds the starting value for the range. The default value is \c 0.0.
-
- \sa to, value
-*/
-qreal QQuickSlider::from() const
-{
- Q_D(const QQuickSlider);
- return d->from;
-}
-
-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();
- }
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Slider::to
-
- This property holds the end value for the range. The default value is \c 1.0.
-
- \sa from, value
-*/
-qreal QQuickSlider::to() const
-{
- Q_D(const QQuickSlider);
- return d->to;
-}
-
-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();
- }
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Slider::value
-
- This property holds the value in the range \c from - \c to. The default value is \c 0.0.
-
- Unlike the \l position property, the \c value is not updated while the
- handle is dragged. The value is updated after the value has been chosen
- and the slider has been released.
-
- \sa position
-*/
-qreal QQuickSlider::value() const
-{
- Q_D(const QQuickSlider);
- return d->value;
-}
-
-void QQuickSlider::setValue(qreal value)
-{
- Q_D(QQuickSlider);
- 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();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Slider::position
- \readonly
-
- This property holds the logical position of the handle.
-
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike the \l value property, the \c position is
- continuously updated while the handle is dragged. For visualizing a
- slider, the right-to-left aware \l visualPosition should be used instead.
-
- \sa value, visualPosition
-*/
-qreal QQuickSlider::position() const
-{
- Q_D(const QQuickSlider);
- return d->position;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Slider::visualPosition
- \readonly
-
- This property holds the visual position of the handle.
-
- The position is defined as a percentage of the control's size, scaled to
- \c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
- value is equal to \c {1.0 - position}. This makes the value suitable for
- visualizing the slider, taking right-to-left support into account.
-
- \sa position
-*/
-qreal QQuickSlider::visualPosition() const
-{
- Q_D(const QQuickSlider);
- if (d->orientation == Qt::Vertical || isMirrored())
- return 1.0 - d->position;
- return d->position;
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Slider::stepSize
-
- This property holds the step size. The default value is \c 0.0.
-
- \sa snapMode, increase(), decrease()
-*/
-qreal QQuickSlider::stepSize() const
-{
- Q_D(const QQuickSlider);
- return d->stepSize;
-}
-
-void QQuickSlider::setStepSize(qreal step)
-{
- Q_D(QQuickSlider);
- if (!qFuzzyCompare(d->stepSize, step)) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Slider::snapMode
-
- This property holds the snap mode.
-
- Possible values:
- \value Slider.NoSnap The slider does not snap (default).
- \value Slider.SnapAlways The slider snaps while the handle is dragged.
- \value Slider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
-
- \sa stepSize
-*/
-QQuickSlider::SnapMode QQuickSlider::snapMode() const
-{
- Q_D(const QQuickSlider);
- return d->snapMode;
-}
-
-void QQuickSlider::setSnapMode(SnapMode mode)
-{
- Q_D(QQuickSlider);
- if (d->snapMode != mode) {
- d->snapMode = mode;
- emit snapModeChanged();
- }
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Slider::pressed
-
- This property holds whether the slider is pressed.
-*/
-bool QQuickSlider::isPressed() const
-{
- Q_D(const QQuickSlider);
- return d->pressed;
-}
-
-void QQuickSlider::setPressed(bool pressed)
-{
- Q_D(QQuickSlider);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- setAccessibleProperty("pressed", pressed);
- emit pressedChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::Slider::orientation
-
- This property holds the orientation.
-
- Possible values:
- \value Qt.Horizontal Horizontal (default)
- \value Qt.Vertical Vertical
-*/
-Qt::Orientation QQuickSlider::orientation() const
-{
- Q_D(const QQuickSlider);
- return d->orientation;
-}
-
-void QQuickSlider::setOrientation(Qt::Orientation orientation)
-{
- Q_D(QQuickSlider);
- if (d->orientation != orientation) {
- d->orientation = orientation;
- emit orientationChanged();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Slider::handle
-
- This property holds the handle item.
-
- \sa {Customizing Slider}
-*/
-QQuickItem *QQuickSlider::handle() const
-{
- Q_D(const QQuickSlider);
- return d->handle;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Slider::track
-
- This property holds the track item.
-
- \sa {Customizing Slider}
-*/
-QQuickItem *QQuickSlider::track() const
-{
- Q_D(const QQuickSlider);
- return d->track;
-}
-
-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();
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Slider::increase()
-
- Increases the value by \l stepSize or \c 0.1 if stepSize is not defined.
-
- \sa stepSize
-*/
-void QQuickSlider::increase()
-{
- Q_D(QQuickSlider);
- qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
- setValue(d->value + step);
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::Slider::decrease()
-
- Decreases the value by \l stepSize or \c 0.1 if stepSize is not defined.
-
- \sa stepSize
-*/
-void QQuickSlider::decrease()
-{
- Q_D(QQuickSlider);
- qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
- setValue(d->value - step);
-}
-
-void QQuickSlider::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickSlider);
- QQuickControl::keyPressEvent(event);
- if (d->orientation == Qt::Horizontal) {
- if (event->key() == Qt::Key_Left) {
- setPressed(true);
- if (isMirrored())
- increase();
- else
- decrease();
- event->accept();
- } else if (event->key() == Qt::Key_Right) {
- setPressed(true);
- if (isMirrored())
- decrease();
- else
- increase();
- event->accept();
- }
- } else {
- if (event->key() == Qt::Key_Up) {
- setPressed(true);
- increase();
- event->accept();
- } else if (event->key() == Qt::Key_Down) {
- setPressed(true);
- decrease();
- event->accept();
- }
- }
-}
-
-void QQuickSlider::keyReleaseEvent(QKeyEvent *event)
-{
- QQuickControl::keyReleaseEvent(event);
- setPressed(false);
-}
-
-void QQuickSlider::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickSlider);
- QQuickControl::mousePressEvent(event);
- d->pressPoint = event->pos();
- setPressed(true);
-}
-
-void QQuickSlider::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickSlider);
- QQuickControl::mouseMoveEvent(event);
- if (!keepMouseGrab()) {
- if (d->orientation == Qt::Horizontal)
- setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - d->pressPoint.x(), Qt::XAxis, event));
- else
- setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().y() - d->pressPoint.y(), Qt::YAxis, event));
- }
- if (keepMouseGrab()) {
- qreal pos = d->positionAt(event->pos());
- if (d->snapMode == SnapAlways)
- pos = d->snapPosition(pos);
- d->setPosition(pos);
- }
-}
-
-void QQuickSlider::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickSlider);
- QQuickControl::mouseReleaseEvent(event);
- d->pressPoint = QPoint();
- if (keepMouseGrab()) {
- qreal pos = d->positionAt(event->pos());
- if (d->snapMode != NoSnap)
- pos = d->snapPosition(pos);
- qreal val = d->valueAt(pos);
- if (!qFuzzyCompare(val, d->value))
- setValue(val);
- else if (d->snapMode != NoSnap)
- d->setPosition(pos);
- setKeepMouseGrab(false);
- }
- setPressed(false);
-}
-
-void QQuickSlider::mouseUngrabEvent()
-{
- Q_D(QQuickSlider);
- QQuickControl::mouseUngrabEvent();
- d->pressPoint = QPoint();
- setPressed(false);
-}
-
-void QQuickSlider::mirrorChange()
-{
- QQuickControl::mirrorChange();
- emit visualPositionChanged();
-}
-
-void QQuickSlider::componentComplete()
-{
- Q_D(QQuickSlider);
- QQuickControl::componentComplete();
- setValue(d->value);
- d->updatePosition();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickSlider::accessibilityActiveChanged(bool active)
-{
- QQuickControl::accessibilityActiveChanged(active);
-
- Q_D(QQuickSlider);
- if (active)
- setAccessibleProperty("pressed", d->pressed);
-}
-
-QAccessible::Role QQuickSlider::accessibleRole() const
-{
- return QAccessible::Slider;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickslider_p.h b/src/templates/qquickslider_p.h
deleted file mode 100644
index 663ad684..00000000
--- a/src/templates/qquickslider_p.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSLIDER_P_H
-#define QQUICKSLIDER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickSliderPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickSlider : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged FINAL)
- Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged FINAL)
- Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged FINAL)
- Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
- Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
- Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
- Q_PROPERTY(SnapMode snapMode READ snapMode WRITE setSnapMode NOTIFY snapModeChanged FINAL)
- Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
- Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
- Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
- Q_PROPERTY(QQuickItem *track READ track WRITE setTrack NOTIFY trackChanged FINAL)
-
-public:
- explicit QQuickSlider(QQuickItem *parent = Q_NULLPTR);
-
- qreal from() const;
- void setFrom(qreal from);
-
- qreal to() const;
- void setTo(qreal to);
-
- qreal value() const;
- void setValue(qreal value);
-
- qreal position() const;
- qreal visualPosition() const;
-
- qreal stepSize() const;
- void setStepSize(qreal step);
-
- enum SnapMode {
- NoSnap,
- SnapAlways,
- SnapOnRelease
- };
- Q_ENUM(SnapMode)
-
- SnapMode snapMode() const;
- void setSnapMode(SnapMode mode);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- Qt::Orientation orientation() const;
- void setOrientation(Qt::Orientation orientation);
-
- QQuickItem *handle() const;
- void setHandle(QQuickItem *handle);
-
- QQuickItem *track() const;
- void setTrack(QQuickItem *track);
-
-public Q_SLOTS:
- void increase();
- void decrease();
-
-Q_SIGNALS:
- void fromChanged();
- void toChanged();
- void valueChanged();
- void positionChanged();
- void visualPositionChanged();
- void stepSizeChanged();
- void snapModeChanged();
- void pressedChanged();
- void orientationChanged();
- void handleChanged();
- 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;
-
-#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickSlider)
- Q_DECLARE_PRIVATE(QQuickSlider)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickSlider)
-
-#endif // QQUICKSLIDER_P_H
diff --git a/src/templates/qquickspinbox.cpp b/src/templates/qquickspinbox.cpp
deleted file mode 100644
index 64c94e7a..00000000
--- a/src/templates/qquickspinbox.cpp
+++ /dev/null
@@ -1,674 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickspinbox_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qguiapplication.h>
-#include <QtGui/qstylehints.h>
-
-#include <QtQml/qqmlinfo.h>
-#include <QtQml/private/qqmllocale_p.h>
-#include <QtQml/private/qqmlengine_p.h>
-
-QT_BEGIN_NAMESPACE
-
-// copied from qabstractbutton.cpp
-static const int AUTO_REPEAT_DELAY = 300;
-static const int AUTO_REPEAT_INTERVAL = 100;
-
-/*!
- \qmltype SpinBox
- \inherits Control
- \instantiates QQuickSpinBox
- \inqmlmodule Qt.labs.controls
- \ingroup input
- \brief A spinbox control.
-
- \image qtlabscontrols-spinbox.png
-
- SpinBox allows the user to choose an integer value by clicking the up
- or down indicator buttons, by pressing up or down on the keyboard, or
- by entering a text value in the input field.
-
- By default, SpinBox provides discrete values in the range of \c [0-99]
- with a \l stepSize of \c 1.
-
- \snippet qtlabscontrols-spinbox.qml 1
-
- \section2 Custom Values
-
- \image qtlabscontrols-spinbox-textual.png
-
- Even though SpinBox works on integer values, it can be customized to
- accept arbitrary input values. The following snippet demonstrates how
- \l validator, \l textFromValue and \l valueFromText can be used to
- customize the default behavior.
-
- \snippet qtlabscontrols-spinbox-textual.qml 1
-
- \labs
-
- \sa Tumbler, {Customizing SpinBox}
-*/
-
-class QQuickSpinBoxPrivate : public QQuickControlPrivate
-{
- Q_DECLARE_PUBLIC(QQuickSpinBox)
-
-public:
- QQuickSpinBoxPrivate() : from(0), to(99), value(0), stepSize(1),
- delayTimer(0), repeatTimer(0), up(Q_NULLPTR), down(Q_NULLPTR), validator(Q_NULLPTR) { }
-
- int boundValue(int value) const;
- void updateValue();
-
- int effectiveStepSize() const;
-
- void startRepeatDelay();
- void startPressRepeat();
- void stopPressRepeat();
-
- bool handleMousePressEvent(QQuickItem *child, QMouseEvent *event);
- bool handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event);
- bool handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event);
- bool handleMouseUngrabEvent(QQuickItem *child);
-
- int from;
- int to;
- int value;
- int stepSize;
- int delayTimer;
- int repeatTimer;
- QQuickSpinButton *up;
- QQuickSpinButton *down;
- QValidator *validator;
- mutable QJSValue textFromValue;
- mutable QJSValue valueFromText;
-};
-
-int QQuickSpinBoxPrivate::boundValue(int value) const
-{
- return from > to ? qBound(to, value, from) : qBound(from, value, to);
-}
-
-void QQuickSpinBoxPrivate::updateValue()
-{
- Q_Q(QQuickSpinBox);
- if (contentItem) {
- QVariant text = contentItem->property("text");
- if (text.isValid()) {
- QQmlEngine *engine = qmlEngine(q);
- if (engine) {
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(engine);
- QJSValue loc(v4, QQmlLocale::wrap(v4, locale));
- QJSValue val = q->valueFromText().call(QJSValueList() << text.toString() << loc);
- q->setValue(val.toInt());
- }
- }
- }
-}
-
-int QQuickSpinBoxPrivate::effectiveStepSize() const
-{
- return from > to ? -1 * stepSize : stepSize;
-}
-
-void QQuickSpinBoxPrivate::startRepeatDelay()
-{
- Q_Q(QQuickSpinBox);
- stopPressRepeat();
- delayTimer = q->startTimer(AUTO_REPEAT_DELAY);
-}
-
-void QQuickSpinBoxPrivate::startPressRepeat()
-{
- Q_Q(QQuickSpinBox);
- stopPressRepeat();
- repeatTimer = q->startTimer(AUTO_REPEAT_INTERVAL);
-}
-
-void QQuickSpinBoxPrivate::stopPressRepeat()
-{
- Q_Q(QQuickSpinBox);
- if (delayTimer > 0) {
- q->killTimer(delayTimer);
- delayTimer = 0;
- }
- if (repeatTimer > 0) {
- q->killTimer(repeatTimer);
- repeatTimer = 0;
- }
-}
-
-bool QQuickSpinBoxPrivate::handleMousePressEvent(QQuickItem *child, QMouseEvent *event)
-{
- Q_Q(QQuickSpinBox);
- QQuickItem *ui = up->indicator();
- QQuickItem *di = down->indicator();
- up->setPressed(ui && ui->contains(ui->mapFromItem(child, event->pos())));
- down->setPressed(di && di->contains(di->mapFromItem(child, event->pos())));
-
- bool pressed = up->isPressed() || down->isPressed();
- q->setAccessibleProperty("pressed", pressed);
- if (pressed)
- startRepeatDelay();
- return pressed;
-}
-
-bool QQuickSpinBoxPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event)
-{
- Q_Q(QQuickSpinBox);
- QQuickItem *ui = up->indicator();
- QQuickItem *di = down->indicator();
- up->setPressed(ui && ui->contains(ui->mapFromItem(child, event->pos())));
- down->setPressed(di && di->contains(di->mapFromItem(child, event->pos())));
-
- bool pressed = up->isPressed() || down->isPressed();
- q->setAccessibleProperty("pressed", pressed);
- stopPressRepeat();
- return pressed;
-}
-
-bool QQuickSpinBoxPrivate::handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event)
-{
- Q_Q(QQuickSpinBox);
- QQuickItem *ui = up->indicator();
- QQuickItem *di = down->indicator();
- bool wasPressed = up->isPressed() || down->isPressed();
- if (up->isPressed()) {
- up->setPressed(false);
- if (repeatTimer <= 0 && ui && ui->contains(ui->mapFromItem(child, event->pos())))
- q->increase();
- } else if (down->isPressed()) {
- down->setPressed(false);
- if (repeatTimer <= 0 && di && di->contains(di->mapFromItem(child, event->pos())))
- q->decrease();
- }
-
- q->setAccessibleProperty("pressed", false);
- stopPressRepeat();
- return wasPressed;
-}
-
-bool QQuickSpinBoxPrivate::handleMouseUngrabEvent(QQuickItem *)
-{
- Q_Q(QQuickSpinBox);
- up->setPressed(false);
- down->setPressed(false);
-
- q->setAccessibleProperty("pressed", false);
- stopPressRepeat();
- return false;
-}
-
-QQuickSpinBox::QQuickSpinBox(QQuickItem *parent) :
- QQuickControl(*(new QQuickSpinBoxPrivate), parent)
-{
- Q_D(QQuickSpinBox);
- d->up = new QQuickSpinButton(this);
- d->down = new QQuickSpinButton(this);
-
- setFlag(ItemIsFocusScope);
- setFiltersChildMouseEvents(true);
- setAcceptedMouseButtons(Qt::LeftButton);
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::SpinBox::from
-
- This property holds the starting value for the range. The default value is \c 0.
-
- \sa to, value
-*/
-int QQuickSpinBox::from() const
-{
- Q_D(const QQuickSpinBox);
- return d->from;
-}
-
-void QQuickSpinBox::setFrom(int from)
-{
- Q_D(QQuickSpinBox);
- if (d->from != from) {
- d->from = from;
- emit fromChanged();
- if (isComponentComplete())
- setValue(d->value);
- }
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::SpinBox::to
-
- This property holds the end value for the range. The default value is \c 99.
-
- \sa from, value
-*/
-int QQuickSpinBox::to() const
-{
- Q_D(const QQuickSpinBox);
- return d->to;
-}
-
-void QQuickSpinBox::setTo(int to)
-{
- Q_D(QQuickSpinBox);
- if (d->to != to) {
- d->to = to;
- emit toChanged();
- if (isComponentComplete())
- setValue(d->value);
- }
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::SpinBox::value
-
- This property holds the value in the range \c from - \c to. The default value is \c 0.
-*/
-int QQuickSpinBox::value() const
-{
- Q_D(const QQuickSpinBox);
- return d->value;
-}
-
-void QQuickSpinBox::setValue(int value)
-{
- Q_D(QQuickSpinBox);
- if (isComponentComplete())
- value = d->boundValue(value);
-
- if (d->value != value) {
- d->value = value;
- emit valueChanged();
- }
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::SpinBox::stepSize
-
- This property holds the step size. The default value is \c 1.
-
- \sa increase(), decrease()
-*/
-int QQuickSpinBox::stepSize() const
-{
- Q_D(const QQuickSpinBox);
- return d->stepSize;
-}
-
-void QQuickSpinBox::setStepSize(int step)
-{
- Q_D(QQuickSpinBox);
- if (d->stepSize != step) {
- d->stepSize = step;
- emit stepSizeChanged();
- }
-}
-
-/*!
- \qmlproperty Validator Qt.labs.controls::SpinBox::validator
-
- This property holds the input text validator. By default, SpinBox uses
- \l IntValidator to accept input of integer numbers.
-
- \snippet SpinBox.qml validator
-
- \sa textFromValue, valueFromText, {Control::locale}{locale}
-*/
-QValidator *QQuickSpinBox::validator() const
-{
- Q_D(const QQuickSpinBox);
- return d->validator;
-}
-
-void QQuickSpinBox::setValidator(QValidator *validator)
-{
- Q_D(QQuickSpinBox);
- if (d->validator != validator) {
- d->validator = validator;
- emit validatorChanged();
- }
-}
-
-/*!
- \qmlproperty function Qt.labs.controls::SpinBox::textFromValue
-
- This property holds a callback function that is called whenever
- an integer value needs to be converted to display text.
-
- The callback function signature is \c {string function(value, locale)}.
- The function can have one or two arguments, where the first argument
- is the value to be converted, and the optional second argument is the
- locale that should be used for the conversion, if applicable.
-
- The default implementation does the conversion using \l {QtQml::Locale}{Number.toLocaleString()}:
-
- \code
- textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }
- \endcode
-
- \sa valueFromText, validator, {Control::locale}{locale}
-*/
-QJSValue QQuickSpinBox::textFromValue() const
-{
- Q_D(const QQuickSpinBox);
- if (!d->textFromValue.isCallable()) {
- QQmlEngine *engine = qmlEngine(this);
- if (engine)
- d->textFromValue = engine->evaluate(QStringLiteral("function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }"));
- }
- return d->textFromValue;
-}
-
-void QQuickSpinBox::setTextFromValue(const QJSValue &callback)
-{
- Q_D(QQuickSpinBox);
- if (!callback.isCallable()) {
- qmlInfo(this) << "textFromValue must be a callable function";
- return;
- }
- d->textFromValue = callback;
- emit textFromValueChanged();
-}
-
-/*!
- \qmlproperty function Qt.labs.controls::SpinBox::valueFromText
-
- This property holds a callback function that is called whenever
- input text needs to be converted to an integer value.
-
- The callback function signature is \c {int function(text, locale)}.
- The function can have one or two arguments, where the first argument
- is the text to be converted, and the optional second argument is the
- locale that should be used for the conversion, if applicable.
-
- The default implementation does the conversion using \l {QtQml::Locale}{Number.fromLocaleString()}:
-
- \code
- valueFromText: function(text, locale) { return Number.fromLocaleString(locale, text); }
- \endcode
-
- \sa textFromValue, validator, {Control::locale}{locale}
-*/
-QJSValue QQuickSpinBox::valueFromText() const
-{
- Q_D(const QQuickSpinBox);
- if (!d->valueFromText.isCallable()) {
- QQmlEngine *engine = qmlEngine(this);
- if (engine)
- d->valueFromText = engine->evaluate(QStringLiteral("function(text, locale) { return Number.fromLocaleString(locale, text); }"));
- }
- return d->valueFromText;
-}
-
-void QQuickSpinBox::setValueFromText(const QJSValue &callback)
-{
- Q_D(QQuickSpinBox);
- if (!callback.isCallable()) {
- qmlInfo(this) << "valueFromText must be a callable function";
- return;
- }
- d->valueFromText = callback;
- emit valueFromTextChanged();
-}
-
-/*!
- \qmlpropertygroup Qt.labs.controls::SpinBox::up
- \qmlproperty bool Qt.labs.controls::SpinBox::up.pressed
- \qmlproperty Item Qt.labs.controls::SpinBox::up.indicator
-
- These properties hold the up indicator item and whether it is pressed.
-
- \sa increase()
-*/
-QQuickSpinButton *QQuickSpinBox::up() const
-{
- Q_D(const QQuickSpinBox);
- return d->up;
-}
-
-/*!
- \qmlpropertygroup Qt.labs.controls::SpinBox::down
- \qmlproperty bool Qt.labs.controls::SpinBox::down.pressed
- \qmlproperty Item Qt.labs.controls::SpinBox::down.indicator
-
- These properties hold the down indicator item and whether it is pressed.
-
- \sa decrease()
-*/
-QQuickSpinButton *QQuickSpinBox::down() const
-{
- Q_D(const QQuickSpinBox);
- return d->down;
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::SpinBox::increase()
-
- Increases the value by \l stepSize.
-
- \sa stepSize
-*/
-void QQuickSpinBox::increase()
-{
- Q_D(QQuickSpinBox);
- setValue(d->value + d->effectiveStepSize());
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::SpinBox::decrease()
-
- Decreases the value by \l stepSize.
-
- \sa stepSize
-*/
-void QQuickSpinBox::decrease()
-{
- Q_D(QQuickSpinBox);
- setValue(d->value - d->effectiveStepSize());
-}
-
-void QQuickSpinBox::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::keyPressEvent(event);
-
- switch (event->key()) {
- case Qt::Key_Up:
- increase();
- d->up->setPressed(true);
- event->accept();
- break;
-
- case Qt::Key_Down:
- decrease();
- d->down->setPressed(true);
- event->accept();
- break;
-
- default:
- break;
- }
-
- setAccessibleProperty("pressed", d->up->isPressed() || d->down->isPressed());
-}
-
-void QQuickSpinBox::keyReleaseEvent(QKeyEvent *event)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::keyReleaseEvent(event);
-
- if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
- d->updateValue();
-
- d->up->setPressed(false);
- d->down->setPressed(false);
- setAccessibleProperty("pressed", false);
-}
-
-bool QQuickSpinBox::childMouseEventFilter(QQuickItem *child, QEvent *event)
-{
- Q_D(QQuickSpinBox);
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::MouseMove:
- return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::MouseButtonRelease:
- return d->handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::UngrabMouse:
- return d->handleMouseUngrabEvent(child);
- default:
- return false;
- }
-}
-
-void QQuickSpinBox::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::mousePressEvent(event);
- d->handleMousePressEvent(this, event);
-}
-
-void QQuickSpinBox::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::mouseMoveEvent(event);
- d->handleMouseMoveEvent(this, event);
-}
-
-void QQuickSpinBox::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::mouseReleaseEvent(event);
- d->handleMouseReleaseEvent(this, event);
-}
-
-void QQuickSpinBox::mouseUngrabEvent()
-{
- Q_D(QQuickSpinBox);
- QQuickControl::mouseUngrabEvent();
- d->handleMouseUngrabEvent(this);
-}
-
-void QQuickSpinBox::timerEvent(QTimerEvent *event)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::timerEvent(event);
- if (event->timerId() == d->delayTimer) {
- d->startPressRepeat();
- } else if (event->timerId() == d->repeatTimer) {
- if (d->up->isPressed())
- increase();
- else if (d->down->isPressed())
- decrease();
- }
-}
-
-void QQuickSpinBox::itemChange(ItemChange change, const ItemChangeData &value)
-{
- Q_D(QQuickSpinBox);
- QQuickControl::itemChange(change, value);
- if (change == ItemActiveFocusHasChanged && !value.boolValue)
- d->updateValue();
-}
-
-void QQuickSpinBox::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_UNUSED(oldItem);
- if (newItem)
- newItem->setActiveFocusOnTab(true);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickSpinBox::accessibleRole() const
-{
- return QAccessible::SpinBox;
-}
-#endif
-
-class QQuickSpinButtonPrivate : public QObjectPrivate
-{
-public:
- QQuickSpinButtonPrivate() : pressed(false), indicator(Q_NULLPTR) { }
- bool pressed;
- QQuickItem *indicator;
-};
-
-QQuickSpinButton::QQuickSpinButton(QQuickSpinBox *parent) :
- QObject(*(new QQuickSpinButtonPrivate), parent)
-{
-}
-
-bool QQuickSpinButton::isPressed() const
-{
- Q_D(const QQuickSpinButton);
- return d->pressed;
-}
-
-void QQuickSpinButton::setPressed(bool pressed)
-{
- Q_D(QQuickSpinButton);
- if (d->pressed != pressed) {
- d->pressed = pressed;
- emit pressedChanged();
- }
-}
-
-QQuickItem *QQuickSpinButton::indicator() const
-{
- Q_D(const QQuickSpinButton);
- return d->indicator;
-}
-
-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();
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickspinbox_p.h b/src/templates/qquickspinbox_p.h
deleted file mode 100644
index c7d1f6c6..00000000
--- a/src/templates/qquickspinbox_p.h
+++ /dev/null
@@ -1,164 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSPINBOX_P_H
-#define QQUICKSPINBOX_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtQml/qjsvalue.h>
-
-QT_BEGIN_NAMESPACE
-
-class QValidator;
-class QQuickSpinButton;
-class QQuickSpinButtonPrivate;
-class QQuickSpinBoxPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickSpinBox : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(int from READ from WRITE setFrom NOTIFY fromChanged FINAL)
- Q_PROPERTY(int to READ to WRITE setTo NOTIFY toChanged FINAL)
- Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged FINAL)
- Q_PROPERTY(int stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
- Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL)
- Q_PROPERTY(QJSValue textFromValue READ textFromValue WRITE setTextFromValue NOTIFY textFromValueChanged FINAL)
- Q_PROPERTY(QJSValue valueFromText READ valueFromText WRITE setValueFromText NOTIFY valueFromTextChanged FINAL)
- Q_PROPERTY(QQuickSpinButton *up READ up CONSTANT FINAL)
- Q_PROPERTY(QQuickSpinButton *down READ down CONSTANT FINAL)
-
-public:
- explicit QQuickSpinBox(QQuickItem *parent = Q_NULLPTR);
-
- int from() const;
- void setFrom(int from);
-
- int to() const;
- void setTo(int to);
-
- int value() const;
- void setValue(int value);
-
- int stepSize() const;
- void setStepSize(int step);
-
- QValidator *validator() const;
- void setValidator(QValidator *validator);
-
- QJSValue textFromValue() const;
- void setTextFromValue(const QJSValue &callback);
-
- QJSValue valueFromText() const;
- void setValueFromText(const QJSValue &callback);
-
- QQuickSpinButton *up() const;
- QQuickSpinButton *down() const;
-
-public Q_SLOTS:
- void increase();
- void decrease();
-
-Q_SIGNALS:
- void fromChanged();
- void toChanged();
- void valueChanged();
- void stepSizeChanged();
- void validatorChanged();
- void textFromValueChanged();
- 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;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickSpinBox)
- Q_DECLARE_PRIVATE(QQuickSpinBox)
-};
-
-class Q_LABSTEMPLATES_EXPORT QQuickSpinButton : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
- Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
-
-public:
- explicit QQuickSpinButton(QQuickSpinBox *parent);
-
- bool isPressed() const;
- void setPressed(bool pressed);
-
- QQuickItem *indicator() const;
- void setIndicator(QQuickItem *indicator);
-
-Q_SIGNALS:
- void pressedChanged();
- void indicatorChanged();
-
-private:
- Q_DISABLE_COPY(QQuickSpinButton)
- Q_DECLARE_PRIVATE(QQuickSpinButton)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickSpinBox)
-
-#endif // QQUICKSPINBOX_P_H
diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp
deleted file mode 100644
index bfa01e72..00000000
--- a/src/templates/qquickstackview.cpp
+++ /dev/null
@@ -1,983 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickstackview_p.h"
-#include "qquickstackview_p_p.h"
-
-#include <QtQml/qjsvalue.h>
-#include <QtQml/qqmlengine.h>
-#include <QtQml/qqmlinfo.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype StackView
- \inherits Control
- \instantiates QQuickStackView
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-navigation
- \ingroup qtlabscontrols-containers
- \brief Provides a stack-based navigation model.
-
- \image qtlabscontrols-stackview-wireframe.png
-
- StackView can be used with a set of inter-linked information pages. For
- example, an email application with separate views to list latest emails,
- view a specific email, and list/view the attachments. The email list view
- is pushed onto the stack as users open an email, and popped out as they
- choose to go back.
-
- The following snippet demonstrates a simple use case, where the \c mainView
- is pushed onto and popped out of the stack on relevant button click:
-
- \qml
- ApplicationWindow {
- title: qsTr("Hello World")
- width: 640
- height: 480
- visible: true
-
- StackView {
- id: stack
- initialItem: mainView
- anchors.fill: parent
- }
-
- Component {
- id: mainView
-
- Row {
- spacing: 10
-
- Button {
- text: "Push"
- onClicked: stack.push(mainView)
- }
- Button {
- text: "Pop"
- enabled: stack.depth > 1
- onClicked: stack.pop()
-
- }
- Text {
- text: stack.depth
- }
- }
- }
- }
- \endqml
-
- \section1 Using StackView in an Application
-
- Using StackView in an application is as simple as adding it as a child to
- a Window. The stack is usually anchored to the edges of the window, except
- at the top or bottom where it might be anchored to a status bar, or some
- other similar UI component. The stack can then be used by invoking its
- navigation methods. The first item to show in the StackView is the one
- that was assigned to \l initialItem, or the topmost item if \l initialItem
- is not set.
-
- \section1 Basic Navigation
-
- StackView supports three primary navigation operations: push(), pop(), and
- replace(). These correspond to classic stack operations where "push" adds
- an item to the top of a stack, "pop" removes the top item from the
- stack, and "replace" is like a pop followed by a push, which replaces the
- topmost item with the new item. The topmost item in the stack
- corresponds to the one that is \l{StackView::currentItem}{currently}
- visible on screen. Logically, "push" navigates forward or deeper into the
- application UI, "pop" navigates backward, and "replace" replaces the
- \l currentItem.
-
- Sometimes, it is necessary to go back more than a single step in the stack.
- For example, to return to a "main" item or some kind of section item in the
- application. In such cases, it is possible to specify an item as a
- parameter for pop(). This is called an "unwind" operation, where the stack
- unwinds till the specified item. If the item is not found, stack unwinds
- until it is left with one item, which becomes the \l currentItem. To
- explicitly unwind to the bottom of the stack, it is recommended to use
- \l{pop()}{pop(null)}, although any non-existent item will do.
-
- Given the stack [A, B, C]:
-
- \list
- \li \l{push()}{push(D)} => [A, B, C, D] - "push" transition animation
- between C and D
- \li pop() => [A, B] - "pop" transition animation between C and B
- \li \l{replace()}{replace(D)} => [A, B, D] - "replace" transition between
- C and D
- \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A
- \endlist
-
- \note When the stack is empty, a push() operation will not have a
- transition animation because there is nothing to transition from (typically
- on application start-up). A pop() operation on a stack with depth 1 or
- 0 does nothing. In such cases, the stack can be emptied using the clear()
- method.
-
- \section1 Deep Linking
-
- \e{Deep linking} means launching an application into a particular state. For
- example, a newspaper application could be launched into showing a
- particular article, bypassing the topmost item. In terms of StackView, deep linking means the ability to modify
- the state of the stack, so much so that it is possible to push a set of
- items to the top of the stack, or to completely reset the stack to a given
- state.
-
- The API for deep linking in StackView is the same as for basic navigation.
- Pushing an array instead of a single item adds all the items in that array
- to the stack. The transition animation, however, is applied only for the
- last item in the array. The normal semantics of push() apply for deep
- linking, that is, it adds whatever is pushed onto the stack.
-
- \note Only the last item of the array is loaded. The rest of the items are
- loaded only when needed, either on subsequent calls to pop or on request to
- get an item using get().
-
- This gives us the following result, given the stack [A, B, C]:
-
- \list
- \li \l{push()}{push([D, E, F])} => [A, B, C, D, E, F] - "push" transition
- animation between C and F
- \li \l{replace()}{replace([D, E, F])} => [A, B, D, E, F] - "replace"
- transition animation between C and F
- \li \l{clear()} followed by \l{push()}{push([D, E, F])} => [D, E, F] - no
- transition animation for pushing items as the stack was empty.
- \endlist
-
- \section1 Finding Items
-
- An Item for which the application does not have a reference can be found
- by calling find(). The method needs a callback function, which is invoked
- for each item in the stack (starting at the top) until a match is found.
- If the callback returns \c true, find() stops and returns the matching
- item, otherwise \c null is returned.
-
- The code below searches the stack for an item named "order_id" and unwinds
- to that item.
-
- \badcode
- stackView.pop(stackView.find(function(item) {
- return item.name == "order_id";
- }));
- \endcode
-
- You can also get to an item in the stack using \l {get()}{get(index)}.
-
- \badcode
- previousItem = stackView.get(myItem.StackView.index - 1));
- \endcode
-
- \section1 Transitions
-
- For each push or pop operation, different transition animations are applied
- to entering and exiting items. These animations define how the entering item
- should animate in, and the exiting item should animate out. The animations
- can be customized by assigning different \l{Transition}s for the
- \l pushEnter, \l pushExit, \l popEnter, \l popExit, \l replaceEnter, and
- \l replaceExit properties of StackView.
-
- \note The transition animations affect each others' transitional behavior.
- Customizing the animation for one and leaving the other may give unexpected
- results.
-
- The following snippet defines a simple fade transition for push and pop
- operations:
-
- \qml
- StackView {
- id: stackview
- anchors.fill: parent
-
- pushEnter: Transition {
- PropertyAnimation {
- property: "opacity"
- from: 0
- to:1
- duration: 200
- }
- }
- pushExit: Transition {
- PropertyAnimation {
- property: "opacity"
- from: 1
- to:0
- duration: 200
- }
- }
- popEnter: Transition {
- PropertyAnimation {
- property: "opacity"
- from: 0
- to:1
- duration: 200
- }
- }
- popExit: Transition {
- PropertyAnimation {
- property: "opacity"
- from: 1
- to:0
- duration: 200
- }
- }
- }
- \endqml
-
- \note Using anchors on the items added to a StackView is not supported.
- Typically push, pop, and replace transitions animate the position,
- which is not possible when anchors are applied. Notice that this
- only applies to the root of the item. Using anchors for its children
- works as expected.
-
- \labs
-
- \sa {Customizing StackView}, {Navigation Controls}, {Container Controls}
-*/
-
-QQuickStackView::QQuickStackView(QQuickItem *parent) :
- QQuickControl(*(new QQuickStackViewPrivate), parent)
-{
- setFlag(ItemIsFocusScope);
-}
-
-QQuickStackView::~QQuickStackView()
-{
- Q_D(QQuickStackView);
- if (d->transitioner) {
- d->transitioner->setChangeListener(Q_NULLPTR);
- delete d->transitioner;
- }
- qDeleteAll(d->removals);
- qDeleteAll(d->elements);
-}
-
-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 new QQuickStackAttached(item);
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::StackView::busy
- \readonly
- This property holds whether a transition is running.
-*/
-bool QQuickStackView::isBusy() const
-{
- Q_D(const QQuickStackView);
- return d->busy;
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::StackView::depth
- \readonly
- This property holds the number of items currently pushed onto the stack.
-*/
-int QQuickStackView::depth() const
-{
- Q_D(const QQuickStackView);
- return d->elements.count();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::StackView::currentItem
- \readonly
- This property holds the current top-most item in the stack.
-*/
-QQuickItem *QQuickStackView::currentItem() const
-{
- Q_D(const QQuickStackView);
- return d->currentItem;
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::StackView::get(index, behavior)
-
- Returns the item at position \a index in the stack, or \c null if the index
- is out of bounds.
-
- Supported behavior values:
- \value StackView.DontLoad The item is not forced to load (and \c null is returned if not yet loaded).
- \value StackView.ForceLoad The item is forced to load.
-*/
-QQuickItem *QQuickStackView::get(int index, LoadBehavior behavior)
-{
- Q_D(QQuickStackView);
- QQuickStackElement *element = d->elements.value(index);
- if (element) {
- if (behavior == ForceLoad)
- element->load(this);
- return element->item;
- }
- return Q_NULLPTR;
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::StackView::find(callback, behavior)
-
- Search for a specific item inside the stack. The \a callback function is called
- for each item in the stack (with the item and index as arguments) until the callback
- function returns \c true. The return value is the item found. For example:
-
- \code
- stackView.find(function(item, index) {
- return item.isTheOne
- })
- \endcode
-
- Supported behavior values:
- \value StackView.DontLoad Unloaded items are skipped (the callback function is not called for them).
- \value StackView.ForceLoad Unloaded items are forced to load.
-*/
-QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavior)
-{
- Q_D(QQuickStackView);
- QJSValue func(callback);
- QQmlEngine *engine = qmlEngine(this);
- if (!engine || !func.isCallable()) // TODO: warning?
- return Q_NULLPTR;
-
- for (int i = d->elements.count() - 1; i >= 0; --i) {
- QQuickStackElement *element = d->elements.at(i);
- if (behavior == ForceLoad)
- element->load(this);
- if (element->item) {
- QJSValue rv = func.call(QJSValueList() << engine->newQObject(element->item) << i);
- if (rv.toBool())
- return element->item;
- }
- }
-
- return Q_NULLPTR;
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::StackView::push(item, properties, operation)
-
- Pushes an \a item onto the stack using the specified \a operation, and
- optionally applies a set of \a properties on the item. The item can be
- an \l Item, \l Component, or a \l [QML] url. Returns the item that became
- current.
-
- Pushing a single item:
- \code
- stackView.push(rect)
-
- // or with properties:
- stackView.push(rect, {"color": "red"})
- \endcode
-
- Multiple items can be pushed at the same time either by passing them as
- additional arguments, or as an array. The last item becomes the current
- item. Each item can be followed by a set of properties to apply.
-
- Passing a variable amount of arguments:
- \code
- stackView.push(rect1, rect2, rect3)
-
- // or with properties:
- stackView.push(rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"})
- \endcode
-
- Pushing an array of items:
- \code
- stackView.push([rect1, rect2, rect3])
-
- // or with properties:
- stackView.push([rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"}])
- \endcode
-
- An \a operation can be optionally specified as the last argument. Supported
- operations:
-
- \value StackView.Transition An operation with transitions.
- \value StackView.Immediate An immediate operation without transitions.
-
- \sa initialItem
-*/
-void QQuickStackView::push(QQmlV4Function *args)
-{
- Q_D(QQuickStackView);
- if (args->length() <= 0) {
- qmlInfo(this) << "push: missing arguments";
- args->setReturnValue(QV4::Encode::null());
- return;
- }
-
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
-
- Operation operation = d->elements.isEmpty() ? Immediate : Transition;
- QV4::ScopedValue lastArg(scope, (*args)[args->length() - 1]);
- if (lastArg->isInt32())
- operation = static_cast<Operation>(lastArg->toInt32());
-
- QList<QQuickStackElement *> elements = d->parseElements(args);
- if (elements.isEmpty()) {
- qmlInfo(this) << "push: nothing to push";
- args->setReturnValue(QV4::Encode::null());
- return;
- }
-
- QQuickStackElement *exit = Q_NULLPTR;
- if (!d->elements.isEmpty())
- exit = d->elements.top();
-
- if (d->pushElements(elements)) {
- emit depthChanged();
- QQuickStackElement *enter = d->elements.top();
- d->pushTransition(enter, exit, boundingRect(), operation == Immediate);
- d->setCurrentItem(enter->item);
- }
-
- if (d->currentItem) {
- QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, d->currentItem));
- args->setReturnValue(rv->asReturnedValue());
- } else {
- args->setReturnValue(QV4::Encode::null());
- }
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::StackView::pop(item, operation)
-
- Pops one or more items off the stack. Returns the last item removed from the stack.
-
- If the \a item argument is specified, all items down to (but not
- including) \a item will be popped. If \a item is \c null, all
- items down to (but not including) the first item is popped.
- If not specified, only the current item is popped.
-
- An \a operation can be optionally specified as the last argument. Supported
- operations:
-
- \value StackView.Transition An operation with transitions.
- \value StackView.Immediate An immediate operation without transitions.
-
- Examples:
- \code
- stackView.pop()
- stackView.pop(someItem, StackView.Immediate)
- stackView.pop(StackView.Immediate)
- stackView.pop(null)
- \endcode
-
- \sa clear()
-*/
-void QQuickStackView::pop(QQmlV4Function *args)
-{
- Q_D(QQuickStackView);
- int argc = args->length();
- if (d->elements.count() <= 1 || argc > 2) {
- if (argc > 2)
- qmlInfo(this) << "pop: too many arguments";
- args->setReturnValue(QV4::Encode::null());
- return;
- }
-
- QQuickStackElement *exit = d->elements.pop();
- QQuickStackElement *enter = d->elements.top();
-
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
-
- if (argc > 0) {
- QV4::ScopedValue value(scope, (*args)[0]);
- if (value->isNull()) {
- enter = d->elements.value(0);
- } else if (!value->isUndefined() && !value->isInt32()) {
- enter = d->findElement(value);
- if (!enter) {
- qmlInfo(this) << "pop: unknown argument: " << value->toQString(); // TODO: safe?
- args->setReturnValue(QV4::Encode::null());
- d->elements.push(exit); // restore
- return;
- }
- }
- }
-
- Operation operation = Transition;
- if (argc > 0) {
- QV4::ScopedValue lastArg(scope, (*args)[argc - 1]);
- if (lastArg->isInt32())
- operation = static_cast<Operation>(lastArg->toInt32());
- }
-
- QQuickItem *previousItem = Q_NULLPTR;
-
- if (d->popElements(enter)) {
- if (exit)
- previousItem = exit->item;
- emit depthChanged();
- d->popTransition(enter, exit, boundingRect(), operation == Immediate);
- d->setCurrentItem(enter->item);
- }
-
- if (previousItem) {
- QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, previousItem));
- args->setReturnValue(rv->asReturnedValue());
- } else {
- args->setReturnValue(QV4::Encode::null());
- }
-}
-
-/*!
- \qmlmethod Item Qt.labs.controls::StackView::replace(target, item, properties, operation)
-
- Replaces one or more items on the stack with the specified \a item and
- \a operation, and optionally applies a set of \a properties on the
- item. The item can be an \l Item, \l Component, or a \l [QML] url.
- Returns the item that became current.
-
- If the \a target argument is specified, all items down to the \target
- item will be replaced. If \a target is \c null, all items in the stack
- will be replaced. If not specified, only the top item will be replaced.
-
- Replace the top item:
- \code
- stackView.replace(rect)
-
- // or with properties:
- stackView.replace(rect, {"color": "red"})
- \endcode
-
- Multiple items can be replaced at the same time either by passing them as
- additional arguments, or as an array. Each item can be followed by a set
- of properties to apply.
-
- Passing a variable amount of arguments:
- \code
- stackView.replace(rect1, rect2, rect3)
-
- // or with properties:
- stackView.replace(rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"})
- \endcode
-
- Replacing an array of items:
- \code
- stackView.replace([rect1, rect2, rect3])
-
- // or with properties:
- stackView.replace([rect1, {"color": "red"}, rect2, {"color": "green"}, rect3, {"color": "blue"}])
- \endcode
-
- An \a operation can be optionally specified as the last argument. Supported
- operations:
-
- \value StackView.Transition An operation with transitions.
- \value StackView.Immediate An immediate operation without transitions.
-
- \sa push()
-*/
-void QQuickStackView::replace(QQmlV4Function *args)
-{
- Q_D(QQuickStackView);
- if (args->length() <= 0) {
- qmlInfo(this) << "replace: missing arguments";
- args->setReturnValue(QV4::Encode::null());
- return;
- }
-
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
-
- Operation operation = d->elements.isEmpty() ? Immediate : Transition;
- QV4::ScopedValue lastArg(scope, (*args)[args->length() - 1]);
- if (lastArg->isInt32())
- operation = static_cast<Operation>(lastArg->toInt32());
-
- QQuickStackElement *target = Q_NULLPTR;
- QV4::ScopedValue firstArg(scope, (*args)[0]);
- if (firstArg->isNull())
- target = d->elements.value(0);
- else if (!firstArg->isInt32())
- target = d->findElement(firstArg);
-
- QList<QQuickStackElement *> elements = d->parseElements(args, target ? 1 : 0);
- if (elements.isEmpty()) {
- qmlInfo(this) << "replace: nothing to push";
- args->setReturnValue(QV4::Encode::null());
- return;
- }
-
- int depth = d->elements.count();
- QQuickStackElement* exit = Q_NULLPTR;
- if (!d->elements.isEmpty())
- exit = d->elements.pop();
-
- if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) {
- if (depth != d->elements.count())
- emit depthChanged();
- QQuickStackElement *enter = d->elements.top();
- d->replaceTransition(enter, exit, boundingRect(), operation == Immediate);
- d->setCurrentItem(enter->item);
- }
-
- if (d->currentItem) {
- QV4::ScopedValue rv(scope, QV4::QObjectWrapper::wrap(v4, d->currentItem));
- args->setReturnValue(rv->asReturnedValue());
- } else {
- args->setReturnValue(QV4::Encode::null());
- }
-}
-
-/*!
- \qmlmethod void Qt.labs.controls::StackView::clear()
-
- Removes all items from the stack. No animations are applied.
-*/
-void QQuickStackView::clear()
-{
- Q_D(QQuickStackView);
- d->setCurrentItem(Q_NULLPTR);
- qDeleteAll(d->elements);
- d->elements.clear();
- emit depthChanged();
-}
-
-/*!
- \qmlproperty var Qt.labs.controls::StackView::initialItem
-
- This property holds the initial item that should be shown when the StackView
- is created. The initial item can be an \l Item, \l Component, or a \l [QML] url.
- Specifying an initial item is equivalent to:
- \code
- Component.onCompleted: stackView.push(myInitialItem)
- \endcode
-
- \sa push()
-*/
-QVariant QQuickStackView::initialItem() const
-{
- Q_D(const QQuickStackView);
- return d->initialItem;
-}
-
-void QQuickStackView::setInitialItem(const QVariant &item)
-{
- Q_D(QQuickStackView);
- d->initialItem = item;
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::StackView::popEnter
-
- This property holds the transition that is applied to the item that
- enters the stack when another item is popped off of it.
-
- \sa {Customizing StackView}
-*/
-QQuickTransition *QQuickStackView::popEnter() const
-{
- Q_D(const QQuickStackView);
- if (d->transitioner)
- return d->transitioner->removeDisplacedTransition;
- return Q_NULLPTR;
-}
-
-void QQuickStackView::setPopEnter(QQuickTransition *enter)
-{
- Q_D(QQuickStackView);
- d->ensureTransitioner();
- if (d->transitioner->removeDisplacedTransition != enter) {
- d->transitioner->removeDisplacedTransition = enter;
- emit popEnterChanged();
- }
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::StackView::popExit
-
- This property holds the transition that is applied to the item that
- exits the stack when the item is popped off of it.
-
- \sa {Customizing StackView}
-*/
-QQuickTransition *QQuickStackView::popExit() const
-{
- Q_D(const QQuickStackView);
- if (d->transitioner)
- return d->transitioner->removeTransition;
- return Q_NULLPTR;
-}
-
-void QQuickStackView::setPopExit(QQuickTransition *exit)
-{
- Q_D(QQuickStackView);
- d->ensureTransitioner();
- if (d->transitioner->removeTransition != exit) {
- d->transitioner->removeTransition = exit;
- emit popExitChanged();
- }
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::StackView::pushEnter
-
- This property holds the transition that is applied to the item that
- enters the stack when the item is pushed onto it.
-
- \sa {Customizing StackView}
-*/
-QQuickTransition *QQuickStackView::pushEnter() const
-{
- Q_D(const QQuickStackView);
- if (d->transitioner)
- return d->transitioner->addTransition;
- return Q_NULLPTR;
-}
-
-void QQuickStackView::setPushEnter(QQuickTransition *enter)
-{
- Q_D(QQuickStackView);
- d->ensureTransitioner();
- if (d->transitioner->addTransition != enter) {
- d->transitioner->addTransition = enter;
- emit pushEnterChanged();
- }
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::StackView::pushExit
-
- This property holds the transition that is applied to the item that
- exits the stack when another item is pushed onto it.
-
- \sa {Customizing StackView}
-*/
-QQuickTransition *QQuickStackView::pushExit() const
-{
- Q_D(const QQuickStackView);
- if (d->transitioner)
- return d->transitioner->addDisplacedTransition;
- return Q_NULLPTR;
-}
-
-void QQuickStackView::setPushExit(QQuickTransition *exit)
-{
- Q_D(QQuickStackView);
- d->ensureTransitioner();
- if (d->transitioner->addDisplacedTransition != exit) {
- d->transitioner->addDisplacedTransition = exit;
- emit pushExitChanged();
- }
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::StackView::replaceEnter
-
- This property holds the transition that is applied to the item that
- enters the stack when another item is replaced by it.
-
- \sa {Customizing StackView}
-*/
-QQuickTransition *QQuickStackView::replaceEnter() const
-{
- Q_D(const QQuickStackView);
- if (d->transitioner)
- return d->transitioner->moveTransition;
- return Q_NULLPTR;
-}
-
-void QQuickStackView::setReplaceEnter(QQuickTransition *enter)
-{
- Q_D(QQuickStackView);
- d->ensureTransitioner();
- if (d->transitioner->moveTransition != enter) {
- d->transitioner->moveTransition = enter;
- emit replaceEnterChanged();
- }
-}
-
-/*!
- \qmlproperty Transition Qt.labs.controls::StackView::replaceExit
-
- This property holds the transition that is applied to the item that
- exits the stack when it is replaced by another item.
-
- \sa {Customizing StackView}
-*/
-QQuickTransition *QQuickStackView::replaceExit() const
-{
- Q_D(const QQuickStackView);
- if (d->transitioner)
- return d->transitioner->moveDisplacedTransition;
- return Q_NULLPTR;
-}
-
-void QQuickStackView::setReplaceExit(QQuickTransition *exit)
-{
- Q_D(QQuickStackView);
- d->ensureTransitioner();
- if (d->transitioner->moveDisplacedTransition != exit) {
- d->transitioner->moveDisplacedTransition = exit;
- emit replaceExitChanged();
- }
-}
-
-void QQuickStackView::componentComplete()
-{
- QQuickControl::componentComplete();
-
- Q_D(QQuickStackView);
- QQuickStackElement *element = Q_NULLPTR;
- if (QObject *o = d->initialItem.value<QObject *>())
- element = QQuickStackElement::fromObject(o, this);
- else if (d->initialItem.canConvert<QString>())
- element = QQuickStackElement::fromString(d->initialItem.toString(), this);
- if (d->pushElement(element)) {
- emit depthChanged();
- d->setCurrentItem(element->item);
- element->setStatus(QQuickStackView::Active);
- }
-}
-
-void QQuickStackView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
-
- Q_D(QQuickStackView);
- foreach (QQuickStackElement *element, d->elements) {
- if (element->item) {
- if (!element->widthValid)
- element->item->setWidth(newGeometry.width());
- if (!element->heightValid)
- element->item->setHeight(newGeometry.height());
- }
- }
-}
-
-bool QQuickStackView::childMouseEventFilter(QQuickItem *item, QEvent *event)
-{
- // in order to block accidental user interaction while busy/transitioning,
- // StackView filters out childrens' mouse events. therefore we block all
- // press events. however, since push() may be called from signal handlers
- // such as onPressed or onDoubleClicked, we must let the current mouse
- // grabber item receive the respective mouse release event to avoid
- // breaking its state (QTBUG-50305).
- if (event->type() == QEvent::MouseButtonPress)
- return true;
- QQuickWindow *window = item->window();
- return window && !window->mouseGrabberItem();
-}
-
-void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
-{
- Q_Q(QQuickStackAttached);
- int oldIndex = element ? element->index : -1;
- QQuickStackView *oldView = element ? element->view : Q_NULLPTR;
- QQuickStackView::Status oldStatus = element ? element->status : QQuickStackView::Inactive;
-
- QQuickStackView *newView = qobject_cast<QQuickStackView *>(parent);
- element = newView ? QQuickStackViewPrivate::get(newView)->findElement(item) : Q_NULLPTR;
-
- int newIndex = element ? element->index : -1;
- QQuickStackView::Status newStatus = element ? element->status : QQuickStackView::Inactive;
-
- if (oldIndex != newIndex)
- emit q->indexChanged();
- if (oldView != newView)
- emit q->viewChanged();
- if (oldStatus != newStatus)
- emit q->statusChanged();
-}
-
-QQuickStackAttached::QQuickStackAttached(QQuickItem *parent) :
- QObject(*(new QQuickStackAttachedPrivate), parent)
-{
- Q_D(QQuickStackAttached);
- QQuickItemPrivate::get(parent)->addItemChangeListener(d, QQuickItemPrivate::Parent);
- d->itemParentChanged(parent, parent->parentItem());
-}
-
-QQuickStackAttached::~QQuickStackAttached()
-{
- Q_D(QQuickStackAttached);
- QQuickItem *parentItem = static_cast<QQuickItem *>(parent());
- QQuickItemPrivate::get(parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Parent);
-}
-
-/*!
- \qmlattachedproperty int Qt.labs.controls::StackView::index
- \readonly
-
- This attached property holds the stack index of the item it's
- attached to, or \c -1 if the item is not in a stack.
-*/
-int QQuickStackAttached::index() const
-{
- Q_D(const QQuickStackAttached);
- return d->element ? d->element->index : -1;
-}
-
-/*!
- \qmlattachedproperty StackView Qt.labs.controls::StackView::view
- \readonly
-
- This attached property holds the stack view of the item it's
- attached to, or \c null if the item is not in a stack.
-*/
-QQuickStackView *QQuickStackAttached::view() const
-{
- Q_D(const QQuickStackAttached);
- return d->element ? d->element->view : Q_NULLPTR;
-}
-
-/*!
- \qmlattachedproperty enumeration Qt.labs.controls::StackView::status
- \readonly
-
- This attached property holds the stack status of the item it's
- attached to, or \c StackView.Inactive if the item is not in a stack.
-
- Available values:
- \value StackView.Inactive The item is inactive (or not in a stack).
- \value StackView.Deactivating The item is being deactivated (popped off).
- \value StackView.Activating The item is being activated (becoming the current item).
- \value StackView.Active The item is active, that is, the current item.
-*/
-QQuickStackView::Status QQuickStackAttached::status() const
-{
- Q_D(const QQuickStackAttached);
- return d->element ? d->element->status : QQuickStackView::Inactive;
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickstackview_p.cpp b/src/templates/qquickstackview_p.cpp
deleted file mode 100644
index 05558a95..00000000
--- a/src/templates/qquickstackview_p.cpp
+++ /dev/null
@@ -1,548 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickstackview_p_p.h"
-
-#include <QtQml/qqmlinfo.h>
-#include <QtQml/qqmllist.h>
-#include <QtQml/qqmlengine.h>
-#include <QtQml/qqmlcomponent.h>
-#include <QtQml/qqmlincubator.h>
-#include <QtQml/private/qqmlcomponent_p.h>
-#include <QtQml/private/qqmlengine_p.h>
-#include <QtQuick/private/qquickanimation_p.h>
-#include <QtQuick/private/qquicktransition_p.h>
-#include <QtQuick/private/qquickitemviewtransition_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static QQuickStackAttached *attachedStackObject(QQuickStackElement *element)
-{
- QQuickStackAttached *attached = qobject_cast<QQuickStackAttached *>(qmlAttachedPropertiesObject<QQuickStackView>(element->item, false));
- if (attached)
- QQuickStackAttachedPrivate::get(attached)->element = element;
- return attached;
-}
-
-class QQuickStackIncubator : public QQmlIncubator
-{
-public:
- QQuickStackIncubator(QQuickStackElement *element) : QQmlIncubator(Synchronous), element(element) { }
-
-protected:
- void setInitialState(QObject *object) Q_DECL_OVERRIDE { element->incubate(object); }
-
-private:
- QQuickStackElement *element;
-};
-
-QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(Q_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),
- status(QQuickStackView::Inactive)
-{
-}
-
-QQuickStackElement::~QQuickStackElement()
-{
- if (item)
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed);
-
- if (ownComponent)
- delete component;
-
- if (item) {
- if (ownItem) {
- item->setParentItem(Q_NULLPTR);
- item->deleteLater();
- item = Q_NULLPTR;
- } else {
- item->setVisible(false);
- if (item->parentItem() != originalParent) {
- item->setParentItem(originalParent);
- } else {
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- QQuickStackAttachedPrivate::get(attached)->itemParentChanged(item, Q_NULLPTR);
- }
- }
- }
-
- delete context;
- delete incubator;
-}
-
-QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickStackView *view)
-{
- QQuickStackElement *element = new QQuickStackElement;
- element->component = new QQmlComponent(qmlEngine(view), QUrl(str), view);
- element->ownComponent = true;
- return element;
-}
-
-QQuickStackElement *QQuickStackElement::fromObject(QObject *object, QQuickStackView *view)
-{
- QQuickStackElement *element = new QQuickStackElement;
- element->component = qobject_cast<QQmlComponent *>(object);
- if (!element->component) {
- element->component = new QQmlComponent(qmlEngine(view), view);
- element->ownComponent = true;
- }
- element->item = qobject_cast<QQuickItem *>(object);
- if (element->item)
- element->originalParent = element->item->parentItem();
- return element;
-}
-
-bool QQuickStackElement::load(QQuickStackView *parent)
-{
- setView(parent);
- if (!item) {
- ownItem = true;
-
- QQmlContext *creationContext = component->creationContext();
- if (!creationContext)
- creationContext = qmlContext(parent);
- context = new QQmlContext(creationContext);
- context->setContextObject(parent);
-
- delete incubator;
- incubator = new QQuickStackIncubator(this);
- component->create(*incubator, context);
- if (component->isError())
- qWarning() << qPrintable(component->errorString().trimmed());
- } else {
- initialize();
- }
- return item;
-}
-
-void QQuickStackElement::incubate(QObject *object)
-{
- item = qmlobject_cast<QQuickItem *>(object);
- if (item) {
- QQmlEngine::setObjectOwnership(item, QQmlEngine::CppOwnership);
- initialize();
- }
-}
-
-void QQuickStackElement::initialize()
-{
- if (!item || init)
- return;
-
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!(widthValid = p->widthValid))
- item->setWidth(view->width());
- if (!(heightValid = p->heightValid))
- item->setHeight(view->height());
- item->setParentItem(view);
- p->addItemChangeListener(this, QQuickItemPrivate::Destroyed);
-
- if (!properties.isUndefined()) {
- QQmlComponentPrivate *d = QQmlComponentPrivate::get(component);
- Q_ASSERT(d && d->engine);
- QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(d->engine);
- Q_ASSERT(v4);
- QV4::Scope scope(v4);
- QV4::ScopedValue ipv(scope, properties.value());
- QV4::Scoped<QV4::QmlContext> qmlContext(scope, qmlCallingContext.value());
- d->initializeObjectWithInitialProperties(qmlContext, ipv, item);
- properties.clear();
- }
-
- init = true;
-}
-
-void QQuickStackElement::setIndex(int value)
-{
- if (index != value) {
- 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();
- }
-}
-
-void QQuickStackElement::setStatus(QQuickStackView::Status value)
-{
- if (status != value) {
- status = value;
- QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->statusChanged();
- }
-}
-
-void QQuickStackElement::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget)
-{
- if (transitioner)
- transitioner->transitionNextReposition(this, type, asTarget);
-}
-
-bool QQuickStackElement::prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds)
-{
- if (transitioner) {
- if (item) {
- QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
- // TODO: expose QQuickAnchorLine so we can test for other conflicting anchors
- if (anchors && (anchors->fill() || anchors->centerIn()))
- qmlInfo(item) << "StackView has detected conflicting anchors. Transitions may not execute properly.";
- }
-
- // TODO: add force argument to QQuickItemViewTransitionableItem::prepareTransition()?
- nextTransitionToSet = true;
- nextTransitionFromSet = true;
- nextTransitionFrom += QPointF(1, 1);
- return QQuickItemViewTransitionableItem::prepareTransition(transitioner, index, viewBounds);
- }
- return false;
-}
-
-void QQuickStackElement::startTransition(QQuickItemViewTransitioner *transitioner)
-{
- if (transitioner)
- QQuickItemViewTransitionableItem::startTransition(transitioner, index);
-}
-
-void QQuickStackElement::itemDestroyed(QQuickItem *)
-{
- item = Q_NULLPTR;
-}
-
-QQuickStackViewPrivate::QQuickStackViewPrivate() : busy(false), currentItem(Q_NULLPTR), transitioner(Q_NULLPTR)
-{
-}
-
-void QQuickStackViewPrivate::setCurrentItem(QQuickItem *item)
-{
- Q_Q(QQuickStackView);
- if (currentItem != item) {
- currentItem = item;
- if (item)
- item->setVisible(true);
- emit q->currentItemChanged();
- }
-}
-
-static bool initProperties(QQuickStackElement *element, const QV4::Value &props, QQmlV4Function *args)
-{
- if (props.isObject()) {
- const QV4::QObjectWrapper *wrapper = props.as<QV4::QObjectWrapper>();
- if (!wrapper) {
- QV4::ExecutionEngine *v4 = args->v4engine();
- element->properties.set(v4, props);
- element->qmlCallingContext.set(v4, v4->qmlContext());
- return true;
- }
- }
- return false;
-}
-
-QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(QQmlV4Function *args, int from)
-{
- QV4::ExecutionEngine *v4 = args->v4engine();
- QV4::Scope scope(v4);
-
- QList<QQuickStackElement *> elements;
-
- int argc = args->length();
- for (int i = from; i < argc; ++i) {
- QV4::ScopedValue arg(scope, (*args)[i]);
- if (QV4::ArrayObject *array = arg->as<QV4::ArrayObject>()) {
- int len = array->getLength();
- for (int j = 0; j < len; ++j) {
- QV4::ScopedValue value(scope, array->getIndexed(j));
- QQuickStackElement *element = createElement(value);
- if (element) {
- if (j < len - 1) {
- QV4::ScopedValue props(scope, array->getIndexed(j + 1));
- if (initProperties(element, props, args))
- ++j;
- }
- elements += element;
- }
- }
- } else {
- QQuickStackElement *element = createElement(arg);
- if (element) {
- if (i < argc - 1) {
- QV4::ScopedValue props(scope, (*args)[i + 1]);
- if (initProperties(element, props, args))
- ++i;
- }
- elements += element;
- }
- }
- }
- return elements;
-}
-
-QQuickStackElement *QQuickStackViewPrivate::findElement(QQuickItem *item) const
-{
- if (item) {
- foreach (QQuickStackElement *e, elements) {
- if (e->item == item)
- return e;
- }
- }
- return Q_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;
-}
-
-QQuickStackElement *QQuickStackViewPrivate::createElement(const QV4::Value &value)
-{
- Q_Q(QQuickStackView);
- if (const QV4::String *s = value.as<QV4::String>())
- return QQuickStackElement::fromString(s->toQString(), q);
- if (const QV4::QObjectWrapper *o = value.as<QV4::QObjectWrapper>())
- return QQuickStackElement::fromObject(o->object(), q);
- return Q_NULLPTR;
-}
-
-bool QQuickStackViewPrivate::pushElements(const QList<QQuickStackElement *> &elems)
-{
- Q_Q(QQuickStackView);
- if (!elems.isEmpty()) {
- foreach (QQuickStackElement *e, elems) {
- e->setIndex(elements.count());
- elements += e;
- }
- return elements.top()->load(q);
- }
- return false;
-}
-
-bool QQuickStackViewPrivate::pushElement(QQuickStackElement *element)
-{
- if (element)
- return pushElements(QList<QQuickStackElement *>() << element);
- return false;
-}
-
-bool QQuickStackViewPrivate::popElements(QQuickStackElement *element)
-{
- Q_Q(QQuickStackView);
- if (elements.count() > 1) {
- while (elements.count() > 1 && elements.top() != element) {
- delete elements.pop();
- if (!element)
- break;
- }
- }
- return elements.top()->load(q);
-}
-
-bool QQuickStackViewPrivate::replaceElements(QQuickStackElement *target, const QList<QQuickStackElement *> &elems)
-{
- if (target) {
- while (!elements.isEmpty()) {
- QQuickStackElement* top = elements.pop();
- delete top;
- if (top == target)
- break;
- }
- }
- return pushElements(elems);
-}
-
-void QQuickStackViewPrivate::ensureTransitioner()
-{
- if (!transitioner) {
- transitioner = new QQuickItemViewTransitioner;
- transitioner->setChangeListener(this);
- }
-}
-
-void QQuickStackViewPrivate::popTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
-{
- ensureTransitioner();
-
- if (exit) {
- exit->removal = true;
- exit->setStatus(QQuickStackView::Deactivating);
- exit->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, true);
- }
- if (enter) {
- enter->setStatus(QQuickStackView::Activating);
- enter->transitionNextReposition(transitioner, QQuickItemViewTransitioner::RemoveTransition, false);
- }
-
- if (exit) {
- if (immediate || !exit->item || !exit->prepareTransition(transitioner, viewBounds))
- completeTransition(exit, transitioner->removeTransition);
- else
- exit->startTransition(transitioner);
- }
- if (enter) {
- if (immediate || !enter->item || !enter->prepareTransition(transitioner, QRectF()))
- completeTransition(enter, transitioner->removeDisplacedTransition);
- else
- enter->startTransition(transitioner);
- }
-
- if (transitioner) {
- setBusy(!transitioner->runningJobs.isEmpty());
- transitioner->resetTargetLists();
- }
-}
-
-void QQuickStackViewPrivate::pushTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
-{
- ensureTransitioner();
-
- if (enter) {
- enter->setStatus(QQuickStackView::Activating);
- enter->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, true);
- }
- if (exit) {
- exit->setStatus(QQuickStackView::Deactivating);
- exit->transitionNextReposition(transitioner, QQuickItemViewTransitioner::AddTransition, false);
- }
-
- if (enter) {
- if (immediate || !enter->item || !enter->prepareTransition(transitioner, viewBounds))
- completeTransition(enter, transitioner->addTransition);
- else
- enter->startTransition(transitioner);
- }
- if (exit) {
- if (immediate || !exit->item || !exit->prepareTransition(transitioner, QRectF()))
- completeTransition(exit, transitioner->addDisplacedTransition);
- else
- exit->startTransition(transitioner);
- }
-
- if (transitioner) {
- setBusy(!transitioner->runningJobs.isEmpty());
- transitioner->resetTargetLists();
- }
-}
-
-void QQuickStackViewPrivate::replaceTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
-{
- ensureTransitioner();
-
- if (exit) {
- exit->removal = true;
- exit->setStatus(QQuickStackView::Deactivating);
- exit->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, false);
- }
- if (enter) {
- enter->setStatus(QQuickStackView::Activating);
- enter->transitionNextReposition(transitioner, QQuickItemViewTransitioner::MoveTransition, true);
- }
-
- if (exit) {
- if (immediate || !exit->item || !exit->prepareTransition(transitioner, QRectF()))
- completeTransition(exit, transitioner->moveDisplacedTransition);
- else
- exit->startTransition(transitioner);
- }
- if (enter) {
- if (immediate || !enter->item || !enter->prepareTransition(transitioner, viewBounds))
- completeTransition(enter, transitioner->moveTransition);
- else
- enter->startTransition(transitioner);
- }
-
- if (transitioner) {
- setBusy(!transitioner->runningJobs.isEmpty());
- transitioner->resetTargetLists();
- }
-}
-
-void QQuickStackViewPrivate::completeTransition(QQuickStackElement *element, QQuickTransition *transition)
-{
- if (transition) {
- // TODO: add a proper way to complete a transition
- QQmlListProperty<QQuickAbstractAnimation> animations = transition->animations();
- int count = animations.count(&animations);
- for (int i = 0; i < count; ++i) {
- QQuickAbstractAnimation *anim = animations.at(&animations, i);
- anim->complete();
- }
- }
- viewItemTransitionFinished(element);
-}
-
-void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransitionableItem *transitionable)
-{
- QQuickStackElement *element = static_cast<QQuickStackElement *>(transitionable);
- if (element->status == QQuickStackView::Activating) {
- element->setStatus(QQuickStackView::Active);
- } else if (element->status == QQuickStackView::Deactivating) {
- element->setStatus(QQuickStackView::Inactive);
- if (element->item)
- element->item->setVisible(false);
- if (element->removal || element->isPendingRemoval())
- removals += element;
- }
-
- if (transitioner->runningJobs.isEmpty()) {
- qDeleteAll(removals);
- removals.clear();
- setBusy(false);
- }
-}
-
-void QQuickStackViewPrivate::setBusy(bool b)
-{
- Q_Q(QQuickStackView);
- if (busy != b) {
- 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
deleted file mode 100644
index 6b78b50a..00000000
--- a/src/templates/qquickstackview_p.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSTACKVIEW_P_H
-#define QQUICKSTACKVIEW_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQmlV4Function;
-class QQuickTransition;
-class QQuickStackElement;
-class QQuickStackAttached;
-class QQuickStackViewPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickStackView : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(bool busy READ isBusy NOTIFY busyChanged FINAL)
- Q_PROPERTY(int depth READ depth NOTIFY depthChanged FINAL)
- Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
- Q_PROPERTY(QVariant initialItem READ initialItem WRITE setInitialItem FINAL)
- Q_PROPERTY(QQuickTransition *popEnter READ popEnter WRITE setPopEnter NOTIFY popEnterChanged FINAL)
- Q_PROPERTY(QQuickTransition *popExit READ popExit WRITE setPopExit NOTIFY popExitChanged FINAL)
- Q_PROPERTY(QQuickTransition *pushEnter READ pushEnter WRITE setPushEnter NOTIFY pushEnterChanged FINAL)
- Q_PROPERTY(QQuickTransition *pushExit READ pushExit WRITE setPushExit NOTIFY pushExitChanged FINAL)
- Q_PROPERTY(QQuickTransition *replaceEnter READ replaceEnter WRITE setReplaceEnter NOTIFY replaceEnterChanged FINAL)
- Q_PROPERTY(QQuickTransition *replaceExit READ replaceExit WRITE setReplaceExit NOTIFY replaceExitChanged FINAL)
-
-public:
- explicit QQuickStackView(QQuickItem *parent = Q_NULLPTR);
- ~QQuickStackView();
-
- static QQuickStackAttached *qmlAttachedProperties(QObject *object);
-
- bool isBusy() const;
- int depth() const;
- QQuickItem *currentItem() const;
-
- enum Status {
- Inactive = 0,
- Deactivating = 1,
- Activating = 2,
- Active = 3
- };
- Q_ENUM(Status)
-
- QVariant initialItem() const;
- void setInitialItem(const QVariant &item);
-
- QQuickTransition *popEnter() const;
- void setPopEnter(QQuickTransition *enter);
-
- QQuickTransition *popExit() const;
- void setPopExit(QQuickTransition *exit);
-
- QQuickTransition *pushEnter() const;
- void setPushEnter(QQuickTransition *enter);
-
- QQuickTransition *pushExit() const;
- void setPushExit(QQuickTransition *exit);
-
- QQuickTransition *replaceEnter() const;
- void setReplaceEnter(QQuickTransition *enter);
-
- QQuickTransition *replaceExit() const;
- void setReplaceExit(QQuickTransition *exit);
-
- enum LoadBehavior {
- DontLoad,
- ForceLoad
- };
- Q_ENUM(LoadBehavior)
-
- Q_INVOKABLE QQuickItem *get(int index, LoadBehavior behavior = DontLoad);
- Q_INVOKABLE QQuickItem *find(const QJSValue &callback, LoadBehavior behavior = DontLoad);
-
- enum Operation {
- Transition,
- Immediate
- };
- Q_ENUM(Operation)
-
- Q_INVOKABLE void push(QQmlV4Function *args);
- Q_INVOKABLE void pop(QQmlV4Function *args);
- Q_INVOKABLE void replace(QQmlV4Function *args);
-
-public Q_SLOTS:
- void clear();
-
-Q_SIGNALS:
- void busyChanged();
- void depthChanged();
- void currentItemChanged();
- void popEnterChanged();
- void popExitChanged();
- void pushEnterChanged();
- void pushExitChanged();
- void replaceEnterChanged();
- 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;
-
-private:
- Q_DISABLE_COPY(QQuickStackView)
- Q_DECLARE_PRIVATE(QQuickStackView)
-};
-
-class QQuickStackAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickStackAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
- Q_PROPERTY(QQuickStackView *view READ view NOTIFY viewChanged FINAL)
- Q_PROPERTY(QQuickStackView::Status status READ status NOTIFY statusChanged FINAL)
-
-public:
- explicit QQuickStackAttached(QQuickItem *parent = Q_NULLPTR);
- ~QQuickStackAttached();
-
- int index() const;
- QQuickStackView *view() const;
- QQuickStackView::Status status() const;
-
-Q_SIGNALS:
- void indexChanged();
- void viewChanged();
- void statusChanged();
-
-private:
- Q_DISABLE_COPY(QQuickStackAttached)
- Q_DECLARE_PRIVATE(QQuickStackAttached)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickStackView)
-QML_DECLARE_TYPEINFO(QQuickStackView, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKSTACKVIEW_P_H
diff --git a/src/templates/qquickstackview_p_p.h b/src/templates/qquickstackview_p_p.h
deleted file mode 100644
index 97cdb109..00000000
--- a/src/templates/qquickstackview_p_p.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSTACKVIEW_P_P_H
-#define QQUICKSTACKVIEW_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickstackview_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-#include <QtQuick/private/qquickitemviewtransition_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
-#include <QtQml/private/qv4persistent_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQmlContext;
-class QQmlComponent;
-class QQmlIncubator;
-
-class QQuickStackElement : public QQuickItemViewTransitionableItem, public QQuickItemChangeListener
-{
- QQuickStackElement();
-
-public:
- ~QQuickStackElement();
-
- static QQuickStackElement *fromString(const QString &str, QQuickStackView *view);
- static QQuickStackElement *fromObject(QObject *object, QQuickStackView *view);
-
- bool load(QQuickStackView *parent);
- void incubate(QObject *object);
- void initialize();
-
- void setIndex(int index);
- void setView(QQuickStackView *view);
- void setStatus(QQuickStackView::Status status);
-
- void transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget);
- bool prepareTransition(QQuickItemViewTransitioner *transitioner, const QRectF &viewBounds);
- void startTransition(QQuickItemViewTransitioner *transitioner);
-
- void itemDestroyed(QQuickItem *item) Q_DECL_OVERRIDE;
-
- int index;
- bool init;
- bool removal;
- bool ownItem;
- bool ownComponent;
- bool widthValid;
- bool heightValid;
- QQmlContext *context;
- QQmlComponent *component;
- QQmlIncubator *incubator;
- QQuickStackView *view;
- QPointer<QQuickItem> originalParent;
- QQuickStackView::Status status;
- QV4::PersistentValue properties;
- QV4::PersistentValue qmlCallingContext;
-};
-
-class QQuickStackViewPrivate : public QQuickControlPrivate, public QQuickItemViewTransitionChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickStackView)
-
-public:
- QQuickStackViewPrivate();
-
- static QQuickStackViewPrivate *get(QQuickStackView *view)
- {
- return view->d_func();
- }
-
- void setCurrentItem(QQuickItem *item);
-
- QList<QQuickStackElement *> parseElements(QQmlV4Function *args, int from = 0);
- QQuickStackElement *findElement(QQuickItem *item) const;
- QQuickStackElement *findElement(const QV4::Value &value) const;
- QQuickStackElement *createElement(const QV4::Value &value);
- bool pushElements(const QList<QQuickStackElement *> &elements);
- bool pushElement(QQuickStackElement *element);
- bool popElements(QQuickStackElement *element);
- bool replaceElements(QQuickStackElement *element, const QList<QQuickStackElement *> &elements);
-
- void ensureTransitioner();
- void popTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate);
- void pushTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate);
- 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 setBusy(bool busy);
-
- bool busy;
- QVariant initialItem;
- QQuickItem *currentItem;
- QList<QQuickStackElement*> removals;
- QStack<QQuickStackElement *> elements;
- QQuickItemViewTransitioner *transitioner;
-};
-
-class QQuickStackAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickStackAttached)
-
-public:
- QQuickStackAttachedPrivate() : element(Q_NULLPTR) { }
-
- static QQuickStackAttachedPrivate *get(QQuickStackAttached *attached)
- {
- return attached->d_func();
- }
-
- void itemParentChanged(QQuickItem *item, QQuickItem *parent);
-
- QQuickStackElement *element;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKSTACKVIEW_P_P_H
diff --git a/src/templates/qquickswipeview.cpp b/src/templates/qquickswipeview.cpp
deleted file mode 100644
index 7698f7cc..00000000
--- a/src/templates/qquickswipeview.cpp
+++ /dev/null
@@ -1,355 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickswipeview_p.h"
-
-#include <QtQml/qqmlinfo.h>
-#include <QtLabsTemplates/private/qquickcontainer_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype SwipeView
- \inherits Container
- \instantiates QQuickSwipeView
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-navigation
- \ingroup qtlabscontrols-containers
- \brief A swipe view control.
-
- SwipeView provides a swipe-based navigation model.
-
- \image qtlabscontrols-swipeview-wireframe.png
-
- SwipeView is populated with a set of pages. One page is visible at a time.
- The user can navigate between the pages by swiping sideways. Notice that
- SwipeView itself is entirely non-visual. It is recommended to combine it
- with PageIndicator, to give the user a visual clue that there are multiple
- pages.
-
- \snippet qtlabscontrols-swipeview-indicator.qml 1
-
- As shown above, SwipeView is typically populated with a static set of
- pages that are defined inline as children of the view. It is also possible
- to \l {Container::addItem()}{add}, \l {Container::insertItem()}{insert},
- \l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove}
- pages dynamically at run time.
-
- \note SwipeView takes over the geometry management of items added to the
- view. Using anchors on the items is not supported, and any \c width
- or \c height assignment will be overridden by the view. Notice that
- this only applies to the root of the item. Specifying width and height,
- or using anchors for its children works as expected.
-
- \labs
-
- \sa TabBar, PageIndicator, {Customizing SwipeView}, {Navigation Controls}, {Container Controls}
-*/
-
-class QQuickSwipeViewPrivate : public QQuickContainerPrivate
-{
- Q_DECLARE_PUBLIC(QQuickSwipeView)
-
-public:
- void resizeItem(QQuickItem *item);
- void resizeItems();
-
- static QQuickSwipeViewPrivate *get(QQuickSwipeView *view);
-};
-
-void QQuickSwipeViewPrivate::resizeItems()
-{
- Q_Q(QQuickSwipeView);
- const int count = q->count();
- for (int i = 0; i < count; ++i) {
- QQuickItem *item = itemAt(i);
- if (item) {
- QQuickAnchors *anchors = QQuickItemPrivate::get(item)->_anchors;
- // TODO: expose QQuickAnchorLine so we can test for other conflicting anchors
- if (anchors && (anchors->fill() || anchors->centerIn()) && !item->property("_q_QQuickSwipeView_warned").toBool()) {
- qmlInfo(item) << "SwipeView has detected conflicting anchors. Unable to layout the item.";
- item->setProperty("_q_QQuickSwipeView_warned", true);
- }
-
- item->setSize(QSizeF(contentItem->width(), contentItem->height()));
- }
- }
-}
-
-QQuickSwipeViewPrivate *QQuickSwipeViewPrivate::get(QQuickSwipeView *view)
-{
- return view->d_func();
-}
-
-QQuickSwipeView::QQuickSwipeView(QQuickItem *parent) :
- QQuickContainer(*(new QQuickSwipeViewPrivate), parent)
-{
- setFlag(ItemIsFocusScope);
- setActiveFocusOnTab(true);
-}
-
-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 new QQuickSwipeViewAttached(item);
-}
-
-void QQuickSwipeView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickSwipeView);
- QQuickContainer::geometryChanged(newGeometry, oldGeometry);
- d->resizeItems();
-}
-
-void QQuickSwipeView::itemAdded(int, QQuickItem *item)
-{
- Q_D(QQuickSwipeView);
- QQuickItemPrivate::get(item)->setCulled(true); // QTBUG-51078, QTBUG-51669
- if (isComponentComplete())
- item->setSize(QSizeF(d->contentItem->width(), d->contentItem->height()));
-}
-
-/*!
- \qmlattachedproperty int Qt.labs.controls::SwipeView::index
- \readonly
-
- This attached property holds the index of each child item in the SwipeView.
-
- It is attached to each child item of the SwipeView.
-*/
-
-/*!
- \qmlattachedproperty bool Qt.labs.controls::SwipeView::isCurrentItem
- \readonly
-
- This attached property is \c true if this child is the current item.
-
- It is attached to each child item of the SwipeView.
-*/
-
-/*!
- \qmlattachedproperty SwipeView Qt.labs.controls::SwipeView::view
- \readonly
-
- This attached property holds the view that manages this child item.
-
- It is attached to each child item of the SwipeView.
-*/
-
-class QQuickSwipeViewAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickSwipeViewAttached)
-public:
- QQuickSwipeViewAttachedPrivate(QQuickItem *item) :
- item(item),
- swipeView(Q_NULLPTR),
- index(-1),
- isCurrent(false)
- {
- }
-
- ~QQuickSwipeViewAttachedPrivate() {
- }
-
- 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 itemDestroyed(QQuickItem *) Q_DECL_OVERRIDE;
-
- void updateIndex();
- void updateIsCurrent();
-
- void setView(QQuickSwipeView *view);
- void setIndex(int i);
- void setIsCurrent(bool current);
-
- QQuickItem *item;
- QQuickSwipeView *swipeView;
- int index;
- // Better to store this so that we don't need to lump its calculation
- // together with index's calculation, as it would otherwise need to know
- // the old index to know if it should emit the change signal.
- bool isCurrent;
-};
-
-void QQuickSwipeViewAttachedPrivate::updateIndex()
-{
- setIndex(swipeView ? QQuickSwipeViewPrivate::get(swipeView)->contentModel->indexOf(item, Q_NULLPTR) : -1);
-}
-
-void QQuickSwipeViewAttachedPrivate::updateIsCurrent()
-{
- setIsCurrent(swipeView ? swipeView->currentIndex() == index : false);
-}
-
-void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
-{
- if (view == swipeView)
- return;
-
- if (swipeView) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(swipeView);
- p->removeItemChangeListener(this, QQuickItemPrivate::Children);
-
- disconnect(swipeView, &QQuickSwipeView::currentIndexChanged,
- this, &QQuickSwipeViewAttachedPrivate::updateIsCurrent);
- disconnect(swipeView, &QQuickSwipeView::contentChildrenChanged,
- this, &QQuickSwipeViewAttachedPrivate::updateIndex);
- }
-
- swipeView = view;
-
- if (swipeView) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(swipeView);
- p->addItemChangeListener(this, QQuickItemPrivate::Children);
-
- connect(swipeView, &QQuickSwipeView::currentIndexChanged,
- this, &QQuickSwipeViewAttachedPrivate::updateIsCurrent);
- connect(swipeView, &QQuickSwipeView::contentChildrenChanged,
- this, &QQuickSwipeViewAttachedPrivate::updateIndex);
- }
-
- Q_Q(QQuickSwipeViewAttached);
- emit q->viewChanged();
-
- updateIndex();
- updateIsCurrent();
-}
-
-void QQuickSwipeViewAttachedPrivate::setIsCurrent(bool current)
-{
- if (current != isCurrent) {
- isCurrent = current;
- Q_Q(QQuickSwipeViewAttached);
- emit q->isCurrentItemChanged();
- }
-}
-
-void QQuickSwipeViewAttachedPrivate::setIndex(int i)
-{
- if (i != index) {
- index = i;
- Q_Q(QQuickSwipeViewAttached);
- emit q->indexChanged();
- }
-}
-
-void QQuickSwipeViewAttachedPrivate::updateView(QQuickItem *parent)
-{
- // parent can be, e.g.:
- // - The contentItem of a ListView (typically the case)
- // - 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;
- if (parent) {
- view = qobject_cast<QQuickSwipeView*>(parent);
- if (!view) {
- if (parent->parentItem() && parent->parentItem()->property("contentItem").isValid()) {
- // The parent is the contentItem of some kind of view.
- view = qobject_cast<QQuickSwipeView*>(parent->parentItem()->parentItem());
- }
- }
- }
-
- setView(view);
-}
-
-void QQuickSwipeViewAttachedPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
-{
- updateIndex();
-}
-
-void QQuickSwipeViewAttachedPrivate::itemChildRemoved(QQuickItem *, QQuickItem *)
-{
- updateIndex();
-}
-
-void QQuickSwipeViewAttachedPrivate::itemParentChanged(QQuickItem *, QQuickItem *parent)
-{
- updateView(parent);
-}
-
-void QQuickSwipeViewAttachedPrivate::itemDestroyed(QQuickItem *item)
-{
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
-}
-
-QQuickSwipeViewAttached::QQuickSwipeViewAttached(QQuickItem *item) :
- QObject(*(new QQuickSwipeViewAttachedPrivate(item)), item)
-{
- Q_D(QQuickSwipeViewAttached);
- if (item->parentItem())
- d->updateView(item->parentItem());
-
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- p->addItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
-}
-
-QQuickSwipeViewAttached::~QQuickSwipeViewAttached()
-{
- Q_D(QQuickSwipeViewAttached);
- QQuickItem *item = qobject_cast<QQuickItem *>(parent());
- if (item)
- QQuickItemPrivate::get(item)->removeItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
-}
-
-QQuickSwipeView *QQuickSwipeViewAttached::view() const
-{
- Q_D(const QQuickSwipeViewAttached);
- return d->swipeView;
-}
-
-int QQuickSwipeViewAttached::index() const
-{
- Q_D(const QQuickSwipeViewAttached);
- return d->index;
-}
-
-bool QQuickSwipeViewAttached::isCurrentItem() const
-{
- Q_D(const QQuickSwipeViewAttached);
- return d->swipeView ? d->swipeView->currentIndex() == d->index : false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickswipeview_p.h b/src/templates/qquickswipeview_p.h
deleted file mode 100644
index bf733c7b..00000000
--- a/src/templates/qquickswipeview_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSWIPEVIEW_P_H
-#define QQUICKSWIPEVIEW_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontainer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickSwipeViewAttached;
-class QQuickSwipeViewPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickSwipeView : public QQuickContainer
-{
- Q_OBJECT
-
-public:
- explicit QQuickSwipeView(QQuickItem *parent = Q_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;
-
-private:
- Q_DISABLE_COPY(QQuickSwipeView)
- Q_DECLARE_PRIVATE(QQuickSwipeView)
-};
-
-class QQuickSwipeViewAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickSwipeViewAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int index READ index NOTIFY indexChanged FINAL)
- Q_PROPERTY(bool isCurrentItem READ isCurrentItem NOTIFY isCurrentItemChanged FINAL)
- Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL)
-
-public:
- explicit QQuickSwipeViewAttached(QQuickItem *delegateItem);
- ~QQuickSwipeViewAttached();
-
- int index() const;
- bool isCurrentItem() const;
- QQuickSwipeView *view() const;
-
-Q_SIGNALS:
- void indexChanged();
- void isCurrentItemChanged();
- void viewChanged();
-
-private:
- Q_DISABLE_COPY(QQuickSwipeViewAttached)
- Q_DECLARE_PRIVATE(QQuickSwipeViewAttached)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickSwipeView)
-QML_DECLARE_TYPEINFO(QQuickSwipeView, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKSWIPEVIEW_P_H
diff --git a/src/templates/qquickswitch.cpp b/src/templates/qquickswitch.cpp
deleted file mode 100644
index 05422d8d..00000000
--- a/src/templates/qquickswitch.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickswitch_p.h"
-#include "qquickabstractbutton_p_p.h"
-
-#include <QtQuick/private/qquickwindow_p.h>
-#include <QtQuick/private/qquickevents_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Switch
- \inherits AbstractButton
- \instantiates QQuickSwitch
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-buttons
- \brief A switch control.
-
- \image qtlabscontrols-switch.gif
-
- Switch is an option button that can be dragged or toggled on (checked) or
- off (unchecked). Switches are typically used to select between two states.
-
- \table
- \row \li \image qtlabscontrols-switch-normal.png
- \li A switch in its normal state.
- \row \li \image qtlabscontrols-switch-checked.png
- \li A switch that is checked.
- \row \li \image qtlabscontrols-switch-focused.png
- \li A switch that has active focus.
- \row \li \image qtlabscontrols-switch-disabled.png
- \li A switch that is disabled.
- \endtable
-
- \code
- ColumnLayout {
- Switch {
- text: qsTr("Wi-Fi")
- }
- Switch {
- text: qsTr("Bluetooth")
- }
- }
- \endcode
-
- \labs
-
- \sa {Customizing Switch}, {Button Controls}
-*/
-
-class QQuickSwitchPrivate : public QQuickAbstractButtonPrivate
-{
- Q_DECLARE_PUBLIC(QQuickSwitch)
-
-public:
- QQuickSwitchPrivate() : position(0) { }
-
- void updatePosition();
-
- bool handleMousePressEvent(QQuickItem *child, QMouseEvent *event);
- bool handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event);
- bool handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event);
- bool handleMouseUngrabEvent(QQuickItem *child);
-
- qreal position;
- QPoint pressPoint;
-};
-
-void QQuickSwitchPrivate::updatePosition()
-{
- Q_Q(QQuickSwitch);
- q->setPosition(checked ? 1.0 : 0.0);
-}
-
-bool QQuickSwitchPrivate::handleMousePressEvent(QQuickItem *child, QMouseEvent *event)
-{
- Q_Q(QQuickSwitch);
- Q_UNUSED(child);
- pressPoint = event->pos();
- q->setPressed(true);
- event->accept();
- return true;
-}
-
-bool QQuickSwitchPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event)
-{
- Q_Q(QQuickSwitch);
- if (!child->keepMouseGrab())
- child->setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->pos().x() - pressPoint.x(), Qt::XAxis, event));
- if (child->keepMouseGrab()) {
- q->setPosition(q->positionAt(event->pos()));
- event->accept();
- }
- return true;
-}
-
-bool QQuickSwitchPrivate::handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event)
-{
- Q_Q(QQuickSwitch);
- pressPoint = QPoint();
- q->setPressed(false);
- if (child->keepMouseGrab()) {
- q->setChecked(position > 0.5);
- q->setPosition(checked ? 1.0 : 0.0);
- child->setKeepMouseGrab(false);
- event->accept();
- } else {
- emit q->clicked();
- event->accept();
- q->toggle();
- }
- return true;
-}
-
-bool QQuickSwitchPrivate::handleMouseUngrabEvent(QQuickItem *child)
-{
- Q_Q(QQuickSwitch);
- Q_UNUSED(child);
- pressPoint = QPoint();
- q->setChecked(position > 0.5);
- q->setPosition(checked ? 1.0 : 0.0);
- q->setPressed(false);
- return true;
-}
-
-QQuickSwitch::QQuickSwitch(QQuickItem *parent) :
- QQuickAbstractButton(*(new QQuickSwitchPrivate), parent)
-{
- setCheckable(true);
- setFiltersChildMouseEvents(true);
- QObjectPrivate::connect(this, &QQuickAbstractButton::checkedChanged, d_func(), &QQuickSwitchPrivate::updatePosition);
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Switch::position
- \readonly
-
- This property holds the logical position of the thumb indicator.
-
- The position is defined as a percentage of the control's size, scaled to
- \c 0.0 - \c 1.0. The position can be used for example to determine whether
- the thumb has been dragged past the halfway. For visualizing a thumb
- indicator, the right-to-left aware \l visualPosition should be used instead.
-
- \sa visualPosition
-*/
-qreal QQuickSwitch::position() const
-{
- Q_D(const QQuickSwitch);
- return d->position;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Switch::visualPosition
- \readonly
-
- This property holds the visual position of the thumb indicator.
-
- The position is defined as a percentage of the control's size, scaled to
- \c 0.0 - \c 1.0. When the control is \l {Control::mirrored}{mirrored}, the
- value is equal to \c {1.0 - position}. This makes the value suitable for
- visualizing the thumb indicator taking right-to-left support into account.
- In order to for example determine whether the thumb has been dragged past
- the halfway, the logical \l position should be used instead.
-
- \sa position
-*/
-qreal QQuickSwitch::visualPosition() const
-{
- Q_D(const QQuickSwitch);
- if (isMirrored())
- return 1.0 - d->position;
- return d->position;
-}
-
-void QQuickSwitch::mirrorChange()
-{
- QQuickAbstractButton::mirrorChange();
- emit visualPositionChanged();
-}
-
-bool QQuickSwitch::childMouseEventFilter(QQuickItem *child, QEvent *event)
-{
- Q_D(QQuickSwitch);
- if (child == indicator()) {
- switch (event->type()) {
- case QEvent::MouseButtonPress:
- return d->handleMousePressEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::MouseMove:
- return d->handleMouseMoveEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::MouseButtonRelease:
- return d->handleMouseReleaseEvent(child, static_cast<QMouseEvent *>(event));
- case QEvent::UngrabMouse:
- return d->handleMouseUngrabEvent(child);
- default:
- return false;
- }
- }
- return false;
-}
-
-qreal QQuickSwitch::positionAt(const QPoint &point) const
-{
- qreal pos = point.x() / indicator()->width();
- if (isMirrored())
- return 1.0 - pos;
- return pos;
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquickswitch_p.h b/src/templates/qquickswitch_p.h
deleted file mode 100644
index 94d0d601..00000000
--- a/src/templates/qquickswitch_p.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKSWITCH_P_H
-#define QQUICKSWITCH_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickSwitchPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickSwitch : public QQuickAbstractButton
-{
- Q_OBJECT
- Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged FINAL)
- Q_PROPERTY(qreal visualPosition READ visualPosition NOTIFY visualPositionChanged FINAL)
-
-public:
- explicit QQuickSwitch(QQuickItem *parent = Q_NULLPTR);
-
- qreal position() const;
- void setPosition(qreal position);
-
- qreal visualPosition() const;
-
-Q_SIGNALS:
- void positionChanged();
- void visualPositionChanged();
-
-protected:
- void mirrorChange() Q_DECL_OVERRIDE;
- bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
-
- virtual qreal positionAt(const QPoint &point) const;
-
-private:
- Q_DISABLE_COPY(QQuickSwitch)
- Q_DECLARE_PRIVATE(QQuickSwitch)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickSwitch)
-
-#endif // QQUICKSWITCH_P_H
diff --git a/src/templates/qquicktabbar.cpp b/src/templates/qquicktabbar.cpp
deleted file mode 100644
index 58d68058..00000000
--- a/src/templates/qquicktabbar.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktabbar_p.h"
-#include "qquicktabbutton_p.h"
-#include "qquickcontainer_p_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype TabBar
- \inherits Container
- \instantiates QQuickTabBar
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-navigation
- \ingroup qtlabscontrols-containers
- \brief A tab bar control.
-
- TabBar provides a tab-based navigation model.
-
- \image qtlabscontrols-tabbar-wireframe.png
-
- TabBar is populated with TabButton controls, and can be used together with
- any layout or container control that provides \c currentIndex -property,
- such as \l StackLayout or \l SwipeView
-
- \snippet qtlabscontrols-tabbar.qml 1
-
- \labs
-
- \sa TabButton, {Customizing TabBar}, {Navigation Controls}, {Container Controls}
-*/
-
-class QQuickTabBarPrivate : public QQuickContainerPrivate
-{
- Q_DECLARE_PUBLIC(QQuickTabBar)
-
-public:
- void updateCurrentItem();
- void updateCurrentIndex();
- void updateLayout();
-};
-
-void QQuickTabBarPrivate::updateCurrentItem()
-{
- QQuickTabButton *button = qobject_cast<QQuickTabButton *>(contentModel->get(currentIndex));
- if (button)
- button->setChecked(true);
-}
-
-void QQuickTabBarPrivate::updateCurrentIndex()
-{
- Q_Q(QQuickTabBar);
- QQuickTabButton *button = qobject_cast<QQuickTabButton *>(q->sender());
- if (button && button->isChecked())
- q->setCurrentIndex(contentModel->indexOf(button, Q_NULLPTR));
-}
-
-void QQuickTabBarPrivate::updateLayout()
-{
- Q_Q(QQuickTabBar);
- const int count = contentModel->count();
- if (count > 0 && contentItem) {
- const qreal itemWidth = (contentItem->width() - qMax(0, count - 1) * spacing) / count;
-
- for (int i = 0; i < count; ++i) {
- QQuickItem *item = q->itemAt(i);
- if (item) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
- item->setWidth(itemWidth);
- p->widthValid = false;
- }
- }
- }
- }
-}
-
-QQuickTabBar::QQuickTabBar(QQuickItem *parent) :
- QQuickContainer(*(new QQuickTabBarPrivate), parent)
-{
- Q_D(QQuickTabBar);
- setFlag(ItemIsFocusScope);
- QObjectPrivate::connect(this, &QQuickTabBar::currentIndexChanged, d, &QQuickTabBarPrivate::updateCurrentItem);
-}
-
-void QQuickTabBar::updatePolish()
-{
- Q_D(QQuickTabBar);
- QQuickContainer::updatePolish();
- d->updateLayout();
-}
-
-void QQuickTabBar::componentComplete()
-{
- Q_D(QQuickTabBar);
- QQuickContainer::componentComplete();
- d->updateCurrentItem();
- d->updateLayout();
-}
-
-void QQuickTabBar::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickTabBar);
- QQuickContainer::geometryChanged(newGeometry, oldGeometry);
- d->updateLayout();
-}
-
-bool QQuickTabBar::isContent(QQuickItem *item) const
-{
- return qobject_cast<QQuickTabButton *>(item);
-}
-
-void QQuickTabBar::itemAdded(int index, QQuickItem *item)
-{
- Q_D(QQuickTabBar);
- Q_UNUSED(index);
- if (QQuickTabButton *button = qobject_cast<QQuickTabButton *>(item))
- QObjectPrivate::connect(button, &QQuickTabButton::checkedChanged, d, &QQuickTabBarPrivate::updateCurrentIndex);
- if (isComponentComplete())
- polish();
-}
-
-void QQuickTabBar::itemRemoved(int index, QQuickItem *item)
-{
- Q_D(QQuickTabBar);
- Q_UNUSED(index);
- if (QQuickTabButton *button = qobject_cast<QQuickTabButton *>(item))
- QObjectPrivate::disconnect(button, &QQuickTabButton::checkedChanged, d, &QQuickTabBarPrivate::updateCurrentIndex);
- if (isComponentComplete())
- polish();
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickTabBar::accessibleRole() const
-{
- return QAccessible::PageTabList;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicktabbar_p.h b/src/templates/qquicktabbar_p.h
deleted file mode 100644
index 7d6f674c..00000000
--- a/src/templates/qquicktabbar_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTABBAR_P_H
-#define QQUICKTABBAR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickcontainer_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickTabBarPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickTabBar : public QQuickContainer
-{
- Q_OBJECT
-
-public:
- explicit QQuickTabBar(QQuickItem *parent = Q_NULLPTR);
-
-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;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
-private:
- Q_DISABLE_COPY(QQuickTabBar)
- Q_DECLARE_PRIVATE(QQuickTabBar)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickTabBar)
-
-#endif // QQUICKTABBAR_P_H
diff --git a/src/templates/qquicktabbutton.cpp b/src/templates/qquicktabbutton.cpp
deleted file mode 100644
index a70dcbe1..00000000
--- a/src/templates/qquicktabbutton.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktabbutton_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype TabButton
- \inherits AbstractButton
- \instantiates QQuickTabButton
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-navigation
- \brief A tab button control.
-
- \image qtlabscontrols-tabbutton.png
-
- TabButton is used in conjunction with a \l TabBar.
-
- \snippet qtlabscontrols-tabbutton.qml 1
-
- \labs
-
- \sa TabBar, {Customizing TabButton}, {Navigation Controls}
-*/
-
-QQuickTabButton::QQuickTabButton(QQuickItem *parent) :
- QQuickAbstractButton(parent)
-{
- setCheckable(true);
- setAutoExclusive(true);
-}
-
-QFont QQuickTabButton::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::TabButtonFont);
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickTabButton::accessibleRole() const
-{
- return QAccessible::PageTab;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicktabbutton_p.h b/src/templates/qquicktabbutton_p.h
deleted file mode 100644
index c02a206f..00000000
--- a/src/templates/qquicktabbutton_p.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTABBUTTON_P_H
-#define QQUICKTABBUTTON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LABSTEMPLATES_EXPORT QQuickTabButton : public QQuickAbstractButton
-{
- Q_OBJECT
-
-public:
- explicit QQuickTabButton(QQuickItem *parent = Q_NULLPTR);
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickTabButton)
-
-#endif // QQUICKTABBUTTON_P_H
diff --git a/src/templates/qquicktextarea.cpp b/src/templates/qquicktextarea.cpp
deleted file mode 100644
index fce74338..00000000
--- a/src/templates/qquicktextarea.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktextarea_p.h"
-#include "qquicktextarea_p_p.h"
-#include "qquickcontrol_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qguiapplication.h>
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquickclipnode_p.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtQuick/private/qquickaccessibleattached_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype TextArea
- \inherits TextEdit
- \instantiates QQuickTextArea
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A multi line text input control.
-
- TextArea is a multi-line text editor. TextArea extends TextEdit with
- a \l {placeholderText}{placeholder text} functionality, and adds decoration.
-
- \code
- TextArea {
- placeholderText: qsTr("Enter description")
- }
- \endcode
-
- \labs
-
- \sa TextField, {Customizing TextArea}, {Input Controls}
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::TextArea::pressAndHold(MouseEvent mouse)
-
- This signal is emitted when there is a long press (the delay depends on the platform plugin).
- The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
- position of the press, and which button is pressed.
-*/
-
-QQuickTextAreaPrivate::QQuickTextAreaPrivate()
- : background(Q_NULLPTR), focusReason(Qt::OtherFocusReason), accessibleAttached(Q_NULLPTR)
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::installActivationObserver(this);
-#endif
-}
-
-QQuickTextAreaPrivate::~QQuickTextAreaPrivate()
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::removeActivationObserver(this);
-#endif
-}
-
-void QQuickTextAreaPrivate::resizeBackground()
-{
- Q_Q(QQuickTextArea);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- background->setHeight(q->height());
- p->heightValid = false;
- }
- }
-}
-
-qreal QQuickTextAreaPrivate::getImplicitWidth() const
-{
- return QQuickItemPrivate::getImplicitWidth();
-}
-
-qreal QQuickTextAreaPrivate::getImplicitHeight() const
-{
- return QQuickItemPrivate::getImplicitHeight();
-}
-
-void QQuickTextAreaPrivate::implicitWidthChanged()
-{
- Q_Q(QQuickTextArea);
- QQuickItemPrivate::implicitWidthChanged();
- emit q->implicitWidthChanged();
-}
-
-void QQuickTextAreaPrivate::implicitHeightChanged()
-{
- Q_Q(QQuickTextArea);
- QQuickItemPrivate::implicitHeightChanged();
- emit q->implicitHeightChanged();
-}
-
-QQuickTextArea::QQuickTextArea(QQuickItem *parent) :
- QQuickTextEdit(*(new QQuickTextAreaPrivate), parent)
-{
- Q_D(QQuickTextArea);
- setActiveFocusOnTab(true);
- d->setImplicitResizeEnabled(false);
- d->pressAndHoldHelper.control = this;
- QObjectPrivate::connect(this, &QQuickTextEdit::readOnlyChanged,
- d, &QQuickTextAreaPrivate::_q_readOnlyChanged);
-}
-
-QQuickTextArea::~QQuickTextArea()
-{
-}
-
-/*!
- \internal
-
- Determine which font is implicitly imposed on this control by its ancestors
- and QGuiApplication::font, resolve this against its own font (attributes from
- the implicit font are copied over). Then propagate this font to this
- control's children.
-*/
-void QQuickTextAreaPrivate::resolveFont()
-{
- Q_Q(QQuickTextArea);
- inheritFont(QQuickControlPrivate::naturalControlFont(q));
-}
-
-void QQuickTextAreaPrivate::inheritFont(const QFont &f)
-{
- Q_Q(QQuickTextArea);
- QFont parentFont = font.resolve(f);
- parentFont.resolve(font.resolve() | f.resolve());
-
- const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
- const QFont resolvedFont = parentFont.resolve(defaultFont);
-
- const bool changed = resolvedFont != sourceFont;
- q->QQuickTextEdit::setFont(resolvedFont);
- if (changed)
- emit q->fontChanged();
-}
-
-void QQuickTextAreaPrivate::_q_readOnlyChanged(bool isReadOnly)
-{
-#ifndef QT_NO_ACCESSIBILITY
- if (accessibleAttached)
- accessibleAttached->set_readOnly(isReadOnly);
-#else
- Q_UNUSED(isReadOnly)
-#endif
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickTextAreaPrivate::accessibilityActiveChanged(bool active)
-{
- if (accessibleAttached || !active)
- return;
-
- Q_Q(QQuickTextArea);
- accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
- if (accessibleAttached) {
- accessibleAttached->setRole(accessibleRole());
- accessibleAttached->set_readOnly(q->isReadOnly());
- accessibleAttached->setDescription(placeholder);
- } else {
- qWarning() << "QQuickTextArea: " << q << " QQuickAccessibleAttached object creation failed!";
- }
-}
-
-QAccessible::Role QQuickTextAreaPrivate::accessibleRole() const
-{
- return QAccessible::EditableText;
-}
-#endif
-
-QFont QQuickTextArea::font() const
-{
- return QQuickTextEdit::font();
-}
-
-void QQuickTextArea::setFont(const QFont &font)
-{
- Q_D(QQuickTextArea);
- if (d->font.resolve() == font.resolve() && d->font == font)
- return;
-
- d->font = font;
- d->resolveFont();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::TextArea::background
-
- This property holds the background item.
-
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
-
- \sa {Customizing TextArea}
-*/
-QQuickItem *QQuickTextArea::background() const
-{
- Q_D(const QQuickTextArea);
- return d->background;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::TextArea::placeholderText
-
- This property holds the placeholder text.
-*/
-QString QQuickTextArea::placeholderText() const
-{
- Q_D(const QQuickTextArea);
- return d->placeholder;
-}
-
-void QQuickTextArea::setPlaceholderText(const QString &text)
-{
- Q_D(QQuickTextArea);
- if (d->placeholder != text) {
- d->placeholder = text;
-#ifndef QT_NO_ACCESSIBILITY
- if (d->accessibleAttached)
- d->accessibleAttached->setDescription(text);
-#endif
- emit placeholderTextChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::TextArea::focusReason
-
- This property holds the reason of the last focus change.
-
- \note This property does not indicate whether the control has \l {Item::activeFocus}
- {active focus}, but the reason why the control either gained or lost focus.
-
- \value Qt.MouseFocusReason A mouse action occurred.
- \value Qt.TabFocusReason The Tab key was pressed.
- \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
- \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
- \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
- \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
- \value Qt.MenuBarFocusReason The menu bar took focus.
- \value Qt.OtherFocusReason Another reason, usually application-specific.
-
- \sa Item::activeFocus
-*/
-Qt::FocusReason QQuickTextArea::focusReason() const
-{
- Q_D(const QQuickTextArea);
- return d->focusReason;
-}
-
-void QQuickTextArea::setFocusReason(Qt::FocusReason reason)
-{
- Q_D(QQuickTextArea);
- if (d->focusReason != reason) {
- d->focusReason = reason;
- emit focusReasonChanged();
- }
-}
-
-void QQuickTextArea::classBegin()
-{
- Q_D(QQuickTextArea);
- QQuickTextEdit::classBegin();
- d->resolveFont();
-}
-
-void QQuickTextArea::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
-{
- Q_D(QQuickTextArea);
- QQuickTextEdit::itemChange(change, value);
- if (change == ItemParentHasChanged && value.item)
- d->resolveFont();
-}
-
-void QQuickTextArea::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickTextArea);
- QQuickTextEdit::geometryChanged(newGeometry, oldGeometry);
- d->resizeBackground();
-}
-
-QSGNode *QQuickTextArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
-{
- QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
- if (!clipNode)
- clipNode = new QQuickDefaultClipNode(QRectF());
-
- clipNode->setRect(clipRect().adjusted(leftPadding(), topPadding(), -rightPadding(), -bottomPadding()));
- clipNode->update();
-
- QSGNode *textNode = QQuickTextEdit::updatePaintNode(clipNode->firstChild(), data);
- if (!textNode->parent())
- clipNode->appendChildNode(textNode);
-
- return clipNode;
-}
-
-void QQuickTextArea::focusInEvent(QFocusEvent *event)
-{
- QQuickTextEdit::focusInEvent(event);
- setFocusReason(event->reason());
-}
-
-void QQuickTextArea::focusOutEvent(QFocusEvent *event)
-{
- QQuickTextEdit::focusOutEvent(event);
- setFocusReason(event->reason());
-}
-
-void QQuickTextArea::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickTextArea);
- d->pressAndHoldHelper.mousePressEvent(event);
- if (d->pressAndHoldHelper.isActive()) {
- if (d->pressAndHoldHelper.delayedMousePressEvent) {
- QQuickTextEdit::mousePressEvent(d->pressAndHoldHelper.delayedMousePressEvent);
- d->pressAndHoldHelper.clearDelayedMouseEvent();
- }
- QQuickTextEdit::mousePressEvent(event);
- }
-}
-
-void QQuickTextArea::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickTextArea);
- d->pressAndHoldHelper.mouseMoveEvent(event);
- if (d->pressAndHoldHelper.isActive()) {
- if (d->pressAndHoldHelper.delayedMousePressEvent) {
- QQuickTextEdit::mousePressEvent(d->pressAndHoldHelper.delayedMousePressEvent);
- d->pressAndHoldHelper.clearDelayedMouseEvent();
- }
- QQuickTextEdit::mouseMoveEvent(event);
- }
-}
-
-void QQuickTextArea::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickTextArea);
- d->pressAndHoldHelper.mouseReleaseEvent(event);
- if (d->pressAndHoldHelper.isActive()) {
- if (d->pressAndHoldHelper.delayedMousePressEvent) {
- QQuickTextEdit::mousePressEvent(d->pressAndHoldHelper.delayedMousePressEvent);
- d->pressAndHoldHelper.clearDelayedMouseEvent();
- }
- QQuickTextEdit::mouseReleaseEvent(event);
- }
-}
-
-void QQuickTextArea::timerEvent(QTimerEvent *event)
-{
- Q_D(QQuickTextArea);
- if (event->timerId() == d->pressAndHoldHelper.timer.timerId()) {
- d->pressAndHoldHelper.timerEvent(event);
- } else {
- QQuickTextEdit::timerEvent(event);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicktextarea_p.h b/src/templates/qquicktextarea_p.h
deleted file mode 100644
index acf67359..00000000
--- a/src/templates/qquicktextarea_p.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTEXTAREA_P_H
-#define QQUICKTEXTAREA_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquicktextedit_p.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickText;
-class QQuickTextAreaPrivate;
-class QQuickMouseEvent;
-
-class Q_LABSTEMPLATES_EXPORT QQuickTextArea : public QQuickTextEdit
-{
- Q_OBJECT
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
- Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged FINAL)
- Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged FINAL)
- Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
- Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
- Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
-
-public:
- explicit QQuickTextArea(QQuickItem *parent = Q_NULLPTR);
- ~QQuickTextArea();
-
- QFont font() const;
- void setFont(const QFont &font);
-
- QQuickItem *background() const;
- void setBackground(QQuickItem *background);
-
- QString placeholderText() const;
- void setPlaceholderText(const QString &text);
-
- Qt::FocusReason focusReason() const;
- void setFocusReason(Qt::FocusReason reason);
-
-Q_SIGNALS:
- void fontChanged();
- void implicitWidthChanged();
- void implicitHeightChanged();
- void backgroundChanged();
- void placeholderTextChanged();
- void focusReasonChanged();
- 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;
-
-private:
- Q_DISABLE_COPY(QQuickTextArea)
- Q_DECLARE_PRIVATE(QQuickTextArea)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickTextArea)
-
-#endif // QQUICKTEXTAREA_P_H
diff --git a/src/templates/qquicktextarea_p_p.h b/src/templates/qquicktextarea_p_p.h
deleted file mode 100644
index f93eb968..00000000
--- a/src/templates/qquicktextarea_p_p.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTEXTAREA_P_P_H
-#define QQUICKTEXTAREA_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquicktextedit_p_p.h>
-#include <QtLabsTemplates/private/qquickpressandholdhelper_p.h>
-
-#include "qquicktextarea_p.h"
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtGui/qaccessible.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAccessibleAttached;
-
-class QQuickTextAreaPrivate : public QQuickTextEditPrivate
-#ifndef QT_NO_ACCESSIBILITY
- , public QAccessible::ActivationObserver
-#endif
-{
- Q_DECLARE_PUBLIC(QQuickTextArea)
-
-public:
- QQuickTextAreaPrivate();
- ~QQuickTextAreaPrivate();
-
- static QQuickTextAreaPrivate *get(QQuickTextArea *item) {
- return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(item)); }
-
- void resizeBackground();
- void resolveFont();
- void inheritFont(const QFont &f);
-
- qreal getImplicitWidth() const Q_DECL_OVERRIDE;
- qreal getImplicitHeight() const Q_DECL_OVERRIDE;
-
- void implicitWidthChanged() Q_DECL_OVERRIDE;
- void implicitHeightChanged() Q_DECL_OVERRIDE;
-
- void _q_readOnlyChanged(bool isReadOnly);
-
-#ifndef QT_NO_ACCESSIBILITY
- void accessibilityActiveChanged(bool active) Q_DECL_OVERRIDE;
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-
- QFont font;
- QQuickItem *background;
- QString placeholder;
- Qt::FocusReason focusReason;
- QQuickPressAndHoldHelper pressAndHoldHelper;
- QQuickAccessibleAttached *accessibleAttached;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKTEXTAREA_P_P_H
diff --git a/src/templates/qquicktextfield.cpp b/src/templates/qquicktextfield.cpp
deleted file mode 100644
index b04940f0..00000000
--- a/src/templates/qquicktextfield.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktextfield_p.h"
-#include "qquicktextfield_p_p.h"
-#include "qquickcontrol_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtCore/qbasictimer.h>
-#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquicktext_p.h>
-#include <QtQuick/private/qquicktextinput_p.h>
-#include <QtQuick/private/qquickclipnode_p.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtQuick/private/qquickaccessibleattached_p.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype TextField
- \inherits TextInput
- \instantiates QQuickTextField
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A single line text input control.
-
- TextField is a single line text editor. TextField extends TextInput with
- a \l {placeholderText}{placeholder text} functionality, and adds decoration.
-
- \table
- \row \li \image qtlabscontrols-textfield-normal.png
- \li A text field in its normal state.
- \row \li \image qtlabscontrols-textfield-focused.png
- \li A text field that has active focus.
- \row \li \image qtlabscontrols-textfield-disabled.png
- \li A text field that is disabled.
- \endtable
-
- \code
- TextField {
- placeholderText: qsTr("Enter name")
- }
- \endcode
-
- \labs
-
- \sa TextArea, {Customizing TextField}, {Input Controls}
-*/
-
-/*!
- \qmlsignal Qt.labs.controls::TextField::pressAndHold(MouseEvent mouse)
-
- This signal is emitted when there is a long press (the delay depends on the platform plugin).
- The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
- position of the press, and which button is pressed.
-*/
-
-QQuickTextFieldPrivate::QQuickTextFieldPrivate()
- : background(Q_NULLPTR)
- , focusReason(Qt::OtherFocusReason)
- , accessibleAttached(Q_NULLPTR)
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::installActivationObserver(this);
-#endif
-}
-
-QQuickTextFieldPrivate::~QQuickTextFieldPrivate()
-{
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::removeActivationObserver(this);
-#endif
-}
-
-void QQuickTextFieldPrivate::resizeBackground()
-{
- Q_Q(QQuickTextField);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- background->setHeight(q->height());
- p->heightValid = false;
- }
- }
-}
-
-qreal QQuickTextFieldPrivate::getImplicitWidth() const
-{
- return QQuickItemPrivate::getImplicitWidth();
-}
-
-qreal QQuickTextFieldPrivate::getImplicitHeight() const
-{
- return QQuickItemPrivate::getImplicitHeight();
-}
-
-void QQuickTextFieldPrivate::implicitWidthChanged()
-{
- Q_Q(QQuickTextField);
- QQuickItemPrivate::implicitWidthChanged();
- emit q->implicitWidthChanged();
-}
-
-void QQuickTextFieldPrivate::implicitHeightChanged()
-{
- Q_Q(QQuickTextField);
- QQuickItemPrivate::implicitHeightChanged();
- emit q->implicitHeightChanged();
-}
-
-QQuickTextField::QQuickTextField(QQuickItem *parent) :
- QQuickTextInput(*(new QQuickTextFieldPrivate), parent)
-{
- Q_D(QQuickTextField);
- d->pressAndHoldHelper.control = this;
- d->setImplicitResizeEnabled(false);
- setActiveFocusOnTab(true);
- QObjectPrivate::connect(this, &QQuickTextInput::readOnlyChanged,
- d, &QQuickTextFieldPrivate::_q_readOnlyChanged);
- QObjectPrivate::connect(this, &QQuickTextInput::echoModeChanged,
- d, &QQuickTextFieldPrivate::_q_echoModeChanged);
-}
-
-QQuickTextField::~QQuickTextField()
-{
-}
-
-/*!
- \internal
-
- Determine which font is implicitly imposed on this control by its ancestors
- and QGuiApplication::font, resolve this against its own font (attributes from
- the implicit font are copied over). Then propagate this font to this
- control's children.
-*/
-void QQuickTextFieldPrivate::resolveFont()
-{
- Q_Q(QQuickTextField);
- inheritFont(QQuickControlPrivate::naturalControlFont(q));
-}
-
-void QQuickTextFieldPrivate::inheritFont(const QFont &f)
-{
- Q_Q(QQuickTextField);
- QFont parentFont = font.resolve(f);
- parentFont.resolve(font.resolve() | f.resolve());
-
- const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
- const QFont resolvedFont = parentFont.resolve(defaultFont);
-
- const bool changed = resolvedFont != sourceFont;
- q->QQuickTextInput::setFont(resolvedFont);
- if (changed)
- emit q->fontChanged();
-}
-
-void QQuickTextFieldPrivate::_q_readOnlyChanged(bool isReadOnly)
-{
-#ifndef QT_NO_ACCESSIBILITY
- if (accessibleAttached)
- accessibleAttached->set_readOnly(isReadOnly);
-#else
- Q_UNUSED(isReadOnly)
-#endif
-}
-
-void QQuickTextFieldPrivate::_q_echoModeChanged(QQuickTextField::EchoMode echoMode)
-{
-#ifndef QT_NO_ACCESSIBILITY
- if (accessibleAttached)
- accessibleAttached->set_passwordEdit((echoMode == QQuickTextField::Password || echoMode == QQuickTextField::PasswordEchoOnEdit) ? true : false);
-#else
- Q_UNUSED(echoMode)
-#endif
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-void QQuickTextFieldPrivate::accessibilityActiveChanged(bool active)
-{
- if (accessibleAttached || !active)
- return;
-
- Q_Q(QQuickTextField);
- accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
- if (accessibleAttached) {
- accessibleAttached->setRole(accessibleRole());
- accessibleAttached->set_readOnly(m_readOnly);
- accessibleAttached->set_passwordEdit((m_echoMode == QQuickTextField::Password || m_echoMode == QQuickTextField::PasswordEchoOnEdit) ? true : false);
- accessibleAttached->setDescription(placeholder);
- } else {
- qWarning() << "QQuickTextField: " << q << " QQuickAccessibleAttached object creation failed!";
- }
-}
-
-QAccessible::Role QQuickTextFieldPrivate::accessibleRole() const
-{
- return QAccessible::EditableText;
-}
-#endif
-
-QFont QQuickTextField::font() const
-{
- return QQuickTextInput::font();
-}
-
-void QQuickTextField::setFont(const QFont &font)
-{
- Q_D(QQuickTextField);
- if (d->font.resolve() == font.resolve() && d->font == font)
- return;
-
- d->font = font;
- d->resolveFont();
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::TextField::background
-
- This property holds the background item.
-
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
-
- \sa {Customizing TextField}
-*/
-QQuickItem *QQuickTextField::background() const
-{
- Q_D(const QQuickTextField);
- return d->background;
-}
-
-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();
- }
-}
-
-/*!
- \qmlproperty string Qt.labs.controls::TextField::placeholderText
-
- This property holds the placeholder text.
-*/
-QString QQuickTextField::placeholderText() const
-{
- Q_D(const QQuickTextField);
- return d->placeholder;
-}
-
-void QQuickTextField::setPlaceholderText(const QString &text)
-{
- Q_D(QQuickTextField);
- if (d->placeholder != text) {
- d->placeholder = text;
-#ifndef QT_NO_ACCESSIBILITY
- if (d->accessibleAttached)
- d->accessibleAttached->setDescription(text);
-#endif
- emit placeholderTextChanged();
- }
-}
-
-/*!
- \qmlproperty enumeration Qt.labs.controls::TextField::focusReason
-
- This property holds the reason of the last focus change.
-
- \note This property does not indicate whether the control has \l {Item::activeFocus}
- {active focus}, but the reason why the control either gained or lost focus.
-
- \value Qt.MouseFocusReason A mouse action occurred.
- \value Qt.TabFocusReason The Tab key was pressed.
- \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
- \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
- \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
- \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
- \value Qt.MenuBarFocusReason The menu bar took focus.
- \value Qt.OtherFocusReason Another reason, usually application-specific.
-
- \sa Item::activeFocus
-*/
-Qt::FocusReason QQuickTextField::focusReason() const
-{
- Q_D(const QQuickTextField);
- return d->focusReason;
-}
-
-void QQuickTextField::setFocusReason(Qt::FocusReason reason)
-{
- Q_D(QQuickTextField);
- if (d->focusReason != reason) {
- d->focusReason = reason;
- emit focusReasonChanged();
- }
-}
-
-void QQuickTextField::classBegin()
-{
- Q_D(QQuickTextField);
- QQuickTextInput::classBegin();
- d->resolveFont();
-}
-
-void QQuickTextField::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
-{
- Q_D(QQuickTextField);
- QQuickTextInput::itemChange(change, value);
- if (change == ItemParentHasChanged && value.item)
- d->resolveFont();
-}
-
-void QQuickTextField::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickTextField);
- QQuickTextInput::geometryChanged(newGeometry, oldGeometry);
- d->resizeBackground();
-}
-
-QSGNode *QQuickTextField::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
-{
- QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
- if (!clipNode)
- clipNode = new QQuickDefaultClipNode(QRectF());
-
- clipNode->setRect(clipRect().adjusted(leftPadding(), topPadding(), -rightPadding(), -bottomPadding()));
- clipNode->update();
-
- QSGNode *textNode = QQuickTextInput::updatePaintNode(clipNode->firstChild(), data);
- if (!textNode->parent())
- clipNode->appendChildNode(textNode);
-
- return clipNode;
-}
-
-void QQuickTextField::focusInEvent(QFocusEvent *event)
-{
- QQuickTextInput::focusInEvent(event);
- setFocusReason(event->reason());
-}
-
-void QQuickTextField::focusOutEvent(QFocusEvent *event)
-{
- QQuickTextInput::focusOutEvent(event);
- setFocusReason(event->reason());
-}
-
-void QQuickTextField::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickTextField);
- d->pressAndHoldHelper.mousePressEvent(event);
- if (d->pressAndHoldHelper.isActive()) {
- if (d->pressAndHoldHelper.delayedMousePressEvent) {
- QQuickTextInput::mousePressEvent(d->pressAndHoldHelper.delayedMousePressEvent);
- d->pressAndHoldHelper.clearDelayedMouseEvent();
- }
- QQuickTextInput::mousePressEvent(event);
- }
-}
-
-void QQuickTextField::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickTextField);
- d->pressAndHoldHelper.mouseMoveEvent(event);
- if (d->pressAndHoldHelper.isActive()) {
- if (d->pressAndHoldHelper.delayedMousePressEvent) {
- QQuickTextInput::mousePressEvent(d->pressAndHoldHelper.delayedMousePressEvent);
- d->pressAndHoldHelper.clearDelayedMouseEvent();
- }
- QQuickTextInput::mouseMoveEvent(event);
- }
-}
-
-void QQuickTextField::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickTextField);
- d->pressAndHoldHelper.mouseReleaseEvent(event);
- if (d->pressAndHoldHelper.isActive()) {
- if (d->pressAndHoldHelper.delayedMousePressEvent) {
- QQuickTextInput::mousePressEvent(d->pressAndHoldHelper.delayedMousePressEvent);
- d->pressAndHoldHelper.clearDelayedMouseEvent();
- }
- QQuickTextInput::mouseReleaseEvent(event);
- }
-}
-
-void QQuickTextField::timerEvent(QTimerEvent *event)
-{
- Q_D(QQuickTextField);
- if (event->timerId() == d->pressAndHoldHelper.timer.timerId()) {
- d->pressAndHoldHelper.timerEvent(event);
- } else {
- QQuickTextInput::timerEvent(event);
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicktextfield_p.h b/src/templates/qquicktextfield_p.h
deleted file mode 100644
index 23658cc6..00000000
--- a/src/templates/qquicktextfield_p.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTEXTFIELD_P_H
-#define QQUICKTEXTFIELD_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquicktextinput_p.h>
-#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickText;
-class QQuickTextFieldPrivate;
-class QQuickMouseEvent;
-
-class Q_LABSTEMPLATES_EXPORT QQuickTextField : public QQuickTextInput
-{
- Q_OBJECT
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) // override
- Q_PROPERTY(qreal implicitWidth READ implicitWidth WRITE setImplicitWidth NOTIFY implicitWidthChanged FINAL)
- Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged FINAL)
- Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
- Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
- Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
-
-public:
- explicit QQuickTextField(QQuickItem *parent = Q_NULLPTR);
- ~QQuickTextField();
-
- QFont font() const;
- void setFont(const QFont &font);
-
- QQuickItem *background() const;
- void setBackground(QQuickItem *background);
-
- QString placeholderText() const;
- void setPlaceholderText(const QString &text);
-
- Qt::FocusReason focusReason() const;
- void setFocusReason(Qt::FocusReason reason);
-
-Q_SIGNALS:
- void fontChanged();
- void implicitWidthChanged();
- void implicitHeightChanged();
- void backgroundChanged();
- void placeholderTextChanged();
- void focusReasonChanged();
- 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;
-
-private:
- Q_DISABLE_COPY(QQuickTextField)
- Q_DECLARE_PRIVATE(QQuickTextField)
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickTextField)
-
-#endif // QQUICKTEXTFIELD_P_H
diff --git a/src/templates/qquicktextfield_p_p.h b/src/templates/qquicktextfield_p_p.h
deleted file mode 100644
index 6cf0805e..00000000
--- a/src/templates/qquicktextfield_p_p.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTEXTFIELD_P_P_H
-#define QQUICKTEXTFIELD_P_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtQuick/private/qquicktextinput_p_p.h>
-#include <QtLabsTemplates/private/qquickpressandholdhelper_p.h>
-
-#include "qquicktextfield_p.h"
-
-#ifndef QT_NO_ACCESSIBILITY
-#include <QtGui/qaccessible.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QQuickAccessibleAttached;
-
-class QQuickTextFieldPrivate : public QQuickTextInputPrivate
-#ifndef QT_NO_ACCESSIBILITY
- , public QAccessible::ActivationObserver
-#endif
-{
- Q_DECLARE_PUBLIC(QQuickTextField)
-
-public:
- QQuickTextFieldPrivate();
- ~QQuickTextFieldPrivate();
-
- static QQuickTextFieldPrivate *get(QQuickTextField *item) {
- return static_cast<QQuickTextFieldPrivate *>(QObjectPrivate::get(item)); }
-
- void resizeBackground();
- void resolveFont();
- void inheritFont(const QFont &f);
-
- qreal getImplicitWidth() const Q_DECL_OVERRIDE;
- qreal getImplicitHeight() const Q_DECL_OVERRIDE;
-
- void implicitWidthChanged() Q_DECL_OVERRIDE;
- void implicitHeightChanged() Q_DECL_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;
-#endif
-
- QFont font;
- QQuickItem *background;
- QString placeholder;
- Qt::FocusReason focusReason;
- QQuickPressAndHoldHelper pressAndHoldHelper;
- QQuickAccessibleAttached *accessibleAttached;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQUICKTEXTFIELD_P_P_H
diff --git a/src/templates/qquicktoolbar.cpp b/src/templates/qquicktoolbar.cpp
deleted file mode 100644
index 882834e3..00000000
--- a/src/templates/qquicktoolbar.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktoolbar_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ToolBar
- \inherits Frame
- \instantiates QQuickToolBar
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-containers
- \brief A tool bar control.
-
- ToolBar is a container of application-wide and context sensitive
- actions and controls, such as navigation buttons and search fields.
- ToolBar is commonly used as a \l {ApplicationWindow::header}{header}
- or a \l {ApplicationWindow::footer}{footer} of an \l ApplicationWindow.
-
- ToolBar does not provide a layout of its own, but requires you to
- position its contents, for instance by creating a \l RowLayout. If only
- a single item is used within the ToolBar, it will resize to fit the
- implicit size of its contained item. This makes it particularly suitable
- for use together with layouts.
-
- \image qtlabscontrols-toolbar.png
-
- \code
- ApplicationWindow {
- visible:true
-
- header: ToolBar {
- RowLayout {
- anchors.fill: parent
- ToolButton {
- text: qsTr("\u25C0 %1").arg(Qt.application.name)
- enabled: stack.depth > 1
- onClicked: stack.pop()
- }
- Item { Layout.fillWidth: true }
- Switch {
- checked: true
- text: qsTr("Notifications")
- }
- }
- }
-
- StackView {
- id: stack
- anchors.fill: parent
- }
- }
- \endcode
-
- \labs
-
- \sa ApplicationWindow, ToolButton, {Customizing ToolBar}, {Container Controls}
-*/
-
-QQuickToolBar::QQuickToolBar(QQuickItem *parent) :
- QQuickFrame(parent)
-{
-}
-
-#ifndef QT_NO_ACCESSIBILITY
-QAccessible::Role QQuickToolBar::accessibleRole() const
-{
- return QAccessible::ToolBar;
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicktoolbar_p.h b/src/templates/qquicktoolbar_p.h
deleted file mode 100644
index 501f74c7..00000000
--- a/src/templates/qquicktoolbar_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTOOLBAR_P_H
-#define QQUICKTOOLBAR_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickframe_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LABSTEMPLATES_EXPORT QQuickToolBar : public QQuickFrame
-{
- Q_OBJECT
-
-public:
- explicit QQuickToolBar(QQuickItem *parent = Q_NULLPTR);
-
-protected:
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
-#endif
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickToolBar)
-
-#endif // QQUICKTOOLBAR_P_H
diff --git a/src/templates/qquicktoolbutton.cpp b/src/templates/qquicktoolbutton.cpp
deleted file mode 100644
index 775eedd1..00000000
--- a/src/templates/qquicktoolbutton.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktoolbutton_p.h"
-#include "qquickcontrol_p_p.h"
-
-#include <QtGui/qpa/qplatformtheme.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype ToolButton
- \inherits Button
- \instantiates QQuickToolButton
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-buttons
- \brief A tool button control.
-
- ToolButton is functionally similar to \l Button, but provides a look that
- is more suitable within a \l ToolBar.
-
- ### TODO: screenshot
-
- \code
- ToolBar {
- RowLayout {
- anchors.fill: parent
- ToolButton {
- text: qsTr("< %1").arg(Qt.application.name)
- enabled: stack.depth > 1
- onClicked: stack.pop()
- }
- Item { Layout.fillWidth: true }
- ToolButton {
- text: qsTr("< %1").arg(Qt.application.name)
- enabled: stack.depth > 1
- onClicked: stack.pop()
- }
- }
- }
- \endcode
-
- \labs
-
- \sa ToolBar, {Customizing ToolButton}, {Button Controls}
-*/
-
-QQuickToolButton::QQuickToolButton(QQuickItem *parent) :
- QQuickButton(parent)
-{
-}
-
-QFont QQuickToolButton::defaultFont() const
-{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ToolButtonFont);
-}
-
-QT_END_NAMESPACE
diff --git a/src/templates/qquicktoolbutton_p.h b/src/templates/qquicktoolbutton_p.h
deleted file mode 100644
index 25f2134d..00000000
--- a/src/templates/qquicktoolbutton_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTOOLBUTTON_P_H
-#define QQUICKTOOLBUTTON_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtLabsTemplates/private/qquickbutton_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_LABSTEMPLATES_EXPORT QQuickToolButton : public QQuickButton
-{
- Q_OBJECT
-
-public:
- explicit QQuickToolButton(QQuickItem *parent = Q_NULLPTR);
-
-protected:
- QFont defaultFont() const Q_DECL_OVERRIDE;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickToolButton)
-
-#endif // QQUICKTOOLBUTTON_P_H
diff --git a/src/templates/qquicktumbler.cpp b/src/templates/qquicktumbler.cpp
deleted file mode 100644
index c5b3f676..00000000
--- a/src/templates/qquicktumbler.cpp
+++ /dev/null
@@ -1,542 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktumbler_p.h"
-
-#include <QtQuick/private/qquickflickable_p.h>
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmltype Tumbler
- \inherits Control
- \instantiates QQuickTumbler
- \inqmlmodule Qt.labs.controls
- \ingroup qtlabscontrols-input
- \brief A spinnable wheel of items that can be selected.
-
- \code
- Tumbler {
- model: 5
- // ...
- }
- \endcode
-
- \section1 Non-wrapping Tumbler
-
- The default contentItem of Tumbler is a \l PathView, which wraps when it
- reaches the top and bottom. To achieve a non-wrapping Tumbler, use ListView
- as the contentItem:
-
- \snippet tst_tumbler.qml contentItem
-
- \image qtlabscontrols-tumbler-wrap.gif
-
- \labs
-
- \sa {Customizing Tumbler}, {Input Controls}
-*/
-
-class QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickTumbler)
-
-public:
- QQuickTumblerPrivate() :
- delegate(Q_NULLPTR),
- visibleItemCount(3)
- {
- }
-
- ~QQuickTumblerPrivate()
- {
- }
-
- QVariant model;
- QQmlComponent *delegate;
- int visibleItemCount;
-
- void _q_updateItemHeights();
- void _q_updateItemWidths();
-
- void itemChildAdded(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
- void itemChildRemoved(QQuickItem *, QQuickItem *) Q_DECL_OVERRIDE;
-};
-
-static QList<QQuickItem *> contentItemChildItems(QQuickItem *contentItem)
-{
- if (!contentItem)
- return QList<QQuickItem *>();
-
- // PathView has no contentItem property, but ListView does.
- QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(contentItem);
- return flickable ? flickable->contentItem()->childItems() : contentItem->childItems();
-}
-
-namespace {
- static inline qreal delegateHeight(const QQuickTumbler *tumbler)
- {
- return tumbler->availableHeight() / tumbler->visibleItemCount();
- }
-
- enum ContentItemType {
- UnsupportedContentItemType,
- PathViewContentItem,
- ListViewContentItem
- };
-
- static inline QQuickItem *actualContentItem(QQuickItem *rootContentItem, ContentItemType contentType)
- {
- if (contentType == PathViewContentItem)
- return rootContentItem;
- else if (contentType == ListViewContentItem)
- return qobject_cast<QQuickFlickable*>(rootContentItem)->contentItem();
-
- return Q_NULLPTR;
- }
-
- static inline ContentItemType contentItemType(QQuickItem *rootContentItem)
- {
- if (rootContentItem->inherits("QQuickPathView"))
- return PathViewContentItem;
- else if (rootContentItem->inherits("QQuickListView"))
- return ListViewContentItem;
-
- return UnsupportedContentItemType;
- }
-
- static inline ContentItemType contentItemTypeFromDelegate(QQuickItem *delegateItem)
- {
- if (delegateItem->parentItem()->inherits("QQuickPathView")) {
- return PathViewContentItem;
- } else if (delegateItem->parentItem()->parentItem()
- && delegateItem->parentItem()->parentItem()->inherits("QQuickListView")) {
- return ListViewContentItem;
- }
-
- return UnsupportedContentItemType;
- }
-}
-
-void QQuickTumblerPrivate::_q_updateItemHeights()
-{
- // Can't use our own private padding members here, as the padding property might be set,
- // which doesn't affect them, only their getters.
- Q_Q(const QQuickTumbler);
- const qreal itemHeight = delegateHeight(q);
- foreach (QQuickItem *childItem, contentItemChildItems(contentItem))
- childItem->setHeight(itemHeight);
-}
-
-void QQuickTumblerPrivate::_q_updateItemWidths()
-{
- Q_Q(const QQuickTumbler);
- const qreal availableWidth = q->availableWidth();
- foreach (QQuickItem *childItem, contentItemChildItems(contentItem))
- childItem->setWidth(availableWidth);
-}
-
-void QQuickTumblerPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
-{
- _q_updateItemWidths();
- _q_updateItemHeights();
-}
-
-void QQuickTumblerPrivate::itemChildRemoved(QQuickItem *, QQuickItem *)
-{
- _q_updateItemWidths();
- _q_updateItemHeights();
-}
-
-QQuickTumbler::QQuickTumbler(QQuickItem *parent) :
- QQuickControl(*(new QQuickTumblerPrivate), parent)
-{
- setActiveFocusOnTab(true);
-
- connect(this, SIGNAL(leftPaddingChanged()), this, SLOT(_q_updateItemWidths()));
- connect(this, SIGNAL(rightPaddingChanged()), this, SLOT(_q_updateItemWidths()));
- connect(this, SIGNAL(topPaddingChanged()), this, SLOT(_q_updateItemHeights()));
- connect(this, SIGNAL(bottomPaddingChanged()), this, SLOT(_q_updateItemHeights()));
-}
-
-QQuickTumbler::~QQuickTumbler()
-{
-}
-
-/*!
- \qmlproperty variant Qt.labs.controls::Tumbler::model
-
- This property holds the model that provides data for this tumbler.
-*/
-QVariant QQuickTumbler::model() const
-{
- Q_D(const QQuickTumbler);
- return d->model;
-}
-
-void QQuickTumbler::setModel(const QVariant &model)
-{
- Q_D(QQuickTumbler);
- if (model != d->model) {
- d->model = model;
- emit modelChanged();
- }
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::Tumbler::count
- \readonly
-
- This property holds the number of items in the model.
-*/
-int QQuickTumbler::count() const
-{
- Q_D(const QQuickTumbler);
- return d->contentItem->property("count").toInt();
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::Tumbler::currentIndex
-
- This property holds the index of the current item.
-*/
-int QQuickTumbler::currentIndex() const
-{
- Q_D(const QQuickTumbler);
- return d->contentItem ? d->contentItem->property("currentIndex").toInt() : -1;
-}
-
-void QQuickTumbler::setCurrentIndex(int currentIndex)
-{
- Q_D(QQuickTumbler);
- d->contentItem->setProperty("currentIndex", currentIndex);
-}
-
-/*!
- \qmlproperty Item Qt.labs.controls::Tumbler::currentItem
- \readonly
-
- This property holds the item at the current index.
-*/
-QQuickItem *QQuickTumbler::currentItem() const
-{
- Q_D(const QQuickTumbler);
- return d->contentItem ? d->contentItem->property("currentItem").value<QQuickItem*>() : Q_NULLPTR;
-}
-
-/*!
- \qmlproperty component Qt.labs.controls::Tumbler::delegate
-
- This property holds the delegate used to display each item.
-*/
-QQmlComponent *QQuickTumbler::delegate() const
-{
- Q_D(const QQuickTumbler);
- return d->delegate;
-}
-
-void QQuickTumbler::setDelegate(QQmlComponent *delegate)
-{
- Q_D(QQuickTumbler);
- if (delegate != d->delegate) {
- d->delegate = delegate;
- emit delegateChanged();
- }
-}
-
-/*!
- \qmlproperty int Qt.labs.controls::Tumbler::visibleItemCount
-
- This property holds the number of items visible in the tumbler. It must be
- an odd number, as the current item is always vertically centered.
-*/
-int QQuickTumbler::visibleItemCount() const
-{
- Q_D(const QQuickTumbler);
- return d->visibleItemCount;
-}
-
-void QQuickTumbler::setVisibleItemCount(int visibleItemCount)
-{
- Q_D(QQuickTumbler);
- if (visibleItemCount != d->visibleItemCount) {
- d->visibleItemCount = visibleItemCount;
- d->_q_updateItemHeights();
- emit visibleItemCountChanged();
- }
-}
-
-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 new QQuickTumblerAttached(delegateItem);
-}
-
-void QQuickTumbler::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickTumbler);
-
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
-
- d->_q_updateItemHeights();
-
- if (newGeometry.width() != oldGeometry.width())
- d->_q_updateItemWidths();
-}
-
-void QQuickTumbler::componentComplete()
-{
- Q_D(QQuickTumbler);
- QQuickControl::componentComplete();
- d->_q_updateItemHeights();
- d->_q_updateItemWidths();
-}
-
-void QQuickTumbler::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- Q_D(QQuickTumbler);
-
- QQuickControl::contentItemChange(newItem, oldItem);
-
- // Since we use the currentIndex of the contentItem directly, we must
- // ensure that we keep track of the currentIndex so it doesn't get lost
- // between contentItem changes.
- const int previousCurrentIndex = currentIndex();
-
- if (oldItem) {
- disconnect(oldItem, SIGNAL(currentIndexChanged()), this, SIGNAL(currentIndexChanged()));
- disconnect(oldItem, SIGNAL(currentItemChanged()), this, SIGNAL(currentItemChanged()));
- disconnect(oldItem, SIGNAL(countChanged()), this, SIGNAL(countChanged()));
-
- ContentItemType oldContentItemType = contentItemType(oldItem);
- QQuickItem *actualOldContentItem = actualContentItem(oldItem, oldContentItemType);
- QQuickItemPrivate *actualContentItemPrivate = QQuickItemPrivate::get(actualOldContentItem);
- actualContentItemPrivate->removeItemChangeListener(d, QQuickItemPrivate::Children);
- }
-
- if (newItem) {
- ContentItemType contentType = contentItemType(newItem);
- if (contentType == UnsupportedContentItemType) {
- qWarning() << "Tumbler: contentItems other than PathView and ListView are not supported";
- return;
- }
-
- connect(newItem, SIGNAL(currentIndexChanged()), this, SIGNAL(currentIndexChanged()));
- connect(newItem, SIGNAL(currentItemChanged()), this, SIGNAL(currentItemChanged()));
- connect(newItem, SIGNAL(countChanged()), this, SIGNAL(countChanged()));
-
- QQuickItem *actualNewContentItem = actualContentItem(newItem, contentType);
- QQuickItemPrivate *actualContentItemPrivate = QQuickItemPrivate::get(actualNewContentItem);
- actualContentItemPrivate->addItemChangeListener(d, QQuickItemPrivate::Children);
-
- // If the previous currentIndex is -1, it means we had no contentItem previously.
- if (previousCurrentIndex != -1) {
- // Can't call setCurrentIndex here, as contentItemChange() is
- // called *before* the contentItem is set.
- newItem->setProperty("currentIndex", previousCurrentIndex);
- }
- }
-}
-
-void QQuickTumbler::keyPressEvent(QKeyEvent *event)
-{
- Q_D(QQuickTumbler);
-
- QQuickControl::keyPressEvent(event);
-
- if (event->isAutoRepeat())
- return;
-
- if (event->key() == Qt::Key_Up) {
- QMetaObject::invokeMethod(d->contentItem, "decrementCurrentIndex");
- } else if (event->key() == Qt::Key_Down) {
- QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex");
- }
-}
-
-class QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
-{
- Q_DECLARE_PUBLIC(QQuickTumblerAttached)
-public:
- QQuickTumblerAttachedPrivate(QQuickItem *delegateItem) :
- tumbler(Q_NULLPTR),
- index(-1),
- displacement(1)
- {
- if (!delegateItem->parentItem()) {
- qWarning() << "Tumbler: attached properties must be accessed from within a delegate item that has a parent";
- return;
- }
-
- QVariant indexContextProperty = qmlContext(delegateItem)->contextProperty(QStringLiteral("index"));
- if (!indexContextProperty.isValid()) {
- qWarning() << "Tumbler: attempting to access attached property on item without an \"index\" property";
- return;
- }
-
- index = indexContextProperty.toInt();
- const ContentItemType contentItemType = contentItemTypeFromDelegate(delegateItem);
- if (contentItemType == UnsupportedContentItemType)
- return;
-
- // ListView has an "additional" content item.
- tumbler = qobject_cast<QQuickTumbler* >(contentItemType == PathViewContentItem
- ? delegateItem->parentItem()->parentItem() : delegateItem->parentItem()->parentItem()->parentItem());
- Q_ASSERT(tumbler);
- }
-
- ~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 _q_calculateDisplacement();
-
- // The Tumbler that contains the delegate. Required to calculated the displacement.
- QQuickTumbler *tumbler;
- // The index of the delegate. Used to calculate the displacement.
- int index;
- // The displacement for our delegate.
- qreal displacement;
-};
-
-void QQuickTumblerAttachedPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
-{
- _q_calculateDisplacement();
-}
-
-void QQuickTumblerAttachedPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
-{
- _q_calculateDisplacement();
-}
-
-void QQuickTumblerAttachedPrivate::itemChildRemoved(QQuickItem *item, QQuickItem *child)
-{
- _q_calculateDisplacement();
-
- if (parent == child) {
- // The child that was removed from the contentItem was the delegate
- // that our properties are attached to. If we don't remove the change
- // listener, the contentItem will attempt to notify a destroyed
- // listener, causing a crash.
-
- // item is the "actual content item" of Tumbler's contentItem, i.e. a PathView or ListView.contentItem
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- p->removeItemChangeListener(this, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
- }
-}
-
-void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
-{
- const int previousDisplacement = displacement;
- displacement = 0;
-
- // This can happen in tests, so it may happen in normal usage too.
- if (tumbler->count() == 0)
- return;
-
- ContentItemType contentType = contentItemType(tumbler->contentItem());
- if (contentType == UnsupportedContentItemType)
- return;
-
- qreal offset = 0;
-
- if (contentType == PathViewContentItem) {
- offset = tumbler->contentItem()->property("offset").toReal();
-
- displacement = tumbler->count() - index - offset;
- int halfVisibleItems = tumbler->visibleItemCount() / 2 + 1;
- if (displacement > halfVisibleItems)
- displacement -= tumbler->count();
- else if (displacement < -halfVisibleItems)
- displacement += tumbler->count();
- } else {
- const qreal contentY = tumbler->contentItem()->property("contentY").toReal();
- const qreal delegateH = delegateHeight(tumbler);
- const qreal preferredHighlightBegin = tumbler->contentItem()->property("preferredHighlightBegin").toReal();
- // Tumbler's displacement goes from negative at the top to positive towards the bottom, so we must switch this around.
- const qreal reverseDisplacement = (contentY + preferredHighlightBegin) / delegateH;
- displacement = reverseDisplacement - index;
- }
-
- Q_Q(QQuickTumblerAttached);
- if (displacement != previousDisplacement)
- emit q->displacementChanged();
-}
-
-QQuickTumblerAttached::QQuickTumblerAttached(QQuickItem *delegateItem) :
- QObject(*(new QQuickTumblerAttachedPrivate(delegateItem)), delegateItem)
-{
- Q_D(QQuickTumblerAttached);
- if (d->tumbler) {
- QQuickItem *rootContentItem = d->tumbler->contentItem();
- const ContentItemType contentType = contentItemType(rootContentItem);
- QQuickItemPrivate *p = QQuickItemPrivate::get(actualContentItem(rootContentItem, contentType));
- p->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
-
- const char *contentItemSignal = contentType == PathViewContentItem
- ? SIGNAL(offsetChanged()) : SIGNAL(contentYChanged());
- connect(d->tumbler->contentItem(), contentItemSignal, this, SLOT(_q_calculateDisplacement()));
- }
-}
-
-QQuickTumblerAttached::~QQuickTumblerAttached()
-{
-}
-
-QQuickTumbler *QQuickTumblerAttached::tumbler() const
-{
- Q_D(const QQuickTumblerAttached);
- return d->tumbler;
-}
-
-qreal QQuickTumblerAttached::displacement() const
-{
- Q_D(const QQuickTumblerAttached);
- return d->displacement;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qquicktumbler_p.cpp"
diff --git a/src/templates/qquicktumbler_p.h b/src/templates/qquicktumbler_p.h
deleted file mode 100644
index ad57acbb..00000000
--- a/src/templates/qquicktumbler_p.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKTUMBLER_H
-#define QQUICKTUMBLER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qvariant.h>
-#include <QtQml/qqmlcomponent.h>
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQuickTumblerAttached;
-class QQuickTumblerPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickTumbler : public QQuickControl
-{
- Q_OBJECT
- Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
- Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
- Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
- Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
- Q_PROPERTY(int visibleItemCount READ visibleItemCount WRITE setVisibleItemCount NOTIFY visibleItemCountChanged FINAL)
-
-public:
- explicit QQuickTumbler(QQuickItem *parent = Q_NULLPTR);
- ~QQuickTumbler();
-
- QVariant model() const;
- void setModel(const QVariant &model);
-
- int count() const;
-
- int currentIndex() const;
- void setCurrentIndex(int currentIndex);
- QQuickItem *currentItem() const;
-
- QQmlComponent *delegate() const;
- void setDelegate(QQmlComponent *delegate);
-
- int visibleItemCount() const;
- void setVisibleItemCount(int visibleItemCount);
-
- static QQuickTumblerAttached *qmlAttachedProperties(QObject *object);
-
-Q_SIGNALS:
- void modelChanged();
- void countChanged();
- void currentIndexChanged();
- void currentItemChanged();
- void delegateChanged();
- 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;
-
-private:
- Q_DISABLE_COPY(QQuickTumbler)
- Q_DECLARE_PRIVATE(QQuickTumbler)
-
- Q_PRIVATE_SLOT(d_func(), void _q_updateItemWidths())
- Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
-};
-
-class QQuickTumblerAttachedPrivate;
-
-class Q_LABSTEMPLATES_EXPORT QQuickTumblerAttached : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QQuickTumbler *tumbler READ tumbler CONSTANT)
- Q_PROPERTY(qreal displacement READ displacement NOTIFY displacementChanged FINAL)
-
-public:
- explicit QQuickTumblerAttached(QQuickItem *delegateItem);
- ~QQuickTumblerAttached();
-
- QQuickTumbler *tumbler() const;
- qreal displacement() const;
-
-Q_SIGNALS:
- void displacementChanged();
-
-private:
- Q_DISABLE_COPY(QQuickTumblerAttached)
- Q_DECLARE_PRIVATE(QQuickTumblerAttached)
-
- Q_PRIVATE_SLOT(d_func(), void _q_calculateDisplacement())
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QQuickTumbler)
-QML_DECLARE_TYPEINFO(QQuickTumbler, QML_HAS_ATTACHED_PROPERTIES)
-
-#endif // QQUICKTUMBLER_H
diff --git a/src/templates/qtlabstemplatesglobal_p.h b/src/templates/qtlabstemplatesglobal_p.h
deleted file mode 100644
index 432240e2..00000000
--- a/src/templates/qtlabstemplatesglobal_p.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Labs Templates module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTLABSTEMPLATESGLOBAL_P_H
-#define QTLABSTEMPLATESGLOBAL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_STATIC
-# if defined(QT_BUILD_LABSTEMPLATES_LIB)
-# define Q_LABSTEMPLATES_EXPORT Q_DECL_EXPORT
-# else
-# define Q_LABSTEMPLATES_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_LABSTEMPLATES_EXPORT
-#endif
-
-QT_END_NAMESPACE
-
-#endif // QTLABSTEMPLATESGLOBAL_P_H
diff --git a/src/templates/templates.pri b/src/templates/templates.pri
deleted file mode 100644
index c4651d82..00000000
--- a/src/templates/templates.pri
+++ /dev/null
@@ -1,97 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/qquickabstractbutton_p.h \
- $$PWD/qquickabstractbutton_p_p.h \
- $$PWD/qquickapplicationwindow_p.h \
- $$PWD/qquickbusyindicator_p.h \
- $$PWD/qquickbutton_p.h \
- $$PWD/qquickbuttongroup_p.h \
- $$PWD/qquickcheckbox_p.h \
- $$PWD/qquickcombobox_p.h \
- $$PWD/qquickcontainer_p.h \
- $$PWD/qquickcontainer_p_p.h \
- $$PWD/qquickcontrol_p.h \
- $$PWD/qquickcontrol_p_p.h \
- $$PWD/qquickdial_p.h \
- $$PWD/qquickdrawer_p.h \
- $$PWD/qquickframe_p.h \
- $$PWD/qquickframe_p_p.h \
- $$PWD/qquickgroupbox_p.h \
- $$PWD/qquickitemdelegate_p.h \
- $$PWD/qquicklabel_p.h \
- $$PWD/qquicklabel_p_p.h \
- $$PWD/qquickmenu_p.h \
- $$PWD/qquickmenu_p_p.h \
- $$PWD/qquickmenuitem_p.h \
- $$PWD/qquickoverlay_p.h \
- $$PWD/qquickpage_p.h \
- $$PWD/qquickpageindicator_p.h \
- $$PWD/qquickpane_p.h \
- $$PWD/qquickpane_p_p.h \
- $$PWD/qquickpopup_p.h \
- $$PWD/qquickpopup_p_p.h \
- $$PWD/qquickpressandholdhelper_p.h \
- $$PWD/qquickprogressbar_p.h \
- $$PWD/qquickradiobutton_p.h \
- $$PWD/qquickrangeslider_p.h \
- $$PWD/qquickscrollbar_p.h \
- $$PWD/qquickscrollindicator_p.h \
- $$PWD/qquickslider_p.h \
- $$PWD/qquickspinbox_p.h \
- $$PWD/qquickstackview_p.h \
- $$PWD/qquickstackview_p_p.h \
- $$PWD/qquickswipeview_p.h \
- $$PWD/qquickswitch_p.h \
- $$PWD/qquicktabbar_p.h \
- $$PWD/qquicktabbutton_p.h \
- $$PWD/qquicktextarea_p.h \
- $$PWD/qquicktextarea_p_p.h \
- $$PWD/qquicktextfield_p.h \
- $$PWD/qquicktextfield_p_p.h \
- $$PWD/qquicktoolbar_p.h \
- $$PWD/qquicktoolbutton_p.h \
- $$PWD/qquicktumbler_p.h
-
-SOURCES += \
- $$PWD/qquickabstractbutton.cpp \
- $$PWD/qquickapplicationwindow.cpp \
- $$PWD/qquickbusyindicator.cpp \
- $$PWD/qquickbutton.cpp \
- $$PWD/qquickbuttongroup.cpp \
- $$PWD/qquickcheckbox.cpp \
- $$PWD/qquickcombobox.cpp \
- $$PWD/qquickcontainer.cpp \
- $$PWD/qquickcontrol.cpp \
- $$PWD/qquickdial.cpp \
- $$PWD/qquickdrawer.cpp \
- $$PWD/qquickframe.cpp \
- $$PWD/qquickgroupbox.cpp \
- $$PWD/qquickitemdelegate.cpp \
- $$PWD/qquicklabel.cpp \
- $$PWD/qquickmenu.cpp \
- $$PWD/qquickmenuitem.cpp \
- $$PWD/qquickoverlay.cpp \
- $$PWD/qquickpage.cpp \
- $$PWD/qquickpageindicator.cpp \
- $$PWD/qquickpane.cpp \
- $$PWD/qquickpopup.cpp \
- $$PWD/qquickpressandholdhelper.cpp \
- $$PWD/qquickprogressbar.cpp \
- $$PWD/qquickradiobutton.cpp \
- $$PWD/qquickrangeslider.cpp \
- $$PWD/qquickscrollbar.cpp \
- $$PWD/qquickscrollindicator.cpp \
- $$PWD/qquickslider.cpp \
- $$PWD/qquickspinbox.cpp \
- $$PWD/qquickstackview.cpp \
- $$PWD/qquickstackview_p.cpp \
- $$PWD/qquickswipeview.cpp \
- $$PWD/qquickswitch.cpp \
- $$PWD/qquicktabbar.cpp \
- $$PWD/qquicktabbutton.cpp \
- $$PWD/qquicktextarea.cpp \
- $$PWD/qquicktextfield.cpp \
- $$PWD/qquicktoolbar.cpp \
- $$PWD/qquicktoolbutton.cpp \
- $$PWD/qquicktumbler.cpp
diff --git a/src/templates/templates.pro b/src/templates/templates.pro
deleted file mode 100644
index 36273577..00000000
--- a/src/templates/templates.pro
+++ /dev/null
@@ -1,14 +0,0 @@
-TARGET = QtLabsTemplates
-MODULE = labstemplates
-CONFIG += internal_module
-
-QT += quick
-QT_PRIVATE += core-private gui-private qml-private quick-private
-
-DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
-
-HEADERS += \
- $$PWD/qtlabstemplatesglobal_p.h
-
-include(templates.pri)
-load(qt_module)