aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/calendar/calendar.pro2
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png (renamed from src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png)bin5724 -> 5724 bytes
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png (renamed from src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png)bin7455 -> 7455 bytes
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png (renamed from src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png)bin2017 -> 2017 bytes
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png (renamed from src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png)bin8876 -> 8876 bytes
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png (renamed from src/imports/controls/doc/images/qtlabscalendar-monthgrid.png)bin3827 -> 3827 bytes
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png (renamed from src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png)bin4986 -> 4986 bytes
-rw-r--r--src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png (renamed from src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png)bin1453 -> 1453 bytes
-rw-r--r--src/imports/calendar/doc/qtlabscalendar.qdocconf37
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml)2
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml)0
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml)0
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml)0
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml)0
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml)0
-rw-r--r--src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml)0
-rw-r--r--src/imports/calendar/doc/src/qtlabscalendar-index.qdoc (renamed from src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc)8
-rw-r--r--src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc (renamed from src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc)0
-rw-r--r--src/imports/controls/AbstractButton.qml4
-rw-r--r--src/imports/controls/ApplicationWindow.qml12
-rw-r--r--src/imports/controls/BusyIndicator.qml8
-rw-r--r--src/imports/controls/Button.qml16
-rw-r--r--src/imports/controls/CheckBox.qml10
-rw-r--r--src/imports/controls/CheckDelegate.qml12
-rw-r--r--src/imports/controls/CheckIndicator.qml16
-rw-r--r--src/imports/controls/ComboBox.qml21
-rw-r--r--src/imports/controls/Container.qml4
-rw-r--r--src/imports/controls/Control.qml4
-rw-r--r--src/imports/controls/Dial.qml12
-rw-r--r--src/imports/controls/Dialog.qml79
-rw-r--r--src/imports/controls/DialogButtonBox.qml73
-rw-r--r--src/imports/controls/Drawer.qml10
-rw-r--r--src/imports/controls/Frame.qml10
-rw-r--r--src/imports/controls/GroupBox.qml12
-rw-r--r--src/imports/controls/ItemDelegate.qml12
-rw-r--r--src/imports/controls/Label.qml10
-rw-r--r--src/imports/controls/Menu.qml11
-rw-r--r--src/imports/controls/MenuItem.qml10
-rw-r--r--src/imports/controls/MenuSeparator.qml59
-rw-r--r--src/imports/controls/Page.qml20
-rw-r--r--src/imports/controls/PageIndicator.qml8
-rw-r--r--src/imports/controls/Pane.qml10
-rw-r--r--src/imports/controls/Popup.qml10
-rw-r--r--src/imports/controls/ProgressBar.qml10
-rw-r--r--src/imports/controls/RadioButton.qml10
-rw-r--r--src/imports/controls/RadioDelegate.qml12
-rw-r--r--src/imports/controls/RadioIndicator.qml12
-rw-r--r--src/imports/controls/RangeSlider.qml24
-rw-r--r--src/imports/controls/RoundButton.qml79
-rw-r--r--src/imports/controls/ScrollBar.qml8
-rw-r--r--src/imports/controls/ScrollIndicator.qml8
-rw-r--r--src/imports/controls/Slider.qml16
-rw-r--r--src/imports/controls/SpinBox.qml26
-rw-r--r--src/imports/controls/StackView.qml6
-rw-r--r--src/imports/controls/SwipeDelegate.qml12
-rw-r--r--src/imports/controls/SwipeView.qml7
-rw-r--r--src/imports/controls/Switch.qml10
-rw-r--r--src/imports/controls/SwitchDelegate.qml12
-rw-r--r--src/imports/controls/SwitchIndicator.qml16
-rw-r--r--src/imports/controls/TabBar.qml4
-rw-r--r--src/imports/controls/TabButton.qml12
-rw-r--r--src/imports/controls/TextArea.qml12
-rw-r--r--src/imports/controls/TextField.qml16
-rw-r--r--src/imports/controls/ToolBar.qml10
-rw-r--r--src/imports/controls/ToolButton.qml10
-rw-r--r--src/imports/controls/ToolSeparator.qml59
-rw-r--r--src/imports/controls/ToolTip.qml9
-rw-r--r--src/imports/controls/Tumbler.qml27
-rw-r--r--src/imports/controls/controls.pri11
-rw-r--r--src/imports/controls/controls.pro2
-rw-r--r--src/imports/controls/dependencies.json17
-rw-r--r--src/imports/controls/designer/ToolSeparatorSpecifics.qml71
-rw-r--r--src/imports/controls/designer/images/toolseparator-icon.pngbin0 -> 198 bytes
-rw-r--r--src/imports/controls/designer/images/toolseparator-icon16.pngbin0 -> 192 bytes
-rw-r--r--src/imports/controls/designer/images/toolseparator-icon16@2x.pngbin0 -> 213 bytes
-rw-r--r--src/imports/controls/designer/images/toolseparator-icon@2x.pngbin0 -> 239 bytes
-rw-r--r--src/imports/controls/designer/qtquickcontrols2.metainfo41
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.pngbin0 -> 1993 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.pngbin0 -> 1987 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.pngbin0 -> 5574 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-menuseparator.pngbin0 -> 5614 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-roundbutton.pngbin0 -> 1001 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.pngbin0 -> 4729 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolseparator.pngbin0 -> 7148 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gifbin54383 -> 54328 bytes
-rw-r--r--src/imports/controls/doc/qtquickcontrols2.qdocconf8
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.qml41
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml44
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml (renamed from src/imports/controls/doc/snippets/basic-example.qml)23
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml69
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.qml60
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml36
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml59
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml69
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml68
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.qml46
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml57
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml99
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml4
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml4
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml2
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml3
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml2
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc18
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc5
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc60
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc10
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc8
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc8
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc17
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc7
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-material.qdoc11
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc4
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-separators.qdoc63
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc11
-rw-r--r--src/imports/controls/material/ApplicationWindow.qml6
-rw-r--r--src/imports/controls/material/BoxShadow.qml7
-rw-r--r--src/imports/controls/material/BusyIndicator.qml8
-rw-r--r--src/imports/controls/material/Button.qml43
-rw-r--r--src/imports/controls/material/CheckBox.qml22
-rw-r--r--src/imports/controls/material/CheckDelegate.qml24
-rw-r--r--src/imports/controls/material/CheckIndicator.qml16
-rw-r--r--src/imports/controls/material/ComboBox.qml43
-rw-r--r--src/imports/controls/material/Dial.qml16
-rw-r--r--src/imports/controls/material/Dialog.qml105
-rw-r--r--src/imports/controls/material/DialogButtonBox.qml79
-rw-r--r--src/imports/controls/material/Drawer.qml10
-rw-r--r--src/imports/controls/material/ElevationEffect.qml22
-rw-r--r--src/imports/controls/material/Frame.qml10
-rw-r--r--src/imports/controls/material/GroupBox.qml12
-rw-r--r--src/imports/controls/material/ItemDelegate.qml23
-rw-r--r--src/imports/controls/material/Label.qml8
-rw-r--r--src/imports/controls/material/Menu.qml10
-rw-r--r--src/imports/controls/material/MenuItem.qml24
-rw-r--r--src/imports/controls/material/MenuSeparator.qml (renamed from src/imports/controls/material/Ripple.qml)24
-rw-r--r--src/imports/controls/material/Page.qml18
-rw-r--r--src/imports/controls/material/PageIndicator.qml8
-rw-r--r--src/imports/controls/material/Pane.qml10
-rw-r--r--src/imports/controls/material/Popup.qml10
-rw-r--r--src/imports/controls/material/ProgressBar.qml8
-rw-r--r--src/imports/controls/material/RadioButton.qml22
-rw-r--r--src/imports/controls/material/RadioDelegate.qml23
-rw-r--r--src/imports/controls/material/RadioIndicator.qml17
-rw-r--r--src/imports/controls/material/RangeSlider.qml12
-rw-r--r--src/imports/controls/material/RectangularGlow.qml240
-rw-r--r--src/imports/controls/material/RoundButton.qml113
-rw-r--r--src/imports/controls/material/ScrollBar.qml48
-rw-r--r--src/imports/controls/material/ScrollIndicator.qml6
-rw-r--r--src/imports/controls/material/Slider.qml11
-rw-r--r--src/imports/controls/material/SliderHandle.qml17
-rw-r--r--src/imports/controls/material/SpinBox.qml54
-rw-r--r--src/imports/controls/material/StackView.qml4
-rw-r--r--src/imports/controls/material/SwipeDelegate.qml28
-rw-r--r--src/imports/controls/material/SwipeView.qml5
-rw-r--r--src/imports/controls/material/Switch.qml19
-rw-r--r--src/imports/controls/material/SwitchDelegate.qml24
-rw-r--r--src/imports/controls/material/SwitchIndicator.qml19
-rw-r--r--src/imports/controls/material/TabBar.qml8
-rw-r--r--src/imports/controls/material/TabButton.qml17
-rw-r--r--src/imports/controls/material/TextArea.qml8
-rw-r--r--src/imports/controls/material/TextField.qml8
-rw-r--r--src/imports/controls/material/ToolBar.qml10
-rw-r--r--src/imports/controls/material/ToolButton.qml25
-rw-r--r--src/imports/controls/material/ToolSeparator.qml59
-rw-r--r--src/imports/controls/material/ToolTip.qml8
-rw-r--r--src/imports/controls/material/Tumbler.qml29
-rw-r--r--src/imports/controls/material/material.pri9
-rw-r--r--src/imports/controls/material/material.pro2
-rw-r--r--src/imports/controls/material/qmldir1
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring.cpp55
-rw-r--r--src/imports/controls/material/qquickmaterialprogressstrip.cpp19
-rw-r--r--src/imports/controls/material/qquickmaterialripple.cpp451
-rw-r--r--src/imports/controls/material/qquickmaterialripple_p.h119
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp133
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h33
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp9
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc3
-rw-r--r--src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag25
-rw-r--r--src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag21
-rw-r--r--src/imports/controls/material/shaders/RectangularGlow.frag19
-rw-r--r--src/imports/controls/plugins.qmltypes1455
-rw-r--r--src/imports/controls/qquickbusyindicatorring.cpp19
-rw-r--r--src/imports/controls/qquickdefaultstyle.cpp241
-rw-r--r--src/imports/controls/qquickdefaultstyle_p.h145
-rw-r--r--src/imports/controls/qquickprogressstrip.cpp22
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp33
-rw-r--r--src/imports/controls/universal/ApplicationWindow.qml8
-rw-r--r--src/imports/controls/universal/BusyIndicator.qml8
-rw-r--r--src/imports/controls/universal/Button.qml15
-rw-r--r--src/imports/controls/universal/CheckBox.qml8
-rw-r--r--src/imports/controls/universal/CheckDelegate.qml11
-rw-r--r--src/imports/controls/universal/CheckIndicator.qml23
-rw-r--r--src/imports/controls/universal/ComboBox.qml18
-rw-r--r--src/imports/controls/universal/Dial.qml9
-rw-r--r--src/imports/controls/universal/Dialog.qml87
-rw-r--r--src/imports/controls/universal/DialogButtonBox.qml77
-rw-r--r--src/imports/controls/universal/Drawer.qml8
-rw-r--r--src/imports/controls/universal/Frame.qml8
-rw-r--r--src/imports/controls/universal/GroupBox.qml8
-rw-r--r--src/imports/controls/universal/ItemDelegate.qml11
-rw-r--r--src/imports/controls/universal/Label.qml6
-rw-r--r--src/imports/controls/universal/Menu.qml8
-rw-r--r--src/imports/controls/universal/MenuItem.qml9
-rw-r--r--src/imports/controls/universal/MenuSeparator.qml60
-rw-r--r--src/imports/controls/universal/Page.qml18
-rw-r--r--src/imports/controls/universal/PageIndicator.qml6
-rw-r--r--src/imports/controls/universal/Pane.qml8
-rw-r--r--src/imports/controls/universal/Popup.qml8
-rw-r--r--src/imports/controls/universal/ProgressBar.qml8
-rw-r--r--src/imports/controls/universal/RadioButton.qml8
-rw-r--r--src/imports/controls/universal/RadioDelegate.qml11
-rw-r--r--src/imports/controls/universal/RadioIndicator.qml10
-rw-r--r--src/imports/controls/universal/RangeSlider.qml17
-rw-r--r--src/imports/controls/universal/RoundButton.qml85
-rw-r--r--src/imports/controls/universal/ScrollBar.qml9
-rw-r--r--src/imports/controls/universal/ScrollIndicator.qml6
-rw-r--r--src/imports/controls/universal/Slider.qml13
-rw-r--r--src/imports/controls/universal/SpinBox.qml25
-rw-r--r--src/imports/controls/universal/StackView.qml6
-rw-r--r--src/imports/controls/universal/SwipeDelegate.qml9
-rw-r--r--src/imports/controls/universal/Switch.qml6
-rw-r--r--src/imports/controls/universal/SwitchDelegate.qml11
-rw-r--r--src/imports/controls/universal/SwitchIndicator.qml32
-rw-r--r--src/imports/controls/universal/TabBar.qml6
-rw-r--r--src/imports/controls/universal/TabButton.qml10
-rw-r--r--src/imports/controls/universal/TextArea.qml9
-rw-r--r--src/imports/controls/universal/TextField.qml9
-rw-r--r--src/imports/controls/universal/ToolBar.qml8
-rw-r--r--src/imports/controls/universal/ToolButton.qml16
-rw-r--r--src/imports/controls/universal/ToolSeparator.qml59
-rw-r--r--src/imports/controls/universal/ToolTip.qml6
-rw-r--r--src/imports/controls/universal/Tumbler.qml27
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring.cpp4
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip.cpp12
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp12
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle_p.h2
-rw-r--r--src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp2
-rw-r--r--src/imports/controls/universal/universal.pri5
-rw-r--r--src/imports/controls/universal/universal.pro2
-rw-r--r--src/imports/imports.pro1
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-colordialog-gtk.pngbin0 -> 11057 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-filedialog-gtk.pngbin0 -> 49506 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-folderdialog-gtk.pngbin0 -> 49092 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-fontdialog-gtk.pngbin0 -> 43653 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-menu.pngbin0 -> 6377 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-menubar.pngbin0 -> 71036 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-messagedialog-android.pngbin0 -> 7946 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-messagedialog-informative-android.pngbin0 -> 15759 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-menu.pngbin0 -> 24016 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-message.pngbin0 -> 36932 bytes
-rw-r--r--src/imports/platform/doc/images/qtlabsplatform-systemtrayicon.pngbin0 -> 19927 bytes
-rw-r--r--src/imports/platform/doc/qtlabsplatform.qdocconf37
-rw-r--r--src/imports/platform/doc/src/includes/widgets.qdocinc29
-rw-r--r--src/imports/platform/doc/src/qtlabsplatform-index.qdoc50
-rw-r--r--src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc58
-rw-r--r--src/imports/platform/platform.pri31
-rw-r--r--src/imports/platform/platform.pro22
-rw-r--r--src/imports/platform/plugins.qmltypes460
-rw-r--r--src/imports/platform/qmldir3
-rw-r--r--src/imports/platform/qquickplatformcolordialog.cpp205
-rw-r--r--src/imports/platform/qquickplatformcolordialog_p.h98
-rw-r--r--src/imports/platform/qquickplatformdialog.cpp409
-rw-r--r--src/imports/platform/qquickplatformdialog_p.h153
-rw-r--r--src/imports/platform/qquickplatformfiledialog.cpp660
-rw-r--r--src/imports/platform/qquickplatformfiledialog_p.h196
-rw-r--r--src/imports/platform/qquickplatformfolderdialog.cpp281
-rw-r--r--src/imports/platform/qquickplatformfolderdialog_p.h110
-rw-r--r--src/imports/platform/qquickplatformfontdialog.cpp208
-rw-r--r--src/imports/platform/qquickplatformfontdialog_p.h98
-rw-r--r--src/imports/platform/qquickplatformiconloader.cpp111
-rw-r--r--src/imports/platform/qquickplatformiconloader_p.h89
-rw-r--r--src/imports/platform/qquickplatformmenu.cpp835
-rw-r--r--src/imports/platform/qquickplatformmenu_p.h213
-rw-r--r--src/imports/platform/qquickplatformmenubar.cpp330
-rw-r--r--src/imports/platform/qquickplatformmenubar_p.h120
-rw-r--r--src/imports/platform/qquickplatformmenuitem.cpp612
-rw-r--r--src/imports/platform/qquickplatformmenuitem_p.h191
-rw-r--r--src/imports/platform/qquickplatformmenuitemgroup.cpp390
-rw-r--r--src/imports/platform/qquickplatformmenuitemgroup_p.h123
-rw-r--r--src/imports/platform/qquickplatformmenuseparator.cpp65
-rw-r--r--src/imports/platform/qquickplatformmenuseparator_p.h67
-rw-r--r--src/imports/platform/qquickplatformmessagedialog.cpp383
-rw-r--r--src/imports/platform/qquickplatformmessagedialog_p.h121
-rw-r--r--src/imports/platform/qquickplatformstandardpaths.cpp159
-rw-r--r--src/imports/platform/qquickplatformstandardpaths_p.h90
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon.cpp441
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon_p.h139
-rw-r--r--src/imports/platform/qtlabsplatformplugin.cpp115
-rw-r--r--src/imports/platform/widgets/qwidgetplatform_p.h125
-rw-r--r--src/imports/platform/widgets/qwidgetplatformcolordialog.cpp87
-rw-r--r--src/imports/platform/widgets/qwidgetplatformcolordialog_p.h78
-rw-r--r--src/imports/platform/widgets/qwidgetplatformdialog.cpp58
-rw-r--r--src/imports/platform/widgets/qwidgetplatformdialog_p.h66
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfiledialog.cpp140
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfiledialog_p.h84
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfontdialog.cpp87
-rw-r--r--src/imports/platform/widgets/qwidgetplatformfontdialog_p.h78
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenu.cpp186
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenu_p.h99
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenuitem.cpp131
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmenuitem_p.h89
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp85
-rw-r--r--src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h75
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp114
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h85
-rw-r--r--src/imports/platform/widgets/widgets.pri23
-rw-r--r--src/imports/templates/dependencies.json12
-rw-r--r--src/imports/templates/doc/src/qtquicktemplates2-index.qdoc (renamed from src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc)0
-rw-r--r--src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc (renamed from src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc)2
-rw-r--r--src/imports/templates/plugins.qmltypes1141
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp28
-rw-r--r--src/imports/templates/templates.pro2
-rw-r--r--src/quickcontrols2/qquickpaddedrectangle.cpp2
-rw-r--r--src/quickcontrols2/qquickproxytheme.cpp6
-rw-r--r--src/quickcontrols2/qquickproxytheme_p.h3
-rw-r--r--src/quickcontrols2/qquickstyle.cpp154
-rw-r--r--src/quickcontrols2/qquickstyle.h1
-rw-r--r--src/quickcontrols2/qquickstyle_p.h67
-rw-r--r--src/quickcontrols2/qquickstyleattached.cpp21
-rw-r--r--src/quickcontrols2/qquickstyleselector.cpp92
-rw-r--r--src/quickcontrols2/qquickstyleselector_p_p.h5
-rw-r--r--src/quickcontrols2/qquicktumblerview.cpp273
-rw-r--r--src/quickcontrols2/qquicktumblerview_p.h109
-rw-r--r--src/quickcontrols2/quickcontrols2.pri7
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp27
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p.h2
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h2
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp25
-rw-r--r--src/quicktemplates2/qquickbutton.cpp34
-rw-r--r--src/quicktemplates2/qquickbutton_p.h5
-rw-r--r--src/quicktemplates2/qquickbutton_p_p.h68
-rw-r--r--src/quicktemplates2/qquickbuttongroup.cpp38
-rw-r--r--src/quicktemplates2/qquickbuttongroup_p.h1
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp33
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h5
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp32
-rw-r--r--src/quicktemplates2/qquickcontainer_p.h2
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp119
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h5
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h7
-rw-r--r--src/quicktemplates2/qquickdialog.cpp363
-rw-r--r--src/quicktemplates2/qquickdialog_p.h114
-rw-r--r--src/quicktemplates2/qquickdialog_p_p.h78
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp672
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p.h155
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p_p.h107
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp2
-rw-r--r--src/quicktemplates2/qquickmenu.cpp2
-rw-r--r--src/quicktemplates2/qquickmenu_p_p.h2
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp16
-rw-r--r--src/quicktemplates2/qquickmenuitem_p.h3
-rw-r--r--src/quicktemplates2/qquickmenuseparator.cpp80
-rw-r--r--src/quicktemplates2/qquickmenuseparator_p.h75
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp4
-rw-r--r--src/quicktemplates2/qquickoverlay_p_p.h2
-rw-r--r--src/quicktemplates2/qquickpage.cpp199
-rw-r--r--src/quicktemplates2/qquickpage_p.h11
-rw-r--r--src/quicktemplates2/qquickpagelayout.cpp190
-rw-r--r--src/quicktemplates2/qquickpagelayout_p_p.h86
-rw-r--r--src/quicktemplates2/qquickpane.cpp12
-rw-r--r--src/quicktemplates2/qquickpane_p_p.h2
-rw-r--r--src/quicktemplates2/qquickpopup.cpp72
-rw-r--r--src/quicktemplates2/qquickpopup_p.h7
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h3
-rw-r--r--src/quicktemplates2/qquickpresshandler.cpp42
-rw-r--r--src/quicktemplates2/qquickpresshandler_p_p.h2
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp63
-rw-r--r--src/quicktemplates2/qquickrangeslider_p.h8
-rw-r--r--src/quicktemplates2/qquickroundbutton.cpp143
-rw-r--r--src/quicktemplates2/qquickroundbutton_p.h84
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp40
-rw-r--r--src/quicktemplates2/qquickscrollbar_p.h2
-rw-r--r--src/quicktemplates2/qquickscrollindicator.cpp20
-rw-r--r--src/quicktemplates2/qquickslider.cpp36
-rw-r--r--src/quicktemplates2/qquickslider_p.h2
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp59
-rw-r--r--src/quicktemplates2/qquickspinbox_p.h8
-rw-r--r--src/quicktemplates2/qquickstackview.cpp145
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp252
-rw-r--r--src/quicktemplates2/qquickstackview_p.h14
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h26
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp233
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p.h28
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp155
-rw-r--r--src/quicktemplates2/qquickswipeview_p.h15
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp4
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp143
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h15
-rw-r--r--src/quicktemplates2/qquicktextarea_p_p.h6
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp129
-rw-r--r--src/quicktemplates2/qquicktextfield_p.h17
-rw-r--r--src/quicktemplates2/qquicktextfield_p_p.h4
-rw-r--r--src/quicktemplates2/qquicktoolseparator.cpp146
-rw-r--r--src/quicktemplates2/qquicktoolseparator_p.h90
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp2
-rw-r--r--src/quicktemplates2/qquicktooltip_p.h2
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp594
-rw-r--r--src/quicktemplates2/qquicktumbler_p.h11
-rw-r--r--src/quicktemplates2/qquicktumbler_p_p.h113
-rw-r--r--src/quicktemplates2/quicktemplates2.pri16
475 files changed, 20178 insertions, 3768 deletions
diff --git a/src/imports/calendar/calendar.pro b/src/imports/calendar/calendar.pro
index 8e9446cc..981860b5 100644
--- a/src/imports/calendar/calendar.pro
+++ b/src/imports/calendar/calendar.pro
@@ -7,6 +7,8 @@ QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+QMAKE_DOCS = $$PWD/doc/qtlabscalendar.qdocconf
+
OTHER_FILES += \
qmldir
diff --git a/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png b/src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png
index 7a140d27..7a140d27 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-calendarmodel.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-calendarmodel.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png b/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png
index 130e3757..130e3757 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow-layout.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow-layout.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png b/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png
index 6c8424ab..6c8424ab 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-dayofweekrow.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-dayofweekrow.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png b/src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png
index dd903650..dd903650 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-monthgrid-layout.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-monthgrid-layout.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png b/src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png
index 0c3b3c41..0c3b3c41 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-monthgrid.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-monthgrid.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png b/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png
index b015a3e6..b015a3e6 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn-layout.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn-layout.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png b/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png
index 65e25b29..65e25b29 100644
--- a/src/imports/controls/doc/images/qtlabscalendar-weeknumbercolumn.png
+++ b/src/imports/calendar/doc/images/qtlabscalendar-weeknumbercolumn.png
Binary files differ
diff --git a/src/imports/calendar/doc/qtlabscalendar.qdocconf b/src/imports/calendar/doc/qtlabscalendar.qdocconf
new file mode 100644
index 00000000..0e230aa1
--- /dev/null
+++ b/src/imports/calendar/doc/qtlabscalendar.qdocconf
@@ -0,0 +1,37 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtLabsCalendar
+description = Qt Labs Calendar Reference Documentation
+version = $QT_VERSION
+
+qhp.projects = QtLabsCalendar
+
+qhp.QtLabsCalendar.file = qtlabscalendar.qhp
+qhp.QtLabsCalendar.namespace = org.qt-project.qtlabscalendar.$QT_VERSION_TAG
+qhp.QtLabsCalendar.virtualFolder = qtlabscalendar
+qhp.QtLabsCalendar.indexTitle = Qt Labs Calendar
+qhp.QtLabsCalendar.indexRoot =
+
+qhp.QtLabsCalendar.filterAttributes = qtlabscalendar $QT_VERSION qtrefdoc
+qhp.QtLabsCalendar.customFilters.Qt.name = QtLabsCalendar $QT_VERSION
+qhp.QtLabsCalendar.customFilters.Qt.filterAttributes = qtlabscalendar $QT_VERSION
+
+qhp.QtLabsCalendar.subprojects = qmltypes
+qhp.QtLabsCalendar.subprojects.qmltypes.title = QML Types
+qhp.QtLabsCalendar.subprojects.qmltypes.indexTitle = Qt Labs Calendar QML Types
+qhp.QtLabsCalendar.subprojects.qmltypes.selectors = qmlclass
+qhp.QtLabsCalendar.subprojects.qmltypes.sortPages = true
+
+depends = qtcore qtgui qtdoc qtqml qtquick qtquickcontrols2
+
+headerdirs += ../
+sourcedirs += ../ src
+exampledirs += ../ snippets
+imagedirs += images
+
+navigation.landingpage = "Qt Labs Calendar"
+navigation.qmltypespage = "Qt Labs Calendar QML Types"
+
+tagfile = qtlabscalendar.tags
+
+macro.labs = "\\note \\e{Types in Qt.labs modules are not guaranteed to remain compatible in future versions.}"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml
index dfbf4fbc..37a6ced7 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import Qt.labs.calendar 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
ListView {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml
index ce41d224..ce41d224 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml
index 5ea3714c..5ea3714c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml
index 346e6099..346e6099 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml
index 16f872b8..16f872b8 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml
index d105553f..d105553f 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml b/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml
index e58e5c7b..e58e5c7b 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml
+++ b/src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml
diff --git a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc b/src/imports/calendar/doc/src/qtlabscalendar-index.qdoc
index d99b3880..9456f1cb 100644
--- a/src/imports/controls/doc/src/calendar/qtlabscalendar-index.qdoc
+++ b/src/imports/calendar/doc/src/qtlabscalendar-index.qdoc
@@ -29,11 +29,11 @@
\page qtlabscalendar-index.html
\title Qt Labs Calendar
- \brief The Qt Labs Calendar module provides a set of UI controls for Qt
- Quick.
+ \brief The experimental Qt Labs Calendar module provides a set of UI controls
+ for Qt Quick.
- The Qt Labs Calendar module provides a set of types that can be used
- to build calendars in Qt Quick.
+ The experimental Qt Labs Calendar module provides a set of types that can be
+ used to build calendars in Qt Quick. The module was introduced in Qt 5.7.
\section1 QML Types
diff --git a/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc b/src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc
index a94e5ec6..a94e5ec6 100644
--- a/src/imports/controls/doc/src/calendar/qtlabscalendar.qdoc
+++ b/src/imports/calendar/doc/src/qtlabscalendar-qmltypes.qdoc
diff --git a/src/imports/controls/AbstractButton.qml b/src/imports/controls/AbstractButton.qml
index 487b452b..a45c6816 100644
--- a/src/imports/controls/AbstractButton.qml
+++ b/src/imports/controls/AbstractButton.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
T.AbstractButton {
id: control
diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml
index 98de8946..e82430e5 100644
--- a/src/imports/controls/ApplicationWindow.qml
+++ b/src/imports/controls/ApplicationWindow.qml
@@ -34,20 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
import QtQuick.Window 2.2
-import QtQuick.Templates 2.0 as T
+import QtQuick.Templates 2.1 as T
T.ApplicationWindow {
id: window
- color: "#ffffff"
+ color: Default.backgroundColor
overlay.modal: Rectangle {
- color: "#7f28282a"
+ color: Default.overlayModalColor
}
overlay.modeless: Rectangle {
- color: "#1f28282a"
+ color: Default.overlayDimColor
}
}
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index 9be1f046..171e5869 100644
--- a/src/imports/controls/BusyIndicator.qml
+++ b/src/imports/controls/BusyIndicator.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.BusyIndicator {
id: control
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
index 1a974eed..85d52b12 100644
--- a/src/imports/controls/Button.qml
+++ b/src/imports/controls/Button.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Button {
id: control
@@ -54,7 +56,9 @@ T.Button {
text: control.text
font: control.font
opacity: enabled || control.highlighted || control.checked ? 1 : 0.3
- color: control.checked || control.highlighted ? "#ffffff" : (control.visualFocus ? "#0066ff" : (control.down ? "#26282a" : "#353637"))
+ color: control.checked || control.highlighted ?
+ Default.textLightColor :
+ (control.visualFocus ? Default.focusColor : (control.down ? Default.textDarkColor : Default.textColor))
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
@@ -65,9 +69,9 @@ T.Button {
implicitHeight: 40
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"
+ (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.textColor)) :
+ (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor))
+ border.color: Default.focusColor
border.width: control.visualFocus ? 2 : 0
}
}
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index 632097b1..98fb31e1 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
T.CheckBox {
id: control
@@ -64,7 +64,7 @@ T.CheckBox {
text: control.text
font: control.font
- color: control.down ? "#26282a" : "#353637"
+ color: control.down ? Default.textDarkColor : Default.textColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml
index 96cb48e0..929dc4b5 100644
--- a/src/imports/controls/CheckDelegate.qml
+++ b/src/imports/controls/CheckDelegate.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
T.CheckDelegate {
id: control
@@ -58,7 +58,7 @@ T.CheckDelegate {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -76,6 +76,6 @@ T.CheckDelegate {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted
- color: control.down ? "#bdbebf" : "#eeeeee"
+ color: control.down ? Default.delegatePressedColor : Default.delegateColor
}
}
diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml
index 5aad92ef..9078e0c6 100644
--- a/src/imports/controls/CheckIndicator.qml
+++ b/src/imports/controls/CheckIndicator.qml
@@ -34,7 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
Rectangle {
id: indicator
@@ -44,15 +46,19 @@ Rectangle {
implicitWidth: 28
implicitHeight: 28
- color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : "#ffffff") : "#353637"
+ color: control.enabled ? (control.down
+ ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor)
+ : Default.backgroundColor) : Default.disabledDarkColor
border.width: control.visualFocus ? 2 : 1
- border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "transparent"
+ border.color: control.enabled ? (control.visualFocus
+ ? Default.focusColor
+ : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : "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")
+ source: "image://default/check/" + (control.visualFocus ? Default.focusColor : Default.textColor)
sourceSize.width: width
sourceSize.height: height
visible: control.checkState === Qt.Checked
@@ -63,7 +69,7 @@ Rectangle {
y: (parent.height - height) / 2
width: 16
height: 3
- color: control.visualFocus ? "#0066ff" : "#353637"
+ color: control.visualFocus ? Default.focusColor : Default.frameDarkColor
visible: control.checkState === Qt.PartiallyChecked
}
}
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 31f2e5d9..e174a70d 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -34,10 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
import QtQuick.Window 2.2
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ComboBox {
id: control
@@ -59,12 +60,13 @@ T.ComboBox {
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex == index
+ hoverEnabled: control.hoverEnabled
}
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")
+ source: "image://default/double-arrow/" + (control.visualFocus ? Default.focusColor : Default.textColor)
sourceSize.width: width
sourceSize.height: height
opacity: enabled ? 1 : 0.3
@@ -76,7 +78,7 @@ T.ComboBox {
text: control.displayText
font: control.font
- color: control.visualFocus ? "#0066ff" : "#353637"
+ color: control.visualFocus ? Default.focusColor : Default.textColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
@@ -87,10 +89,11 @@ T.ComboBox {
implicitWidth: 120
implicitHeight: 40
- color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#f0f6ff") :
- (control.pressed || popup.visible ? "#d0d0d0" : "#e0e0e0")
- border.color: "#0066ff"
+ color: control.visualFocus ? (control.pressed ? Default.focusPressedColor : Default.focusLightColor) :
+ (control.pressed || popup.visible ? Default.buttonPressedColor : Default.buttonColor)
+ border.color: Default.focusColor
border.width: control.visualFocus ? 2 : 0
+ visible: !control.flat || control.pressed
}
popup: T.Popup {
@@ -115,7 +118,7 @@ T.ComboBox {
width: listview.width
height: listview.height
color: "transparent"
- border.color: "#bdbebf"
+ border.color: Default.frameLightColor
}
T.ScrollIndicator.vertical: ScrollIndicator { }
diff --git a/src/imports/controls/Container.qml b/src/imports/controls/Container.qml
index 9e9215f8..d3aa89bc 100644
--- a/src/imports/controls/Container.qml
+++ b/src/imports/controls/Container.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
T.Container {
id: control
diff --git a/src/imports/controls/Control.qml b/src/imports/controls/Control.qml
index a4bb95fe..92b1cfd2 100644
--- a/src/imports/controls/Control.qml
+++ b/src/imports/controls/Control.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
T.Control {
id: control
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index cd4d6ba2..67c3b0fb 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Dial {
id: control
@@ -48,7 +48,7 @@ T.Dial {
background: DialRing {
width: control.availableWidth
height: control.availableHeight
- color: control.visualFocus ? "#0066ff" : "#353637"
+ color: control.visualFocus ? Default.focusColor : Default.frameDarkColor
progress: control.position
opacity: control.enabled ? 1 : 0.3
}
@@ -59,7 +59,7 @@ T.Dial {
y: background.y + background.height / 2 - handle.height / 2
width: 14
height: 10
- source: "image://default/dial-indicator/" + (control.visualFocus ? "#0066ff" : "#353637")
+ source: "image://default/dial-indicator/" + (control.visualFocus ? Default.focusColor : Default.textColor)
sourceSize.width: width
sourceSize.height: height
antialiasing: true
diff --git a/src/imports/controls/Dialog.qml b/src/imports/controls/Dialog.qml
new file mode 100644
index 00000000..1cf64164
--- /dev/null
+++ b/src/imports/controls/Dialog.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+
+T.Dialog {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0,
+ contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (header && header.visible ? header.implicitHeight + spacing : 0)
+ + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
+ + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
+ padding: 12
+
+ background: Rectangle {
+ border.color: Default.frameDarkColor
+ }
+
+ header: Label {
+ text: control.title
+ visible: control.title
+ elide: Label.ElideRight
+ font.bold: true
+ padding: 12
+ background: Rectangle {
+ x: 1; y: 1
+ width: parent.width - 2
+ height: parent.height - 1
+ }
+ }
+
+ footer: DialogButtonBox {
+ visible: count > 0
+ }
+}
diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml
new file mode 100644
index 00000000..9f4ebce5
--- /dev/null
+++ b/src/imports/controls/DialogButtonBox.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.8
+import QtQuick.Templates 2.1 as T
+
+T.DialogButtonBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ spacing: 1
+ padding: 12
+ alignment: count === 1 ? Qt.AlignRight : undefined
+
+ delegate: Button {
+ width: control.count === 1 ? control.availableWidth / 2 : undefined
+ }
+
+ contentItem: ListView {
+ implicitWidth: contentWidth
+ implicitHeight: 40
+
+ model: control.contentModel
+ spacing: control.spacing
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+ }
+
+ background: Rectangle {
+ implicitHeight: 40
+ x: 1; y: 1
+ width: parent.width - 2
+ height: parent.height - 2
+ }
+}
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml
index 6e9ab71f..a90893d9 100644
--- a/src/imports/controls/Drawer.qml
+++ b/src/imports/controls/Drawer.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Drawer {
id: control
@@ -56,14 +58,12 @@ T.Drawer {
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"
+ color: Default.frameDarkColor
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 b7968cb4..6086d92b 100644
--- a/src/imports/controls/Frame.qml
+++ b/src/imports/controls/Frame.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Frame {
id: control
@@ -48,10 +50,8 @@ T.Frame {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
color: "transparent"
- border.color: "#bdbebf"
+ border.color: Default.frameLightColor
}
}
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index 31f4963f..4f083b15 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.GroupBox {
id: control
@@ -52,15 +54,13 @@ T.GroupBox {
padding: 12
topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- contentItem: Item { }
-
label: Text {
x: control.leftPadding
width: control.availableWidth
text: control.title
font: control.font
- color: control.enabled ? "#353637" : "#bdbebf"
+ color: control.enabled ? Default.textColor : Default.textDisabledColor
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
@@ -72,6 +72,6 @@ T.GroupBox {
height: parent.height - control.topPadding + control.padding
color: "transparent"
- border.color: "#bdbebf"
+ border.color: Default.frameLightColor
}
}
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index 519ef3bf..23d72080 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ItemDelegate {
id: control
@@ -56,7 +58,7 @@ T.ItemDelegate {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -67,6 +69,8 @@ T.ItemDelegate {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted || control.visualFocus
- color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee")
+ color: control.visualFocus
+ ? (control.pressed ? Default.focusPressedColor : Default.delegateFocusColor)
+ : (control.down ? Default.delegatePressedColor : Default.delegateColor)
}
}
diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml
index d0f01613..c492cd7a 100644
--- a/src/imports/controls/Label.qml
+++ b/src/imports/controls/Label.qml
@@ -34,12 +34,14 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Label {
id: control
- color: "#26282a"
- linkColor: "#45a7d7" // TODO
+ color: Default.textDarkColor
+ linkColor: Default.textLinkColor
}
diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml
index d9a97cee..e449f6d1 100644
--- a/src/imports/controls/Menu.qml
+++ b/src/imports/controls/Menu.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Menu {
id: control
@@ -63,7 +64,7 @@ T.Menu {
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
- color: "#ffffff"
- border.color: "#353637"
+ color: Default.backgroundColor
+ border.color: Default.frameDarkColor
}
}
diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml
index 69f00900..cd224393 100644
--- a/src/imports/controls/MenuItem.qml
+++ b/src/imports/controls/MenuItem.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.MenuItem {
id: control
@@ -55,7 +57,7 @@ T.MenuItem {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -79,7 +81,7 @@ T.MenuItem {
y: 1
width: parent.width - 2
height: parent.height - 2
- color: control.visualFocus || control.down ? "#eeeeee" : "transparent"
+ color: control.visualFocus || control.down ? Default.delegateColor : "transparent"
}
}
}
diff --git a/src/imports/controls/MenuSeparator.qml b/src/imports/controls/MenuSeparator.qml
new file mode 100644
index 00000000..ef075ef9
--- /dev/null
+++ b/src/imports/controls/MenuSeparator.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
+
+T.MenuSeparator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+
+ padding: 2
+ topPadding: padding + 4
+ bottomPadding: padding + 4
+
+ //! [contentItem]
+ contentItem: Rectangle {
+ implicitWidth: 188
+ implicitHeight: 1
+ color: Default.separatorColor
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml
index 4ed7efb1..02f81e07 100644
--- a/src/imports/controls/Page.qml
+++ b/src/imports/controls/Page.qml
@@ -34,15 +34,27 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Page {
id: control
- contentItem: Item { }
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(contentWidth,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentHeight + topPadding + bottomPadding
+ + (header && header.visible ? header.implicitHeight + spacing : 0)
+ + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
background: Rectangle {
- color: "#ffffff"
+ color: Default.backgroundColor
}
}
diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml
index 933bc839..0273af98 100644
--- a/src/imports/controls/PageIndicator.qml
+++ b/src/imports/controls/PageIndicator.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.PageIndicator {
id: control
@@ -53,7 +55,7 @@ T.PageIndicator {
implicitHeight: 8
radius: width / 2
- color: "#28282a" // TODO
+ color: Default.pageIndicatorColor
opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45
Behavior on opacity { OpacityAnimator { duration: 100 } }
diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml
index feb8eb58..2aeeee5d 100644
--- a/src/imports/controls/Pane.qml
+++ b/src/imports/controls/Pane.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Pane {
id: control
@@ -48,9 +50,7 @@ T.Pane {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
- color: "#ffffff"
+ color: Default.backgroundColor
}
}
diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml
index 72428f23..476a1882 100644
--- a/src/imports/controls/Popup.qml
+++ b/src/imports/controls/Popup.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Popup {
id: control
@@ -50,9 +52,7 @@ T.Popup {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
- border.color: "#353637"
+ border.color: Default.frameDarkColor
}
}
diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml
index 45e990ee..a050383b 100644
--- a/src/imports/controls/ProgressBar.qml
+++ b/src/imports/controls/ProgressBar.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
T.ProgressBar {
id: control
@@ -69,6 +69,6 @@ T.ProgressBar {
width: control.availableWidth
height: 6
- color: "#e4e4e4"
+ color: Default.progressBarColor
}
}
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 1100273a..35395d85 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.RadioButton {
id: control
@@ -64,7 +64,7 @@ T.RadioButton {
text: control.text
font: control.font
- color: control.down ? "#26282a" : "#353637"
+ color: control.down ? Default.textDarkColor : Default.textColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml
index 620417a8..5df649d9 100644
--- a/src/imports/controls/RadioDelegate.qml
+++ b/src/imports/controls/RadioDelegate.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.RadioDelegate {
id: control
@@ -58,7 +58,7 @@ T.RadioDelegate {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -76,6 +76,6 @@ T.RadioDelegate {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted
- color: control.down ? "#bdbebf" : "#eeeeee"
+ color: control.down ? Default.delegatePressedColor : Default.delegateColor
}
}
diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml
index 05ff6673..15e6f9cf 100644
--- a/src/imports/controls/RadioIndicator.qml
+++ b/src/imports/controls/RadioIndicator.qml
@@ -34,16 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
Rectangle {
implicitWidth: 28
implicitHeight: 28
radius: width / 2
- color: control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")
+ color: control.down
+ ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor)
+ : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)
border.width: control.visualFocus ? 2 : 1
- border.color: control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")
+ border.color: control.visualFocus ? Default.focusColor : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)
opacity: enabled ? 1 : 0.3
property Item control
@@ -54,7 +58,7 @@ Rectangle {
width: 20
height: 20
radius: width / 2
- color: control.down ? "#26282a" : "#353637"
+ color: control.down ? Default.textDarkColor : Default.buttonCheckedColor
visible: control.checked
}
}
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml
index 181550a4..52e28ba4 100644
--- a/src/imports/controls/RangeSlider.qml
+++ b/src/imports/controls/RangeSlider.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.RangeSlider {
id: control
@@ -56,8 +58,12 @@ T.RangeSlider {
implicitHeight: 28
radius: width / 2
border.width: activeFocus ? 2 : 1
- border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6"
- color: control.enabled ? (first.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
+ border.color: control.enabled ? (activeFocus
+ ? Default.focusColor
+ : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor
+ color: control.enabled ? (first.pressed
+ ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor)
+ : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
@@ -69,8 +75,12 @@ T.RangeSlider {
implicitHeight: 28
radius: width / 2
border.width: activeFocus ? 2 : 1
- border.color: control.enabled ? (activeFocus ? "#0066ff" : (control.first.pressed ? "#808080" : "#909090")) : "#d6d6d6"
- color: control.enabled ? (second.pressed ? (activeFocus ? "#cce0ff" : "#f6f6f6") : (activeFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
+ border.color: control.enabled ? (activeFocus
+ ? Default.focusColor
+ : (control.first.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor
+ color: control.enabled ? (second.pressed
+ ? (activeFocus ? Default.focusPressedColor : Default.indicatorPressedColor)
+ : (activeFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
@@ -83,7 +93,7 @@ T.RangeSlider {
width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight
radius: 3
- color: "#e0e0e0"
+ color: Default.buttonColor
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
diff --git a/src/imports/controls/RoundButton.qml b/src/imports/controls/RoundButton.qml
new file mode 100644
index 00000000..15c01b48
--- /dev/null
+++ b/src/imports/controls/RoundButton.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
+
+T.RoundButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ padding: 6
+
+ //! [contentItem]
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ opacity: enabled || control.highlighted || control.checked ? 1 : 0.3
+ color: control.checked || control.highlighted ? Default.textLightColor : (control.visualFocus ? Default.focusColor : (control.down ? Default.textDarkColor : Default.textColor))
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 40
+ implicitHeight: 40
+ radius: control.radius
+ opacity: enabled ? 1 : 0.3
+ visible: !control.flat || control.down || control.checked || control.highlighted
+ color: control.checked || control.highlighted ?
+ (control.visualFocus ? (control.down ? Default.buttonCheckedFocusColor : Default.focusColor) : (control.down ? Default.buttonCheckedPressedColor : Default.buttonCheckedColor)) :
+ (control.visualFocus ? (control.down ? Default.focusPressedColor : Default.focusLightColor) : (control.down ? Default.buttonPressedColor : Default.buttonColor))
+ border.color: Default.focusColor
+ border.width: control.visualFocus ? 2 : 0
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
index c77463aa..52ec1995 100644
--- a/src/imports/controls/ScrollBar.qml
+++ b/src/imports/controls/ScrollBar.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ScrollBar {
id: control
@@ -54,7 +56,7 @@ T.ScrollBar {
implicitHeight: 6
radius: width / 2
- color: control.pressed ? "#28282a" : "#bdbebf"
+ color: control.pressed ? Default.scrollBarPressedColor : Default.scrollBarColor
visible: control.size < 1.0
opacity: 0.0
diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml
index c129e5b8..8ef60ed6 100644
--- a/src/imports/controls/ScrollIndicator.qml
+++ b/src/imports/controls/ScrollIndicator.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ScrollIndicator {
id: control
@@ -53,7 +55,7 @@ T.ScrollIndicator {
implicitWidth: 2
implicitHeight: 2
- color: "#bdbebf"
+ color: Default.scrollBarColor
visible: control.size < 1.0
opacity: 0.0
diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml
index 5e4dc699..2a14d31c 100644
--- a/src/imports/controls/Slider.qml
+++ b/src/imports/controls/Slider.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Slider {
id: control
@@ -53,9 +55,13 @@ T.Slider {
implicitWidth: 28
implicitHeight: 28
radius: width / 2
- color: control.enabled ? (control.pressed ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
+ color: control.enabled ? (control.pressed
+ ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor)
+ : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor
border.width: control.visualFocus ? 2 : 1
- border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.pressed ? "#808080" : "#909090")) : "#d6d6d6"
+ border.color: control.enabled ? (control.visualFocus
+ ? Default.focusColor
+ : (control.pressed ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
@@ -68,7 +74,7 @@ T.Slider {
width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight
radius: 3
- color: "#e0e0e0"
+ color: Default.buttonColor
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
index dee368e2..6a564d6e 100644
--- a/src/imports/controls/SpinBox.qml
+++ b/src/imports/controls/SpinBox.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.SpinBox {
id: control
@@ -66,9 +68,9 @@ T.SpinBox {
opacity: control.enabled ? 1 : 0.3
font: control.font
- color: "#353637"
- selectionColor: "#0066ff"
- selectedTextColor: "#ffffff"
+ color: Default.textColor
+ selectionColor: Default.focusColor
+ selectedTextColor: Default.textLightColor
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
@@ -83,7 +85,7 @@ T.SpinBox {
height: control.height
visible: control.activeFocus
color: "transparent"
- border.color: "#0066ff"
+ border.color: Default.focusColor
border.width: 2
}
}
@@ -93,21 +95,21 @@ T.SpinBox {
height: parent.height
implicitWidth: 40
implicitHeight: 40
- color: up.pressed ? "#d0d0d0" : "#e0e0e0"
+ color: up.pressed ? Default.buttonPressedColor : Default.buttonColor
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width / 3
height: 2
- color: enabled ? "#353637" : "#bdbebf"
+ color: enabled ? Default.textColor : Default.textDisabledColor
}
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: 2
height: parent.width / 3
- color: enabled ? "#353637" : "#bdbebf"
+ color: enabled ? Default.textColor : Default.textDisabledColor
}
}
@@ -116,19 +118,19 @@ T.SpinBox {
height: parent.height
implicitWidth: 40
implicitHeight: 40
- color: down.pressed ? "#d0d0d0" : "#e0e0e0"
+ color: down.pressed ? Default.buttonPressedColor : Default.buttonColor
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width / 3
height: 2
- color: enabled ? "#353637" : "#bdbebf"
+ color: enabled ? Default.textColor : Default.textDisabledColor
}
}
background: Rectangle {
implicitWidth: 140
- border.color: "#e0e0e0"
+ border.color: Default.buttonColor
}
}
diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml
index f70ecf97..96120d2b 100644
--- a/src/imports/controls/StackView.qml
+++ b/src/imports/controls/StackView.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.4
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Templates 2.1 as T
T.StackView {
id: control
diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml
index 6c84dae0..b140eb95 100644
--- a/src/imports/controls/SwipeDelegate.qml
+++ b/src/imports/controls/SwipeDelegate.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.SwipeDelegate {
id: control
@@ -56,7 +58,7 @@ T.SwipeDelegate {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -72,7 +74,9 @@ T.SwipeDelegate {
}
background: Rectangle {
- color: control.visualFocus ? (control.down ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#ffffff")
+ color: control.visualFocus
+ ? (control.down ? Default.focusPressedColor : Default.delegateFocusColor)
+ : (control.down ? Default.delegatePressedColor : Default.backgroundColor)
Behavior on x {
enabled: !control.down
diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml
index c4e5a570..555775ee 100644
--- a/src/imports/controls/SwipeView.qml
+++ b/src/imports/controls/SwipeView.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Templates 2.1 as T
T.SwipeView {
id: control
@@ -48,6 +48,7 @@ T.SwipeView {
contentItem: ListView {
model: control.contentModel
+ interactive: control.interactive
currentIndex: control.currentIndex
spacing: control.spacing
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index b4717d05..1918189a 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
T.Switch {
id: control
@@ -64,7 +64,7 @@ T.Switch {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml
index f5383628..a030ec07 100644
--- a/src/imports/controls/SwitchDelegate.qml
+++ b/src/imports/controls/SwitchDelegate.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls 2.0
-import QtQuick.Controls.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
T.SwitchDelegate {
id: control
@@ -64,7 +64,7 @@ T.SwitchDelegate {
text: control.text
font: control.font
- color: control.enabled ? "#26282a" : "#bdbebf"
+ color: control.enabled ? Default.textDarkColor : Default.textDisabledColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -75,6 +75,6 @@ T.SwitchDelegate {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted
- color: control.down ? "#bdbebf" : "#eeeeee"
+ color: control.down ? Default.delegatePressedColor : Default.delegateColor
}
}
diff --git a/src/imports/controls/SwitchIndicator.qml b/src/imports/controls/SwitchIndicator.qml
index 261d9999..362ebfef 100644
--- a/src/imports/controls/SwitchIndicator.qml
+++ b/src/imports/controls/SwitchIndicator.qml
@@ -34,7 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
Item {
implicitWidth: 56
@@ -47,9 +49,9 @@ Item {
width: 56
height: 16
radius: 8
- color: control.checked ? (control.visualFocus ? "#0066ff" : "#353637") : "#e0e0e0"
+ color: control.checked ? (control.visualFocus ? Default.focusColor : Default.buttonCheckedColor) : Default.buttonColor
border.width: control.visualFocus ? 2 : 0
- border.color: "#0066ff"
+ border.color: Default.focusColor
}
Rectangle {
@@ -58,9 +60,13 @@ Item {
width: 28
height: 28
radius: 16
- color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")) : "#fdfdfd"
+ color: control.enabled ? (control.down
+ ? (control.visualFocus ? Default.focusPressedColor : Default.indicatorPressedColor)
+ : (control.visualFocus ? Default.focusLightColor : Default.backgroundColor)) : Default.indicatorDisabledColor
border.width: control.visualFocus ? 2 : 1
- border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "#d6d6d6"
+ border.color: control.enabled ? (control.visualFocus
+ ? Default.focusColor
+ : (control.down ? Default.indicatorFramePressedColor : Default.indicatorFrameColor)) : Default.indicatorFrameDisabledColor
Behavior on x {
enabled: !control.down
diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml
index 22b5329e..21358c39 100644
--- a/src/imports/controls/TabBar.qml
+++ b/src/imports/controls/TabBar.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
T.TabBar {
id: control
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index 2c5b2708..f0d922a1 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.TabButton {
id: control
@@ -53,13 +55,15 @@ T.TabButton {
font: control.font
elide: Text.ElideRight
opacity: enabled ? 1 : 0.3
- color: !control.checked ? "#ffffff" : control.down ? "#26282a" : "#353637"
+ color: !control.checked ? Default.textLightColor : control.down ? Default.textDarkColor : Default.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
background: Rectangle {
implicitHeight: 40
- color: control.down ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637")
+ color: control.down
+ ? (control.checked ? Default.tabButtonCheckedPressedColor : Default.tabButtonPressedColor)
+ : (control.checked ? "transparent" : Default.tabButtonColor)
}
}
diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml
index f1ec6dfa..734cc9d0 100644
--- a/src/imports/controls/TextArea.qml
+++ b/src/imports/controls/TextArea.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.TextArea {
id: control
@@ -51,8 +53,8 @@ T.TextArea {
leftPadding: padding + 4
opacity: enabled ? 1 : 0.2
- color: "#353637"
- selectionColor: "#fddd5c"
+ color: Default.textColor
+ selectionColor: Default.textSelectionColor
selectedTextColor: color
Text {
@@ -64,7 +66,7 @@ T.TextArea {
text: control.placeholderText
font: control.font
- color: "#c2c2c2"
+ color: Default.textDisabledLightColor
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml
index fc07e7bb..5e6e91b6 100644
--- a/src/imports/controls/TextField.qml
+++ b/src/imports/controls/TextField.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.TextField {
id: control
@@ -51,8 +53,8 @@ T.TextField {
leftPadding: padding + 4
opacity: enabled ? 1 : 0.2
- color: "#353637"
- selectionColor: "#fddd5c"
+ color: Default.textColor
+ selectionColor: Default.textSelectionColor
selectedTextColor: color
verticalAlignment: TextInput.AlignVCenter
@@ -65,7 +67,7 @@ T.TextField {
text: control.placeholderText
font: control.font
- color: "#bdbebf"
+ color: Default.textDisabledColor
horizontalAlignment: control.horizontalAlignment
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
@@ -76,7 +78,7 @@ T.TextField {
implicitWidth: 200
implicitHeight: 40
border.width: control.activeFocus ? 2 : 1
- color: control.enabled ? "#ffffff" : "#353637"
- border.color: control.activeFocus ? "#0066ff" : (control.enabled ? "#bdbebf" : "transparent")
+ color: control.enabled ? Default.backgroundColor : Default.disabledDarkColor
+ border.color: control.activeFocus ? Default.focusColor : (control.enabled ? Default.disabledLightColor : "transparent")
}
}
diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml
index 02b6c6f3..d7c29be7 100644
--- a/src/imports/controls/ToolBar.qml
+++ b/src/imports/controls/ToolBar.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ToolBar {
id: control
@@ -46,10 +48,8 @@ T.ToolBar {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- contentItem: Item { }
-
background: Rectangle {
implicitHeight: 40
- color: "#eeeeee"
+ color: Default.delegateColor
}
}
diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml
index 1fda5ba3..8d91da10 100644
--- a/src/imports/controls/ToolButton.qml
+++ b/src/imports/controls/ToolButton.qml
@@ -34,8 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ToolButton {
id: control
@@ -51,7 +53,7 @@ T.ToolButton {
contentItem: Text {
text: control.text
font: control.font
- color: control.enabled ? (control.visualFocus ? "#0066ff" : "#26282a") : "#c2c2c2"
+ color: control.enabled ? (control.visualFocus ? Default.focusColor : Default.textDarkColor) : Default.textDisabledLightColor
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -61,7 +63,7 @@ T.ToolButton {
implicitWidth: 40
implicitHeight: 40
- color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0)
+ color: Qt.darker(Default.toolButtonColor, control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0)
opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0
visible: control.down || (control.enabled && (control.checked || control.highlighted))
}
diff --git a/src/imports/controls/ToolSeparator.qml b/src/imports/controls/ToolSeparator.qml
new file mode 100644
index 00000000..dca746d7
--- /dev/null
+++ b/src/imports/controls/ToolSeparator.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
+
+T.ToolSeparator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+
+ padding: vertical ? 6 : 2
+ topPadding: vertical ? 2 : 6
+ bottomPadding: vertical ? 2 : 6
+
+ //! [contentItem]
+ contentItem: Rectangle {
+ implicitWidth: vertical ? 1 : 30
+ implicitHeight: vertical ? 30 : 1
+ color: Default.separatorColor
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml
index 322757c7..bf574c28 100644
--- a/src/imports/controls/ToolTip.qml
+++ b/src/imports/controls/ToolTip.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.ToolTip {
id: control
@@ -61,6 +62,6 @@ T.ToolTip {
}
background: Rectangle {
- border.color: "#353637"
+ border.color: Default.frameDarkColor
}
}
diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml
index 571d8089..6c89b86d 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Tumbler {
id: control
@@ -46,29 +47,23 @@ T.Tumbler {
delegate: Text {
id: label
text: modelData
- color: control.visualFocus ? "#0066ff" : "#26282a"
+ color: control.visualFocus ? Default.focusColor : Default.textDarkColor
font: control.font
opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- contentItem: PathView {
- id: pathView
+ contentItem: TumblerView {
+ id: tumblerView
model: control.model
delegate: control.delegate
- clip: true
- pathItemCount: control.visibleItemCount + 1
- preferredHighlightBegin: 0.5
- preferredHighlightEnd: 0.5
- dragMargin: width / 2
-
path: Path {
- startX: pathView.width / 2
- startY: -pathView.delegateHeight / 2
+ startX: tumblerView.width / 2
+ startY: -tumblerView.delegateHeight / 2
PathLine {
- x: pathView.width / 2
- y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2
+ x: tumblerView.width / 2
+ y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
}
}
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index dcbcf8e1..79e03db5 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -1,12 +1,14 @@
HEADERS += \
$$PWD/qquickbusyindicatorring_p.h \
$$PWD/qquickprogressstrip_p.h \
- $$PWD/qquickdialring_p.h
+ $$PWD/qquickdialring_p.h \
+ $$PWD/qquickdefaultstyle_p.h
SOURCES += \
$$PWD/qquickbusyindicatorring.cpp \
$$PWD/qquickprogressstrip.cpp \
- $$PWD/qquickdialring.cpp
+ $$PWD/qquickdialring.cpp \
+ $$PWD/qquickdefaultstyle.cpp
QML_CONTROLS = \
AbstractButton.qml \
@@ -20,6 +22,8 @@ QML_CONTROLS = \
Container.qml \
Control.qml \
Dial.qml \
+ Dialog.qml \
+ DialogButtonBox.qml \
Drawer.qml \
Frame.qml \
GroupBox.qml \
@@ -27,6 +31,7 @@ QML_CONTROLS = \
Label.qml \
Menu.qml \
MenuItem.qml \
+ MenuSeparator.qml \
Page.qml \
PageIndicator.qml \
Pane.qml \
@@ -36,6 +41,7 @@ QML_CONTROLS = \
RadioDelegate.qml \
RadioIndicator.qml \
RangeSlider.qml \
+ RoundButton.qml \
ScrollBar.qml \
ScrollIndicator.qml \
Slider.qml \
@@ -52,6 +58,7 @@ QML_CONTROLS = \
TextField.qml \
ToolBar.qml \
ToolButton.qml \
+ ToolSeparator.qml \
ToolTip.qml \
Tumbler.qml
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index 15c07cf0..9e8a3c27 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2plugin
TARGETPATH = QtQuick/Controls.2
-IMPORT_VERSION = 2.0
+IMPORT_VERSION = 2.1
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
diff --git a/src/imports/controls/dependencies.json b/src/imports/controls/dependencies.json
new file mode 100644
index 00000000..4481dd1c
--- /dev/null
+++ b/src/imports/controls/dependencies.json
@@ -0,0 +1,17 @@
+[
+ {
+ "name": "QtQuick",
+ "type": "module",
+ "version": "2.8"
+ },
+ {
+ "name": "QtQuick.Window",
+ "type": "module",
+ "version": "2.2"
+ },
+ {
+ "name": "QtQuick.Templates",
+ "type": "module",
+ "version": "2.1"
+ }
+]
diff --git a/src/imports/controls/designer/ToolSeparatorSpecifics.qml b/src/imports/controls/designer/ToolSeparatorSpecifics.qml
new file mode 100644
index 00000000..2e967a6e
--- /dev/null
+++ b/src/imports/controls/designer/ToolSeparatorSpecifics.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** 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.8
+import HelperWidgets 2.0
+import QtQuick.Layouts 1.3
+
+Column {
+ width: parent.width
+
+ Section {
+ width: parent.width
+ caption: qsTr("ToolSeparator")
+
+ SectionLayout {
+ Label {
+ text: qsTr("Orientation")
+ tooltip: qsTr("The orientation of the separator.")
+ }
+ SecondColumnLayout {
+ ComboBox {
+ backendValue: backendValues.orientation
+ model: [ "Horizontal", "Vertical" ]
+ scope: "Qt"
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+
+ ControlSection {
+ width: parent.width
+ }
+
+ PaddingSection {
+ width: parent.width
+ }
+}
diff --git a/src/imports/controls/designer/images/toolseparator-icon.png b/src/imports/controls/designer/images/toolseparator-icon.png
new file mode 100644
index 00000000..3d2e152f
--- /dev/null
+++ b/src/imports/controls/designer/images/toolseparator-icon.png
Binary files differ
diff --git a/src/imports/controls/designer/images/toolseparator-icon16.png b/src/imports/controls/designer/images/toolseparator-icon16.png
new file mode 100644
index 00000000..97672506
--- /dev/null
+++ b/src/imports/controls/designer/images/toolseparator-icon16.png
Binary files differ
diff --git a/src/imports/controls/designer/images/toolseparator-icon16@2x.png b/src/imports/controls/designer/images/toolseparator-icon16@2x.png
new file mode 100644
index 00000000..979b6426
--- /dev/null
+++ b/src/imports/controls/designer/images/toolseparator-icon16@2x.png
Binary files differ
diff --git a/src/imports/controls/designer/images/toolseparator-icon@2x.png b/src/imports/controls/designer/images/toolseparator-icon@2x.png
new file mode 100644
index 00000000..19287154
--- /dev/null
+++ b/src/imports/controls/designer/images/toolseparator-icon@2x.png
Binary files differ
diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo
index 81a6d914..c697b3c2 100644
--- a/src/imports/controls/designer/qtquickcontrols2.metainfo
+++ b/src/imports/controls/designer/qtquickcontrols2.metainfo
@@ -388,6 +388,19 @@ MetaInfo {
}
Type {
+ name: "QtQuick.Controls.ToolSeparator"
+ icon: "images/toolseparator-icon16.png"
+
+ ItemLibraryEntry {
+ name: "ToolSeparator"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/toolseparator-icon.png"
+ version: "2.1"
+ requiredImport: "QtQuick.Controls"
+ }
+ }
+
+ Type {
name: "QtQuick.Controls.Tumbler"
icon: "images/tumbler-icon16.png"
@@ -399,4 +412,32 @@ MetaInfo {
requiredImport: "QtQuick.Controls"
}
}
+
+ Type {
+ name: "QtQuick.Controls.TabBar"
+ icon: "images/toolbar-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Tab Bar"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/toolbar-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ Property { name: "width"; type: "int"; value: 240 }
+ }
+ }
+
+ Type {
+ name: "QtQuick.Controls.TabButton"
+ icon: "images/toolbutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Tab Button"
+ category: "Qt Quick - Controls 2"
+ libraryIcon: "images/toolbutton-icon.png"
+ version: "2.0"
+ requiredImport: "QtQuick.Controls"
+ Property { name: "text"; type: "binding"; value: "qsTr(\"Tab Button\")" }
+ }
+ }
}
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png
new file mode 100644
index 00000000..53ecf83d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox-attached.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png
new file mode 100644
index 00000000..87cece98
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dialogbuttonbox.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.png
new file mode 100644
index 00000000..48785b73
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-menuseparator.png b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator.png
new file mode 100644
index 00000000..beb1cfeb
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-menuseparator.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png b/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png
new file mode 100644
index 00000000..9f1d44fc
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-roundbutton.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.png
new file mode 100644
index 00000000..4f423154
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator-custom.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolseparator.png b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator.png
new file mode 100644
index 00000000..253c429b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolseparator.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif
index 4821a4e8..8f59eedc 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tumbler-wrap.gif
Binary files differ
diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf
index a9a48343..42ff16f8 100644
--- a/src/imports/controls/doc/qtquickcontrols2.qdocconf
+++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf
@@ -29,27 +29,24 @@ 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
+depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquickextras qmake qtsql qtwidgets qtlabscalendar qtlabsplatform
# 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 \
+ ../../templates/doc/src \
src
imagedirs += images
@@ -91,7 +88,6 @@ macro.endstylemethod2 = "\\br"
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
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.qml
new file mode 100644
index 00000000..c151ceed
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modal.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.1
+
+Item {
+ width: dialog.implicitWidth
+ height: dialog.implicitHeight
+//! [1]
+Dialog {
+ id: dialog
+ modal: true
+ standardButtons: Dialog.Ok
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.qml
new file mode 100644
index 00000000..45e1c2c0
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog-modeless.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.1
+
+Item {
+ width: dialog.implicitWidth
+ height: dialog.implicitHeight
+//! [1]
+Dialog {
+ id: dialog
+ modal: false
+ standardButtons: Dialog.Ok
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.qml
new file mode 100644
index 00000000..69e84914
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialog.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.1
+
+Item {
+ width: dialog.implicitWidth
+ height: dialog.implicitHeight
+//! [1]
+Dialog {
+ id: dialog
+ title: "Title"
+ standardButtons: Dialog.Ok | Dialog.Cancel
+
+ onAccepted: console.log("Ok clicked")
+ onRejected: console.log("Cancel clicked")
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.qml
new file mode 100644
index 00000000..a93cda30
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox-attached.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.1
+
+//! [1]
+DialogButtonBox {
+ Button {
+ text: qsTr("Save")
+ DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
+ }
+ Button {
+ text: qsTr("Close")
+ DialogButtonBox.buttonRole: DialogButtonBox.DestructiveRole
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/basic-example.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml
index 62ab2466..41e6cf23 100644
--- a/src/imports/controls/doc/snippets/basic-example.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-dialogbuttonbox.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** 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 documentation of the Qt Toolkit.
@@ -25,19 +25,14 @@
**
****************************************************************************/
-//! [0]
-import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick 2.0
+import QtQuick.Controls 2.1
-ApplicationWindow {
- title: "My Application"
- width: 640
- height: 480
- visible: true
+//! [1]
+DialogButtonBox {
+ standardButtons: DialogButtonBox.Ok | DialogButtonBox.Cancel
- Button {
- text: "Push Me"
- anchors.centerIn: parent
- }
+ onAccepted: console.log("Ok clicked")
+ onRejected: console.log("Cancel clicked")
}
-//! [0]
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml
new file mode 100644
index 00000000..b5d8b18b
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator-custom.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** 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.1
+
+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
+
+ MenuItem {
+ text: qsTr("New...")
+ }
+ MenuItem {
+ text: qsTr("Open...")
+ }
+ MenuItem {
+ text: qsTr("Save")
+ }
+
+ MenuSeparator {
+ padding: 0
+ topPadding: 12
+ bottomPadding: 12
+ contentItem: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 1
+ color: "#1E000000"
+ }
+ }
+
+ MenuItem {
+ text: qsTr("Exit")
+ }
+}
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.qml
new file mode 100644
index 00000000..d41d3cf9
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-menuseparator.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.1
+
+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
+
+ MenuItem {
+ text: qsTr("New...")
+ }
+ MenuItem {
+ text: qsTr("Open...")
+ }
+ MenuItem {
+ text: qsTr("Save")
+ }
+
+ MenuSeparator {}
+
+ MenuItem {
+ text: qsTr("Exit")
+ }
+}
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.qml
new file mode 100644
index 00000000..fa926302
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-roundbutton.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$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 2.1
+
+//! [1]
+RoundButton {
+ text: "\u2713" // Unicode Character 'CHECK MARK'
+ onClicked: textArea.readOnly = true
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml
index 3e40ea2d..898ff6af 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-stackview-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
StackView {
id: control
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
index db077057..46b2809f 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
@@ -25,39 +25,56 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0
+import QtQuick 2.8
+import QtQuick.Controls 2.1
//! [1]
ListView {
- width: 200
- height: 300
- clip: true
+ id: listView
+ anchors.fill: parent
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" }
+ ListElement { sender: "Bob Bobbleton"; title: "How are you going?" }
+ ListElement { sender: "Rug Emporium"; title: "SALE! All rugs MUST go!" }
+ ListElement { sender: "Electric Co."; title: "Electricity bill 15/07/2016 overdue" }
+ ListElement { sender: "Tips"; title: "Five ways this tip will save your life" }
}
delegate: SwipeDelegate {
id: swipeDelegate
- text: title
+ text: model.sender + " - " + model.title
width: parent.width
- onClicked: if (swipe.complete) listModel.remove(index)
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction {
+ target: swipeDelegate
+ property: "ListView.delayRemove"
+ value: true
+ }
+ NumberAnimation {
+ target: swipeDelegate
+ property: "height"
+ to: 0
+ easing.type: Easing.InOutQuad
+ }
+ PropertyAction {
+ target: swipeDelegate;
+ property: "ListView.delayRemove";
+ value: false
+ }
+ }
- swipe.right: Rectangle {
- color: swipeDelegate.swipe.complete && swipeDelegate.pressed ? "#333" : "#444"
- width: parent.width
+ swipe.right: Label {
+ id: deleteLabel
+ text: qsTr("Delete")
+ color: "white"
+ verticalAlignment: Label.AlignVCenter
+ padding: 12
height: parent.height
+ anchors.right: parent.right
+
+ SwipeDelegate.onClicked: listView.model.remove(index)
- Label {
- font.pixelSize: swipeDelegate.font.pixelSize
- text: qsTr("Remove")
- color: "white"
- anchors.centerIn: parent
+ background: Rectangle {
+ color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
}
}
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml
index 04b12512..0f862276 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
SwipeView {
id: control
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml
new file mode 100644
index 00000000..7495a993
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator-custom.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+
+//! [file]
+ToolBar {
+ RowLayout {
+ anchors.fill: parent
+
+ ToolButton {
+ text: qsTr("Action 1")
+ }
+ ToolButton {
+ text: qsTr("Action 2")
+ }
+
+ ToolSeparator {
+ padding: vertical ? 10 : 2
+ topPadding: vertical ? 2 : 10
+ bottomPadding: vertical ? 2 : 10
+
+ contentItem: Rectangle {
+ implicitWidth: parent.vertical ? 1 : 24
+ implicitHeight: parent.vertical ? 24 : 1
+ color: "#c3c3c3"
+ }
+ }
+
+ ToolButton {
+ text: qsTr("Action 3")
+ }
+ ToolButton {
+ text: qsTr("Action 4")
+ }
+
+ Item {
+ Layout.fillWidth: true
+ }
+ }
+}
+//! [file]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml
new file mode 100644
index 00000000..7770d14c
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-toolseparator.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+
+//! [1]
+ToolBar {
+ RowLayout {
+ anchors.fill: parent
+
+ ToolButton {
+ text: qsTr("Action 1")
+ }
+ ToolButton {
+ text: qsTr("Action 2")
+ }
+
+ ToolSeparator {}
+
+ ToolButton {
+ text: qsTr("Action 3")
+ }
+ ToolButton {
+ text: qsTr("Action 4")
+ }
+
+ ToolSeparator {}
+
+ ToolButton {
+ text: qsTr("Action 5")
+ }
+ ToolButton {
+ text: qsTr("Action 6")
+ }
+
+ Item {
+ Layout.fillWidth: true
+ }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml
index 94d9c12e..6bb8a45e 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
ToolTip {
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.qml
new file mode 100644
index 00000000..ff3ecd81
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-listView.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.8
+import QtQuick.Controls 2.1
+
+//! [contentItem]
+Tumbler {
+ id: tumbler
+
+ contentItem: ListView {
+ model: tumbler.model
+ delegate: tumbler.delegate
+
+ snapMode: ListView.SnapToItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ preferredHighlightBegin: height / 2 - (height / tumbler.visibleItemCount / 2)
+ preferredHighlightEnd: height / 2 + (height / tumbler.visibleItemCount / 2)
+ clip: true
+ }
+}
+//! [contentItem]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml
new file mode 100644
index 00000000..957112e0
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-pathView.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Controls 2.1
+
+//! [contentItem]
+Tumbler {
+ id: tumbler
+
+ contentItem: PathView {
+ id: pathView
+ model: tumbler.model
+ delegate: tumbler.delegate
+ clip: true
+ pathItemCount: tumbler.visibleItemCount + 1
+ preferredHighlightBegin: 0.5
+ preferredHighlightEnd: 0.5
+ dragMargin: width / 2
+
+ path: Path {
+ startX: pathView.width / 2
+ startY: -pathView.delegateHeight / 2
+ PathLine {
+ x: pathView.width / 2
+ y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2
+ }
+ }
+
+ property real delegateHeight: tumbler.availableHeight / tumbler.visibleItemCount
+ }
+}
+//! [contentItem]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml
new file mode 100644
index 00000000..86276266
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-timePicker.qml
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+//! [tumbler]
+import QtQuick 2.8
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+
+Rectangle {
+ width: frame.implicitWidth + 10
+ height: frame.implicitHeight + 10
+
+ function formatText(count, modelData) {
+ var data = count === 12 ? modelData + 1 : modelData;
+ return data.toString().length < 2 ? "0" + data : data;
+ }
+
+ FontMetrics {
+ id: fontMetrics
+ }
+
+ Component {
+ id: delegateComponent
+
+ Label {
+ text: formatText(Tumbler.tumbler.count, modelData)
+ opacity: 1.0 - Math.abs(Tumbler.displacement) / (Tumbler.tumbler.visibleItemCount / 2)
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ font.pixelSize: fontMetrics.font.pixelSize * 1.25
+ }
+ }
+
+ Frame {
+ id: frame
+ padding: 0
+ anchors.centerIn: parent
+
+ Row {
+ id: row
+
+ Tumbler {
+ id: hoursTumbler
+ model: 12
+ delegate: delegateComponent
+ }
+
+ Tumbler {
+ id: minutesTumbler
+ model: 60
+ delegate: delegateComponent
+ }
+
+ Tumbler {
+ id: amPmTumbler
+ model: ["AM", "PM"]
+ delegate: delegateComponent
+ }
+ }
+ }
+}
+//! [tumbler]
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
index 82ed9cdc..847ad736 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
BusyIndicator {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
index eac6b831..dbe53f4d 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Button {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
index f4555c90..c7399b9a 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Button {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
index a99346a6..ea220fde 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Button {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
index f206bcec..385d4abb 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Button {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
index 8a941561..edf0b324 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Button {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
index 075e6342..e5c466da 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
CheckBox {
text: "Checked"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
index 0465ec80..9645a4b6 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
CheckBox {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
index 4878cf31..3bfbb730 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
CheckBox {
text: "Disabled"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
index 93f1c214..fd7c7fea 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
CheckBox {
text: "Focused"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
index a840116e..dba9e7e9 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
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
index 483f9838..83f0ef86 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
CheckDelegate {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
index bd261e52..12d56a56 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
ComboBox {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
index d8b5d1fa..2817d956 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
id: root
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
index 36569e15..1ac43234 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
id: root
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
index efe061d3..1bf9baf4 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Dial {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
index 19d943a6..d9a61682 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Dial {
id: dial
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
index d11c431e..f2b5d254 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Frame {
background: Rectangle {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
index 1ede733d..98f177ef 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
Frame {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
index a2999925..db58593f 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
GroupBox {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
index cb9ed049..bf21e022 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
GroupBox {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
index 74d0ea52..bef99d0b 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
GroupBox {
width: 100
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
index f79f3aef..7d4f328c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
GroupBox {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
index 002aae69..0935d8f6 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
ItemDelegate {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
index 143b3323..733434e8 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
ListView {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
index 98dbdc5e..2eedb29f 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Label {
text: qsTr("Label")
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
index 4346c0eb..cf59c49a 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
Label {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
index a6971232..f4507714 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
id: window
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
index 65112ef4..225ba423 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
PageIndicator {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
index 4b3ccf23..c7ae046f 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
PageIndicator {
count: 5
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
index 237bc6e7..cf91d6f2 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
@@ -25,7 +25,7 @@
**
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
PageIndicator {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
index 80519939..42c30795 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Pane {
background: Rectangle {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
index 3d86499f..b7b8fa5d 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
Pane {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
index 88faed20..9e6779d6 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
ProgressBar {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
index dba262be..1d9661a5 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
RadioButton {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
index 6efb7803..91125921 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
RadioDelegate {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
index 7e488d14..86fae061 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
RangeSlider {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
index 086541c8..1570aff4 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
width: 100
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
index 0bf13b3c..05b3f3aa 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
ScrollBar {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
index c118c7aa..954b449c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
width: 100
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
index 5720f4f7..97930e1e 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
ScrollIndicator {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
index ebc11f46..6201cbf8 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Slider {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
index 20b569f3..fa23972c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Slider {
value: 0.5
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
index 6433fd80..cfbd8400 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
SpinBox {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
index 15af31ae..ad22b856 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
SpinBox {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
index 419dae5c..ecd2a659 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
SpinBox {
value: 50
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
index 814b8b28..e6b7c735 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
SpinBox {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
index b4b0fab3..0b2c3fea 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
SpinBox {
value: 50
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
index 6616ed60..d8c54714 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
SpinBox {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
index ae63efed..087e17fe 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
SwipeDelegate {
id: control
@@ -37,7 +37,7 @@ SwipeDelegate {
id: component
Rectangle {
- color: control.swipe.complete && control.down ? "#333" : "#444"
+ color: SwipeDelegate.pressed ? "#333" : "#444"
width: parent.width
height: parent.height
clip: true
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
index 2ba8df9c..3afcc3e2 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
width: 200
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
index f9a18b1c..3a6dfc7c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Switch {
text: "Checked"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
index 698c1a05..5152040d 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Switch {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
index a40586b5..6eb53084 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Switch {
text: "Disabled"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
index f98f2c90..6ca19062 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Switch {
text: "Focused"
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
index a55c2854..339874d7 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
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
index 8d0daa0a..e06af484 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
SwitchDelegate {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
index 1873fba9..305101c0 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
TabBar {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
index b445ee67..e3a67c30 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.3
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Column {
width: 300
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
index 67e5e1e0..9fef1e59 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
TabBar {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
index f70c7135..dd6035c0 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
TextArea {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
index e11750cb..500e09c3 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
width: 100
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
index 0deb0e5c..8e5d897c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
TextField {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
index ac798f53..21c351c4 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
TextField {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
index a4e1b3b1..ddea7c51 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
TextField {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
index 12c7ead9..29f7fb9c 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
TextField {
width: 80
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
index 3e98808c..e8d268c5 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
@@ -27,7 +27,7 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [file]
ToolBar {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
index 246f3ae5..2ec10c57 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Layouts 1.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
width: children[0].implicitWidth * 2
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
index 10491cb5..449266c1 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
@@ -27,7 +27,7 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
ToolButton {
id: control
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
index 330ab83c..27b03a63 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
Button {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
index eddb09e6..7d285528 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
//! [1]
Button {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
index e6a386c1..ca08ce72 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Window 2.2
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
id: root
@@ -46,7 +46,7 @@ Item {
ToolTip {
parent: slider.handle
visible: slider.pressed
- text: slider.position.toFixed(1)
+ text: slider.valueAt(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
index 146fe477..3aa26908 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
@@ -27,7 +27,7 @@
import QtQuick 2.0
import QtQuick.Window 2.2
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Item {
id: root
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
index d2b4f960..f1c2b806 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
@@ -27,12 +27,11 @@
//! [file]
import QtQuick 2.6
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Tumbler {
id: control
model: 15
- visibleItemCount: 5
background: Item {
Rectangle {
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
index 4d389ab7..4d2c7349 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
@@ -26,7 +26,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Controls 2.0
+import QtQuick.Controls 2.1
Tumbler {
id: tumbler
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
index 5e2c9370..d79dd198 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
@@ -128,6 +128,24 @@
\b {See also} \l RadioButton
+ \section1 RoundButton Control
+
+ \l RoundButton is a clickable control that starts an action, or opens or
+ closes a popup. A round button with a square image icon or one-letter font
+ icon is circular. A circular RoundButton takes less space than a normal
+ \l Button, and can also be used as a floating action button.
+
+ \image qtquickcontrols2-roundbutton.png
+
+ 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 RoundButton
+
\section1 Switch Control
\image qtquickcontrols2-switch.png
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
index 29bfc99c..d03f2325 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
@@ -36,14 +36,15 @@
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.
+ is run with the \l {Universal style} instead, the accent color is red and the appropriate theme
+ is chosen based on the system theme colors.
\code
[Controls]
Style=Material
[Universal]
- Theme=Dark
+ Theme=System
Accent=Red
[Material]
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index 71ffe350..06201404 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -49,7 +49,7 @@
\qml
import QtQuick 2.6
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
width: 400
@@ -92,7 +92,7 @@
your application, refer to it by its filename:
\qml
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
MyButton {
@@ -108,7 +108,7 @@
control, first import the folder into a namespace:
\qml
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
import "controls" as MyControls
ApplicationWindow {
@@ -136,8 +136,6 @@
\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}.
@@ -155,6 +153,10 @@
for example.
\endlist
+ By default, the styling system uses the Default style as a fallback for
+ controls that aren't implemented. To customize or extend any other built-in
+ style, it is possible to specify a different fallback style using \l QQuickStyle.
+
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.
@@ -299,7 +301,7 @@
\qml
import QtQuick 2.6
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
import MyStyle 1.0
@@ -488,7 +490,7 @@
\quotefromfile qtquickcontrols2-menu-custom.qml
\skipto import QtQuick 2.6
- \printuntil import QtQuick.Controls 2.0
+ \printuntil import QtQuick.Controls 2.1
\skipto Menu
\printto contentItem.parent: window
\skipline contentItem.parent: window
@@ -503,6 +505,23 @@
\l {Customizing Button}{Button}.
+ \section2 Customizing MenuSeparator
+
+ MenuSeparator consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-menuseparator-custom.png
+
+ \quotefromfile qtquickcontrols2-menuseparator-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.1
+ \skipto Menu
+ \printto contentItem.parent: window
+ \skipline contentItem.parent: window
+ \printuntil text: qsTr("Exit")
+ \printuntil }
+ \printuntil }
+
\section2 Customizing PageIndicator
PageIndicator consists of a \l {Control::background}{background}, \l {Control::contentItem}{content item}, and \l {PageIndicator::delegate}{delegate}.
@@ -581,6 +600,12 @@
\snippet qtquickcontrols2-rangeslider-custom.qml file
+ \section2 Customizing RoundButton
+
+ RoundButton can be customized in the same manner as
+ \l {Customizing Button}{Button}.
+
+
\section2 Customizing ScrollBar
ScrollBar consists of two visual items: \l {Control::background}{background}
@@ -723,6 +748,16 @@
\snippet qtquickcontrols2-toolbutton-custom.qml file
+ \section2 Customizing ToolSeparator
+
+ ToolSeparator consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
+
+ \image qtquickcontrols2-toolseparator-custom.png
+
+ \snippet qtquickcontrols2-toolseparator-custom.qml file
+
+
\section2 Customizing ToolTip
ToolTip consists of two visual items: \l {Popup::background}{background}
@@ -730,7 +765,7 @@
\quotefromfile qtquickcontrols2-tooltip-custom.qml
\skipto import QtQuick 2.6
- \printuntil import QtQuick.Controls 2.0
+ \printuntil import QtQuick.Controls 2.1
\skipto ToolTip
\printuntil }
\printuntil }
@@ -747,4 +782,13 @@
\image qtquickcontrols2-tumbler-custom.png
\snippet qtquickcontrols2-tumbler-custom.qml file
+
+ If you want to define your own contentItem, use either a \l ListView or
+ \l PathView as the root item. For a wrapping Tumbler, use PathView:
+
+ \snippet qtquickcontrols2-tumbler-pathView.qml contentItem
+
+ For a non-wrapping Tumbler, use ListView:
+
+ \snippet qtquickcontrols2-tumbler-listView.qml contentItem
*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
index 45ea7db7..5cb7a9a5 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
@@ -115,7 +115,7 @@
\row
\li Can be used on Desktop
\li Yes
- \li Yes \b *
+ \li Yes
\row
\li Can be used on Mobile
\li Yes
@@ -130,8 +130,6 @@
\li C++
\endtable
- \b {* No hover effects}
-
\section2 Porting Qt Quick Controls Code
The API of Qt Quick Controls 2 is very similar to Qt Quick Controls, but it
@@ -262,6 +260,9 @@
\li \l [QML QtQuickControls] {MenuItem}
\li \l [QML QtQuickControls2] {MenuItem}
\row
+ \li \l [QML QtQuickControls] {MenuSeparator}
+ \li \l [QML QtQuickControls2] {MenuSeparator}
+ \row
\li \mdash
\li \l [QML QtQuickControls2] {Page}
\row
@@ -352,6 +353,9 @@
\li \l [QML QtQuickControls2] {ToolButton}
\row
\li \mdash
+ \li \l [QML QtQuickControls2] {ToolSeparator}
+ \row
+ \li \mdash
\li \l [QML QtQuickControls2] {ToolTip}
\row
\li \l [QML QtQuickControls] {TreeView}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
index 7c1b1c16..c83adf4b 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
@@ -43,10 +43,18 @@
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_FALLBACK_STYLE
+ \li Specifies a fallback style for \l {Creating a Custom Style}{custom styles}.
+ The value can be one of the built-in styles, for example \c "Material",
+ \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".
+ \row
+ \li \c QT_QUICK_CONTROLS_HOVER_ENABLED
+ \li Specifies whether Qt Quick Controls 2 use \l {Control::hoverEnabled}{hover effects}.
+ The value can be set to \c 0 or \c 1 to disable or enable hover effects, respectively.
\endtable
\l {Material style} specific environment variables:
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc
index 86df60c7..a132c6f0 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-fileselectors.qdoc
@@ -62,7 +62,7 @@
\code
// main.qml
import QtQuick 2.6
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
id: window
@@ -81,7 +81,7 @@
\code
// CustomButton.qml
import QtQuick 2.6
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
Button {
id: control
@@ -103,8 +103,8 @@
// +material/CustomButton.qml
import QtQuick 2.6
import QtGraphicalEffects 1.0
- import QtQuick.Controls 2.0
- import QtQuick.Controls.Material 2.0
+ import QtQuick.Controls 2.1
+ import QtQuick.Controls.Material 2.1
Button {
id: control
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc
index 4661e8c9..7eb9eaf4 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-gettingstarted.qdoc
@@ -31,7 +31,22 @@
A basic example of a QML file that makes use of controls is shown here:
- \snippet basic-example.qml 0
+ \qml
+ import QtQuick 2.6
+ import QtQuick.Controls 2.1
+
+ ApplicationWindow {
+ title: "My Application"
+ width: 640
+ height: 480
+ visible: true
+
+ Button {
+ text: "Push Me"
+ anchors.centerIn: parent
+ }
+ }
+ \endqml
\section1 Setting Up Controls from C++
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
index cdb20a27..d3f3ec52 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -32,7 +32,8 @@
\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.
+ to build complete interfaces in Qt Quick. The module was introduced
+ in Qt 5.7.
\section1 Prerequisites
@@ -40,7 +41,7 @@
application using the following import statement in your \c {.qml} file:
\code
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
\endcode
The \l{Qt Quick Controls 2 C++ Classes}{C++ classes} can be included into
@@ -85,6 +86,7 @@
\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 - Text Editor}{Text Editor}
\li \l{Qt Quick Controls 2 Examples}{All Examples}
\endlist
@@ -95,5 +97,6 @@
\li \l{Qt Quick Layouts}
\li \l{Qt Quick Templates 2}
\li \l{Qt Labs Calendar}
+ \li \l{Qt Labs Platform}
\endlist
*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
index 9842fee6..d841c46d 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
@@ -32,7 +32,7 @@
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}
+ \styleimport {QtQuick.Controls.Material 2.1} {Qt 5.7}
\section1 Attached Properties
@@ -89,8 +89,8 @@
\li
\qml
import QtQuick 2.0
- import QtQuick.Controls 2.0
- import QtQuick.Controls.Material 2.0
+ import QtQuick.Controls 2.1
+ import QtQuick.Controls.Material 2.1
ApplicationWindow {
visible: true
@@ -328,6 +328,11 @@
Available themes:
\value Material.Light Light theme (default)
\value Material.Dark Dark theme
+ \value Material.System System theme
+
+ Setting the theme to \c System chooses either the light or dark theme based
+ on the system theme colors. However, when reading the value of the theme
+ property, the value is never \c System, but the actual theme.
In the following example, the theme for both the pane and the button is set
to \c Material.Dark:
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
index 52da41a7..2add71b2 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \qmlmodule QtQuick.Controls 2.0
+ \qmlmodule QtQuick.Controls 2.1
\title Qt Quick Controls 2 QML Types
\ingroup qmlmodules
\brief Provides QML types for user interfaces (Qt Quick Controls 2).
@@ -39,7 +39,7 @@
using the following import statement in your .qml file:
\badcode
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
\endcode
\section1 QML Types
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-separators.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-separators.qdoc
new file mode 100644
index 00000000..c4ef1c76
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-separators.qdoc
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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-separators.html
+ \title Separator Controls
+ \ingroup qtquickcontrols2-guidelines
+ \brief Guidelines for separator controls
+
+ Qt Quick Controls 2 offers a selection of separators.
+
+ \annotatedlist qtquickcontrols2-separators
+
+ Each type of separator has its own specific use case. The following
+ sections offer guidelines for choosing the appropriate type of separator,
+ depending on the use case.
+
+ \section1 MenuSeparator Control
+
+ \image qtquickcontrols2-menuseparator.png
+
+ \l MenuSeparator should be used to separate items (typically MenuItem
+ controls) in a Menu. Grouping related menu items together makes it easier
+ for the user to interact with the menu. For example, a typical desktop
+ user interface might have \c Undo and \c Redo items in one group, and
+ \c Cut, \c Copy and \c Paste in another.
+
+ \section1 ToolSeparator Control
+
+ \image qtquickcontrols2-toolseparator.png
+
+ \l ToolSeparator should be used to separate items (typically ToolButton
+ controls) in a ToolBar. It can be used in horizontal or vertical toolbars.
+
+ \section1 Related Information
+ \list
+ \li \l {Qt Quick Controls 2 Guidelines}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
index c0e2daee..104c682f 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
@@ -32,7 +32,7 @@
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}
+ \styleimport {QtQuick.Controls.Universal 2.1} {Qt 5.7}
\section1 Attached Properties
@@ -88,8 +88,8 @@
\li
\qml
import QtQuick 2.0
- import QtQuick.Controls 2.0
- import QtQuick.Controls.Universal 2.0
+ import QtQuick.Controls 2.1
+ import QtQuick.Controls.Universal 2.1
ApplicationWindow {
visible: true
@@ -241,6 +241,11 @@
Available themes:
\value Universal.Light Light theme (default)
\value Universal.Dark Dark theme
+ \value Universal.System System theme
+
+ Setting the theme to \c System chooses either the light or dark theme based
+ on the system theme colors. However, when reading the value of the theme
+ property, the value is never \c System, but the actual theme.
In the following example, the theme for both the pane and the button is set
to \c Universal.Dark:
diff --git a/src/imports/controls/material/ApplicationWindow.qml b/src/imports/controls/material/ApplicationWindow.qml
index db27f25b..0a6b71a3 100644
--- a/src/imports/controls/material/ApplicationWindow.qml
+++ b/src/imports/controls/material/ApplicationWindow.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
import QtQuick.Window 2.2
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/material/BoxShadow.qml b/src/imports/controls/material/BoxShadow.qml
index b70fcee5..4809838e 100644
--- a/src/imports/controls/material/BoxShadow.qml
+++ b/src/imports/controls/material/BoxShadow.qml
@@ -34,10 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtGraphicalEffects 1.0
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
-/*!
+/*
A implementation of CSS's box-shadow, used by ElevationEffect for a Material Design
elevation shadow effect.
*/
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml
index 387ffb71..3077ceb7 100644
--- a/src/imports/controls/material/BusyIndicator.qml
+++ b/src/imports/controls/material/BusyIndicator.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.BusyIndicator {
id: control
diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml
index f2fad313..9b3ced25 100644
--- a/src/imports/controls/material/Button.qml
+++ b/src/imports/controls/material/Button.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Button {
id: control
@@ -62,7 +62,7 @@ T.Button {
font: control.font
color: !control.enabled ? control.Material.hintTextColor :
control.flat && control.highlighted ? control.Material.accentColor :
- control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.primaryTextColor
+ control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.foreground
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
@@ -78,16 +78,19 @@ T.Button {
width: parent.width
height: parent.height - 12
radius: 2
- 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
+ color: !control.enabled ? control.Material.buttonDisabledColor :
+ control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor
+
+ PaddedRectangle {
+ y: parent.height - 4
+ width: parent.width
+ height: 4
+ radius: 2
+ topPadding: -2
+ clip: true
+ visible: control.checkable && (!control.highlighted || control.flat)
+ color: control.checked && control.enabled ? control.Material.accentColor : control.Material.secondaryTextColor
+ }
Behavior on color {
ColorAnimation {
@@ -102,5 +105,15 @@ T.Button {
layer.effect: ElevationEffect {
elevation: control.Material.elevation
}
+
+ Ripple {
+ clipRadius: 2
+ width: parent.width
+ height: parent.height
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ }
}
}
diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml
index 1c6848d8..979654f7 100644
--- a/src/imports/controls/material/CheckBox.qml
+++ b/src/imports/controls/material/CheckBox.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.CheckBox {
id: control
@@ -58,6 +58,18 @@ T.CheckBox {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
+
+ Ripple {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 28; height: 28
+
+ z: -1
+ anchor: control
+ pressed: control.pressed
+ active: control.down || control.visualFocus || control.hovered
+ color: control.checked ? control.Material.highlightedRippleColor : control.Material.rippleColor
+ }
}
contentItem: Text {
@@ -66,7 +78,7 @@ T.CheckBox {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
diff --git a/src/imports/controls/material/CheckDelegate.qml b/src/imports/controls/material/CheckDelegate.qml
index d5785467..aec48bf1 100644
--- a/src/imports/controls/material/CheckDelegate.qml
+++ b/src/imports/controls/material/CheckDelegate.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.CheckDelegate {
id: control
@@ -66,7 +66,7 @@ T.CheckDelegate {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -76,7 +76,17 @@ T.CheckDelegate {
background: Rectangle {
implicitHeight: 48
- visible: control.down || control.highlighted
- color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ color: control.highlighted ? control.Material.listHighlightColor : "transparent"
+
+ Ripple {
+ width: parent.width
+ height: parent.height
+
+ clip: visible
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ }
}
}
diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml
index f64ca168..afc19bc2 100644
--- a/src/imports/controls/material/CheckIndicator.qml
+++ b/src/imports/controls/material/CheckIndicator.qml
@@ -34,8 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
Rectangle {
id: indicatorItem
@@ -46,7 +47,7 @@ Rectangle {
border.width: control.checked ? width / 2 : 2
radius: 2
- property alias control: ripple.control
+ property Item control
Behavior on border.width {
NumberAnimation {
@@ -62,15 +63,6 @@ Rectangle {
}
}
- 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
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 183bcef9..15987ebc 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -34,18 +34,16 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
import QtQuick.Window 2.2
-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
+import QtQuick.Controls 2.1
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
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,
@@ -59,21 +57,23 @@ T.ComboBox {
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
+ Material.elevation: flat ? control.pressed || control.hovered ? 2 : 0
+ : control.pressed ? 8 : 2
+ Material.background: flat ? "transparent" : undefined
+ Material.foreground: flat ? undefined : Material.primaryTextColor
delegate: MenuItem {
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
+ Material.foreground: control.currentIndex === index ? control.popup.Material.accent : control.popup.Material.foreground
highlighted: control.highlightedIndex === index
+ hoverEnabled: control.hoverEnabled
}
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"
+ source: "image://material/drop-indicator/" + (control.enabled ? control.Material.foreground : control.Material.hintTextColor)
}
contentItem: Text {
@@ -82,7 +82,7 @@ T.ComboBox {
text: control.displayText
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
@@ -95,7 +95,7 @@ T.ComboBox {
// external vertical padding is 6 (to increase touch area)
y: 6
height: parent.height - 12
- radius: 2
+ radius: control.flat ? 0 : 2
color: control.Material.dialogColor
Behavior on color {
@@ -104,17 +104,20 @@ T.ComboBox {
}
}
- layer.enabled: control.enabled && control.Material.elevation > 0
+ layer.enabled: control.enabled && control.Material.background.a > 0
layer.effect: ElevationEffect {
elevation: control.Material.elevation
}
- Rectangle {
+ Ripple {
+ clip: control.flat
+ clipRadius: control.flat ? 0 : 2
width: parent.width
height: parent.height
- radius: parent.radius
- visible: control.visualFocus
- color: control.Material.checkBoxUncheckedRippleColor
+ pressed: control.pressed
+ anchor: control
+ active: control.pressed || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
}
}
@@ -154,7 +157,7 @@ T.ComboBox {
background: Rectangle {
radius: 2
- color: control.Material.dialogColor
+ color: control.popup.Material.dialogColor
layer.enabled: control.enabled
layer.effect: ElevationEffect {
diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml
index c07cd423..ce76c2a7 100644
--- a/src/imports/controls/material/Dial.qml
+++ b/src/imports/controls/material/Dial.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Dial {
id: control
@@ -55,7 +56,7 @@ T.Dial {
border.color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor
}
- handle: Rectangle {
+ handle: SliderHandle {
id: handleItem
x: background.x + background.width / 2 - handle.width / 2
@@ -72,7 +73,10 @@ T.Dial {
]
implicitWidth: 14
implicitHeight: 14
- radius: width / 2
- color: control.enabled ? control.Material.accentColor : control.Material.hintTextColor
+
+ value: control.value
+ handleHasFocus: control.visualFocus
+ handlePressed: control.pressed
+ handleHovered: control.hovered
}
}
diff --git a/src/imports/controls/material/Dialog.qml b/src/imports/controls/material/Dialog.qml
new file mode 100644
index 00000000..90cda45a
--- /dev/null
+++ b/src/imports/controls/material/Dialog.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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
+
+T.Dialog {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0,
+ contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (header && header.visible ? header.implicitHeight + spacing : 0)
+ + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
+ + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
+ padding: 24
+ topPadding: 20
+
+ Material.elevation: 24
+
+ enter: Transition {
+ // grow_fade_in
+ NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ exit: Transition {
+ // shrink_fade_out
+ NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ background: Rectangle {
+ radius: 2
+ color: control.Material.dialogColor
+
+ layer.enabled: control.Material.elevation > 0
+ layer.effect: ElevationEffect {
+ elevation: control.Material.elevation
+ }
+ }
+
+ header: Label {
+ text: control.title
+ visible: control.title
+ elide: Label.ElideRight
+ padding: 24
+ bottomPadding: 0
+ // TODO: QPlatformTheme::TitleBarFont
+ font.bold: true
+ font.pixelSize: 16
+ background: PaddedRectangle {
+ radius: 2
+ color: control.Material.dialogColor
+ bottomPadding: -2
+ clip: true
+ }
+ }
+
+ footer: DialogButtonBox {
+ visible: count > 0
+ }
+}
diff --git a/src/imports/controls/material/DialogButtonBox.qml b/src/imports/controls/material/DialogButtonBox.qml
new file mode 100644
index 00000000..312aa4eb
--- /dev/null
+++ b/src/imports/controls/material/DialogButtonBox.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
+
+T.DialogButtonBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ spacing: 8
+ padding: 8
+ topPadding: padding - 4
+ bottomPadding: padding - 4
+ alignment: Qt.AlignRight
+
+ Material.foreground: Material.accent
+
+ delegate: Button { flat: true }
+
+ contentItem: ListView {
+ implicitWidth: contentWidth
+ implicitHeight: 48
+
+ model: control.contentModel
+ spacing: control.spacing
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+ }
+
+ background: PaddedRectangle {
+ implicitHeight: 52
+ radius: 2
+ color: control.Material.dialogColor
+ topPadding: control.position === T.DialogButtonBox.Footer ? -2 : 0
+ bottomPadding: control.position === T.DialogButtonBox.Header ? -2 : 0
+ clip: true
+ }
+}
diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml
index 1c15e689..a4b2e3bc 100644
--- a/src/imports/controls/material/Drawer.qml
+++ b/src/imports/controls/material/Drawer.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Drawer {
id: control
@@ -53,8 +53,6 @@ T.Drawer {
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }
- contentItem: Item { }
-
background: Rectangle {
color: control.Material.dialogColor
diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml
index 4ee4369c..3cf6623c 100644
--- a/src/imports/controls/material/ElevationEffect.qml
+++ b/src/imports/controls/material/ElevationEffect.qml
@@ -34,27 +34,27 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
-/*!
+/*
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.
@@ -62,7 +62,7 @@ Item {
*/
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.
@@ -70,7 +70,7 @@ Item {
*/
property bool fullHeight: false
- /*!
+ /*
\internal
The actual source Item the effect is applied to.
@@ -102,7 +102,7 @@ Item {
* 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
@@ -210,7 +210,7 @@ Item {
{offset: 9, blur: 46, spread: 8}]
]
- /*!
+ /*
\internal
The current shadow based on the elevation.
diff --git a/src/imports/controls/material/Frame.qml b/src/imports/controls/material/Frame.qml
index c2f623ae..08c01353 100644
--- a/src/imports/controls/material/Frame.qml
+++ b/src/imports/controls/material/Frame.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Frame {
id: control
@@ -50,8 +50,6 @@ T.Frame {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
radius: 2
color: control.Material.elevation > 0 ? control.Material.backgroundColor : "transparent"
diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml
index 6d84197c..64b589af 100644
--- a/src/imports/controls/material/GroupBox.qml
+++ b/src/imports/controls/material/GroupBox.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.GroupBox {
id: control
@@ -54,15 +54,13 @@ T.GroupBox {
padding: 12
topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- contentItem: Item {}
-
label: Text {
x: control.leftPadding
width: control.availableWidth
text: control.title
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml
index e43fc981..ec74fbee 100644
--- a/src/imports/controls/material/ItemDelegate.qml
+++ b/src/imports/controls/material/ItemDelegate.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.ItemDelegate {
id: control
@@ -57,7 +58,7 @@ T.ItemDelegate {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -67,7 +68,17 @@ T.ItemDelegate {
background: Rectangle {
implicitHeight: 48
- visible: control.down || control.highlighted
- color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ color: control.highlighted ? control.Material.listHighlightColor : "transparent"
+
+ Ripple {
+ width: parent.width
+ height: parent.height
+
+ clip: visible
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ }
}
}
diff --git a/src/imports/controls/material/Label.qml b/src/imports/controls/material/Label.qml
index 8bda5cc2..3a728dc8 100644
--- a/src/imports/controls/material/Label.qml
+++ b/src/imports/controls/material/Label.qml
@@ -34,13 +34,13 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.Label {
id: control
- color: enabled ? Material.primaryTextColor : Material.hintTextColor
+ color: enabled ? Material.foreground : Material.hintTextColor
linkColor: Material.accentColor
}
diff --git a/src/imports/controls/material/Menu.qml b/src/imports/controls/material/Menu.qml
index b11c00b6..7fe6af0e 100644
--- a/src/imports/controls/material/Menu.qml
+++ b/src/imports/controls/material/Menu.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.6
-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
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Menu {
id: control
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml
index 27c2922c..a6dbba2c 100644
--- a/src/imports/controls/material/MenuItem.qml
+++ b/src/imports/controls/material/MenuItem.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.MenuItem {
id: control
@@ -67,7 +67,7 @@ T.MenuItem {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -77,7 +77,17 @@ T.MenuItem {
background: Rectangle {
implicitWidth: 200
implicitHeight: 48
- visible: control.down || control.highlighted
- color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ color: control.highlighted ? control.Material.listHighlightColor : "transparent"
+
+ Ripple {
+ width: parent.width
+ height: parent.height
+
+ clip: visible
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ }
}
}
diff --git a/src/imports/controls/material/Ripple.qml b/src/imports/controls/material/MenuSeparator.qml
index 15650384..76cac31b 100644
--- a/src/imports/controls/material/Ripple.qml
+++ b/src/imports/controls/material/MenuSeparator.qml
@@ -34,18 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
-Rectangle {
- property Item control
- property bool colored: false
+T.MenuSeparator {
+ id: control
- radius: width / 2
- scale: 2.5
- color: colored ? control.Material.checkBoxCheckedRippleColor : control.Material.checkBoxUncheckedRippleColor
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
- Behavior on opacity {
- NumberAnimation {}
+ topPadding: 8
+ bottomPadding: 8
+
+ contentItem: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 1
+ color: control.Material.dividerColor
}
}
diff --git a/src/imports/controls/material/Page.qml b/src/imports/controls/material/Page.qml
index 92c85b58..c91b16c1 100644
--- a/src/imports/controls/material/Page.qml
+++ b/src/imports/controls/material/Page.qml
@@ -34,14 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.Page {
id: control
- contentItem: Item { }
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(contentWidth,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentHeight + topPadding + bottomPadding
+ + (header && header.visible ? header.implicitHeight + spacing : 0)
+ + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
background: Rectangle {
color: control.Material.backgroundColor
diff --git a/src/imports/controls/material/PageIndicator.qml b/src/imports/controls/material/PageIndicator.qml
index 78372afe..5a68df6b 100644
--- a/src/imports/controls/material/PageIndicator.qml
+++ b/src/imports/controls/material/PageIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.PageIndicator {
id: control
@@ -54,7 +54,7 @@ T.PageIndicator {
implicitHeight: 8
radius: width / 2
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45
Behavior on opacity { OpacityAnimator { duration: 100 } }
diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml
index 251492ea..4aedbd40 100644
--- a/src/imports/controls/material/Pane.qml
+++ b/src/imports/controls/material/Pane.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Pane {
id: control
@@ -50,8 +50,6 @@ T.Pane {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
color: control.Material.backgroundColor
radius: control.Material.elevation > 0 ? 2 : 0
diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml
index 19fd6b79..01b3951a 100644
--- a/src/imports/controls/material/Popup.qml
+++ b/src/imports/controls/material/Popup.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Popup {
id: control
@@ -66,8 +66,6 @@ T.Popup {
NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
}
- contentItem: Item { }
-
background: Rectangle {
radius: 2
color: control.Material.dialogColor
diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml
index eb8bf3ce..2b78be49 100644
--- a/src/imports/controls/material/ProgressBar.qml
+++ b/src/imports/controls/material/ProgressBar.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.ProgressBar {
id: control
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index 3ea2cf4d..32bf1cbd 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.RadioButton {
id: control
@@ -58,6 +58,18 @@ T.RadioButton {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
+
+ Ripple {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 28; height: 28
+
+ z: -1
+ anchor: control
+ pressed: control.pressed
+ active: control.down || control.visualFocus || control.hovered
+ color: control.checked ? control.Material.highlightedRippleColor : control.Material.rippleColor
+ }
}
contentItem: Text {
@@ -66,7 +78,7 @@ T.RadioButton {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml
index 95bfb19b..349352b4 100644
--- a/src/imports/controls/material/RadioDelegate.qml
+++ b/src/imports/controls/material/RadioDelegate.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.RadioDelegate {
id: control
@@ -65,7 +66,7 @@ T.RadioDelegate {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -75,7 +76,17 @@ T.RadioDelegate {
background: Rectangle {
implicitHeight: 48
- visible: control.down || control.highlighted
- color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ color: control.highlighted ? control.Material.listHighlightColor : "transparent"
+
+ Ripple {
+ width: parent.width
+ height: parent.height
+
+ clip: visible
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ }
}
}
diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml
index 4090c732..b1e19656 100644
--- a/src/imports/controls/material/RadioIndicator.qml
+++ b/src/imports/controls/material/RadioIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
Rectangle {
implicitWidth: 20
@@ -46,16 +46,7 @@ Rectangle {
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
- }
+ property Item control
Rectangle {
x: (parent.width - width) / 2
diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml
index dc2c25fa..0233f137 100644
--- a/src/imports/controls/material/RangeSlider.qml
+++ b/src/imports/controls/material/RangeSlider.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.RangeSlider {
id: control
@@ -57,6 +57,7 @@ T.RangeSlider {
value: first.value
handleHasFocus: activeFocus
handlePressed: first.pressed
+ handleHovered: first.hovered
}
second.handle: SliderHandle {
@@ -65,6 +66,7 @@ T.RangeSlider {
value: second.value
handleHasFocus: activeFocus
handlePressed: second.pressed
+ handleHovered: second.hovered
}
background: Rectangle {
@@ -74,7 +76,7 @@ T.RangeSlider {
implicitHeight: horizontal ? 48 : 200
width: horizontal ? control.availableWidth : 1
height: horizontal ? 1 : control.availableHeight
- color: control.Material.primaryTextColor
+ color: control.Material.foreground
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
diff --git a/src/imports/controls/material/RectangularGlow.qml b/src/imports/controls/material/RectangularGlow.qml
new file mode 100644
index 00000000..32c10500
--- /dev/null
+++ b/src/imports/controls/material/RectangularGlow.qml
@@ -0,0 +1,240 @@
+/****************************************************************************
+**
+** 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.0
+
+/*
+ A cross-graphics API implementation of QtGraphicalEffects' RectangularGlow.
+ */
+Item {
+ id: rootItem
+
+ /*
+ This property defines how many pixels outside the item area are reached
+ by the glow.
+
+ The value ranges from 0.0 (no glow) to inf (infinite glow). By default,
+ the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different glowRadius values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_glowRadius1.png
+ \li \image RectangularGlow_glowRadius2.png
+ \li \image RectangularGlow_glowRadius3.png
+ \row
+ \li \b { glowRadius: 10 }
+ \li \b { glowRadius: 20 }
+ \li \b { glowRadius: 40 }
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+
+ */
+ property real glowRadius: 0.0
+
+ /*
+ This property defines how large part of the glow color is strenghtened
+ near the source edges.
+
+ The value ranges from 0.0 (no strenght increase) to 1.0 (maximum
+ strenght increase). By default, the property is set to \c 0.0.
+
+ \table
+ \header
+ \li Output examples with different spread values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_spread1.png
+ \li \image RectangularGlow_spread2.png
+ \li \image RectangularGlow_spread3.png
+ \row
+ \li \b { spread: 0.0 }
+ \li \b { spread: 0.5 }
+ \li \b { spread: 1.0 }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+ */
+ property real spread: 0.0
+
+ /*
+ This property defines the RGBA color value which is used for the glow.
+
+ By default, the property is set to \c "white".
+
+ \table
+ \header
+ \li Output examples with different color values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_color1.png
+ \li \image RectangularGlow_color2.png
+ \li \image RectangularGlow_color3.png
+ \row
+ \li \b { color: #ffffff }
+ \li \b { color: #55ff55 }
+ \li \b { color: #5555ff }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \li \l cornerRadius: 25
+ \endtable
+ */
+ property color color: "white"
+
+ /*
+ This property defines the corner radius that is used to draw a glow with
+ rounded corners.
+
+ The value ranges from 0.0 to half of the effective width or height of
+ the glow, whichever is smaller. This can be calculated with: \c{
+ min(width, height) / 2.0 + glowRadius}
+
+ By default, the property is bound to glowRadius property. The glow
+ behaves as if the rectangle was blurred when adjusting the glowRadius
+ property.
+
+ \table
+ \header
+ \li Output examples with different cornerRadius values
+ \li
+ \li
+ \row
+ \li \image RectangularGlow_cornerRadius1.png
+ \li \image RectangularGlow_cornerRadius2.png
+ \li \image RectangularGlow_cornerRadius3.png
+ \row
+ \li \b { cornerRadius: 0 }
+ \li \b { cornerRadius: 25 }
+ \li \b { cornerRadius: 50 }
+ \row
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \li \l glowRadius: 20
+ \row
+ \li \l spread: 0
+ \li \l spread: 0
+ \li \l spread: 0
+ \row
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \li \l color: #ffffff
+ \endtable
+ */
+ property real cornerRadius: glowRadius
+
+ /*
+ This property allows the effect output pixels to be cached in order to
+ improve the rendering performance.
+
+ Every time the source or effect properties are changed, the pixels in
+ the cache must be updated. Memory consumption is increased, because an
+ extra buffer of memory is required for storing the effect output.
+
+ It is recommended to disable the cache when the source or the effect
+ properties are animated.
+
+ By default, the property is set to \c false.
+ */
+ property bool cached: false
+
+ ShaderEffectSource {
+ id: cacheItem
+ anchors.fill: shaderItem
+ visible: rootItem.cached
+ smooth: true
+ sourceItem: shaderItem
+ live: true
+ hideSource: visible
+ }
+
+ ShaderEffect {
+ id: shaderItem
+
+ x: (parent.width - width) / 2.0
+ y: (parent.height - height) / 2.0
+ width: parent.width + rootItem.glowRadius * 2 + cornerRadius * 2
+ height: parent.height + rootItem.glowRadius * 2 + cornerRadius * 2
+
+ function clampedCornerRadius() {
+ var maxCornerRadius = Math.min(rootItem.width, rootItem.height) / 2 + glowRadius;
+ return Math.max(0, Math.min(rootItem.cornerRadius, maxCornerRadius))
+ }
+
+ property color color: rootItem.color
+ property real inverseSpread: 1.0 - rootItem.spread
+ property real relativeSizeX: ((inverseSpread * inverseSpread) * rootItem.glowRadius + cornerRadius * 2.0) / width
+ property real relativeSizeY: relativeSizeX * (width / height)
+ property real spread: rootItem.spread / 2.0
+ property real cornerRadius: clampedCornerRadius()
+
+ fragmentShader: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Material/shaders/RectangularGlow.frag"
+ }
+}
diff --git a/src/imports/controls/material/RoundButton.qml b/src/imports/controls/material/RoundButton.qml
new file mode 100644
index 00000000..f6899dea
--- /dev/null
+++ b/src/imports/controls/material/RoundButton.qml
@@ -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 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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
+
+T.RoundButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ // external vertical padding is 6 (to increase touch area)
+ padding: 12
+
+ 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.foreground
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ }
+
+ // TODO: Add a proper ripple/ink effect for mouse/touch input and focus state
+ background: Rectangle {
+ implicitWidth: 48
+ implicitHeight: 48
+
+ // external vertical padding is 6 (to increase touch area)
+ x: 6
+ y: 6
+ width: parent.width - 12
+ height: parent.height - 12
+ radius: control.radius
+ color: !control.enabled ? control.Material.buttonDisabledColor
+ : control.checked || control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ radius: control.radius
+ visible: control.hovered || control.visualFocus
+ color: control.Material.rippleColor
+ }
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ radius: control.radius
+ visible: control.down
+ color: control.Material.rippleColor
+ }
+
+ Behavior on color {
+ ColorAnimation {
+ duration: 400
+ }
+ }
+
+ // The layer is disabled when the button color is transparent so that 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
+ }
+ }
+}
diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml
index 84f2d33a..2874f125 100644
--- a/src/imports/controls/material/ScrollBar.qml
+++ b/src/imports/controls/material/ScrollBar.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.ScrollBar {
id: control
@@ -46,33 +46,43 @@ T.ScrollBar {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
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)
+ padding: 1
contentItem: Rectangle {
id: handle
- implicitWidth: 4
- implicitHeight: 4
+ implicitWidth: 13
+ implicitHeight: 13
- color: control.pressed ? control.Material.scrollBarPressedColor : control.Material.scrollBarColor
+ color: control.pressed ? control.Material.scrollBarPressedColor :
+ control.hovered ? control.Material.scrollBarHoveredColor : control.Material.scrollBarColor
visible: control.size < 1.0
opacity: 0.0
+ }
- states: State {
- name: "active"
- when: control.active
- PropertyChanges { target: handle; opacity: 0.75 }
- }
+ background: Rectangle {
+ implicitWidth: 16
+ implicitHeight: 16
+ color: "#0e000000"
+ opacity: 0.0
+ }
- transitions: Transition {
+ states: State {
+ name: "active"
+ when: control.active
+ }
+
+ transitions: [
+ Transition {
+ to: "active"
+ NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 1.0 }
+ },
+ Transition {
from: "active"
SequentialAnimation {
- PauseAnimation { duration: 450 }
- NumberAnimation { target: handle; duration: 200; property: "opacity"; to: 0.0 }
+ PauseAnimation { duration: 2450 }
+ NumberAnimation { targets: [contentItem, background]; property: "opacity"; to: 0.0 }
}
}
- }
+ ]
}
diff --git a/src/imports/controls/material/ScrollIndicator.qml b/src/imports/controls/material/ScrollIndicator.qml
index b5f25d33..3b1dd2c3 100644
--- a/src/imports/controls/material/ScrollIndicator.qml
+++ b/src/imports/controls/material/ScrollIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.ScrollIndicator {
id: control
diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml
index 15c8edb2..d13797c5 100644
--- a/src/imports/controls/material/Slider.qml
+++ b/src/imports/controls/material/Slider.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.Slider {
id: control
@@ -55,6 +55,7 @@ T.Slider {
value: control.value
handleHasFocus: control.visualFocus
handlePressed: control.pressed
+ handleHovered: control.hovered
}
background: Rectangle {
@@ -64,7 +65,7 @@ T.Slider {
implicitHeight: horizontal ? 48 : 200
width: horizontal ? control.availableWidth : 1
height: horizontal ? 1 : control.availableHeight
- color: control.Material.primaryTextColor
+ color: control.Material.foreground
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml
index 49f833d0..ba6260e9 100644
--- a/src/imports/controls/material/SliderHandle.qml
+++ b/src/imports/controls/material/SliderHandle.qml
@@ -34,8 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
Item {
id: root
@@ -45,6 +46,7 @@ Item {
property real value: 0
property bool handleHasFocus: false
property bool handlePressed: false
+ property bool handleHovered: false
readonly property int initialSize: 13
readonly property bool horizontal: control.orientation === Qt.Horizontal
readonly property var control: parent
@@ -65,10 +67,11 @@ Item {
}
Ripple {
- width: parent.width
- height: width
- control: root.control
- colored: true
- opacity: root.handleHasFocus && !root.handlePressed ? 1 : 0
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 22; height: 22
+ pressed: root.handlePressed
+ active: root.handlePressed || root.handleHasFocus || root.handleHovered
+ color: control.Material.rippleColor
}
}
diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml
index e28815e8..6881fc23 100644
--- a/src/imports/controls/material/SpinBox.qml
+++ b/src/imports/controls/material/SpinBox.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.SpinBox {
id: control
@@ -68,9 +68,9 @@ T.SpinBox {
text: control.textFromValue(control.value, control.locale)
font: control.font
- color: enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: enabled ? control.Material.foreground : control.Material.hintTextColor
selectionColor: control.Material.textSelectionColor
- selectedTextColor: control.Material.primaryTextColor
+ selectedTextColor: control.Material.foreground
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
cursorDelegate: Rectangle {
@@ -104,52 +104,64 @@ T.SpinBox {
inputMethodHints: Qt.ImhFormattedNumbersOnly
}
- up.indicator: PaddedRectangle {
+ up.indicator: Item {
x: control.mirrored ? 0 : parent.width - width
implicitWidth: 48
implicitHeight: 48
height: parent.height
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")
+
+ Ripple {
+ clipRadius: 2
+ x: control.spacing
+ y: control.spacing
+ width: parent.width - 2 * control.spacing
+ height: parent.height - 2 * control.spacing
+ pressed: control.up.pressed
+ active: control.up.pressed || control.up.hovered || control.visualFocus
+ color: control.Material.rippleColor
+ }
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: Math.min(parent.width / 3, parent.width / 3)
height: 2
- color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor
+ color: enabled ? control.Material.foreground : 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: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor
+ color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor
}
}
- down.indicator: PaddedRectangle {
+ down.indicator: Item {
x: control.mirrored ? parent.width - width : 0
implicitWidth: 48
implicitHeight: 48
height: parent.height
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")
+
+ Ripple {
+ clipRadius: 2
+ x: control.spacing
+ y: control.spacing
+ width: parent.width - 2 * control.spacing
+ height: parent.height - 2 * control.spacing
+ pressed: control.down.pressed
+ active: control.down.pressed || control.down.hovered || control.visualFocus
+ color: control.Material.rippleColor
+ }
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
width: parent.width / 3
height: 2
- color: enabled ? control.Material.primaryTextColor : control.Material.spinBoxDisabledIconColor
+ color: enabled ? control.Material.foreground : control.Material.spinBoxDisabledIconColor
}
}
diff --git a/src/imports/controls/material/StackView.qml b/src/imports/controls/material/StackView.qml
index 982a37cb..916e910f 100644
--- a/src/imports/controls/material/StackView.qml
+++ b/src/imports/controls/material/StackView.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.4
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
T.StackView {
id: control
diff --git a/src/imports/controls/material/SwipeDelegate.qml b/src/imports/controls/material/SwipeDelegate.qml
index dec2d12f..da54b0c3 100644
--- a/src/imports/controls/material/SwipeDelegate.qml
+++ b/src/imports/controls/material/SwipeDelegate.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.SwipeDelegate {
id: control
@@ -60,7 +60,7 @@ T.SwipeDelegate {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -83,10 +83,20 @@ T.SwipeDelegate {
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
+ visible: control.highlighted
+ color: control.Material.listHighlightColor
+ }
+
+ Ripple {
+ width: parent.width
+ height: parent.height
+
+ clip: visible
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ enabled: control.swipe.position === 0
}
Behavior on x {
diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml
index 38c12b6b..3ac373d5 100644
--- a/src/imports/controls/material/SwipeView.qml
+++ b/src/imports/controls/material/SwipeView.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
T.SwipeView {
id: control
@@ -47,6 +47,7 @@ T.SwipeView {
contentItem: ListView {
model: control.contentModel
+ interactive: control.interactive
currentIndex: control.currentIndex
spacing: control.spacing
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index ca739e62..645dc55a 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
+import QtQuick.Templates 2.1 as T
T.Switch {
id: control
@@ -56,6 +56,15 @@ T.Switch {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
+
+ Ripple {
+ x: parent.handle.x + parent.handle.width / 2 - width / 2
+ y: parent.handle.y + parent.handle.height / 2 - height / 2
+ width: 28; height: 28
+ pressed: control.pressed
+ active: control.down || control.visualFocus || control.hovered
+ color: control.checked ? control.Material.highlightedRippleColor : control.Material.rippleColor
+ }
}
contentItem: Text {
@@ -64,7 +73,7 @@ T.Switch {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml
index 097f0acd..9fb18271 100644
--- a/src/imports/controls/material/SwitchDelegate.qml
+++ b/src/imports/controls/material/SwitchDelegate.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.SwitchDelegate {
id: control
@@ -66,7 +66,7 @@ T.SwitchDelegate {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: control.enabled ? control.Material.foreground : control.Material.hintTextColor
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
@@ -76,7 +76,17 @@ T.SwitchDelegate {
background: Rectangle {
implicitHeight: 48
- visible: control.down || control.highlighted
- color: control.down ? control.Material.buttonPressColor : control.Material.listHighlightColor
+ color: control.highlighted ? control.Material.listHighlightColor : "transparent"
+
+ Ripple {
+ width: parent.width
+ height: parent.height
+
+ clip: visible
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
+ }
}
}
diff --git a/src/imports/controls/material/SwitchIndicator.qml b/src/imports/controls/material/SwitchIndicator.qml
index 0d2163b2..c59e6ac2 100644
--- a/src/imports/controls/material/SwitchIndicator.qml
+++ b/src/imports/controls/material/SwitchIndicator.qml
@@ -34,29 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
Item {
id: indicator
implicitWidth: 38
implicitHeight: 32
- property alias control: ripple.control
+ property Item control
+ property alias handle: handle
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
diff --git a/src/imports/controls/material/TabBar.qml b/src/imports/controls/material/TabBar.qml
index 901e3328..1c3b5c0c 100644
--- a/src/imports/controls/material/TabBar.qml
+++ b/src/imports/controls/material/TabBar.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.TabBar {
id: control
diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml
index 535dfc02..a76df820 100644
--- a/src/imports/controls/material/TabButton.qml
+++ b/src/imports/controls/material/TabButton.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.TabButton {
id: control
@@ -53,12 +54,18 @@ T.TabButton {
text: control.text
font: control.font
elide: Text.ElideRight
- color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.primaryTextColor
+ color: !control.enabled ? control.Material.hintTextColor : control.down || control.checked ? control.Material.accentColor : control.Material.foreground
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- background: Item {
+ background: Ripple {
implicitHeight: 48
+
+ clip: true
+ pressed: control.pressed
+ anchor: control
+ active: control.down || control.visualFocus || control.hovered
+ color: control.Material.rippleColor
}
}
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index 38502ed6..d454796a 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.TextArea {
id: control
@@ -51,7 +51,7 @@ T.TextArea {
topPadding: 8
bottomPadding: 16
- color: enabled ? Material.primaryTextColor : Material.hintTextColor
+ color: enabled ? Material.foreground : Material.hintTextColor
selectionColor: Material.accentColor
selectedTextColor: Material.primaryHighlightedTextColor
cursorDelegate: Rectangle {
diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml
index ab6f6187..8954dd26 100644
--- a/src/imports/controls/material/TextField.qml
+++ b/src/imports/controls/material/TextField.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.TextField {
id: control
@@ -51,7 +51,7 @@ T.TextField {
topPadding: 8
bottomPadding: 16
- color: enabled ? Material.primaryTextColor : Material.hintTextColor
+ color: enabled ? Material.foreground : Material.hintTextColor
selectionColor: Material.accentColor
selectedTextColor: Material.primaryHighlightedTextColor
verticalAlignment: TextInput.AlignVCenter
diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml
index f0b50f73..38acf43e 100644
--- a/src/imports/controls/material/ToolBar.qml
+++ b/src/imports/controls/material/ToolBar.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
-import QtQuick.Controls.Material.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.ToolBar {
id: control
@@ -52,8 +52,6 @@ T.ToolBar {
Material.foreground: Material.toolTextColor
- contentItem: Item { }
-
background: Rectangle {
implicitHeight: 48
color: control.Material.toolBarColor
diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml
index d8c945a7..78b15ac2 100644
--- a/src/imports/controls/material/ToolButton.qml
+++ b/src/imports/controls/material/ToolButton.qml
@@ -34,9 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+import QtQuick.Controls.Material.impl 2.1
T.ToolButton {
id: control
@@ -52,17 +53,27 @@ T.ToolButton {
contentItem: Text {
text: control.text
font: control.font
- color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ color: !control.enabled ? control.Material.hintTextColor :
+ control.checked || control.highlighted ? control.Material.accent : control.Material.foreground
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- background: Rectangle {
+ background: Ripple {
implicitWidth: 48
implicitHeight: 48
- color: control.down ? control.Material.buttonPressColor : control.Material.buttonHoverColor
- visible: control.enabled && (control.down || control.visualFocus || control.checked || control.highlighted)
+ readonly property bool square: control.contentItem.implicitWidth <= control.contentItem.implicitHeight
+
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ clip: !square
+ width: square ? parent.height / 2 : parent.width
+ height: square ? parent.height / 2 : parent.height
+ pressed: control.pressed
+ anchor: control
+ active: control.enabled && (control.down || control.visualFocus || control.hovered)
+ color: control.Material.rippleColor
}
}
diff --git a/src/imports/controls/material/ToolSeparator.qml b/src/imports/controls/material/ToolSeparator.qml
new file mode 100644
index 00000000..c241750a
--- /dev/null
+++ b/src/imports/controls/material/ToolSeparator.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
+
+T.ToolSeparator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+
+ leftPadding: vertical ? 12 : 5
+ rightPadding: vertical ? 12 : 5
+ topPadding: vertical ? 5 : 12
+ bottomPadding: vertical ? 5 : 12
+
+ //! [contentItem]
+ contentItem: Rectangle {
+ implicitWidth: vertical ? 1 : 38
+ implicitHeight: vertical ? 38 : 1
+ color: control.Material.hintTextColor
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/material/ToolTip.qml b/src/imports/controls/material/ToolTip.qml
index ab3b05d8..559b85da 100644
--- a/src/imports/controls/material/ToolTip.qml
+++ b/src/imports/controls/material/ToolTip.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.ToolTip {
id: control
@@ -72,7 +72,7 @@ T.ToolTip {
text: control.text
font: control.font
// TODO: wrapMode: Label.Wrap
- color: control.Material.primaryTextColor
+ color: control.Material.foreground
}
background: Rectangle {
diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml
index 7e914319..a3be17b7 100644
--- a/src/imports/controls/material/Tumbler.qml
+++ b/src/imports/controls/material/Tumbler.qml
@@ -34,10 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Material 2.0
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Material 2.1
T.Tumbler {
id: control
@@ -47,29 +48,23 @@ T.Tumbler {
delegate: Text {
id: label
text: modelData
- color: control.Material.primaryTextColor
+ color: control.Material.foreground
font: control.font
opacity: (1.0 - Math.abs(Tumbler.displacement) / (visibleItemCount / 2)) * (control.enabled ? 1 : 0.6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- contentItem: PathView {
- id: pathView
+ contentItem: TumblerView {
+ id: tumblerView
model: control.model
delegate: control.delegate
- clip: true
- pathItemCount: control.visibleItemCount + 1
- preferredHighlightBegin: 0.5
- preferredHighlightEnd: 0.5
- dragMargin: width / 2
-
path: Path {
- startX: pathView.width / 2
- startY: -pathView.delegateHeight / 2
+ startX: tumblerView.width / 2
+ startY: -tumblerView.delegateHeight / 2
PathLine {
- x: pathView.width / 2
- y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2
+ x: tumblerView.width / 2
+ y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
}
}
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index d6247895..3170a695 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -1,10 +1,12 @@
HEADERS += \
+ $$PWD/qquickmaterialripple_p.h \
$$PWD/qquickmaterialstyle_p.h \
$$PWD/qquickmaterialtheme_p.h \
$$PWD/qquickmaterialprogressring_p.h \
$$PWD/qquickmaterialprogressstrip_p.h
SOURCES += \
+ $$PWD/qquickmaterialripple.cpp \
$$PWD/qquickmaterialstyle.cpp \
$$PWD/qquickmaterialtheme.cpp \
$$PWD/qquickmaterialprogressring.cpp \
@@ -20,6 +22,8 @@ QML_FILES += \
$$PWD/CheckIndicator.qml \
$$PWD/ComboBox.qml \
$$PWD/Dial.qml \
+ $$PWD/Dialog.qml \
+ $$PWD/DialogButtonBox.qml \
$$PWD/Drawer.qml \
$$PWD/ElevationEffect.qml \
$$PWD/Frame.qml \
@@ -28,6 +32,7 @@ QML_FILES += \
$$PWD/Label.qml \
$$PWD/Menu.qml \
$$PWD/MenuItem.qml \
+ $$PWD/MenuSeparator.qml \
$$PWD/Page.qml \
$$PWD/PageIndicator.qml \
$$PWD/Pane.qml \
@@ -37,7 +42,8 @@ QML_FILES += \
$$PWD/RadioDelegate.qml \
$$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
- $$PWD/Ripple.qml \
+ $$PWD/RoundButton.qml \
+ $$PWD/RectangularGlow.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \
$$PWD/Slider.qml \
@@ -55,5 +61,6 @@ QML_FILES += \
$$PWD/TextField.qml \
$$PWD/ToolBar.qml \
$$PWD/ToolButton.qml \
+ $$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
$$PWD/Tumbler.qml
diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro
index 06499467..363e4861 100644
--- a/src/imports/controls/material/material.pro
+++ b/src/imports/controls/material/material.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2materialstyleplugin
TARGETPATH = QtQuick/Controls.2/Material
-IMPORT_VERSION = 2.0
+IMPORT_VERSION = 2.1
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
diff --git a/src/imports/controls/material/qmldir b/src/imports/controls/material/qmldir
index 51dafa08..6125e67d 100644
--- a/src/imports/controls/material/qmldir
+++ b/src/imports/controls/material/qmldir
@@ -2,4 +2,3 @@ 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 8407c7c2..a3564c17 100644
--- a/src/imports/controls/material/qquickmaterialprogressring.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressring.cpp
@@ -41,8 +41,8 @@
#include <QtCore/qset.h>
#include <QtGui/qpainter.h>
#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/qsgsimplerectnode.h>
-#include <QtQuick/qsgsimpletexturenode.h>
+#include <QtQuick/qsgrectanglenode.h>
+#include <QtQuick/qsgimagenode.h>
#include <QtQuick/qquickwindow.h>
QT_BEGIN_NAMESPACE
@@ -79,18 +79,6 @@ private:
qreal m_devicePixelRatio;
QSGNode *m_containerNode;
QQuickWindow *m_window;
-};
-
-class QQuickMaterialRingTexture : public QSGSimpleTextureNode
-{
-public:
- QQuickMaterialRingTexture();
- ~QQuickMaterialRingTexture();
-
- QColor color() const;
- void setColor(QColor color);
-
-private:
QColor m_color;
};
@@ -106,14 +94,15 @@ QQuickMaterialProgressRing::~QQuickMaterialProgressRing()
QSGNode *QQuickMaterialProgressRing::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *)
{
- if (!oldNode)
- oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
-
- static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+ if (!oldNode) {
+ oldNode = window()->createRectangleNode();
+ static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent);
+ }
+ static_cast<QSGRectangleNode *>(oldNode)->setRect(boundingRect());
- QQuickMaterialRingTexture *textureNode = static_cast<QQuickMaterialRingTexture*>(oldNode->firstChild());
+ QSGImageNode *textureNode = static_cast<QSGImageNode *>(oldNode->firstChild());
if (!textureNode) {
- textureNode = new QQuickMaterialRingTexture;
+ textureNode = window()->createImageNode();
textureNode->setOwnsTexture(true);
oldNode->appendChildNode(textureNode);
}
@@ -122,7 +111,6 @@ QSGNode *QQuickMaterialProgressRing::updatePaintNode(QSGNode *oldNode, QQuickIte
// so just use a blank image.
QImage blankImage(width(), height(), QImage::Format_ARGB32_Premultiplied);
blankImage.fill(Qt::transparent);
- textureNode->setColor(m_color);
textureNode->setRect(boundingRect());
textureNode->setTexture(window()->createTextureFromImage(blankImage));
@@ -194,7 +182,7 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
if (!m_containerNode)
return;
- QSGSimpleRectNode *rectNode = static_cast<QSGSimpleRectNode*>(m_containerNode->firstChild());
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(m_containerNode->firstChild());
if (!rectNode)
return;
@@ -209,8 +197,8 @@ void QQuickMaterialRingAnimatorJob::updateCurrentTime(int time)
painter.setRenderHint(QPainter::Antialiasing);
QPen pen;
- QQuickMaterialRingTexture *textureNode = static_cast<QQuickMaterialRingTexture*>(rectNode->firstChild());
- pen.setColor(textureNode->color());
+ QSGImageNode *textureNode = static_cast<QSGImageNode *>(rectNode->firstChild());
+ pen.setColor(m_color);
pen.setWidth(4 * m_devicePixelRatio);
painter.setPen(pen);
@@ -266,24 +254,7 @@ void QQuickMaterialRingAnimatorJob::nodeWasDestroyed()
void QQuickMaterialRingAnimatorJob::afterNodeSync()
{
m_containerNode = QQuickItemPrivate::get(m_target)->childContainerNode();
-}
-
-QQuickMaterialRingTexture::QQuickMaterialRingTexture()
-{
-}
-
-QQuickMaterialRingTexture::~QQuickMaterialRingTexture()
-{
-}
-
-QColor QQuickMaterialRingTexture::color() const
-{
- return m_color;
-}
-
-void QQuickMaterialRingTexture::setColor(QColor color)
-{
- m_color = color;
+ m_color = static_cast<QQuickMaterialProgressRing *>(m_target.data())->color();
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialprogressstrip.cpp b/src/imports/controls/material/qquickmaterialprogressstrip.cpp
index ce4d676e..542d312f 100644
--- a/src/imports/controls/material/qquickmaterialprogressstrip.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressstrip.cpp
@@ -38,10 +38,11 @@
#include <QtCore/qmath.h>
#include <QtCore/qeasingcurve.h>
-#include <QtQuick/qsgsimplerectnode.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickanimatorjob_p.h>
#include <QtQuick/private/qsgadaptationlayer_p.h>
+#include <QtQuick/qsgrectanglenode.h>
+#include <QtQuick/qsgimagenode.h>
QT_BEGIN_NAMESPACE
@@ -81,7 +82,7 @@ void QQuickMaterialProgressStripAnimatorJob::updateCurrentTime(int time)
if (!m_node)
return;
- QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(m_node->firstChild());
+ QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(m_node->firstChild());
Q_ASSERT(!geometryNode || geometryNode->type() == QSGNode::GeometryNodeType);
if (!geometryNode)
return;
@@ -128,7 +129,7 @@ void QQuickMaterialProgressStripAnimatorJob::moveNode(QSGTransformNode *transfor
matrix.translate(x, 0);
transformNode->setMatrix(matrix);
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(transformNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
QRectF r = geometry;
@@ -211,9 +212,11 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa
bounds.setHeight(implicitHeight());
bounds.moveTop((height() - bounds.height()) / 2.0);
- if (!oldNode)
- oldNode = new QSGSimpleRectNode(bounds, Qt::transparent);
- static_cast<QSGSimpleRectNode *>(oldNode)->setRect(bounds);
+ if (!oldNode) {
+ oldNode = window()->createRectangleNode();
+ static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent);
+ }
+ static_cast<QSGRectangleNode *>(oldNode)->setRect(bounds);
const int count = m_indeterminate ? 2 : 1;
const qreal w = m_indeterminate ? 0 : m_progress * width();
@@ -225,14 +228,14 @@ QSGNode *QQuickMaterialProgressStrip::updatePaintNode(QSGNode *oldNode, UpdatePa
transformNode = new QSGTransformNode;
oldNode->appendChildNode(transformNode);
- QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode();
rectNode->setAntialiasing(true);
transformNode->appendChildNode(rectNode);
}
Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType);
static_cast<QSGTransformNode *>(transformNode)->setMatrix(QMatrix4x4());
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(transformNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
rectNode->setRect(rect);
diff --git a/src/imports/controls/material/qquickmaterialripple.cpp b/src/imports/controls/material/qquickmaterialripple.cpp
new file mode 100644
index 00000000..645b0289
--- /dev/null
+++ b/src/imports/controls/material/qquickmaterialripple.cpp
@@ -0,0 +1,451 @@
+/****************************************************************************
+**
+** 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 "qquickmaterialripple_p.h"
+
+#include <QtCore/qmath.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickanimator_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/private/qquickanimatorjob_p.h>
+#include <QtQuick/private/qsgadaptationlayer_p.h>
+#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
+#include <QtQuickTemplates2/private/qquickabstractbutton_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+ enum WavePhase { WaveEnter, WaveExit };
+}
+
+static const int RIPPLE_ENTER_DELAY = 80;
+static const int OPACITY_ENTER_DURATION_FAST = 120;
+static const int WAVE_OPACITY_DECAY_DURATION = 333;
+static const qreal WAVE_TOUCH_UP_ACCELERATION = 3400.0;
+static const qreal WAVE_TOUCH_DOWN_ACCELERATION = 1024.0;
+
+class QQuickMaterialRippleAnimatorJob : public QQuickAnimatorJob
+{
+public:
+ QQuickMaterialRippleAnimatorJob(WavePhase phase, const QPointF &anchor, const QRectF &bounds);
+
+ void initialize(QQuickAnimatorController *controller) override;
+ void updateCurrentTime(int time) override;
+ void writeBack() override;
+ void nodeWasDestroyed() override;
+ void afterNodeSync() override;
+
+private:
+ qreal m_diameter;
+ WavePhase m_phase;
+ QRectF m_bounds;
+ QPointF m_anchor;
+ QSGTransformNode *m_itemNode;
+ QSGOpacityNode *m_opacityNode;
+ QSGInternalRectangleNode *m_rectNode;
+};
+
+QQuickMaterialRippleAnimatorJob::QQuickMaterialRippleAnimatorJob(WavePhase phase, const QPointF &anchor, const QRectF &bounds)
+ : m_diameter(qSqrt(bounds.width() * bounds.width() + bounds.height() * bounds.height())),
+ m_phase(phase),
+ m_bounds(bounds),
+ m_anchor(anchor),
+ m_itemNode(nullptr),
+ m_opacityNode(nullptr),
+ m_rectNode(nullptr)
+{
+}
+
+void QQuickMaterialRippleAnimatorJob::initialize(QQuickAnimatorController *controller)
+{
+ QQuickAnimatorJob::initialize(controller);
+ afterNodeSync();
+}
+
+void QQuickMaterialRippleAnimatorJob::updateCurrentTime(int time)
+{
+ if (!m_itemNode || !m_rectNode)
+ return;
+
+ qreal duration = 0;
+ if (m_phase == WaveEnter)
+ duration = QQuickAnimatorJob::duration();
+ else
+ duration = 1000.0 * qSqrt((m_diameter - m_from) / 2.0 / (WAVE_TOUCH_UP_ACCELERATION + WAVE_TOUCH_DOWN_ACCELERATION));
+
+ qreal p = 1.0;
+ if (!qFuzzyIsNull(duration) && time < duration)
+ p = time / duration;
+
+ m_value = m_from + (m_to - m_from) * p;
+ p = m_value / m_diameter;
+
+ const qreal dx = (1.0 - p) * (m_anchor.x() - m_bounds.width() / 2);
+ const qreal dy = (1.0 - p) * (m_anchor.y() - m_bounds.height() / 2);
+
+ m_rectNode->setRect(QRectF(0, 0, m_value, m_value));
+ m_rectNode->setRadius(m_value / 2);
+ m_rectNode->update();
+
+ QMatrix4x4 m;
+ m.translate((m_bounds.width() - m_value) / 2 + dx,
+ (m_bounds.height() - m_value) / 2 + dy);
+ m_itemNode->setMatrix(m);
+
+ if (m_opacityNode) {
+ qreal opacity = 1.0;
+ if (m_phase == WaveExit)
+ opacity -= static_cast<qreal>(time) / WAVE_OPACITY_DECAY_DURATION;
+ m_opacityNode->setOpacity(opacity);
+ }
+}
+
+void QQuickMaterialRippleAnimatorJob::writeBack()
+{
+ if (m_target)
+ m_target->setSize(QSizeF(m_value, m_value));
+ if (m_phase == WaveExit)
+ m_target->deleteLater();
+}
+
+void QQuickMaterialRippleAnimatorJob::nodeWasDestroyed()
+{
+ m_itemNode = nullptr;
+ m_opacityNode = nullptr;
+ m_rectNode = nullptr;
+}
+
+void QQuickMaterialRippleAnimatorJob::afterNodeSync()
+{
+ m_itemNode = QQuickItemPrivate::get(m_target)->itemNode();
+ m_opacityNode = QQuickItemPrivate::get(m_target)->opacityNode();
+ m_rectNode = static_cast<QSGInternalRectangleNode *>(QQuickItemPrivate::get(m_target)->childContainerNode()->firstChild());
+}
+
+class QQuickMaterialRippleAnimator : public QQuickAnimator
+{
+public:
+ QQuickMaterialRippleAnimator(const QPointF &anchor, const QRectF &bounds, QObject *parent = nullptr);
+
+ WavePhase phase() const;
+ void setPhase(WavePhase phase);
+
+protected:
+ QString propertyName() const override;
+ QQuickAnimatorJob *createJob() const override;
+
+private:
+ QPointF m_anchor;
+ QRectF m_bounds;
+ WavePhase m_phase;
+};
+
+QQuickMaterialRippleAnimator::QQuickMaterialRippleAnimator(const QPointF &anchor, const QRectF &bounds, QObject *parent)
+ : QQuickAnimator(parent), m_anchor(anchor), m_bounds(bounds), m_phase(WaveEnter)
+{
+}
+
+WavePhase QQuickMaterialRippleAnimator::phase() const
+{
+ return m_phase;
+}
+
+void QQuickMaterialRippleAnimator::setPhase(WavePhase phase)
+{
+ if (m_phase == phase)
+ return;
+
+ m_phase = phase;
+}
+
+QString QQuickMaterialRippleAnimator::propertyName() const
+{
+ return QString();
+}
+
+QQuickAnimatorJob *QQuickMaterialRippleAnimator::createJob() const
+{
+ return new QQuickMaterialRippleAnimatorJob(m_phase, m_anchor, m_bounds);
+}
+
+QQuickMaterialRipple::QQuickMaterialRipple(QQuickItem *parent)
+ : QQuickItem(parent), m_active(false), m_pressed(false), m_enterDelay(0), m_trigger(Press), m_clipRadius(0.0), m_anchor(nullptr), m_opacityAnimator(nullptr)
+{
+ setOpacity(0.0);
+ setFlag(ItemHasContents);
+}
+
+bool QQuickMaterialRipple::isActive() const
+{
+ return m_active;
+}
+
+void QQuickMaterialRipple::setActive(bool active)
+{
+ if (active == m_active)
+ return;
+
+ m_active = active;
+
+ if (!m_opacityAnimator) {
+ m_opacityAnimator = new QQuickOpacityAnimator(this);
+ m_opacityAnimator->setTargetItem(this);
+ }
+ m_opacityAnimator->setDuration(active ? OPACITY_ENTER_DURATION_FAST : WAVE_OPACITY_DECAY_DURATION);
+
+ const int time = m_opacityAnimator->currentTime();
+ m_opacityAnimator->stop();
+ m_opacityAnimator->setFrom(opacity());
+ m_opacityAnimator->setTo(active ? 1.0 : 0.0);
+ m_opacityAnimator->setCurrentTime(time);
+ m_opacityAnimator->start();
+}
+
+QColor QQuickMaterialRipple::color() const
+{
+ return m_color;
+}
+
+void QQuickMaterialRipple::setColor(const QColor &color)
+{
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ update();
+}
+
+qreal QQuickMaterialRipple::clipRadius() const
+{
+ return m_clipRadius;
+}
+
+void QQuickMaterialRipple::setClipRadius(qreal radius)
+{
+ if (qFuzzyCompare(m_clipRadius, radius))
+ return;
+
+ m_clipRadius = radius;
+ setClip(!qFuzzyIsNull(radius));
+ update();
+}
+
+bool QQuickMaterialRipple::isPressed() const
+{
+ return m_pressed;
+}
+
+void QQuickMaterialRipple::setPressed(bool pressed)
+{
+ if (pressed == m_pressed)
+ return;
+
+ m_pressed = pressed;
+
+ if (!isEnabled())
+ return;
+
+ if (pressed) {
+ if (m_trigger == Press)
+ prepareWave();
+ else
+ exitWave();
+ } else {
+ if (m_trigger == Release)
+ enterWave();
+ else
+ exitWave();
+ }
+}
+
+QQuickMaterialRipple::Trigger QQuickMaterialRipple::trigger() const
+{
+ return m_trigger;
+}
+
+void QQuickMaterialRipple::setTrigger(Trigger trigger)
+{
+ m_trigger = trigger;
+}
+
+QPointF QQuickMaterialRipple::anchorPoint() const
+{
+ const QRectF bounds = boundingRect();
+ const QPointF center = bounds.center();
+ if (!m_anchor)
+ return center;
+
+ QPointF anchorPoint = bounds.center();
+ if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(m_anchor))
+ anchorPoint = QQuickAbstractButtonPrivate::get(button)->pressPoint;
+ anchorPoint = mapFromItem(m_anchor, anchorPoint);
+
+ // calculate whether the anchor point is within the ripple circle bounds,
+ // that is, whether waves should start expanding from the anchor point
+ const qreal r = qSqrt(bounds.width() * bounds.width() + bounds.height() * bounds.height()) / 2;
+ if (QLineF(center, anchorPoint).length() < r)
+ return anchorPoint;
+
+ // if the anchor point is outside the ripple circle bounds, start expanding
+ // from the intersection point of the ripple circle and a line from its center
+ // to the the anchor point
+ const qreal p = qAtan2(anchorPoint.y() - center.y(), anchorPoint.x() - center.x());
+ return QPointF(center.x() + r * qCos(p), center.y() + r * qSin(p));
+}
+
+QQuickItem *QQuickMaterialRipple::anchor() const
+{
+ return m_anchor;
+}
+
+void QQuickMaterialRipple::setAnchor(QQuickItem *item)
+{
+ m_anchor = item;
+}
+
+void QQuickMaterialRipple::itemChange(ItemChange change, const ItemChangeData &data)
+{
+ QQuickItem::itemChange(change, data);
+
+ if (change == ItemChildRemovedChange) {
+ QQuickMaterialRippleAnimator *animator = data.item->findChild<QQuickMaterialRippleAnimator *>();
+ if (animator)
+ m_rippleAnimators.removeOne(animator);
+ }
+}
+
+QSGNode *QQuickMaterialRipple::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
+{
+ QQuickItemPrivate *d = QQuickItemPrivate::get(this);
+ QQuickDefaultClipNode *clipNode = d->clipNode();
+ if (clipNode) {
+ // TODO: QTBUG-51894
+ // clipNode->setRadius(m_clipRadius);
+ clipNode->setRect(boundingRect());
+ clipNode->update();
+ }
+
+ const qreal w = width();
+ const qreal h = height();
+ const qreal sz = qSqrt(w * w + h * h);
+
+ QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(oldNode);
+ if (!transformNode)
+ transformNode = new QSGTransformNode;
+
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(transformNode->firstChild());
+ if (!rectNode) {
+ rectNode = d->sceneGraphContext()->createInternalRectangleNode();
+ rectNode->setAntialiasing(true);
+ transformNode->appendChildNode(rectNode);
+ }
+
+ QMatrix4x4 matrix;
+ if (qFuzzyIsNull(m_clipRadius)) {
+ matrix.translate((w - sz) / 2, (h - sz) / 2);
+ rectNode->setRect(QRectF(0, 0, sz, sz));
+ rectNode->setRadius(sz / 2);
+ } else {
+ rectNode->setRect(QRectF(0, 0, w, h));
+ rectNode->setRadius(m_clipRadius);
+ }
+ transformNode->setMatrix(matrix);
+ rectNode->setColor(m_color);
+ rectNode->update();
+
+ return transformNode;
+}
+
+void QQuickMaterialRipple::timerEvent(QTimerEvent *event)
+{
+ QQuickItem::timerEvent(event);
+
+ if (event->timerId() == m_enterDelay)
+ enterWave();
+}
+
+void QQuickMaterialRipple::prepareWave()
+{
+ if (m_enterDelay <= 0)
+ m_enterDelay = startTimer(RIPPLE_ENTER_DELAY);
+}
+
+void QQuickMaterialRipple::enterWave()
+{
+ if (m_enterDelay > 0) {
+ killTimer(m_enterDelay);
+ m_enterDelay = 0;
+ }
+
+ const qreal w = width();
+ const qreal h = height();
+ const qreal sz = qSqrt(w * w + h * h);
+
+ QQuickRectangle *wave = new QQuickRectangle(this);
+ wave->setPosition(QPointF((w - sz) / 2, (h - sz) / 2));
+ wave->setSize(QSizeF(sz, sz));
+ wave->setRadius(sz / 2);
+ wave->setColor(color());
+ wave->setOpacity(0.0);
+
+ QQuickMaterialRippleAnimator *animator = new QQuickMaterialRippleAnimator(anchorPoint(), boundingRect(), wave);
+ animator->setDuration(qRound(1000.0 * qSqrt(sz / 2.0 / WAVE_TOUCH_DOWN_ACCELERATION)));
+ animator->setTargetItem(wave);
+ animator->setTo(sz);
+ animator->start();
+ m_rippleAnimators += animator;
+}
+
+void QQuickMaterialRipple::exitWave()
+{
+ if (m_enterDelay > 0) {
+ killTimer(m_enterDelay);
+ m_enterDelay = 0;
+ }
+
+ for (QQuickMaterialRippleAnimator *animator : m_rippleAnimators) {
+ if (animator->phase() == WaveEnter) {
+ animator->stop(); // -> writeBack() -> setSize()
+ if (QQuickItem *wave = animator->targetItem())
+ animator->setFrom(wave->width());
+ animator->setDuration(WAVE_OPACITY_DECAY_DURATION);
+ animator->setPhase(WaveExit);
+ animator->restart();
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialripple_p.h b/src/imports/controls/material/qquickmaterialripple_p.h
new file mode 100644
index 00000000..a1cfed94
--- /dev/null
+++ b/src/imports/controls/material/qquickmaterialripple_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 QQUICKMATERIALRIPPLE_P_H
+#define QQUICKMATERIALRIPPLE_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>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickOpacityAnimator;
+class QQuickMaterialRippleAnimator;
+
+class QQuickMaterialRipple : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(qreal clipRadius READ clipRadius WRITE setClipRadius FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed FINAL)
+ Q_PROPERTY(bool active READ isActive WRITE setActive FINAL)
+ Q_PROPERTY(QQuickItem *anchor READ anchor WRITE setAnchor FINAL)
+ Q_PROPERTY(Trigger trigger READ trigger WRITE setTrigger FINAL)
+
+public:
+ QQuickMaterialRipple(QQuickItem *parent = nullptr);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ qreal clipRadius() const;
+ void setClipRadius(qreal radius);
+
+ bool isActive() const;
+ void setActive(bool active);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ enum Trigger { Press, Release };
+ Q_ENUM (Trigger)
+
+ Trigger trigger() const;
+ void setTrigger(Trigger trigger);
+
+ QPointF anchorPoint() const;
+
+ QQuickItem *anchor() const;
+ void setAnchor(QQuickItem *anchor);
+
+protected:
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
+ void timerEvent(QTimerEvent *event) override;
+
+ void prepareWave();
+ void enterWave();
+ void exitWave();
+
+private:
+ bool m_active;
+ bool m_pressed;
+ int m_enterDelay;
+ Trigger m_trigger;
+ qreal m_clipRadius;
+ QColor m_color;
+ QQuickItem *m_anchor;
+ QQuickOpacityAnimator *m_opacityAnimator;
+ QVector<QQuickMaterialRippleAnimator *> m_rippleAnimators;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickMaterialRipple)
+
+#endif // QQUICKMATERIALRIPPLE_P_H
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 1c19bbd3..08203482 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -408,37 +408,24 @@ static const QRgb raisedButtonColorLight = 0xFFD6D7D7;
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;
-static const QRgb checkBoxUncheckedRippleColorLight = 0x10000000;
-static const QRgb checkBoxUncheckedRippleColorDark = 0x20FFFFFF;
+static const QRgb rippleColorLight = 0x10000000;
+static const QRgb rippleColorDark = 0x20FFFFFF;
static const QRgb spinBoxDisabledIconColorLight = 0xFFCCCCCC;
static const QRgb spinBoxDisabledIconColorDark = 0xFF666666;
-static QColor alphaBlend(const QColor &bg, const QColor &fg)
+extern bool qt_is_dark_system_theme();
+
+static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme theme)
{
- QColor result;
- result.setRedF(fg.redF() * fg.alphaF() + bg.redF() * (1.0 - fg.alphaF()));
- result.setGreenF(fg.greenF() * fg.alphaF() + bg.greenF() * (1.0 - fg.alphaF()));
- result.setBlueF(fg.blueF() * fg.alphaF() + bg.blueF() * (1.0 - fg.alphaF()));
- result.setAlphaF(bg.alphaF() + fg.alphaF() * (1.0 - bg.alphaF()));
- return result;
+ if (theme == QQuickMaterialStyle::System)
+ theme = qt_is_dark_system_theme() ? QQuickMaterialStyle::Dark : QQuickMaterialStyle::Light;
+ return theme;
}
QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickStyleAttached(parent),
@@ -475,6 +462,9 @@ QQuickMaterialStyle::Theme QQuickMaterialStyle::theme() const
void QQuickMaterialStyle::setTheme(Theme theme)
{
+ if (theme == System)
+ theme = qt_is_dark_system_theme() ? Dark : Light;
+
m_explicitTheme = true;
if (m_theme == theme)
return;
@@ -648,7 +638,13 @@ void QQuickMaterialStyle::resetAccent()
QVariant QQuickMaterialStyle::foreground() const
{
- return primaryTextColor();
+ 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 QColor::fromRgba(colors[m_foreground][Shade500]);
}
void QQuickMaterialStyle::setForeground(const QVariant &var)
@@ -824,13 +820,7 @@ QColor QQuickMaterialStyle::backgroundColor() const
QColor QQuickMaterialStyle::primaryTextColor() const
{
- 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];
+ return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark);
}
QColor QQuickMaterialStyle::primaryHighlightedTextColor() const
@@ -877,10 +867,9 @@ QColor QQuickMaterialStyle::iconDisabledColor() const
return QColor::fromRgba(m_theme == Light ? iconDisabledColorLight : iconDisabledColorDark);
}
-QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hover) const
+QColor QQuickMaterialStyle::buttonColor(bool highlighted) const
{
- Shade shade = pressed ? (m_theme == Light ? Shade700 : Shade100)
- : themeShade();
+ Shade shade = themeShade();
QColor color = Qt::transparent;
@@ -891,45 +880,14 @@ QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hov
} 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;
- }
+ return color;
}
QColor QQuickMaterialStyle::buttonColor() const
{
- return buttonColor(false, false, false);
-}
-
-QColor QQuickMaterialStyle::buttonHoverColor() const
-{
- return buttonColor(false, false, true);
-}
-
-QColor QQuickMaterialStyle::buttonPressColor() const
-{
- return buttonColor(false, true, false);
+ return buttonColor(false);
}
QColor QQuickMaterialStyle::buttonDisabledColor() const
@@ -944,37 +902,7 @@ QColor QQuickMaterialStyle::buttonDisabledColor() const
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::swipeDelegateColor() const
-{
- return QColor::fromRgba(m_theme == Light ? swipeDelegateColorLight : swipeDelegateColorDark);
-}
-
-QColor QQuickMaterialStyle::swipeDelegateHoverColor() const
-{
- return QColor::fromRgba(m_theme == Light ? swipeDelegateHoverColorLight : swipeDelegateHoverColorDark);
-}
-
-QColor QQuickMaterialStyle::swipeDelegatePressColor() const
-{
- return QColor::fromRgba(m_theme == Light ? swipeDelegatePressColorLight : swipeDelegatePressColorDark);
-}
-
-QColor QQuickMaterialStyle::swipeDelegateDisabledColor() const
-{
- return QColor::fromRgba(m_theme == Light ? swipeDelegateDisabledColorLight : swipeDelegateDisabledColorDark);
+ return buttonColor(true);
}
QColor QQuickMaterialStyle::frameColor() const
@@ -982,12 +910,12 @@ QColor QQuickMaterialStyle::frameColor() const
return QColor::fromRgba(m_theme == Light ? frameColorLight : frameColorDark);
}
-QColor QQuickMaterialStyle::checkBoxUncheckedRippleColor() const
+QColor QQuickMaterialStyle::rippleColor() const
{
- return QColor::fromRgba(m_theme == Light ? checkBoxUncheckedRippleColorLight : checkBoxUncheckedRippleColorDark);
+ return QColor::fromRgba(m_theme == Light ? rippleColorLight : rippleColorDark);
}
-QColor QQuickMaterialStyle::checkBoxCheckedRippleColor() const
+QColor QQuickMaterialStyle::highlightedRippleColor() const
{
QColor pressColor = accentColor();
pressColor.setAlpha(m_theme == Light ? 30 : 50);
@@ -1031,6 +959,11 @@ QColor QQuickMaterialStyle::scrollBarColor() const
return QColor::fromRgba(m_theme == Light ? 0x40000000 : 0x40FFFFFF);
}
+QColor QQuickMaterialStyle::scrollBarHoveredColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? 0x60000000 : 0x60FFFFFF);
+}
+
QColor QQuickMaterialStyle::scrollBarPressedColor() const
{
return QColor::fromRgba(m_theme == Light ? 0x80000000 : 0x80FFFFFF);
@@ -1242,7 +1175,7 @@ void QQuickMaterialStyle::init()
QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme"));
Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
if (ok)
- globalTheme = m_theme = themeEnum;
+ globalTheme = m_theme = effectiveTheme(themeEnum);
else if (!themeValue.isEmpty())
qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue;
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index af5638f1..78fef272 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -67,7 +67,7 @@ class QQuickMaterialStyle : public QQuickStyleAttached
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 backgroundChanged FINAL)
- Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY foregroundChanged FINAL) // TODO: rename to foregroundColor()?
+ Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY paletteChanged FINAL)
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)
@@ -77,19 +77,11 @@ class QQuickMaterialStyle : public QQuickStyleAttached
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)
+ Q_PROPERTY(QColor rippleColor READ rippleColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor highlightedRippleColor READ highlightedRippleColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor switchUncheckedTrackColor READ switchUncheckedTrackColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor switchCheckedTrackColor READ switchCheckedTrackColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor switchUncheckedHandleColor READ switchUncheckedHandleColor NOTIFY paletteChanged FINAL)
@@ -97,6 +89,7 @@ class QQuickMaterialStyle : public QQuickStyleAttached
Q_PROPERTY(QColor switchDisabledTrackColor READ switchDisabledTrackColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor switchDisabledHandleColor READ switchDisabledHandleColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor scrollBarHoveredColor READ scrollBarHoveredColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL)
@@ -109,7 +102,8 @@ class QQuickMaterialStyle : public QQuickStyleAttached
public:
enum Theme {
Light,
- Dark
+ Dark,
+ System
};
enum Color {
@@ -206,20 +200,12 @@ public:
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;
+ QColor rippleColor() const;
+ QColor highlightedRippleColor() const;
QColor switchUncheckedTrackColor() const;
QColor switchCheckedTrackColor() const;
QColor switchUncheckedHandleColor() const;
@@ -227,6 +213,7 @@ public:
QColor switchDisabledTrackColor() const;
QColor switchDisabledHandleColor() const;
QColor scrollBarColor() const;
+ QColor scrollBarHoveredColor() const;
QColor scrollBarPressedColor() const;
QColor dialogColor() const;
QColor backgroundDimColor() const;
@@ -258,7 +245,7 @@ private:
QColor backgroundColor(Shade shade) const;
QColor accentColor(Shade shade) const;
- QColor buttonColor(bool highlighted, bool pressed, bool hover) const;
+ QColor buttonColor(bool highlighted) const;
Shade themeShade() const;
// These reflect whether a color value was explicitly set on the specific
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
index ac11e95b..27d2c5a6 100644
--- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
@@ -40,9 +40,11 @@
#include "qquickmaterialtheme_p.h"
#include "qquickmaterialprogressring_p.h"
#include "qquickmaterialprogressstrip_p.h"
+#include "qquickmaterialripple_p.h"
#include <QtQuickControls2/private/qquickstyleselector_p.h>
#include <QtQuickControls2/private/qquickpaddedrectangle_p.h>
+#include <QtQuickControls2/private/qquickcolorimageprovider_p.h>
static inline void initResources()
{
@@ -77,22 +79,27 @@ QtQuickControls2MaterialStylePlugin::QtQuickControls2MaterialStylePlugin(QObject
void QtQuickControls2MaterialStylePlugin::registerTypes(const char *uri)
{
qmlRegisterUncreatableType<QQuickMaterialStyle>(uri, 2, 0, "Material", tr("Material is an attached property"));
+ qmlRegisterRevision<QQuickMaterialStyle, 1>(uri, 2, 1);
}
void QtQuickControls2MaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
QQuickStylePlugin::initializeEngine(engine, uri);
+ engine->addImageProvider(name(), new QQuickColorImageProvider(QStringLiteral(":/qt-project.org/imports/QtQuick/Controls.2/Material/images")));
+
QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterType<QQuickPaddedRectangle>(import, 2, 0, "PaddedRectangle");
+ qmlRegisterRevision<QQuickPaddedRectangle, 1>(import, 2, 1);
qmlRegisterType<QQuickMaterialProgressRing>(import, 2, 0, "ProgressRing");
qmlRegisterType<QQuickMaterialProgressStrip>(import, 2, 0, "ProgressStrip");
qmlRegisterType<QQuickMaterialRingAnimator>(import, 2, 0, "RingAnimator");
+ qmlRegisterType<QQuickMaterialRipple>(import, 2, 0, "Ripple");
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("RectangularGlow.qml")), import, 2, 0, "RectangularGlow");
qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle");
qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
}
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
index 47257ce4..e2cc90fa 100644
--- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.qrc
@@ -8,5 +8,8 @@
<file>images/drop-indicator@2x.png</file>
<file>images/drop-indicator@3x.png</file>
<file>images/drop-indicator@4x.png</file>
+ <file>shaders/RectangularGlow.frag</file>
+ <file>shaders/+glslcore/RectangularGlow.frag</file>
+ <file>shaders/+hlsl/RectangularGlow.frag</file>
</qresource>
</RCC>
diff --git a/src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag b/src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag
new file mode 100644
index 00000000..432d86b5
--- /dev/null
+++ b/src/imports/controls/material/shaders/+glslcore/RectangularGlow.frag
@@ -0,0 +1,25 @@
+#version 150
+
+uniform float qt_Opacity;
+uniform float relativeSizeX;
+uniform float relativeSizeY;
+uniform float spread;
+uniform vec4 color;
+
+in vec2 qt_TexCoord0;
+out vec4 fragColor;
+
+float linearstep(float e0, float e1, float x)
+{
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+}
+
+void main()
+{
+ float alpha =
+ smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
+ smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
+
+ float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
+ fragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
+}
diff --git a/src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag b/src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag
new file mode 100644
index 00000000..69d9f852
--- /dev/null
+++ b/src/imports/controls/material/shaders/+hlsl/RectangularGlow.frag
@@ -0,0 +1,21 @@
+cbuffer ConstantBuffer : register(b0)
+{
+ float4x4 qt_Matrix;
+ float qt_Opacity;
+ float relativeSizeX;
+ float relativeSizeY;
+ float spread;
+ float4 color;
+}
+
+float linearstep(float e0, float e1, float x) { return clamp((x - e0) / (e1 - e0), 0.0, 1.0); }
+
+float4 main(float4 position : SV_POSITION, float2 coord : TEXCOORD0) : SV_TARGET
+{
+ float alpha =
+ smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - coord.x)) *
+ smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - coord.y));
+
+ float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
+ return color * qt_Opacity * spreadMultiplier * spreadMultiplier;
+}
diff --git a/src/imports/controls/material/shaders/RectangularGlow.frag b/src/imports/controls/material/shaders/RectangularGlow.frag
new file mode 100644
index 00000000..40bab580
--- /dev/null
+++ b/src/imports/controls/material/shaders/RectangularGlow.frag
@@ -0,0 +1,19 @@
+uniform highp float qt_Opacity;
+uniform mediump float relativeSizeX;
+uniform mediump float relativeSizeY;
+uniform mediump float spread;
+uniform lowp vec4 color;
+varying highp vec2 qt_TexCoord0;
+
+highp float linearstep(highp float e0, highp float e1, highp float x) {
+ return clamp((x - e0) / (e1 - e0), 0.0, 1.0);
+}
+
+void main() {
+ lowp float alpha =
+ smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) *
+ smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y));
+
+ highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha);
+ gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier;
+}
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes
index e661056c..de4e26f8 100644
--- a/src/imports/controls/plugins.qmltypes
+++ b/src/imports/controls/plugins.qmltypes
@@ -4,82 +4,14 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.0 -merge ..\templates\plugins.qmltypes -dependencies dep.json'
+// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.1 -merge ../templates/plugins.qmltypes -dependencies dependencies.json'
Module {
- dependencies: ["QtQuick.Templates 2.0", "QtQuick.Window 2.2", "QtQuick 2.7"]
- Component {
- 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: "runningChanged"
- Parameter { type: "bool" }
- }
- Signal {
- 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: "QQuickAnimator"
- prototype: "QQuickAbstractAnimation"
- exports: [
- "QtQuick.Controls.impl/BusyRingAnimator 2.0",
- "QtQuick.Controls.impl/ProgressStripAnimator 2.0"
- ]
- 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: "durationChanged"
- Parameter { name: "duration"; type: "int" }
- }
- Signal {
- name: "easingChanged"
- Parameter { name: "curve"; type: "QEasingCurve" }
- }
- Signal {
- name: "toChanged"
- Parameter { name: "to"; type: "double" }
- }
- Signal {
- name: "fromChanged"
- Parameter { name: "from"; type: "double" }
- }
- }
+ dependencies: [
+ "QtQuick 2.8",
+ "QtQuick.Templates 2.1",
+ "QtQuick.Window 2.2"
+ ]
Component {
name: "QQuickBusyIndicatorRing"
defaultProperty: "data"
@@ -88,26 +20,51 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
- name: "QQuickButtonGroup"
+ name: "QQuickDefaultStyle"
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 }
+ exports: ["QtQuick.Controls.impl/Default 2.1"]
+ isCreatable: false
+ isSingleton: true
+ exportMetaObjectRevisions: [0]
+ Property { name: "backgroundColor"; type: "QColor"; isReadonly: true }
+ Property { name: "overlayModalColor"; type: "QColor"; isReadonly: true }
+ Property { name: "overlayDimColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textDarkColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textLightColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textLinkColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textSelectionColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textDisabledColor"; type: "QColor"; isReadonly: true }
+ Property { name: "textDisabledLightColor"; type: "QColor"; isReadonly: true }
+ Property { name: "focusColor"; type: "QColor"; isReadonly: true }
+ Property { name: "focusLightColor"; type: "QColor"; isReadonly: true }
+ Property { name: "focusPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonColor"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonCheckedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonCheckedPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "buttonCheckedFocusColor"; type: "QColor"; isReadonly: true }
+ Property { name: "toolButtonColor"; type: "QColor"; isReadonly: true }
+ Property { name: "tabButtonColor"; type: "QColor"; isReadonly: true }
+ Property { name: "tabButtonPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "tabButtonCheckedPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "delegateColor"; type: "QColor"; isReadonly: true }
+ Property { name: "delegatePressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "delegateFocusColor"; type: "QColor"; isReadonly: true }
+ Property { name: "indicatorPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "indicatorDisabledColor"; type: "QColor"; isReadonly: true }
+ Property { name: "indicatorFrameColor"; type: "QColor"; isReadonly: true }
+ Property { name: "indicatorFramePressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "indicatorFrameDisabledColor"; type: "QColor"; isReadonly: true }
+ Property { name: "frameDarkColor"; type: "QColor"; isReadonly: true }
+ Property { name: "frameLightColor"; type: "QColor"; isReadonly: true }
+ Property { name: "scrollBarColor"; type: "QColor"; isReadonly: true }
+ Property { name: "scrollBarPressedColor"; type: "QColor"; isReadonly: true }
+ Property { name: "progressBarColor"; type: "QColor"; isReadonly: true }
+ Property { name: "pageIndicatorColor"; type: "QColor"; isReadonly: true }
+ Property { name: "separatorColor"; type: "QColor"; isReadonly: true }
+ Property { name: "disabledDarkColor"; type: "QColor"; isReadonly: true }
+ Property { name: "disabledLightColor"; type: "QColor"; isReadonly: true }
}
Component {
name: "QQuickDialRing"
@@ -119,24 +76,6 @@ Module {
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"
@@ -146,6 +85,24 @@ Module {
Property { name: "progress"; type: "double" }
}
Component {
+ name: "QQuickTumblerView"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["QtQuick.Controls.impl/TumblerView 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "path"; type: "QQuickPath"; isPointer: true }
+ }
+ Component {
+ prototype: "QQuickAbstractButton"
+ name: "QtQuick.Controls/AbstractButton 2.0"
+ exports: ["QtQuick.Controls/AbstractButton 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickApplicationWindow"
name: "QtQuick.Controls/ApplicationWindow 2.0"
exports: ["QtQuick.Controls/ApplicationWindow 2.0"]
@@ -186,17 +143,13 @@ Module {
defaultProperty: "data"
}
Component {
- prototype: "QQuickItem"
+ prototype: "QQuickRectangle"
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"
@@ -207,6 +160,22 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickContainer"
+ name: "QtQuick.Controls/Container 2.0"
+ exports: ["QtQuick.Controls/Container 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickControl"
+ name: "QtQuick.Controls/Control 2.0"
+ exports: ["QtQuick.Controls/Control 2.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickDial"
name: "QtQuick.Controls/Dial 2.0"
exports: ["QtQuick.Controls/Dial 2.0"]
@@ -215,6 +184,22 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickDialog"
+ name: "QtQuick.Controls/Dialog 2.1"
+ exports: ["QtQuick.Controls/Dialog 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickDialogButtonBox"
+ name: "QtQuick.Controls/DialogButtonBox 2.1"
+ exports: ["QtQuick.Controls/DialogButtonBox 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
prototype: "QQuickDrawer"
name: "QtQuick.Controls/Drawer 2.0"
exports: ["QtQuick.Controls/Drawer 2.0"]
@@ -271,6 +256,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickMenuSeparator"
+ name: "QtQuick.Controls/MenuSeparator 2.1"
+ exports: ["QtQuick.Controls/MenuSeparator 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickPage"
name: "QtQuick.Controls/Page 2.0"
exports: ["QtQuick.Controls/Page 2.0"]
@@ -327,17 +320,13 @@ Module {
defaultProperty: "data"
}
Component {
- prototype: "QQuickItem"
+ prototype: "QQuickRectangle"
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"
@@ -348,6 +337,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickRoundButton"
+ name: "QtQuick.Controls/RoundButton 2.1"
+ exports: ["QtQuick.Controls/RoundButton 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickScrollBar"
name: "QtQuick.Controls/ScrollBar 2.0"
exports: ["QtQuick.Controls/ScrollBar 2.0"]
@@ -477,6 +474,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickToolSeparator"
+ name: "QtQuick.Controls/ToolSeparator 2.1"
+ exports: ["QtQuick.Controls/ToolSeparator 2.1"]
+ exportMetaObjectRevisions: [1]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickToolTip"
name: "QtQuick.Controls/ToolTip 2.0"
exports: ["QtQuick.Controls/ToolTip 2.0"]
@@ -492,6 +497,7 @@ Module {
isComposite: true
defaultProperty: "data"
}
+
Component {
name: "QQuickAbstractButton"
defaultProperty: "data"
@@ -502,6 +508,7 @@ Module {
Property { name: "down"; type: "bool" }
Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "checked"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
Property { name: "autoExclusive"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Signal { name: "pressed" }
@@ -553,12 +560,41 @@ Module {
prototype: "QQuickAbstractButton"
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: "QQuickButtonGroup"
+ prototype: "QObject"
+ exports: [
+ "QtQuick.Templates/ButtonGroup 2.0",
+ "QtQuick.Templates/ButtonGroup 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickButtonGroupAttached"
+ Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true }
+ Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true }
+ Signal {
+ name: "clicked"
+ revision: 1
+ Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: 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: "QQuickCheckBox"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
@@ -580,11 +616,15 @@ Module {
name: "QQuickComboBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/ComboBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/ComboBox 2.0",
+ "QtQuick.Templates/ComboBox 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
+ Property { name: "flat"; revision: 1; type: "bool" }
Property { name: "pressed"; type: "bool" }
Property { name: "highlightedIndex"; type: "int"; isReadonly: true }
Property { name: "currentIndex"; type: "int" }
@@ -594,6 +634,7 @@ Module {
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
+ Signal { name: "flatChanged"; revision: 1 }
Signal {
name: "activated"
Parameter { name: "index"; type: "int" }
@@ -625,8 +666,11 @@ Module {
name: "QQuickContainer"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Container 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Container 2.0",
+ "QtQuick.Templates/Container 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
@@ -637,6 +681,8 @@ Module {
name: "setCurrentIndex"
Parameter { name: "index"; type: "int" }
}
+ Method { name: "incrementCurrentIndex"; revision: 1 }
+ Method { name: "decrementCurrentIndex"; revision: 1 }
Method {
name: "itemAt"
type: "QQuickItem*"
@@ -715,6 +761,58 @@ Module {
Method { name: "decrease" }
}
Component {
+ name: "QQuickDialog"
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["QtQuick.Templates/Dialog 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
+ Property { name: "header"; type: "QQuickItem"; isPointer: true }
+ Property { name: "footer"; type: "QQuickItem"; isPointer: true }
+ Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "accept" }
+ Method { name: "reject" }
+ }
+ Component {
+ name: "QQuickDialogButtonBox"
+ defaultProperty: "contentData"
+ prototype: "QQuickContainer"
+ exports: ["QtQuick.Templates/DialogButtonBox 2.1"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickDialogButtonBoxAttached"
+ Enum {
+ name: "Position"
+ values: {
+ "Header": 0,
+ "Footer": 1
+ }
+ }
+ Property { name: "position"; type: "Position" }
+ Property { name: "alignment"; type: "Qt::Alignment" }
+ Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Signal { name: "helpRequested" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true }
+ }
+ Method {
+ name: "standardButton"
+ type: "QQuickAbstractButton*"
+ Parameter { name: "button"; type: "QPlatformDialogHelper::StandardButton" }
+ }
+ }
+ Component {
+ name: "QQuickDialogButtonBoxAttached"
+ prototype: "QObject"
+ Property { name: "buttonBox"; type: "QQuickDialogButtonBox"; isReadonly: true; isPointer: true }
+ Property { name: "buttonRole"; type: "QPlatformDialogHelper::ButtonRole" }
+ }
+ Component {
name: "QQuickDrawer"
defaultProperty: "contentData"
prototype: "QQuickPopup"
@@ -741,15 +839,6 @@ Module {
Property { name: "label"; type: "QQuickItem"; isPointer: true }
}
Component {
- name: "QQuickImplicitSizeItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- Property { name: "implicitWidth"; type: "double"; isReadonly: true }
- Property { name: "implicitHeight"; type: "double"; isReadonly: true }
- Signal { name: "implicitWidthChanged2"; revision: 1 }
- Signal { name: "implicitHeightChanged2"; revision: 1 }
- }
- Component {
name: "QQuickItemDelegate"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
@@ -805,16 +894,22 @@ Module {
prototype: "QQuickAbstractButton"
exports: ["QtQuick.Templates/MenuItem 2.0"]
exportMetaObjectRevisions: [0]
- Property { name: "checkable"; type: "bool" }
Property { name: "highlighted"; type: "bool" }
Signal { name: "triggered" }
}
Component {
+ name: "QQuickMenuSeparator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/MenuSeparator 2.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickOverlay"
defaultProperty: "data"
prototype: "QQuickItem"
- Property { name: "modal"; type: "QQuickItem"; isPointer: true }
- Property { name: "modeless"; type: "QQuickItem"; isPointer: true }
+ Property { name: "modal"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "modeless"; type: "QQmlComponent"; isPointer: true }
Signal { name: "pressed" }
Signal { name: "released" }
}
@@ -822,13 +917,17 @@ Module {
name: "QQuickPage"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Page 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick.Templates/Page 2.0", "QtQuick.Templates/Page 2.1"]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "title"; type: "string" }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
+ Property { name: "contentWidth"; revision: 1; type: "double" }
+ Property { name: "contentHeight"; revision: 1; type: "double" }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Signal { name: "contentWidthChanged"; revision: 1 }
+ Signal { name: "contentHeightChanged"; revision: 1 }
}
Component {
name: "QQuickPageIndicator"
@@ -856,8 +955,11 @@ Module {
name: "QQuickPopup"
defaultProperty: "contentData"
prototype: "QObject"
- exports: ["QtQuick.Templates/Popup 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Popup 2.0",
+ "QtQuick.Templates/Popup 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "ClosePolicy"
values: {
@@ -894,6 +996,7 @@ Module {
Property { name: "contentHeight"; type: "double" }
Property { name: "availableWidth"; type: "double"; isReadonly: true }
Property { name: "availableHeight"; type: "double"; isReadonly: true }
+ Property { name: "spacing"; revision: 1; type: "double" }
Property { name: "margins"; type: "double" }
Property { name: "topMargin"; type: "double" }
Property { name: "leftMargin"; type: "double" }
@@ -923,6 +1026,7 @@ Module {
Property { name: "transformOrigin"; type: "TransformOrigin" }
Property { name: "enter"; type: "QQuickTransition"; isPointer: true }
Property { name: "exit"; type: "QQuickTransition"; isPointer: true }
+ Signal { name: "spacingChanged"; revision: 1 }
Signal {
name: "windowChanged"
Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
@@ -933,6 +1037,11 @@ Module {
Signal { name: "closed" }
Method { name: "open" }
Method { name: "close" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method { name: "forceActiveFocus" }
}
Component {
name: "QQuickProgressBar"
@@ -965,8 +1074,11 @@ Module {
name: "QQuickRangeSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/RangeSlider 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/RangeSlider 2.0",
+ "QtQuick.Templates/RangeSlider 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "SnapMode"
values: {
@@ -996,21 +1108,18 @@ Module {
Property { name: "visualPosition"; type: "double"; isReadonly: true }
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; revision: 1; type: "bool" }
+ Signal { name: "hoveredChanged"; revision: 1 }
Method { name: "increase" }
Method { name: "decrease" }
}
Component {
- name: "QQuickRootItem"
+ name: "QQuickRoundButton"
defaultProperty: "data"
- prototype: "QQuickItem"
- Method {
- name: "setWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "h"; type: "int" }
- }
+ prototype: "QQuickButton"
+ exports: ["QtQuick.Templates/RoundButton 2.1"]
+ exportMetaObjectRevisions: [1]
+ Property { name: "radius"; type: "double" }
}
Component {
name: "QQuickScrollBar"
@@ -1072,8 +1181,11 @@ Module {
name: "QQuickSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Slider 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Slider 2.0",
+ "QtQuick.Templates/Slider 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "SnapMode"
values: {
@@ -1094,13 +1206,22 @@ Module {
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Method { name: "increase" }
Method { name: "decrease" }
+ Method {
+ name: "valueAt"
+ revision: 1
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
}
Component {
name: "QQuickSpinBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/SpinBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/SpinBox 2.0",
+ "QtQuick.Templates/SpinBox 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "from"; type: "int" }
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
@@ -1118,7 +1239,9 @@ Module {
name: "QQuickSpinButton"
prototype: "QObject"
Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; revision: 1; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ Signal { name: "hoveredChanged"; revision: 1 }
}
Component {
name: "QQuickStackAttached"
@@ -1126,13 +1249,21 @@ Module {
Property { name: "index"; type: "int"; isReadonly: true }
Property { name: "view"; type: "QQuickStackView"; isReadonly: true; isPointer: true }
Property { name: "status"; type: "QQuickStackView::Status"; isReadonly: true }
+ Signal { name: "activated" }
+ Signal { name: "activating" }
+ Signal { name: "deactivated" }
+ Signal { name: "deactivating" }
+ Signal { name: "removed" }
}
Component {
name: "QQuickStackView"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/StackView 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/StackView 2.0",
+ "QtQuick.Templates/StackView 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickStackAttached"
Enum {
name: "Status"
@@ -1153,8 +1284,11 @@ Module {
Enum {
name: "Operation"
values: {
- "Transition": 0,
- "Immediate": 1
+ "Transition": -1,
+ "Immediate": 0,
+ "PushTransition": 1,
+ "ReplaceTransition": 2,
+ "PopTransition": 3
}
}
Property { name: "busy"; type: "bool"; isReadonly: true }
@@ -1214,28 +1348,47 @@ Module {
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 }
+ Signal { name: "completed"; revision: 1 }
+ Method { name: "close"; revision: 1 }
}
Component {
name: "QQuickSwipeDelegate"
defaultProperty: "data"
prototype: "QQuickItemDelegate"
- exports: ["QtQuick.Templates/SwipeDelegate 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/SwipeDelegate 2.0",
+ "QtQuick.Templates/SwipeDelegate 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickSwipeDelegateAttached"
Property { name: "swipe"; type: "QQuickSwipe"; isReadonly: true; isPointer: true }
}
Component {
+ name: "QQuickSwipeDelegateAttached"
+ prototype: "QObject"
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ }
+ Component {
name: "QQuickSwipeView"
defaultProperty: "contentData"
prototype: "QQuickContainer"
- exports: ["QtQuick.Templates/SwipeView 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/SwipeView 2.0",
+ "QtQuick.Templates/SwipeView 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickSwipeViewAttached"
+ Property { name: "interactive"; revision: 1; type: "bool" }
+ Signal { name: "interactiveChanged"; revision: 1 }
}
Component {
name: "QQuickSwipeViewAttached"
prototype: "QObject"
Property { name: "index"; type: "int"; isReadonly: true }
Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "isNextItem"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "isPreviousItem"; revision: 1; type: "bool"; isReadonly: true }
Property { name: "view"; type: "QQuickSwipeView"; isReadonly: true; isPointer: true }
}
Component {
@@ -1279,188 +1432,14 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
- name: "QQuickText"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4,
- "AlignJustify": 8
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "TextStyle"
- values: {
- "Normal": 0,
- "Outline": 1,
- "Raised": 2,
- "Sunken": 3
- }
- }
- Enum {
- name: "TextFormat"
- values: {
- "PlainText": 0,
- "RichText": 1,
- "AutoText": 2,
- "StyledText": 4
- }
- }
- Enum {
- name: "TextElideMode"
- values: {
- "ElideLeft": 0,
- "ElideRight": 1,
- "ElideMiddle": 2,
- "ElideNone": 3
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Enum {
- name: "LineHeightMode"
- values: {
- "ProportionalHeight": 0,
- "FixedHeight": 1
- }
- }
- Enum {
- name: "FontSizeMode"
- values: {
- "FixedSize": 0,
- "HorizontalFit": 1,
- "VerticalFit": 2,
- "Fit": 3
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "font"; type: "QFont" }
- Property { name: "color"; type: "QColor" }
- Property { name: "linkColor"; type: "QColor" }
- Property { name: "style"; type: "TextStyle" }
- Property { name: "styleColor"; type: "QColor" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "lineCount"; type: "int"; isReadonly: true }
- Property { name: "truncated"; type: "bool"; isReadonly: true }
- Property { name: "maximumLineCount"; type: "int" }
- Property { name: "textFormat"; type: "TextFormat" }
- Property { name: "elide"; type: "TextElideMode" }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "lineHeight"; type: "double" }
- Property { name: "lineHeightMode"; type: "LineHeightMode" }
- Property { name: "baseUrl"; type: "QUrl" }
- Property { name: "minimumPixelSize"; type: "int" }
- Property { name: "minimumPointSize"; type: "int" }
- Property { name: "fontSizeMode"; type: "FontSizeMode" }
- Property { name: "renderType"; type: "RenderType" }
- Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Signal {
- name: "textChanged"
- Parameter { name: "text"; type: "string" }
- }
- Signal {
- name: "linkActivated"
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "linkHovered"
- revision: 2
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "styleChanged"
- Parameter { name: "style"; type: "QQuickText::TextStyle" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickText::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickText::VAlignment" }
- }
- Signal {
- name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "QQuickText::TextFormat" }
- }
- Signal {
- name: "elideModeChanged"
- Parameter { name: "mode"; type: "QQuickText::TextElideMode" }
- }
- Signal { name: "contentSizeChanged" }
- Signal {
- name: "lineHeightChanged"
- Parameter { name: "lineHeight"; type: "double" }
- }
- Signal {
- name: "lineHeightModeChanged"
- Parameter { name: "mode"; type: "LineHeightMode" }
- }
- Signal {
- name: "lineLaidOut"
- Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
- }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "doLayout" }
- Method {
- name: "linkAt"
- revision: 3
- type: "string"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- }
- Component {
name: "QQuickTextArea"
defaultProperty: "data"
prototype: "QQuickTextEdit"
- exports: ["QtQuick.Templates/TextArea 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/TextArea 2.0",
+ "QtQuick.Templates/TextArea 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickTextAreaAttached"
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
@@ -1468,539 +1447,72 @@ Module {
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
+ Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "hoverEnabledChanged"; revision: 1 }
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"
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4,
- "AlignJustify": 8
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "TextFormat"
- values: {
- "PlainText": 0,
- "RichText": 1,
- "AutoText": 2
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "SelectionMode"
- values: {
- "SelectCharacters": 0,
- "SelectWords": 1
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "color"; type: "QColor" }
- Property { name: "selectionColor"; type: "QColor" }
- Property { name: "selectedTextColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "lineCount"; type: "int"; isReadonly: true }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "textFormat"; type: "TextFormat" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "cursorVisible"; type: "bool" }
- Property { name: "cursorPosition"; type: "int" }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionStart"; type: "int"; isReadonly: true }
- Property { name: "selectionEnd"; type: "int"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "activeFocusOnPress"; type: "bool" }
- Property { name: "persistentSelection"; type: "bool" }
- Property { name: "textMargin"; type: "double" }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
- Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
- Property { name: "selectByMouse"; type: "bool" }
- Property { name: "mouseSelectionMode"; type: "SelectionMode" }
- Property { name: "canPaste"; type: "bool"; isReadonly: true }
- Property { name: "canUndo"; type: "bool"; isReadonly: true }
- Property { name: "canRedo"; type: "bool"; isReadonly: true }
- Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
- Property { name: "baseUrl"; type: "QUrl" }
- Property { name: "renderType"; type: "RenderType" }
- Property {
- name: "textDocument"
- revision: 1
- type: "QQuickTextDocument"
- isReadonly: true
- isPointer: true
- }
- Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- 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"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "selectionColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "selectedTextColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextEdit::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextEdit::VAlignment" }
- }
- Signal {
- name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "QQuickTextEdit::TextFormat" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "isReadOnly"; type: "bool" }
- }
- Signal {
- name: "cursorVisibleChanged"
- Parameter { name: "isCursorVisible"; type: "bool" }
- }
- Signal {
- name: "activeFocusOnPressChanged"
- Parameter { name: "activeFocusOnPressed"; type: "bool" }
- }
- Signal {
- name: "persistentSelectionChanged"
- Parameter { name: "isPersistentSelection"; type: "bool" }
- }
- Signal {
- name: "textMarginChanged"
- Parameter { name: "textMargin"; type: "double" }
- }
- Signal {
- name: "selectByKeyboardChanged"
+ name: "pressed"
revision: 1
- Parameter { name: "selectByKeyboard"; type: "bool" }
- }
- Signal {
- name: "selectByMouseChanged"
- Parameter { name: "selectByMouse"; type: "bool" }
- }
- Signal {
- name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "QQuickTextEdit::SelectionMode" }
- }
- Signal {
- name: "linkActivated"
- Parameter { name: "link"; type: "string" }
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
Signal {
- name: "linkHovered"
- revision: 2
- Parameter { name: "link"; type: "string" }
- }
- Signal { name: "editingFinished"; revision: 6 }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "selectAll" }
- Method { name: "selectWord" }
- Method {
- name: "select"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "deselect" }
- Method {
- name: "isRightToLeft"
- type: "bool"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "cut" }
- Method { name: "copy" }
- Method { name: "paste" }
- Method { name: "undo" }
- Method { name: "redo" }
- Method {
- name: "insert"
- Parameter { name: "position"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "remove"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "append"
- revision: 2
- Parameter { name: "text"; type: "string" }
- }
- Method { name: "clear"; revision: 7 }
- Method {
- name: "inputMethodQuery"
- revision: 4
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method {
- name: "positionToRectangle"
- type: "QRectF"
- Parameter { type: "int" }
- }
- Method {
- name: "positionAt"
- type: "int"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "mode"; type: "SelectionMode" }
- }
- Method {
- name: "getText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "getFormattedText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "linkAt"
- revision: 3
- type: "string"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
+ name: "released"
+ revision: 1
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
}
Component {
+ name: "QQuickTextAreaAttached"
+ prototype: "QObject"
+ Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true }
+ }
+ Component {
name: "QQuickTextField"
defaultProperty: "data"
prototype: "QQuickTextInput"
- exports: ["QtQuick.Templates/TextField 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/TextField 2.0",
+ "QtQuick.Templates/TextField 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
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" }
+ Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
+ Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "hoverEnabledChanged"; revision: 1 }
Signal {
name: "pressAndHold"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickTextInput"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- Enum {
- name: "EchoMode"
- values: {
- "Normal": 0,
- "NoEcho": 1,
- "Password": 2,
- "PasswordEchoOnEdit": 3
- }
- }
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "SelectionMode"
- values: {
- "SelectCharacters": 0,
- "SelectWords": 1
- }
- }
- Enum {
- name: "CursorPosition"
- values: {
- "CursorBetweenCharacters": 0,
- "CursorOnCharacter": 1
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "color"; type: "QColor" }
- Property { name: "selectionColor"; type: "QColor" }
- Property { name: "selectedTextColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "cursorVisible"; type: "bool" }
- Property { name: "cursorPosition"; type: "int" }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionStart"; type: "int"; isReadonly: true }
- Property { name: "selectionEnd"; type: "int"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "maximumLength"; type: "int" }
- Property { name: "validator"; type: "QValidator"; isPointer: true }
- Property { name: "inputMask"; type: "string" }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
- Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
- Property { name: "echoMode"; type: "EchoMode" }
- Property { name: "activeFocusOnPress"; type: "bool" }
- 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" }
- Property { name: "persistentSelection"; type: "bool" }
- Property { name: "canPaste"; type: "bool"; isReadonly: true }
- Property { name: "canUndo"; type: "bool"; isReadonly: true }
- Property { name: "canRedo"; type: "bool"; isReadonly: true }
- Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "renderType"; type: "RenderType" }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Signal { name: "accepted" }
- Signal { name: "editingFinished"; revision: 2 }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "isReadOnly"; type: "bool" }
- }
- Signal {
- name: "cursorVisibleChanged"
- Parameter { name: "isCursorVisible"; type: "bool" }
- }
- Signal {
- name: "maximumLengthChanged"
- Parameter { name: "maximumLength"; type: "int" }
- }
- Signal {
- name: "inputMaskChanged"
- Parameter { name: "inputMask"; type: "string" }
- }
- Signal {
- name: "echoModeChanged"
- 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" }
- }
- Signal {
- name: "autoScrollChanged"
- Parameter { name: "autoScroll"; type: "bool" }
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
Signal {
- name: "selectByMouseChanged"
- Parameter { name: "selectByMouse"; type: "bool" }
+ name: "pressed"
+ revision: 1
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
Signal {
- name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" }
- }
- Signal { name: "contentSizeChanged" }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "selectAll" }
- Method { name: "selectWord" }
- Method {
- name: "select"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "deselect" }
- Method {
- name: "isRightToLeft"
- type: "bool"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "cut" }
- Method { name: "copy" }
- Method { name: "paste" }
- Method { name: "undo" }
- Method { name: "redo" }
- Method {
- name: "insert"
- Parameter { name: "position"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "remove"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "ensureVisible"
- revision: 3
- Parameter { name: "position"; type: "int" }
- }
- Method { name: "clear"; revision: 7 }
- Method {
- name: "positionAt"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "positionToRectangle"
- type: "QRectF"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "mode"; type: "SelectionMode" }
- }
- Method {
- name: "inputMethodQuery"
- revision: 3
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method {
- name: "getText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
+ name: "released"
+ revision: 1
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
}
Component {
name: "QQuickToolBar"
defaultProperty: "contentData"
- prototype: "QQuickFrame"
+ prototype: "QQuickPane"
exports: ["QtQuick.Templates/ToolBar 2.0"]
exportMetaObjectRevisions: [0]
Enum {
@@ -2020,6 +1532,16 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
+ name: "QQuickToolSeparator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/ToolSeparator 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "orientation"; type: "Qt::Orientation" }
+ Property { name: "horizontal"; type: "bool"; isReadonly: true }
+ Property { name: "vertical"; type: "bool"; isReadonly: true }
+ }
+ Component {
name: "QQuickToolTip"
defaultProperty: "contentData"
prototype: "QQuickPopup"
@@ -2029,8 +1551,6 @@ Module {
Property { name: "delay"; type: "int" }
Property { name: "timeout"; type: "int" }
Property { name: "text"; type: "string" }
- Method { name: "open" }
- Method { name: "close" }
}
Component {
name: "QQuickToolTipAttached"
@@ -2055,8 +1575,11 @@ Module {
name: "QQuickTumbler"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Tumbler 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Tumbler 2.0",
+ "QtQuick.Templates/Tumbler 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickTumblerAttached"
Property { name: "model"; type: "QVariant" }
Property { name: "count"; type: "int"; isReadonly: true }
@@ -2064,6 +1587,8 @@ Module {
Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "visibleItemCount"; type: "int" }
+ Property { name: "wrap"; revision: 1; type: "bool" }
+ Signal { name: "wrapChanged"; revision: 1 }
}
Component {
name: "QQuickTumblerAttached"
@@ -2071,240 +1596,4 @@ 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: "QQuickWindow"
- defaultProperty: "data"
- 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: "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 }
- }
-
}
diff --git a/src/imports/controls/qquickbusyindicatorring.cpp b/src/imports/controls/qquickbusyindicatorring.cpp
index 4f9e9977..d8c035d2 100644
--- a/src/imports/controls/qquickbusyindicatorring.cpp
+++ b/src/imports/controls/qquickbusyindicatorring.cpp
@@ -39,8 +39,9 @@
#include <QtCore/qset.h>
#include <QtGui/qpainter.h>
#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/qsgsimplerectnode.h>
+#include <QtQuick/qsgnode.h>
#include <QtQuick/qquickwindow.h>
+#include <QtQuick/qsgrectanglenode.h>
QT_BEGIN_NAMESPACE
@@ -84,9 +85,11 @@ QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem::
{
QQuickItemPrivate *d = QQuickItemPrivate::get(this);
- if (!oldNode)
- oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
- static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+ if (!oldNode) {
+ oldNode = window()->createRectangleNode();
+ static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent);
+ }
+ static_cast<QSGRectangleNode *>(oldNode)->setRect(boundingRect());
QSGTransformNode *rootTransformNode = static_cast<QSGTransformNode *>(oldNode->firstChild());
if (!rootTransformNode) {
@@ -112,7 +115,7 @@ QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem::
QSGOpacityNode *opacityNode = new QSGOpacityNode;
transformNode->appendChildNode(opacityNode);
- QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode();
rectNode->setAntialiasing(true);
rectNode->setColor(color);
rectNode->setPenColor(color);
@@ -122,7 +125,7 @@ QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem::
QSGNode *opacityNode = transformNode->firstChild();
Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius);
@@ -178,7 +181,7 @@ void QQuickBusyIndicatorAnimatorJob::updateCurrentTime(int time)
if (!m_node)
return;
- QSGSimpleRectNode *rootRectNode = static_cast<QSGSimpleRectNode*>(m_node->firstChild());
+ QSGRectangleNode *rootRectNode = static_cast<QSGRectangleNode *>(m_node->firstChild());
if (!rootRectNode)
return;
@@ -199,7 +202,7 @@ void QQuickBusyIndicatorAnimatorJob::updateCurrentTime(int time)
QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode*>(transformNode->firstChild());
Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(opacityNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(opacityNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
const bool fill = (firstPhaseProgress > qreal(i) / circles) || (secondPhaseProgress > 0 && secondPhaseProgress < qreal(i) / circles);
diff --git a/src/imports/controls/qquickdefaultstyle.cpp b/src/imports/controls/qquickdefaultstyle.cpp
new file mode 100644
index 00000000..7dfedfb7
--- /dev/null
+++ b/src/imports/controls/qquickdefaultstyle.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 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 "qquickdefaultstyle_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QQuickDefaultStyle::QQuickDefaultStyle(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QColor QQuickDefaultStyle::backgroundColor() const
+{
+ return QColor::fromRgba(0xFFFFFFFF);
+}
+
+QColor QQuickDefaultStyle::overlayModalColor() const
+{
+ return QColor::fromRgba(0x7F28282A);
+}
+
+QColor QQuickDefaultStyle::overlayDimColor() const
+{
+ return QColor::fromRgba(0x1F28282A);
+}
+
+QColor QQuickDefaultStyle::textColor() const
+{
+ return QColor::fromRgba(0xFF353637);
+}
+
+QColor QQuickDefaultStyle::textDarkColor() const
+{
+ return QColor::fromRgba(0xFF26282A);
+}
+
+QColor QQuickDefaultStyle::textLightColor() const
+{
+ return QColor::fromRgba(0xFFFFFFFF);
+}
+
+QColor QQuickDefaultStyle::textLinkColor() const
+{
+ return QColor::fromRgba(0xFF45A7D7);
+}
+
+QColor QQuickDefaultStyle::textSelectionColor() const
+{
+ return QColor::fromRgba(0xFFFDDD5C);
+}
+
+QColor QQuickDefaultStyle::textDisabledColor() const
+{
+ return QColor::fromRgba(0xFFBDBEBF);
+}
+
+QColor QQuickDefaultStyle::textDisabledLightColor() const
+{
+ return QColor::fromRgba(0xFFC2C2C2);
+}
+
+QColor QQuickDefaultStyle::focusColor() const
+{
+ return QColor::fromRgba(0xFF0066FF);
+}
+
+QColor QQuickDefaultStyle::focusLightColor() const
+{
+ return QColor::fromRgba(0xFFF0F6FF);
+}
+
+QColor QQuickDefaultStyle::focusPressedColor() const
+{
+ return QColor::fromRgba(0xFFCCE0FF);
+}
+
+QColor QQuickDefaultStyle::buttonColor() const
+{
+ return QColor::fromRgba(0xFFE0E0E0);
+}
+
+QColor QQuickDefaultStyle::buttonPressedColor() const
+{
+ return QColor::fromRgba(0xFFD0D0D0);
+}
+
+QColor QQuickDefaultStyle::buttonCheckedColor() const
+{
+ return QColor::fromRgba(0xFF353637);
+}
+
+QColor QQuickDefaultStyle::buttonCheckedPressedColor() const
+{
+ return QColor::fromRgba(0xFF585A5C);
+}
+
+QColor QQuickDefaultStyle::buttonCheckedFocusColor() const
+{
+ return QColor::fromRgba(0xFF599BFF);
+}
+
+QColor QQuickDefaultStyle::toolButtonColor() const
+{
+ return QColor::fromRgba(0x33333333);
+}
+
+QColor QQuickDefaultStyle::tabButtonColor() const
+{
+ return QColor::fromRgba(0xFF353637);
+}
+
+QColor QQuickDefaultStyle::tabButtonPressedColor() const
+{
+ return QColor::fromRgba(0xFF585A5C);
+}
+
+QColor QQuickDefaultStyle::tabButtonCheckedPressedColor() const
+{
+ return QColor::fromRgba(0xFFE4E4E4);
+}
+
+QColor QQuickDefaultStyle::delegateColor() const
+{
+ return QColor::fromRgba(0xFFEEEEEE);
+}
+
+QColor QQuickDefaultStyle::delegatePressedColor() const
+{
+ return QColor::fromRgba(0xFFBDBEBF);
+}
+
+QColor QQuickDefaultStyle::delegateFocusColor() const
+{
+ return QColor::fromRgba(0xFFE5EFFF);
+}
+
+QColor QQuickDefaultStyle::indicatorPressedColor() const
+{
+ return QColor::fromRgba(0xFFF6F6F6);
+}
+
+QColor QQuickDefaultStyle::indicatorDisabledColor() const
+{
+ return QColor::fromRgba(0xFFFDFDFD);
+}
+
+QColor QQuickDefaultStyle::indicatorFrameColor() const
+{
+ return QColor::fromRgba(0xFF909090);
+}
+
+QColor QQuickDefaultStyle::indicatorFramePressedColor() const
+{
+ return QColor::fromRgba(0xFF808080);
+}
+
+QColor QQuickDefaultStyle::indicatorFrameDisabledColor() const
+{
+ return QColor::fromRgba(0xFFD6D6D6);
+}
+
+QColor QQuickDefaultStyle::frameDarkColor() const
+{
+ return QColor::fromRgba(0xFF353637);
+}
+
+QColor QQuickDefaultStyle::frameLightColor() const
+{
+ return QColor::fromRgba(0xFFBDBEBF);
+}
+
+QColor QQuickDefaultStyle::scrollBarColor() const
+{
+ return QColor::fromRgba(0xFFBDBEBF);
+}
+
+QColor QQuickDefaultStyle::scrollBarPressedColor() const
+{
+ return QColor::fromRgba(0xFF28282A);
+}
+
+QColor QQuickDefaultStyle::progressBarColor() const
+{
+ return QColor::fromRgba(0xFFE4E4E4);
+}
+
+QColor QQuickDefaultStyle::pageIndicatorColor() const
+{
+ return QColor::fromRgba(0xFF28282A);
+}
+
+QColor QQuickDefaultStyle::separatorColor() const
+{
+ return QColor::fromRgba(0xFFCCCCCC);
+}
+
+QColor QQuickDefaultStyle::disabledDarkColor() const
+{
+ return QColor::fromRgba(0xFF353637);
+}
+
+QColor QQuickDefaultStyle::disabledLightColor() const
+{
+ return QColor::fromRgba(0xFFBDBEBF);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/qquickdefaultstyle_p.h b/src/imports/controls/qquickdefaultstyle_p.h
new file mode 100644
index 00000000..854dc6c8
--- /dev/null
+++ b/src/imports/controls/qquickdefaultstyle_p.h
@@ -0,0 +1,145 @@
+/****************************************************************************
+**
+** 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 QQUICKDEFAULTSTYLE_P_H
+#define QQUICKDEFAULTSTYLE_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 <QtGui/qcolor.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDefaultStyle : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor CONSTANT FINAL)
+ Q_PROPERTY(QColor overlayModalColor READ overlayModalColor CONSTANT FINAL)
+ Q_PROPERTY(QColor overlayDimColor READ overlayDimColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textColor READ textColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textDarkColor READ textDarkColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textLightColor READ textLightColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textLinkColor READ textLinkColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textSelectionColor READ textSelectionColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textDisabledColor READ textDisabledColor CONSTANT FINAL)
+ Q_PROPERTY(QColor textDisabledLightColor READ textDisabledLightColor CONSTANT FINAL)
+ Q_PROPERTY(QColor focusColor READ focusColor CONSTANT FINAL)
+ Q_PROPERTY(QColor focusLightColor READ focusLightColor CONSTANT FINAL)
+ Q_PROPERTY(QColor focusPressedColor READ focusPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor buttonColor READ buttonColor CONSTANT FINAL)
+ Q_PROPERTY(QColor buttonPressedColor READ buttonPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor buttonCheckedColor READ buttonCheckedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor buttonCheckedPressedColor READ buttonCheckedPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor buttonCheckedFocusColor READ buttonCheckedFocusColor CONSTANT FINAL)
+ Q_PROPERTY(QColor toolButtonColor READ toolButtonColor CONSTANT FINAL)
+ Q_PROPERTY(QColor tabButtonColor READ tabButtonColor CONSTANT FINAL)
+ Q_PROPERTY(QColor tabButtonPressedColor READ tabButtonPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor tabButtonCheckedPressedColor READ tabButtonCheckedPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor delegateColor READ delegateColor CONSTANT FINAL)
+ Q_PROPERTY(QColor delegatePressedColor READ delegatePressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor delegateFocusColor READ delegateFocusColor CONSTANT FINAL)
+ Q_PROPERTY(QColor indicatorPressedColor READ indicatorPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor indicatorDisabledColor READ indicatorDisabledColor CONSTANT FINAL)
+ Q_PROPERTY(QColor indicatorFrameColor READ indicatorFrameColor CONSTANT FINAL)
+ Q_PROPERTY(QColor indicatorFramePressedColor READ indicatorFramePressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor indicatorFrameDisabledColor READ indicatorFrameDisabledColor CONSTANT FINAL)
+ Q_PROPERTY(QColor frameDarkColor READ frameDarkColor CONSTANT FINAL)
+ Q_PROPERTY(QColor frameLightColor READ frameLightColor CONSTANT FINAL)
+ Q_PROPERTY(QColor scrollBarColor READ scrollBarColor CONSTANT FINAL)
+ Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor CONSTANT FINAL)
+ Q_PROPERTY(QColor progressBarColor READ progressBarColor CONSTANT FINAL)
+ Q_PROPERTY(QColor pageIndicatorColor READ pageIndicatorColor CONSTANT FINAL)
+ Q_PROPERTY(QColor separatorColor READ separatorColor CONSTANT FINAL)
+ Q_PROPERTY(QColor disabledDarkColor READ disabledDarkColor CONSTANT FINAL)
+ Q_PROPERTY(QColor disabledLightColor READ disabledLightColor CONSTANT FINAL)
+
+public:
+ explicit QQuickDefaultStyle(QObject *parent = nullptr);
+
+ QColor backgroundColor() const;
+ QColor overlayModalColor() const;
+ QColor overlayDimColor() const;
+ QColor textColor() const;
+ QColor textDarkColor() const;
+ QColor textLightColor() const;
+ QColor textLinkColor() const;
+ QColor textSelectionColor() const;
+ QColor textDisabledColor() const;
+ QColor textDisabledLightColor() const;
+ QColor focusColor() const;
+ QColor focusLightColor() const;
+ QColor focusPressedColor() const;
+ QColor buttonColor() const;
+ QColor buttonPressedColor() const;
+ QColor buttonCheckedColor() const;
+ QColor buttonCheckedPressedColor() const;
+ QColor buttonCheckedFocusColor() const;
+ QColor toolButtonColor() const;
+ QColor tabButtonColor() const;
+ QColor tabButtonPressedColor() const;
+ QColor tabButtonCheckedPressedColor() const;
+ QColor delegateColor() const;
+ QColor delegatePressedColor() const;
+ QColor delegateFocusColor() const;
+ QColor indicatorPressedColor() const;
+ QColor indicatorDisabledColor() const;
+ QColor indicatorFrameColor() const;
+ QColor indicatorFramePressedColor() const;
+ QColor indicatorFrameDisabledColor() const;
+ QColor frameDarkColor() const;
+ QColor frameLightColor() const;
+ QColor scrollBarColor() const;
+ QColor scrollBarPressedColor() const;
+ QColor progressBarColor() const;
+ QColor pageIndicatorColor() const;
+ QColor separatorColor() const;
+ QColor disabledDarkColor() const;
+ QColor disabledLightColor() const;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDEFAULTSTYLE_P_H
diff --git a/src/imports/controls/qquickprogressstrip.cpp b/src/imports/controls/qquickprogressstrip.cpp
index 5b50a28d..33a21848 100644
--- a/src/imports/controls/qquickprogressstrip.cpp
+++ b/src/imports/controls/qquickprogressstrip.cpp
@@ -37,7 +37,7 @@
#include "qquickprogressstrip_p.h"
#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/qsgsimplerectnode.h>
+#include <QtQuick/qsgrectanglenode.h>
QT_BEGIN_NAMESPACE
@@ -129,9 +129,11 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
{
QQuickItemPrivate *d = QQuickItemPrivate::get(this);
- if (!oldNode)
- oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
- static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+ if (!oldNode) {
+ oldNode = window()->createRectangleNode();
+ static_cast<QSGRectangleNode *>(oldNode)->setColor(Qt::transparent);
+ }
+ static_cast<QSGRectangleNode *>(oldNode)->setRect(boundingRect());
QSGTransformNode *rootTransformNode = static_cast<QSGTransformNode *>(oldNode->firstChild());
if (!rootTransformNode) {
@@ -155,9 +157,9 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
rootTransformNode->appendChildNode(transformNode);
}
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(transformNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild());
if (!rectNode) {
- rectNode = d->sceneGraphContext()->createRectangleNode();
+ rectNode = d->sceneGraphContext()->createInternalRectangleNode();
rectNode->setColor(color);
transformNode->appendChildNode(rectNode);
}
@@ -177,9 +179,9 @@ QSGNode *QQuickProgressStrip::updatePaintNode(QSGNode *oldNode, QQuickItem::Upda
rootTransformNode->removeAllChildNodes();
}
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(rootTransformNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(rootTransformNode->firstChild());
if (!rectNode) {
- rectNode = d->sceneGraphContext()->createRectangleNode();
+ rectNode = d->sceneGraphContext()->createInternalRectangleNode();
rectNode->setColor(color);
rootTransformNode->appendChildNode(rectNode);
}
@@ -233,7 +235,7 @@ void QQuickProgressAnimatorJob::updateCurrentTime(int time)
if (!m_node)
return;
- QSGSimpleRectNode *rootRectNode = static_cast<QSGSimpleRectNode*>(m_node->firstChild());
+ QSGRectangleNode *rootRectNode = static_cast<QSGRectangleNode *>(m_node->firstChild());
if (!rootRectNode)
return;
Q_ASSERT(rootRectNode->type() == QSGNode::GeometryNodeType);
@@ -250,7 +252,7 @@ void QQuickProgressAnimatorJob::updateCurrentTime(int time)
const qreal pixelsPerSecond = rootRectNode->rect().width();
for (int i = 0; i < blocks; ++i) {
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(transformNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode*>(transformNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
QMatrix4x4 m;
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 8e41a58c..5b8868fe 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -36,12 +36,15 @@
#include <QtCore/private/qfileselector_p.h>
#include <QtQuickControls2/qquickstyle.h>
+#include <QtQuickControls2/private/qquickstyle_p.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 <QtQuickControls2/private/qquicktumblerview_p.h>
#include "qquickbusyindicatorring_p.h"
+#include "qquickdefaultstyle_p.h"
#include "qquickdialring_p.h"
#include "qquickprogressstrip_p.h"
@@ -73,20 +76,21 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu
void QtQuickControls2Plugin::registerTypes(const char *uri)
{
- qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
- qmlRegisterType<QQuickButtonGroupAttached>();
-
- QQuickStyleSelector selector;
- selector.setBaseUrl(typeUrl());
-
+ QQuickStylePrivate::init(typeUrl());
const QString style = QQuickStyle::name();
if (!style.isEmpty())
QFileSelectorPrivate::addStatics(QStringList() << style.toLower());
+ QQuickStyleSelector selector;
+ selector.setBaseUrl(typeUrl());
+
+ // QtQuick.Controls 2.0 (Qt 5.7)
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<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
+ qmlRegisterType<QQuickButtonGroupAttached>();
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");
@@ -125,6 +129,21 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
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");
+
+ // QtQuick.Controls 2.1 (Qt 5.8)
+ qmlRegisterType<QQuickButtonGroup,1 >(uri, 2, 1, "ButtonGroup");
+ qmlRegisterType(selector.select(QStringLiteral("Dialog.qml")), uri, 2, 1, "Dialog");
+ qmlRegisterType(selector.select(QStringLiteral("DialogButtonBox.qml")), uri, 2, 1, "DialogButtonBox");
+ qmlRegisterType(selector.select(QStringLiteral("MenuSeparator.qml")), uri, 2, 1, "MenuSeparator");
+ qmlRegisterType(selector.select(QStringLiteral("RoundButton.qml")), uri, 2, 1, "RoundButton");
+ qmlRegisterType(selector.select(QStringLiteral("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator");
+}
+
+static QObject *styleSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(engine);
+ Q_UNUSED(scriptEngine);
+ return new QQuickDefaultStyle;
}
void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -139,6 +158,8 @@ void QtQuickControls2Plugin::initializeEngine(QQmlEngine *engine, const char *ur
qmlRegisterType<QQuickProgressStrip>(import, 2, 0, "ProgressStrip");
qmlRegisterType<QQuickProgressAnimator>(import, 2, 0, "ProgressStripAnimator");
qmlRegisterType<QQuickDialRing>(import, 2, 0, "DialRing");
+ qmlRegisterType<QQuickTumblerView>(import, 2, 1, "TumblerView");
+ qmlRegisterSingletonType<QQuickDefaultStyle>(import, 2, 1, "Default", styleSingleton);
qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
diff --git a/src/imports/controls/universal/ApplicationWindow.qml b/src/imports/controls/universal/ApplicationWindow.qml
index 70bd403c..ba07021a 100644
--- a/src/imports/controls/universal/ApplicationWindow.qml
+++ b/src/imports/controls/universal/ApplicationWindow.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
-import QtQuick.Controls.Universal.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+import QtQuick.Controls.Universal.impl 2.1
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/universal/BusyIndicator.qml b/src/imports/controls/universal/BusyIndicator.qml
index fe2186a7..514a233e 100644
--- a/src/imports/controls/universal/BusyIndicator.qml
+++ b/src/imports/controls/universal/BusyIndicator.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
-import QtQuick.Controls.Universal.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+import QtQuick.Controls.Universal.impl 2.1
T.BusyIndicator {
id: control
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml
index 6954d31a..aa65e714 100644
--- a/src/imports/controls/universal/Button.qml
+++ b/src/imports/controls/universal/Button.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Button {
id: control
@@ -72,5 +72,14 @@ T.Button {
color: control.down ? control.Universal.baseMediumLowColor :
control.enabled && (control.highlighted || control.checked) ? control.Universal.accent :
control.Universal.baseLowColor
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ color: "transparent"
+ visible: control.hovered
+ border.width: 2 // ButtonBorderThemeThickness
+ border.color: control.Universal.baseMediumLowColor
+ }
}
}
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index a1c3ba6b..916348f9 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
-import QtQuick.Controls.Universal.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+import QtQuick.Controls.Universal.impl 2.1
T.CheckBox {
id: control
diff --git a/src/imports/controls/universal/CheckDelegate.qml b/src/imports/controls/universal/CheckDelegate.qml
index c0ca272e..42e7b10c 100644
--- a/src/imports/controls/universal/CheckDelegate.qml
+++ b/src/imports/controls/universal/CheckDelegate.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.CheckDelegate {
id: control
@@ -76,8 +76,9 @@ T.CheckDelegate {
}
background: Rectangle {
- visible: control.down || control.highlighted || control.visualFocus
- color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ visible: control.down || control.highlighted || control.visualFocus || control.hovered
+ color: control.down ? control.Universal.listMediumColor :
+ control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
diff --git a/src/imports/controls/universal/CheckIndicator.qml b/src/imports/controls/universal/CheckIndicator.qml
index eeecf264..166cf184 100644
--- a/src/imports/controls/universal/CheckIndicator.qml
+++ b/src/imports/controls/universal/CheckIndicator.qml
@@ -34,16 +34,16 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
Rectangle {
implicitWidth: 20
implicitHeight: 20
color: !control.enabled ? "transparent" :
- control.down && control.checkState !== Qt.PartiallyChecked ? control.Universal.baseMediumColor :
+ control.down && !partiallyChecked ? control.Universal.baseMediumColor :
control.checkState === Qt.Checked ? control.Universal.accent : "transparent"
border.color: !control.enabled ? control.Universal.baseLowColor :
control.down ? control.Universal.baseMediumColor :
@@ -51,6 +51,7 @@ Rectangle {
border.width: 2 // CheckBoxBorderThemeThickness
property Item control
+ readonly property bool partiallyChecked: control.checkState === Qt.PartiallyChecked
Image {
x: (parent.width - width) / 2
@@ -65,11 +66,15 @@ Rectangle {
Rectangle {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
- width: parent.width / 2
- height: parent.height / 2
+ width: partiallyChecked ? parent.width / 2 : parent.width
+ height: partiallyChecked ? parent.height / 2 : parent.height
- visible: control.checkState === Qt.PartiallyChecked
- color: !control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ visible: !control.pressed && control.hovered || partiallyChecked
+ color: !partiallyChecked ? "transparent" :
+ !control.enabled ? control.Universal.baseLowColor :
+ control.down ? control.Universal.baseMediumColor :
+ control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
+ border.width: partiallyChecked ? 0 : 2 // CheckBoxBorderThemeThickness
+ border.color: control.Universal.baseMediumLowColor
}
}
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index bb816fc1..2d768a1d 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.6
+import QtQuick 2.8
import QtQuick.Window 2.2
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls 2.1
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ComboBox {
id: control
@@ -60,6 +60,7 @@ T.ComboBox {
width: control.popup.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
highlighted: control.highlightedIndex === index
+ hoverEnabled: control.hoverEnabled
}
indicator: Image {
@@ -88,11 +89,14 @@ T.ComboBox {
implicitWidth: 120
implicitHeight: 32
- border.width: 2 // ComboBoxBorderThemeThickness
+ border.width: control.flat ? 0 : 2 // ComboBoxBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed || popup.visible ? control.Universal.baseMediumLowColor : control.Universal.baseMediumLowColor
+ control.pressed || popup.visible ? control.Universal.baseMediumLowColor :
+ control.hovered ? control.Universal.baseMediumColor : control.Universal.baseMediumLowColor
color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed || popup.visible ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ control.pressed || popup.visible ? control.Universal.listMediumColor :
+ control.flat && control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
+ visible: !control.flat || control.pressed || control.hovered || control.visualFocus
Rectangle {
x: 2
diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml
index 6781d387..9eaf69ba 100644
--- a/src/imports/controls/universal/Dial.qml
+++ b/src/imports/controls/universal/Dial.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Dial {
id: control
@@ -64,7 +64,8 @@ T.Dial {
radius: width / 2
color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ control.pressed ? control.Universal.baseMediumColor :
+ control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
transform: [
Translate {
diff --git a/src/imports/controls/universal/Dialog.qml b/src/imports/controls/universal/Dialog.qml
new file mode 100644
index 00000000..f805581c
--- /dev/null
+++ b/src/imports/controls/universal/Dialog.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls 2.1
+import QtQuick.Controls.Universal 2.1
+
+T.Dialog {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0,
+ contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (header && header.visible ? header.implicitHeight + spacing : 0)
+ + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
+ + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+
+ padding: 24
+ topPadding: 18
+ bottomPadding: 18
+
+ background: Rectangle {
+ color: control.Universal.chromeMediumLowColor
+ border.color: control.Universal.chromeHighColor
+ border.width: 1 // FlyoutBorderThemeThickness
+ }
+
+ header: Label {
+ text: control.title
+ visible: control.title
+ elide: Label.ElideRight
+ topPadding: 18
+ leftPadding: 24
+ rightPadding: 24
+ // TODO: QPlatformTheme::TitleBarFont
+ font.pixelSize: 20
+ background: Rectangle {
+ x: 1; y: 1 // // FlyoutBorderThemeThickness
+ color: control.Universal.chromeMediumLowColor
+ width: parent.width - 2
+ height: parent.height - 1
+ }
+ }
+
+ footer: DialogButtonBox {
+ visible: count > 0
+ }
+}
diff --git a/src/imports/controls/universal/DialogButtonBox.qml b/src/imports/controls/universal/DialogButtonBox.qml
new file mode 100644
index 00000000..043496d9
--- /dev/null
+++ b/src/imports/controls/universal/DialogButtonBox.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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+
+T.DialogButtonBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+
+ spacing: 4
+ padding: 24
+ topPadding: position === T.DialogButtonBox.Footer ? 6 : 24
+ bottomPadding: position === T.DialogButtonBox.Header ? 6 : 24
+ alignment: count === 1 ? Qt.AlignRight : undefined
+
+ delegate: Button {
+ width: control.count === 1 ? control.availableWidth / 2 : undefined
+ }
+
+ contentItem: ListView {
+ implicitWidth: contentWidth
+ implicitHeight: 32
+
+ model: control.contentModel
+ spacing: control.spacing
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ snapMode: ListView.SnapToItem
+ }
+
+ background: Rectangle {
+ implicitHeight: 32
+ color: control.Universal.chromeMediumLowColor
+ x: 1; y: 1
+ width: parent.width - 2
+ height: parent.height - 2
+ }
+}
diff --git a/src/imports/controls/universal/Drawer.qml b/src/imports/controls/universal/Drawer.qml
index 84831323..09b3751d 100644
--- a/src/imports/controls/universal/Drawer.qml
+++ b/src/imports/controls/universal/Drawer.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Drawer {
id: control
@@ -57,8 +57,6 @@ T.Drawer {
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }
- contentItem: Item { }
-
background: Rectangle {
color: control.Universal.chromeMediumLowColor
Rectangle {
diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml
index d5b327c1..1c83f3fd 100644
--- a/src/imports/controls/universal/Frame.qml
+++ b/src/imports/controls/universal/Frame.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Frame {
id: control
@@ -49,8 +49,6 @@ T.Frame {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
color: "transparent"
border.color: control.Universal.chromeDisabledLowColor
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
index c75c81a6..435a9755 100644
--- a/src/imports/controls/universal/GroupBox.qml
+++ b/src/imports/controls/universal/GroupBox.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.GroupBox {
id: control
@@ -53,8 +53,6 @@ T.GroupBox {
padding: 12
topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- contentItem: Item { }
-
label: Text {
x: control.leftPadding
width: control.availableWidth
diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml
index 6822d658..a8d55ba6 100644
--- a/src/imports/controls/universal/ItemDelegate.qml
+++ b/src/imports/controls/universal/ItemDelegate.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ItemDelegate {
id: control
@@ -70,8 +70,9 @@ T.ItemDelegate {
}
background: Rectangle {
- visible: control.down || control.highlighted || control.visualFocus
- color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ visible: control.down || control.highlighted || control.visualFocus || control.hovered
+ color: control.down ? control.Universal.listMediumColor :
+ control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
diff --git a/src/imports/controls/universal/Label.qml b/src/imports/controls/universal/Label.qml
index 9b50f4f5..9e377f61 100644
--- a/src/imports/controls/universal/Label.qml
+++ b/src/imports/controls/universal/Label.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Label {
id: control
diff --git a/src/imports/controls/universal/Menu.qml b/src/imports/controls/universal/Menu.qml
index 5ee2c243..afae51f0 100644
--- a/src/imports/controls/universal/Menu.qml
+++ b/src/imports/controls/universal/Menu.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls 2.0
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Controls 2.1
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Menu {
id: control
diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml
index d8fdbcd0..380a5b0e 100644
--- a/src/imports/controls/universal/MenuItem.qml
+++ b/src/imports/controls/universal/MenuItem.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.MenuItem {
id: control
@@ -81,7 +81,8 @@ T.MenuItem {
implicitHeight: 40
color: !control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ control.down ? control.Universal.listMediumColor :
+ control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
Rectangle {
x: 1; y: 1
diff --git a/src/imports/controls/universal/MenuSeparator.qml b/src/imports/controls/universal/MenuSeparator.qml
new file mode 100644
index 00000000..cd79c60f
--- /dev/null
+++ b/src/imports/controls/universal/MenuSeparator.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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+
+T.MenuSeparator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+
+ padding: 12
+ topPadding: 9
+ bottomPadding: 10
+
+ contentItem: Rectangle {
+ implicitWidth: 188
+ implicitHeight: 1
+ color: control.Universal.baseMediumLowColor
+ }
+
+ background: Rectangle {
+ color: control.Universal.altMediumLowColor
+ }
+}
diff --git a/src/imports/controls/universal/Page.qml b/src/imports/controls/universal/Page.qml
index 3150715f..e8c7bd4a 100644
--- a/src/imports/controls/universal/Page.qml
+++ b/src/imports/controls/universal/Page.qml
@@ -34,14 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Page {
id: control
- contentItem: Item { }
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ Math.max(contentWidth,
+ header && header.visible ? header.implicitWidth : 0,
+ footer && footer.visible ? footer.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentHeight + topPadding + bottomPadding
+ + (header && header.visible ? header.implicitHeight + spacing : 0)
+ + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
+
+ contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
+ contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
background: Rectangle {
color: control.Universal.background
diff --git a/src/imports/controls/universal/PageIndicator.qml b/src/imports/controls/universal/PageIndicator.qml
index 0c4e3b80..817c89fb 100644
--- a/src/imports/controls/universal/PageIndicator.qml
+++ b/src/imports/controls/universal/PageIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.PageIndicator {
id: control
diff --git a/src/imports/controls/universal/Pane.qml b/src/imports/controls/universal/Pane.qml
index cd62b65c..903e501a 100644
--- a/src/imports/controls/universal/Pane.qml
+++ b/src/imports/controls/universal/Pane.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Pane {
id: control
@@ -49,8 +49,6 @@ T.Pane {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
color: control.Universal.background
}
diff --git a/src/imports/controls/universal/Popup.qml b/src/imports/controls/universal/Popup.qml
index 892db087..53178b71 100644
--- a/src/imports/controls/universal/Popup.qml
+++ b/src/imports/controls/universal/Popup.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Popup {
id: control
@@ -51,8 +51,6 @@ T.Popup {
padding: 12
- contentItem: Item { }
-
background: Rectangle {
color: control.Universal.chromeMediumLowColor
border.color: control.Universal.chromeHighColor
diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml
index 66d1aeb8..cd314c27 100644
--- a/src/imports/controls/universal/ProgressBar.qml
+++ b/src/imports/controls/universal/ProgressBar.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
-import QtQuick.Controls.Universal.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+import QtQuick.Controls.Universal.impl 2.1
T.ProgressBar {
id: control
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index b8986488..8f599e55 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
-import QtQuick.Controls.Universal.impl 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+import QtQuick.Controls.Universal.impl 2.1
T.RadioButton {
id: control
diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml
index 09f86f15..14680cd6 100644
--- a/src/imports/controls/universal/RadioDelegate.qml
+++ b/src/imports/controls/universal/RadioDelegate.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.RadioDelegate {
id: control
@@ -78,8 +78,9 @@ T.RadioDelegate {
}
background: Rectangle {
- visible: control.down || control.highlighted || control.visualFocus
- color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ visible: control.down || control.highlighted || control.visualFocus || control.hovered
+ color: control.down ? control.Universal.listMediumColor :
+ control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
diff --git a/src/imports/controls/universal/RadioIndicator.qml b/src/imports/controls/universal/RadioIndicator.qml
index 65790e6a..c745b04e 100644
--- a/src/imports/controls/universal/RadioIndicator.qml
+++ b/src/imports/controls/universal/RadioIndicator.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Controls.Universal 2.1
Rectangle {
implicitWidth: 20
@@ -45,7 +45,8 @@ Rectangle {
border.width: 2 // RadioButtonBorderThemeThickness
border.color: control.checked ? "transparent" :
!control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ control.down ? control.Universal.baseMediumColor :
+ control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
property var control
@@ -72,6 +73,7 @@ Rectangle {
radius: width / 2
opacity: control.checked ? 1 : 0
color: !control.enabled ? control.Universal.baseLowColor :
- control.down ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ control.down ? control.Universal.baseMediumColor :
+ control.hovered ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
}
}
diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml
index ec2ff7c8..fec8bb18 100644
--- a/src/imports/controls/universal/RangeSlider.qml
+++ b/src/imports/controls/universal/RangeSlider.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.RangeSlider {
id: control
@@ -60,7 +60,9 @@ T.RangeSlider {
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
radius: 4
- color: control.first.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
+ color: control.first.pressed ? control.Universal.chromeHighColor :
+ control.first.hovered ? control.Universal.chromeAltLowColor :
+ control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
second.handle: Rectangle {
@@ -73,7 +75,9 @@ T.RangeSlider {
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height))
radius: 4
- color: control.second.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
+ color: control.second.pressed ? control.Universal.chromeHighColor :
+ control.second.hovered ? control.Universal.chromeAltLowColor :
+ control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
background: Item {
@@ -95,7 +99,8 @@ T.RangeSlider {
width: parent.horizontal ? parent.width : 2 // SliderBackgroundThemeHeight
height: !parent.horizontal ? parent.height : 2 // SliderBackgroundThemeHeight
- color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
+ color: control.hovered && !control.pressed ? control.Universal.baseMediumColor :
+ control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
}
Rectangle {
diff --git a/src/imports/controls/universal/RoundButton.qml b/src/imports/controls/universal/RoundButton.qml
new file mode 100644
index 00000000..9a50c0fe
--- /dev/null
+++ b/src/imports/controls/universal/RoundButton.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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+
+T.RoundButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ padding: 8
+
+ property bool useSystemFocusVisuals: true
+
+ contentItem: Text {
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
+ }
+
+ background: Rectangle {
+ implicitWidth: 32
+ implicitHeight: 32
+
+ radius: control.radius
+ 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
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ radius: control.radius
+ color: "transparent"
+ visible: control.hovered
+ border.width: 2 // ButtonBorderThemeThickness
+ border.color: control.Universal.baseMediumLowColor
+ }
+ }
+}
diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml
index 1ac627a7..6d5c84fe 100644
--- a/src/imports/controls/universal/ScrollBar.qml
+++ b/src/imports/controls/universal/ScrollBar.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ScrollBar {
id: control
@@ -52,7 +52,8 @@ T.ScrollBar {
implicitWidth: 12
implicitHeight: 12
- color: control.pressed ? control.Universal.baseMediumColor : control.Universal.chromeHighColor
+ color: control.pressed ? control.Universal.baseMediumColor :
+ control.hovered ? control.Universal.baseMediumLowColor : control.Universal.chromeHighColor
visible: control.size < 1.0
opacity: 0.0
}
diff --git a/src/imports/controls/universal/ScrollIndicator.qml b/src/imports/controls/universal/ScrollIndicator.qml
index ce289ce3..f03bc819 100644
--- a/src/imports/controls/universal/ScrollIndicator.qml
+++ b/src/imports/controls/universal/ScrollIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ScrollIndicator {
id: control
diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml
index baf91211..472f5455 100644
--- a/src/imports/controls/universal/Slider.qml
+++ b/src/imports/controls/universal/Slider.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Slider {
id: control
@@ -60,7 +60,9 @@ T.Slider {
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
radius: 4
- color: control.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
+ color: control.pressed ? control.Universal.chromeHighColor :
+ control.hovered ? control.Universal.chromeAltLowColor :
+ control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
background: Item {
@@ -82,7 +84,8 @@ T.Slider {
width: parent.horizontal ? parent.width : 2 // SliderTrackThemeHeight
height: !parent.horizontal ? parent.height : 2 // SliderTrackThemeHeight
- color: control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
+ color: control.hovered && !control.pressed ? control.Universal.baseMediumColor :
+ control.enabled ? control.Universal.baseMediumLowColor : control.Universal.chromeDisabledHighColor
}
Rectangle {
diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml
index d3647114..57120a7b 100644
--- a/src/imports/controls/universal/SpinBox.qml
+++ b/src/imports/controls/universal/SpinBox.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.SpinBox {
id: control
@@ -92,9 +92,11 @@ T.SpinBox {
x: 2; y: 4
width: parent.width - 4
height: parent.height - 8
- color: !control.up.pressed ? "transparent" :
- control.activeFocus ? control.Universal.accent
- : control.Universal.chromeDisabledLowColor
+ color: control.activeFocus ? control.Universal.accent :
+ control.up.pressed ? control.Universal.baseMediumLowColor :
+ control.up.hovered ? control.Universal.baseLowColor : "transparent"
+ visible: control.up.pressed || control.up.hovered
+ opacity: control.activeFocus && !control.up.pressed ? 0.4 : 1.0
}
Image {
@@ -118,9 +120,11 @@ T.SpinBox {
x: 2; y: 4
width: parent.width - 4
height: parent.height - 8
- color: !control.down.pressed ? "transparent" :
- control.activeFocus ? control.Universal.accent
- : control.Universal.chromeDisabledLowColor
+ color: control.activeFocus ? control.Universal.accent :
+ control.down.pressed ? control.Universal.baseMediumLowColor :
+ control.down.hovered ? control.Universal.baseLowColor : "transparent"
+ visible: control.down.pressed || control.down.hovered
+ opacity: control.activeFocus && !control.down.pressed ? 0.4 : 1.0
}
Image {
@@ -140,7 +144,8 @@ T.SpinBox {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
+ control.activeFocus ? control.Universal.accent :
+ control.hovered ? control.Universal.baseMediumColor : control.Universal.chromeDisabledLowColor
color: control.enabled ? control.Universal.background : control.Universal.baseLowColor
}
}
diff --git a/src/imports/controls/universal/StackView.qml b/src/imports/controls/universal/StackView.qml
index 4f37bb76..6e6d1b50 100644
--- a/src/imports/controls/universal/StackView.qml
+++ b/src/imports/controls/universal/StackView.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.StackView {
id: control
diff --git a/src/imports/controls/universal/SwipeDelegate.qml b/src/imports/controls/universal/SwipeDelegate.qml
index 82c1e744..bc82e40e 100644
--- a/src/imports/controls/universal/SwipeDelegate.qml
+++ b/src/imports/controls/universal/SwipeDelegate.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.SwipeDelegate {
id: control
@@ -84,7 +84,8 @@ T.SwipeDelegate {
Rectangle {
width: parent.width
height: parent.height
- color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ color: control.down ? control.Universal.listMediumColor :
+ control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index b42361dc..2b0012d5 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.Switch {
id: control
diff --git a/src/imports/controls/universal/SwitchDelegate.qml b/src/imports/controls/universal/SwitchDelegate.qml
index 558f5cfb..5e4a1c52 100644
--- a/src/imports/controls/universal/SwitchDelegate.qml
+++ b/src/imports/controls/universal/SwitchDelegate.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.SwitchDelegate {
id: control
@@ -76,8 +76,9 @@ T.SwitchDelegate {
}
background: Rectangle {
- visible: control.down || control.highlighted || control.visualFocus
- color: control.down ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ visible: control.down || control.highlighted || control.visualFocus || control.hovered
+ color: control.down ? control.Universal.listMediumColor :
+ control.hovered ? control.Universal.listLowColor : control.Universal.altMediumLowColor
Rectangle {
width: parent.width
height: parent.height
diff --git a/src/imports/controls/universal/SwitchIndicator.qml b/src/imports/controls/universal/SwitchIndicator.qml
index b3d44d9e..0f68d26a 100644
--- a/src/imports/controls/universal/SwitchIndicator.qml
+++ b/src/imports/controls/universal/SwitchIndicator.qml
@@ -34,21 +34,28 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
-Rectangle {
+Item {
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
+ Rectangle {
+ width: parent.width
+ height: parent.height
+
+ 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.hovered && !control.checked && !control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumColor
+ opacity: control.hovered && control.checked && !control.pressed ? (control.Universal.theme === Universal.Light ? 0.7 : 0.9) : 1.0
+ border.width: 2
+ }
property Item control
@@ -58,7 +65,8 @@ Rectangle {
radius: 5
color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed || control.checked ? control.Universal.chromeWhiteColor : control.Universal.baseMediumHighColor
+ control.pressed || control.checked ? control.Universal.chromeWhiteColor :
+ control.hovered && !control.checked ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor
x: Math.max(5, Math.min(parent.width - width - 5,
control.visualPosition * parent.width - (width / 2)))
diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml
index 7c2e83a6..a8d80fec 100644
--- a/src/imports/controls/universal/TabBar.qml
+++ b/src/imports/controls/universal/TabBar.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.TabBar {
id: control
diff --git a/src/imports/controls/universal/TabButton.qml b/src/imports/controls/universal/TabButton.qml
index d503c86a..04f04291 100644
--- a/src/imports/controls/universal/TabButton.qml
+++ b/src/imports/controls/universal/TabButton.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.TabButton {
id: control
@@ -56,7 +56,7 @@ T.TabButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
- opacity: control.checked || control.down ? 1.0 : 0.2
- color: control.Universal.foreground
+ opacity: control.checked || control.down || control.hovered ? 1.0 : 0.2
+ color: control.hovered ? control.Universal.baseMediumHighColor : control.Universal.foreground
}
}
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
index 43fd40f4..8d422a2c 100644
--- a/src/imports/controls/universal/TextArea.qml
+++ b/src/imports/controls/universal/TextArea.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.TextArea {
id: control
@@ -83,7 +83,8 @@ T.TextArea {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
+ control.activeFocus ? control.Universal.accent :
+ control.hovered ? control.Universal.baseMediumColor : control.Universal.chromeDisabledLowColor
color: control.enabled ? control.Universal.background : control.Universal.baseLowColor
}
}
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index bd496ecc..5723e484 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.TextField {
id: control
@@ -84,7 +84,8 @@ T.TextField {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
+ control.activeFocus ? control.Universal.accent :
+ control.hovered ? control.Universal.baseMediumColor : control.Universal.chromeDisabledLowColor
color: control.enabled ? control.Universal.background : control.Universal.baseLowColor
}
}
diff --git a/src/imports/controls/universal/ToolBar.qml b/src/imports/controls/universal/ToolBar.qml
index 48e200c0..35f79806 100644
--- a/src/imports/controls/universal/ToolBar.qml
+++ b/src/imports/controls/universal/ToolBar.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ToolBar {
id: control
@@ -47,8 +47,6 @@ T.ToolBar {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- contentItem: Item { }
-
background: Rectangle {
implicitHeight: 48 // AppBarThemeCompactHeight
color: control.Universal.chromeMediumColor
diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml
index cb87130d..4dad17f7 100644
--- a/src/imports/controls/universal/ToolButton.qml
+++ b/src/imports/controls/universal/ToolButton.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ToolButton {
id: control
@@ -66,7 +66,13 @@ T.ToolButton {
implicitWidth: 68
implicitHeight: 48 // AppBarThemeCompactHeight
- color: control.down ? control.Universal.listMediumColor :
- control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : "transparent"
+ color: control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : "transparent"
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.down || control.hovered
+ color: control.down ? control.Universal.listMediumColor : control.Universal.listLowColor
+ }
}
}
diff --git a/src/imports/controls/universal/ToolSeparator.qml b/src/imports/controls/universal/ToolSeparator.qml
new file mode 100644
index 00000000..a4a5f18c
--- /dev/null
+++ b/src/imports/controls/universal/ToolSeparator.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+
+T.ToolSeparator {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+
+ leftPadding: vertical ? 16 : 12
+ rightPadding: vertical ? 15 : 12
+ topPadding: vertical ? 12 : 16
+ bottomPadding: vertical ? 12 : 15
+
+ //! [contentItem]
+ contentItem: Rectangle {
+ implicitWidth: vertical ? 1 : 20
+ implicitHeight: vertical ? 20 : 1
+ color: control.Universal.baseMediumLowColor
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/universal/ToolTip.qml b/src/imports/controls/universal/ToolTip.qml
index 423e729d..bd3d54e7 100644
--- a/src/imports/controls/universal/ToolTip.qml
+++ b/src/imports/controls/universal/ToolTip.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
T.ToolTip {
id: control
diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
index 7b134b84..e7093d0a 100644
--- a/src/imports/controls/universal/Tumbler.qml
+++ b/src/imports/controls/universal/Tumbler.qml
@@ -34,10 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.6
-import QtQuick.Templates 2.0 as T
-import QtQuick.Controls.Universal 2.0
-import QtQuick.Controls 2.0
+import QtQuick 2.8
+import QtQuick.Templates 2.1 as T
+import QtQuick.Controls.Universal 2.1
+import QtQuick.Controls 2.1
+import QtQuick.Controls.impl 2.1
T.Tumbler {
id: control
@@ -54,22 +55,16 @@ T.Tumbler {
verticalAlignment: Text.AlignVCenter
}
- contentItem: PathView {
- id: pathView
+ contentItem: TumblerView {
+ id: tumblerView
model: control.model
delegate: control.delegate
- clip: true
- pathItemCount: control.visibleItemCount + 1
- preferredHighlightBegin: 0.5
- preferredHighlightEnd: 0.5
- dragMargin: width / 2
-
path: Path {
- startX: pathView.width / 2
- startY: -pathView.delegateHeight / 2
+ startX: tumblerView.width / 2
+ startY: -tumblerView.delegateHeight / 2
PathLine {
- x: pathView.width / 2
- y: pathView.pathItemCount * pathView.delegateHeight - pathView.delegateHeight / 2
+ x: tumblerView.width / 2
+ y: (control.visibleItemCount + 1) * tumblerView.delegateHeight - tumblerView.delegateHeight / 2
}
}
diff --git a/src/imports/controls/universal/qquickuniversalprogressring.cpp b/src/imports/controls/universal/qquickuniversalprogressring.cpp
index ac087c78..1d733fed 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressring.cpp
@@ -241,7 +241,7 @@ QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePa
QSGOpacityNode *opacityNode = new QSGOpacityNode;
transformNode->appendChildNode(opacityNode);
- QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode();
rectNode->setAntialiasing(true);
opacityNode->appendChildNode(rectNode);
}
@@ -249,7 +249,7 @@ QSGNode *QQuickUniversalProgressRing::updatePaintNode(QSGNode *oldNode, UpdatePa
QSGNode *opacityNode = transformNode->firstChild();
Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
rectNode->setRect(rect);
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
index 16f394f1..32af5113 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip.cpp
@@ -38,10 +38,10 @@
#include <QtCore/qmath.h>
#include <QtCore/qeasingcurve.h>
-#include <QtQuick/qsgsimplerectnode.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquickanimatorjob_p.h>
#include <QtQuick/private/qsgadaptationlayer_p.h>
+#include <QtQuick/qsgrectanglenode.h>
QT_BEGIN_NAMESPACE
@@ -106,7 +106,7 @@ void QQuickUniversalProgressStripAnimatorJob::updateCurrentTime(int time)
if (!m_node)
return;
- QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(m_node->firstChild());
+ QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(m_node->firstChild());
Q_ASSERT(!geometryNode || geometryNode->type() == QSGNode::GeometryNodeType);
if (!geometryNode)
return;
@@ -286,9 +286,9 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP
if (!m_indeterminate)
bounds.setWidth(m_progress * bounds.width());
- QSGSimpleRectNode *geometryNode = static_cast<QSGSimpleRectNode *>(oldNode);
+ QSGRectangleNode *geometryNode = static_cast<QSGRectangleNode *>(oldNode);
if (!geometryNode)
- geometryNode = new QSGSimpleRectNode(bounds, Qt::transparent);
+ geometryNode = window()->createRectangleNode();
geometryNode->setRect(bounds);
geometryNode->setColor(m_indeterminate ? Qt::transparent : m_color);
@@ -317,7 +317,7 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP
QSGOpacityNode *opacityNode = new QSGOpacityNode;
ellipseNode->appendChildNode(opacityNode);
- QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ QSGInternalRectangleNode *rectNode = d->sceneGraphContext()->createInternalRectangleNode();
rectNode->setAntialiasing(true);
rectNode->setRadius(EllipseDiameter / 2);
opacityNode->appendChildNode(rectNode);
@@ -330,7 +330,7 @@ QSGNode *QQuickUniversalProgressStrip::updatePaintNode(QSGNode *oldNode, UpdateP
QSGNode *opacityNode = ellipseNode->firstChild();
Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(opacityNode->firstChild());
Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
rectNode->setRect(QRectF((EllipseCount - i - 1) * (EllipseDiameter + EllipseOffset), (height() - EllipseDiameter) / 2, EllipseDiameter, EllipseDiameter));
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
index 2328f1a5..b33c27e8 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -132,6 +132,15 @@ static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Color accent)
return colors[accent];
}
+extern bool qt_is_dark_system_theme();
+
+static QQuickUniversalStyle::Theme qquickuniversal_effective_theme(QQuickUniversalStyle::Theme theme)
+{
+ if (theme == QQuickUniversalStyle::System)
+ theme = qt_is_dark_system_theme() ? QQuickUniversalStyle::Dark : QQuickUniversalStyle::Light;
+ return theme;
+}
+
// 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.
@@ -164,6 +173,7 @@ QQuickUniversalStyle::Theme QQuickUniversalStyle::theme() const
void QQuickUniversalStyle::setTheme(Theme theme)
{
+ theme = qquickuniversal_effective_theme(theme);
m_explicitTheme = true;
if (m_theme == theme)
return;
@@ -536,7 +546,7 @@ void QQuickUniversalStyle::init()
QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_UNIVERSAL_THEME", settings, QStringLiteral("Theme"));
Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
if (ok)
- GlobalTheme = m_theme = themeEnum;
+ GlobalTheme = m_theme = qquickuniversal_effective_theme(themeEnum);
else if (!themeValue.isEmpty())
qWarning().nospace().noquote() << "Universal: unknown theme value: " << themeValue;
diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h
index bf0a84d8..0d3a6dab 100644
--- a/src/imports/controls/universal/qquickuniversalstyle_p.h
+++ b/src/imports/controls/universal/qquickuniversalstyle_p.h
@@ -93,7 +93,7 @@ public:
static QQuickUniversalStyle *qmlAttachedProperties(QObject *object);
- enum Theme { Light, Dark };
+ enum Theme { Light, Dark, System };
Q_ENUM(Theme)
Theme theme() const;
diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
index ddad6548..394e9162 100644
--- a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
@@ -77,6 +77,7 @@ QtQuickControls2UniversalStylePlugin::QtQuickControls2UniversalStylePlugin(QObje
void QtQuickControls2UniversalStylePlugin::registerTypes(const char *uri)
{
qmlRegisterUncreatableType<QQuickUniversalStyle>(uri, 2, 0, "Universal", tr("Universal is an attached property"));
+ qmlRegisterRevision<QQuickUniversalStyle, 1>(uri, 2, 1);
}
void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -87,6 +88,7 @@ void QtQuickControls2UniversalStylePlugin::initializeEngine(QQmlEngine *engine,
QByteArray import = QByteArray(uri) + ".impl";
qmlRegisterType<QQuickUniversalFocusRectangle>(import, 2, 0, "FocusRectangle");
+ qmlRegisterRevision<QQuickUniversalFocusRectangle, 1>(import, 2, 1);
qmlRegisterType<QQuickUniversalProgressRing>(import, 2, 0, "ProgressRing");
qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 2, 0, "ProgressRingAnimator");
qmlRegisterType<QQuickUniversalProgressStrip>(import, 2, 0, "ProgressStrip");
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index 61b6912a..3697a2a6 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -7,6 +7,8 @@ QML_FILES += \
$$PWD/CheckIndicator.qml \
$$PWD/ComboBox.qml \
$$PWD/Dial.qml \
+ $$PWD/Dialog.qml \
+ $$PWD/DialogButtonBox.qml \
$$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
@@ -14,6 +16,7 @@ QML_FILES += \
$$PWD/Label.qml \
$$PWD/Menu.qml \
$$PWD/MenuItem.qml \
+ $$PWD/MenuSeparator.qml \
$$PWD/Page.qml \
$$PWD/PageIndicator.qml \
$$PWD/Pane.qml \
@@ -23,6 +26,7 @@ QML_FILES += \
$$PWD/RadioDelegate.qml \
$$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
+ $$PWD/RoundButton.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \
$$PWD/Slider.qml \
@@ -38,6 +42,7 @@ QML_FILES += \
$$PWD/TextField.qml \
$$PWD/ToolBar.qml \
$$PWD/ToolButton.qml \
+ $$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
$$PWD/Tumbler.qml
diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro
index f10f21b0..c3835016 100644
--- a/src/imports/controls/universal/universal.pro
+++ b/src/imports/controls/universal/universal.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2universalstyleplugin
TARGETPATH = QtQuick/Controls.2/Universal
-IMPORT_VERSION = 2.0
+IMPORT_VERSION = 2.1
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
index 3227cb99..e1da66c9 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -2,6 +2,7 @@ TEMPLATE = subdirs
SUBDIRS += \
controls \
calendar \
+ platform \
templates
SUBDIRS += \
diff --git a/src/imports/platform/doc/images/qtlabsplatform-colordialog-gtk.png b/src/imports/platform/doc/images/qtlabsplatform-colordialog-gtk.png
new file mode 100644
index 00000000..e0785a05
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-colordialog-gtk.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-filedialog-gtk.png b/src/imports/platform/doc/images/qtlabsplatform-filedialog-gtk.png
new file mode 100644
index 00000000..3bc963d0
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-filedialog-gtk.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-folderdialog-gtk.png b/src/imports/platform/doc/images/qtlabsplatform-folderdialog-gtk.png
new file mode 100644
index 00000000..ea4d929d
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-folderdialog-gtk.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-fontdialog-gtk.png b/src/imports/platform/doc/images/qtlabsplatform-fontdialog-gtk.png
new file mode 100644
index 00000000..9f3dc2e7
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-fontdialog-gtk.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-menu.png b/src/imports/platform/doc/images/qtlabsplatform-menu.png
new file mode 100644
index 00000000..120d263b
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-menu.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-menubar.png b/src/imports/platform/doc/images/qtlabsplatform-menubar.png
new file mode 100644
index 00000000..685d03b3
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-menubar.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-messagedialog-android.png b/src/imports/platform/doc/images/qtlabsplatform-messagedialog-android.png
new file mode 100644
index 00000000..a1de1806
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-messagedialog-android.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-messagedialog-informative-android.png b/src/imports/platform/doc/images/qtlabsplatform-messagedialog-informative-android.png
new file mode 100644
index 00000000..7062ed90
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-messagedialog-informative-android.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-menu.png b/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-menu.png
new file mode 100644
index 00000000..0d0ecfab
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-menu.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-message.png b/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-message.png
new file mode 100644
index 00000000..d929ca97
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon-message.png
Binary files differ
diff --git a/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon.png b/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon.png
new file mode 100644
index 00000000..58c40d73
--- /dev/null
+++ b/src/imports/platform/doc/images/qtlabsplatform-systemtrayicon.png
Binary files differ
diff --git a/src/imports/platform/doc/qtlabsplatform.qdocconf b/src/imports/platform/doc/qtlabsplatform.qdocconf
new file mode 100644
index 00000000..e78a9644
--- /dev/null
+++ b/src/imports/platform/doc/qtlabsplatform.qdocconf
@@ -0,0 +1,37 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = QtLabsPlatform
+description = Qt Labs Platform Reference Documentation
+version = $QT_VERSION
+
+qhp.projects = QtLabsPlatform
+
+qhp.QtLabsPlatform.file = qtlabsplatform.qhp
+qhp.QtLabsPlatform.namespace = org.qt-project.qtlabsplatform.$QT_VERSION_TAG
+qhp.QtLabsPlatform.virtualFolder = qtlabsplatform
+qhp.QtLabsPlatform.indexTitle = Qt Labs Platform
+qhp.QtLabsPlatform.indexRoot =
+
+qhp.QtLabsPlatform.filterAttributes = qtlabsplatform $QT_VERSION qtrefdoc
+qhp.QtLabsPlatform.customFilters.Qt.name = QtLabsPlatform $QT_VERSION
+qhp.QtLabsPlatform.customFilters.Qt.filterAttributes = qtlabsplatform $QT_VERSION
+
+qhp.QtLabsPlatform.subprojects = qmltypes
+qhp.QtLabsPlatform.subprojects.qmltypes.title = QML Types
+qhp.QtLabsPlatform.subprojects.qmltypes.indexTitle = Qt Labs Platform QML Types
+qhp.QtLabsPlatform.subprojects.qmltypes.selectors = qmlclass
+qhp.QtLabsPlatform.subprojects.qmltypes.sortPages = true
+
+depends = qtcore qtgui qtdoc qtqml qtquick qtquickcontrols2 qtwidgets
+
+headerdirs += ../
+sourcedirs += ../
+
+imagedirs += images
+
+navigation.landingpage = "Qt Labs Platform"
+navigation.qmltypespage = "Qt Labs Platform QML Types"
+
+tagfile = qtlabsplatform.tags
+
+macro.labs = "\\note \\e{Types in Qt.labs modules are not guaranteed to remain compatible in future versions.}"
diff --git a/src/imports/platform/doc/src/includes/widgets.qdocinc b/src/imports/platform/doc/src/includes/widgets.qdocinc
new file mode 100644
index 00000000..c89c3ca0
--- /dev/null
+++ b/src/imports/platform/doc/src/includes/widgets.qdocinc
@@ -0,0 +1,29 @@
+//! [1]
+The Qt Labs Platform module uses Qt Widgets as a fallback on platforms that
+do not have a native implementation available. Therefore, applications that
+use types from the Qt Labs Platform module should link to QtWidgets and use
+\l QApplication instead of \l QGuiApplication.
+
+To link against the QtWidgets library, add the following to your qmake project
+file:
+
+\code
+QT += widgets
+\endcode
+
+Create an instance of \l QApplication in \c main():
+
+\code
+#include <QApplication>
+#include <QQmlApplicationEngine>
+
+int main(int argc, char *argv[])
+{
+ QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QApplication app(argc, argv);
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ return app.exec();
+}
+\endcode
+//! [1]
diff --git a/src/imports/platform/doc/src/qtlabsplatform-index.qdoc b/src/imports/platform/doc/src/qtlabsplatform-index.qdoc
new file mode 100644
index 00000000..aec2a923
--- /dev/null
+++ b/src/imports/platform/doc/src/qtlabsplatform-index.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$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabsplatform-index.html
+ \title Qt Labs Platform
+
+ \brief The experimental Qt Labs Platform module provides QML types for
+ native platform extensions.
+
+ The experimental Qt Labs Platform module provides QML types for native
+ platform extensions. The module was introduced in Qt 5.8.
+
+ \section1 QML Types
+
+ \generatelist {qmltypesbymodule Qt.labs.platform}
+
+ \labs
+
+ \section1 Related Information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc b/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc
new file mode 100644
index 00000000..470b93c4
--- /dev/null
+++ b/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc
@@ -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$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule Qt.labs.platform 1.0
+ \title Qt Labs Platform QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for native platform extensions.
+
+ The experimental \l{Qt Labs Platform} module provides QML types for native
+ platform extensions. These QML types work in conjunction with \l{Qt Quick}
+ and \l{Qt Quick Controls 2}.
+
+ The QML types can be imported into your application using the
+ following import statement in your .qml file:
+
+ \badcode
+ import Qt.labs.platform 1.0
+ \endcode
+
+ \section1 QML Types
+
+ \generatelist {qmltypesbymodule Qt.labs.platform}
+
+ \labs
+
+ \section1 Related Information
+
+ \list
+ \li \l {Qt Quick Controls 2 QML Types}
+ \endlist
+
+ \noautolist
+*/
diff --git a/src/imports/platform/platform.pri b/src/imports/platform/platform.pri
new file mode 100644
index 00000000..1e300251
--- /dev/null
+++ b/src/imports/platform/platform.pri
@@ -0,0 +1,31 @@
+HEADERS += \
+ $$PWD/qquickplatformcolordialog_p.h \
+ $$PWD/qquickplatformdialog_p.h \
+ $$PWD/qquickplatformfiledialog_p.h \
+ $$PWD/qquickplatformfolderdialog_p.h \
+ $$PWD/qquickplatformfontdialog_p.h \
+ $$PWD/qquickplatformiconloader_p.h \
+ $$PWD/qquickplatformmenu_p.h \
+ $$PWD/qquickplatformmenubar_p.h \
+ $$PWD/qquickplatformmenuitem_p.h \
+ $$PWD/qquickplatformmenuitemgroup_p.h \
+ $$PWD/qquickplatformmenuseparator_p.h \
+ $$PWD/qquickplatformmessagedialog_p.h \
+ $$PWD/qquickplatformstandardpaths_p.h \
+ $$PWD/qquickplatformsystemtrayicon_p.h
+
+SOURCES += \
+ $$PWD/qquickplatformcolordialog.cpp \
+ $$PWD/qquickplatformdialog.cpp \
+ $$PWD/qquickplatformfiledialog.cpp \
+ $$PWD/qquickplatformfolderdialog.cpp \
+ $$PWD/qquickplatformfontdialog.cpp \
+ $$PWD/qquickplatformiconloader.cpp \
+ $$PWD/qquickplatformmenu.cpp \
+ $$PWD/qquickplatformmenubar.cpp \
+ $$PWD/qquickplatformmenuitem.cpp \
+ $$PWD/qquickplatformmenuitemgroup.cpp \
+ $$PWD/qquickplatformmenuseparator.cpp \
+ $$PWD/qquickplatformmessagedialog.cpp \
+ $$PWD/qquickplatformstandardpaths.cpp \
+ $$PWD/qquickplatformsystemtrayicon.cpp
diff --git a/src/imports/platform/platform.pro b/src/imports/platform/platform.pro
new file mode 100644
index 00000000..043b0172
--- /dev/null
+++ b/src/imports/platform/platform.pro
@@ -0,0 +1,22 @@
+TARGET = qtlabsplatformplugin
+TARGETPATH = Qt/labs/platform
+IMPORT_VERSION = 1.0
+
+QT += qml quick
+QT_PRIVATE += core-private gui-private qml-private quick-private
+
+DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
+
+QMAKE_DOCS = $$PWD/doc/qtlabsplatform.qdocconf
+
+OTHER_FILES += \
+ qmldir
+
+SOURCES += \
+ $$PWD/qtlabsplatformplugin.cpp
+
+include(platform.pri)
+qtHaveModule(widgets): include(widgets/widgets.pri)
+
+CONFIG += no_cxx_module
+load(qml_plugin)
diff --git a/src/imports/platform/plugins.qmltypes b/src/imports/platform/plugins.qmltypes
new file mode 100644
index 00000000..6913405b
--- /dev/null
+++ b/src/imports/platform/plugins.qmltypes
@@ -0,0 +1,460 @@
+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 Qt.labs.platform 1.0'
+
+Module {
+ dependencies: ["QtQuick 2.8"]
+ Component {
+ name: "QPlatformDialogHelper"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/StandardButton 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "StandardButtons"
+ values: {
+ "NoButton": 0,
+ "Ok": 1024,
+ "Save": 2048,
+ "SaveAll": 4096,
+ "Open": 8192,
+ "Yes": 16384,
+ "YesToAll": 32768,
+ "No": 65536,
+ "NoToAll": 131072,
+ "Abort": 262144,
+ "Retry": 524288,
+ "Ignore": 1048576,
+ "Close": 2097152,
+ "Cancel": 4194304,
+ "Discard": 8388608,
+ "Help": 16777216,
+ "Apply": 33554432,
+ "Reset": 67108864,
+ "RestoreDefaults": 134217728,
+ "FirstButton": 1024,
+ "LastButton": 134217728,
+ "LowestBit": 10,
+ "HighestBit": 27
+ }
+ }
+ Enum {
+ name: "ButtonRole"
+ values: {
+ "InvalidRole": -1,
+ "AcceptRole": 0,
+ "RejectRole": 1,
+ "DestructiveRole": 2,
+ "ActionRole": 3,
+ "HelpRole": 4,
+ "YesRole": 5,
+ "NoRole": 6,
+ "ResetRole": 7,
+ "ApplyRole": 8,
+ "NRoles": 9,
+ "RoleMask": 268435455,
+ "AlternateRole": 268435456,
+ "Stretch": 536870912,
+ "Reverse": 1073741824,
+ "EOL": -1
+ }
+ }
+ Signal { name: "accept" }
+ Signal { name: "reject" }
+ }
+ Component {
+ name: "QQuickPlatformColorDialog"
+ defaultProperty: "data"
+ prototype: "QQuickPlatformDialog"
+ exports: ["Qt.labs.platform/ColorDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "color"; type: "QColor" }
+ Property { name: "currentColor"; type: "QColor" }
+ Property { name: "options"; type: "QColorDialogOptions::ColorDialogOptions" }
+ }
+ Component {
+ name: "QQuickPlatformDialog"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/Dialog 1.0"]
+ isCreatable: false
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "StandardCode"
+ values: {
+ "Rejected": 0,
+ "Accepted": 1
+ }
+ }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "parentWindow"; type: "QWindow"; isPointer: true }
+ Property { name: "title"; type: "string" }
+ Property { name: "flags"; type: "Qt::WindowFlags" }
+ Property { name: "modality"; type: "Qt::WindowModality" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "result"; type: "int" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "open" }
+ Method { name: "close" }
+ Method { name: "accept" }
+ Method { name: "reject" }
+ Method {
+ name: "done"
+ Parameter { name: "result"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickPlatformFileDialog"
+ defaultProperty: "data"
+ prototype: "QQuickPlatformDialog"
+ exports: ["Qt.labs.platform/FileDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "FileMode"
+ values: {
+ "OpenFile": 0,
+ "OpenFiles": 1,
+ "SaveFile": 2
+ }
+ }
+ Property { name: "fileMode"; type: "FileMode" }
+ Property { name: "file"; type: "QUrl" }
+ Property { name: "files"; type: "QList<QUrl>" }
+ Property { name: "currentFile"; type: "QUrl" }
+ Property { name: "currentFiles"; type: "QList<QUrl>" }
+ Property { name: "folder"; type: "QUrl" }
+ Property { name: "options"; type: "QFileDialogOptions::FileDialogOptions" }
+ Property { name: "nameFilters"; type: "QStringList" }
+ Property {
+ name: "selectedNameFilter"
+ type: "QQuickPlatformFileNameFilter"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "defaultSuffix"; type: "string" }
+ Property { name: "acceptLabel"; type: "string" }
+ Property { name: "rejectLabel"; type: "string" }
+ }
+ Component {
+ name: "QQuickPlatformFileNameFilter"
+ prototype: "QObject"
+ Property { name: "index"; type: "int" }
+ Property { name: "name"; type: "string"; isReadonly: true }
+ Property { name: "extensions"; type: "QStringList"; isReadonly: true }
+ Signal {
+ name: "indexChanged"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "nameChanged"
+ Parameter { name: "name"; type: "string" }
+ }
+ Signal {
+ name: "extensionsChanged"
+ Parameter { name: "extensions"; type: "QStringList" }
+ }
+ }
+ Component {
+ name: "QQuickPlatformFolderDialog"
+ defaultProperty: "data"
+ prototype: "QQuickPlatformDialog"
+ exports: ["Qt.labs.platform/FolderDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "folder"; type: "QUrl" }
+ Property { name: "currentFolder"; type: "QUrl" }
+ Property { name: "options"; type: "QFileDialogOptions::FileDialogOptions" }
+ Property { name: "acceptLabel"; type: "string" }
+ Property { name: "rejectLabel"; type: "string" }
+ }
+ Component {
+ name: "QQuickPlatformFontDialog"
+ defaultProperty: "data"
+ prototype: "QQuickPlatformDialog"
+ exports: ["Qt.labs.platform/FontDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "font"; type: "QFont" }
+ Property { name: "currentFont"; type: "QFont" }
+ Property { name: "options"; type: "QFontDialogOptions::FontDialogOptions" }
+ }
+ Component {
+ name: "QQuickPlatformMenu"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "items"; type: "QQuickPlatformMenuItem"; isList: true; isReadonly: true }
+ Property { name: "menuBar"; type: "QQuickPlatformMenuBar"; isReadonly: true; isPointer: true }
+ Property { name: "parentMenu"; type: "QQuickPlatformMenu"; isReadonly: true; isPointer: true }
+ Property {
+ name: "systemTrayIcon"
+ type: "QQuickPlatformSystemTrayIcon"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "menuItem"; type: "QQuickPlatformMenuItem"; isReadonly: true; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "minimumWidth"; type: "int" }
+ Property { name: "type"; type: "QPlatformMenu::MenuType" }
+ Property { name: "title"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Signal { name: "aboutToShow" }
+ Signal { name: "aboutToHide" }
+ Method {
+ name: "open"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "close" }
+ Method {
+ name: "addItem"
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Method {
+ name: "addMenu"
+ Parameter { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ }
+ Method {
+ name: "insertMenu"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ }
+ Method {
+ name: "removeMenu"
+ Parameter { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QQuickPlatformMenuBar"
+ defaultProperty: "data"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/MenuBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "menus"; type: "QQuickPlatformMenu"; isList: true; isReadonly: true }
+ Property { name: "window"; type: "QWindow"; isPointer: true }
+ Method {
+ name: "addMenu"
+ Parameter { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ }
+ Method {
+ name: "insertMenu"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ }
+ Method {
+ name: "removeMenu"
+ Parameter { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QQuickPlatformMenuItem"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "menu"; type: "QQuickPlatformMenu"; isReadonly: true; isPointer: true }
+ Property { name: "subMenu"; type: "QQuickPlatformMenu"; isReadonly: true; isPointer: true }
+ Property { name: "group"; type: "QQuickPlatformMenuItemGroup"; isPointer: true }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "separator"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "role"; type: "QPlatformMenuItem::MenuRole" }
+ Property { name: "text"; type: "string" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "shortcut"; type: "QVariant" }
+ Property { name: "font"; type: "QFont" }
+ Signal { name: "triggered" }
+ Signal { name: "hovered" }
+ Method { name: "toggle" }
+ }
+ Component {
+ name: "QQuickPlatformMenuItemGroup"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/MenuItemGroup 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "exclusive"; type: "bool" }
+ Property { name: "checkedItem"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ Property { name: "items"; type: "QQuickPlatformMenuItem"; isList: true; isReadonly: true }
+ Signal {
+ name: "triggered"
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Signal {
+ name: "hovered"
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Method {
+ name: "addItem"
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { name: "item"; type: "QQuickPlatformMenuItem"; isPointer: true }
+ }
+ Method { name: "clear" }
+ }
+ Component {
+ name: "QQuickPlatformMenuSeparator"
+ prototype: "QQuickPlatformMenuItem"
+ exports: ["Qt.labs.platform/MenuSeparator 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickPlatformMessageDialog"
+ defaultProperty: "data"
+ prototype: "QQuickPlatformDialog"
+ exports: ["Qt.labs.platform/MessageDialog 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "informativeText"; type: "string" }
+ Property { name: "detailedText"; type: "string" }
+ Property { name: "buttons"; type: "QPlatformDialogHelper::StandardButtons" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "button"; type: "QPlatformDialogHelper::StandardButton" }
+ }
+ Signal { name: "okClicked" }
+ Signal { name: "saveClicked" }
+ Signal { name: "saveAllClicked" }
+ Signal { name: "openClicked" }
+ Signal { name: "yesClicked" }
+ Signal { name: "yesToAllClicked" }
+ Signal { name: "noClicked" }
+ Signal { name: "noToAllClicked" }
+ Signal { name: "abortClicked" }
+ Signal { name: "retryClicked" }
+ Signal { name: "ignoreClicked" }
+ Signal { name: "closeClicked" }
+ Signal { name: "cancelClicked" }
+ Signal { name: "discardClicked" }
+ Signal { name: "helpClicked" }
+ Signal { name: "applyClicked" }
+ Signal { name: "resetClicked" }
+ Signal { name: "restoreDefaultsClicked" }
+ }
+ Component {
+ name: "QQuickPlatformStandardPaths"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/StandardPaths 1.0"]
+ isCreatable: false
+ isSingleton: true
+ exportMetaObjectRevisions: [0]
+ Method {
+ name: "displayName"
+ type: "string"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ }
+ Method {
+ name: "findExecutable"
+ type: "QUrl"
+ Parameter { name: "executableName"; type: "string" }
+ Parameter { name: "paths"; type: "QStringList" }
+ }
+ Method {
+ name: "findExecutable"
+ type: "QUrl"
+ Parameter { name: "executableName"; type: "string" }
+ }
+ Method {
+ name: "locate"
+ type: "QUrl"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ Parameter { name: "fileName"; type: "string" }
+ Parameter { name: "options"; type: "QStandardPaths::LocateOptions" }
+ }
+ Method {
+ name: "locate"
+ type: "QUrl"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ Parameter { name: "fileName"; type: "string" }
+ }
+ Method {
+ name: "locateAll"
+ type: "QList<QUrl>"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ Parameter { name: "fileName"; type: "string" }
+ Parameter { name: "options"; type: "QStandardPaths::LocateOptions" }
+ }
+ Method {
+ name: "locateAll"
+ type: "QList<QUrl>"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ Parameter { name: "fileName"; type: "string" }
+ }
+ Method {
+ name: "setTestModeEnabled"
+ Parameter { name: "testMode"; type: "bool" }
+ }
+ Method {
+ name: "standardLocations"
+ type: "QList<QUrl>"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ }
+ Method {
+ name: "writableLocation"
+ type: "QUrl"
+ Parameter { name: "type"; type: "QStandardPaths::StandardLocation" }
+ }
+ }
+ Component {
+ name: "QQuickPlatformSystemTrayIcon"
+ prototype: "QObject"
+ exports: ["Qt.labs.platform/SystemTrayIcon 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "available"; type: "bool"; isReadonly: true }
+ Property { name: "supportsMessages"; type: "bool"; isReadonly: true }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "iconSource"; type: "QUrl" }
+ Property { name: "iconName"; type: "string" }
+ Property { name: "tooltip"; type: "string" }
+ Property { name: "menu"; type: "QQuickPlatformMenu"; isPointer: true }
+ Signal {
+ name: "activated"
+ Parameter { name: "reason"; type: "QPlatformSystemTrayIcon::ActivationReason" }
+ }
+ Signal { name: "messageClicked" }
+ Method { name: "show" }
+ Method { name: "hide" }
+ Method {
+ name: "showMessage"
+ Parameter { name: "title"; type: "string" }
+ Parameter { name: "message"; type: "string" }
+ Parameter { name: "iconType"; type: "QPlatformSystemTrayIcon::MessageIcon" }
+ Parameter { name: "msecs"; type: "int" }
+ }
+ Method {
+ name: "showMessage"
+ Parameter { name: "title"; type: "string" }
+ Parameter { name: "message"; type: "string" }
+ Parameter { name: "iconType"; type: "QPlatformSystemTrayIcon::MessageIcon" }
+ }
+ Method {
+ name: "showMessage"
+ Parameter { name: "title"; type: "string" }
+ Parameter { name: "message"; type: "string" }
+ }
+ }
+}
diff --git a/src/imports/platform/qmldir b/src/imports/platform/qmldir
new file mode 100644
index 00000000..9653b7d3
--- /dev/null
+++ b/src/imports/platform/qmldir
@@ -0,0 +1,3 @@
+module Qt.labs.platform
+plugin qtlabsplatformplugin
+classname QtLabsPlatformPlugin
diff --git a/src/imports/platform/qquickplatformcolordialog.cpp b/src/imports/platform/qquickplatformcolordialog.cpp
new file mode 100644
index 00000000..36bb7d69
--- /dev/null
+++ b/src/imports/platform/qquickplatformcolordialog.cpp
@@ -0,0 +1,205 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformcolordialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ColorDialog
+ \inherits Dialog
+ \instantiates QQuickPlatformColorDialog
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native color dialog.
+
+ The ColorDialog type provides a QML API for native platform color dialogs.
+
+ \image qtlabsplatform-colordialog-gtk.png
+
+ To show a color dialog, construct an instance of ColorDialog, set the
+ desired properties, and call \l {Dialog::}{open()}. The \l currentColor
+ property can be used to determine the currently selected color in the
+ dialog. The \l color property is updated only after the final selection
+ has been made by accepting the dialog.
+
+ \code
+ MenuItem {
+ text: "Color"
+ onTriggered: colorDialog.open()
+ }
+
+ ColorDialog {
+ id: colorDialog
+ currentColor: document.color
+ }
+
+ MyDocument {
+ id: document
+ color: colorDialog.color
+ }
+ \endcode
+
+ \section2 Availability
+
+ A native platform color dialog is currently available on the following platforms:
+
+ \list
+ \li macOS
+ \li Linux (when running with the GTK+ platform theme)
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+*/
+
+QQuickPlatformColorDialog::QQuickPlatformColorDialog(QObject *parent)
+ : QQuickPlatformDialog(QPlatformTheme::ColorDialog, parent),
+ m_options(QColorDialogOptions::create())
+{
+}
+
+/*!
+ \qmlproperty color Qt.labs.platform::ColorDialog::color
+
+ This property holds the final accepted color.
+
+ Unlike the \l currentColor property, the \c color property is not updated
+ while the user is selecting colors in the dialog, but only after the final
+ selection has been made. That is, when the user has clicked \uicontrol OK
+ to accept a color. Alternatively, the \l {Dialog::}{accepted()} signal
+ can be handled to get the final selection.
+
+ \sa currentColor, {Dialog::}{accepted()}
+*/
+QColor QQuickPlatformColorDialog::color() const
+{
+ return m_color;
+}
+
+void QQuickPlatformColorDialog::setColor(const QColor &color)
+{
+ if (m_color == color)
+ return;
+
+ m_color = color;
+ setCurrentColor(color);
+ emit colorChanged();
+}
+
+/*!
+ \qmlproperty color Qt.labs.platform::ColorDialog::currentColor
+
+ This property holds the currently selected color in the dialog.
+
+ Unlike the \l color property, the \c currentColor property is updated
+ while the user is selecting colors in the dialog, even before the final
+ selection has been made.
+
+ \sa color
+*/
+QColor QQuickPlatformColorDialog::currentColor() const
+{
+ if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(handle()))
+ return colorDialog->currentColor();
+ return m_currentColor;
+}
+
+void QQuickPlatformColorDialog::setCurrentColor(const QColor &color)
+{
+ if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(handle()))
+ colorDialog->setCurrentColor(color);
+ m_currentColor = color;
+}
+
+/*!
+ \qmlproperty flags Qt.labs.platform::ColorDialog::options
+
+ This property holds the various options that affect the look and feel of the dialog.
+
+ By default, all options are disabled.
+
+ Options should be set before showing the dialog. Setting them while the dialog is
+ visible is not guaranteed to have an immediate effect on the dialog (depending on
+ the option and on the platform).
+
+ Available options:
+ \value ColorDialog.ShowAlphaChannel Allow the user to select the alpha component of a color.
+ \value ColorDialog.NoButtons Don't display \uicontrol OK and \uicontrol Cancel buttons (useful for "live dialogs").
+*/
+QColorDialogOptions::ColorDialogOptions QQuickPlatformColorDialog::options() const
+{
+ return m_options->options();
+}
+
+void QQuickPlatformColorDialog::setOptions(QColorDialogOptions::ColorDialogOptions options)
+{
+ if (options == m_options->options())
+ return;
+
+ m_options->setOptions(options);
+ emit optionsChanged();
+}
+
+bool QQuickPlatformColorDialog::useNativeDialog() const
+{
+ return QQuickPlatformDialog::useNativeDialog()
+ && !m_options->testOption(QColorDialogOptions::DontUseNativeDialog);
+}
+
+void QQuickPlatformColorDialog::onCreate(QPlatformDialogHelper *dialog)
+{
+ if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(dialog)) {
+ connect(colorDialog, &QPlatformColorDialogHelper::currentColorChanged, this, &QQuickPlatformColorDialog::currentColorChanged);
+ colorDialog->setOptions(m_options);
+ }
+}
+
+void QQuickPlatformColorDialog::onShow(QPlatformDialogHelper *dialog)
+{
+ m_options->setWindowTitle(title());
+ if (QPlatformColorDialogHelper *colorDialog = qobject_cast<QPlatformColorDialogHelper *>(dialog))
+ colorDialog->setOptions(m_options);
+}
+
+void QQuickPlatformColorDialog::accept()
+{
+ setColor(currentColor());
+ QQuickPlatformDialog::accept();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformcolordialog_p.h b/src/imports/platform/qquickplatformcolordialog_p.h
new file mode 100644
index 00000000..33d6f0e8
--- /dev/null
+++ b/src/imports/platform/qquickplatformcolordialog_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMCOLORDIALOG_P_H
+#define QQUICKPLATFORMCOLORDIALOG_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 "qquickplatformdialog_p.h"
+#include <QtGui/qcolor.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformColorDialog : public QQuickPlatformDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
+ Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged FINAL)
+ Q_PROPERTY(QColorDialogOptions::ColorDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL)
+ Q_FLAGS(QColorDialogOptions::ColorDialogOptions)
+
+public:
+ explicit QQuickPlatformColorDialog(QObject *parent = nullptr);
+
+ QColor color() const;
+ void setColor(const QColor &color);
+
+ QColor currentColor() const;
+ void setCurrentColor(const QColor &color);
+
+ QColorDialogOptions::ColorDialogOptions options() const;
+ void setOptions(QColorDialogOptions::ColorDialogOptions options);
+
+Q_SIGNALS:
+ void colorChanged();
+ void currentColorChanged();
+ void optionsChanged();
+
+protected:
+ bool useNativeDialog() const override;
+ void onCreate(QPlatformDialogHelper *dialog) override;
+ void onShow(QPlatformDialogHelper *dialog) override;
+ void accept() override;
+
+private:
+ QColor m_color;
+ QColor m_currentColor; // TODO: QColorDialogOptions::initialColor
+ QSharedPointer<QColorDialogOptions> m_options;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformColorDialog)
+
+#endif // QQUICKPLATFORMCOLORDIALOG_P_H
diff --git a/src/imports/platform/qquickplatformdialog.cpp b/src/imports/platform/qquickplatformdialog.cpp
new file mode 100644
index 00000000..95bc6426
--- /dev/null
+++ b/src/imports/platform/qquickplatformdialog.cpp
@@ -0,0 +1,409 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformdialog_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/qquickwindow.h>
+
+#include "widgets/qwidgetplatform_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Dialog
+ \inherits QtObject
+ \instantiates QQuickPlatformDialog
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief The base class of native dialogs.
+
+ The Dialog type provides common QML API for native platform dialogs.
+
+ To show a native dialog, construct an instance of one of the concrete
+ Dialog implementations, set the desired properties, and call \l open().
+ Dialog emits \l accepted() or \l rejected() when the user is done with
+ the dialog.
+
+ \labs
+*/
+
+/*!
+ \qmlsignal void Qt.labs.platform::Dialog::accepted()
+
+ This signal is emitted when the dialog has been accepted either
+ interactively or by calling \l accept().
+
+ \note This signal is \e not emitted when closing the dialog with \l close().
+
+ \sa rejected()
+*/
+
+/*!
+ \qmlsignal void Qt.labs.platform::Dialog::rejected()
+
+ This signal is emitted when the dialog has been rejected either
+ interactively or by calling \l reject().
+
+ \note This signal is \e not emitted when closing the dialog with \l close().
+
+ \sa accepted()
+*/
+
+Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformDialogs)
+
+QQuickPlatformDialog::QQuickPlatformDialog(QPlatformTheme::DialogType type, QObject *parent)
+ : QObject(parent),
+ m_visible(false),
+ m_complete(false),
+ m_result(0),
+ m_parentWindow(nullptr),
+ m_flags(Qt::Dialog),
+ m_modality(Qt::WindowModal),
+ m_type(type),
+ m_handle(nullptr)
+{
+}
+
+QQuickPlatformDialog::~QQuickPlatformDialog()
+{
+ destroy();
+}
+
+QPlatformDialogHelper *QQuickPlatformDialog::handle() const
+{
+ return m_handle;
+}
+
+/*!
+ \default
+ \qmlproperty list<Object> Qt.labs.platform::Dialog::data
+
+ This default property holds the list of all objects declared as children of
+ the dialog.
+*/
+QQmlListProperty<QObject> QQuickPlatformDialog::data()
+{
+ return QQmlListProperty<QObject>(this, m_data);
+}
+
+/*!
+ \qmlproperty Window Qt.labs.platform::Dialog::parentWindow
+
+ This property holds the parent window of the dialog.
+
+ Unless explicitly set, the window is automatically resolved by iterating
+ the QML parent objects until a \l Window or an \l Item that has a window
+ is found.
+*/
+QWindow *QQuickPlatformDialog::parentWindow() const
+{
+ return m_parentWindow;
+}
+
+void QQuickPlatformDialog::setParentWindow(QWindow *window)
+{
+ if (m_parentWindow == window)
+ return;
+
+ m_parentWindow = window;
+ emit parentWindowChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::Dialog::title
+
+ This property holds the title of the dialog.
+*/
+QString QQuickPlatformDialog::title() const
+{
+ return m_title;
+}
+
+void QQuickPlatformDialog::setTitle(const QString &title)
+{
+ if (m_title == title)
+ return;
+
+ m_title = title;
+ emit titleChanged();
+}
+
+/*!
+ \qmlproperty Qt::WindowFlags Qt.labs.platform::Dialog::flags
+
+ This property holds the window flags of the dialog. The default value is \c Qt.Dialog.
+*/
+Qt::WindowFlags QQuickPlatformDialog::flags() const
+{
+ return m_flags;
+}
+
+void QQuickPlatformDialog::setFlags(Qt::WindowFlags flags)
+{
+ if (m_flags == flags)
+ return;
+
+ m_flags = flags;
+ emit flagsChanged();
+}
+
+/*!
+ \qmlproperty Qt::WindowModality Qt.labs.platform::Dialog::modality
+
+ This property holds the modality of the dialog. The default value is \c Qt.WindowModal.
+
+ Available values:
+ \value Qt.NonModal The dialog is not modal and does not block input to other windows.
+ \value Qt.WindowModal The dialog is modal to a single window hierarchy and blocks input to its parent window, all grandparent windows, and all siblings of its parent and grandparent windows.
+ \value Qt.ApplicationModal The dialog is modal to the application and blocks input to all windows.
+*/
+Qt::WindowModality QQuickPlatformDialog::modality() const
+{
+ return m_modality;
+}
+
+void QQuickPlatformDialog::setModality(Qt::WindowModality modality)
+{
+ if (m_modality == modality)
+ return;
+
+ m_modality = modality;
+ emit modalityChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::Dialog::visible
+
+ This property holds the visibility of the dialog. The default value is \c false.
+
+ \sa open(), close()
+*/
+bool QQuickPlatformDialog::isVisible() const
+{
+ return m_handle && m_visible;
+}
+
+void QQuickPlatformDialog::setVisible(bool visible)
+{
+ if (visible)
+ open();
+ else
+ close();
+}
+
+/*!
+ \qmlproperty int Qt.labs.platform::Dialog::result
+
+ This property holds the result code.
+
+ Standard result codes:
+ \value Dialog.Accepted
+ \value Dialog.Rejected
+
+ \note MessageDialog sets the result to the value of the clicked standard
+ button instead of using the standard result codes.
+*/
+int QQuickPlatformDialog::result() const
+{
+ return m_result;
+}
+
+void QQuickPlatformDialog::setResult(int result)
+{
+ if (m_result == result)
+ return;
+
+ m_result = result;
+ emit resultChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Dialog::open()
+
+ Opens the dialog.
+
+ \sa visible, close()
+*/
+void QQuickPlatformDialog::open()
+{
+ if (m_visible || !create())
+ return;
+
+ onShow(m_handle);
+ m_visible = m_handle->show(m_flags, m_modality, m_parentWindow);
+ if (m_visible)
+ emit visibleChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Dialog::close()
+
+ Closes the dialog.
+
+ \sa visible, open()
+*/
+void QQuickPlatformDialog::close()
+{
+ if (!m_handle || !m_visible)
+ return;
+
+ onHide(m_handle);
+ m_handle->hide();
+ m_visible = false;
+ emit visibleChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Dialog::accept()
+
+ Closes the dialog and emits the \l accepted() signal.
+
+ \sa reject()
+*/
+void QQuickPlatformDialog::accept()
+{
+ done(Accepted);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Dialog::reject()
+
+ Closes the dialog and emits the \l rejected() signal.
+
+ \sa accept()
+*/
+void QQuickPlatformDialog::reject()
+{
+ done(Rejected);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Dialog::done(int result)
+
+ Closes the dialog and sets the \a result.
+
+ \sa accept(), reject(), result
+*/
+void QQuickPlatformDialog::done(int result)
+{
+ close();
+ setResult(result);
+
+ if (result == Accepted)
+ emit accepted();
+ else if (result == Rejected)
+ emit rejected();
+}
+
+void QQuickPlatformDialog::classBegin()
+{
+}
+
+void QQuickPlatformDialog::componentComplete()
+{
+ m_complete = true;
+ if (!m_parentWindow)
+ setParentWindow(findParentWindow());
+}
+
+static const char *qmlTypeName(const QObject *object)
+{
+ return object->metaObject()->className() + qstrlen("QQuickPlatform");
+}
+
+bool QQuickPlatformDialog::create()
+{
+ if (!m_handle) {
+ if (useNativeDialog())
+ m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformDialogHelper(m_type);
+ if (!m_handle)
+ m_handle = QWidgetPlatform::createDialog(m_type, this);
+ qCDebug(qtLabsPlatformDialogs) << qmlTypeName(this) << "->" << m_handle;
+ if (m_handle) {
+ onCreate(m_handle);
+ connect(m_handle, &QPlatformDialogHelper::accept, this, &QQuickPlatformDialog::accept);
+ connect(m_handle, &QPlatformDialogHelper::reject, this, &QQuickPlatformDialog::reject);
+ }
+ }
+ return m_handle;
+}
+
+void QQuickPlatformDialog::destroy()
+{
+ delete m_handle;
+ m_handle = nullptr;
+}
+
+bool QQuickPlatformDialog::useNativeDialog() const
+{
+ return !QCoreApplication::testAttribute(Qt::AA_DontUseNativeDialogs)
+ && QGuiApplicationPrivate::platformTheme()->usePlatformNativeDialog(m_type);
+}
+
+void QQuickPlatformDialog::onCreate(QPlatformDialogHelper *dialog)
+{
+ Q_UNUSED(dialog);
+}
+
+void QQuickPlatformDialog::onShow(QPlatformDialogHelper *dialog)
+{
+ Q_UNUSED(dialog);
+}
+
+void QQuickPlatformDialog::onHide(QPlatformDialogHelper *dialog)
+{
+ Q_UNUSED(dialog);
+}
+
+QWindow *QQuickPlatformDialog::findParentWindow() const
+{
+ QObject *obj = parent();
+ while (obj) {
+ QWindow *window = qobject_cast<QWindow *>(obj);
+ if (window)
+ return window;
+ QQuickItem *item = qobject_cast<QQuickItem *>(obj);
+ if (item && item->window())
+ return item->window();
+ obj = obj->parent();
+ }
+ return nullptr;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformdialog_p.h b/src/imports/platform/qquickplatformdialog_p.h
new file mode 100644
index 00000000..a9797c1d
--- /dev/null
+++ b/src/imports/platform/qquickplatformdialog_p.h
@@ -0,0 +1,153 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMDIALOG_P_H
+#define QQUICKPLATFORMDIALOG_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 <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqmllist.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+class QPlatformDialogHelper;
+
+class QQuickPlatformDialog : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL)
+ Q_PROPERTY(QWindow *parentWindow READ parentWindow WRITE setParentWindow NOTIFY parentWindowChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(Qt::WindowFlags flags READ flags WRITE setFlags NOTIFY flagsChanged FINAL)
+ Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "data")
+ Q_ENUMS(StandardCode)
+
+public:
+ explicit QQuickPlatformDialog(QPlatformTheme::DialogType type, QObject *parent = nullptr);
+ ~QQuickPlatformDialog();
+
+ QPlatformDialogHelper *handle() const;
+
+ QQmlListProperty<QObject> data();
+
+ QWindow *parentWindow() const;
+ void setParentWindow(QWindow *window);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ Qt::WindowFlags flags() const;
+ void setFlags(Qt::WindowFlags flags);
+
+ Qt::WindowModality modality() const;
+ void setModality(Qt::WindowModality modality);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ enum StandardCode { Rejected, Accepted };
+
+ int result() const;
+ void setResult(int result);
+
+public Q_SLOTS:
+ void open();
+ void close();
+ virtual void accept();
+ virtual void reject();
+ virtual void done(int result);
+
+Q_SIGNALS:
+ void accepted();
+ void rejected();
+ void parentWindowChanged();
+ void titleChanged();
+ void flagsChanged();
+ void modalityChanged();
+ void visibleChanged();
+ void resultChanged();
+
+protected:
+ void classBegin() override;
+ void componentComplete() override;
+
+ bool create();
+ void destroy();
+
+ virtual bool useNativeDialog() const;
+ virtual void onCreate(QPlatformDialogHelper *dialog);
+ virtual void onShow(QPlatformDialogHelper *dialog);
+ virtual void onHide(QPlatformDialogHelper *dialog);
+
+ QWindow *findParentWindow() const;
+
+private:
+ bool m_visible;
+ bool m_complete;
+ int m_result;
+ QWindow *m_parentWindow;
+ QString m_title;
+ Qt::WindowFlags m_flags;
+ Qt::WindowModality m_modality;
+ QPlatformTheme::DialogType m_type;
+ QList<QObject *> m_data;
+ QPlatformDialogHelper *m_handle;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformDialog)
+
+#endif // QQUICKPLATFORMDIALOG_P_H
diff --git a/src/imports/platform/qquickplatformfiledialog.cpp b/src/imports/platform/qquickplatformfiledialog.cpp
new file mode 100644
index 00000000..6a0f4e13
--- /dev/null
+++ b/src/imports/platform/qquickplatformfiledialog.cpp
@@ -0,0 +1,660 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformfiledialog_p.h"
+
+#include <QtCore/qvector.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype FileDialog
+ \inherits Dialog
+ \instantiates QQuickPlatformFileDialog
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native file dialog.
+
+ The FileDialog type provides a QML API for native platform file dialogs.
+
+ \image qtlabsplatform-filedialog-gtk.png
+
+ To show a file dialog, construct an instance of FileDialog, set the
+ desired properties, and call \l {Dialog::}{open()}. The \l currentFile
+ or \l currentFiles properties can be used to determine the currently
+ selected file(s) in the dialog. The \l file and \l files properties
+ are updated only after the final selection has been made by accepting
+ the dialog.
+
+ \code
+ MenuItem {
+ text: "Open..."
+ onTriggered: fileDialog.open()
+ }
+
+ FileDialog {
+ id: fileDialog
+ currentFile: document.source
+ folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
+ }
+
+ MyDocument {
+ id: document
+ source: fileDialog.file
+ }
+ \endcode
+
+ \section2 Availability
+
+ A native platform file dialog is currently available on the following platforms:
+
+ \list
+ \li iOS
+ \li Linux (when running with the GTK+ platform theme)
+ \li macOS
+ \li Windows
+ \li WinRT
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+
+ \sa FolderDialog, StandardPaths
+*/
+
+QQuickPlatformFileDialog::QQuickPlatformFileDialog(QObject *parent)
+ : QQuickPlatformDialog(QPlatformTheme::FileDialog, parent),
+ m_fileMode(OpenFile),
+ m_options(QFileDialogOptions::create()),
+ m_selectedNameFilter(nullptr)
+{
+ m_options->setFileMode(QFileDialogOptions::ExistingFile);
+ m_options->setAcceptMode(QFileDialogOptions::AcceptOpen);
+}
+
+/*!
+ \qmlproperty enumeration Qt.labs.platform::FileDialog::fileMode
+
+ This property holds the mode of the dialog.
+
+ Available values:
+ \value FileDialog.OpenFile The dialog is used to select an existing file (default).
+ \value FileDialog.OpenFiles The dialog is used to select multiple existing files.
+ \value FileDialog.SaveFile The dialog is used to select any file. The file does not have to exist.
+*/
+QQuickPlatformFileDialog::FileMode QQuickPlatformFileDialog::fileMode() const
+{
+ return m_fileMode;
+}
+
+void QQuickPlatformFileDialog::setFileMode(FileMode mode)
+{
+ if (mode == m_fileMode)
+ return;
+
+ switch (mode) {
+ case OpenFile:
+ m_options->setFileMode(QFileDialogOptions::ExistingFile);
+ m_options->setAcceptMode(QFileDialogOptions::AcceptOpen);
+ break;
+ case OpenFiles:
+ m_options->setFileMode(QFileDialogOptions::ExistingFiles);
+ m_options->setAcceptMode(QFileDialogOptions::AcceptOpen);
+ break;
+ case SaveFile:
+ m_options->setFileMode(QFileDialogOptions::AnyFile);
+ m_options->setAcceptMode(QFileDialogOptions::AcceptSave);
+ break;
+ default:
+ break;
+ }
+
+ m_fileMode = mode;
+ emit fileModeChanged();
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::FileDialog::file
+
+ This property holds the final accepted file.
+
+ Unlike the \l currentFile property, the \c file property is not updated
+ while the user is selecting files in the dialog, but only after the final
+ selection has been made. That is, when the user has clicked \uicontrol OK
+ to accept a file. Alternatively, the \l {Dialog::}{accepted()} signal
+ can be handled to get the final selection.
+
+ \sa currentFile, {Dialog::}{accepted()}
+*/
+QUrl QQuickPlatformFileDialog::file() const
+{
+ return addDefaultSuffix(m_files.value(0));
+}
+
+void QQuickPlatformFileDialog::setFile(const QUrl &file)
+{
+ setFiles(QList<QUrl>() << file);
+}
+
+/*!
+ \qmlproperty list<url> Qt.labs.platform::FileDialog::files
+
+ This property holds the final accepted files.
+
+ Unlike the \l currentFiles property, the \c files property is not updated
+ while the user is selecting files in the dialog, but only after the final
+ selection has been made. That is, when the user has clicked \uicontrol OK
+ to accept files. Alternatively, the \l {Dialog::}{accepted()} signal
+ can be handled to get the final selection.
+
+ \sa currentFiles, {Dialog::}{accepted()}
+*/
+QList<QUrl> QQuickPlatformFileDialog::files() const
+{
+ return addDefaultSuffixes(m_files);
+}
+
+void QQuickPlatformFileDialog::setFiles(const QList<QUrl> &files)
+{
+ if (m_files == files)
+ return;
+
+ bool firstChanged = m_files.value(0) != files.value(0);
+ m_files = files;
+ if (firstChanged)
+ emit fileChanged();
+ emit filesChanged();
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::FileDialog::currentFile
+
+ This property holds the currently selected file in the dialog.
+
+ Unlike the \l file property, the \c currentFile property is updated
+ while the user is selecting files in the dialog, even before the final
+ selection has been made.
+
+ \sa file, currentFiles
+*/
+QUrl QQuickPlatformFileDialog::currentFile() const
+{
+ return currentFiles().value(0);
+}
+
+void QQuickPlatformFileDialog::setCurrentFile(const QUrl &file)
+{
+ setCurrentFiles(QList<QUrl>() << file);
+}
+
+/*!
+ \qmlproperty list<url> Qt.labs.platform::FileDialog::currentFiles
+
+ This property holds the currently selected files in the dialog.
+
+ Unlike the \l files property, the \c currentFiles property is updated
+ while the user is selecting files in the dialog, even before the final
+ selection has been made.
+
+ \sa files, currentFile
+*/
+QList<QUrl> QQuickPlatformFileDialog::currentFiles() const
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle()))
+ return fileDialog->selectedFiles();
+ return m_options->initiallySelectedFiles();
+}
+
+void QQuickPlatformFileDialog::setCurrentFiles(const QList<QUrl> &files)
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle())) {
+ for (const QUrl &file : files)
+ fileDialog->selectFile(file);
+ }
+ m_options->setInitiallySelectedFiles(files);
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::FileDialog::folder
+
+ This property holds the folder where files are selected.
+ For selecting a folder, use FolderDialog instead.
+
+ \sa FolderDialog
+*/
+QUrl QQuickPlatformFileDialog::folder() const
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle()))
+ return fileDialog->directory();
+ return m_options->initialDirectory();
+}
+
+void QQuickPlatformFileDialog::setFolder(const QUrl &folder)
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle()))
+ fileDialog->setDirectory(folder);
+ m_options->setInitialDirectory(folder);
+}
+
+/*!
+ \qmlproperty flags Qt.labs.platform::FileDialog::options
+
+ This property holds the various options that affect the look and feel of the dialog.
+
+ By default, all options are disabled.
+
+ Options should be set before showing the dialog. Setting them while the dialog is
+ visible is not guaranteed to have an immediate effect on the dialog (depending on
+ the option and on the platform).
+
+ Available options:
+ \value FileDialog.DontResolveSymlinks Don't resolve symlinks in the file dialog. By default symlinks are resolved.
+ \value FileDialog.DontConfirmOverwrite Don't ask for confirmation if an existing file is selected. By default confirmation is requested.
+ \value FileDialog.ReadOnly Indicates that the dialog doesn't allow creating directories.
+ \value FileDialog.HideNameFilterDetails Indicates if the file name filter details are hidden or not.
+*/
+QFileDialogOptions::FileDialogOptions QQuickPlatformFileDialog::options() const
+{
+ return m_options->options();
+}
+
+void QQuickPlatformFileDialog::setOptions(QFileDialogOptions::FileDialogOptions options)
+{
+ if (options == m_options->options())
+ return;
+
+ m_options->setOptions(options);
+ emit optionsChanged();
+}
+
+void QQuickPlatformFileDialog::resetOptions()
+{
+ setOptions(0);
+}
+
+/*!
+ \qmlproperty list<string> Qt.labs.platform::FileDialog::nameFilters
+
+ This property holds the filters that restrict the types of files that
+ can be selected.
+
+ \code
+ FileDialog {
+ nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)"]
+ }
+ \endcode
+
+ \note \b{*.*} is not a portable filter, because the historical assumption
+ that the file extension determines the file type is not consistent on every
+ operating system. It is possible to have a file with no dot in its name (for
+ example, \c Makefile). In a native Windows file dialog, \b{*.*} will match
+ such files, while in other types of file dialogs it may not. So it is better
+ to use \b{*} if you mean to select any file.
+
+ \sa selectedNameFilter
+*/
+QStringList QQuickPlatformFileDialog::nameFilters() const
+{
+ return m_options->nameFilters();
+}
+
+void QQuickPlatformFileDialog::setNameFilters(const QStringList &filters)
+{
+ if (filters == m_options->nameFilters())
+ return;
+
+ m_options->setNameFilters(filters);
+ if (m_selectedNameFilter) {
+ int index = m_selectedNameFilter->index();
+ if (index < 0 || index >= filters.count())
+ index = 0;
+ m_selectedNameFilter->update(filters.value(index));
+ }
+ emit nameFiltersChanged();
+}
+
+void QQuickPlatformFileDialog::resetNameFilters()
+{
+ setNameFilters(QStringList());
+}
+
+/*!
+ \qmlpropertygroup Qt.labs.platform::FileDialog::selectedNameFilter
+ \qmlproperty int Qt.labs.platform::FileDialog::selectedNameFilter.index
+ \qmlproperty string Qt.labs.platform::FileDialog::selectedNameFilter.name
+ \qmlproperty list<string> Qt.labs.platform::FileDialog::selectedNameFilter.extensions
+
+ These properties hold the currently selected name filter.
+
+ \table
+ \header
+ \li Name
+ \li Description
+ \row
+ \li \b index : int
+ \li This property determines which \l {nameFilters}{name filter} is selected.
+ The specified filter is selected when the dialog is opened. The value is
+ updated when the user selects another filter.
+ \row
+ \li [read-only] \b name : string
+ \li This property holds the name of the selected filter. In the
+ example below, the name of the first filter is \c {"Text files"}
+ and the second is \c {"HTML files"}.
+ \row
+ \li [read-only] \b extensions : list<string>
+ \li This property holds the list of extensions of the selected filter.
+ In the example below, the list of extensions of the first filter is
+ \c {["txt"]} and the second is \c {["html", "htm"]}.
+ \endtable
+
+ \code
+ FileDialog {
+ id: fileDialog
+ selectedNameFilter.index: 1
+ nameFilters: ["Text files (*.txt)", "HTML files (*.html *.htm)"]
+ }
+
+ MyDocument {
+ id: document
+ fileType: fileDialog.selectedNameFilter.extensions[0]
+ }
+ \endcode
+
+ \sa nameFilters
+*/
+QQuickPlatformFileNameFilter *QQuickPlatformFileDialog::selectedNameFilter() const
+{
+ if (!m_selectedNameFilter) {
+ QQuickPlatformFileDialog *that = const_cast<QQuickPlatformFileDialog *>(this);
+ m_selectedNameFilter = new QQuickPlatformFileNameFilter(that);
+ m_selectedNameFilter->setOptions(m_options);
+ }
+ return m_selectedNameFilter;
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::FileDialog::defaultSuffix
+
+ This property holds a suffix that is added to selected files that have
+ no suffix specified. The suffix is typically used to indicate the file
+ type (e.g. "txt" indicates a text file).
+
+ If the first character is a dot ('.'), it is removed.
+*/
+QString QQuickPlatformFileDialog::defaultSuffix() const
+{
+ return m_options->defaultSuffix();
+}
+
+void QQuickPlatformFileDialog::setDefaultSuffix(const QString &suffix)
+{
+ if (suffix == m_options->defaultSuffix())
+ return;
+
+ m_options->setDefaultSuffix(suffix);
+ emit defaultSuffixChanged();
+}
+
+void QQuickPlatformFileDialog::resetDefaultSuffix()
+{
+ setDefaultSuffix(QString());
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::FileDialog::acceptLabel
+
+ This property holds the label text shown on the button that accepts the dialog.
+
+ When set to an empty string, the default label of the underlying platform is used.
+ The default label is typically \uicontrol Open or \uicontrol Save depending on which
+ \l fileMode the dialog is used in.
+
+ The default value is an empty string.
+
+ \sa rejectLabel
+*/
+QString QQuickPlatformFileDialog::acceptLabel() const
+{
+ return m_options->labelText(QFileDialogOptions::Accept);
+}
+
+void QQuickPlatformFileDialog::setAcceptLabel(const QString &label)
+{
+ if (label == m_options->labelText(QFileDialogOptions::Accept))
+ return;
+
+ m_options->setLabelText(QFileDialogOptions::Accept, label);
+ emit acceptLabelChanged();
+}
+
+void QQuickPlatformFileDialog::resetAcceptLabel()
+{
+ setAcceptLabel(QString());
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::FileDialog::rejectLabel
+
+ This property holds the label text shown on the button that rejects the dialog.
+
+ When set to an empty string, the default label of the underlying platform is used.
+ The default label is typically \uicontrol Cancel.
+
+ The default value is an empty string.
+
+ \sa acceptLabel
+*/
+QString QQuickPlatformFileDialog::rejectLabel() const
+{
+ return m_options->labelText(QFileDialogOptions::Reject);
+}
+
+void QQuickPlatformFileDialog::setRejectLabel(const QString &label)
+{
+ if (label == m_options->labelText(QFileDialogOptions::Reject))
+ return;
+
+ m_options->setLabelText(QFileDialogOptions::Reject, label);
+ emit rejectLabelChanged();
+}
+
+void QQuickPlatformFileDialog::resetRejectLabel()
+{
+ setRejectLabel(QString());
+}
+
+bool QQuickPlatformFileDialog::useNativeDialog() const
+{
+ return QQuickPlatformDialog::useNativeDialog()
+ && !m_options->testOption(QFileDialogOptions::DontUseNativeDialog);
+}
+
+void QQuickPlatformFileDialog::onCreate(QPlatformDialogHelper *dialog)
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(dialog)) {
+ // TODO: emit currentFileChanged only when the first entry in currentFiles changes
+ connect(fileDialog, &QPlatformFileDialogHelper::currentChanged, this, &QQuickPlatformFileDialog::currentFileChanged);
+ connect(fileDialog, &QPlatformFileDialogHelper::currentChanged, this, &QQuickPlatformFileDialog::currentFilesChanged);
+ connect(fileDialog, &QPlatformFileDialogHelper::directoryEntered, this, &QQuickPlatformFileDialog::folderChanged);
+ fileDialog->setOptions(m_options);
+ }
+}
+
+void QQuickPlatformFileDialog::onShow(QPlatformDialogHelper *dialog)
+{
+ m_options->setWindowTitle(title());
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(dialog)) {
+ fileDialog->setOptions(m_options);
+ if (m_selectedNameFilter) {
+ const int index = m_selectedNameFilter->index();
+ const QString filter = m_options->nameFilters().value(index);
+ m_options->setInitiallySelectedNameFilter(filter);
+ fileDialog->selectNameFilter(filter);
+ connect(fileDialog, &QPlatformFileDialogHelper::filterSelected, m_selectedNameFilter, &QQuickPlatformFileNameFilter::update);
+ }
+ }
+}
+
+void QQuickPlatformFileDialog::onHide(QPlatformDialogHelper *dialog)
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(dialog)) {
+ if (m_selectedNameFilter)
+ disconnect(fileDialog, &QPlatformFileDialogHelper::filterSelected, m_selectedNameFilter, &QQuickPlatformFileNameFilter::update);
+ }
+}
+
+void QQuickPlatformFileDialog::accept()
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle()))
+ setFiles(fileDialog->selectedFiles());
+ QQuickPlatformDialog::accept();
+}
+
+QUrl QQuickPlatformFileDialog::addDefaultSuffix(const QUrl &file) const
+{
+ QUrl url = file;
+ const QString path = url.path();
+ const QString suffix = m_options->defaultSuffix();
+ if (!suffix.isEmpty() && !path.endsWith(QLatin1Char('/')) && path.lastIndexOf(QLatin1Char('.')) == -1)
+ url.setPath(path + QLatin1Char('.') + suffix);
+ return url;
+}
+
+QList<QUrl> QQuickPlatformFileDialog::addDefaultSuffixes(const QList<QUrl> &files) const
+{
+ QList<QUrl> urls;
+ urls.reserve(files.size());
+ for (const QUrl &file : files)
+ urls += addDefaultSuffix(file);
+ return urls;
+}
+
+QQuickPlatformFileNameFilter::QQuickPlatformFileNameFilter(QObject *parent)
+ : QObject(parent), m_index(-1)
+{
+}
+
+int QQuickPlatformFileNameFilter::index() const
+{
+ return m_index;
+}
+
+void QQuickPlatformFileNameFilter::setIndex(int index)
+{
+ if (m_index == index)
+ return;
+
+ m_index = index;
+ emit indexChanged(index);
+}
+
+QString QQuickPlatformFileNameFilter::name() const
+{
+ return m_name;
+}
+
+QStringList QQuickPlatformFileNameFilter::extensions() const
+{
+ return m_extensions;
+}
+
+QSharedPointer<QFileDialogOptions> QQuickPlatformFileNameFilter::options() const
+{
+ return m_options;
+}
+
+void QQuickPlatformFileNameFilter::setOptions(const QSharedPointer<QFileDialogOptions> &options)
+{
+ m_options = options;
+}
+
+static QString extractName(const QString &filter)
+{
+ return filter.left(filter.indexOf(QLatin1Char('(')) - 1);
+}
+
+static QString extractExtension(const QString &filter)
+{
+ return filter.mid(filter.indexOf(QLatin1Char('.')) + 1);
+}
+
+static QStringList extractExtensions(const QString &filter)
+{
+ QStringList extensions;
+ const int from = filter.indexOf(QLatin1Char('('));
+ const int to = filter.lastIndexOf(QLatin1Char(')')) - 1;
+ if (from >= 0 && from < to) {
+ const QStringRef ref = filter.midRef(from + 1, to - from);
+ const QVector<QStringRef> exts = ref.split(QLatin1Char(' '), QString::SkipEmptyParts);
+ for (const QStringRef &ref : exts)
+ extensions += extractExtension(ref.toString());
+ }
+
+ return extensions;
+}
+
+void QQuickPlatformFileNameFilter::update(const QString &filter)
+{
+ const QStringList filters = nameFilters();
+
+ const int oldIndex = m_index;
+ const QString oldName = m_name;
+ const QStringList oldExtensions = m_extensions;
+
+ m_index = filters.indexOf(filter);
+ m_name = extractName(filter);
+ m_extensions = extractExtensions(filter);
+
+ if (oldIndex != m_index)
+ emit indexChanged(m_index);
+ if (oldName != m_name)
+ emit nameChanged(m_name);
+ if (oldExtensions != m_extensions)
+ emit extensionsChanged(m_extensions);
+}
+
+QStringList QQuickPlatformFileNameFilter::nameFilters() const
+{
+ return m_options ? m_options->nameFilters() : QStringList();
+}
+
+QString QQuickPlatformFileNameFilter::nameFilter(int index) const
+{
+ return m_options ? m_options->nameFilters().value(index) : QString();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformfiledialog_p.h b/src/imports/platform/qquickplatformfiledialog_p.h
new file mode 100644
index 00000000..51f88d46
--- /dev/null
+++ b/src/imports/platform/qquickplatformfiledialog_p.h
@@ -0,0 +1,196 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMFILEDIALOG_P_H
+#define QQUICKPLATFORMFILEDIALOG_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 "qquickplatformdialog_p.h"
+#include <QtCore/qurl.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformFileNameFilter;
+
+class QQuickPlatformFileDialog : public QQuickPlatformDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode NOTIFY fileModeChanged FINAL)
+ Q_PROPERTY(QUrl file READ file WRITE setFile NOTIFY fileChanged FINAL)
+ Q_PROPERTY(QList<QUrl> files READ files WRITE setFiles NOTIFY filesChanged FINAL)
+ Q_PROPERTY(QUrl currentFile READ currentFile WRITE setCurrentFile NOTIFY currentFileChanged FINAL)
+ Q_PROPERTY(QList<QUrl> currentFiles READ currentFiles WRITE setCurrentFiles NOTIFY currentFilesChanged FINAL)
+ Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged FINAL)
+ Q_PROPERTY(QFileDialogOptions::FileDialogOptions options READ options WRITE setOptions RESET resetOptions NOTIFY optionsChanged FINAL)
+ Q_PROPERTY(QStringList nameFilters READ nameFilters WRITE setNameFilters RESET resetNameFilters NOTIFY nameFiltersChanged FINAL)
+ Q_PROPERTY(QQuickPlatformFileNameFilter *selectedNameFilter READ selectedNameFilter CONSTANT)
+ Q_PROPERTY(QString defaultSuffix READ defaultSuffix WRITE setDefaultSuffix RESET resetDefaultSuffix NOTIFY defaultSuffixChanged FINAL)
+ Q_PROPERTY(QString acceptLabel READ acceptLabel WRITE setAcceptLabel RESET resetAcceptLabel NOTIFY acceptLabelChanged FINAL)
+ Q_PROPERTY(QString rejectLabel READ rejectLabel WRITE setRejectLabel RESET resetRejectLabel NOTIFY rejectLabelChanged FINAL)
+ Q_FLAGS(QFileDialogOptions::FileDialogOptions)
+
+public:
+ explicit QQuickPlatformFileDialog(QObject *parent = nullptr);
+
+ enum FileMode {
+ OpenFile,
+ OpenFiles,
+ SaveFile
+ };
+ Q_ENUM(FileMode)
+
+ FileMode fileMode() const;
+ void setFileMode(FileMode fileMode);
+
+ QUrl file() const;
+ void setFile(const QUrl &file);
+
+ QList<QUrl> files() const;
+ void setFiles(const QList<QUrl> &files);
+
+ QUrl currentFile() const;
+ void setCurrentFile(const QUrl &file);
+
+ QList<QUrl> currentFiles() const;
+ void setCurrentFiles(const QList<QUrl> &files);
+
+ QUrl folder() const;
+ void setFolder(const QUrl &folder);
+
+ QFileDialogOptions::FileDialogOptions options() const;
+ void setOptions(QFileDialogOptions::FileDialogOptions options);
+ void resetOptions();
+
+ QStringList nameFilters() const;
+ void setNameFilters(const QStringList &filters);
+ void resetNameFilters();
+
+ QQuickPlatformFileNameFilter *selectedNameFilter() const;
+
+ QString defaultSuffix() const;
+ void setDefaultSuffix(const QString &suffix);
+ void resetDefaultSuffix();
+
+ QString acceptLabel() const;
+ void setAcceptLabel(const QString &label);
+ void resetAcceptLabel();
+
+ QString rejectLabel() const;
+ void setRejectLabel(const QString &label);
+ void resetRejectLabel();
+
+Q_SIGNALS:
+ void fileModeChanged();
+ void fileChanged();
+ void filesChanged();
+ void currentFileChanged();
+ void currentFilesChanged();
+ void folderChanged();
+ void optionsChanged();
+ void nameFiltersChanged();
+ void defaultSuffixChanged();
+ void acceptLabelChanged();
+ void rejectLabelChanged();
+
+protected:
+ bool useNativeDialog() const override;
+ void onCreate(QPlatformDialogHelper *dialog) override;
+ void onShow(QPlatformDialogHelper *dialog) override;
+ void onHide(QPlatformDialogHelper *dialog) override;
+ void accept() override;
+
+private:
+ QUrl addDefaultSuffix(const QUrl &file) const;
+ QList<QUrl> addDefaultSuffixes(const QList<QUrl> &files) const;
+
+ FileMode m_fileMode;
+ QList<QUrl> m_files;
+ QSharedPointer<QFileDialogOptions> m_options;
+ mutable QQuickPlatformFileNameFilter *m_selectedNameFilter;
+};
+
+class QQuickPlatformFileNameFilter : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int index READ index WRITE setIndex NOTIFY indexChanged FINAL)
+ Q_PROPERTY(QString name READ name NOTIFY nameChanged FINAL)
+ Q_PROPERTY(QStringList extensions READ extensions NOTIFY extensionsChanged FINAL)
+
+public:
+ explicit QQuickPlatformFileNameFilter(QObject *parent = nullptr);
+
+ int index() const;
+ void setIndex(int index);
+
+ QString name() const;
+ QStringList extensions() const;
+
+ QSharedPointer<QFileDialogOptions> options() const;
+ void setOptions(const QSharedPointer<QFileDialogOptions> &options);
+
+ void update(const QString &filter);
+
+Q_SIGNALS:
+ void indexChanged(int index);
+ void nameChanged(const QString &name);
+ void extensionsChanged(const QStringList &extensions);
+
+private:
+ QStringList nameFilters() const;
+ QString nameFilter(int index) const;
+
+ int m_index;
+ QString m_name;
+ QStringList m_extensions;
+ QSharedPointer<QFileDialogOptions> m_options;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformFileDialog)
+
+#endif // QQUICKPLATFORMFILEDIALOG_P_H
diff --git a/src/imports/platform/qquickplatformfolderdialog.cpp b/src/imports/platform/qquickplatformfolderdialog.cpp
new file mode 100644
index 00000000..c56658c4
--- /dev/null
+++ b/src/imports/platform/qquickplatformfolderdialog.cpp
@@ -0,0 +1,281 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformfolderdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype FolderDialog
+ \inherits Dialog
+ \instantiates QQuickPlatformFolderDialog
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native folder dialog.
+
+ The FolderDialog type provides a QML API for native platform folder dialogs.
+
+ \image qtlabsplatform-folderdialog-gtk.png
+
+ To show a folder dialog, construct an instance of FolderDialog, set the
+ desired properties, and call \l {Dialog::}{open()}. The \l currentFolder
+ property can be used to determine the currently selected folder in the
+ dialog. The \l folder property is updated only after the final selection
+ has been made by accepting the dialog.
+
+ \code
+ MenuItem {
+ text: "Open..."
+ onTriggered: folderDialog.open()
+ }
+
+ FolderDialog {
+ id: folderDialog
+ currentFolder: viewer.folder
+ folder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
+ }
+
+ MyViewer {
+ id: viewer
+ folder: folderDialog.folder
+ }
+ \endcode
+
+ \section2 Availability
+
+ A native platform folder dialog is currently available on the following platforms:
+
+ \list
+ \li iOS
+ \li Linux (when running with the GTK+ platform theme)
+ \li macOS
+ \li Windows
+ \li WinRT
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+
+ \sa FileDialog, StandardPaths
+*/
+
+QQuickPlatformFolderDialog::QQuickPlatformFolderDialog(QObject *parent)
+ : QQuickPlatformDialog(QPlatformTheme::FileDialog, parent),
+ m_options(QFileDialogOptions::create())
+{
+ m_options->setFileMode(QFileDialogOptions::Directory);
+ m_options->setAcceptMode(QFileDialogOptions::AcceptOpen);
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::FolderDialog::folder
+
+ This property holds the final accepted folder.
+
+ Unlike the \l currentFolder property, the \c folder property is not updated
+ while the user is selecting folders in the dialog, but only after the final
+ selection has been made. That is, when the user has clicked \uicontrol OK
+ to accept a folder. Alternatively, the \l {Dialog::}{accepted()} signal
+ can be handled to get the final selection.
+
+ \sa currentFolder, {Dialog::}{accepted()}
+*/
+QUrl QQuickPlatformFolderDialog::folder() const
+{
+ return m_folder;
+}
+
+void QQuickPlatformFolderDialog::setFolder(const QUrl &folder)
+{
+ if (m_folder == folder)
+ return;
+
+ m_folder = folder;
+ setCurrentFolder(folder);
+ emit folderChanged();
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::FolderDialog::currentFolder
+
+ This property holds the currently selected folder in the dialog.
+
+ Unlike the \l folder property, the \c currentFolder property is updated
+ while the user is selecting folders in the dialog, even before the final
+ selection has been made.
+
+ \sa folder
+*/
+QUrl QQuickPlatformFolderDialog::currentFolder() const
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle()))
+ return fileDialog->directory();
+ return m_options->initialDirectory();
+}
+
+void QQuickPlatformFolderDialog::setCurrentFolder(const QUrl &folder)
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(handle()))
+ fileDialog->setDirectory(folder);
+ m_options->setInitialDirectory(folder);
+}
+
+/*!
+ \qmlproperty flags Qt.labs.platform::FolderDialog::options
+
+ This property holds the various options that affect the look and feel of the dialog.
+
+ By default, all options are disabled.
+
+ Options should be set before showing the dialog. Setting them while the dialog is
+ visible is not guaranteed to have an immediate effect on the dialog (depending on
+ the option and on the platform).
+
+ Available options:
+ \value FolderDialog.ShowDirsOnly Only show directories in the folder dialog. By default both folders and directories are shown.
+ \value FolderDialog.DontResolveSymlinks Don't resolve symlinks in the folder dialog. By default symlinks are resolved.
+ \value FolderDialog.ReadOnly Indicates that the dialog doesn't allow creating directories.
+*/
+QFileDialogOptions::FileDialogOptions QQuickPlatformFolderDialog::options() const
+{
+ return m_options->options();
+}
+
+void QQuickPlatformFolderDialog::setOptions(QFileDialogOptions::FileDialogOptions options)
+{
+ if (options == m_options->options())
+ return;
+
+ m_options->setOptions(options);
+ emit optionsChanged();
+}
+
+void QQuickPlatformFolderDialog::resetOptions()
+{
+ setOptions(0);
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::FolderDialog::acceptLabel
+
+ This property holds the label text shown on the button that accepts the dialog.
+
+ When set to an empty string, the default label of the underlying platform is used.
+ The default label is typically \uicontrol Open.
+
+ The default value is an empty string.
+
+ \sa rejectLabel
+*/
+QString QQuickPlatformFolderDialog::acceptLabel() const
+{
+ return m_options->labelText(QFileDialogOptions::Accept);
+}
+
+void QQuickPlatformFolderDialog::setAcceptLabel(const QString &label)
+{
+ if (label == m_options->labelText(QFileDialogOptions::Accept))
+ return;
+
+ m_options->setLabelText(QFileDialogOptions::Accept, label);
+ emit acceptLabelChanged();
+}
+
+void QQuickPlatformFolderDialog::resetAcceptLabel()
+{
+ setAcceptLabel(QString());
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::FolderDialog::rejectLabel
+
+ This property holds the label text shown on the button that rejects the dialog.
+
+ When set to an empty string, the default label of the underlying platform is used.
+ The default label is typically \uicontrol Cancel.
+
+ The default value is an empty string.
+
+ \sa acceptLabel
+*/
+QString QQuickPlatformFolderDialog::rejectLabel() const
+{
+ return m_options->labelText(QFileDialogOptions::Reject);
+}
+
+void QQuickPlatformFolderDialog::setRejectLabel(const QString &label)
+{
+ if (label == m_options->labelText(QFileDialogOptions::Reject))
+ return;
+
+ m_options->setLabelText(QFileDialogOptions::Reject, label);
+ emit rejectLabelChanged();
+}
+
+void QQuickPlatformFolderDialog::resetRejectLabel()
+{
+ setRejectLabel(QString());
+}
+
+bool QQuickPlatformFolderDialog::useNativeDialog() const
+{
+ return QQuickPlatformDialog::useNativeDialog()
+ && !m_options->testOption(QFileDialogOptions::DontUseNativeDialog);
+}
+
+void QQuickPlatformFolderDialog::onCreate(QPlatformDialogHelper *dialog)
+{
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(dialog)) {
+ connect(fileDialog, &QPlatformFileDialogHelper::directoryEntered, this, &QQuickPlatformFolderDialog::currentFolderChanged);
+ fileDialog->setOptions(m_options);
+ }
+}
+
+void QQuickPlatformFolderDialog::onShow(QPlatformDialogHelper *dialog)
+{
+ m_options->setWindowTitle(title());
+ if (QPlatformFileDialogHelper *fileDialog = qobject_cast<QPlatformFileDialogHelper *>(dialog))
+ fileDialog->setOptions(m_options);
+}
+
+void QQuickPlatformFolderDialog::accept()
+{
+ setFolder(currentFolder());
+ QQuickPlatformDialog::accept();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformfolderdialog_p.h b/src/imports/platform/qquickplatformfolderdialog_p.h
new file mode 100644
index 00000000..d9ecd1fb
--- /dev/null
+++ b/src/imports/platform/qquickplatformfolderdialog_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMFOLDERDIALOG_P_H
+#define QQUICKPLATFORMFOLDERDIALOG_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This folder is not part of the Qt API. It exists purely as an
+// implementation detail. This header folder may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qquickplatformdialog_p.h"
+#include <QtCore/qurl.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformFolderDialog : public QQuickPlatformDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QUrl folder READ folder WRITE setFolder NOTIFY folderChanged FINAL)
+ Q_PROPERTY(QUrl currentFolder READ currentFolder WRITE setCurrentFolder NOTIFY currentFolderChanged FINAL)
+ Q_PROPERTY(QFileDialogOptions::FileDialogOptions options READ options WRITE setOptions RESET resetOptions NOTIFY optionsChanged FINAL)
+ Q_PROPERTY(QString acceptLabel READ acceptLabel WRITE setAcceptLabel RESET resetAcceptLabel NOTIFY acceptLabelChanged FINAL)
+ Q_PROPERTY(QString rejectLabel READ rejectLabel WRITE setRejectLabel RESET resetRejectLabel NOTIFY rejectLabelChanged FINAL)
+ Q_FLAGS(QFileDialogOptions::FileDialogOptions)
+
+public:
+ explicit QQuickPlatformFolderDialog(QObject *parent = nullptr);
+
+ QUrl folder() const;
+ void setFolder(const QUrl &folder);
+
+ QUrl currentFolder() const;
+ void setCurrentFolder(const QUrl &folder);
+
+ QFileDialogOptions::FileDialogOptions options() const;
+ void setOptions(QFileDialogOptions::FileDialogOptions options);
+ void resetOptions();
+
+ QString acceptLabel() const;
+ void setAcceptLabel(const QString &label);
+ void resetAcceptLabel();
+
+ QString rejectLabel() const;
+ void setRejectLabel(const QString &label);
+ void resetRejectLabel();
+
+Q_SIGNALS:
+ void folderChanged();
+ void currentFolderChanged();
+ void optionsChanged();
+ void acceptLabelChanged();
+ void rejectLabelChanged();
+
+protected:
+ bool useNativeDialog() const override;
+ void onCreate(QPlatformDialogHelper *dialog) override;
+ void onShow(QPlatformDialogHelper *dialog) override;
+ void accept() override;
+
+private:
+ QUrl m_folder;
+ QSharedPointer<QFileDialogOptions> m_options;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformFolderDialog)
+
+#endif // QQUICKPLATFORMFOLDERDIALOG_P_H
diff --git a/src/imports/platform/qquickplatformfontdialog.cpp b/src/imports/platform/qquickplatformfontdialog.cpp
new file mode 100644
index 00000000..edefe645
--- /dev/null
+++ b/src/imports/platform/qquickplatformfontdialog.cpp
@@ -0,0 +1,208 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformfontdialog_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype FontDialog
+ \inherits Dialog
+ \instantiates QQuickPlatformFontDialog
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native font dialog.
+
+ The FontDialog type provides a QML API for native platform font dialogs.
+
+ \image qtlabsplatform-fontdialog-gtk.png
+
+ To show a font dialog, construct an instance of FontDialog, set the
+ desired properties, and call \l {Dialog::}{open()}. The \l currentFont
+ property can be used to determine the currently selected font in the
+ dialog. The \l font property is updated only after the final selection
+ has been made by accepting the dialog.
+
+ \code
+ MenuItem {
+ text: "Font"
+ onTriggered: fontDialog.open()
+ }
+
+ FontDialog {
+ id: fontDialog
+ currentFont.family: document.font
+ }
+
+ MyDocument {
+ id: document
+ font: fontDialog.font
+ }
+ \endcode
+
+ \section2 Availability
+
+ A native platform font dialog is currently available on the following platforms:
+
+ \list
+ \li macOS
+ \li Linux (when running with the GTK+ platform theme)
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+*/
+
+QQuickPlatformFontDialog::QQuickPlatformFontDialog(QObject *parent)
+ : QQuickPlatformDialog(QPlatformTheme::FontDialog, parent),
+ m_options(QFontDialogOptions::create())
+{
+}
+
+/*!
+ \qmlproperty font Qt.labs.platform::FontDialog::font
+
+ This property holds the final accepted font.
+
+ Unlike the \l currentFont property, the \c font property is not updated
+ while the user is selecting fonts in the dialog, but only after the final
+ selection has been made. That is, when the user has clicked \uicontrol OK
+ to accept a font. Alternatively, the \l {Dialog::}{accepted()} signal
+ can be handled to get the final selection.
+
+ \sa currentFont, {Dialog::}{accepted()}
+*/
+QFont QQuickPlatformFontDialog::font() const
+{
+ return m_font;
+}
+
+void QQuickPlatformFontDialog::setFont(const QFont &font)
+{
+ if (m_font == font)
+ return;
+
+ m_font = font;
+ setCurrentFont(font);
+ emit fontChanged();
+}
+
+/*!
+ \qmlproperty font Qt.labs.platform::FontDialog::currentFont
+
+ This property holds the currently selected font in the dialog.
+
+ Unlike the \l font property, the \c currentFont property is updated
+ while the user is selecting fonts in the dialog, even before the final
+ selection has been made.
+
+ \sa font
+*/
+QFont QQuickPlatformFontDialog::currentFont() const
+{
+ if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(handle()))
+ return fontDialog->currentFont();
+ return m_currentFont;
+}
+
+void QQuickPlatformFontDialog::setCurrentFont(const QFont &font)
+{
+ if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(handle()))
+ fontDialog->setCurrentFont(font);
+ m_currentFont = font;
+}
+
+/*!
+ \qmlproperty flags Qt.labs.platform::FontDialog::options
+
+ This property holds the various options that affect the look and feel of the dialog.
+
+ By default, all options are disabled.
+
+ Options should be set before showing the dialog. Setting them while the dialog is
+ visible is not guaranteed to have an immediate effect on the dialog (depending on
+ the option and on the platform).
+
+ Available options:
+ \value FontDialog.ScalableFonts Show scalable fonts.
+ \value FontDialog.NonScalableFonts Show non-scalable fonts.
+ \value FontDialog.MonospacedFonts Show monospaced fonts.
+ \value FontDialog.ProportionalFonts Show proportional fonts.
+ \value FontDialog.NoButtons Don't display \uicontrol OK and \uicontrol Cancel buttons (useful for "live dialogs").
+*/
+QFontDialogOptions::FontDialogOptions QQuickPlatformFontDialog::options() const
+{
+ return m_options->options();
+}
+
+void QQuickPlatformFontDialog::setOptions(QFontDialogOptions::FontDialogOptions options)
+{
+ if (options == m_options->options())
+ return;
+
+ m_options->setOptions(options);
+ emit optionsChanged();
+}
+
+bool QQuickPlatformFontDialog::useNativeDialog() const
+{
+ return QQuickPlatformDialog::useNativeDialog()
+ && !m_options->testOption(QFontDialogOptions::DontUseNativeDialog);
+}
+
+void QQuickPlatformFontDialog::onCreate(QPlatformDialogHelper *dialog)
+{
+ if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(dialog)) {
+ connect(fontDialog, &QPlatformFontDialogHelper::currentFontChanged, this, &QQuickPlatformFontDialog::currentFontChanged);
+ fontDialog->setOptions(m_options);
+ }
+}
+
+void QQuickPlatformFontDialog::onShow(QPlatformDialogHelper *dialog)
+{
+ m_options->setWindowTitle(title());
+ if (QPlatformFontDialogHelper *fontDialog = qobject_cast<QPlatformFontDialogHelper *>(dialog))
+ fontDialog->setOptions(m_options);
+}
+
+void QQuickPlatformFontDialog::accept()
+{
+ setFont(currentFont());
+ QQuickPlatformDialog::accept();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformfontdialog_p.h b/src/imports/platform/qquickplatformfontdialog_p.h
new file mode 100644
index 00000000..c0704610
--- /dev/null
+++ b/src/imports/platform/qquickplatformfontdialog_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMFONTDIALOG_P_H
+#define QQUICKPLATFORMFONTDIALOG_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 "qquickplatformdialog_p.h"
+#include <QtGui/qfont.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformFontDialog : public QQuickPlatformDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
+ Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged FINAL)
+ Q_PROPERTY(QFontDialogOptions::FontDialogOptions options READ options WRITE setOptions NOTIFY optionsChanged FINAL)
+ Q_FLAGS(QFontDialogOptions::FontDialogOptions)
+
+public:
+ explicit QQuickPlatformFontDialog(QObject *parent = nullptr);
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+ QFont currentFont() const;
+ void setCurrentFont(const QFont &font);
+
+ QFontDialogOptions::FontDialogOptions options() const;
+ void setOptions(QFontDialogOptions::FontDialogOptions options);
+
+Q_SIGNALS:
+ void fontChanged();
+ void currentFontChanged();
+ void optionsChanged();
+
+protected:
+ bool useNativeDialog() const override;
+ void onCreate(QPlatformDialogHelper *dialog) override;
+ void onShow(QPlatformDialogHelper *dialog) override;
+ void accept() override;
+
+private:
+ QFont m_font;
+ QFont m_currentFont; // TODO: QFontDialogOptions::initialFont
+ QSharedPointer<QFontDialogOptions> m_options;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformFontDialog)
+
+#endif // QQUICKPLATFORMFONTDIALOG_P_H
diff --git a/src/imports/platform/qquickplatformiconloader.cpp b/src/imports/platform/qquickplatformiconloader.cpp
new file mode 100644
index 00000000..08df44d9
--- /dev/null
+++ b/src/imports/platform/qquickplatformiconloader.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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformiconloader_p.h"
+
+#include <QtCore/qobject.h>
+#include <QtCore/qmetaobject.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickPlatformIconLoader::QQuickPlatformIconLoader(int slot, QObject *parent)
+ : m_parent(parent),
+ m_slot(slot),
+ m_enabled(false)
+{
+ Q_ASSERT(slot != -1 && parent);
+}
+
+bool QQuickPlatformIconLoader::isEnabled() const
+{
+ return m_enabled;
+}
+
+void QQuickPlatformIconLoader::setEnabled(bool enabled)
+{
+ m_enabled = enabled;
+ if (m_enabled)
+ loadIcon();
+}
+
+QIcon QQuickPlatformIconLoader::icon() const
+{
+ QIcon fallback = QPixmap::fromImage(image());
+ return QIcon::fromTheme(m_iconName, fallback);
+}
+
+QUrl QQuickPlatformIconLoader::iconSource() const
+{
+ return m_iconSource;
+}
+
+void QQuickPlatformIconLoader::setIconSource(const QUrl& source)
+{
+ m_iconSource = source;
+ if (m_enabled)
+ loadIcon();
+}
+
+QString QQuickPlatformIconLoader::iconName() const
+{
+ return m_iconName;
+}
+
+void QQuickPlatformIconLoader::setIconName(const QString& name)
+{
+ m_iconName = name;
+ if (m_enabled)
+ loadIcon();
+}
+
+void QQuickPlatformIconLoader::loadIcon()
+{
+ if (m_iconSource.isEmpty()) {
+ clear(m_parent);
+ } else {
+ load(qmlEngine(m_parent), m_iconSource);
+ if (m_slot != -1 && isLoading()) {
+ connectFinished(m_parent, m_slot);
+ m_slot = -1;
+ }
+ }
+
+ if (!isLoading())
+ m_parent->metaObject()->method(m_slot).invoke(m_parent);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformiconloader_p.h b/src/imports/platform/qquickplatformiconloader_p.h
new file mode 100644
index 00000000..5ddb625f
--- /dev/null
+++ b/src/imports/platform/qquickplatformiconloader_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMICONLOADER_P_H
+#define QQUICKPLATFORMICONLOADER_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 <QtGui/qicon.h>
+#include <QtQuick/private/qquickpixmapcache_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QObject;
+
+class QQuickPlatformIconLoader : public QQuickPixmap
+{
+public:
+ QQuickPlatformIconLoader(int slot, QObject *parent);
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ QIcon icon() const;
+
+ QUrl iconSource() const;
+ void setIconSource(const QUrl &source);
+
+ QString iconName() const;
+ void setIconName(const QString &name);
+
+private:
+ void loadIcon();
+
+ QObject *m_parent;
+ int m_slot;
+ bool m_enabled;
+ QIcon m_icon;
+ QUrl m_iconSource;
+ QString m_iconName;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPLATFORMICONLOADER_P_H
diff --git a/src/imports/platform/qquickplatformmenu.cpp b/src/imports/platform/qquickplatformmenu.cpp
new file mode 100644
index 00000000..17d3b2ce
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenu.cpp
@@ -0,0 +1,835 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformmenu_p.h"
+#include "qquickplatformmenubar_p.h"
+#include "qquickplatformmenuitem_p.h"
+#include "qquickplatformiconloader_p.h"
+#include "qquickplatformsystemtrayicon_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/qicon.h>
+#include <QtGui/qcursor.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQml/private/qqmlengine_p.h>
+#include <QtQml/private/qv4scopedvalue_p.h>
+#include <QtQml/private/qv4qobjectwrapper_p.h>
+#include <QtQuick/qquickrendercontrol.h>
+#include <QtQuick/qquickwindow.h>
+#include <QtQuick/qquickitem.h>
+
+#include "widgets/qwidgetplatform_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Menu
+ \inherits QtObject
+ \instantiates QQuickPlatformMenu
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native menu.
+
+ The Menu type provides a QML API for native platform menu popups.
+
+ \image qtlabsplatform-menu.png
+
+ Menu can be used in a \l MenuBar, or as a stand-alone context menu.
+ The following example shows how to open a context menu on right mouse
+ click:
+
+ \code
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.RightButton
+ onClicked: zoomMenu.open()
+ }
+
+ Menu {
+ id: zoomMenu
+
+ MenuItem {
+ text: qsTr("Zoom In")
+ shortcut: StandardKey.ZoomIn
+ onTriggered: zoomIn()
+ }
+
+ MenuItem {
+ text: qsTr("Zoom Out")
+ shortcut: StandardKey.ZoomOut
+ onTriggered: zoomOut()
+ }
+ }
+ \endcode
+
+ \section2 Availability
+
+ A native platform menu is currently available on the following platforms:
+
+ \list
+ \li macOS
+ \li iOS
+ \li Android
+ \li Linux (only available as a stand-alone context menu when running with the GTK+ platform theme)
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+
+ \sa MenuItem, MenuSeparator, MenuBar
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::Menu::aboutToShow()
+
+ This signal is emitted when the menu is about to be shown to the user.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::Menu::aboutToHide()
+
+ This signal is emitted when the menu is about to be hidden from the user.
+*/
+
+Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformMenus)
+
+QQuickPlatformMenu::QQuickPlatformMenu(QObject *parent)
+ : QObject(parent),
+ m_complete(false),
+ m_enabled(true),
+ m_visible(true),
+ m_minimumWidth(-1),
+ m_type(QPlatformMenu::DefaultMenu),
+ m_menuBar(nullptr),
+ m_parentMenu(nullptr),
+ m_systemTrayIcon(nullptr),
+ m_menuItem(nullptr),
+ m_iconLoader(nullptr),
+ m_handle(nullptr)
+{
+}
+
+QQuickPlatformMenu::~QQuickPlatformMenu()
+{
+ if (m_menuBar)
+ m_menuBar->removeMenu(this);
+ if (m_parentMenu)
+ m_parentMenu->removeMenu(this);
+ for (QQuickPlatformMenuItem *item : m_items) {
+ if (QQuickPlatformMenu *subMenu = item->subMenu())
+ subMenu->setParentMenu(nullptr);
+ item->setMenu(nullptr);
+ }
+ delete m_iconLoader;
+ m_iconLoader = nullptr;
+ delete m_handle;
+ m_handle = nullptr;
+}
+
+QPlatformMenu *QQuickPlatformMenu::handle() const
+{
+ return m_handle;
+}
+
+QPlatformMenu * QQuickPlatformMenu::create()
+{
+ if (!m_handle) {
+ if (m_menuBar && m_menuBar->handle())
+ m_handle = m_menuBar->handle()->createMenu();
+ else if (m_parentMenu && m_parentMenu->handle())
+ m_handle = m_parentMenu->handle()->createSubMenu();
+ else if (m_systemTrayIcon && m_systemTrayIcon->handle())
+ m_handle = m_systemTrayIcon->handle()->createMenu();
+
+ // TODO: implement ^
+ // - QCocoaMenuBar::createMenu()
+ // - QCocoaMenu::createSubMenu()
+ // - QCocoaSystemTrayIcon::createMenu()
+ if (!m_handle)
+ m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformMenu();
+
+ if (!m_handle)
+ m_handle = QWidgetPlatform::createMenu();
+
+ qCDebug(qtLabsPlatformMenus) << "Menu ->" << m_handle;
+
+ if (m_handle) {
+ connect(m_handle, &QPlatformMenu::aboutToShow, this, &QQuickPlatformMenu::aboutToShow);
+ connect(m_handle, &QPlatformMenu::aboutToHide, this, &QQuickPlatformMenu::aboutToHide);
+
+ for (QQuickPlatformMenuItem *item : m_items)
+ m_handle->insertMenuItem(item->create(), nullptr);
+
+ if (m_menuItem) {
+ if (QPlatformMenuItem *handle = m_menuItem->create())
+ handle->setMenu(m_handle);
+ }
+ }
+ }
+ return m_handle;
+}
+
+void QQuickPlatformMenu::destroy()
+{
+ if (!m_handle)
+ return;
+
+ delete m_handle;
+ m_handle = nullptr;
+}
+
+void QQuickPlatformMenu::sync()
+{
+ if (!m_complete || !create())
+ return;
+
+ m_handle->setText(m_title);
+ m_handle->setEnabled(m_enabled);
+ m_handle->setVisible(m_visible);
+ m_handle->setMinimumWidth(m_minimumWidth);
+ m_handle->setMenuType(m_type);
+ m_handle->setFont(m_font);
+
+ if (m_menuBar && m_menuBar->handle())
+ m_menuBar->handle()->syncMenu(m_handle);
+ else if (m_systemTrayIcon && m_systemTrayIcon->handle())
+ m_systemTrayIcon->handle()->updateMenu(m_handle);
+
+ for (QQuickPlatformMenuItem *item : m_items)
+ item->sync();
+}
+
+/*!
+ \default
+ \qmlproperty list<Object> Qt.labs.platform::Menu::data
+
+ This default property holds the list of all objects declared as children of
+ the menu. The data property includes objects that are not \l MenuItem instances,
+ such as \l Timer and \l QtObject.
+
+ \sa items
+*/
+QQmlListProperty<QObject> QQuickPlatformMenu::data()
+{
+ return QQmlListProperty<QObject>(this, nullptr, data_append, data_count, data_at, data_clear);
+}
+
+/*!
+ \qmlproperty list<MenuItem> Qt.labs.platform::Menu::items
+
+ This property holds the list of items in the menu.
+*/
+QQmlListProperty<QQuickPlatformMenuItem> QQuickPlatformMenu::items()
+{
+ return QQmlListProperty<QQuickPlatformMenuItem>(this, nullptr, items_append, items_count, items_at, items_clear);
+}
+
+/*!
+ \readonly
+ \qmlproperty MenuBar Qt.labs.platform::Menu::menuBar
+
+ This property holds the menubar that the menu belongs to, or \c null if the
+ menu is not in a menubar.
+*/
+QQuickPlatformMenuBar *QQuickPlatformMenu::menuBar() const
+{
+ return m_menuBar;
+}
+
+void QQuickPlatformMenu::setMenuBar(QQuickPlatformMenuBar *menuBar)
+{
+ if (m_menuBar == menuBar)
+ return;
+
+ m_menuBar = menuBar;
+ destroy();
+ emit menuBarChanged();
+}
+
+/*!
+ \readonly
+ \qmlproperty Menu Qt.labs.platform::Menu::parentMenu
+
+ This property holds the parent menu that the menu belongs to, or \c null if the
+ menu is not a sub-menu.
+*/
+QQuickPlatformMenu *QQuickPlatformMenu::parentMenu() const
+{
+ return m_parentMenu;
+}
+
+void QQuickPlatformMenu::setParentMenu(QQuickPlatformMenu *menu)
+{
+ if (m_parentMenu == menu)
+ return;
+
+ m_parentMenu = menu;
+ destroy();
+ emit parentMenuChanged();
+}
+
+/*!
+ \readonly
+ \qmlproperty SystemTrayIcon Qt.labs.platform::Menu::systemTrayIcon
+
+ This property holds the system tray icon that the menu belongs to, or \c null
+ if the menu is not in a system tray icon.
+*/
+QQuickPlatformSystemTrayIcon *QQuickPlatformMenu::systemTrayIcon() const
+{
+ return m_systemTrayIcon;
+}
+
+void QQuickPlatformMenu::setSystemTrayIcon(QQuickPlatformSystemTrayIcon *icon)
+{
+ if (m_systemTrayIcon == icon)
+ return;
+
+ m_systemTrayIcon = icon;
+ destroy();
+ emit systemTrayIconChanged();
+}
+
+/*!
+ \readonly
+ \qmlproperty MenuItem Qt.labs.platform::Menu::menuItem
+
+ This property holds the item that presents the menu (in a parent menu).
+*/
+QQuickPlatformMenuItem *QQuickPlatformMenu::menuItem() const
+{
+ if (!m_menuItem) {
+ QQuickPlatformMenu *that = const_cast<QQuickPlatformMenu *>(this);
+ m_menuItem = new QQuickPlatformMenuItem(that);
+ m_menuItem->setSubMenu(that);
+ m_menuItem->setText(m_title);
+ m_menuItem->setIconName(iconName());
+ m_menuItem->setIconSource(iconSource());
+ m_menuItem->setVisible(m_visible);
+ m_menuItem->setEnabled(m_enabled);
+ m_menuItem->componentComplete();
+ }
+ return m_menuItem;
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::Menu::enabled
+
+ This property holds whether the menu is enabled. The default value is \c true.
+*/
+bool QQuickPlatformMenu::isEnabled() const
+{
+ return m_enabled;
+}
+
+void QQuickPlatformMenu::setEnabled(bool enabled)
+{
+ if (m_enabled == enabled)
+ return;
+
+ if (m_menuItem)
+ m_menuItem->setEnabled(enabled);
+
+ m_enabled = enabled;
+ sync();
+ emit enabledChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::Menu::visible
+
+ This property holds whether the menu is visible. The default value is \c true.
+*/
+bool QQuickPlatformMenu::isVisible() const
+{
+ return m_visible;
+}
+
+void QQuickPlatformMenu::setVisible(bool visible)
+{
+ if (m_visible == visible)
+ return;
+
+ if (m_menuItem)
+ m_menuItem->setVisible(visible);
+
+ m_visible = visible;
+ sync();
+ emit visibleChanged();
+}
+
+/*!
+ \qmlproperty int Qt.labs.platform::Menu::minimumWidth
+
+ This property holds the minimum width of the menu. The default value is \c -1 (no minimum width).
+*/
+int QQuickPlatformMenu::minimumWidth() const
+{
+ return m_minimumWidth;
+}
+
+void QQuickPlatformMenu::setMinimumWidth(int width)
+{
+ if (m_minimumWidth == width)
+ return;
+
+ m_minimumWidth = width;
+ sync();
+ emit minimumWidthChanged();
+}
+
+/*!
+ \qmlproperty enumeration Qt.labs.platform::Menu::type
+
+ This property holds the type of the menu.
+
+ Available values:
+ \value Menu.DefaultMenu A normal menu (default).
+ \value Menu.EditMenu An edit menu with pre-populated cut, copy and paste items.
+*/
+QPlatformMenu::MenuType QQuickPlatformMenu::type() const
+{
+ return m_type;
+}
+
+void QQuickPlatformMenu::setType(QPlatformMenu::MenuType type)
+{
+ if (m_type == type)
+ return;
+
+ m_type = type;
+ sync();
+ emit typeChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::Menu::title
+
+ This property holds the menu's title.
+*/
+QString QQuickPlatformMenu::title() const
+{
+ return m_title;
+}
+
+void QQuickPlatformMenu::setTitle(const QString &title)
+{
+ if (m_title == title)
+ return;
+
+ m_title = title;
+ sync();
+ emit titleChanged();
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::Menu::iconSource
+
+ This property holds the url of the menu's icon.
+
+ \sa iconName
+*/
+QUrl QQuickPlatformMenu::iconSource() const
+{
+ if (!m_iconLoader)
+ return QUrl();
+
+ return m_iconLoader->iconSource();
+}
+
+void QQuickPlatformMenu::setIconSource(const QUrl& source)
+{
+ if (source == iconSource())
+ return;
+
+ if (m_menuItem)
+ m_menuItem->setIconSource(source);
+
+ iconLoader()->setIconSource(source);
+ emit iconSourceChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::Menu::iconName
+
+ This property holds the theme name of the menu's icon.
+
+ \sa iconSource, QIcon::fromTheme()
+*/
+QString QQuickPlatformMenu::iconName() const
+{
+ if (!m_iconLoader)
+ return QString();
+
+ return m_iconLoader->iconName();
+}
+
+void QQuickPlatformMenu::setIconName(const QString& name)
+{
+ if (name == iconName())
+ return;
+
+ if (m_menuItem)
+ m_menuItem->setIconName(name);
+
+ iconLoader()->setIconName(name);
+ emit iconNameChanged();
+}
+
+/*!
+ \qmlproperty font Qt.labs.platform::Menu::font
+
+ This property holds the menu's font.
+
+ \sa text
+*/
+QFont QQuickPlatformMenu::font() const
+{
+ return m_font;
+}
+
+void QQuickPlatformMenu::setFont(const QFont& font)
+{
+ if (m_font == font)
+ return;
+
+ m_font = font;
+ sync();
+ emit fontChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::addItem(MenuItem item)
+
+ Adds an \a item to the end of the menu.
+*/
+void QQuickPlatformMenu::addItem(QQuickPlatformMenuItem *item)
+{
+ insertItem(m_items.count(), item);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::insertItem(int index, MenuItem item)
+
+ Inserts an \a item at the specified \a index in the menu.
+*/
+void QQuickPlatformMenu::insertItem(int index, QQuickPlatformMenuItem *item)
+{
+ if (!item || m_items.contains(item))
+ return;
+
+ m_items.insert(index, item);
+ m_data.append(item);
+ item->setMenu(this);
+ if (m_handle && item->create()) {
+ QQuickPlatformMenuItem *before = m_items.value(index + 1);
+ m_handle->insertMenuItem(item->handle(), before ? before->create() : nullptr);
+ }
+ sync();
+ emit itemsChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::removeItem(MenuItem item)
+
+ Removes an \a item from the menu.
+*/
+void QQuickPlatformMenu::removeItem(QQuickPlatformMenuItem *item)
+{
+ if (!item || !m_items.removeOne(item))
+ return;
+
+ m_data.removeOne(item);
+ if (m_handle)
+ m_handle->removeMenuItem(item->handle());
+ item->setMenu(nullptr);
+ sync();
+ emit itemsChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::addMenu(Menu submenu)
+
+ Adds a \a submenu to the end of the menu.
+*/
+void QQuickPlatformMenu::addMenu(QQuickPlatformMenu *menu)
+{
+ insertMenu(m_items.count(), menu);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::insertMenu(int index, Menu submenu)
+
+ Inserts a \a submenu at the specified \a index in the menu.
+*/
+void QQuickPlatformMenu::insertMenu(int index, QQuickPlatformMenu *menu)
+{
+ if (!menu)
+ return;
+
+ menu->setParentMenu(this);
+ insertItem(index, menu->menuItem());
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::removeMenu(Menu submenu)
+
+ Removes a \a submenu from the menu.
+*/
+void QQuickPlatformMenu::removeMenu(QQuickPlatformMenu *menu)
+{
+ if (!menu)
+ return;
+
+ menu->setParentMenu(nullptr);
+ removeItem(menu->menuItem());
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::clear()
+
+ Removes all items from the menu.
+*/
+void QQuickPlatformMenu::clear()
+{
+ if (m_items.isEmpty())
+ return;
+
+ for (QQuickPlatformMenuItem *item : m_items) {
+ m_data.removeOne(item);
+ if (m_handle)
+ m_handle->removeMenuItem(item->handle());
+ item->setMenu(nullptr);
+ delete item;
+ }
+
+ m_items.clear();
+ sync();
+ emit itemsChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::open(MenuItem item)
+
+ Opens the menu at the current mouse position, optionally aligned to a menu \a item.
+*/
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::open(Item target, MenuItem item)
+
+ Opens the menu at the specified \a target item, optionally aligned to a menu \a item.
+*/
+void QQuickPlatformMenu::open(QQmlV4Function *args)
+{
+ if (!m_handle)
+ return;
+
+ if (args->length() > 2) {
+ args->v4engine()->throwTypeError();
+ return;
+ }
+
+ QV4::ExecutionEngine *v4 = args->v4engine();
+ QV4::Scope scope(v4);
+
+ QQuickItem *targetItem = nullptr;
+ if (args->length() > 0) {
+ QV4::ScopedValue value(scope, (*args)[0]);
+ QV4::Scoped<QV4::QObjectWrapper> object(scope, value->as<QV4::QObjectWrapper>());
+ if (object)
+ targetItem = qobject_cast<QQuickItem *>(object->object());
+ }
+
+ QQuickPlatformMenuItem *menuItem = nullptr;
+ if (args->length() > 1) {
+ QV4::ScopedValue value(scope, (*args)[1]);
+ QV4::Scoped<QV4::QObjectWrapper> object(scope, value->as<QV4::QObjectWrapper>());
+ if (object)
+ menuItem = qobject_cast<QQuickPlatformMenuItem *>(object->object());
+ }
+
+ QPoint offset;
+ QWindow *window = findWindow(targetItem, &offset);
+
+ QRect targetRect;
+ if (targetItem) {
+ QRectF sceneBounds = targetItem->mapRectToScene(targetItem->boundingRect());
+ targetRect = sceneBounds.toAlignedRect().translated(offset);
+ } else {
+#ifndef QT_NO_CURSOR
+ QPoint pos = QCursor::pos();
+ if (window)
+ pos = window->mapFromGlobal(pos);
+ targetRect.moveTo(pos);
+#endif
+ }
+
+ m_handle->showPopup(window, targetRect, menuItem ? menuItem->handle() : nullptr);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::Menu::close()
+
+ Closes the menu.
+*/
+void QQuickPlatformMenu::close()
+{
+ if (m_handle)
+ m_handle->dismiss();
+}
+
+void QQuickPlatformMenu::classBegin()
+{
+}
+
+void QQuickPlatformMenu::componentComplete()
+{
+ m_complete = true;
+ if (m_handle && m_iconLoader)
+ m_iconLoader->setEnabled(true);
+ sync();
+}
+
+QQuickPlatformIconLoader *QQuickPlatformMenu::iconLoader() const
+{
+ if (!m_iconLoader) {
+ QQuickPlatformMenu *that = const_cast<QQuickPlatformMenu *>(this);
+ static int slot = staticMetaObject.indexOfSlot("updateIcon()");
+ m_iconLoader = new QQuickPlatformIconLoader(slot, that);
+ m_iconLoader->setEnabled(m_complete);
+ }
+ return m_iconLoader;
+}
+
+static QWindow *effectiveWindow(QWindow *window, QPoint *offset)
+{
+ QQuickWindow *quickWindow = qobject_cast<QQuickWindow *>(window);
+ if (quickWindow) {
+ QWindow *renderWindow = QQuickRenderControl::renderWindowFor(quickWindow, offset);
+ if (renderWindow)
+ return renderWindow;
+ }
+ return window;
+}
+
+QWindow *QQuickPlatformMenu::findWindow(QQuickItem *target, QPoint *offset) const
+{
+ if (target)
+ return effectiveWindow(target->window(), offset);
+
+ if (m_menuBar && m_menuBar->window())
+ return effectiveWindow(m_menuBar->window(), offset);
+
+ QObject *obj = parent();
+ while (obj) {
+ QWindow *window = qobject_cast<QWindow *>(obj);
+ if (window)
+ return effectiveWindow(window, offset);
+
+ QQuickItem *item = qobject_cast<QQuickItem *>(obj);
+ if (item && item->window())
+ return effectiveWindow(item->window(), offset);
+
+ obj = obj->parent();
+ }
+ return nullptr;
+}
+
+void QQuickPlatformMenu::data_append(QQmlListProperty<QObject> *property, QObject *object)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ if (QQuickPlatformMenuItem *item = qobject_cast<QQuickPlatformMenuItem *>(object))
+ menu->addItem(item);
+ else if (QQuickPlatformMenu *subMenu = qobject_cast<QQuickPlatformMenu *>(object))
+ menu->addMenu(subMenu);
+ else
+ menu->m_data.append(object);
+}
+
+int QQuickPlatformMenu::data_count(QQmlListProperty<QObject> *property)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ return menu->m_data.count();
+}
+
+QObject *QQuickPlatformMenu::data_at(QQmlListProperty<QObject> *property, int index)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ return menu->m_data.value(index);
+}
+
+void QQuickPlatformMenu::data_clear(QQmlListProperty<QObject> *property)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ menu->m_data.clear();
+}
+
+void QQuickPlatformMenu::items_append(QQmlListProperty<QQuickPlatformMenuItem> *property, QQuickPlatformMenuItem *item)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ menu->addItem(item);
+}
+
+int QQuickPlatformMenu::items_count(QQmlListProperty<QQuickPlatformMenuItem> *property)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ return menu->m_items.count();
+}
+
+QQuickPlatformMenuItem *QQuickPlatformMenu::items_at(QQmlListProperty<QQuickPlatformMenuItem> *property, int index)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ return menu->m_items.value(index);
+}
+
+void QQuickPlatformMenu::items_clear(QQmlListProperty<QQuickPlatformMenuItem> *property)
+{
+ QQuickPlatformMenu *menu = static_cast<QQuickPlatformMenu *>(property->object);
+ menu->clear();
+}
+
+void QQuickPlatformMenu::updateIcon()
+{
+ if (!m_handle || !m_iconLoader)
+ return;
+
+ m_handle->setIcon(m_iconLoader->icon());
+ sync();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmenu_p.h b/src/imports/platform/qquickplatformmenu_p.h
new file mode 100644
index 00000000..587fae99
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenu_p.h
@@ -0,0 +1,213 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMMENU_P_H
+#define QQUICKPLATFORMMENU_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/qurl.h>
+#include <QtGui/qfont.h>
+#include <QtGui/qpa/qplatformmenu.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqmllist.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QIcon;
+class QWindow;
+class QQuickItem;
+class QPlatformMenu;
+class QQmlV4Function;
+class QQuickPlatformMenuBar;
+class QQuickPlatformMenuItem;
+class QQuickPlatformIconLoader;
+class QQuickPlatformSystemTrayIcon;
+
+class QQuickPlatformMenu : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickPlatformMenuItem> items READ items NOTIFY itemsChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenuBar *menuBar READ menuBar NOTIFY menuBarChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenu *parentMenu READ parentMenu NOTIFY parentMenuChanged FINAL)
+ Q_PROPERTY(QQuickPlatformSystemTrayIcon *systemTrayIcon READ systemTrayIcon NOTIFY systemTrayIconChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenuItem *menuItem READ menuItem CONSTANT FINAL)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(int minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged FINAL)
+ Q_PROPERTY(QPlatformMenu::MenuType type READ type WRITE setType NOTIFY typeChanged FINAL)
+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
+ Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged FINAL)
+ Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
+ Q_ENUMS(QPlatformMenu::MenuType)
+ Q_CLASSINFO("DefaultProperty", "data")
+
+public:
+ explicit QQuickPlatformMenu(QObject *parent = nullptr);
+ ~QQuickPlatformMenu();
+
+ QPlatformMenu *handle() const;
+ QPlatformMenu *create();
+ void destroy();
+ void sync();
+
+ QQmlListProperty<QObject> data();
+ QQmlListProperty<QQuickPlatformMenuItem> items();
+
+ QQuickPlatformMenuBar *menuBar() const;
+ void setMenuBar(QQuickPlatformMenuBar *menuBar);
+
+ QQuickPlatformMenu *parentMenu() const;
+ void setParentMenu(QQuickPlatformMenu *menu);
+
+ QQuickPlatformSystemTrayIcon *systemTrayIcon() const;
+ void setSystemTrayIcon(QQuickPlatformSystemTrayIcon *icon);
+
+ QQuickPlatformMenuItem *menuItem() const;
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ int minimumWidth() const;
+ void setMinimumWidth(int width);
+
+ QPlatformMenu::MenuType type() const;
+ void setType(QPlatformMenu::MenuType type);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QUrl iconSource() const;
+ void setIconSource(const QUrl &source);
+
+ QString iconName() const;
+ void setIconName(const QString &name);
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+ Q_INVOKABLE void addItem(QQuickPlatformMenuItem *item);
+ Q_INVOKABLE void insertItem(int index, QQuickPlatformMenuItem *item);
+ Q_INVOKABLE void removeItem(QQuickPlatformMenuItem *item);
+
+ Q_INVOKABLE void addMenu(QQuickPlatformMenu *menu);
+ Q_INVOKABLE void insertMenu(int index, QQuickPlatformMenu *menu);
+ Q_INVOKABLE void removeMenu(QQuickPlatformMenu *menu);
+
+ Q_INVOKABLE void clear();
+
+public Q_SLOTS:
+ void open(QQmlV4Function *args);
+ void close();
+
+Q_SIGNALS:
+ void aboutToShow();
+ void aboutToHide();
+
+ void itemsChanged();
+ void menuBarChanged();
+ void parentMenuChanged();
+ void systemTrayIconChanged();
+ void titleChanged();
+ void iconSourceChanged();
+ void iconNameChanged();
+ void enabledChanged();
+ void visibleChanged();
+ void minimumWidthChanged();
+ void fontChanged();
+ void typeChanged();
+
+protected:
+ void classBegin() override;
+ void componentComplete() override;
+
+ QQuickPlatformIconLoader *iconLoader() const;
+
+ QWindow *findWindow(QQuickItem *target, QPoint *offset) const;
+
+ static void data_append(QQmlListProperty<QObject> *property, QObject *object);
+ static int data_count(QQmlListProperty<QObject> *property);
+ static QObject *data_at(QQmlListProperty<QObject> *property, int index);
+ static void data_clear(QQmlListProperty<QObject> *property);
+
+ static void items_append(QQmlListProperty<QQuickPlatformMenuItem> *property, QQuickPlatformMenuItem *item);
+ static int items_count(QQmlListProperty<QQuickPlatformMenuItem> *property);
+ static QQuickPlatformMenuItem *items_at(QQmlListProperty<QQuickPlatformMenuItem> *property, int index);
+ static void items_clear(QQmlListProperty<QQuickPlatformMenuItem> *property);
+
+private Q_SLOTS:
+ void updateIcon();
+
+private:
+ bool m_complete;
+ bool m_enabled;
+ bool m_visible;
+ int m_minimumWidth;
+ QPlatformMenu::MenuType m_type;
+ QString m_title;
+ QFont m_font;
+ QList<QObject *> m_data;
+ QList<QQuickPlatformMenuItem *> m_items;
+ QQuickPlatformMenuBar *m_menuBar;
+ QQuickPlatformMenu *m_parentMenu;
+ QQuickPlatformSystemTrayIcon *m_systemTrayIcon;
+ mutable QQuickPlatformMenuItem *m_menuItem;
+ mutable QQuickPlatformIconLoader *m_iconLoader;
+ QPlatformMenu *m_handle;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMenu)
+
+#endif // QQUICKPLATFORMMENU_P_H
diff --git a/src/imports/platform/qquickplatformmenubar.cpp b/src/imports/platform/qquickplatformmenubar.cpp
new file mode 100644
index 00000000..00630a84
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenubar.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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformmenubar_p.h"
+#include "qquickplatformmenu_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/qpa/qplatformmenu.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtQuick/qquickwindow.h>
+#include <QtQuick/qquickitem.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuBar
+ \inherits QtObject
+ \instantiates QQuickPlatformMenuBar
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native menubar.
+
+ The MenuBar type provides a QML API for native platform menubars.
+
+ \image qtlabsplatform-menubar.png
+
+ A menubar consists of a list of drop-down menus.
+
+ \code
+ MenuBar {
+ id: menuBar
+
+ Menu {
+ id: fileMenu
+ title: qsTr("File")
+ // ...
+ }
+
+ Menu {
+ id: editMenu
+ title: qsTr("&Edit")
+ // ...
+ }
+
+ Menu {
+ id: viewMenu
+ title: qsTr("&View")
+ // ...
+ }
+
+ Menu {
+ id: helpMenu
+ title: qsTr("&Help")
+ // ...
+ }
+ }
+ \endcode
+
+ MenuBar is currently available on the following platforms:
+
+ \list
+ \li macOS
+ \li Android
+ \li Linux (only available on desktop environments that provide a global D-Bus menu bar)
+ \endlist
+
+ \labs
+
+ \sa Menu
+*/
+
+Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformMenus)
+
+QQuickPlatformMenuBar::QQuickPlatformMenuBar(QObject *parent)
+ : QObject(parent),
+ m_complete(false),
+ m_window(nullptr),
+ m_handle(nullptr)
+{
+ m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformMenuBar();
+ qCDebug(qtLabsPlatformMenus) << "MenuBar ->" << m_handle;
+}
+
+QQuickPlatformMenuBar::~QQuickPlatformMenuBar()
+{
+ for (QQuickPlatformMenu *menu : m_menus)
+ menu->setMenuBar(nullptr);
+ delete m_handle;
+ m_handle = nullptr;
+}
+
+QPlatformMenuBar *QQuickPlatformMenuBar::handle() const
+{
+ return m_handle;
+}
+
+/*!
+ \default
+ \qmlproperty list<Object> Qt.labs.platform::MenuBar::data
+
+ This default property holds the list of all objects declared as children of
+ the menubar. The data property includes objects that are not \l Menu instances,
+ such as \l Timer and \l QtObject.
+
+ \sa menus
+*/
+QQmlListProperty<QObject> QQuickPlatformMenuBar::data()
+{
+ return QQmlListProperty<QObject>(this, nullptr, data_append, data_count, data_at, data_clear);
+}
+
+/*!
+ \qmlproperty list<Menu> Qt.labs.platform::MenuBar::menus
+
+ This property holds the list of menus in the menubar.
+*/
+QQmlListProperty<QQuickPlatformMenu> QQuickPlatformMenuBar::menus()
+{
+ return QQmlListProperty<QQuickPlatformMenu>(this, nullptr, menus_append, menus_count, menus_at, menus_clear);
+}
+
+/*!
+ \qmlproperty Window Qt.labs.platform::MenuBar::window
+
+ This property holds the menubar's window.
+
+ Unless explicitly set, the window is automatically resolved by iterating
+ the QML parent objects until a \l Window or an \l Item that has a window
+ is found.
+*/
+QWindow *QQuickPlatformMenuBar::window() const
+{
+ return m_window;
+}
+
+void QQuickPlatformMenuBar::setWindow(QWindow *window)
+{
+ if (m_window == window)
+ return;
+
+ if (m_handle)
+ m_handle->handleReparent(window);
+
+ m_window = window;
+ emit windowChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuBar::addMenu(Menu menu)
+
+ Adds a \a menu to end of the menubar.
+*/
+void QQuickPlatformMenuBar::addMenu(QQuickPlatformMenu *menu)
+{
+ insertMenu(m_menus.count(), menu);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuBar::insertMenu(int index, Menu menu)
+
+ Inserts a \a menu at the specified \a index in the menubar.
+*/
+void QQuickPlatformMenuBar::insertMenu(int index, QQuickPlatformMenu *menu)
+{
+ if (!menu || m_menus.contains(menu))
+ return;
+
+ QQuickPlatformMenu *before = m_menus.value(index);
+ m_menus.insert(index, menu);
+ m_data.append(menu);
+ menu->setMenuBar(this);
+ if (m_handle)
+ m_handle->insertMenu(menu->create(), before ? before->handle() : nullptr);
+ emit menusChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuBar::removeMenu(Menu menu)
+
+ Removes a \a menu from the menubar.
+*/
+void QQuickPlatformMenuBar::removeMenu(QQuickPlatformMenu *menu)
+{
+ if (!menu || !m_menus.removeOne(menu))
+ return;
+
+ m_data.removeOne(menu);
+ if (m_handle)
+ m_handle->removeMenu(menu->handle());
+ menu->setMenuBar(nullptr);
+ emit menusChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuBar::clear()
+
+ Removes all menus from the menubar.
+*/
+void QQuickPlatformMenuBar::clear()
+{
+ if (m_menus.isEmpty())
+ return;
+
+ for (QQuickPlatformMenu *menu : m_menus) {
+ m_data.removeOne(menu);
+ if (m_handle)
+ m_handle->removeMenu(menu->handle());
+ menu->setMenuBar(nullptr);
+ delete menu;
+ }
+
+ m_menus.clear();
+ emit menusChanged();
+}
+
+void QQuickPlatformMenuBar::classBegin()
+{
+}
+
+void QQuickPlatformMenuBar::componentComplete()
+{
+ m_complete = true;
+ for (QQuickPlatformMenu *menu : m_menus)
+ menu->sync();
+ if (!m_window)
+ setWindow(findWindow());
+}
+
+QWindow *QQuickPlatformMenuBar::findWindow() const
+{
+ QObject *obj = parent();
+ while (obj) {
+ QWindow *window = qobject_cast<QWindow *>(obj);
+ if (window)
+ return window;
+ QQuickItem *item = qobject_cast<QQuickItem *>(obj);
+ if (item && item->window())
+ return item->window();
+ obj = obj->parent();
+ }
+ return nullptr;
+}
+
+void QQuickPlatformMenuBar::data_append(QQmlListProperty<QObject> *property, QObject *object)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ QQuickPlatformMenu *menu = qobject_cast<QQuickPlatformMenu *>(object);
+ if (menu)
+ menuBar->addMenu(menu);
+ else
+ menuBar->m_data.append(object);
+}
+
+int QQuickPlatformMenuBar::data_count(QQmlListProperty<QObject> *property)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ return menuBar->m_data.count();
+}
+
+QObject *QQuickPlatformMenuBar::data_at(QQmlListProperty<QObject> *property, int index)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ return menuBar->m_data.value(index);
+}
+
+void QQuickPlatformMenuBar::data_clear(QQmlListProperty<QObject> *property)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ menuBar->m_data.clear();
+}
+
+void QQuickPlatformMenuBar::menus_append(QQmlListProperty<QQuickPlatformMenu> *property, QQuickPlatformMenu *menu)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ menuBar->addMenu(menu);
+}
+
+int QQuickPlatformMenuBar::menus_count(QQmlListProperty<QQuickPlatformMenu> *property)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ return menuBar->m_menus.count();
+}
+
+QQuickPlatformMenu *QQuickPlatformMenuBar::menus_at(QQmlListProperty<QQuickPlatformMenu> *property, int index)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ return menuBar->m_menus.value(index);
+}
+
+void QQuickPlatformMenuBar::menus_clear(QQmlListProperty<QQuickPlatformMenu> *property)
+{
+ QQuickPlatformMenuBar *menuBar = static_cast<QQuickPlatformMenuBar *>(property->object);
+ menuBar->clear();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmenubar_p.h b/src/imports/platform/qquickplatformmenubar_p.h
new file mode 100644
index 00000000..059acfe6
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenubar_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMMENUBAR_P_H
+#define QQUICKPLATFORMMENUBAR_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 <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqmllist.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindow;
+class QPlatformMenuBar;
+class QQuickPlatformMenu;
+
+class QQuickPlatformMenuBar : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQmlListProperty<QObject> data READ data FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickPlatformMenu> menus READ menus NOTIFY menusChanged FINAL)
+ Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "data")
+
+public:
+ explicit QQuickPlatformMenuBar(QObject *parent = nullptr);
+ ~QQuickPlatformMenuBar();
+
+ QPlatformMenuBar *handle() const;
+
+ QQmlListProperty<QObject> data();
+ QQmlListProperty<QQuickPlatformMenu> menus();
+
+ QWindow *window() const;
+ void setWindow(QWindow *window);
+
+ Q_INVOKABLE void addMenu(QQuickPlatformMenu *menu);
+ Q_INVOKABLE void insertMenu(int index, QQuickPlatformMenu *menu);
+ Q_INVOKABLE void removeMenu(QQuickPlatformMenu *menu);
+ Q_INVOKABLE void clear();
+
+Q_SIGNALS:
+ void menusChanged();
+ void windowChanged();
+
+protected:
+ void classBegin() override;
+ void componentComplete() override;
+
+ QWindow *findWindow() const;
+
+ static void data_append(QQmlListProperty<QObject> *property, QObject *object);
+ static int data_count(QQmlListProperty<QObject> *property);
+ static QObject *data_at(QQmlListProperty<QObject> *property, int index);
+ static void data_clear(QQmlListProperty<QObject> *property);
+
+ static void menus_append(QQmlListProperty<QQuickPlatformMenu> *property, QQuickPlatformMenu *menu);
+ static int menus_count(QQmlListProperty<QQuickPlatformMenu> *property);
+ static QQuickPlatformMenu *menus_at(QQmlListProperty<QQuickPlatformMenu> *property, int index);
+ static void menus_clear(QQmlListProperty<QQuickPlatformMenu> *property);
+
+private:
+ bool m_complete;
+ QWindow *m_window;
+ QList<QObject *> m_data;
+ QList<QQuickPlatformMenu *> m_menus;
+ QPlatformMenuBar *m_handle;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMenuBar)
+
+#endif // QQUICKPLATFORMMENUBAR_P_H
diff --git a/src/imports/platform/qquickplatformmenuitem.cpp b/src/imports/platform/qquickplatformmenuitem.cpp
new file mode 100644
index 00000000..9f261d24
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenuitem.cpp
@@ -0,0 +1,612 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformmenuitem_p.h"
+#include "qquickplatformmenu_p.h"
+#include "qquickplatformmenuitemgroup_p.h"
+#include "qquickplatformiconloader_p.h"
+
+#include <QtGui/qicon.h>
+#include <QtGui/qkeysequence.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+#include "widgets/qwidgetplatform_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuItem
+ \inherits QtObject
+ \instantiates QQuickPlatformMenuItem
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native menu item.
+
+ The MenuItem type provides a QML API for native platform menu items.
+
+ \image qtlabsplatform-menu.png
+
+ A menu item consists of an \l {iconSource}{icon}, \l text, and \l shortcut.
+
+ \code
+ Menu {
+ id: zoomMenu
+
+ MenuItem {
+ text: qsTr("Zoom In")
+ shortcut: StandardKey.ZoomIn
+ onTriggered: zoomIn()
+ }
+
+ MenuItem {
+ text: qsTr("Zoom Out")
+ shortcut: StandardKey.ZoomOut
+ onTriggered: zoomOut()
+ }
+ }
+ \endcode
+
+ \labs
+
+ \sa Menu, MenuItemGroup
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MenuItem::triggered()
+
+ This signal is emitted when the menu item is triggered by the user.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MenuItem::hovered()
+
+ This signal is emitted when the menu item is hovered by the user.
+*/
+
+QQuickPlatformMenuItem::QQuickPlatformMenuItem(QObject *parent)
+ : QObject(parent),
+ m_complete(false),
+ m_enabled(true),
+ m_visible(true),
+ m_separator(false),
+ m_checkable(false),
+ m_checked(false),
+ m_role(QPlatformMenuItem::TextHeuristicRole),
+ m_menu(nullptr),
+ m_subMenu(nullptr),
+ m_group(nullptr),
+ m_iconLoader(nullptr),
+ m_handle(nullptr)
+{
+}
+
+QQuickPlatformMenuItem::~QQuickPlatformMenuItem()
+{
+ if (m_menu)
+ m_menu->removeItem(this);
+ if (m_group)
+ m_group->removeItem(this);
+ delete m_iconLoader;
+ m_iconLoader = nullptr;
+ delete m_handle;
+ m_handle = nullptr;
+}
+
+QPlatformMenuItem *QQuickPlatformMenuItem::handle() const
+{
+ return m_handle;
+}
+
+QPlatformMenuItem *QQuickPlatformMenuItem::create()
+{
+ if (!m_handle && m_menu && m_menu->handle()) {
+ m_handle = m_menu->handle()->createMenuItem();
+
+ // TODO: implement QCocoaMenu::createMenuItem()
+ if (!m_handle)
+ m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem();
+
+ if (!m_handle)
+ m_handle = QWidgetPlatform::createMenuItem();
+
+ if (m_handle) {
+ connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::triggered);
+ connect(m_handle, &QPlatformMenuItem::hovered, this, &QQuickPlatformMenuItem::hovered);
+ if (m_checkable)
+ connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::toggle);
+ }
+ }
+ return m_handle;
+}
+
+void QQuickPlatformMenuItem::sync()
+{
+ if (!m_complete || !create())
+ return;
+
+ m_handle->setEnabled(isEnabled());
+ m_handle->setVisible(isVisible());
+ m_handle->setIsSeparator(m_separator);
+ m_handle->setCheckable(m_checkable);
+ m_handle->setChecked(m_checked);
+ m_handle->setRole(m_role);
+ m_handle->setText(m_text);
+ m_handle->setFont(m_font);
+ m_handle->setHasExclusiveGroup(m_group && m_group->isExclusive());
+ if (m_subMenu && m_subMenu->handle())
+ m_handle->setMenu(m_subMenu->handle());
+
+ QKeySequence sequence;
+ if (m_shortcut.type() == QVariant::Int)
+ sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(m_shortcut.toInt()));
+ else
+ sequence = QKeySequence::fromString(m_shortcut.toString());
+ m_handle->setShortcut(sequence.toString());
+
+ if (m_menu && m_menu->handle())
+ m_menu->handle()->syncMenuItem(m_handle);
+}
+
+/*!
+ \readonly
+ \qmlproperty Menu Qt.labs.platform::MenuItem::menu
+
+ This property holds the menu that the item belongs to, or \c null if the
+ item is not in a menu.
+*/
+QQuickPlatformMenu *QQuickPlatformMenuItem::menu() const
+{
+ return m_menu;
+}
+
+void QQuickPlatformMenuItem::setMenu(QQuickPlatformMenu *menu)
+{
+ if (m_menu == menu)
+ return;
+
+ m_menu = menu;
+ emit menuChanged();
+}
+
+/*!
+ \readonly
+ \qmlproperty Menu Qt.labs.platform::MenuItem::subMenu
+
+ This property holds the sub-menu that the item contains, or \c null if
+ the item is not a sub-menu item.
+*/
+QQuickPlatformMenu *QQuickPlatformMenuItem::subMenu() const
+{
+ return m_subMenu;
+}
+
+void QQuickPlatformMenuItem::setSubMenu(QQuickPlatformMenu *menu)
+{
+ if (m_subMenu == menu)
+ return;
+
+ m_subMenu = menu;
+ sync();
+ emit subMenuChanged();
+}
+
+/*!
+ \qmlproperty MenuItemGroup Qt.labs.platform::MenuItem::group
+
+ This property holds the group that the item belongs to, or \c null if the
+ item is not in a group.
+*/
+QQuickPlatformMenuItemGroup *QQuickPlatformMenuItem::group() const
+{
+ return m_group;
+}
+
+void QQuickPlatformMenuItem::setGroup(QQuickPlatformMenuItemGroup *group)
+{
+ if (m_group == group)
+ return;
+
+ bool wasEnabled = isEnabled();
+ bool wasVisible = isVisible();
+
+ if (group)
+ group->addItem(this);
+
+ m_group = group;
+ sync();
+ emit groupChanged();
+
+ if (isEnabled() != wasEnabled)
+ emit enabledChanged();
+ if (isVisible() != wasVisible)
+ emit visibleChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItem::enabled
+
+ This property holds whether the item is enabled. The default value is \c true.
+
+ Disabled items cannot be triggered by the user. They do not disappear from menus,
+ but they are displayed in a way which indicates that they are unavailable. For
+ example, they might be displayed using only shades of gray.
+
+ When an item is disabled, it is not possible to trigger it through its \l shortcut.
+*/
+bool QQuickPlatformMenuItem::isEnabled() const
+{
+ return m_enabled && (!m_group || m_group->isEnabled());
+}
+
+void QQuickPlatformMenuItem::setEnabled(bool enabled)
+{
+ if (m_enabled == enabled)
+ return;
+
+ bool wasEnabled = isEnabled();
+ m_enabled = enabled;
+ sync();
+ if (isEnabled() != wasEnabled)
+ emit enabledChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItem::visible
+
+ This property holds whether the item is visible. The default value is \c true.
+*/
+bool QQuickPlatformMenuItem::isVisible() const
+{
+ return m_visible && (!m_group || m_group->isVisible());
+}
+
+void QQuickPlatformMenuItem::setVisible(bool visible)
+{
+ if (m_visible == visible)
+ return;
+
+ bool wasVisible = isVisible();
+ m_visible = visible;
+ sync();
+ if (isVisible() != wasVisible)
+ emit visibleChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItem::separator
+
+ This property holds whether the item is a separator line. The default value
+ is \c false.
+
+ \sa MenuSeparator
+*/
+bool QQuickPlatformMenuItem::isSeparator() const
+{
+ return m_separator;
+}
+
+void QQuickPlatformMenuItem::setSeparator(bool separator)
+{
+ if (m_separator == separator)
+ return;
+
+ m_separator = separator;
+ sync();
+ emit separatorChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItem::checkable
+
+ This property holds whether the item is checkable.
+
+ A checkable menu item has an on/off state. For example, in a word processor,
+ a "Bold" menu item may be either on or off. A menu item that is not checkable
+ is a command item that is simply executed, e.g. file save.
+
+ The default value is \c false.
+
+ \sa checked, MenuItemGroup
+*/
+bool QQuickPlatformMenuItem::isCheckable() const
+{
+ return m_checkable;
+}
+
+void QQuickPlatformMenuItem::setCheckable(bool checkable)
+{
+ if (m_checkable == checkable)
+ return;
+
+ if (m_handle) {
+ if (checkable)
+ connect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::toggle);
+ else
+ disconnect(m_handle, &QPlatformMenuItem::activated, this, &QQuickPlatformMenuItem::toggle);
+ }
+
+ m_checkable = checkable;
+ sync();
+ emit checkableChanged();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItem::checked
+
+ This property holds whether the item is checked (on) or unchecked (off).
+ The default value is \c false.
+
+ \sa checkable, MenuItemGroup
+*/
+bool QQuickPlatformMenuItem::isChecked() const
+{
+ return m_checked;
+}
+
+void QQuickPlatformMenuItem::setChecked(bool checked)
+{
+ if (m_checked == checked)
+ return;
+
+ if (checked && !m_checkable)
+ setCheckable(true);
+
+ m_checked = checked;
+ sync();
+ emit checkedChanged();
+}
+
+/*!
+ \qmlproperty enumeration Qt.labs.platform::MenuItem::role
+
+ This property holds the role of the item. The role determines whether
+ the item should be placed into the application menu on macOS.
+
+ Available values:
+ \value MenuItem.NoRole The item should not be put into the application menu
+ \value MenuItem.TextHeuristicRole The item should be put in the application menu based on the action's text (default)
+ \value MenuItem.ApplicationSpecificRole The item should be put in the application menu with an application-specific role
+ \value MenuItem.AboutQtRole The item handles the "About Qt" menu item.
+ \value MenuItem.AboutRole The item should be placed where the "About" menu item is in the application menu. The text of
+ the menu item will be set to "About <application name>". The application name is fetched from the
+ \c{Info.plist} file in the application's bundle (See \l{Qt for OS X - Deployment}).
+ \value MenuItem.PreferencesRole The item should be placed where the "Preferences..." menu item is in the application menu.
+ \value MenuItem.QuitRole The item should be placed where the Quit menu item is in the application menu.
+
+ Specifying the role only has effect on items that are in the immediate
+ menus of a menubar, not in the submenus of those menus. For example, if
+ you have a "File" menu in your menubar and the "File" menu has a submenu,
+ specifying a role for the items in that submenu has no effect. They will
+ never be moved to the application menu.
+*/
+QPlatformMenuItem::MenuRole QQuickPlatformMenuItem::role() const
+{
+ return m_role;
+}
+
+void QQuickPlatformMenuItem::setRole(QPlatformMenuItem::MenuRole role)
+{
+ if (m_role == role)
+ return;
+
+ m_role = role;
+ sync();
+ emit roleChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::MenuItem::text
+
+ This property holds the menu item's text.
+*/
+QString QQuickPlatformMenuItem::text() const
+{
+ return m_text;
+}
+
+void QQuickPlatformMenuItem::setText(const QString &text)
+{
+ if (m_text == text)
+ return;
+
+ m_text = text;
+ sync();
+ emit textChanged();
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::MenuItem::iconSource
+
+ This property holds the url of the menu item's icon.
+
+ \code
+ MenuItem {
+ iconName: "edit-undo"
+ iconSource: "qrc:/images/undo.png"
+ }
+ \endcode
+
+ \sa iconName
+*/
+QUrl QQuickPlatformMenuItem::iconSource() const
+{
+ if (!m_iconLoader)
+ return QUrl();
+
+ return m_iconLoader->iconSource();
+}
+
+void QQuickPlatformMenuItem::setIconSource(const QUrl& source)
+{
+ if (source == iconSource())
+ return;
+
+ iconLoader()->setIconSource(source);
+ emit iconSourceChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::MenuItem::iconName
+
+ This property holds the theme name of the menu item's icon.
+
+ \code
+ MenuItem {
+ iconName: "edit-undo"
+ iconSource: "qrc:/images/undo.png"
+ }
+ \endcode
+
+ \sa iconSource, QIcon::fromTheme()
+*/
+QString QQuickPlatformMenuItem::iconName() const
+{
+ if (!m_iconLoader)
+ return QString();
+
+ return m_iconLoader->iconName();
+}
+
+void QQuickPlatformMenuItem::setIconName(const QString& name)
+{
+ if (name == iconName())
+ return;
+
+ iconLoader()->setIconName(name);
+ emit iconNameChanged();
+}
+
+/*!
+ \qmlproperty keysequence Qt.labs.platform::MenuItem::shortcut
+
+ This property holds the menu item's shortcut.
+
+ The shortcut key sequence can be set to one of the
+ \l{QKeySequence::StandardKey}{standard keyboard shortcuts}, or it can be
+ specified by a string containing a sequence of up to four key presses
+ that are needed to \l{triggered}{trigger} the shortcut.
+
+ The default value is an empty key sequence.
+
+ \code
+ MenuItem {
+ shortcut: "Ctrl+E,Ctrl+W"
+ onTriggered: edit.wrapMode = TextEdit.Wrap
+ }
+ \endcode
+*/
+QVariant QQuickPlatformMenuItem::shortcut() const
+{
+ return m_shortcut;
+}
+
+void QQuickPlatformMenuItem::setShortcut(const QVariant& shortcut)
+{
+ if (m_shortcut == shortcut)
+ return;
+
+ m_shortcut = shortcut;
+ sync();
+ emit shortcutChanged();
+}
+
+/*!
+ \qmlproperty font Qt.labs.platform::MenuItem::font
+
+ This property holds the menu item's font.
+
+ \sa text
+*/
+QFont QQuickPlatformMenuItem::font() const
+{
+ return m_font;
+}
+
+void QQuickPlatformMenuItem::setFont(const QFont& font)
+{
+ if (m_font == font)
+ return;
+
+ m_font = font;
+ sync();
+ emit fontChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuItem::toggle()
+
+ Toggles the \l checked state to its opposite state.
+*/
+void QQuickPlatformMenuItem::toggle()
+{
+ if (m_checkable)
+ setChecked(!m_checked);
+}
+
+void QQuickPlatformMenuItem::classBegin()
+{
+}
+
+void QQuickPlatformMenuItem::componentComplete()
+{
+ if (m_handle && m_iconLoader)
+ m_iconLoader->setEnabled(true);
+ m_complete = true;
+ sync();
+}
+
+QQuickPlatformIconLoader *QQuickPlatformMenuItem::iconLoader() const
+{
+ if (!m_iconLoader) {
+ QQuickPlatformMenuItem *that = const_cast<QQuickPlatformMenuItem *>(this);
+ static int slot = staticMetaObject.indexOfSlot("updateIcon()");
+ m_iconLoader = new QQuickPlatformIconLoader(slot, that);
+ m_iconLoader->setEnabled(m_complete);
+ }
+ return m_iconLoader;
+}
+
+void QQuickPlatformMenuItem::updateIcon()
+{
+ if (!m_handle || !m_iconLoader)
+ return;
+
+ m_handle->setIcon(m_iconLoader->icon());
+ sync();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmenuitem_p.h b/src/imports/platform/qquickplatformmenuitem_p.h
new file mode 100644
index 00000000..48a5603e
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenuitem_p.h
@@ -0,0 +1,191 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMMENUITEM_P_H
+#define QQUICKPLATFORMMENUITEM_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/qurl.h>
+#include <QtGui/qfont.h>
+#include <QtGui/qpa/qplatformmenu.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPlatformMenuItem;
+class QQuickPlatformMenu;
+class QQuickPlatformIconLoader;
+class QQuickPlatformMenuItemGroup;
+
+class QQuickPlatformMenuItem : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(QQuickPlatformMenu *menu READ menu NOTIFY menuChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenu *subMenu READ subMenu NOTIFY subMenuChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenuItemGroup *group READ group WRITE setGroup NOTIFY groupChanged FINAL)
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(bool separator READ isSeparator WRITE setSeparator NOTIFY separatorChanged FINAL)
+ Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
+ Q_PROPERTY(QPlatformMenuItem::MenuRole role READ role WRITE setRole NOTIFY roleChanged FINAL)
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged FINAL)
+ Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
+ Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged FINAL)
+ Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
+ Q_ENUMS(QPlatformMenuItem::MenuRole)
+
+public:
+ explicit QQuickPlatformMenuItem(QObject *parent = nullptr);
+ ~QQuickPlatformMenuItem();
+
+ QPlatformMenuItem *handle() const;
+ QPlatformMenuItem *create();
+ void sync();
+
+ QQuickPlatformMenu *menu() const;
+ void setMenu(QQuickPlatformMenu* menu);
+
+ QQuickPlatformMenu *subMenu() const;
+ void setSubMenu(QQuickPlatformMenu *menu);
+
+ QQuickPlatformMenuItemGroup *group() const;
+ void setGroup(QQuickPlatformMenuItemGroup *group);
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ bool isSeparator() const;
+ void setSeparator(bool separator);
+
+ bool isCheckable() const;
+ void setCheckable(bool checkable);
+
+ bool isChecked() const;
+ void setChecked(bool checked);
+
+ QPlatformMenuItem::MenuRole role() const;
+ void setRole(QPlatformMenuItem::MenuRole role);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ QUrl iconSource() const;
+ void setIconSource(const QUrl &source);
+
+ QString iconName() const;
+ void setIconName(const QString &name);
+
+ QVariant shortcut() const;
+ void setShortcut(const QVariant& shortcut);
+
+ QFont font() const;
+ void setFont(const QFont &font);
+
+public Q_SLOTS:
+ void toggle();
+
+Q_SIGNALS:
+ void triggered();
+ void hovered();
+
+ void menuChanged();
+ void subMenuChanged();
+ void groupChanged();
+ void enabledChanged();
+ void visibleChanged();
+ void separatorChanged();
+ void checkableChanged();
+ void checkedChanged();
+ void roleChanged();
+ void textChanged();
+ void iconSourceChanged();
+ void iconNameChanged();
+ void shortcutChanged();
+ void fontChanged();
+
+protected:
+ void classBegin() override;
+ void componentComplete() override;
+
+ QQuickPlatformIconLoader *iconLoader() const;
+
+private Q_SLOTS:
+ void updateIcon();
+
+private:
+ bool m_complete;
+ bool m_enabled;
+ bool m_visible;
+ bool m_separator;
+ bool m_checkable;
+ bool m_checked;
+ QPlatformMenuItem::MenuRole m_role;
+ QString m_text;
+ QVariant m_shortcut;
+ QFont m_font;
+ QQuickPlatformMenu *m_menu;
+ QQuickPlatformMenu *m_subMenu;
+ QQuickPlatformMenuItemGroup *m_group;
+ mutable QQuickPlatformIconLoader *m_iconLoader;
+ QPlatformMenuItem *m_handle;
+
+ friend class QQuickPlatformMenu;
+ friend class QQuickPlatformMenuItemGroup;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMenuItem)
+
+#endif // QQUICKPLATFORMMENUITEM_P_H
diff --git a/src/imports/platform/qquickplatformmenuitemgroup.cpp b/src/imports/platform/qquickplatformmenuitemgroup.cpp
new file mode 100644
index 00000000..1f4dda3c
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenuitemgroup.cpp
@@ -0,0 +1,390 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 "qquickplatformmenuitemgroup_p.h"
+#include "qquickplatformmenuitem_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuItemGroup
+ \inherits QtObject
+ \instantiates QQuickPlatformMenuItemGroup
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A group for managing native menu items.
+
+ The MenuItemGroup groups native menu items together.
+
+ MenuItemGroup is exclusive by default. In an exclusive menu item
+ group, only one item can be checked at any time; checking another
+ item automatically unchecks the previously checked one. MenuItemGroup
+ can be configured as non-exclusive, which is particularly useful for
+ showing, hiding, enabling and disabling items together as a group.
+
+ The most straight-forward way to use MenuItemGroup is to assign
+ a list of items.
+
+ \code
+ Menu {
+ id: verticalMenu
+ title: qsTr("Vertical")
+
+ MenuItemGroup {
+ id: verticalGroup
+ items: verticalMenu.items
+ }
+
+ MenuItem { text: qsTr("Top"); checkable: true }
+ MenuItem { text: qsTr("Center"); checked: true }
+ MenuItem { text: qsTr("Bottom"); checkable: true }
+ }
+ \endcode
+
+ The same menu may sometimes contain items that should not be included
+ in the same exclusive group. Such cases are best handled using the
+ \l {MenuItem::group}{group} property.
+
+ \code
+ Menu {
+ id: horizontalMenu
+ title: qsTr("Horizontal")
+
+ MenuItemGroup {
+ id: horizontalGroup
+ }
+
+ MenuItem {
+ checked: true
+ text: qsTr("Left")
+ group: horizontalGroup
+ }
+ MenuItem {
+ checkable: true
+ text: qsTr("Center")
+ group: horizontalGroup
+ }
+ MenuItem {
+ text: qsTr("Right")
+ checkable: true
+ group: horizontalGroup
+ }
+
+ MenuItem { separator: true }
+ MenuItem { text: qsTr("Justify"); checkable: true }
+ MenuItem { text: qsTr("Absolute"); checkable: true }
+ }
+ \endcode
+
+ More advanced use cases can be handled using the addItem() and
+ removeItem() methods.
+
+ \labs
+
+ \sa MenuItem
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MenuItemGroup::triggered(MenuItem item)
+
+ This signal is emitted when an \a item in the group is triggered by the user.
+
+ \sa MenuItem::triggered()
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MenuItemGroup::hovered(MenuItem item)
+
+ This signal is emitted when an \a item in the group is hovered by the user.
+
+ \sa MenuItem::hovered()
+*/
+
+QQuickPlatformMenuItemGroup::QQuickPlatformMenuItemGroup(QObject *parent)
+ : QObject(parent), m_enabled(true), m_visible(true), m_exclusive(true), m_checkedItem(nullptr)
+{
+}
+
+QQuickPlatformMenuItemGroup::~QQuickPlatformMenuItemGroup()
+{
+ clear();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItemGroup::enabled
+
+ This property holds whether the group is enabled. The default value is \c true.
+
+ The enabled state of the group affects the enabled state of each item in the group,
+ except that explicitly disabled items are not enabled even if the group is enabled.
+*/
+bool QQuickPlatformMenuItemGroup::isEnabled() const
+{
+ return m_enabled;
+}
+
+void QQuickPlatformMenuItemGroup::setEnabled(bool enabled)
+{
+ if (m_enabled == enabled)
+ return;
+
+ m_enabled = enabled;
+ emit enabledChanged();
+
+ for (QQuickPlatformMenuItem *item : m_items) {
+ if (item->m_enabled) {
+ item->sync();
+ emit item->enabledChanged();
+ }
+ }
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItemGroup::visible
+
+ This property holds whether the group is visible. The default value is \c true.
+
+ The visibility of the group affects the visibility of each item in the group,
+ except that explicitly hidden items are not visible even if the group is visible.
+*/
+bool QQuickPlatformMenuItemGroup::isVisible() const
+{
+ return m_visible;
+}
+
+void QQuickPlatformMenuItemGroup::setVisible(bool visible)
+{
+ if (m_visible == visible)
+ return;
+
+ m_visible = visible;
+ emit visibleChanged();
+
+ for (QQuickPlatformMenuItem *item : m_items) {
+ if (item->m_visible) {
+ item->sync();
+ emit item->visibleChanged();
+ }
+ }
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::MenuItemGroup::exclusive
+
+ This property holds whether the group is exclusive. The default value is \c true.
+
+ In an exclusive menu item group, only one item can be checked at any time;
+ checking another item automatically unchecks the previously checked one.
+*/
+bool QQuickPlatformMenuItemGroup::isExclusive() const
+{
+ return m_exclusive;
+}
+
+void QQuickPlatformMenuItemGroup::setExclusive(bool exclusive)
+{
+ if (m_exclusive == exclusive)
+ return;
+
+ m_exclusive = exclusive;
+ emit exclusiveChanged();
+
+ for (QQuickPlatformMenuItem *item : m_items)
+ item->sync();
+}
+
+/*!
+ \qmlproperty MenuItem Qt.labs.platform::MenuItemGroup::checkedItem
+
+ This property holds the currently checked item in the group, or \c null if no item is checked.
+*/
+QQuickPlatformMenuItem *QQuickPlatformMenuItemGroup::checkedItem() const
+{
+ return m_checkedItem;
+}
+
+void QQuickPlatformMenuItemGroup::setCheckedItem(QQuickPlatformMenuItem *item)
+{
+ if (m_checkedItem == item)
+ return;
+
+ if (m_checkedItem)
+ m_checkedItem->setChecked(false);
+
+ m_checkedItem = item;
+ emit checkedItemChanged();
+
+ if (item)
+ item->setChecked(true);
+}
+
+/*!
+ \qmlproperty list<MenuItem> Qt.labs.platform::MenuItemGroup::items
+
+ This property holds the list of items in the group.
+*/
+QQmlListProperty<QQuickPlatformMenuItem> QQuickPlatformMenuItemGroup::items()
+{
+ return QQmlListProperty<QQuickPlatformMenuItem>(this, nullptr, items_append, items_count, items_at, items_clear);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuItemGroup::addItem(MenuItem item)
+
+ Adds an \a item to the group.
+*/
+void QQuickPlatformMenuItemGroup::addItem(QQuickPlatformMenuItem *item)
+{
+ if (!item || m_items.contains(item))
+ return;
+
+ m_items.append(item);
+ item->setGroup(this);
+
+ connect(item, &QQuickPlatformMenuItem::checkedChanged, this, &QQuickPlatformMenuItemGroup::updateCurrent);
+ connect(item, &QQuickPlatformMenuItem::triggered, this, &QQuickPlatformMenuItemGroup::activateItem);
+ connect(item, &QQuickPlatformMenuItem::hovered, this, &QQuickPlatformMenuItemGroup::hoverItem);
+
+ if (m_exclusive && item->isChecked())
+ setCheckedItem(item);
+
+ emit itemsChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuItemGroup::removeItem(MenuItem item)
+
+ Removes an \a item from the group.
+*/
+void QQuickPlatformMenuItemGroup::removeItem(QQuickPlatformMenuItem *item)
+{
+ if (!item || !m_items.contains(item))
+ return;
+
+ m_items.removeOne(item);
+ item->setGroup(nullptr);
+
+ disconnect(item, &QQuickPlatformMenuItem::checkedChanged, this, &QQuickPlatformMenuItemGroup::updateCurrent);
+ disconnect(item, &QQuickPlatformMenuItem::triggered, this, &QQuickPlatformMenuItemGroup::activateItem);
+ disconnect(item, &QQuickPlatformMenuItem::hovered, this, &QQuickPlatformMenuItemGroup::hoverItem);
+
+ if (m_checkedItem == item)
+ setCheckedItem(nullptr);
+
+ emit itemsChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::MenuItemGroup::clear()
+
+ Removes all items from the group.
+*/
+void QQuickPlatformMenuItemGroup::clear()
+{
+ if (m_items.isEmpty())
+ return;
+
+ for (QQuickPlatformMenuItem *item : m_items) {
+ item->setGroup(nullptr);
+ disconnect(item, &QQuickPlatformMenuItem::checkedChanged, this, &QQuickPlatformMenuItemGroup::updateCurrent);
+ disconnect(item, &QQuickPlatformMenuItem::triggered, this, &QQuickPlatformMenuItemGroup::activateItem);
+ disconnect(item, &QQuickPlatformMenuItem::hovered, this, &QQuickPlatformMenuItemGroup::hoverItem);
+ }
+
+ setCheckedItem(nullptr);
+
+ m_items.clear();
+ emit itemsChanged();
+}
+
+QQuickPlatformMenuItem *QQuickPlatformMenuItemGroup::findCurrent() const
+{
+ for (QQuickPlatformMenuItem *item : m_items) {
+ if (item->isChecked())
+ return item;
+ }
+ return nullptr;
+}
+
+void QQuickPlatformMenuItemGroup::updateCurrent()
+{
+ if (!m_exclusive)
+ return;
+
+ QQuickPlatformMenuItem *item = qobject_cast<QQuickPlatformMenuItem*>(sender());
+ if (item && item->isChecked())
+ setCheckedItem(item);
+}
+
+void QQuickPlatformMenuItemGroup::activateItem()
+{
+ QQuickPlatformMenuItem *item = qobject_cast<QQuickPlatformMenuItem*>(sender());
+ if (item)
+ emit triggered(item);
+}
+
+void QQuickPlatformMenuItemGroup::hoverItem()
+{
+ QQuickPlatformMenuItem *item = qobject_cast<QQuickPlatformMenuItem*>(sender());
+ if (item)
+ emit hovered(item);
+}
+
+void QQuickPlatformMenuItemGroup::items_append(QQmlListProperty<QQuickPlatformMenuItem> *prop, QQuickPlatformMenuItem *item)
+{
+ QQuickPlatformMenuItemGroup *group = static_cast<QQuickPlatformMenuItemGroup *>(prop->object);
+ group->addItem(item);
+}
+
+int QQuickPlatformMenuItemGroup::items_count(QQmlListProperty<QQuickPlatformMenuItem> *prop)
+{
+ QQuickPlatformMenuItemGroup *group = static_cast<QQuickPlatformMenuItemGroup *>(prop->object);
+ return group->m_items.count();
+}
+
+QQuickPlatformMenuItem *QQuickPlatformMenuItemGroup::items_at(QQmlListProperty<QQuickPlatformMenuItem> *prop, int index)
+{
+ QQuickPlatformMenuItemGroup *group = static_cast<QQuickPlatformMenuItemGroup *>(prop->object);
+ return group->m_items.value(index);
+}
+
+void QQuickPlatformMenuItemGroup::items_clear(QQmlListProperty<QQuickPlatformMenuItem> *prop)
+{
+ QQuickPlatformMenuItemGroup *group = static_cast<QQuickPlatformMenuItemGroup *>(prop->object);
+ group->clear();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmenuitemgroup_p.h b/src/imports/platform/qquickplatformmenuitemgroup_p.h
new file mode 100644
index 00000000..f5797eff
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenuitemgroup_p.h
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 QQUICKPLATFORMMENUITEMGROUP_P_H
+#define QQUICKPLATFORMMENUITEMGROUP_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/qvector.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformMenuItem;
+class QQuickPlatformMenuItemGroupPrivate;
+
+class QQuickPlatformMenuItemGroup : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(bool exclusive READ isExclusive WRITE setExclusive NOTIFY exclusiveChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenuItem *checkedItem READ checkedItem WRITE setCheckedItem NOTIFY checkedItemChanged FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickPlatformMenuItem> items READ items NOTIFY itemsChanged FINAL)
+
+public:
+ explicit QQuickPlatformMenuItemGroup(QObject *parent = nullptr);
+ ~QQuickPlatformMenuItemGroup();
+
+ bool isEnabled() const;
+ void setEnabled(bool enabled);
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ bool isExclusive() const;
+ void setExclusive(bool exclusive);
+
+ QQuickPlatformMenuItem *checkedItem() const;
+ void setCheckedItem(QQuickPlatformMenuItem *item);
+
+ QQmlListProperty<QQuickPlatformMenuItem> items();
+
+ Q_INVOKABLE void addItem(QQuickPlatformMenuItem *item);
+ Q_INVOKABLE void removeItem(QQuickPlatformMenuItem *item);
+ Q_INVOKABLE void clear();
+
+Q_SIGNALS:
+ void triggered(QQuickPlatformMenuItem *item);
+ void hovered(QQuickPlatformMenuItem *item);
+
+ void enabledChanged();
+ void visibleChanged();
+ void exclusiveChanged();
+ void checkedItemChanged();
+ void itemsChanged();
+
+private:
+ QQuickPlatformMenuItem *findCurrent() const;
+ void updateCurrent();
+ void activateItem();
+ void hoverItem();
+
+ static void items_append(QQmlListProperty<QQuickPlatformMenuItem> *prop, QQuickPlatformMenuItem *obj);
+ static int items_count(QQmlListProperty<QQuickPlatformMenuItem> *prop);
+ static QQuickPlatformMenuItem *items_at(QQmlListProperty<QQuickPlatformMenuItem> *prop, int index);
+ static void items_clear(QQmlListProperty<QQuickPlatformMenuItem> *prop);
+
+ bool m_enabled;
+ bool m_visible;
+ bool m_exclusive;
+ QQuickPlatformMenuItem *m_checkedItem;
+ QVector<QQuickPlatformMenuItem*> m_items;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMenuItemGroup)
+
+#endif // QQUICKPLATFORMMENUITEMGROUP_P_H
diff --git a/src/imports/platform/qquickplatformmenuseparator.cpp b/src/imports/platform/qquickplatformmenuseparator.cpp
new file mode 100644
index 00000000..908ea075
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenuseparator.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformmenuseparator_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuSeparator
+ \inherits MenuItem
+ \instantiates QQuickPlatformMenuSeparator
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native menu separator.
+
+ The MenuSeparator type is provided for convenience. It is a MenuItem
+ that has the \l {MenuItem::}{separator} property set to \c true by default.
+
+ \image qtlabsplatform-menubar.png
+
+ \labs
+
+ \sa Menu, MenuItem
+*/
+
+QQuickPlatformMenuSeparator::QQuickPlatformMenuSeparator(QObject *parent)
+ : QQuickPlatformMenuItem(parent)
+{
+ setSeparator(true);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmenuseparator_p.h b/src/imports/platform/qquickplatformmenuseparator_p.h
new file mode 100644
index 00000000..ce5ed391
--- /dev/null
+++ b/src/imports/platform/qquickplatformmenuseparator_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMMENUSEPARATOR_P_H
+#define QQUICKPLATFORMMENUSEPARATOR_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 "qquickplatformmenuitem_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformMenuSeparator : public QQuickPlatformMenuItem
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickPlatformMenuSeparator(QObject *parent = nullptr);
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMenuSeparator)
+
+#endif // QQUICKPLATFORMMENUSEPARATOR_P_H
diff --git a/src/imports/platform/qquickplatformmessagedialog.cpp b/src/imports/platform/qquickplatformmessagedialog.cpp
new file mode 100644
index 00000000..20216e9b
--- /dev/null
+++ b/src/imports/platform/qquickplatformmessagedialog.cpp
@@ -0,0 +1,383 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformmessagedialog_p.h"
+
+#include <QtQml/qqmlinfo.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MessageDialog
+ \inherits Dialog
+ \instantiates QQuickPlatformMessageDialog
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A native message dialog.
+
+ The MessageDialog type provides a QML API for native platform message dialogs.
+
+ \image qtlabsplatform-messagedialog-android.png
+
+ A message dialog is used to inform the user, or ask the user a question.
+ A message dialog displays a primary \l text to alert the user to a situation,
+ an \l {informativeText}{informative text} to further explain the alert or to
+ ask the user a question, and an optional \l {detailedText}{detailed text} to
+ provide even more data if the user requests it. A message box can also display
+ a configurable set of \l buttons for accepting a user response.
+
+ To show a message dialog, construct an instance of MessageDialog, set the
+ desired properties, and call \l {Dialog::}{open()}.
+
+ \code
+ MessageDialog {
+ buttons: MessageDialog.Ok
+ text: "The document has been modified."
+ }
+ \endcode
+
+ The user must click the \uicontrol OK button to dismiss the message dialog.
+ A modal message dialog blocks the rest of the GUI until the message is
+ dismissed.
+
+ A more elaborate approach than just alerting the user to an event is to
+ also ask the user what to do about it. Store the question in the
+ \l {informativeText}{informative text} property, and specify the \l buttons
+ property to the set of buttons you want as the set of user responses. The
+ buttons are specified by combining values using the bitwise OR operator. The
+ display order for the buttons is platform dependent.
+
+ \code
+ MessageDialog {
+ text: "The document has been modified."
+ informativeText: "Do you want to save your changes?"
+ buttons: MessageDialog.Ok | MessageDialog.Cancel
+
+ onAccepted: document.save()
+ }
+ \endcode
+
+ \image qtlabsplatform-messagedialog-informative-android.png
+
+ The \l clicked() signal passes the information of which button was clicked.
+
+ A native platform message dialog is currently available on the following platforms:
+
+ \list
+ \li iOS
+ \li Android
+ \li WinRT
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::clicked(button)
+
+ This signal is emitted when a dialog \a button is clicked.
+
+ \sa buttons
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::okClicked()
+
+ This signal is emitted when \uicontrol Ok is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::saveClicked()
+
+ This signal is emitted when \uicontrol Save is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::saveAllClicked()
+
+ This signal is emitted when \uicontrol {Save All} is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::openClicked()
+
+ This signal is emitted when \uicontrol Open is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::yesClicked()
+
+ This signal is emitted when \uicontrol Yes is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::yesToAllClicked()
+
+ This signal is emitted when \uicontrol {Yes To All} is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::noClicked()
+
+ This signal is emitted when \uicontrol No is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::noToAllClicked()
+
+ This signal is emitted when \uicontrol {No To All} is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::abortClicked()
+
+ This signal is emitted when \uicontrol Abort is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::retryClicked()
+
+ This signal is emitted when \uicontrol Retry is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::ignoreClicked()
+
+ This signal is emitted when \uicontrol Ignore is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::closeClicked()
+
+ This signal is emitted when \uicontrol Close is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::cancelClicked()
+
+ This signal is emitted when \uicontrol Cancel is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::discardClicked()
+
+ This signal is emitted when \uicontrol Discard is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::helpClicked()
+
+ This signal is emitted when \uicontrol Help is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::applyClicked()
+
+ This signal is emitted when \uicontrol Apply is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::resetClicked()
+
+ This signal is emitted when \uicontrol Reset is clicked.
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::MessageDialog::restoreDefaultsClicked()
+
+ This signal is emitted when \uicontrol {Restore Defaults} is clicked.
+*/
+
+QQuickPlatformMessageDialog::QQuickPlatformMessageDialog(QObject *parent)
+ : QQuickPlatformDialog(QPlatformTheme::MessageDialog, parent),
+ m_options(QMessageDialogOptions::create())
+{
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::MessageDialog::text
+
+ This property holds the text to be displayed on the message dialog.
+
+ \sa informativeText, detailedText
+*/
+QString QQuickPlatformMessageDialog::text() const
+{
+ return m_options->text();
+}
+
+void QQuickPlatformMessageDialog::setText(const QString &text)
+{
+ if (m_options->text() == text)
+ return;
+
+ m_options->setText(text);
+ emit textChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::MessageDialog::informativeText
+
+ This property holds the informative text that provides a fuller description for the message.
+
+ Informative text can be used to expand upon the \l text to give more information to the user.
+
+ \sa text, detailedText
+*/
+QString QQuickPlatformMessageDialog::informativeText() const
+{
+ return m_options->informativeText();
+}
+
+void QQuickPlatformMessageDialog::setInformativeText(const QString &text)
+{
+ if (m_options->informativeText() == text)
+ return;
+
+ m_options->setInformativeText(text);
+ emit informativeTextChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::MessageDialog::detailedText
+
+ This property holds the text to be displayed in the details area.
+
+ \sa text, informativeText
+*/
+QString QQuickPlatformMessageDialog::detailedText() const
+{
+ return m_options->detailedText();
+}
+
+void QQuickPlatformMessageDialog::setDetailedText(const QString &text)
+{
+ if (m_options->detailedText() == text)
+ return;
+
+ m_options->setDetailedText(text);
+ emit detailedTextChanged();
+}
+
+/*!
+ \qmlproperty flags Qt.labs.platform::MessageDialog::buttons
+
+ This property holds a combination of buttons that are used by the message dialog.
+ The default value is \c MessageDialog.NoButton.
+
+ Possible flags:
+ \value MessageDialog.Ok An "OK" button defined with the \c AcceptRole.
+ \value MessageDialog.Open An "Open" button defined with the \c AcceptRole.
+ \value MessageDialog.Save A "Save" button defined with the \c AcceptRole.
+ \value MessageDialog.Cancel A "Cancel" button defined with the \c RejectRole.
+ \value MessageDialog.Close A "Close" button defined with the \c RejectRole.
+ \value MessageDialog.Discard A "Discard" or "Don't Save" button, depending on the platform, defined with the \c DestructiveRole.
+ \value MessageDialog.Apply An "Apply" button defined with the \c ApplyRole.
+ \value MessageDialog.Reset A "Reset" button defined with the \c ResetRole.
+ \value MessageDialog.RestoreDefaults A "Restore Defaults" button defined with the \c ResetRole.
+ \value MessageDialog.Help A "Help" button defined with the \c HelpRole.
+ \value MessageDialog.SaveAll A "Save All" button defined with the \c AcceptRole.
+ \value MessageDialog.Yes A "Yes" button defined with the \c YesRole.
+ \value MessageDialog.YesToAll A "Yes to All" button defined with the \c YesRole.
+ \value MessageDialog.No A "No" button defined with the \c NoRole.
+ \value MessageDialog.NoToAll A "No to All" button defined with the \c NoRole.
+ \value MessageDialog.Abort An "Abort" button defined with the \c RejectRole.
+ \value MessageDialog.Retry A "Retry" button defined with the \c AcceptRole.
+ \value MessageDialog.Ignore An "Ignore" button defined with the \c AcceptRole.
+ \value MessageDialog.NoButton The dialog has no buttons.
+
+ \sa clicked()
+*/
+QPlatformDialogHelper::StandardButtons QQuickPlatformMessageDialog::buttons() const
+{
+ return m_options->standardButtons();
+}
+
+void QQuickPlatformMessageDialog::setButtons(QPlatformDialogHelper::StandardButtons buttons)
+{
+ if (m_options->standardButtons() == buttons)
+ return;
+
+ m_options->setStandardButtons(buttons);
+ emit buttonsChanged();
+}
+
+void QQuickPlatformMessageDialog::onCreate(QPlatformDialogHelper *dialog)
+{
+ if (QPlatformMessageDialogHelper *messageDialog = qobject_cast<QPlatformMessageDialogHelper *>(dialog)) {
+ connect(messageDialog, &QPlatformMessageDialogHelper::clicked, this, &QQuickPlatformMessageDialog::handleClick);
+ messageDialog->setOptions(m_options);
+ }
+}
+
+void QQuickPlatformMessageDialog::onShow(QPlatformDialogHelper *dialog)
+{
+ m_options->setWindowTitle(title());
+ if (QPlatformMessageDialogHelper *messageDialog = qobject_cast<QPlatformMessageDialogHelper *>(dialog))
+ messageDialog->setOptions(m_options);
+}
+
+void QQuickPlatformMessageDialog::handleClick(QPlatformDialogHelper::StandardButton button)
+{
+ done(button);
+ emit clicked(button);
+
+ switch (button) {
+ case QPlatformDialogHelper::Ok: emit okClicked(); break;
+ case QPlatformDialogHelper::Save: emit saveClicked(); break;
+ case QPlatformDialogHelper::SaveAll: emit saveAllClicked(); break;
+ case QPlatformDialogHelper::Open: emit openClicked(); break;
+ case QPlatformDialogHelper::Yes: emit yesClicked(); break;
+ case QPlatformDialogHelper::YesToAll: emit yesToAllClicked(); break;
+ case QPlatformDialogHelper::No: emit noClicked(); break;
+ case QPlatformDialogHelper::NoToAll: emit noToAllClicked(); break;
+ case QPlatformDialogHelper::Abort: emit abortClicked(); break;
+ case QPlatformDialogHelper::Retry: emit retryClicked(); break;
+ case QPlatformDialogHelper::Ignore: emit ignoreClicked(); break;
+ case QPlatformDialogHelper::Close: emit closeClicked(); break;
+ case QPlatformDialogHelper::Cancel: emit cancelClicked(); break;
+ case QPlatformDialogHelper::Discard: emit discardClicked(); break;
+ case QPlatformDialogHelper::Help: emit helpClicked(); break;
+ case QPlatformDialogHelper::Apply: emit applyClicked(); break;
+ case QPlatformDialogHelper::Reset: emit resetClicked(); break;
+ case QPlatformDialogHelper::RestoreDefaults: emit restoreDefaultsClicked(); break;
+ default: qmlInfo(this) << "unknown button" << button; break;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmessagedialog_p.h b/src/imports/platform/qquickplatformmessagedialog_p.h
new file mode 100644
index 00000000..e8355932
--- /dev/null
+++ b/src/imports/platform/qquickplatformmessagedialog_p.h
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMMESSAGEDIALOG_P_H
+#define QQUICKPLATFORMMESSAGEDIALOG_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 "qquickplatformdialog_p.h"
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformMessageDialog : public QQuickPlatformDialog
+{
+ Q_OBJECT
+ Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
+ Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText NOTIFY informativeTextChanged FINAL)
+ Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText NOTIFY detailedTextChanged FINAL)
+ Q_PROPERTY(QPlatformDialogHelper::StandardButtons buttons READ buttons WRITE setButtons NOTIFY buttonsChanged FINAL)
+ Q_FLAGS(QPlatformDialogHelper::StandardButtons)
+
+public:
+ explicit QQuickPlatformMessageDialog(QObject *parent = nullptr);
+
+ QString text() const;
+ void setText(const QString &text);
+
+ QString informativeText() const;
+ void setInformativeText(const QString &text);
+
+ QString detailedText() const;
+ void setDetailedText(const QString &text);
+
+ QPlatformDialogHelper::StandardButtons buttons() const;
+ void setButtons(QPlatformDialogHelper::StandardButtons buttons);
+
+Q_SIGNALS:
+ void textChanged();
+ void informativeTextChanged();
+ void detailedTextChanged();
+ void buttonsChanged();
+ void clicked(QPlatformDialogHelper::StandardButton button);
+
+ void okClicked();
+ void saveClicked();
+ void saveAllClicked();
+ void openClicked();
+ void yesClicked();
+ void yesToAllClicked();
+ void noClicked();
+ void noToAllClicked();
+ void abortClicked();
+ void retryClicked();
+ void ignoreClicked();
+ void closeClicked();
+ void cancelClicked();
+ void discardClicked();
+ void helpClicked();
+ void applyClicked();
+ void resetClicked();
+ void restoreDefaultsClicked();
+
+protected:
+ void onCreate(QPlatformDialogHelper *dialog) override;
+ void onShow(QPlatformDialogHelper *dialog) override;
+
+private Q_SLOTS:
+ void handleClick(QPlatformDialogHelper::StandardButton button);
+
+private:
+ QSharedPointer<QMessageDialogOptions> m_options;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformMessageDialog)
+
+#endif // QQUICKPLATFORMMESSAGEDIALOG_P_H
diff --git a/src/imports/platform/qquickplatformstandardpaths.cpp b/src/imports/platform/qquickplatformstandardpaths.cpp
new file mode 100644
index 00000000..004d3c86
--- /dev/null
+++ b/src/imports/platform/qquickplatformstandardpaths.cpp
@@ -0,0 +1,159 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformstandardpaths_p.h"
+
+#include <QtQml/qqmlengine.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype StandardPaths
+ \inherits QtObject
+ \instantiates QQuickPlatformStandardPaths
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief Provides access to the standard system paths.
+
+ The StandardPaths singleton type provides methods for querying the standard
+ system paths. The standard paths are mostly useful in conjunction with the
+ FileDialog and FolderDialog types.
+
+ \qml
+ FileDialog {
+ folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
+ }
+ \endqml
+
+ \labs
+
+ \sa FileDialog, FolderDialog, QStandardPaths
+*/
+
+static QList<QUrl> toUrlList(const QStringList &paths)
+{
+ QList<QUrl> urls;
+ urls.reserve(paths.size());
+ for (const QString &path : paths)
+ urls += QUrl::fromLocalFile(path);
+ return urls;
+}
+
+QQuickPlatformStandardPaths::QQuickPlatformStandardPaths(QObject *parent)
+ : QObject(parent)
+{
+}
+
+QObject *QQuickPlatformStandardPaths::create(QQmlEngine *engine, QJSEngine *scriptEngine)
+{
+ Q_UNUSED(scriptEngine);
+ return new QQuickPlatformStandardPaths(engine);
+}
+
+/*!
+ \qmlmethod string Qt.labs.platform::StandardPaths::displayName(StandardLocation type)
+
+ \sa QStandardPaths::displayName()
+*/
+QString QQuickPlatformStandardPaths::displayName(QStandardPaths::StandardLocation type)
+{
+ return QStandardPaths::displayName(type);
+}
+
+/*!
+ \qmlmethod url Qt.labs.platform::StandardPaths::findExecutable(string executableName, list<string> paths)
+
+ \sa QStandardPaths::findExecutable()
+*/
+QUrl QQuickPlatformStandardPaths::findExecutable(const QString &executableName, const QStringList &paths)
+{
+ return QUrl::fromLocalFile(QStandardPaths::findExecutable(executableName, paths));
+}
+
+/*!
+ \qmlmethod url Qt.labs.platform::StandardPaths::locate(StandardLocation type, string fileName, LocateOptions options = LocateFile)
+
+ \sa QStandardPaths::locate()
+*/
+QUrl QQuickPlatformStandardPaths::locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
+{
+ return QUrl::fromLocalFile(QStandardPaths::locate(type, fileName, options));
+}
+
+/*!
+ \qmlmethod list<url> Qt.labs.platform::StandardPaths::locateAll(StandardLocation type, string fileName, LocateOptions options = LocateFile)
+
+ \sa QStandardPaths::locateAll()
+*/
+QList<QUrl> QQuickPlatformStandardPaths::locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options)
+{
+ return toUrlList(QStandardPaths::locateAll(type, fileName, options));
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::StandardPaths::setTestModeEnabled(bool testMode)
+
+ \sa QStandardPaths::setTestModeEnabled()
+*/
+void QQuickPlatformStandardPaths::setTestModeEnabled(bool testMode)
+{
+ QStandardPaths::setTestModeEnabled(testMode);
+}
+
+/*!
+ \qmlmethod list<url> Qt.labs.platform::StandardPaths::standardLocations(StandardLocation type)
+
+ \sa QStandardPaths::standardLocations()
+*/
+QList<QUrl> QQuickPlatformStandardPaths::standardLocations(QStandardPaths::StandardLocation type)
+{
+ return toUrlList(QStandardPaths::standardLocations(type));
+}
+
+/*!
+ \qmlmethod url Qt.labs.platform::StandardPaths::writableLocation(StandardLocation type)
+
+ \sa QStandardPaths::writableLocation()
+*/
+QUrl QQuickPlatformStandardPaths::writableLocation(QStandardPaths::StandardLocation type)
+{
+ return QUrl::fromLocalFile(QStandardPaths::writableLocation(type));
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformstandardpaths_p.h b/src/imports/platform/qquickplatformstandardpaths_p.h
new file mode 100644
index 00000000..b6504e70
--- /dev/null
+++ b/src/imports/platform/qquickplatformstandardpaths_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMSTANDARDPATHS_P_H
+#define QQUICKPLATFORMSTANDARDPATHS_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/qstandardpaths.h>
+#include <QtCore/qurl.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlEngine;
+class QJSEngine;
+
+class QQuickPlatformStandardPaths : public QObject
+{
+ Q_OBJECT
+ Q_ENUMS(QStandardPaths::StandardLocation QStandardPaths::LocateOptions)
+
+public:
+ explicit QQuickPlatformStandardPaths(QObject *parent = nullptr);
+
+ static QObject *create(QQmlEngine *engine, QJSEngine *scriptEngine);
+
+ Q_INVOKABLE static QString displayName(QStandardPaths::StandardLocation type);
+ Q_INVOKABLE static QUrl findExecutable(const QString &executableName, const QStringList &paths = QStringList());
+ Q_INVOKABLE static QUrl locate(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile);
+ Q_INVOKABLE static QList<QUrl> locateAll(QStandardPaths::StandardLocation type, const QString &fileName, QStandardPaths::LocateOptions options = QStandardPaths::LocateFile);
+ Q_INVOKABLE static void setTestModeEnabled(bool testMode);
+ Q_INVOKABLE static QList<QUrl> standardLocations(QStandardPaths::StandardLocation type);
+ Q_INVOKABLE static QUrl writableLocation(QStandardPaths::StandardLocation type);
+
+private:
+ Q_DISABLE_COPY(QQuickPlatformStandardPaths)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformStandardPaths)
+
+#endif // QQUICKPLATFORMSTANDARDPATHS_P_H
diff --git a/src/imports/platform/qquickplatformsystemtrayicon.cpp b/src/imports/platform/qquickplatformsystemtrayicon.cpp
new file mode 100644
index 00000000..70393c41
--- /dev/null
+++ b/src/imports/platform/qquickplatformsystemtrayicon.cpp
@@ -0,0 +1,441 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qquickplatformsystemtrayicon_p.h"
+#include "qquickplatformmenu_p.h"
+#include "qquickplatformiconloader_p.h"
+
+#include <QtCore/qloggingcategory.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+#include "widgets/qwidgetplatform_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype SystemTrayIcon
+ \inherits QtObject
+ \instantiates QQuickPlatformSystemTrayIcon
+ \inqmlmodule Qt.labs.platform
+ \since 5.8
+ \brief A system tray icon.
+
+ The SystemTrayIcon type provides an icon for an application in the system tray.
+
+ Many desktop platforms provide a special system tray or notification area,
+ where applications can display icons and notification messages.
+
+ \image qtlabsplatform-systemtrayicon.png
+
+ The following example shows how to create a system tray icon, and how to make
+ use of the \l activated() signal:
+
+ \code
+ SystemTrayIcon {
+ visible: true
+ iconSource: "qrc:/images/tray-icon.png"
+
+ onActivated: {
+ window.show()
+ window.raise()
+ window.requestActivate()
+ }
+ }
+ \endcode
+
+ \section2 Tray menu
+
+ SystemTrayIcon can have a menu that opens when the icon is activated.
+
+ \image qtlabsplatform-systemtrayicon-menu.png
+
+ The following example illustrates how to assign a \l Menu to a system tray icon:
+
+ \code
+ SystemTrayIcon {
+ visible: true
+ iconSource: "qrc:/images/tray-icon.png"
+
+ menu: Menu {
+ MenuItem {
+ text: qsTr("Quit")
+ onActivated: Qt.quit()
+ }
+ }
+ }
+ \endcode
+
+ \section2 Notification messages
+
+ SystemTrayIcon can display notification messages.
+
+ \image qtlabsplatform-systemtrayicon-message.png
+
+ The following example presents how to show a notification message using
+ \l showMessage(), and how to make use of the \l messageClicked() signal:
+
+ \code
+ SystemTrayIcon {
+ visible: true
+ iconSource: "qrc:/images/tray-icon.png"
+
+ onMessageClicked: console.log("Message clicked")
+ Component.onCompleted: showMessage("Message title", "Something important came up. Click this to know more.")
+ }
+ \endcode
+
+ \section2 Availability
+
+ A native system tray icon is currently \l available on the following platforms:
+
+ \list
+ \li All window managers and independent tray implementations for X11 that implement the
+ \l{http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html}
+ {freedesktop.org XEmbed system tray specification}.
+ \li All desktop environments that implement the
+ \l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem}
+ {freedesktop.org D-Bus StatusNotifierItem specification}, including recent versions of KDE and Unity.
+ \li All supported versions of macOS. Note that the Growl notification system must be installed
+ for showMessage() to display messages on OS X prior to 10.8 (Mountain Lion).
+ \endlist
+
+ \input includes/widgets.qdocinc 1
+
+ \labs
+
+ \sa Menu
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::SystemTrayIcon::activated(ActivationReason reason)
+
+ This signal is emitted when the system tray icon is activated by the user. The
+ \a reason argument specifies how the system tray icon was activated.
+
+ Available reasons:
+
+ \value SystemTrayIcon.Unknown Unknown reason
+ \value SystemTrayIcon.Context The context menu for the system tray icon was requested
+ \value SystemTrayIcon.DoubleClick The system tray icon was double clicked
+ \value SystemTrayIcon.Trigger The system tray icon was clicked
+ \value SystemTrayIcon.MiddleClick The system tray icon was clicked with the middle mouse button
+*/
+
+/*!
+ \qmlsignal Qt.labs.platform::SystemTrayIcon::messageClicked()
+
+ This signal is emitted when a notification message is clicked by the user.
+
+ \sa showMessage()
+*/
+
+Q_DECLARE_LOGGING_CATEGORY(qtLabsPlatformTray)
+
+QQuickPlatformSystemTrayIcon::QQuickPlatformSystemTrayIcon(QObject *parent)
+ : QObject(parent),
+ m_complete(false),
+ m_visible(false),
+ m_menu(nullptr),
+ m_iconLoader(nullptr),
+ m_handle(nullptr)
+{
+ m_handle = QGuiApplicationPrivate::platformTheme()->createPlatformSystemTrayIcon();
+ if (!m_handle)
+ m_handle = QWidgetPlatform::createSystemTrayIcon(this);
+ qCDebug(qtLabsPlatformTray) << "SystemTrayIcon ->" << m_handle;
+
+ if (m_handle) {
+ connect(m_handle, &QPlatformSystemTrayIcon::activated, this, &QQuickPlatformSystemTrayIcon::activated);
+ connect(m_handle, &QPlatformSystemTrayIcon::messageClicked, this, &QQuickPlatformSystemTrayIcon::messageClicked);
+ }
+}
+
+QQuickPlatformSystemTrayIcon::~QQuickPlatformSystemTrayIcon()
+{
+ if (m_menu)
+ m_menu->setSystemTrayIcon(nullptr);
+ cleanup();
+ delete m_iconLoader;
+ m_iconLoader = nullptr;
+ delete m_handle;
+ m_handle = nullptr;
+}
+
+QPlatformSystemTrayIcon *QQuickPlatformSystemTrayIcon::handle() const
+{
+ return m_handle;
+}
+
+/*!
+ \readonly
+ \qmlproperty bool Qt.labs.platform::SystemTrayIcon::available
+
+ This property holds whether the system tray is available.
+*/
+bool QQuickPlatformSystemTrayIcon::isAvailable() const
+{
+ return m_handle && m_handle->isSystemTrayAvailable();
+}
+
+/*!
+ \readonly
+ \qmlproperty bool Qt.labs.platform::SystemTrayIcon::supportsMessages
+
+ This property holds whether the system tray icon supports notification messages.
+
+ \sa showMessage()
+*/
+bool QQuickPlatformSystemTrayIcon::supportsMessages() const
+{
+ return m_handle && m_handle->supportsMessages();
+}
+
+/*!
+ \qmlproperty bool Qt.labs.platform::SystemTrayIcon::visible
+
+ This property holds whether the system tray icon is visible.
+
+ The default value is \c false.
+*/
+bool QQuickPlatformSystemTrayIcon::isVisible() const
+{
+ return m_visible;
+}
+
+void QQuickPlatformSystemTrayIcon::setVisible(bool visible)
+{
+ if (m_visible == visible)
+ return;
+
+ if (m_handle && m_complete) {
+ if (visible)
+ init();
+ else
+ cleanup();
+ }
+
+ m_visible = visible;
+ emit visibleChanged();
+}
+
+/*!
+ \qmlproperty url Qt.labs.platform::SystemTrayIcon::iconSource
+
+ This property holds the url of the system tray icon.
+
+ \sa iconName
+*/
+QUrl QQuickPlatformSystemTrayIcon::iconSource() const
+{
+ if (!m_iconLoader)
+ return QUrl();
+
+ return m_iconLoader->iconSource();
+}
+
+void QQuickPlatformSystemTrayIcon::setIconSource(const QUrl& source)
+{
+ if (source == iconSource())
+ return;
+
+ iconLoader()->setIconSource(source);
+ emit iconSourceChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::SystemTrayIcon::iconName
+
+ This property holds the theme name of the system tray icon.
+
+ \sa iconSource, QIcon::fromTheme()
+*/
+QString QQuickPlatformSystemTrayIcon::iconName() const
+{
+ if (!m_iconLoader)
+ return QString();
+
+ return m_iconLoader->iconName();
+}
+
+void QQuickPlatformSystemTrayIcon::setIconName(const QString& name)
+{
+ if (name == iconName())
+ return;
+
+ iconLoader()->setIconName(name);
+ emit iconNameChanged();
+}
+
+/*!
+ \qmlproperty string Qt.labs.platform::SystemTrayIcon::tooltip
+
+ This property holds the tooltip of the system tray icon.
+*/
+QString QQuickPlatformSystemTrayIcon::tooltip() const
+{
+ return m_tooltip;
+}
+
+void QQuickPlatformSystemTrayIcon::setTooltip(const QString &tooltip)
+{
+ if (m_tooltip == tooltip)
+ return;
+
+ if (m_handle && m_complete)
+ m_handle->updateToolTip(tooltip);
+
+ m_tooltip = tooltip;
+ emit tooltipChanged();
+}
+
+/*!
+ \qmlproperty Menu Qt.labs.platform::SystemTrayIcon::menu
+
+ This property holds a menu for the system tray icon.
+*/
+QQuickPlatformMenu *QQuickPlatformSystemTrayIcon::menu() const
+{
+ return m_menu;
+}
+
+void QQuickPlatformSystemTrayIcon::setMenu(QQuickPlatformMenu *menu)
+{
+ if (m_menu == menu)
+ return;
+
+ if (m_menu)
+ m_menu->setSystemTrayIcon(nullptr);
+ if (menu) {
+ menu->setSystemTrayIcon(this);
+ if (m_handle && m_complete && menu->create())
+ m_handle->updateMenu(menu->handle());
+ }
+
+ m_menu = menu;
+ emit menuChanged();
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::SystemTrayIcon::show()
+
+ Shows the system tray icon.
+*/
+void QQuickPlatformSystemTrayIcon::show()
+{
+ setVisible(true);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::SystemTrayIcon::hide()
+
+ Hides the system tray icon.
+*/
+void QQuickPlatformSystemTrayIcon::hide()
+{
+ setVisible(false);
+}
+
+/*!
+ \qmlmethod void Qt.labs.platform::SystemTrayIcon::showMessage(string title, string message, MessageIcon icon, int msecs)
+
+ Shows a system tray message with the given \a title, \a message and \a icon
+ for the time specified in \a msecs.
+
+ \note System tray messages are dependent on the system configuration and user preferences,
+ and may not appear at all. Therefore, it should not be relied upon as the sole means for providing
+ critical information.
+
+ \sa supportsMessages, messageClicked()
+*/
+void QQuickPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg, QPlatformSystemTrayIcon::MessageIcon icon, int msecs)
+{
+ if (m_handle)
+ m_handle->showMessage(title, msg, QIcon(), icon, msecs);
+}
+
+void QQuickPlatformSystemTrayIcon::init()
+{
+ if (!m_handle)
+ return;
+
+ m_handle->init();
+ if (m_menu && m_menu->create())
+ m_handle->updateMenu(m_menu->handle());
+ m_handle->updateToolTip(m_tooltip);
+ if (m_iconLoader)
+ m_iconLoader->setEnabled(true);
+}
+
+void QQuickPlatformSystemTrayIcon::cleanup()
+{
+ if (m_handle)
+ m_handle->cleanup();
+ if (m_iconLoader)
+ m_iconLoader->setEnabled(false);
+}
+
+void QQuickPlatformSystemTrayIcon::classBegin()
+{
+}
+
+void QQuickPlatformSystemTrayIcon::componentComplete()
+{
+ m_complete = true;
+ if (m_visible)
+ init();
+}
+
+QQuickPlatformIconLoader *QQuickPlatformSystemTrayIcon::iconLoader() const
+{
+ if (!m_iconLoader) {
+ QQuickPlatformSystemTrayIcon *that = const_cast<QQuickPlatformSystemTrayIcon *>(this);
+ static int slot = staticMetaObject.indexOfSlot("updateIcon()");
+ m_iconLoader = new QQuickPlatformIconLoader(slot, that);
+ m_iconLoader->setEnabled(m_complete);
+ }
+ return m_iconLoader;
+}
+
+void QQuickPlatformSystemTrayIcon::updateIcon()
+{
+ if (!m_handle || !m_iconLoader)
+ return;
+
+ m_handle->updateIcon(m_iconLoader->icon());
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformsystemtrayicon_p.h b/src/imports/platform/qquickplatformsystemtrayicon_p.h
new file mode 100644
index 00000000..12597c72
--- /dev/null
+++ b/src/imports/platform/qquickplatformsystemtrayicon_p.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QQUICKPLATFORMSYSTEMTRAYICON_P_H
+#define QQUICKPLATFORMSYSTEMTRAYICON_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 <QtGui/qpa/qplatformsystemtrayicon.h>
+#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqml.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPlatformMenu;
+class QQuickPlatformIconLoader;
+
+class QQuickPlatformSystemTrayIcon : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_INTERFACES(QQmlParserStatus)
+ Q_PROPERTY(bool available READ isAvailable CONSTANT FINAL)
+ Q_PROPERTY(bool supportsMessages READ supportsMessages CONSTANT FINAL)
+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged FINAL)
+ Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged FINAL)
+ Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
+ Q_PROPERTY(QString tooltip READ tooltip WRITE setTooltip NOTIFY tooltipChanged FINAL)
+ Q_PROPERTY(QQuickPlatformMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
+ Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason QPlatformSystemTrayIcon::MessageIcon)
+
+public:
+ explicit QQuickPlatformSystemTrayIcon(QObject *parent = nullptr);
+ ~QQuickPlatformSystemTrayIcon();
+
+ QPlatformSystemTrayIcon *handle() const;
+
+ bool isAvailable() const;
+ bool supportsMessages() const;
+
+ bool isVisible() const;
+ void setVisible(bool visible);
+
+ QUrl iconSource() const;
+ void setIconSource(const QUrl &source);
+
+ QString iconName() const;
+ void setIconName(const QString &name);
+
+ QString tooltip() const;
+ void setTooltip(const QString &tooltip);
+
+ QQuickPlatformMenu *menu() const;
+ void setMenu(QQuickPlatformMenu *menu);
+
+public Q_SLOTS:
+ void show();
+ void hide();
+
+ void showMessage(const QString &title, const QString &message,
+ QPlatformSystemTrayIcon::MessageIcon iconType = QPlatformSystemTrayIcon::Information, int msecs = 10000);
+
+Q_SIGNALS:
+ void activated(QPlatformSystemTrayIcon::ActivationReason reason);
+ void messageClicked();
+ void visibleChanged();
+ void iconSourceChanged();
+ void iconNameChanged();
+ void tooltipChanged();
+ void menuChanged();
+
+protected:
+ void init();
+ void cleanup();
+
+ void classBegin() override;
+ void componentComplete() override;
+
+ QQuickPlatformIconLoader *iconLoader() const;
+
+private Q_SLOTS:
+ void updateIcon();
+
+private:
+ bool m_complete;
+ bool m_visible;
+ QString m_tooltip;
+ QQuickPlatformMenu *m_menu;
+ mutable QQuickPlatformIconLoader *m_iconLoader;
+ QPlatformSystemTrayIcon *m_handle;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPlatformSystemTrayIcon)
+
+#endif // QQUICKPLATFORMSYSTEMTRAYICON_P_H
diff --git a/src/imports/platform/qtlabsplatformplugin.cpp b/src/imports/platform/qtlabsplatformplugin.cpp
new file mode 100644
index 00000000..f73b04e8
--- /dev/null
+++ b/src/imports/platform/qtlabsplatformplugin.cpp
@@ -0,0 +1,115 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 <QtQml/qqml.h>
+#include <QtCore/qloggingcategory.h>
+
+#include "qquickplatformdialog_p.h"
+#include "qquickplatformcolordialog_p.h"
+#include "qquickplatformfiledialog_p.h"
+#include "qquickplatformfolderdialog_p.h"
+#include "qquickplatformfontdialog_p.h"
+#include "qquickplatformmessagedialog_p.h"
+
+#include "qquickplatformmenu_p.h"
+#include "qquickplatformmenubar_p.h"
+#include "qquickplatformmenuitem_p.h"
+#include "qquickplatformmenuitemgroup_p.h"
+#include "qquickplatformmenuseparator_p.h"
+
+#include "qquickplatformstandardpaths_p.h"
+
+#include "qquickplatformsystemtrayicon_p.h"
+
+Q_DECLARE_METATYPE(QStandardPaths::StandardLocation)
+Q_DECLARE_METATYPE(QStandardPaths::LocateOptions)
+
+static inline void initResources()
+{
+#ifdef QT_STATIC
+ Q_INIT_RESOURCE(qmake_Qt_labs_platform);
+#endif
+}
+
+QT_BEGIN_NAMESPACE
+
+Q_LOGGING_CATEGORY(qtLabsPlatformDialogs, "qt.labs.platform.dialogs")
+Q_LOGGING_CATEGORY(qtLabsPlatformMenus, "qt.labs.platform.menus")
+Q_LOGGING_CATEGORY(qtLabsPlatformTray, "qt.labs.platform.tray")
+
+class QtLabsPlatformPlugin: public QQmlExtensionPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
+
+public:
+ QtLabsPlatformPlugin(QObject *parent = nullptr);
+ void registerTypes(const char *uri) override;
+};
+
+QtLabsPlatformPlugin::QtLabsPlatformPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
+{
+ initResources();
+}
+
+void QtLabsPlatformPlugin::registerTypes(const char *uri)
+{
+ qmlRegisterUncreatableType<QQuickPlatformDialog>(uri, 1, 0, "Dialog", QQuickPlatformDialog::tr("Dialog is an abstract base class"));
+ qmlRegisterType<QQuickPlatformColorDialog>(uri, 1, 0, "ColorDialog");
+ qmlRegisterType<QQuickPlatformFileDialog>(uri, 1, 0, "FileDialog");
+ qmlRegisterType<QQuickPlatformFileNameFilter>();
+ qmlRegisterType<QQuickPlatformFolderDialog>(uri, 1, 0, "FolderDialog");
+ qmlRegisterType<QQuickPlatformFontDialog>(uri, 1, 0, "FontDialog");
+ qmlRegisterType<QQuickPlatformMessageDialog>(uri, 1, 0, "MessageDialog");
+
+ qmlRegisterType<QQuickPlatformMenu>(uri, 1, 0, "Menu");
+ qmlRegisterType<QQuickPlatformMenuBar>(uri, 1, 0, "MenuBar");
+ qmlRegisterType<QQuickPlatformMenuItem>(uri, 1, 0, "MenuItem");
+ qmlRegisterType<QQuickPlatformMenuItemGroup>(uri, 1, 0, "MenuItemGroup");
+ qmlRegisterType<QQuickPlatformMenuSeparator>(uri, 1, 0, "MenuSeparator");
+
+ qmlRegisterUncreatableType<QPlatformDialogHelper>(uri, 1, 0, "StandardButton", QQuickPlatformDialog::tr("Cannot create an instance of StandardButton"));
+ qmlRegisterSingletonType<QQuickPlatformStandardPaths>(uri, 1, 0, "StandardPaths", QQuickPlatformStandardPaths::create);
+ qRegisterMetaType<QStandardPaths::StandardLocation>();
+ qRegisterMetaType<QStandardPaths::LocateOptions>();
+
+ qmlRegisterType<QQuickPlatformSystemTrayIcon>(uri, 1, 0, "SystemTrayIcon");
+}
+
+QT_END_NAMESPACE
+
+#include "qtlabsplatformplugin.moc"
diff --git a/src/imports/platform/widgets/qwidgetplatform_p.h b/src/imports/platform/widgets/qwidgetplatform_p.h
new file mode 100644
index 00000000..06dcc9d3
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatform_p.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORM_P_H
+#define QWIDGETPLATFORM_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/qdebug.h>
+#include <QtCore/qcoreapplication.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+#include <QtGui/qpa/qplatformsystemtrayicon.h>
+#include <QtGui/qpa/qplatformmenu.h>
+
+#ifdef QT_WIDGETS_LIB
+#include "qwidgetplatformcolordialog_p.h"
+#include "qwidgetplatformfiledialog_p.h"
+#include "qwidgetplatformfontdialog_p.h"
+#include "qwidgetplatformmessagedialog_p.h"
+#include "qwidgetplatformmenu_p.h"
+#include "qwidgetplatformmenuitem_p.h"
+#include "qwidgetplatformsystemtrayicon_p.h"
+#endif
+
+QT_BEGIN_NAMESPACE
+
+#ifndef QT_WIDGETS_LIB
+typedef QPlatformMenu QWidgetPlatformMenu;
+typedef QPlatformMenuItem QWidgetPlatformMenuItem;
+typedef QPlatformColorDialogHelper QWidgetPlatformColorDialog;
+typedef QPlatformFileDialogHelper QWidgetPlatformFileDialog;
+typedef QPlatformFontDialogHelper QWidgetPlatformFontDialog;
+typedef QPlatformMessageDialogHelper QWidgetPlatformMessageDialog;
+typedef QPlatformSystemTrayIcon QWidgetPlatformSystemTrayIcon;
+#endif
+
+namespace QWidgetPlatform
+{
+ static inline bool isAvailable(const char *type)
+ {
+ if (!qApp->inherits("QApplication")) {
+ qCritical("\nERROR: No native %s implementation available."
+ "\nQt Labs Platform requires Qt Widgets on this setup."
+ "\nAdd 'QT += widgets' to .pro and create QApplication in main().\n", type);
+ return false;
+ }
+ return true;
+ }
+
+ template<typename T>
+ static inline T *createWidget(const char *name, QObject *parent)
+ {
+ static bool available = isAvailable(name);
+#ifdef QT_WIDGETS_LIB
+ if (available)
+ return new T(parent);
+#else
+ Q_UNUSED(parent)
+ Q_UNUSED(available)
+#endif
+ return nullptr;
+ }
+
+ static inline QPlatformMenu *createMenu(QObject *parent = nullptr) { return createWidget<QWidgetPlatformMenu>("Menu", parent); }
+ static inline QPlatformMenuItem *createMenuItem(QObject *parent = nullptr) { return createWidget<QWidgetPlatformMenuItem>("MenuItem", parent); }
+ static inline QPlatformSystemTrayIcon *createSystemTrayIcon(QObject *parent = nullptr) { return createWidget<QWidgetPlatformSystemTrayIcon>("SystemTrayIcon", parent); }
+ static inline QPlatformDialogHelper *createDialog(QPlatformTheme::DialogType type, QObject *parent = nullptr)
+ {
+ switch (type) {
+ case QPlatformTheme::ColorDialog: return createWidget<QWidgetPlatformColorDialog>("ColorDialog", parent);
+ case QPlatformTheme::FileDialog: return createWidget<QWidgetPlatformFileDialog>("FileDialog", parent);
+ case QPlatformTheme::FontDialog: return createWidget<QWidgetPlatformFontDialog>("FontDialog", parent);
+ case QPlatformTheme::MessageDialog: return createWidget<QWidgetPlatformMessageDialog>("MessageDialog", parent);
+ default: Q_UNREACHABLE(); break;
+ return nullptr;
+ }
+ }
+}
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORM_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformcolordialog.cpp b/src/imports/platform/widgets/qwidgetplatformcolordialog.cpp
new file mode 100644
index 00000000..69a76eb2
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformcolordialog.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformcolordialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qcolordialog.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformColorDialog::QWidgetPlatformColorDialog(QObject *parent)
+ : m_dialog(new QColorDialog)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QColorDialog::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QColorDialog::rejected, this, &QPlatformDialogHelper::reject);
+ connect(m_dialog.data(), &QColorDialog::currentColorChanged, this, &QPlatformColorDialogHelper::currentColorChanged);
+}
+
+QWidgetPlatformColorDialog::~QWidgetPlatformColorDialog()
+{
+}
+
+QColor QWidgetPlatformColorDialog::currentColor() const
+{
+ return m_dialog->currentColor();
+}
+
+void QWidgetPlatformColorDialog::setCurrentColor(const QColor &color)
+{
+ m_dialog->setCurrentColor(color);
+}
+
+void QWidgetPlatformColorDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformColorDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QColorDialogOptions> options = QPlatformColorDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setOptions(static_cast<QColorDialog::ColorDialogOptions>(int(options->options())) | QColorDialog::DontUseNativeDialog);
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformColorDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformcolordialog_p.h b/src/imports/platform/widgets/qwidgetplatformcolordialog_p.h
new file mode 100644
index 00000000..14bbcd1f
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformcolordialog_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMCOLORDIALOG_P_H
+#define QWIDGETPLATFORMCOLORDIALOG_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/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QColorDialog;
+
+class QWidgetPlatformColorDialog : public QPlatformColorDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformColorDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformColorDialog();
+
+ QColor currentColor() const override;
+ void setCurrentColor(const QColor &color) override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QColorDialog> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMCOLORDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformdialog.cpp b/src/imports/platform/widgets/qwidgetplatformdialog.cpp
new file mode 100644
index 00000000..ebca7ea8
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformdialog.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformdialog_p.h"
+
+#include <QtGui/qwindow.h>
+#include <QtWidgets/qdialog.h>
+
+QT_BEGIN_NAMESPACE
+
+bool QWidgetPlatformDialog::show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ dialog->setWindowFlags(flags);
+ dialog->setWindowModality(modality);
+
+ dialog->createWinId();
+ QWindow *handle = dialog->windowHandle();
+ Q_ASSERT(handle);
+ handle->setTransientParent(const_cast<QWindow *>(parent));
+
+ dialog->show();
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformdialog_p.h b/src/imports/platform/widgets/qwidgetplatformdialog_p.h
new file mode 100644
index 00000000..efc99b85
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformdialog_p.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMDIALOG_P_H
+#define QWIDGETPLATFORMDIALOG_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>
+
+QT_BEGIN_NAMESPACE
+
+class QDialog;
+class QWindow;
+
+class QWidgetPlatformDialog
+{
+public:
+ static bool show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent);
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformfiledialog.cpp b/src/imports/platform/widgets/qwidgetplatformfiledialog.cpp
new file mode 100644
index 00000000..772443a5
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfiledialog.cpp
@@ -0,0 +1,140 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformfiledialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qfiledialog.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformFileDialog::QWidgetPlatformFileDialog(QObject *parent)
+ : m_dialog(new QFileDialog)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QDialog::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QDialog::rejected, this, &QPlatformDialogHelper::reject);
+
+ connect(m_dialog.data(), &QFileDialog::fileSelected, [this](const QString &file) {
+ emit fileSelected(QUrl::fromLocalFile(file));
+ });
+ connect(m_dialog.data(), &QFileDialog::filesSelected, [this](const QList<QString> &files) {
+ QList<QUrl> urls;
+ urls.reserve(files.count());
+ for (const QString &file : files)
+ urls += QUrl::fromLocalFile(file);
+ emit filesSelected(urls);
+ });
+ connect(m_dialog.data(), &QFileDialog::currentChanged, [this](const QString &path) {
+ emit currentChanged(QUrl::fromLocalFile(path));
+ });
+ connect(m_dialog.data(), &QFileDialog::directoryEntered, this, &QWidgetPlatformFileDialog::directoryEntered);
+ connect(m_dialog.data(), &QFileDialog::filterSelected, this, &QWidgetPlatformFileDialog::filterSelected);
+}
+
+QWidgetPlatformFileDialog::~QWidgetPlatformFileDialog()
+{
+}
+
+bool QWidgetPlatformFileDialog::defaultNameFilterDisables() const
+{
+ return false; // TODO: ?
+}
+
+void QWidgetPlatformFileDialog::setDirectory(const QUrl &directory)
+{
+ m_dialog->setDirectory(directory.toLocalFile());
+}
+
+QUrl QWidgetPlatformFileDialog::directory() const
+{
+ return m_dialog->directoryUrl();
+}
+
+void QWidgetPlatformFileDialog::selectFile(const QUrl &filename)
+{
+ m_dialog->selectUrl(filename);
+}
+
+QList<QUrl> QWidgetPlatformFileDialog::selectedFiles() const
+{
+ return m_dialog->selectedUrls();
+}
+
+void QWidgetPlatformFileDialog::setFilter()
+{
+ // TODO: ?
+}
+
+void QWidgetPlatformFileDialog::selectNameFilter(const QString &filter)
+{
+ m_dialog->selectNameFilter(filter);
+}
+
+QString QWidgetPlatformFileDialog::selectedNameFilter() const
+{
+ return m_dialog->selectedNameFilter();
+}
+
+void QWidgetPlatformFileDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformFileDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QFileDialogOptions> options = QPlatformFileDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setAcceptMode(static_cast<QFileDialog::AcceptMode>(options->acceptMode()));
+ m_dialog->setFileMode(static_cast<QFileDialog::FileMode>(options->fileMode()));
+ m_dialog->setOptions(static_cast<QFileDialog::Options>(int(options->options())) | QFileDialog::DontUseNativeDialog);
+ m_dialog->setNameFilters(options->nameFilters());
+ m_dialog->setDefaultSuffix(options->defaultSuffix());
+ if (options->isLabelExplicitlySet(QFileDialogOptions::Accept))
+ m_dialog->setLabelText(QFileDialog::Accept, options->labelText(QFileDialogOptions::Accept));
+ if (options->isLabelExplicitlySet(QFileDialogOptions::Reject))
+ m_dialog->setLabelText(QFileDialog::Reject, options->labelText(QFileDialogOptions::Reject));
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformFileDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformfiledialog_p.h b/src/imports/platform/widgets/qwidgetplatformfiledialog_p.h
new file mode 100644
index 00000000..743bc571
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfiledialog_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMFILEDIALOG_P_H
+#define QWIDGETPLATFORMFILEDIALOG_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/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFileDialog;
+
+class QWidgetPlatformFileDialog : public QPlatformFileDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformFileDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformFileDialog();
+
+ bool defaultNameFilterDisables() const override;
+ void setDirectory(const QUrl &directory) override;
+ QUrl directory() const override;
+ void selectFile(const QUrl &filename) override;
+ QList<QUrl> selectedFiles() const override;
+ void setFilter() override;
+ void selectNameFilter(const QString &filter) override;
+ QString selectedNameFilter() const override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QFileDialog> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMFILEDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformfontdialog.cpp b/src/imports/platform/widgets/qwidgetplatformfontdialog.cpp
new file mode 100644
index 00000000..d2b6c539
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfontdialog.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformfontdialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qfontdialog.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformFontDialog::QWidgetPlatformFontDialog(QObject *parent)
+ : m_dialog(new QFontDialog)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QFontDialog::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QFontDialog::rejected, this, &QPlatformDialogHelper::reject);
+ connect(m_dialog.data(), &QFontDialog::currentFontChanged, this, &QPlatformFontDialogHelper::currentFontChanged);
+}
+
+QWidgetPlatformFontDialog::~QWidgetPlatformFontDialog()
+{
+}
+
+QFont QWidgetPlatformFontDialog::currentFont() const
+{
+ return m_dialog->currentFont();
+}
+
+void QWidgetPlatformFontDialog::setCurrentFont(const QFont &font)
+{
+ m_dialog->setCurrentFont(font);
+}
+
+void QWidgetPlatformFontDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformFontDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QFontDialogOptions> options = QPlatformFontDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setOptions(static_cast<QFontDialog::FontDialogOptions>(int(options->options())) | QFontDialog::DontUseNativeDialog);
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformFontDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformfontdialog_p.h b/src/imports/platform/widgets/qwidgetplatformfontdialog_p.h
new file mode 100644
index 00000000..97d5463d
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformfontdialog_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMFONTDIALOG_P_H
+#define QWIDGETPLATFORMFONTDIALOG_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/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QFontDialog;
+
+class QWidgetPlatformFontDialog : public QPlatformFontDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformFontDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformFontDialog();
+
+ QFont currentFont() const override;
+ void setCurrentFont(const QFont &font) override;
+
+ void exec() override;
+ bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QFontDialog> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMFONTDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformmenu.cpp b/src/imports/platform/widgets/qwidgetplatformmenu.cpp
new file mode 100644
index 00000000..d9ecb16f
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenu.cpp
@@ -0,0 +1,186 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformmenu_p.h"
+#include "qwidgetplatformmenuitem_p.h"
+
+#include <QtGui/qwindow.h>
+#include <QtWidgets/qmenu.h>
+#include <QtWidgets/qaction.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformMenu::QWidgetPlatformMenu(QObject *parent)
+ : m_menu(new QMenu)
+{
+ setParent(parent);
+
+ connect(m_menu.data(), &QMenu::aboutToShow, this, &QPlatformMenu::aboutToShow);
+ connect(m_menu.data(), &QMenu::aboutToHide, this, &QPlatformMenu::aboutToHide);
+}
+
+QWidgetPlatformMenu::~QWidgetPlatformMenu()
+{
+}
+
+QMenu *QWidgetPlatformMenu::menu() const
+{
+ return m_menu.data();
+}
+
+void QWidgetPlatformMenu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before)
+{
+ QWidgetPlatformMenuItem *widgetItem = qobject_cast<QWidgetPlatformMenuItem *>(item);
+ if (!widgetItem)
+ return;
+
+ QWidgetPlatformMenuItem *widgetBefore = qobject_cast<QWidgetPlatformMenuItem *>(before);
+ m_menu->insertAction(widgetBefore ? widgetBefore->action() : nullptr, widgetItem->action());
+}
+
+void QWidgetPlatformMenu::removeMenuItem(QPlatformMenuItem *item)
+{
+ QWidgetPlatformMenuItem *widgetItem = qobject_cast<QWidgetPlatformMenuItem *>(item);
+ if (!widgetItem)
+ return;
+
+ m_menu->removeAction(widgetItem->action());
+}
+
+void QWidgetPlatformMenu::syncMenuItem(QPlatformMenuItem *item)
+{
+ Q_UNUSED(item);
+}
+
+void QWidgetPlatformMenu::syncSeparatorsCollapsible(bool enable)
+{
+ Q_UNUSED(enable);
+}
+
+quintptr QWidgetPlatformMenu::tag() const
+{
+ return 0;
+}
+
+void QWidgetPlatformMenu::setTag(quintptr tag)
+{
+ Q_UNUSED(tag);
+}
+
+void QWidgetPlatformMenu::setText(const QString &text)
+{
+ m_menu->setTitle(text);
+}
+
+void QWidgetPlatformMenu::setIcon(const QIcon &icon)
+{
+ m_menu->setIcon(icon);
+}
+
+void QWidgetPlatformMenu::setEnabled(bool enabled)
+{
+ m_menu->menuAction()->setEnabled(enabled);
+}
+
+bool QWidgetPlatformMenu::isEnabled() const
+{
+ return m_menu->menuAction()->isEnabled();
+}
+
+void QWidgetPlatformMenu::setVisible(bool visible)
+{
+ m_menu->menuAction()->setVisible(visible);
+}
+
+void QWidgetPlatformMenu::setMinimumWidth(int width)
+{
+ if (width > 0)
+ m_menu->setMinimumWidth(width);
+}
+
+void QWidgetPlatformMenu::setFont(const QFont &font)
+{
+ m_menu->setFont(font);
+}
+
+void QWidgetPlatformMenu::setMenuType(MenuType type)
+{
+ Q_UNUSED(type);
+}
+
+void QWidgetPlatformMenu::showPopup(const QWindow *window, const QRect &targetRect, const QPlatformMenuItem *item)
+{
+ m_menu->createWinId();
+ QWindow *handle = m_menu->windowHandle();
+ Q_ASSERT(handle);
+ handle->setTransientParent(const_cast<QWindow *>(window));
+
+ QPoint targetPos = targetRect.bottomLeft();
+ if (window)
+ targetPos = window->mapToGlobal(targetPos);
+
+ const QWidgetPlatformMenuItem *widgetItem = qobject_cast<const QWidgetPlatformMenuItem *>(item);
+ m_menu->popup(targetPos, widgetItem ? widgetItem->action() : nullptr);
+}
+
+void QWidgetPlatformMenu::dismiss()
+{
+ m_menu->close();
+}
+
+QPlatformMenuItem *QWidgetPlatformMenu::menuItemAt(int position) const
+{
+ Q_UNUSED(position);
+ return nullptr;
+}
+
+QPlatformMenuItem *QWidgetPlatformMenu::menuItemForTag(quintptr tag) const
+{
+ Q_UNUSED(tag);
+ return nullptr;
+}
+
+QPlatformMenuItem *QWidgetPlatformMenu::createMenuItem() const
+{
+ return nullptr;
+}
+
+QPlatformMenu *QWidgetPlatformMenu::createSubMenu() const
+{
+ return nullptr;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenu_p.h b/src/imports/platform/widgets/qwidgetplatformmenu_p.h
new file mode 100644
index 00000000..56ea7a45
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenu_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMMENU_P_H
+#define QWIDGETPLATFORMMENU_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/qplatformmenu.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMenu;
+
+class QWidgetPlatformMenu : public QPlatformMenu
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformMenu(QObject *parent = nullptr);
+ ~QWidgetPlatformMenu();
+
+ QMenu *menu() const;
+
+ void insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before) override;
+ void removeMenuItem(QPlatformMenuItem *item) override;
+ void syncMenuItem(QPlatformMenuItem *item) override;
+ void syncSeparatorsCollapsible(bool enable) override;
+
+ quintptr tag()const override;
+ void setTag(quintptr tag) override;
+
+ void setText(const QString &text) override;
+ void setIcon(const QIcon &icon) override;
+ void setEnabled(bool enabled) override;
+ bool isEnabled() const override;
+ void setVisible(bool visible) override;
+ void setMinimumWidth(int width) override;
+ void setFont(const QFont &font) override;
+ void setMenuType(MenuType type) override;
+
+ void showPopup(const QWindow *window, const QRect &targetRect, const QPlatformMenuItem *item) override;
+ void dismiss() override;
+
+ QPlatformMenuItem *menuItemAt(int position) const override;
+ QPlatformMenuItem *menuItemForTag(quintptr tag) const override;
+
+ QPlatformMenuItem *createMenuItem() const override;
+ QPlatformMenu *createSubMenu() const override;
+
+private:
+ QScopedPointer<QMenu> m_menu;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMMENU_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp b/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
new file mode 100644
index 00000000..4d168f7a
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenuitem.cpp
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformmenuitem_p.h"
+
+#include <QtWidgets/qmenu.h>
+#include <QtWidgets/qaction.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformMenuItem::QWidgetPlatformMenuItem(QObject *parent)
+ : m_action(new QAction)
+{
+ setParent(parent);
+ connect(m_action.data(), &QAction::hovered, this, &QPlatformMenuItem::hovered);
+ connect(m_action.data(), &QAction::triggered, this, &QPlatformMenuItem::activated);
+}
+
+QWidgetPlatformMenuItem::~QWidgetPlatformMenuItem()
+{
+}
+
+QAction *QWidgetPlatformMenuItem::action() const
+{
+ return m_action.data();
+}
+
+quintptr QWidgetPlatformMenuItem::tag() const
+{
+ return 0;
+}
+
+void QWidgetPlatformMenuItem::setTag(quintptr tag)
+{
+ Q_UNUSED(tag);
+}
+
+void QWidgetPlatformMenuItem::setText(const QString &text)
+{
+ m_action->setText(text);
+}
+
+void QWidgetPlatformMenuItem::setIcon(const QIcon &icon)
+{
+ m_action->setIcon(icon);
+}
+
+void QWidgetPlatformMenuItem::setMenu(QPlatformMenu *menu)
+{
+ m_action->setMenu(qobject_cast<QMenu *>(menu));
+}
+
+void QWidgetPlatformMenuItem::setVisible(bool visible)
+{
+ m_action->setVisible(visible);
+}
+
+void QWidgetPlatformMenuItem::setIsSeparator(bool separator)
+{
+ m_action->setSeparator(separator);
+}
+
+void QWidgetPlatformMenuItem::setFont(const QFont &font)
+{
+ m_action->setFont(font);
+}
+
+void QWidgetPlatformMenuItem::setRole(MenuRole role)
+{
+ m_action->setMenuRole(static_cast<QAction::MenuRole>(role));
+}
+
+void QWidgetPlatformMenuItem::setCheckable(bool checkable)
+{
+ m_action->setCheckable(checkable);
+}
+
+void QWidgetPlatformMenuItem::setChecked(bool checked)
+{
+ m_action->setChecked(checked);
+}
+
+void QWidgetPlatformMenuItem::setShortcut(const QKeySequence &shortcut)
+{
+ m_action->setShortcut(shortcut);
+}
+
+void QWidgetPlatformMenuItem::setEnabled(bool enabled)
+{
+ m_action->setEnabled(enabled);
+}
+
+void QWidgetPlatformMenuItem::setIconSize(int size)
+{
+ Q_UNUSED(size);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h b/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
new file mode 100644
index 00000000..d1a08187
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmenuitem_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMMENUITEM_P_H
+#define QWIDGETPLATFORMMENUITEM_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/qplatformmenu.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAction;
+
+class QWidgetPlatformMenuItem : public QPlatformMenuItem
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformMenuItem(QObject *parent = nullptr);
+ ~QWidgetPlatformMenuItem();
+
+ QAction *action() const;
+
+ quintptr tag()const override;
+ void setTag(quintptr tag) override;
+
+ void setText(const QString &text) override;
+ void setIcon(const QIcon &icon) override;
+ void setMenu(QPlatformMenu *menu) override;
+ void setVisible(bool visible) override;
+ void setIsSeparator(bool separator) override;
+ void setFont(const QFont &font) override;
+ void setRole(MenuRole role) override;
+ void setCheckable(bool checkable) override;
+ void setChecked(bool checked) override;
+ void setShortcut(const QKeySequence& shortcut) override;
+ void setEnabled(bool enabled) override;
+ void setIconSize(int size) override;
+
+private:
+ QScopedPointer<QAction> m_action;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMMENUITEM_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp b/src/imports/platform/widgets/qwidgetplatformmessagedialog.cpp
new file mode 100644
index 00000000..b546e534
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmessagedialog.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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformmessagedialog_p.h"
+#include "qwidgetplatformdialog_p.h"
+
+#include <QtWidgets/qmessagebox.h>
+#include <QtWidgets/qabstractbutton.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformMessageDialog::QWidgetPlatformMessageDialog(QObject *parent)
+ : m_dialog(new QMessageBox)
+{
+ setParent(parent);
+
+ connect(m_dialog.data(), &QMessageBox::accepted, this, &QPlatformDialogHelper::accept);
+ connect(m_dialog.data(), &QMessageBox::rejected, this, &QPlatformDialogHelper::reject);
+ connect(m_dialog.data(), &QMessageBox::buttonClicked, [this](QAbstractButton *button) {
+ QMessageBox::ButtonRole role = m_dialog->buttonRole(button);
+ QMessageBox::StandardButton standardButton = m_dialog->standardButton(button);
+ emit clicked(static_cast<StandardButton>(standardButton), static_cast<ButtonRole>(role));
+ });
+}
+
+QWidgetPlatformMessageDialog::~QWidgetPlatformMessageDialog()
+{
+}
+void QWidgetPlatformMessageDialog::exec()
+{
+ m_dialog->exec();
+}
+
+bool QWidgetPlatformMessageDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent)
+{
+ QSharedPointer<QMessageDialogOptions> options = QPlatformMessageDialogHelper::options();
+ m_dialog->setWindowTitle(options->windowTitle());
+ m_dialog->setIcon(static_cast<QMessageBox::Icon>(options->icon()));
+ m_dialog->setText(options->text());
+ m_dialog->setInformativeText(options->informativeText());
+ m_dialog->setDetailedText(options->detailedText());
+ m_dialog->setStandardButtons(static_cast<QMessageBox::StandardButtons>(int(options->standardButtons())));
+
+ return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent);
+}
+
+void QWidgetPlatformMessageDialog::hide()
+{
+ m_dialog->hide();
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h b/src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h
new file mode 100644
index 00000000..319bb34d
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformmessagedialog_p.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMMESSAGEDIALOG_P_H
+#define QWIDGETPLATFORMMESSAGEDIALOG_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/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QMessageBox;
+
+class QWidgetPlatformMessageDialog : public QPlatformMessageDialogHelper
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformMessageDialog(QObject *parent = nullptr);
+ ~QWidgetPlatformMessageDialog();
+
+ void exec() override;
+ bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override;
+ void hide() override;
+
+private:
+ QScopedPointer<QMessageBox> m_dialog;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMMESSAGEDIALOG_P_H
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
new file mode 100644
index 00000000..cfee02aa
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 "qwidgetplatformsystemtrayicon_p.h"
+#include "qwidgetplatformmenu_p.h"
+
+#include <QtWidgets/qsystemtrayicon.h>
+
+QT_BEGIN_NAMESPACE
+
+QWidgetPlatformSystemTrayIcon::QWidgetPlatformSystemTrayIcon(QObject *parent)
+ : m_systray(new QSystemTrayIcon)
+{
+ setParent(parent);
+
+ connect(m_systray.data(), &QSystemTrayIcon::messageClicked, this, &QPlatformSystemTrayIcon::messageClicked);
+ connect(m_systray.data(), &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) {
+ emit activated(static_cast<ActivationReason>(reason));
+ });
+}
+
+QWidgetPlatformSystemTrayIcon::~QWidgetPlatformSystemTrayIcon()
+{
+}
+
+void QWidgetPlatformSystemTrayIcon::init()
+{
+ m_systray->show();
+}
+
+void QWidgetPlatformSystemTrayIcon::cleanup()
+{
+ m_systray->hide();
+}
+
+void QWidgetPlatformSystemTrayIcon::updateIcon(const QIcon &icon)
+{
+ m_systray->setIcon(icon);
+}
+
+void QWidgetPlatformSystemTrayIcon::updateToolTip(const QString &tooltip)
+{
+ m_systray->setToolTip(tooltip);
+}
+
+void QWidgetPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu)
+{
+ QWidgetPlatformMenu *widgetMenu = qobject_cast<QWidgetPlatformMenu *>(menu);
+ if (!widgetMenu)
+ return;
+
+ m_systray->setContextMenu(widgetMenu->menu());
+}
+
+QRect QWidgetPlatformSystemTrayIcon::geometry() const
+{
+ return m_systray->geometry();
+}
+
+void QWidgetPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg, const QIcon &icon, MessageIcon iconType, int msecs)
+{
+ Q_UNUSED(icon);
+ m_systray->showMessage(title, msg, static_cast<QSystemTrayIcon::MessageIcon>(iconType), msecs);
+}
+
+bool QWidgetPlatformSystemTrayIcon::isSystemTrayAvailable() const
+{
+ return QSystemTrayIcon::isSystemTrayAvailable();
+}
+
+bool QWidgetPlatformSystemTrayIcon::supportsMessages() const
+{
+ return QSystemTrayIcon::supportsMessages();
+}
+
+QPlatformMenu *QWidgetPlatformSystemTrayIcon::createMenu() const
+{
+ return new QWidgetPlatformMenu;
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_p.h
new file mode 100644
index 00000000..f48430a4
--- /dev/null
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon_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 Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure 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 QWIDGETPLATFORMSYSTEMTRAYICON_P_H
+#define QWIDGETPLATFORMSYSTEMTRAYICON_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/qplatformsystemtrayicon.h>
+
+QT_BEGIN_NAMESPACE
+
+class QSystemTrayIcon;
+
+class QWidgetPlatformSystemTrayIcon : public QPlatformSystemTrayIcon
+{
+ Q_OBJECT
+
+public:
+ explicit QWidgetPlatformSystemTrayIcon(QObject *parent = nullptr);
+ ~QWidgetPlatformSystemTrayIcon();
+
+ void init() override;
+ void cleanup() override;
+ void updateIcon(const QIcon &icon) override;
+ void updateToolTip(const QString &tooltip) override;
+ void updateMenu(QPlatformMenu *menu) override;
+ QRect geometry() const override;
+ void showMessage(const QString &title, const QString &msg,
+ const QIcon &icon, MessageIcon iconType, int msecs) override;
+
+ bool isSystemTrayAvailable() const override;
+ bool supportsMessages() const override;
+
+ QPlatformMenu *createMenu() const override;
+
+private:
+ QScopedPointer<QSystemTrayIcon> m_systray;
+};
+
+QT_END_NAMESPACE
+
+#endif // QWIDGETPLATFORMSYSTEMTRAYICON_P_H
diff --git a/src/imports/platform/widgets/widgets.pri b/src/imports/platform/widgets/widgets.pri
new file mode 100644
index 00000000..c904e924
--- /dev/null
+++ b/src/imports/platform/widgets/widgets.pri
@@ -0,0 +1,23 @@
+QT += widgets
+DEPENDPATH += $$PWD
+
+HEADERS += \
+ $$PWD/qwidgetplatform_p.h \
+ $$PWD/qwidgetplatformcolordialog_p.h \
+ $$PWD/qwidgetplatformdialog_p.h \
+ $$PWD/qwidgetplatformfiledialog_p.h \
+ $$PWD/qwidgetplatformfontdialog_p.h \
+ $$PWD/qwidgetplatformmenu_p.h \
+ $$PWD/qwidgetplatformmenuitem_p.h \
+ $$PWD/qwidgetplatformmessagedialog_p.h \
+ $$PWD/qwidgetplatformsystemtrayicon_p.h
+
+SOURCES += \
+ $$PWD/qwidgetplatformcolordialog.cpp \
+ $$PWD/qwidgetplatformdialog.cpp \
+ $$PWD/qwidgetplatformfiledialog.cpp \
+ $$PWD/qwidgetplatformfontdialog.cpp \
+ $$PWD/qwidgetplatformmenu.cpp \
+ $$PWD/qwidgetplatformmenuitem.cpp \
+ $$PWD/qwidgetplatformmessagedialog.cpp \
+ $$PWD/qwidgetplatformsystemtrayicon.cpp
diff --git a/src/imports/templates/dependencies.json b/src/imports/templates/dependencies.json
new file mode 100644
index 00000000..26ce7c00
--- /dev/null
+++ b/src/imports/templates/dependencies.json
@@ -0,0 +1,12 @@
+[
+ {
+ "name": "QtQuick",
+ "type": "module",
+ "version": "2.8"
+ },
+ {
+ "name": "QtQuick.Window",
+ "type": "module",
+ "version": "2.2"
+ }
+]
diff --git a/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc b/src/imports/templates/doc/src/qtquicktemplates2-index.qdoc
index 2e22196b..2e22196b 100644
--- a/src/imports/controls/doc/src/templates/qtquicktemplates2-index.qdoc
+++ b/src/imports/templates/doc/src/qtquicktemplates2-index.qdoc
diff --git a/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc b/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc
index 1ddfe763..977616bd 100644
--- a/src/imports/controls/doc/src/templates/qtquicktemplates2.qdoc
+++ b/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc
@@ -38,7 +38,7 @@
\c .qml file:
\badcode
- import QtQuick.Templates 2.0 as T
+ import QtQuick.Templates 2.1 as T
\endcode
For the sake of clarity, there is a one-to-one mapping between the types
diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes
index 75a11a6e..6b644437 100644
--- a/src/imports/templates/plugins.qmltypes
+++ b/src/imports/templates/plugins.qmltypes
@@ -4,10 +4,10 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Templates 2.0'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.1'
Module {
- dependencies: ["QtQuick.Window 2.2"]
+ dependencies: ["QtQuick 2.8", "QtQuick.Window 2.2"]
Component {
name: "QQuickAbstractButton"
defaultProperty: "data"
@@ -18,6 +18,7 @@ Module {
Property { name: "down"; type: "bool" }
Property { name: "pressed"; type: "bool"; isReadonly: true }
Property { name: "checked"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
Property { name: "autoExclusive"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Signal { name: "pressed" }
@@ -69,12 +70,41 @@ Module {
prototype: "QQuickAbstractButton"
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: "QQuickButtonGroup"
+ prototype: "QObject"
+ exports: [
+ "QtQuick.Templates/ButtonGroup 2.0",
+ "QtQuick.Templates/ButtonGroup 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickButtonGroupAttached"
+ Property { name: "checkedButton"; type: "QQuickAbstractButton"; isPointer: true }
+ Property { name: "buttons"; type: "QQuickAbstractButton"; isList: true; isReadonly: true }
+ Signal {
+ name: "clicked"
+ revision: 1
+ Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: 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: "QQuickCheckBox"
defaultProperty: "data"
prototype: "QQuickAbstractButton"
@@ -96,11 +126,15 @@ Module {
name: "QQuickComboBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/ComboBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/ComboBox 2.0",
+ "QtQuick.Templates/ComboBox 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
+ Property { name: "flat"; revision: 1; type: "bool" }
Property { name: "pressed"; type: "bool" }
Property { name: "highlightedIndex"; type: "int"; isReadonly: true }
Property { name: "currentIndex"; type: "int" }
@@ -110,6 +144,7 @@ Module {
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
+ Signal { name: "flatChanged"; revision: 1 }
Signal {
name: "activated"
Parameter { name: "index"; type: "int" }
@@ -141,8 +176,11 @@ Module {
name: "QQuickContainer"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Container 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Container 2.0",
+ "QtQuick.Templates/Container 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
@@ -153,6 +191,8 @@ Module {
name: "setCurrentIndex"
Parameter { name: "index"; type: "int" }
}
+ Method { name: "incrementCurrentIndex"; revision: 1 }
+ Method { name: "decrementCurrentIndex"; revision: 1 }
Method {
name: "itemAt"
type: "QQuickItem*"
@@ -231,6 +271,58 @@ Module {
Method { name: "decrease" }
}
Component {
+ name: "QQuickDialog"
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["QtQuick.Templates/Dialog 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
+ Property { name: "header"; type: "QQuickItem"; isPointer: true }
+ Property { name: "footer"; type: "QQuickItem"; isPointer: true }
+ Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Method { name: "accept" }
+ Method { name: "reject" }
+ }
+ Component {
+ name: "QQuickDialogButtonBox"
+ defaultProperty: "contentData"
+ prototype: "QQuickContainer"
+ exports: ["QtQuick.Templates/DialogButtonBox 2.1"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickDialogButtonBoxAttached"
+ Enum {
+ name: "Position"
+ values: {
+ "Header": 0,
+ "Footer": 1
+ }
+ }
+ Property { name: "position"; type: "Position" }
+ Property { name: "alignment"; type: "Qt::Alignment" }
+ Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Signal { name: "accepted" }
+ Signal { name: "rejected" }
+ Signal { name: "helpRequested" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "button"; type: "QQuickAbstractButton"; isPointer: true }
+ }
+ Method {
+ name: "standardButton"
+ type: "QQuickAbstractButton*"
+ Parameter { name: "button"; type: "QPlatformDialogHelper::StandardButton" }
+ }
+ }
+ Component {
+ name: "QQuickDialogButtonBoxAttached"
+ prototype: "QObject"
+ Property { name: "buttonBox"; type: "QQuickDialogButtonBox"; isReadonly: true; isPointer: true }
+ Property { name: "buttonRole"; type: "QPlatformDialogHelper::ButtonRole" }
+ }
+ Component {
name: "QQuickDrawer"
defaultProperty: "contentData"
prototype: "QQuickPopup"
@@ -257,181 +349,6 @@ Module {
Property { name: "label"; type: "QQuickItem"; isPointer: true }
}
Component {
- name: "QQuickImplicitSizeItem"
- defaultProperty: "data"
- prototype: "QQuickItem"
- Property { name: "implicitWidth"; type: "double"; isReadonly: true }
- Property { name: "implicitHeight"; type: "double"; isReadonly: true }
- Signal { name: "implicitWidthChanged2"; revision: 1 }
- 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"
@@ -487,16 +404,22 @@ Module {
prototype: "QQuickAbstractButton"
exports: ["QtQuick.Templates/MenuItem 2.0"]
exportMetaObjectRevisions: [0]
- Property { name: "checkable"; type: "bool" }
Property { name: "highlighted"; type: "bool" }
Signal { name: "triggered" }
}
Component {
+ name: "QQuickMenuSeparator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/MenuSeparator 2.1"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickOverlay"
defaultProperty: "data"
prototype: "QQuickItem"
- Property { name: "modal"; type: "QQuickItem"; isPointer: true }
- Property { name: "modeless"; type: "QQuickItem"; isPointer: true }
+ Property { name: "modal"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "modeless"; type: "QQmlComponent"; isPointer: true }
Signal { name: "pressed" }
Signal { name: "released" }
}
@@ -504,13 +427,17 @@ Module {
name: "QQuickPage"
defaultProperty: "contentData"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Page 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: ["QtQuick.Templates/Page 2.0", "QtQuick.Templates/Page 2.1"]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "title"; type: "string" }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
+ Property { name: "contentWidth"; revision: 1; type: "double" }
+ Property { name: "contentHeight"; revision: 1; type: "double" }
Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Signal { name: "contentWidthChanged"; revision: 1 }
+ Signal { name: "contentHeightChanged"; revision: 1 }
}
Component {
name: "QQuickPageIndicator"
@@ -538,8 +465,11 @@ Module {
name: "QQuickPopup"
defaultProperty: "contentData"
prototype: "QObject"
- exports: ["QtQuick.Templates/Popup 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Popup 2.0",
+ "QtQuick.Templates/Popup 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "ClosePolicy"
values: {
@@ -576,6 +506,7 @@ Module {
Property { name: "contentHeight"; type: "double" }
Property { name: "availableWidth"; type: "double"; isReadonly: true }
Property { name: "availableHeight"; type: "double"; isReadonly: true }
+ Property { name: "spacing"; revision: 1; type: "double" }
Property { name: "margins"; type: "double" }
Property { name: "topMargin"; type: "double" }
Property { name: "leftMargin"; type: "double" }
@@ -605,6 +536,7 @@ Module {
Property { name: "transformOrigin"; type: "TransformOrigin" }
Property { name: "enter"; type: "QQuickTransition"; isPointer: true }
Property { name: "exit"; type: "QQuickTransition"; isPointer: true }
+ Signal { name: "spacingChanged"; revision: 1 }
Signal {
name: "windowChanged"
Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
@@ -615,6 +547,11 @@ Module {
Signal { name: "closed" }
Method { name: "open" }
Method { name: "close" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method { name: "forceActiveFocus" }
}
Component {
name: "QQuickProgressBar"
@@ -647,8 +584,11 @@ Module {
name: "QQuickRangeSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/RangeSlider 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/RangeSlider 2.0",
+ "QtQuick.Templates/RangeSlider 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "SnapMode"
values: {
@@ -678,21 +618,18 @@ Module {
Property { name: "visualPosition"; type: "double"; isReadonly: true }
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; revision: 1; type: "bool" }
+ Signal { name: "hoveredChanged"; revision: 1 }
Method { name: "increase" }
Method { name: "decrease" }
}
Component {
- name: "QQuickRootItem"
+ name: "QQuickRoundButton"
defaultProperty: "data"
- prototype: "QQuickItem"
- Method {
- name: "setWidth"
- Parameter { name: "w"; type: "int" }
- }
- Method {
- name: "setHeight"
- Parameter { name: "h"; type: "int" }
- }
+ prototype: "QQuickButton"
+ exports: ["QtQuick.Templates/RoundButton 2.1"]
+ exportMetaObjectRevisions: [1]
+ Property { name: "radius"; type: "double" }
}
Component {
name: "QQuickScrollBar"
@@ -754,8 +691,11 @@ Module {
name: "QQuickSlider"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Slider 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Slider 2.0",
+ "QtQuick.Templates/Slider 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "SnapMode"
values: {
@@ -776,13 +716,22 @@ Module {
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Method { name: "increase" }
Method { name: "decrease" }
+ Method {
+ name: "valueAt"
+ revision: 1
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
}
Component {
name: "QQuickSpinBox"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/SpinBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/SpinBox 2.0",
+ "QtQuick.Templates/SpinBox 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "from"; type: "int" }
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
@@ -800,7 +749,9 @@ Module {
name: "QQuickSpinButton"
prototype: "QObject"
Property { name: "pressed"; type: "bool" }
+ Property { name: "hovered"; revision: 1; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ Signal { name: "hoveredChanged"; revision: 1 }
}
Component {
name: "QQuickStackAttached"
@@ -808,13 +759,21 @@ Module {
Property { name: "index"; type: "int"; isReadonly: true }
Property { name: "view"; type: "QQuickStackView"; isReadonly: true; isPointer: true }
Property { name: "status"; type: "QQuickStackView::Status"; isReadonly: true }
+ Signal { name: "activated" }
+ Signal { name: "activating" }
+ Signal { name: "deactivated" }
+ Signal { name: "deactivating" }
+ Signal { name: "removed" }
}
Component {
name: "QQuickStackView"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/StackView 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/StackView 2.0",
+ "QtQuick.Templates/StackView 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickStackAttached"
Enum {
name: "Status"
@@ -835,8 +794,11 @@ Module {
Enum {
name: "Operation"
values: {
- "Transition": 0,
- "Immediate": 1
+ "Transition": -1,
+ "Immediate": 0,
+ "PushTransition": 1,
+ "ReplaceTransition": 2,
+ "PopTransition": 3
}
}
Property { name: "busy"; type: "bool"; isReadonly: true }
@@ -896,28 +858,47 @@ Module {
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 }
+ Signal { name: "completed"; revision: 1 }
+ Method { name: "close"; revision: 1 }
}
Component {
name: "QQuickSwipeDelegate"
defaultProperty: "data"
prototype: "QQuickItemDelegate"
- exports: ["QtQuick.Templates/SwipeDelegate 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/SwipeDelegate 2.0",
+ "QtQuick.Templates/SwipeDelegate 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
+ attachedType: "QQuickSwipeDelegateAttached"
Property { name: "swipe"; type: "QQuickSwipe"; isReadonly: true; isPointer: true }
}
Component {
+ name: "QQuickSwipeDelegateAttached"
+ prototype: "QObject"
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Signal { name: "clicked" }
+ }
+ Component {
name: "QQuickSwipeView"
defaultProperty: "contentData"
prototype: "QQuickContainer"
- exports: ["QtQuick.Templates/SwipeView 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/SwipeView 2.0",
+ "QtQuick.Templates/SwipeView 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickSwipeViewAttached"
+ Property { name: "interactive"; revision: 1; type: "bool" }
+ Signal { name: "interactiveChanged"; revision: 1 }
}
Component {
name: "QQuickSwipeViewAttached"
prototype: "QObject"
Property { name: "index"; type: "int"; isReadonly: true }
Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "isNextItem"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "isPreviousItem"; revision: 1; type: "bool"; isReadonly: true }
Property { name: "view"; type: "QQuickSwipeView"; isReadonly: true; isPointer: true }
}
Component {
@@ -961,188 +942,14 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
- name: "QQuickText"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4,
- "AlignJustify": 8
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "TextStyle"
- values: {
- "Normal": 0,
- "Outline": 1,
- "Raised": 2,
- "Sunken": 3
- }
- }
- Enum {
- name: "TextFormat"
- values: {
- "PlainText": 0,
- "RichText": 1,
- "AutoText": 2,
- "StyledText": 4
- }
- }
- Enum {
- name: "TextElideMode"
- values: {
- "ElideLeft": 0,
- "ElideRight": 1,
- "ElideMiddle": 2,
- "ElideNone": 3
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Enum {
- name: "LineHeightMode"
- values: {
- "ProportionalHeight": 0,
- "FixedHeight": 1
- }
- }
- Enum {
- name: "FontSizeMode"
- values: {
- "FixedSize": 0,
- "HorizontalFit": 1,
- "VerticalFit": 2,
- "Fit": 3
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "font"; type: "QFont" }
- Property { name: "color"; type: "QColor" }
- Property { name: "linkColor"; type: "QColor" }
- Property { name: "style"; type: "TextStyle" }
- Property { name: "styleColor"; type: "QColor" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "lineCount"; type: "int"; isReadonly: true }
- Property { name: "truncated"; type: "bool"; isReadonly: true }
- Property { name: "maximumLineCount"; type: "int" }
- Property { name: "textFormat"; type: "TextFormat" }
- Property { name: "elide"; type: "TextElideMode" }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "lineHeight"; type: "double" }
- Property { name: "lineHeightMode"; type: "LineHeightMode" }
- Property { name: "baseUrl"; type: "QUrl" }
- Property { name: "minimumPixelSize"; type: "int" }
- Property { name: "minimumPointSize"; type: "int" }
- Property { name: "fontSizeMode"; type: "FontSizeMode" }
- Property { name: "renderType"; type: "RenderType" }
- Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Signal {
- name: "textChanged"
- Parameter { name: "text"; type: "string" }
- }
- Signal {
- name: "linkActivated"
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "linkHovered"
- revision: 2
- Parameter { name: "link"; type: "string" }
- }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "styleChanged"
- Parameter { name: "style"; type: "QQuickText::TextStyle" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickText::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickText::VAlignment" }
- }
- Signal {
- name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "QQuickText::TextFormat" }
- }
- Signal {
- name: "elideModeChanged"
- Parameter { name: "mode"; type: "QQuickText::TextElideMode" }
- }
- Signal { name: "contentSizeChanged" }
- Signal {
- name: "lineHeightChanged"
- Parameter { name: "lineHeight"; type: "double" }
- }
- Signal {
- name: "lineHeightModeChanged"
- Parameter { name: "mode"; type: "LineHeightMode" }
- }
- Signal {
- name: "lineLaidOut"
- Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
- }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "doLayout" }
- Method {
- name: "linkAt"
- revision: 3
- type: "string"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- }
- Component {
name: "QQuickTextArea"
defaultProperty: "data"
prototype: "QQuickTextEdit"
- exports: ["QtQuick.Templates/TextArea 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/TextArea 2.0",
+ "QtQuick.Templates/TextArea 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickTextAreaAttached"
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
@@ -1150,539 +957,72 @@ Module {
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
+ Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "hoverEnabledChanged"; revision: 1 }
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"
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4,
- "AlignJustify": 8
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "TextFormat"
- values: {
- "PlainText": 0,
- "RichText": 1,
- "AutoText": 2
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "SelectionMode"
- values: {
- "SelectCharacters": 0,
- "SelectWords": 1
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "color"; type: "QColor" }
- Property { name: "selectionColor"; type: "QColor" }
- Property { name: "selectedTextColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "lineCount"; type: "int"; isReadonly: true }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "paintedWidth"; type: "double"; isReadonly: true }
- Property { name: "paintedHeight"; type: "double"; isReadonly: true }
- Property { name: "textFormat"; type: "TextFormat" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "cursorVisible"; type: "bool" }
- Property { name: "cursorPosition"; type: "int" }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionStart"; type: "int"; isReadonly: true }
- Property { name: "selectionEnd"; type: "int"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "activeFocusOnPress"; type: "bool" }
- Property { name: "persistentSelection"; type: "bool" }
- Property { name: "textMargin"; type: "double" }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
- Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
- Property { name: "selectByMouse"; type: "bool" }
- Property { name: "mouseSelectionMode"; type: "SelectionMode" }
- Property { name: "canPaste"; type: "bool"; isReadonly: true }
- Property { name: "canUndo"; type: "bool"; isReadonly: true }
- Property { name: "canRedo"; type: "bool"; isReadonly: true }
- Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
- Property { name: "baseUrl"; type: "QUrl" }
- Property { name: "renderType"; type: "RenderType" }
- Property {
- name: "textDocument"
- revision: 1
- type: "QQuickTextDocument"
- isReadonly: true
- isPointer: true
- }
- Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- 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"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "selectionColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "selectedTextColorChanged"
- Parameter { name: "color"; type: "QColor" }
- }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextEdit::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextEdit::VAlignment" }
- }
- Signal {
- name: "textFormatChanged"
- Parameter { name: "textFormat"; type: "QQuickTextEdit::TextFormat" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "isReadOnly"; type: "bool" }
- }
- Signal {
- name: "cursorVisibleChanged"
- Parameter { name: "isCursorVisible"; type: "bool" }
- }
- Signal {
- name: "activeFocusOnPressChanged"
- Parameter { name: "activeFocusOnPressed"; type: "bool" }
- }
- Signal {
- name: "persistentSelectionChanged"
- Parameter { name: "isPersistentSelection"; type: "bool" }
- }
- Signal {
- name: "textMarginChanged"
- Parameter { name: "textMargin"; type: "double" }
- }
- Signal {
- name: "selectByKeyboardChanged"
+ name: "pressed"
revision: 1
- Parameter { name: "selectByKeyboard"; type: "bool" }
- }
- Signal {
- name: "selectByMouseChanged"
- Parameter { name: "selectByMouse"; type: "bool" }
- }
- Signal {
- name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "QQuickTextEdit::SelectionMode" }
- }
- Signal {
- name: "linkActivated"
- Parameter { name: "link"; type: "string" }
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
Signal {
- name: "linkHovered"
- revision: 2
- Parameter { name: "link"; type: "string" }
- }
- Signal { name: "editingFinished"; revision: 6 }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "selectAll" }
- Method { name: "selectWord" }
- Method {
- name: "select"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "deselect" }
- Method {
- name: "isRightToLeft"
- type: "bool"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "cut" }
- Method { name: "copy" }
- Method { name: "paste" }
- Method { name: "undo" }
- Method { name: "redo" }
- Method {
- name: "insert"
- Parameter { name: "position"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "remove"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "append"
- revision: 2
- Parameter { name: "text"; type: "string" }
- }
- Method { name: "clear"; revision: 7 }
- Method {
- name: "inputMethodQuery"
- revision: 4
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method {
- name: "positionToRectangle"
- type: "QRectF"
- Parameter { type: "int" }
- }
- Method {
- name: "positionAt"
- type: "int"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "mode"; type: "SelectionMode" }
- }
- Method {
- name: "getText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "getFormattedText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "linkAt"
- revision: 3
- type: "string"
- Parameter { name: "x"; type: "double" }
- Parameter { name: "y"; type: "double" }
+ name: "released"
+ revision: 1
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
}
Component {
+ name: "QQuickTextAreaAttached"
+ prototype: "QObject"
+ Property { name: "flickable"; type: "QQuickTextArea"; isPointer: true }
+ }
+ Component {
name: "QQuickTextField"
defaultProperty: "data"
prototype: "QQuickTextInput"
- exports: ["QtQuick.Templates/TextField 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/TextField 2.0",
+ "QtQuick.Templates/TextField 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
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" }
+ Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
+ Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
+ Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "hoverEnabledChanged"; revision: 1 }
Signal {
name: "pressAndHold"
- Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
- }
- }
- Component {
- name: "QQuickTextInput"
- defaultProperty: "data"
- prototype: "QQuickImplicitSizeItem"
- Enum {
- name: "EchoMode"
- values: {
- "Normal": 0,
- "NoEcho": 1,
- "Password": 2,
- "PasswordEchoOnEdit": 3
- }
- }
- Enum {
- name: "HAlignment"
- values: {
- "AlignLeft": 1,
- "AlignRight": 2,
- "AlignHCenter": 4
- }
- }
- Enum {
- name: "VAlignment"
- values: {
- "AlignTop": 32,
- "AlignBottom": 64,
- "AlignVCenter": 128
- }
- }
- Enum {
- name: "WrapMode"
- values: {
- "NoWrap": 0,
- "WordWrap": 1,
- "WrapAnywhere": 3,
- "WrapAtWordBoundaryOrAnywhere": 4,
- "Wrap": 4
- }
- }
- Enum {
- name: "SelectionMode"
- values: {
- "SelectCharacters": 0,
- "SelectWords": 1
- }
- }
- Enum {
- name: "CursorPosition"
- values: {
- "CursorBetweenCharacters": 0,
- "CursorOnCharacter": 1
- }
- }
- Enum {
- name: "RenderType"
- values: {
- "QtRendering": 0,
- "NativeRendering": 1
- }
- }
- Property { name: "text"; type: "string" }
- Property { name: "length"; type: "int"; isReadonly: true }
- Property { name: "color"; type: "QColor" }
- Property { name: "selectionColor"; type: "QColor" }
- Property { name: "selectedTextColor"; type: "QColor" }
- Property { name: "font"; type: "QFont" }
- Property { name: "horizontalAlignment"; type: "HAlignment" }
- Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
- Property { name: "verticalAlignment"; type: "VAlignment" }
- Property { name: "wrapMode"; type: "WrapMode" }
- Property { name: "readOnly"; type: "bool" }
- Property { name: "cursorVisible"; type: "bool" }
- Property { name: "cursorPosition"; type: "int" }
- Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
- Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
- Property { name: "selectionStart"; type: "int"; isReadonly: true }
- Property { name: "selectionEnd"; type: "int"; isReadonly: true }
- Property { name: "selectedText"; type: "string"; isReadonly: true }
- Property { name: "maximumLength"; type: "int" }
- Property { name: "validator"; type: "QValidator"; isPointer: true }
- Property { name: "inputMask"; type: "string" }
- Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
- Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
- Property { name: "echoMode"; type: "EchoMode" }
- Property { name: "activeFocusOnPress"; type: "bool" }
- 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" }
- Property { name: "persistentSelection"; type: "bool" }
- Property { name: "canPaste"; type: "bool"; isReadonly: true }
- Property { name: "canUndo"; type: "bool"; isReadonly: true }
- Property { name: "canRedo"; type: "bool"; isReadonly: true }
- Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
- Property { name: "contentWidth"; type: "double"; isReadonly: true }
- Property { name: "contentHeight"; type: "double"; isReadonly: true }
- Property { name: "renderType"; type: "RenderType" }
- Property { name: "padding"; revision: 6; type: "double" }
- Property { name: "topPadding"; revision: 6; type: "double" }
- Property { name: "leftPadding"; revision: 6; type: "double" }
- Property { name: "rightPadding"; revision: 6; type: "double" }
- Property { name: "bottomPadding"; revision: 6; type: "double" }
- Signal { name: "accepted" }
- Signal { name: "editingFinished"; revision: 2 }
- Signal {
- name: "fontChanged"
- Parameter { name: "font"; type: "QFont" }
- }
- Signal {
- name: "horizontalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextInput::HAlignment" }
- }
- Signal {
- name: "verticalAlignmentChanged"
- Parameter { name: "alignment"; type: "QQuickTextInput::VAlignment" }
- }
- Signal {
- name: "readOnlyChanged"
- Parameter { name: "isReadOnly"; type: "bool" }
- }
- Signal {
- name: "cursorVisibleChanged"
- Parameter { name: "isCursorVisible"; type: "bool" }
- }
- Signal {
- name: "maximumLengthChanged"
- Parameter { name: "maximumLength"; type: "int" }
- }
- Signal {
- name: "inputMaskChanged"
- Parameter { name: "inputMask"; type: "string" }
- }
- Signal {
- name: "echoModeChanged"
- 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" }
- }
- Signal {
- name: "autoScrollChanged"
- Parameter { name: "autoScroll"; type: "bool" }
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
Signal {
- name: "selectByMouseChanged"
- Parameter { name: "selectByMouse"; type: "bool" }
+ name: "pressed"
+ revision: 1
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
Signal {
- name: "mouseSelectionModeChanged"
- Parameter { name: "mode"; type: "QQuickTextInput::SelectionMode" }
- }
- Signal { name: "contentSizeChanged" }
- Signal { name: "paddingChanged"; revision: 6 }
- Signal { name: "topPaddingChanged"; revision: 6 }
- Signal { name: "leftPaddingChanged"; revision: 6 }
- Signal { name: "rightPaddingChanged"; revision: 6 }
- Signal { name: "bottomPaddingChanged"; revision: 6 }
- Method { name: "selectAll" }
- Method { name: "selectWord" }
- Method {
- name: "select"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "deselect" }
- Method {
- name: "isRightToLeft"
- type: "bool"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method { name: "cut" }
- Method { name: "copy" }
- Method { name: "paste" }
- Method { name: "undo" }
- Method { name: "redo" }
- Method {
- name: "insert"
- Parameter { name: "position"; type: "int" }
- Parameter { name: "text"; type: "string" }
- }
- Method {
- name: "remove"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
- }
- Method {
- name: "ensureVisible"
- revision: 3
- Parameter { name: "position"; type: "int" }
- }
- Method { name: "clear"; revision: 7 }
- Method {
- name: "positionAt"
- Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
- }
- Method {
- name: "positionToRectangle"
- type: "QRectF"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- }
- Method {
- name: "moveCursorSelection"
- Parameter { name: "pos"; type: "int" }
- Parameter { name: "mode"; type: "SelectionMode" }
- }
- Method {
- name: "inputMethodQuery"
- revision: 3
- type: "QVariant"
- Parameter { name: "query"; type: "Qt::InputMethodQuery" }
- Parameter { name: "argument"; type: "QVariant" }
- }
- Method {
- name: "getText"
- type: "string"
- Parameter { name: "start"; type: "int" }
- Parameter { name: "end"; type: "int" }
+ name: "released"
+ revision: 1
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
}
}
Component {
name: "QQuickToolBar"
defaultProperty: "contentData"
- prototype: "QQuickFrame"
+ prototype: "QQuickPane"
exports: ["QtQuick.Templates/ToolBar 2.0"]
exportMetaObjectRevisions: [0]
Enum {
@@ -1702,6 +1042,16 @@ Module {
exportMetaObjectRevisions: [0]
}
Component {
+ name: "QQuickToolSeparator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["QtQuick.Templates/ToolSeparator 2.1"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "orientation"; type: "Qt::Orientation" }
+ Property { name: "horizontal"; type: "bool"; isReadonly: true }
+ Property { name: "vertical"; type: "bool"; isReadonly: true }
+ }
+ Component {
name: "QQuickToolTip"
defaultProperty: "contentData"
prototype: "QQuickPopup"
@@ -1711,8 +1061,6 @@ Module {
Property { name: "delay"; type: "int" }
Property { name: "timeout"; type: "int" }
Property { name: "text"; type: "string" }
- Method { name: "open" }
- Method { name: "close" }
}
Component {
name: "QQuickToolTipAttached"
@@ -1737,8 +1085,11 @@ Module {
name: "QQuickTumbler"
defaultProperty: "data"
prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Tumbler 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/Tumbler 2.0",
+ "QtQuick.Templates/Tumbler 2.1"
+ ]
+ exportMetaObjectRevisions: [0, 1]
attachedType: "QQuickTumblerAttached"
Property { name: "model"; type: "QVariant" }
Property { name: "count"; type: "int"; isReadonly: true }
@@ -1746,6 +1097,8 @@ Module {
Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
Property { name: "visibleItemCount"; type: "int" }
+ Property { name: "wrap"; revision: 1; type: "bool" }
+ Signal { name: "wrapChanged"; revision: 1 }
}
Component {
name: "QQuickTumblerAttached"
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index 2c87fd45..0e62200d 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -47,6 +47,8 @@
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
#include <QtQuickTemplates2/private/qquickcontainer_p.h>
#include <QtQuickTemplates2/private/qquickdial_p.h>
+#include <QtQuickTemplates2/private/qquickdialog_p.h>
+#include <QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>
#include <QtQuickTemplates2/private/qquickdrawer_p.h>
#include <QtQuickTemplates2/private/qquickframe_p.h>
#include <QtQuickTemplates2/private/qquickgroupbox_p.h>
@@ -54,6 +56,7 @@
#include <QtQuickTemplates2/private/qquicklabel_p.h>
#include <QtQuickTemplates2/private/qquickmenu_p.h>
#include <QtQuickTemplates2/private/qquickmenuitem_p.h>
+#include <QtQuickTemplates2/private/qquickmenuseparator_p.h>
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
#include <QtQuickTemplates2/private/qquickpage_p.h>
#include <QtQuickTemplates2/private/qquickpageindicator_p.h>
@@ -63,6 +66,7 @@
#include <QtQuickTemplates2/private/qquickradiobutton_p.h>
#include <QtQuickTemplates2/private/qquickradiodelegate_p.h>
#include <QtQuickTemplates2/private/qquickrangeslider_p.h>
+#include <QtQuickTemplates2/private/qquickroundbutton_p.h>
#include <QtQuickTemplates2/private/qquickscrollbar_p.h>
#include <QtQuickTemplates2/private/qquickscrollindicator_p.h>
#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
@@ -79,6 +83,7 @@
#include <QtQuickTemplates2/private/qquicktextfield_p.h>
#include <QtQuickTemplates2/private/qquicktoolbar_p.h>
#include <QtQuickTemplates2/private/qquicktoolbutton_p.h>
+#include <QtQuickTemplates2/private/qquicktoolseparator_p.h>
#include <QtQuickTemplates2/private/qquicktooltip_p.h>
#include <QtQuickTemplates2/private/qquicktumbler_p.h>
@@ -126,6 +131,7 @@ QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin()
void QtQuickTemplates2Plugin::registerTypes(const char *uri)
{
+ // QtQuick.Templates 2.0 (Qt 5.7)
qmlRegisterType<QQuickAbstractButton>(uri, 2, 0, "AbstractButton");
qmlRegisterType<QQuickApplicationWindow>(uri, 2, 0, "ApplicationWindow");
qmlRegisterType<QQuickApplicationWindowAttached>();
@@ -190,6 +196,28 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterRevision<QQuickText, 6>(uri, 2, 0);
qmlRegisterRevision<QQuickTextInput, 7>(uri, 2, 0);
qmlRegisterRevision<QQuickTextEdit, 7>(uri, 2, 0);
+
+ // QtQuick.Templates 2.1 (Qt 5.8)
+ qmlRegisterType<QQuickButtonGroup, 1>(uri, 2, 1, "ButtonGroup");
+ qmlRegisterType<QQuickComboBox, 1>(uri, 2, 1, "ComboBox");
+ qmlRegisterType<QQuickContainer, 1>(uri, 2, 1, "Container");
+ qmlRegisterType<QQuickDialog>(uri, 2, 1, "Dialog");
+ qmlRegisterType<QQuickDialogButtonBox>(uri, 2, 1, "DialogButtonBox");
+ qmlRegisterType<QQuickDialogButtonBoxAttached>();
+ qmlRegisterType<QQuickMenuSeparator>(uri, 2, 1, "MenuSeparator");
+ qmlRegisterType<QQuickPage, 1>(uri, 2, 1, "Page");
+ qmlRegisterType<QQuickPopup, 1>(uri, 2, 1, "Popup");
+ qmlRegisterType<QQuickRangeSlider, 1>(uri, 2, 1, "RangeSlider");
+ qmlRegisterType<QQuickRoundButton, 1>(uri, 2, 1, "RoundButton");
+ qmlRegisterType<QQuickSlider, 1>(uri, 2, 1, "Slider");
+ qmlRegisterType<QQuickSpinBox, 1>(uri, 2, 1, "SpinBox");
+ qmlRegisterType<QQuickStackView, 1>(uri, 2, 1, "StackView");
+ qmlRegisterType<QQuickSwipeDelegate, 1>(uri, 2, 1, "SwipeDelegate");
+ qmlRegisterType<QQuickSwipeView, 1>(uri, 2, 1, "SwipeView");
+ qmlRegisterType<QQuickTextArea, 1>(uri, 2, 1, "TextArea");
+ qmlRegisterType<QQuickTextField, 1>(uri, 2, 1, "TextField");
+ qmlRegisterType<QQuickToolSeparator>(uri, 2, 1, "ToolSeparator");
+ qmlRegisterType<QQuickTumbler, 1>(uri, 2, 1, "Tumbler");
}
QT_END_NAMESPACE
diff --git a/src/imports/templates/templates.pro b/src/imports/templates/templates.pro
index 8785734a..3640f6d1 100644
--- a/src/imports/templates/templates.pro
+++ b/src/imports/templates/templates.pro
@@ -1,6 +1,6 @@
TARGET = qtquicktemplates2plugin
TARGETPATH = QtQuick/Templates.2
-IMPORT_VERSION = 2.0
+IMPORT_VERSION = 2.1
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private
diff --git a/src/quickcontrols2/qquickpaddedrectangle.cpp b/src/quickcontrols2/qquickpaddedrectangle.cpp
index 08d74dc6..28423f51 100644
--- a/src/quickcontrols2/qquickpaddedrectangle.cpp
+++ b/src/quickcontrols2/qquickpaddedrectangle.cpp
@@ -184,7 +184,7 @@ QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeDa
if (!transformNode)
transformNode = new QSGTransformNode;
- QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data));
+ QSGInternalRectangleNode *rectNode = static_cast<QSGInternalRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data));
if (rectNode) {
if (!transformNode->firstChild())
diff --git a/src/quickcontrols2/qquickproxytheme.cpp b/src/quickcontrols2/qquickproxytheme.cpp
index da4f2a2e..3791bb06 100644
--- a/src/quickcontrols2/qquickproxytheme.cpp
+++ b/src/quickcontrols2/qquickproxytheme.cpp
@@ -137,11 +137,11 @@ QPixmap QQuickProxyTheme::standardPixmap(QPlatformTheme::StandardPixmap sp, cons
return QPlatformTheme::standardPixmap(sp, size);
}
-QPixmap QQuickProxyTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &size, QPlatformTheme::IconOptions iconOptions) const
+QIcon QQuickProxyTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
{
if (m_theme)
- return m_theme->fileIconPixmap(fileInfo, size, iconOptions);
- return QPlatformTheme::fileIconPixmap(fileInfo, size, iconOptions);
+ return m_theme->fileIcon(fileInfo, iconOptions);
+ return QPlatformTheme::fileIcon(fileInfo, iconOptions);
}
QIconEngine *QQuickProxyTheme::createIconEngine(const QString &iconName) const
diff --git a/src/quickcontrols2/qquickproxytheme_p.h b/src/quickcontrols2/qquickproxytheme_p.h
index c94417dc..c2cec4f7 100644
--- a/src/quickcontrols2/qquickproxytheme_p.h
+++ b/src/quickcontrols2/qquickproxytheme_p.h
@@ -80,8 +80,7 @@ public:
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;
+ QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const override;
QIconEngine *createIconEngine(const QString &iconName) const override;
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 143f599a..d7143be7 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qquickstyle.h"
+#include "qquickstyle_p.h"
#include "qquickstyleattached_p.h"
#include <QtCore/qdir.h>
@@ -80,6 +81,19 @@ QT_BEGIN_NAMESPACE
Qt Quick Controls 2. It is not possible to change the style after the QML
types have been registered.
+ The style can also be specified as a path to a custom style, such as
+ \c ":/mystyle". See \l {Creating a Custom Style} for more details about
+ building custom styles. Custom styles do not need to implement all controls.
+ By default, the styling system uses the \l {Default style} as a fallback
+ for controls that a custom style does not provide. It is possible to
+ specify a different fallback style to customize or extend one of the
+ built-in styles.
+
+ \code
+ QQuickStyle::setStyle(":/mystyle");
+ QQuickStyle::setFallbackStyle("Material");
+ \endcode
+
\sa {Styling Qt Quick Controls 2}
*/
@@ -102,7 +116,7 @@ static QStringList defaultImportPathList()
struct QQuickStyleSpec
{
- QQuickStyleSpec() : resolved(false) { }
+ QQuickStyleSpec() : custom(false), resolved(false) { }
QString name()
{
@@ -128,54 +142,126 @@ struct QQuickStyleSpec
resolve();
}
- void resolve()
+ void setFallbackStyle(const QString &fallback, const QByteArray &method)
+ {
+ fallbackStyle = fallback;
+ fallbackMethod = method;
+ }
+
+ static QString findStyle(const QString &path, const QString &name)
+ {
+ QDir dir(path);
+ if (!dir.exists())
+ return QString();
+
+ if (name.isEmpty())
+ return dir.absolutePath() + QLatin1Char('/');
+
+ const QStringList entries = dir.entryList(QStringList(), QDir::Dirs | QDir::NoDotAndDotDot);
+ for (const QString &entry : entries) {
+ if (entry.compare(name, Qt::CaseInsensitive) == 0)
+ return dir.absoluteFilePath(entry);
+ }
+
+ return QString();
+ }
+
+ void resolve(const QUrl &baseUrl = QUrl())
{
if (style.isEmpty())
style = QGuiApplicationPrivate::styleOverride;
if (style.isEmpty())
style = QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_STYLE"));
- if (style.isEmpty()) {
+ if (fallbackStyle.isEmpty())
+ setFallbackStyle(QString::fromLatin1(qgetenv("QT_QUICK_CONTROLS_FALLBACK_STYLE")), "QT_QUICK_CONTROLS_FALLBACK_STYLE");
+ if (style.isEmpty() || fallbackStyle.isEmpty()) {
QSharedPointer<QSettings> settings = QQuickStyleAttached::settings(QStringLiteral("Controls"));
- if (settings)
- style = settings->value(QStringLiteral("Style")).toString();
+ if (settings) {
+ if (style.isEmpty())
+ style = settings->value(QStringLiteral("Style")).toString();
+ if (fallbackStyle.isEmpty())
+ setFallbackStyle(settings->value(QStringLiteral("FallbackStyle")).toString(), ":/qtquickcontrols2.conf");
+ }
+ }
+ custom = style.contains(QLatin1Char('/'));
+
+ if (baseUrl.isValid()) {
+ QString path = QQmlFile::urlToLocalFileOrQrc(baseUrl);
+ QString stylePath = findStyle(path, style);
+ if (!stylePath.isEmpty()) {
+ style = stylePath;
+ resolved = true;
+ }
}
if (QGuiApplication::instance()) {
- if (!style.contains(QLatin1Char('/'))) {
+ if (!custom) {
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)
+ QString stylePath = findStyle(importPath + QLatin1Char('/') + targetPath, style);
+ if (!stylePath.isEmpty()) {
+ style = stylePath;
+ resolved = true;
break;
+ }
}
}
resolved = true;
}
}
+ void reset()
+ {
+ custom = false;
+ resolved = false;
+ style.clear();
+ fallbackStyle.clear();
+ fallbackMethod.clear();
+ }
+
+ bool custom;
bool resolved;
QString style;
+ QString fallbackStyle;
+ QByteArray fallbackMethod;
};
Q_GLOBAL_STATIC(QQuickStyleSpec, styleSpec)
+QString QQuickStylePrivate::fallbackStyle()
+{
+ return styleSpec()->fallbackStyle;
+}
+
+bool QQuickStylePrivate::isCustomStyle()
+{
+ return styleSpec()->custom;
+}
+
+void QQuickStylePrivate::init(const QUrl &baseUrl)
+{
+ QQuickStyleSpec *spec = styleSpec();
+ spec->resolve(baseUrl);
+
+ if (!spec->fallbackStyle.isEmpty()) {
+ QString fallbackStyle = spec->findStyle(baseUrl.toLocalFile(), spec->fallbackStyle);
+ if (fallbackStyle.isEmpty()) {
+ if (spec->fallbackStyle.compare(QStringLiteral("Default")) != 0) {
+ qWarning() << "ERROR: unable to locate fallback style" << spec->fallbackStyle;
+ qInfo().nospace().noquote() << spec->fallbackMethod << ": the fallback style must be the name of one of the built-in Qt Quick Controls 2 styles.";
+ }
+ spec->fallbackStyle.clear();
+ }
+ }
+}
+
+void QQuickStylePrivate::reset()
+{
+ styleSpec()->reset();
+}
+
/*!
Returns the name of the application style.
@@ -217,4 +303,26 @@ void QQuickStyle::setStyle(const QString &style)
styleSpec()->setStyle(style);
}
+/*!
+ \since 5.8
+ Sets the application fallback style to \a style.
+
+ \note The fallback style must be the name of one of the built-in Qt Quick Controls 2 styles, e.g. "Material".
+
+ \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.
+
+ The fallback style can be also specified by setting the \c QT_QUICK_CONTROLS_FALLBACK_STYLE
+ \l {Supported Environment Variables in Qt Quick Controls 2}{environment variable}.
+*/
+void QQuickStyle::setFallbackStyle(const QString &style)
+{
+ if (QQmlMetaType::isModule(QStringLiteral("QtQuick.Controls"), 2, 0)) {
+ qWarning() << "ERROR: QQuickStyle::setFallbackStyle() must be called before loading QML that imports Qt Quick Controls 2.";
+ return;
+ }
+
+ styleSpec()->setFallbackStyle(style, "QQuickStyle::setFallbackStyle()");
+}
+
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle.h b/src/quickcontrols2/qquickstyle.h
index 4476a29a..d2e7faf1 100644
--- a/src/quickcontrols2/qquickstyle.h
+++ b/src/quickcontrols2/qquickstyle.h
@@ -49,6 +49,7 @@ public:
static QString name();
static QString path();
static void setStyle(const QString &style);
+ static void setFallbackStyle(const QString &style);
};
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle_p.h b/src/quickcontrols2/qquickstyle_p.h
new file mode 100644
index 00000000..cfe87fbb
--- /dev/null
+++ b/src/quickcontrols2/qquickstyle_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 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_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 <QtCore/qurl.h>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStylePrivate
+{
+public:
+ static QString fallbackStyle();
+ static bool isCustomStyle();
+ static void init(const QUrl &baseUrl);
+ static void reset();
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSTYLE_P_H
diff --git a/src/quickcontrols2/qquickstyleattached.cpp b/src/quickcontrols2/qquickstyleattached.cpp
index e72abde0..2ef07fd6 100644
--- a/src/quickcontrols2/qquickstyleattached.cpp
+++ b/src/quickcontrols2/qquickstyleattached.cpp
@@ -39,12 +39,33 @@
#include <QtCore/qfile.h>
#include <QtCore/qsettings.h>
#include <QtCore/qfileselector.h>
+#include <QtGui/qcolor.h>
+#include <QtGui/qpalette.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
#include <QtQuick/qquickwindow.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
QT_BEGIN_NAMESPACE
+static bool isDarkSystemTheme()
+{
+ if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
+ if (const QPalette *systemPalette = theme->palette(QPlatformTheme::SystemPalette)) {
+ const QColor textColor = systemPalette->color(QPalette::WindowText);
+ return textColor.red() > 128 && textColor.blue() > 128 && textColor.green() > 128;
+ }
+ }
+ return false;
+}
+
+Q_QUICKCONTROLS2_PRIVATE_EXPORT bool qt_is_dark_system_theme()
+{
+ static bool dark = isDarkSystemTheme();
+ return dark;
+}
+
static QQuickStyleAttached *attachedStyle(const QMetaObject *type, QObject *object, bool create = false)
{
if (!object)
diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp
index 5210a684..8dbbc064 100644
--- a/src/quickcontrols2/qquickstyleselector.cpp
+++ b/src/quickcontrols2/qquickstyleselector.cpp
@@ -35,12 +35,14 @@
#include "qquickstyleselector_p.h"
#include "qquickstyleselector_p_p.h"
#include "qquickstyle.h"
+#include "qquickstyle_p.h"
#include <QtCore/qdir.h>
#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
#include <QtCore/qsysinfo.h>
#include <QtCore/qlocale.h>
+#include <QtQml/qqmlfile.h>
#include <QtCore/private/qfileselector_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -56,6 +58,13 @@ static bool isLocalScheme(const QString &scheme)
return local;
}
+static QString ensureSlash(const QString &path)
+{
+ if (path.endsWith(QLatin1Char('/')))
+ return path;
+ return path + QLatin1Char('/');
+}
+
static QStringList allSelectors(const QString &style = QString())
{
static const QStringList platformSelectors = QFileSelectorPrivate::platformSelectors();
@@ -66,33 +75,6 @@ static QStringList allSelectors(const QString &style = QString())
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);
@@ -101,18 +83,35 @@ QString QQuickStyleSelectorPrivate::select(const QString &filePath) const
return filePath;
const QString path = fi.path();
- const QString ret = selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'),
- fi.fileName(), allSelectors(style));
+ const QString ret = QFileSelectorPrivate::selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'),
+ fi.fileName(), allSelectors(styleName), QChar());
if (!ret.isEmpty())
return ret;
return filePath;
}
+QString QQuickStyleSelectorPrivate::trySelect(const QString &filePath, const QString &fallback) const
+{
+ QFileInfo fi(filePath);
+ if (!fi.exists())
+ return fallback;
+
+ // the path contains the name of the custom/fallback style, so exclude it from
+ // the selectors. the rest of the selectors (os, locale) are still valid, though.
+ const QString path = fi.path();
+ const QString selectedPath = QFileSelectorPrivate::selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'),
+ fi.fileName(), allSelectors(), QChar());
+ if (selectedPath.startsWith(QLatin1Char(':')))
+ return QLatin1String("qrc") + selectedPath;
+ return QUrl::fromLocalFile(QFileInfo(selectedPath).absoluteFilePath()).toString();
+}
+
QQuickStyleSelector::QQuickStyleSelector() : d_ptr(new QQuickStyleSelectorPrivate)
{
Q_D(QQuickStyleSelector);
- d->style = QQuickStyle::name();
+ d->styleName = QQuickStyle::name();
+ d->stylePath = QQuickStyle::path();
}
QQuickStyleSelector::~QQuickStyleSelector()
@@ -129,29 +128,32 @@ void QQuickStyleSelector::setBaseUrl(const QUrl &url)
{
Q_D(QQuickStyleSelector);
d->baseUrl = url;
+ d->basePath = QQmlFile::urlToLocalFileOrQrc(url.toString(QUrl::StripTrailingSlash) + QLatin1Char('/'));
}
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();
- }
+
+ // 1) try selecting from a custom style path, for example ":/mystyle"
+ if (QQuickStylePrivate::isCustomStyle()) {
+ // NOTE: this path may contain a subset of controls
+ const QString selectedPath = d->trySelect(ensureSlash(d->stylePath) + d->styleName + QLatin1Char('/') + fileName);
+ if (!selectedPath.isEmpty())
+ return selectedPath;
}
- QString base = d->baseUrl.toString();
- if (!base.isEmpty() && !base.endsWith(QLatin1Char('/')))
- base += QLatin1Char('/');
+ // 2) try selecting from the fallback style path, for example QT_INSTALL_QML/QtQuick/Controls.2/Material
+ const QString fallbackStyle = QQuickStylePrivate::fallbackStyle();
+ if (!fallbackStyle.isEmpty()) {
+ // NOTE: this path may also contain a subset of controls
+ const QString selectedPath = d->trySelect(ensureSlash(d->basePath) + fallbackStyle + QLatin1Char('/') + fileName);
+ if (!selectedPath.isEmpty())
+ return selectedPath;
+ }
- QUrl url(base + fileName);
+ // 3) fallback to the default style that is guaranteed to contain all controls
+ QUrl url(ensureSlash(d->baseUrl.toString()) + fileName);
if (isLocalScheme(url.scheme())) {
QString equivalentPath = QLatin1Char(':') + url.path();
QString selectedPath = d->select(equivalentPath);
diff --git a/src/quickcontrols2/qquickstyleselector_p_p.h b/src/quickcontrols2/qquickstyleselector_p_p.h
index cc3f0a58..4ff28d5d 100644
--- a/src/quickcontrols2/qquickstyleselector_p_p.h
+++ b/src/quickcontrols2/qquickstyleselector_p_p.h
@@ -54,9 +54,12 @@ class QQuickStyleSelectorPrivate
{
public:
QString select(const QString &filePath) const;
+ QString trySelect(const QString &filePath, const QString &fallback = QString()) const;
QUrl baseUrl;
- QString style;
+ QString basePath;
+ QString styleName;
+ QString stylePath;
};
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp
new file mode 100644
index 00000000..540a8dd1
--- /dev/null
+++ b/src/quickcontrols2/qquicktumblerview.cpp
@@ -0,0 +1,273 @@
+/****************************************************************************
+**
+** 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 "qquicktumblerview_p.h"
+
+#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquicklistview_p.h>
+#include <QtQuick/private/qquickpathview_p.h>
+
+#include <QtQuickTemplates2/private/qquicktumbler_p.h>
+#include <QtQuickTemplates2/private/qquicktumbler_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickTumblerView::QQuickTumblerView(QQuickItem *parent) :
+ QQuickItem(parent),
+ m_tumbler(nullptr),
+ m_delegate(nullptr),
+ m_pathView(nullptr),
+ m_listView(nullptr),
+ m_path(nullptr)
+{
+ // We don't call createView() here because we don't know what the wrap flag is set to
+ // yet, and we don't want to create a view that might never get used.
+}
+
+QVariant QQuickTumblerView::model() const
+{
+ return m_model;
+}
+
+void QQuickTumblerView::setModel(const QVariant &model)
+{
+ if (model == m_model)
+ return;
+
+ m_model = model;
+
+ if (m_pathView) {
+ m_pathView->setModel(m_model);
+ } else if (m_listView) {
+ // QQuickItemView::setModel() resets the current index,
+ // but if we're still creating the Tumbler, it should be maintained.
+ const int oldCurrentIndex = m_listView->currentIndex();
+ m_listView->setModel(m_model);
+ if (!isComponentComplete())
+ m_listView->setCurrentIndex(oldCurrentIndex);
+ }
+
+ emit modelChanged();
+}
+
+QQmlComponent *QQuickTumblerView::delegate() const
+{
+ return m_delegate;
+}
+
+void QQuickTumblerView::setDelegate(QQmlComponent *delegate)
+{
+ if (delegate == m_delegate)
+ return;
+
+ m_delegate = delegate;
+
+ if (m_pathView)
+ m_pathView->setDelegate(m_delegate);
+ else if (m_listView)
+ m_listView->setDelegate(m_delegate);
+
+ emit delegateChanged();
+}
+
+QQuickPath *QQuickTumblerView::path() const
+{
+ return m_path;
+}
+
+void QQuickTumblerView::setPath(QQuickPath *path)
+{
+ if (path == m_path)
+ return;
+
+ m_path = path;
+ emit pathChanged();
+}
+
+void QQuickTumblerView::createView()
+{
+ Q_ASSERT(m_tumbler);
+
+ // We create a view regardless of whether or not we know
+ // the count yet, because we rely on the view to tell us the count.
+ if (m_tumbler->wrap()) {
+ if (m_listView) {
+ delete m_listView;
+ m_listView = nullptr;
+ }
+
+ if (!m_pathView) {
+ m_pathView = new QQuickPathView;
+ QQmlEngine::setContextForObject(m_pathView, qmlContext(this));
+ QQml_setParent_noEvent(m_pathView, this);
+ m_pathView->setParentItem(this);
+ m_pathView->setPath(m_path);
+ m_pathView->setDelegate(m_delegate);
+ m_pathView->setPreferredHighlightBegin(0.5);
+ m_pathView->setPreferredHighlightEnd(0.5);
+ m_pathView->setClip(true);
+
+ // Give the view a size.
+ updateView();
+ // Ensure that the model is set eventually.
+ polish();
+ }
+ } else {
+ if (m_pathView) {
+ delete m_pathView;
+ m_pathView = nullptr;
+ }
+
+ if (!m_listView) {
+ m_listView = new QQuickListView;
+ QQmlEngine::setContextForObject(m_listView, qmlContext(this));
+ QQml_setParent_noEvent(m_listView, this);
+ m_listView->setParentItem(this);
+ m_listView->setSnapMode(QQuickListView::SnapToItem);
+ m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
+ m_listView->setClip(true);
+ m_listView->setDelegate(m_delegate);
+
+ // Give the view a size.
+ updateView();
+ // Ensure that the model is set eventually.
+ polish();
+ }
+ }
+}
+
+// Called whever the size or visibleItemCount changes.
+void QQuickTumblerView::updateView()
+{
+ QQuickItem *theView = view();
+ if (!theView)
+ return;
+
+ theView->setSize(QSizeF(width(), height()));
+
+ // Can be called in geometryChanged when it might not have a parent item yet.
+ if (!m_tumbler)
+ return;
+
+ // Set view-specific properties that have a dependency on the size, etc.
+ if (m_pathView) {
+ m_pathView->setPathItemCount(m_tumbler->visibleItemCount() + 1);
+ m_pathView->setDragMargin(width() / 2);
+ } else {
+ m_listView->setPreferredHighlightBegin(height() / 2 - (height() / m_tumbler->visibleItemCount() / 2));
+ m_listView->setPreferredHighlightEnd(height() / 2 + (height() / m_tumbler->visibleItemCount() / 2));
+ }
+}
+
+void QQuickTumblerView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+ updateView();
+}
+
+void QQuickTumblerView::componentComplete()
+{
+ QQuickItem::componentComplete();
+ updateView();
+}
+
+void QQuickTumblerView::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
+{
+ QQuickItem::itemChange(change, data);
+
+ if (change == QQuickItem::ItemParentHasChanged && data.item) {
+ if (m_tumbler)
+ m_tumbler->disconnect(this);
+
+ m_tumbler = qobject_cast<QQuickTumbler*>(parentItem());
+
+ if (m_tumbler) {
+ // We assume that the parentChanged() signal of the tumbler will be emitted before its wrap property is set...
+ connect(m_tumbler, &QQuickTumbler::wrapChanged, this, &QQuickTumblerView::createView);
+ connect(m_tumbler, &QQuickTumbler::visibleItemCountChanged, this, &QQuickTumblerView::updateView);
+ }
+ }
+}
+
+void QQuickTumblerView::updatePolish()
+{
+ // There are certain cases where model count changes can potentially cause problems.
+ // An example of this is a ListModel that appends items in a for loop in Component.onCompleted.
+ // If we didn't delay assignment of the model, the PathView/ListView would be deleted in
+ // response to it emitting countChanged(), causing a crash. To avoid this issue,
+ // and to avoid the overhead of count affecting the wrap property, which in turn may
+ // unnecessarily create delegates that are never seen, we delay setting the model. This ensures that
+ // Component.onCompleted would have been finished, for example.
+ if (m_pathView && !m_pathView->model().isValid() && m_model.isValid()) {
+ // QQuickPathView::setPathItemCount() resets the offset animation,
+ // so we just skip the animation while constructing the view.
+ const int oldHighlightMoveDuration = m_pathView->highlightMoveDuration();
+ m_pathView->setHighlightMoveDuration(0);
+
+ // Setting model can change the count, which can affect the wrap, which can cause
+ // the current view to be deleted before setModel() is finished, which causes a crash.
+ // Since QQuickTumbler can't know about QQuickTumblerView, we use its private API to
+ // inform it that it should delay setting wrap.
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(m_tumbler);
+ tumblerPrivate->lockWrap();
+ m_pathView->setModel(m_model);
+ tumblerPrivate->unlockWrap();
+
+ // The count-depends-on-wrap behavior could cause wrap to change after
+ // the call above, so we must check that we're still using a PathView.
+ if (m_pathView)
+ m_pathView->setHighlightMoveDuration(oldHighlightMoveDuration);
+ } else if (m_listView && !m_listView->model().isValid() && m_model.isValid()) {
+ // Usually we'd do this in QQuickTumbler::setWrap(), but that will be too early for polishes.
+ const int currentIndex = m_tumbler->currentIndex();
+ m_listView->setModel(m_model);
+ m_listView->setCurrentIndex(currentIndex);
+ }
+}
+
+QQuickItem *QQuickTumblerView::view()
+{
+ if (!m_tumbler)
+ return nullptr;
+
+ if (m_tumbler->wrap())
+ return m_pathView;
+
+ return m_listView;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquicktumblerview_p.h b/src/quickcontrols2/qquicktumblerview_p.h
new file mode 100644
index 00000000..f3ba3721
--- /dev/null
+++ b/src/quickcontrols2/qquicktumblerview_p.h
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** 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 QQUICKTUMBLERVIEW_P_H
+#define QQUICKTUMBLERVIEW_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 <QQuickItem>
+#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickListView;
+class QQuickPath;
+class QQuickPathView;
+
+class QQuickTumbler;
+
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickTumblerView : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
+ Q_PROPERTY(QQuickPath *path READ path WRITE setPath NOTIFY pathChanged)
+
+public:
+ QQuickTumblerView(QQuickItem *parent = nullptr);
+
+ QVariant model() const;
+ void setModel(const QVariant &model);
+
+ QQmlComponent *delegate() const;
+ void setDelegate(QQmlComponent *delegate);
+
+ QQuickPath *path() const;
+ void setPath(QQuickPath *path);
+
+Q_SIGNALS:
+ void modelChanged();
+ void delegateChanged();
+ void pathChanged();
+
+protected:
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void componentComplete() override;
+ void itemChange(ItemChange change, const ItemChangeData &data) override;
+ void updatePolish() override;
+
+private:
+ QQuickItem *view();
+ void createView();
+ void updateView();
+
+ void wrapChange();
+
+ QQuickTumbler *m_tumbler;
+ QVariant m_model;
+ QQmlComponent *m_delegate;
+ QQuickPathView *m_pathView;
+ QQuickListView *m_listView;
+ QQuickPath *m_path;
+};
+
+QT_END_NAMESPACE
+
+#endif // TUMBLERVIEW_H
diff --git a/src/quickcontrols2/quickcontrols2.pri b/src/quickcontrols2/quickcontrols2.pri
index aaf01ed6..8e4e0046 100644
--- a/src/quickcontrols2/quickcontrols2.pri
+++ b/src/quickcontrols2/quickcontrols2.pri
@@ -2,11 +2,13 @@ HEADERS += \
$$PWD/qquickcolorimageprovider_p.h \
$$PWD/qquickproxytheme_p.h \
$$PWD/qquickstyle.h \
+ $$PWD/qquickstyle_p.h \
$$PWD/qquickstyleattached_p.h \
$$PWD/qquickstyleplugin_p.h \
$$PWD/qquickstyleselector_p.h \
$$PWD/qquickstyleselector_p_p.h \
- $$PWD/qquickpaddedrectangle_p.h
+ $$PWD/qquickpaddedrectangle_p.h \
+ $$PWD/qquicktumblerview_p.h
SOURCES += \
$$PWD/qquickcolorimageprovider.cpp \
@@ -15,4 +17,5 @@ SOURCES += \
$$PWD/qquickstyleattached.cpp \
$$PWD/qquickstyleplugin.cpp \
$$PWD/qquickstyleselector.cpp \
- $$PWD/qquickpaddedrectangle.cpp
+ $$PWD/qquickpaddedrectangle.cpp \
+ $$PWD/qquicktumblerview.cpp
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 75854d04..bee45554 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -330,6 +330,8 @@ void QQuickAbstractButton::setPressed(bool isPressed)
\qmlproperty bool QtQuick.Controls::AbstractButton::checked
This property holds whether the button is checked.
+
+ \sa checkable
*/
bool QQuickAbstractButton::isChecked() const
{
@@ -352,11 +354,21 @@ void QQuickAbstractButton::setChecked(bool checked)
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.
+/*!
+ \qmlproperty bool QtQuick.Controls::AbstractButton::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 checked to \c true forces this property to \c true.
+
+ The default value is \c false.
+
+ \sa checked
+*/
bool QQuickAbstractButton::isCheckable() const
{
Q_D(const QQuickAbstractButton);
@@ -372,6 +384,7 @@ void QQuickAbstractButton::setCheckable(bool checkable)
d->checkable = checkable;
setAccessibleProperty("checkable", checkable);
checkableChange();
+ emit checkableChanged();
}
/*!
@@ -474,8 +487,8 @@ 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));
+ setPressed(true);
if (d->autoRepeat) {
d->startRepeatDelay();
@@ -506,8 +519,8 @@ void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickAbstractButton);
QQuickControl::mousePressEvent(event);
- setPressed(true);
d->pressPoint = event->pos();
+ setPressed(true);
emit pressed();
diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h
index 779739de..97b5c06b 100644
--- a/src/quicktemplates2/qquickabstractbutton_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p.h
@@ -61,6 +61,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButton : public QQuickContr
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 checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL)
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
@@ -107,6 +108,7 @@ Q_SIGNALS:
void downChanged();
void pressedChanged();
void checkedChanged();
+ void checkableChanged();
void autoExclusiveChanged();
void indicatorChanged();
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index 8138a61d..688ad804 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
class QQuickButtonGroup;
-class QQuickAbstractButtonPrivate : public QQuickControlPrivate
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButtonPrivate : public QQuickControlPrivate
{
Q_DECLARE_PUBLIC(QQuickAbstractButton)
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 3a454353..87dc8816 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -42,6 +42,7 @@
#include "qquicktextfield_p.h"
#include "qquicktoolbar_p.h"
#include "qquicktabbar_p.h"
+#include "qquickdialogbuttonbox_p.h"
#include <QtCore/private/qobject_p.h>
#include <QtQuick/private/qquickitem_p.h>
@@ -68,7 +69,7 @@ QT_BEGIN_NAMESPACE
\image qtquickcontrols2-applicationwindow-wireframe.png
\qml
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
visible: true
@@ -153,7 +154,7 @@ public:
void relayout();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
void itemVisibilityChanged(QQuickItem *item) override;
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
@@ -223,11 +224,11 @@ void QQuickApplicationWindowPrivate::relayout()
}
}
-void QQuickApplicationWindowPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newRect, const QRectF &oldRect)
+void QQuickApplicationWindowPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
{
Q_UNUSED(item)
- Q_UNUSED(newRect)
- Q_UNUSED(oldRect)
+ Q_UNUSED(change)
+ Q_UNUSED(diff)
relayout();
}
@@ -357,8 +358,9 @@ void QQuickApplicationWindow::setBackground(QQuickItem *background)
}
\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.
+ \note Assigning a ToolBar, TabBar, or DialogButtonBox as a window header
+ automatically sets the respective \l ToolBar::position, \l TabBar::position,
+ or \l DialogButtonBox::position property to \c Header.
\sa footer, Page::header
*/
@@ -391,6 +393,8 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header)
toolBar->setPosition(QQuickToolBar::Header);
else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(header))
tabBar->setPosition(QQuickTabBar::Header);
+ else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(header))
+ buttonBox->setPosition(QQuickDialogButtonBox::Header);
}
if (isComponentComplete())
d->relayout();
@@ -411,8 +415,9 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header)
}
\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.
+ \note Assigning a ToolBar, TabBar, or DialogButtonBox as a window footer
+ automatically sets the respective \l ToolBar::position, \l TabBar::position,
+ or \l DialogButtonBox::position property to \c Footer.
\sa header, Page::footer
*/
@@ -445,6 +450,8 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer)
toolBar->setPosition(QQuickToolBar::Footer);
else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(footer))
tabBar->setPosition(QQuickTabBar::Footer);
+ else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(footer))
+ buttonBox->setPosition(QQuickDialogButtonBox::Footer);
}
if (isComponentComplete())
d->relayout();
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index ca6d4551..b11d2179 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -35,7 +35,7 @@
****************************************************************************/
#include "qquickbutton_p.h"
-#include "qquickabstractbutton_p_p.h"
+#include "qquickbutton_p_p.h"
#include <QtGui/qpa/qplatformtheme.h>
@@ -80,17 +80,6 @@ QT_BEGIN_NAMESPACE
\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)
{
@@ -101,26 +90,9 @@ QQuickButton::QQuickButton(QQuickItem *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()
+QQuickButton::QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent) :
+ QQuickAbstractButton(dd, parent)
{
- emit checkableChanged();
}
/*!
diff --git a/src/quicktemplates2/qquickbutton_p.h b/src/quicktemplates2/qquickbutton_p.h
index fafce150..5edbbe4e 100644
--- a/src/quicktemplates2/qquickbutton_p.h
+++ b/src/quicktemplates2/qquickbutton_p.h
@@ -57,7 +57,6 @@ 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)
@@ -72,13 +71,13 @@ public:
void setFlat(bool flat);
Q_SIGNALS:
- void checkableChanged();
void autoRepeatChanged();
void highlightedChanged();
void flatChanged();
protected:
- void checkableChange() override;
+ QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent);
+
void autoRepeatChange() override;
QFont defaultFont() const override;
diff --git a/src/quicktemplates2/qquickbutton_p_p.h b/src/quicktemplates2/qquickbutton_p_p.h
new file mode 100644
index 00000000..86663e9e
--- /dev/null
+++ b/src/quicktemplates2/qquickbutton_p_p.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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_P_H
+#define QQUICKBUTTON_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 QQuickButtonPrivate : public QQuickAbstractButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickButton)
+
+public:
+ QQuickButtonPrivate();
+
+ bool flat;
+ bool highlighted;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKBUTTON_P_P_H
diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp
index 6ed75a2b..89941c19 100644
--- a/src/quicktemplates2/qquickbuttongroup.cpp
+++ b/src/quicktemplates2/qquickbuttongroup.cpp
@@ -123,6 +123,32 @@ QT_BEGIN_NAMESPACE
\sa RadioButton, {Button Controls}
*/
+/*!
+ \qmlsignal QtQuick.Controls::ButtonGroup::clicked(AbstractButton button)
+ \since QtQuick.Controls 2.1
+
+ This signal is emitted when a \a button in the group has been clicked.
+
+ This signal is convenient for implementing a common signal handler for
+ all buttons in the same group.
+
+ \code
+ ButtonGroup {
+ buttons: column.children
+ onClicked: console.log("clicked:", button.text)
+ }
+
+ Column {
+ id: column
+ Button { text: "First" }
+ Button { text: "Second" }
+ Button { text: "Third" }
+ }
+ \endcode
+
+ \sa AbstractButton::clicked()
+*/
+
class QQuickButtonGroupPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QQuickButtonGroup)
@@ -131,6 +157,7 @@ public:
QQuickButtonGroupPrivate() : checkedButton(nullptr) { }
void clear();
+ void buttonClicked();
void _q_updateCurrent();
static void buttons_append(QQmlListProperty<QQuickAbstractButton> *prop, QQuickAbstractButton *obj);
@@ -146,11 +173,20 @@ void QQuickButtonGroupPrivate::clear()
{
for (QQuickAbstractButton *button : qAsConst(buttons)) {
QQuickAbstractButtonPrivate::get(button)->group = nullptr;
+ QObjectPrivate::disconnect(button, &QQuickAbstractButton::clicked, this, &QQuickButtonGroupPrivate::buttonClicked);
QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, this, &QQuickButtonGroupPrivate::_q_updateCurrent);
}
buttons.clear();
}
+void QQuickButtonGroupPrivate::buttonClicked()
+{
+ Q_Q(QQuickButtonGroup);
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(q->sender());
+ if (button)
+ emit q->clicked(button);
+}
+
void QQuickButtonGroupPrivate::_q_updateCurrent()
{
Q_Q(QQuickButtonGroup);
@@ -289,6 +325,7 @@ void QQuickButtonGroup::addButton(QQuickAbstractButton *button)
return;
QQuickAbstractButtonPrivate::get(button)->group = this;
+ QObjectPrivate::connect(button, &QQuickAbstractButton::clicked, d, &QQuickButtonGroupPrivate::buttonClicked);
QObjectPrivate::connect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::_q_updateCurrent);
if (button->isChecked())
@@ -316,6 +353,7 @@ void QQuickButtonGroup::removeButton(QQuickAbstractButton *button)
return;
QQuickAbstractButtonPrivate::get(button)->group = nullptr;
+ QObjectPrivate::disconnect(button, &QQuickAbstractButton::clicked, d, &QQuickButtonGroupPrivate::buttonClicked);
QObjectPrivate::disconnect(button, &QQuickAbstractButton::checkedChanged, d, &QQuickButtonGroupPrivate::_q_updateCurrent);
if (d->checkedButton == button)
diff --git a/src/quicktemplates2/qquickbuttongroup_p.h b/src/quicktemplates2/qquickbuttongroup_p.h
index baf4e13f..2202ae2f 100644
--- a/src/quicktemplates2/qquickbuttongroup_p.h
+++ b/src/quicktemplates2/qquickbuttongroup_p.h
@@ -83,6 +83,7 @@ public Q_SLOTS:
Q_SIGNALS:
void checkedButtonChanged();
void buttonsChanged();
+ Q_REVISION(1) void clicked(QQuickAbstractButton *button);
private:
Q_DISABLE_COPY(QQuickButtonGroup)
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 01f0f699..a0fcbe8c 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -170,7 +170,7 @@ class QQuickComboBoxPrivate : public QQuickControlPrivate
Q_DECLARE_PUBLIC(QQuickComboBox)
public:
- QQuickComboBoxPrivate() : pressed(false), ownModel(false), hasDisplayText(false), hasCurrentIndex(false),
+ QQuickComboBoxPrivate() : flat(false), pressed(false), ownModel(false), hasDisplayText(false), hasCurrentIndex(false),
highlightedIndex(-1), currentIndex(-1), delegateModel(nullptr),
delegate(nullptr), indicator(nullptr), popup(nullptr) { }
@@ -195,6 +195,7 @@ public:
void createDelegateModel();
+ bool flat;
bool pressed;
bool ownModel;
bool hasDisplayText;
@@ -532,6 +533,36 @@ QQmlInstanceModel *QQuickComboBox::delegateModel() const
}
/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty bool QtQuick.Controls::ComboBox::flat
+
+ This property holds whether the combo box button is flat.
+
+ A flat combo box button does not draw a background unless it is interacted
+ with. In comparison to normal combo boxes, flat combo boxes provide looks
+ that make them stand out less from the rest of the UI. For instance, when
+ placing a combo box into a tool bar, it may be desirable to make the combo
+ box flat so it matches better with the flat looks of tool buttons.
+
+ The default value is \c false.
+*/
+bool QQuickComboBox::isFlat() const
+{
+ Q_D(const QQuickComboBox);
+ return d->flat;
+}
+
+void QQuickComboBox::setFlat(bool flat)
+{
+ Q_D(QQuickComboBox);
+ if (d->flat == flat)
+ return;
+
+ d->flat = flat;
+ emit flatChanged();
+}
+
+/*!
\qmlproperty bool QtQuick.Controls::ComboBox::pressed
This property holds whether the combo box button is pressed.
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index 4cbdd77b..0e18a4d5 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -62,6 +62,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl
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 flat READ isFlat WRITE setFlat NOTIFY flatChanged FINAL REVISION 1)
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)
@@ -82,6 +83,9 @@ public:
void setModel(const QVariant &model);
QQmlInstanceModel *delegateModel() const;
+ bool isFlat() const;
+ void setFlat(bool flat);
+
bool isPressed() const;
void setPressed(bool pressed);
@@ -119,6 +123,7 @@ Q_SIGNALS:
void countChanged();
void modelChanged();
void delegateModelChanged();
+ Q_REVISION(1) void flatChanged();
void pressedChanged();
void highlightedIndexChanged();
void currentIndexChanged();
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index c95cfc75..decc6e8a 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -548,7 +548,7 @@ QQmlListProperty<QQuickItem> QQuickContainer::contentChildren()
This property holds the index of the current item.
- \sa currentItem
+ \sa currentItem, incrementCurrentIndex(), decrementCurrentIndex()
*/
int QQuickContainer::currentIndex() const
{
@@ -568,6 +568,36 @@ void QQuickContainer::setCurrentIndex(int index)
}
/*!
+ \qmlmethod void QtQuick.Controls::Container::incrementCurrentIndex()
+ \since QtQuick.Controls 2.1
+
+ Increments the current index of the container.
+
+ \sa currentIndex
+*/
+void QQuickContainer::incrementCurrentIndex()
+{
+ Q_D(QQuickContainer);
+ if (d->currentIndex < count() - 1)
+ setCurrentIndex(d->currentIndex + 1);
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Container::decrementCurrentIndex()
+ \since QtQuick.Controls 2.1
+
+ Decrements the current index of the container.
+
+ \sa currentIndex
+*/
+void QQuickContainer::decrementCurrentIndex()
+{
+ Q_D(QQuickContainer);
+ if (d->currentIndex > 0)
+ setCurrentIndex(d->currentIndex - 1);
+}
+
+/*!
\qmlproperty Item QtQuick.Controls::Container::currentItem
\readonly
diff --git a/src/quicktemplates2/qquickcontainer_p.h b/src/quicktemplates2/qquickcontainer_p.h
index 2ed30b77..98873c09 100644
--- a/src/quicktemplates2/qquickcontainer_p.h
+++ b/src/quicktemplates2/qquickcontainer_p.h
@@ -86,6 +86,8 @@ public:
public Q_SLOTS:
void setCurrentIndex(int index);
+ Q_REVISION(1) void incrementCurrentIndex();
+ Q_REVISION(1) void decrementCurrentIndex();
Q_SIGNALS:
void countChanged();
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index cb891ee9..d8088f24 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -109,7 +109,8 @@ QQuickControlPrivate::ExtraData::ExtraData()
}
QQuickControlPrivate::QQuickControlPrivate() :
- hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false), hasLocale(false), hovered(false), wheelEnabled(false),
+ hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false),
+ hasLocale(false), hovered(false), wheelEnabled(false), explicitHoverEnabled(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)
@@ -214,6 +215,11 @@ void QQuickControlPrivate::resizeContent()
}
}
+QQuickItem *QQuickControlPrivate::getContentItem()
+{
+ return contentItem;
+}
+
#ifndef QT_NO_ACCESSIBILITY
void QQuickControlPrivate::accessibilityActiveChanged(bool active)
{
@@ -356,6 +362,62 @@ void QQuickControlPrivate::updateFontRecur(QQuickItem *item, const QFont &f)
}
}
+void QQuickControlPrivate::updateHoverEnabled(bool enabled, bool xplicit)
+{
+ Q_Q(QQuickControl);
+ if (!xplicit && explicitHoverEnabled)
+ return;
+
+ bool wasEnabled = q->isHoverEnabled();
+ explicitHoverEnabled = xplicit;
+ if (wasEnabled != enabled) {
+ q->setAcceptHoverEvents(enabled);
+ QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
+ emit q->hoverEnabledChanged();
+ }
+}
+
+void QQuickControlPrivate::updateHoverEnabledRecur(QQuickItem *item, bool enabled)
+{
+ const auto childItems = item->childItems();
+ for (QQuickItem *child : childItems) {
+ if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
+ QQuickControlPrivate::get(control)->updateHoverEnabled(enabled, false);
+ else
+ updateHoverEnabledRecur(child, enabled);
+ }
+}
+
+bool QQuickControlPrivate::calcHoverEnabled(const QQuickItem *item)
+{
+ const QQuickItem *p = item;
+ while (p) {
+ // QQuickPopupItem accepts hover events to avoid leaking them through.
+ // Don't inherit that to the children of the popup, but fallback to the
+ // environment variable or style hint.
+ if (qobject_cast<const QQuickPopupItem *>(p))
+ break;
+
+ if (const QQuickControl *control = qobject_cast<const QQuickControl *>(p))
+ return control->isHoverEnabled();
+
+ QVariant v = p->property("hoverEnabled");
+ if (v.isValid() && v.userType() == QMetaType::Bool)
+ return v.toBool();
+
+ p = p->parentItem();
+ }
+
+ bool ok = false;
+ int env = qEnvironmentVariableIntValue("QT_QUICK_CONTROLS_HOVER_ENABLED", &ok);
+ if (ok)
+ return env != 0;
+
+ // TODO: QQuickApplicationWindow::isHoverEnabled()
+
+ return QGuiApplication::styleHints()->useHoverEffects();
+}
+
QString QQuickControl::accessibleName() const
{
#ifndef QT_NO_ACCESSIBILITY
@@ -424,6 +486,8 @@ void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::
d->resolveFont();
if (!d->hasLocale)
d->updateLocale(QQuickControlPrivate::calcLocale(d->parentItem), false); // explicit=false
+ if (!d->explicitHoverEnabled)
+ d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
}
break;
case ItemActiveFocusHasChanged:
@@ -702,10 +766,13 @@ qreal QQuickControl::spacing() const
void QQuickControl::setSpacing(qreal spacing)
{
Q_D(QQuickControl);
- if (!qFuzzyCompare(d->spacing, spacing)) {
- d->spacing = spacing;
- emit spacingChanged();
- }
+ if (qFuzzyCompare(d->spacing, spacing))
+ return;
+
+ qreal oldSpacing = d->spacing;
+ d->spacing = spacing;
+ emit spacingChanged();
+ spacingChange(spacing, oldSpacing);
}
void QQuickControl::resetSpacing()
@@ -936,12 +1003,21 @@ void QQuickControl::setHovered(bool hovered)
d->hovered = hovered;
emit hoveredChanged();
+ hoverChange();
}
/*!
\qmlproperty bool QtQuick.Controls::Control::hoverEnabled
- This property determines whether the control accepts hover events. The default value is \c false.
+ This property determines whether the control accepts hover events. The default value
+ is \c Qt.styleHints.useHoverEffects.
+
+ Setting this property propagates the value to all child controls that do not have
+ \c hoverEnabled explicitly set.
+
+ You can also enable or disable hover effects for all Qt Quick Controls 2 applications
+ by setting the \c QT_QUICK_CONTROLS_HOVER_ENABLED \l {Supported Environment Variables
+ in Qt Quick Controls 2}{environment variable}.
\sa hovered
*/
@@ -954,11 +1030,20 @@ bool QQuickControl::isHoverEnabled() const
void QQuickControl::setHoverEnabled(bool enabled)
{
Q_D(QQuickControl);
- if (enabled == d->hoverEnabled)
+ if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
return;
- setAcceptHoverEvents(enabled);
- emit hoverEnabledChanged();
+ d->updateHoverEnabled(enabled, true); // explicit=true
+}
+
+void QQuickControl::resetHoverEnabled()
+{
+ Q_D(QQuickControl);
+ if (!d->explicitHoverEnabled)
+ return;
+
+ d->explicitHoverEnabled = false;
+ d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
}
/*!
@@ -1062,8 +1147,8 @@ void QQuickControl::setBackground(QQuickItem *background)
*/
QQuickItem *QQuickControl::contentItem() const
{
- Q_D(const QQuickControl);
- return d->contentItem;
+ QQuickControlPrivate *d = const_cast<QQuickControlPrivate *>(d_func());
+ return d->getContentItem();
}
void QQuickControl::setContentItem(QQuickItem *item)
@@ -1097,6 +1182,8 @@ void QQuickControl::componentComplete()
QQuickItem::componentComplete();
if (!d->hasLocale)
d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
+ if (!d->explicitHoverEnabled)
+ setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
#ifndef QT_NO_ACCESSIBILITY
if (!d->accessibleAttached && QAccessible::isActive())
accessibilityActiveChanged(true);
@@ -1198,11 +1285,21 @@ void QQuickControl::fontChange(const QFont &newFont, const QFont &oldFont)
Q_UNUSED(oldFont);
}
+void QQuickControl::hoverChange()
+{
+}
+
void QQuickControl::mirrorChange()
{
emit mirroredChanged();
}
+void QQuickControl::spacingChange(qreal newSpacing, qreal oldSpacing)
+{
+ Q_UNUSED(newSpacing);
+ Q_UNUSED(oldSpacing);
+}
+
void QQuickControl::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
{
Q_D(QQuickControl);
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
index d9827017..3bc21684 100644
--- a/src/quicktemplates2/qquickcontrol_p.h
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -74,7 +74,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControl : public QQuickItem
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 hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled 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)
@@ -132,6 +132,7 @@ public:
bool isHoverEnabled() const;
void setHoverEnabled(bool enabled);
+ void resetHoverEnabled();
bool isWheelEnabled() const;
void setWheelEnabled(bool enabled);
@@ -186,7 +187,9 @@ protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
virtual void fontChange(const QFont &newFont, const QFont &oldFont);
+ virtual void hoverChange();
virtual void mirrorChange();
+ virtual void spacingChange(qreal newSpacing, qreal oldSpacing);
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);
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
index 64f29986..cae1ae59 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -88,6 +88,8 @@ public:
void resizeBackground();
virtual void resizeContent();
+ virtual QQuickItem *getContentItem();
+
#ifndef QT_NO_ACCESSIBILITY
void accessibilityActiveChanged(bool active) override;
QAccessible::Role accessibleRole() const override;
@@ -109,6 +111,10 @@ public:
static void updateLocaleRecur(QQuickItem *item, const QLocale &l);
static QLocale calcLocale(const QQuickItem *item);
+ void updateHoverEnabled(bool enabled, bool xplicit);
+ static void updateHoverEnabledRecur(QQuickItem *item, bool enabled);
+ static bool calcHoverEnabled(const QQuickItem *item);
+
void deleteDelegate(QObject *object);
struct ExtraData {
@@ -129,6 +135,7 @@ public:
bool hasLocale;
bool hovered;
bool wheelEnabled;
+ bool explicitHoverEnabled;
qreal padding;
qreal topPadding;
qreal leftPadding;
diff --git a/src/quicktemplates2/qquickdialog.cpp b/src/quicktemplates2/qquickdialog.cpp
new file mode 100644
index 00000000..c84c9269
--- /dev/null
+++ b/src/quicktemplates2/qquickdialog.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 "qquickdialog_p.h"
+#include "qquickdialog_p_p.h"
+#include "qquickdialogbuttonbox_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Dialog
+ \inherits Popup
+ \instantiates QQuickDialog
+ \inqmlmodule QtQuick.Controls
+ \ingroup qtquickcontrols2-dialogs
+ \ingroup qtquickcontrols2-popups
+ \brief Popup dialog with standard buttons and a title, used for short-term interaction with the user.
+ \since 5.8
+
+ A dialog is a popup mostly used for short-term tasks and brief communications
+ with the user. Similarly to \l ApplicationWindow and \l Page, Dialog is organized
+ into three sections: \l header, \l {Popup::}{contentItem}, and \l footer.
+
+ \image qtquickcontrols2-page-wireframe.png
+
+ \section1 Dialog Title and Buttons
+
+ Dialog's \l title is displayed by a style-specific title bar that is assigned
+ as a dialog \l header by default.
+
+ Dialog's standard buttons are managed by a \l DialogButtonBox that is assigned
+ as a dialog \l footer by default. The dialog's \l standardButtons property is
+ forwarded to the respective property of the button box. Furthermore, the
+ \l {DialogButtonBox::}{accepted()} and \l {DialogButtonBox::}{rejected()}
+ signals of the button box are connected to the respective signals in Dialog.
+
+ \snippet qtquickcontrols2-dialog.qml 1
+
+ \section1 Modal Dialogs
+
+ A \l {Popup::}{modal} dialog blocks input to other content beneath
+ the dialog. When a modal dialog is opened, the user must finish
+ interacting with the dialog and close it before they can access any
+ other content in the same window.
+
+ \snippet qtquickcontrols2-dialog-modal.qml 1
+
+ \section1 Modeless Dialogs
+
+ A modeless dialog is a dialog that operates independently of other
+ content around the dialog. When a modeless dialog is opened, the user
+ is allowed to interact with both the dialog and the other content in
+ the same window.
+
+ \snippet qtquickcontrols2-dialog-modeless.qml 1
+
+ \sa DialogButtonBox, {Popup Controls}
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::Dialog::accepted()
+
+ This signal is emitted when the dialog has been accepted either
+ interactively or by calling \l accept().
+
+ \note This signal is \e not emitted when closing the dialog with
+ \l {Popup::}{close()} or setting \l {Popup::}{visible} to \c false.
+
+ \sa rejected()
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::Dialog::rejected()
+
+ This signal is emitted when the dialog has been rejected either
+ interactively or by calling \l reject().
+
+ \note This signal is \e not emitted when closing the dialog with
+ \l {Popup::}{close()} or setting \l {Popup::}{visible} to \c false.
+
+ \sa accepted()
+*/
+
+QQuickDialog::QQuickDialog(QObject *parent) :
+ QQuickPopup(*(new QQuickDialogPrivate), parent)
+{
+ Q_D(QQuickDialog);
+ d->layout.reset(new QQuickPageLayout(d->popupItem));
+}
+
+/*!
+ \qmlproperty string QtQuick.Controls::Dialog::title
+
+ This property holds the dialog title.
+
+ The title is displayed in the dialog header.
+
+ \code
+ Dialog {
+ title: qsTr("About")
+
+ Label {
+ text: "Lorem ipsum..."
+ }
+ }
+ \endcode
+*/
+QString QQuickDialog::title() const
+{
+ Q_D(const QQuickDialog);
+ return d->title;
+}
+
+void QQuickDialog::setTitle(const QString &title)
+{
+ Q_D(QQuickDialog);
+ if (d->title == title)
+ return;
+
+ d->title = title;
+ setAccessibleName(title);
+ emit titleChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Dialog::header
+
+ This property holds the dialog header item. The header item is positioned to
+ the top, and resized to the width of the dialog. The default value is \c null.
+
+ \note Assigning a \l DialogButtonBox as a dialog header automatically connects
+ its \l {DialogButtonBox::}{accepted()} and \l {DialogButtonBox::}{rejected()}
+ signals to the respective signals in Dialog.
+
+ \note Assigning a \l DialogButtonBox, \l ToolBar, or \l TabBar as a dialog
+ header automatically sets the respective \l DialogButtonBox::position,
+ \l ToolBar::position, or \l TabBar::position property to \c Header.
+
+ \sa footer
+*/
+QQuickItem *QQuickDialog::header() const
+{
+ Q_D(const QQuickDialog);
+ return d->layout->header();
+}
+
+void QQuickDialog::setHeader(QQuickItem *header)
+{
+ Q_D(QQuickDialog);
+ QQuickItem *oldHeader = d->layout->header();
+ if (!d->layout->setHeader(header))
+ return;
+
+ if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(oldHeader)) {
+ disconnect(buttonBox, &QQuickDialogButtonBox::accepted, this, &QQuickDialog::accept);
+ disconnect(buttonBox, &QQuickDialogButtonBox::rejected, this, &QQuickDialog::reject);
+ if (d->buttonBox == buttonBox)
+ d->buttonBox = nullptr;
+ }
+ if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(header)) {
+ connect(buttonBox, &QQuickDialogButtonBox::accepted, this, &QQuickDialog::accept);
+ connect(buttonBox, &QQuickDialogButtonBox::rejected, this, &QQuickDialog::reject);
+ d->buttonBox = buttonBox;
+ buttonBox->setStandardButtons(d->standardButtons);
+ }
+
+ if (isComponentComplete())
+ d->layout->update();
+ emit headerChanged();
+}
+
+/*!
+ \qmlproperty Item QtQuick.Controls::Dialog::footer
+
+ This property holds the dialog footer item. The footer item is positioned to
+ the bottom, and resized to the width of the dialog. The default value is \c null.
+
+ \note Assigning a \l DialogButtonBox as a dialog footer automatically connects
+ its \l {DialogButtonBox::}{accepted()} and \l {DialogButtonBox::}{rejected()}
+ signals to the respective signals in Dialog.
+
+ \note Assigning a \l DialogButtonBox, \l ToolBar, or \l TabBar as a dialog
+ footer automatically sets the respective \l DialogButtonBox::position,
+ \l ToolBar::position, or \l TabBar::position property to \c Footer.
+
+ \sa header
+*/
+QQuickItem *QQuickDialog::footer() const
+{
+ Q_D(const QQuickDialog);
+ return d->layout->footer();
+}
+
+void QQuickDialog::setFooter(QQuickItem *footer)
+{
+ Q_D(QQuickDialog);
+ QQuickItem *oldFooter = d->layout->footer();
+ if (!d->layout->setFooter(footer))
+ return;
+
+ if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(oldFooter)) {
+ disconnect(buttonBox, &QQuickDialogButtonBox::accepted, this, &QQuickDialog::accept);
+ disconnect(buttonBox, &QQuickDialogButtonBox::rejected, this, &QQuickDialog::reject);
+ if (d->buttonBox == buttonBox)
+ d->buttonBox = nullptr;
+ }
+ if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(footer)) {
+ connect(buttonBox, &QQuickDialogButtonBox::accepted, this, &QQuickDialog::accept);
+ connect(buttonBox, &QQuickDialogButtonBox::rejected, this, &QQuickDialog::reject);
+ d->buttonBox = buttonBox;
+ buttonBox->setStandardButtons(d->standardButtons);
+ }
+
+ if (isComponentComplete())
+ d->layout->update();
+ emit footerChanged();
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::Dialog::standardButtons
+
+ This property holds a combination of standard buttons that are used by the dialog.
+
+ \snippet qtquickcontrols2-dialog.qml 1
+
+ Possible flags:
+ \value Dialog.Ok An "OK" button defined with the \c AcceptRole.
+ \value Dialog.Open An "Open" button defined with the \c AcceptRole.
+ \value Dialog.Save A "Save" button defined with the \c AcceptRole.
+ \value Dialog.Cancel A "Cancel" button defined with the \c RejectRole.
+ \value Dialog.Close A "Close" button defined with the \c RejectRole.
+ \value Dialog.Discard A "Discard" or "Don't Save" button, depending on the platform, defined with the \c DestructiveRole.
+ \value Dialog.Apply An "Apply" button defined with the \c ApplyRole.
+ \value Dialog.Reset A "Reset" button defined with the \c ResetRole.
+ \value Dialog.RestoreDefaults A "Restore Defaults" button defined with the \c ResetRole.
+ \value Dialog.Help A "Help" button defined with the \c HelpRole.
+ \value Dialog.SaveAll A "Save All" button defined with the \c AcceptRole.
+ \value Dialog.Yes A "Yes" button defined with the \c YesRole.
+ \value Dialog.YesToAll A "Yes to All" button defined with the \c YesRole.
+ \value Dialog.No A "No" button defined with the \c NoRole.
+ \value Dialog.NoToAll A "No to All" button defined with the \c NoRole.
+ \value Dialog.Abort An "Abort" button defined with the \c RejectRole.
+ \value Dialog.Retry A "Retry" button defined with the \c AcceptRole.
+ \value Dialog.Ignore An "Ignore" button defined with the \c AcceptRole.
+ \value Dialog.NoButton An invalid button.
+
+ \sa DialogButtonBox
+*/
+QPlatformDialogHelper::StandardButtons QQuickDialog::standardButtons() const
+{
+ Q_D(const QQuickDialog);
+ return d->standardButtons;
+}
+
+void QQuickDialog::setStandardButtons(QPlatformDialogHelper::StandardButtons buttons)
+{
+ Q_D(QQuickDialog);
+ if (d->standardButtons == buttons)
+ return;
+
+ d->standardButtons = buttons;
+ if (d->buttonBox)
+ d->buttonBox->setStandardButtons(buttons);
+ emit standardButtonsChanged();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Dialog::accept()
+
+ Closes the dialog and emits the \l accepted() signal.
+
+ \sa reject()
+*/
+void QQuickDialog::accept()
+{
+ close();
+ emit accepted();
+}
+
+/*!
+ \qmlmethod void QtQuick.Controls::Dialog::reject()
+
+ Closes the dialog and emits the \l rejected() signal.
+
+ \sa accept()
+*/
+void QQuickDialog::reject()
+{
+ close();
+ emit rejected();
+}
+
+void QQuickDialog::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickDialog);
+ QQuickPopup::geometryChanged(newGeometry, oldGeometry);
+ d->layout->update();
+}
+
+void QQuickDialog::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
+{
+ Q_D(QQuickDialog);
+ QQuickPopup::paddingChange(newPadding, oldPadding);
+ d->layout->update();
+}
+
+void QQuickDialog::spacingChange(qreal newSpacing, qreal oldSpacing)
+{
+ Q_D(QQuickDialog);
+ QQuickPopup::spacingChange(newSpacing, oldSpacing);
+ d->layout->update();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickDialog::accessibleRole() const
+{
+ return QAccessible::Dialog;
+}
+
+void QQuickDialog::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickDialog);
+ QQuickPopup::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->title);
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickdialog_p.h b/src/quicktemplates2/qquickdialog_p.h
new file mode 100644
index 00000000..6ec440bf
--- /dev/null
+++ b/src/quicktemplates2/qquickdialog_p.h
@@ -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$
+**
+****************************************************************************/
+
+#ifndef QQUICKDIALOG_P_H
+#define QQUICKDIALOG_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>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDialogPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup
+{
+ 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(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
+ Q_FLAGS(QPlatformDialogHelper::StandardButtons)
+
+public:
+ explicit QQuickDialog(QObject *parent = nullptr);
+
+ QString title() const;
+ void setTitle(const QString &title);
+
+ QQuickItem *header() const;
+ void setHeader(QQuickItem *header);
+
+ QQuickItem *footer() const;
+ void setFooter(QQuickItem *footer);
+
+ QPlatformDialogHelper::StandardButtons standardButtons() const;
+ void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
+
+public Q_SLOTS:
+ void accept();
+ void reject();
+
+Q_SIGNALS:
+ void accepted();
+ void rejected();
+
+ void titleChanged();
+ void headerChanged();
+ void footerChanged();
+ void standardButtonsChanged();
+
+protected:
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
+ void spacingChange(qreal newSpacing, qreal oldSpacing) override;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickDialog)
+ Q_DECLARE_PRIVATE(QQuickDialog)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickDialog)
+
+#endif // QQUICKDIALOG_P_H
diff --git a/src/quicktemplates2/qquickdialog_p_p.h b/src/quicktemplates2/qquickdialog_p_p.h
new file mode 100644
index 00000000..5ea84cc8
--- /dev/null
+++ b/src/quicktemplates2/qquickdialog_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 QQUICKDIALOG_P_P_H
+#define QQUICKDIALOG_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/qquickpopup_p_p.h>
+#include <QtQuickTemplates2/private/qquickpagelayout_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDialogButtonBox;
+
+class QQuickDialogPrivate : public QQuickPopupPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDialog)
+
+public:
+ QQuickDialogPrivate() : buttonBox(nullptr) { }
+
+ static QQuickDialogPrivate *get(QQuickDialog *dialog)
+ {
+ return dialog->d_func();
+ }
+
+ QString title;
+ QQuickDialogButtonBox *buttonBox;
+ QScopedPointer<QQuickPageLayout> layout;
+ QPlatformDialogHelper::StandardButtons standardButtons;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDIALOG_P_P_H
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
new file mode 100644
index 00000000..10603d58
--- /dev/null
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -0,0 +1,672 @@
+/****************************************************************************
+**
+** 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 "qquickdialogbuttonbox_p.h"
+#include "qquickdialogbuttonbox_p_p.h"
+#include "qquickabstractbutton_p.h"
+#include "qquickbutton_p.h"
+
+#include <QtCore/qpointer.h>
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlcomponent.h>
+
+#include <algorithm>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype DialogButtonBox
+ \inherits Container
+ \instantiates QQuickDialogButtonBox
+ \inqmlmodule QtQuick.Controls
+ \ingroup qtquickcontrols2-dialogs
+ \brief A button box used in dialogs.
+ \since 5.8
+
+ Dialogs and message boxes typically present buttons in an order that
+ conforms to the interface guidelines for that platform. Invariably,
+ different platforms have their dialog buttons in different orders.
+ DialogButtonBox allows a developer to add buttons to it and will
+ automatically use the appropriate order for the user's platform.
+
+ Most buttons for a dialog follow certain roles. Such roles include:
+
+ \list
+ \li Accepting or rejecting the dialog.
+ \li Asking for help.
+ \li Performing actions on the dialog itself (such as resetting fields or
+ applying changes).
+ \endlist
+
+ There can also be alternate ways of dismissing the dialog which may cause
+ destructive results.
+
+ Most dialogs have buttons that can almost be considered standard (e.g.
+ \uicontrol OK and \uicontrol Cancel buttons). It is sometimes convenient
+ to create these buttons in a standard way.
+
+ There are a couple ways of using DialogButtonBox. One way is to specify
+ the standard buttons (e.g. \uicontrol OK, \uicontrol Cancel, \uicontrol Save)
+ and let the button box setup the buttons.
+
+ \image qtquickcontrols2-dialogbuttonbox.png
+
+ \snippet qtquickcontrols2-dialogbuttonbox.qml 1
+
+ Alternatively, buttons and their roles can be specified by hand:
+
+ \snippet qtquickcontrols2-dialogbuttonbox-attached.qml 1
+
+ You can also mix and match normal buttons and standard buttons.
+
+ When a button is clicked in the button box, the \l clicked() signal is
+ emitted for the actual button that is pressed. For convenience, if the
+ button has an \c AcceptRole, \c RejectRole, or \c HelpRole, the \l accepted(),
+ \l rejected(), or \l helpRequested() signals are emitted respectively.
+
+ \sa Dialog
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::DialogButtonBox::accepted()
+
+ This signal is emitted when a button defined with the \c AcceptRole or
+ \c YesRole is clicked.
+
+ \sa rejected(), clicked(), helpRequested()
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::DialogButtonBox::rejected()
+
+ This signal is emitted when a button defined with the \c RejectRole or
+ \c NoRole is clicked.
+
+ \sa accepted(), helpRequested(), clicked()
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::DialogButtonBox::helpRequested()
+
+ This signal is emitted when a button defined with the \c HelpRole is clicked.
+
+ \sa accepted(), rejected(), clicked()
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::DialogButtonBox::clicked(AbstractButton button)
+
+ This signal is emitted when a \a button inside the button box is clicked.
+
+ \sa accepted(), rejected(), helpRequested()
+*/
+
+static QPlatformDialogHelper::ButtonRole buttonRole(QQuickAbstractButton *button)
+{
+ const QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, false));
+ return attached ? attached->buttonRole() : QPlatformDialogHelper::InvalidRole;
+}
+
+QQuickDialogButtonBoxPrivate::QQuickDialogButtonBoxPrivate() :
+ alignment(0),
+ position(QQuickDialogButtonBox::Footer),
+ standardButtons(QPlatformDialogHelper::NoButton),
+ delegate(nullptr)
+{
+}
+
+void QQuickDialogButtonBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ resizeContent();
+}
+
+void QQuickDialogButtonBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_UNUSED(item);
+ resizeContent();
+}
+
+// adapted from QStyle::alignedRect()
+static QRectF alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSizeF &size, const QRectF &rectangle)
+{
+ alignment = QGuiApplicationPrivate::visualAlignment(direction, alignment);
+ qreal x = rectangle.x();
+ qreal y = rectangle.y();
+ qreal w = size.width();
+ qreal h = size.height();
+ if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)
+ y += rectangle.size().height() / 2 - h / 2;
+ else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom)
+ y += rectangle.size().height() - h;
+ if ((alignment & Qt::AlignRight) == Qt::AlignRight)
+ x += rectangle.size().width() - w;
+ else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter)
+ x += rectangle.size().width() / 2 - w / 2;
+ return QRectF(x, y, w, h);
+}
+
+void QQuickDialogButtonBoxPrivate::resizeContent()
+{
+ Q_Q(QQuickDialogButtonBox);
+ if (!contentItem)
+ return;
+
+ const int halign = alignment & Qt::AlignHorizontal_Mask;
+ const int valign = alignment & Qt::AlignVertical_Mask;
+
+ const qreal cw = !halign ? q->availableWidth() : contentItem->implicitWidth();
+ const qreal ch = !valign ? q->availableHeight() : contentItem->implicitWidth();
+
+ QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding());
+ if (halign || valign)
+ geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry);
+
+ contentItem->setPosition(geometry.topLeft());
+ contentItem->setSize(geometry.size());
+}
+
+void QQuickDialogButtonBoxPrivate::updateLayout()
+{
+ Q_Q(QQuickDialogButtonBox);
+ const int count = contentModel->count();
+ if (count <= 0)
+ return;
+
+ const int halign = alignment & Qt::AlignHorizontal_Mask;
+ const int valign = alignment & Qt::AlignVertical_Mask;
+
+ QVector<QQuickAbstractButton *> buttons;
+ const qreal maxItemWidth = (contentItem->width() - qMax(0, count - 1) * spacing) / count;
+ const qreal maxItemHeight = contentItem->height();
+
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ if (!p->widthValid) {
+ if (!halign)
+ item->setWidth(maxItemWidth);
+ else
+ item->resetWidth();
+ if (!valign)
+ item->setHeight(maxItemHeight);
+ else
+ item->resetHeight();
+ p->widthValid = false;
+ }
+ }
+ buttons += static_cast<QQuickAbstractButton *>(item);
+ }
+
+ struct ButtonLayout {
+ bool operator()(QQuickAbstractButton *first, QQuickAbstractButton *second)
+ {
+ const QPlatformDialogHelper::ButtonRole firstRole = buttonRole(first);
+ const QPlatformDialogHelper::ButtonRole secondRole = buttonRole(second);
+
+ if (firstRole != secondRole && firstRole != QPlatformDialogHelper::InvalidRole && secondRole != QPlatformDialogHelper::InvalidRole) {
+ const int *l = m_layout;
+ while (*l != QPlatformDialogHelper::EOL) {
+ const int role = (*l & ~QPlatformDialogHelper::Reverse);
+ if (role == firstRole)
+ return true;
+ if (role == secondRole)
+ return false;
+ ++l;
+ }
+ }
+
+ if (firstRole == secondRole)
+ return first < second;
+
+ return firstRole != QPlatformDialogHelper::InvalidRole;
+ }
+ const int *m_layout = QPlatformDialogHelper::buttonLayout();
+ };
+
+ std::sort(buttons.begin(), buttons.end(), ButtonLayout());
+
+ for (int i = 0; i < buttons.count() - 1; ++i)
+ q->insertItem(i, buttons.at(i));
+}
+
+void QQuickDialogButtonBoxPrivate::handleClick()
+{
+ Q_Q(QQuickDialogButtonBox);
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(q->sender());
+ if (!button)
+ return;
+
+ // Can't fetch this *after* emitting clicked, as clicked may destroy the button
+ // or change its role. Now changing the role is not possible yet, but arguably
+ // both clicked and accepted/rejected/etc. should be emitted "atomically"
+ // depending on whatever role the button had at the time of the click.
+ const QPlatformDialogHelper::ButtonRole role = buttonRole(button);
+ QPointer<QQuickDialogButtonBox> guard(q);
+
+ emit q->clicked(button);
+
+ if (!guard)
+ return;
+
+ switch (role) {
+ case QPlatformDialogHelper::AcceptRole:
+ case QPlatformDialogHelper::YesRole:
+ emit q->accepted();
+ break;
+ case QPlatformDialogHelper::RejectRole:
+ case QPlatformDialogHelper::NoRole:
+ emit q->rejected();
+ break;
+ case QPlatformDialogHelper::HelpRole:
+ emit q->helpRequested();
+ break;
+ default:
+ break;
+ }
+}
+
+QQuickAbstractButton *QQuickDialogButtonBoxPrivate::createStandardButton(QPlatformDialogHelper::StandardButton standardButton)
+{
+ Q_Q(QQuickDialogButtonBox);
+ if (!delegate)
+ return nullptr;
+
+ QQmlContext *creationContext = delegate->creationContext();
+ if (!creationContext)
+ creationContext = qmlContext(q);
+ QQmlContext *context = new QQmlContext(creationContext);
+ context->setContextObject(q);
+
+ QObject *object = delegate->beginCreate(context);
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton*>(object);
+ if (button) {
+ QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, true));
+ QQuickDialogButtonBoxAttachedPrivate::get(attached)->standardButton = standardButton;
+ attached->setButtonRole(QPlatformDialogHelper::buttonRole(standardButton));
+ button->setText(QPlatformTheme::removeMnemonics(QGuiApplicationPrivate::platformTheme()->standardButtonText(standardButton)));
+ delegate->completeCreate();
+ return button;
+ }
+
+ delete object;
+ return nullptr;
+}
+
+void QQuickDialogButtonBoxPrivate::removeStandardButtons()
+{
+ Q_Q(QQuickDialogButtonBox);
+ int i = q->count() - 1;
+ while (i >= 0) {
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(q->itemAt(i));
+ if (button) {
+ QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(button, false));
+ if (attached) {
+ QQuickDialogButtonBoxAttachedPrivate *p = QQuickDialogButtonBoxAttachedPrivate::get(attached);
+ if (p->standardButton != QPlatformDialogHelper::NoButton) {
+ q->removeItem(i);
+ button->deleteLater();
+ }
+ }
+ }
+ --i;
+ }
+}
+
+QQuickDialogButtonBox::QQuickDialogButtonBox(QQuickItem *parent) :
+ QQuickContainer(*(new QQuickDialogButtonBoxPrivate), parent)
+{
+}
+
+QQuickDialogButtonBox::~QQuickDialogButtonBox()
+{
+}
+
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::DialogButtonBox::position
+
+ This property holds the position of the button box.
+
+ \note If the button box is assigned as a header or footer of ApplicationWindow
+ or Page, the appropriate position is set automatically.
+
+ Possible values:
+ \value DialogButtonBox.Header The button box is at the top, as a window or page header.
+ \value DialogButtonBox.Footer The button box is at the bottom, as a window or page header.
+
+ The default value is \c Footer.
+
+ \sa Dialog::header, Dialog::footer
+*/
+QQuickDialogButtonBox::Position QQuickDialogButtonBox::position() const
+{
+ Q_D(const QQuickDialogButtonBox);
+ return d->position;
+}
+
+void QQuickDialogButtonBox::setPosition(Position position)
+{
+ Q_D(QQuickDialogButtonBox);
+ if (d->position == position)
+ return;
+
+ d->position = position;
+ emit positionChanged();
+}
+
+/*!
+ \qmlproperty flags QtQuick.Controls::DialogButtonBox::alignment
+
+ This property holds the alignment of the buttons.
+
+ Possible values:
+ \value undefined The buttons are resized to fill the available space.
+ \value Qt.AlignLeft The buttons are aligned to the left.
+ \value Qt.AlignHCenter The buttons are horizontally centered.
+ \value Qt.AlignRight The buttons are aligned to the right.
+ \value Qt.AlignTop The buttons are aligned to the top.
+ \value Qt.AlignVCenter The buttons are vertically centered.
+ \value Qt.AlignBottom The buttons are aligned to the bottom.
+*/
+Qt::Alignment QQuickDialogButtonBox::alignment() const
+{
+ Q_D(const QQuickDialogButtonBox);
+ return d->alignment;
+}
+
+void QQuickDialogButtonBox::setAlignment(Qt::Alignment alignment)
+{
+ Q_D(QQuickDialogButtonBox);
+ if (d->alignment == alignment)
+ return;
+
+ d->alignment = alignment;
+ if (isComponentComplete()) {
+ d->resizeContent();
+ polish();
+ }
+ emit alignmentChanged();
+}
+
+void QQuickDialogButtonBox::resetAlignment()
+{
+ setAlignment(0);
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::DialogButtonBox::standardButtons
+
+ This property holds a combination of standard buttons that are used by the button box.
+
+ \snippet qtquickcontrols2-dialogbuttonbox.qml 1
+
+ Possible flags:
+ \value DialogButtonBox.Ok An "OK" button defined with the \c AcceptRole.
+ \value DialogButtonBox.Open An "Open" button defined with the \c AcceptRole.
+ \value DialogButtonBox.Save A "Save" button defined with the \c AcceptRole.
+ \value DialogButtonBox.Cancel A "Cancel" button defined with the \c RejectRole.
+ \value DialogButtonBox.Close A "Close" button defined with the \c RejectRole.
+ \value DialogButtonBox.Discard A "Discard" or "Don't Save" button, depending on the platform, defined with the \c DestructiveRole.
+ \value DialogButtonBox.Apply An "Apply" button defined with the \c ApplyRole.
+ \value DialogButtonBox.Reset A "Reset" button defined with the \c ResetRole.
+ \value DialogButtonBox.RestoreDefaults A "Restore Defaults" button defined with the \c ResetRole.
+ \value DialogButtonBox.Help A "Help" button defined with the \c HelpRole.
+ \value DialogButtonBox.SaveAll A "Save All" button defined with the \c AcceptRole.
+ \value DialogButtonBox.Yes A "Yes" button defined with the \c YesRole.
+ \value DialogButtonBox.YesToAll A "Yes to All" button defined with the \c YesRole.
+ \value DialogButtonBox.No A "No" button defined with the \c NoRole.
+ \value DialogButtonBox.NoToAll A "No to All" button defined with the \c NoRole.
+ \value DialogButtonBox.Abort An "Abort" button defined with the \c RejectRole.
+ \value DialogButtonBox.Retry A "Retry" button defined with the \c AcceptRole.
+ \value DialogButtonBox.Ignore An "Ignore" button defined with the \c AcceptRole.
+ \value DialogButtonBox.NoButton An invalid button.
+
+ \sa standardButton()
+*/
+QPlatformDialogHelper::StandardButtons QQuickDialogButtonBox::standardButtons() const
+{
+ Q_D(const QQuickDialogButtonBox);
+ return d->standardButtons;
+}
+
+void QQuickDialogButtonBox::setStandardButtons(QPlatformDialogHelper::StandardButtons buttons)
+{
+ Q_D(QQuickDialogButtonBox);
+ if (d->standardButtons == buttons)
+ return;
+
+ d->removeStandardButtons();
+
+ for (int i = QPlatformDialogHelper::FirstButton; i <= QPlatformDialogHelper::LastButton; i<<=1) {
+ QPlatformDialogHelper::StandardButton standardButton = static_cast<QPlatformDialogHelper::StandardButton>(i);
+ if (standardButton & buttons) {
+ QQuickAbstractButton *button = d->createStandardButton(standardButton);
+ if (button)
+ addItem(button);
+ }
+ }
+
+ if (isComponentComplete())
+ polish();
+
+ d->standardButtons = buttons;
+ emit standardButtonsChanged();
+}
+
+/*!
+ \qmlmethod AbstractButton QtQuick.Controls::DialogButtonBox::standardButton(StandardButton button)
+
+ Returns the specified standard \a button, or \c null if it does not exist.
+
+ \sa standardButtons
+*/
+QQuickAbstractButton *QQuickDialogButtonBox::standardButton(QPlatformDialogHelper::StandardButton button) const
+{
+ Q_UNUSED(button);
+ return nullptr;
+}
+
+/*!
+ \qmlproperty Component QtQuick.Controls::DialogButtonBox::delegate
+
+ This property holds a delegate for creating standard buttons.
+
+ \sa standardButtons
+*/
+QQmlComponent *QQuickDialogButtonBox::delegate() const
+{
+ Q_D(const QQuickDialogButtonBox);
+ return d->delegate;
+}
+
+void QQuickDialogButtonBox::setDelegate(QQmlComponent* delegate)
+{
+ Q_D(QQuickDialogButtonBox);
+ if (d->delegate == delegate)
+ return;
+
+ delete d->delegate;
+ d->delegate = delegate;
+ emit delegateChanged();
+}
+
+QQuickDialogButtonBoxAttached *QQuickDialogButtonBox::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickDialogButtonBoxAttached(object);
+}
+
+void QQuickDialogButtonBox::updatePolish()
+{
+ Q_D(QQuickDialogButtonBox);
+ QQuickContainer::updatePolish();
+ d->updateLayout();
+}
+
+void QQuickDialogButtonBox::componentComplete()
+{
+ Q_D(QQuickDialogButtonBox);
+ QQuickContainer::componentComplete();
+ d->updateLayout();
+}
+
+void QQuickDialogButtonBox::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickDialogButtonBox);
+ QQuickContainer::geometryChanged(newGeometry, oldGeometry);
+ d->updateLayout();
+}
+
+void QQuickDialogButtonBox::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ Q_D(QQuickDialogButtonBox);
+ QQuickContainer::contentItemChange(newItem, oldItem);
+ if (oldItem)
+ QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+ if (newItem)
+ QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
+}
+
+bool QQuickDialogButtonBox::isContent(QQuickItem *item) const
+{
+ return qobject_cast<QQuickAbstractButton *>(item);
+}
+
+void QQuickDialogButtonBox::itemAdded(int index, QQuickItem *item)
+{
+ Q_D(QQuickDialogButtonBox);
+ Q_UNUSED(index);
+ if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(item))
+ QObjectPrivate::connect(button, &QQuickAbstractButton::clicked, d, &QQuickDialogButtonBoxPrivate::handleClick);
+ if (QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(item, false)))
+ QQuickDialogButtonBoxAttachedPrivate::get(attached)->setButtonBox(this);
+ if (isComponentComplete())
+ polish();
+}
+
+void QQuickDialogButtonBox::itemRemoved(int index, QQuickItem *item)
+{
+ Q_D(QQuickDialogButtonBox);
+ Q_UNUSED(index);
+ if (QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(item))
+ QObjectPrivate::disconnect(button, &QQuickAbstractButton::clicked, d, &QQuickDialogButtonBoxPrivate::handleClick);
+ if (QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(item, false)))
+ QQuickDialogButtonBoxAttachedPrivate::get(attached)->setButtonBox(nullptr);
+ if (isComponentComplete())
+ polish();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickDialogButtonBox::accessibleRole() const
+{
+ return QAccessible::PageTabList;
+}
+#endif
+
+void QQuickDialogButtonBoxAttachedPrivate::setButtonBox(QQuickDialogButtonBox *box)
+{
+ Q_Q(QQuickDialogButtonBoxAttached);
+ if (buttonBox == box)
+ return;
+
+ buttonBox = box;
+ emit q->buttonBoxChanged();
+}
+
+QQuickDialogButtonBoxAttached::QQuickDialogButtonBoxAttached(QObject *parent) :
+ QObject(*(new QQuickDialogButtonBoxAttachedPrivate), parent)
+{
+ Q_D(QQuickDialogButtonBoxAttached);
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent);
+ while (parentItem && !d->buttonBox) {
+ d->buttonBox = qobject_cast<QQuickDialogButtonBox *>(parentItem);
+ parentItem = parentItem->parentItem();
+ }
+}
+
+/*!
+ \qmlattachedproperty DialogButtonBox QtQuick.Controls::DialogButtonBox::buttonBox
+ \readonly
+
+ This attached property holds the button box that manages this button, or
+ \c null if the button is not in a button box.
+*/
+QQuickDialogButtonBox *QQuickDialogButtonBoxAttached::buttonBox() const
+{
+ Q_D(const QQuickDialogButtonBoxAttached);
+ return d->buttonBox;
+}
+
+/*!
+ \qmlattachedproperty enumeration QtQuick.Controls::DialogButtonBox::buttonRole
+
+ This attached property holds the role of each button in a button box.
+
+ \snippet qtquickcontrols2-dialogbuttonbox-attached.qml 1
+
+ Available values:
+ \value DialogButtonBox.InvalidRole The button is invalid.
+ \value DialogButtonBox.AcceptRole Clicking the button causes the dialog to be accepted (e.g. \uicontrol OK).
+ \value DialogButtonBox.RejectRole Clicking the button causes the dialog to be rejected (e.g. \uicontrol Cancel).
+ \value DialogButtonBox.DestructiveRole Clicking the button causes a destructive change (e.g. for discarding changes) and closes the dialog.
+ \value DialogButtonBox.ActionRole Clicking the button causes changes to the elements within the dialog.
+ \value DialogButtonBox.HelpRole The button can be clicked to request help.
+ \value DialogButtonBox.YesRole The button is a "Yes"-like button.
+ \value DialogButtonBox.NoRole The button is a "No"-like button.
+ \value DialogButtonBox.ResetRole The button resets the dialog's fields to default values.
+ \value DialogButtonBox.ApplyRole The button applies current changes.
+*/
+QPlatformDialogHelper::ButtonRole QQuickDialogButtonBoxAttached::buttonRole() const
+{
+ Q_D(const QQuickDialogButtonBoxAttached);
+ return d->buttonRole;
+}
+
+void QQuickDialogButtonBoxAttached::setButtonRole(QPlatformDialogHelper::ButtonRole role)
+{
+ Q_D(QQuickDialogButtonBoxAttached);
+ if (d->buttonRole == role)
+ return;
+
+ d->buttonRole = role;
+ emit buttonRoleChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p.h
new file mode 100644
index 00000000..445b645b
--- /dev/null
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** 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 QQUICKDIALOGBUTTONBOX_P_H
+#define QQUICKDIALOGBUTTONBOX_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>
+#include <QtGui/qpa/qplatformdialoghelper.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlComponent;
+class QQuickAbstractButton;
+class QQuickDialogButtonBoxPrivate;
+class QQuickDialogButtonBoxAttached;
+class QQuickDialogButtonBoxAttachedPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialogButtonBox : public QQuickContainer
+{
+ Q_OBJECT
+ Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
+ Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment RESET resetAlignment NOTIFY alignmentChanged FINAL)
+ Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
+ Q_FLAGS(QPlatformDialogHelper::StandardButtons)
+
+public:
+ explicit QQuickDialogButtonBox(QQuickItem *parent = nullptr);
+ ~QQuickDialogButtonBox();
+
+ enum Position {
+ Header,
+ Footer
+ };
+ Q_ENUM(Position)
+
+ Position position() const;
+ void setPosition(Position position);
+
+ Qt::Alignment alignment() const;
+ void setAlignment(Qt::Alignment alignment);
+ void resetAlignment();
+
+ QPlatformDialogHelper::StandardButtons standardButtons() const;
+ void setStandardButtons(QPlatformDialogHelper::StandardButtons buttons);
+ Q_INVOKABLE QQuickAbstractButton *standardButton(QPlatformDialogHelper::StandardButton button) const;
+
+ QQmlComponent *delegate() const;
+ void setDelegate(QQmlComponent *delegate);
+
+ static QQuickDialogButtonBoxAttached *qmlAttachedProperties(QObject *object);
+
+Q_SIGNALS:
+ void accepted();
+ void rejected();
+ void helpRequested();
+ void clicked(QQuickAbstractButton *button);
+
+ void positionChanged();
+ void alignmentChanged();
+ void standardButtonsChanged();
+ void delegateChanged();
+
+protected:
+ void updatePolish() override;
+ void componentComplete() override;
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) 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(QQuickDialogButtonBox)
+ Q_DECLARE_PRIVATE(QQuickDialogButtonBox)
+};
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialogButtonBoxAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickDialogButtonBox *buttonBox READ buttonBox NOTIFY buttonBoxChanged FINAL)
+ Q_PROPERTY(QPlatformDialogHelper::ButtonRole buttonRole READ buttonRole WRITE setButtonRole NOTIFY buttonRoleChanged FINAL)
+ Q_ENUMS(QPlatformDialogHelper::ButtonRole)
+
+public:
+ explicit QQuickDialogButtonBoxAttached(QObject *parent = nullptr);
+
+ QQuickDialogButtonBox *buttonBox() const;
+
+ QPlatformDialogHelper::ButtonRole buttonRole() const;
+ void setButtonRole(QPlatformDialogHelper::ButtonRole role);
+
+Q_SIGNALS:
+ void buttonBoxChanged();
+ void buttonRoleChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickDialogButtonBoxAttached)
+ Q_DECLARE_PRIVATE(QQuickDialogButtonBoxAttached)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickDialogButtonBox)
+QML_DECLARE_TYPEINFO(QQuickDialogButtonBox, QML_HAS_ATTACHED_PROPERTIES)
+
+#endif // QQUICKDIALOGBUTTONBOX_P_H
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
new file mode 100644
index 00000000..d25bd90a
--- /dev/null
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p_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 QQUICKDIALOGBUTTONBOX_P_P_H
+#define QQUICKDIALOGBUTTONBOX_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/qquickcontainer_p_p.h>
+#include <QtQuickTemplates2/private/qquickdialogbuttonbox_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickDialogButtonBoxPrivate : public QQuickContainerPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDialogButtonBox)
+
+public:
+ QQuickDialogButtonBoxPrivate();
+
+ static QQuickDialogButtonBoxPrivate *get(QQuickDialogButtonBox *box)
+ {
+ return box->d_func();
+ }
+
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
+ void resizeContent() override;
+ void updateLayout();
+ void handleClick();
+
+ QQuickAbstractButton *createStandardButton(QPlatformDialogHelper::StandardButton button);
+ void removeStandardButtons();
+
+ Qt::Alignment alignment;
+ QQuickDialogButtonBox::Position position;
+ QPlatformDialogHelper::StandardButtons standardButtons;
+ QQmlComponent *delegate;
+};
+
+class QQuickDialogButtonBoxAttachedPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickDialogButtonBoxAttached)
+
+public:
+ QQuickDialogButtonBoxAttachedPrivate() : buttonBox(nullptr),
+ buttonRole(QPlatformDialogHelper::InvalidRole),
+ standardButton(QPlatformDialogHelper::NoButton) { }
+
+ static QQuickDialogButtonBoxAttachedPrivate *get(QQuickDialogButtonBoxAttached *q)
+ {
+ return q->d_func();
+ }
+
+ void setButtonBox(QQuickDialogButtonBox *box);
+
+ QQuickDialogButtonBox *buttonBox;
+ QPlatformDialogHelper::ButtonRole buttonRole;
+ QPlatformDialogHelper::StandardButton standardButton;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKDIALOGBUTTONBOX_P_P_H
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 1dae911e..36493e79 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -118,7 +118,7 @@ QT_BEGIN_NAMESPACE
\code
import QtQuick 2.7
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
id: window
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 2203e574..ab5415d3 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -211,7 +211,7 @@ void QQuickMenuPrivate::itemDestroyed(QQuickItem *item)
removeItem(index, item);
}
-void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
{
if (complete)
resizeItems();
diff --git a/src/quicktemplates2/qquickmenu_p_p.h b/src/quicktemplates2/qquickmenu_p_p.h
index c27e6631..4ca3c379 100644
--- a/src/quicktemplates2/qquickmenu_p_p.h
+++ b/src/quicktemplates2/qquickmenu_p_p.h
@@ -76,7 +76,7 @@ public:
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 itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &diff) override;
void onItemPressed();
void onItemActiveFocusChanged();
diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
index 564d3f38..cb23df07 100644
--- a/src/quicktemplates2/qquickmenuitem.cpp
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -110,22 +110,6 @@ QQuickMenuItem::QQuickMenuItem(QQuickItem *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);
diff --git a/src/quicktemplates2/qquickmenuitem_p.h b/src/quicktemplates2/qquickmenuitem_p.h
index 6c717e13..258a096f 100644
--- a/src/quicktemplates2/qquickmenuitem_p.h
+++ b/src/quicktemplates2/qquickmenuitem_p.h
@@ -57,7 +57,6 @@ 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:
@@ -67,12 +66,10 @@ public:
void setHighlighted(bool highlighted);
Q_SIGNALS:
- void checkableChanged();
void triggered();
void highlightedChanged();
protected:
- void checkableChange() override;
QFont defaultFont() const override;
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/quicktemplates2/qquickmenuseparator.cpp b/src/quicktemplates2/qquickmenuseparator.cpp
new file mode 100644
index 00000000..9aea6a91
--- /dev/null
+++ b/src/quicktemplates2/qquickmenuseparator.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 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 "qquickmenuseparator_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype MenuSeparator
+ \inherits Control
+ \instantiates QQuickMenuSeparator
+ \inqmlmodule QtQuick.Controls
+ \since 5.8
+ \ingroup qtquickcontrols2-separators
+ \brief Separates a group of items in a menu from adjacent items.
+
+ MenuSeparator is used to visually distinguish between groups of items in a
+ menu by separating them with a line.
+
+ \image qtquickcontrols2-menuseparator.png
+
+ \quotefromfile qtquickcontrols2-menuseparator-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.1
+ \skipto Menu
+ \printto contentItem.parent: window
+ \skipline contentItem.parent: window
+ \printuntil text: qsTr("Exit")
+ \printuntil }
+ \printuntil }
+
+ \sa {Customizing MenuSeparator}, {Separator Controls}
+*/
+
+QQuickMenuSeparator::QQuickMenuSeparator(QQuickItem *parent) :
+ QQuickControl(parent)
+{
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickMenuSeparator::accessibleRole() const
+{
+ return QAccessible::Separator;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickmenuseparator_p.h b/src/quicktemplates2/qquickmenuseparator_p.h
new file mode 100644
index 00000000..95a8f8fa
--- /dev/null
+++ b/src/quicktemplates2/qquickmenuseparator_p.h
@@ -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 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 QQUICKMENUSEPARATOR_P_H
+#define QQUICKMENUSEPARATOR_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 Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuSeparator : public QQuickControl
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickMenuSeparator(QQuickItem *parent = nullptr);
+
+protected:
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickMenuSeparator)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickMenuSeparator)
+
+#endif // QQUICKMENUSEPARATOR_P_H
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index ba0dfc46..18500ae6 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -163,10 +163,10 @@ QVector<QQuickDrawer *> QQuickOverlayPrivate::stackingOrderDrawers() const
return sorted;
}
-void QQuickOverlayPrivate::itemGeometryChanged(QQuickItem *, const QRectF &newGeometry, const QRectF &)
+void QQuickOverlayPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange, const QRectF &)
{
Q_Q(QQuickOverlay);
- q->setSize(newGeometry.size());
+ q->setSize(QSizeF(item->width(), item->height()));
}
QQuickOverlayPrivate::QQuickOverlayPrivate() :
diff --git a/src/quicktemplates2/qquickoverlay_p_p.h b/src/quicktemplates2/qquickoverlay_p_p.h
index 6201908e..ef142f1b 100644
--- a/src/quicktemplates2/qquickoverlay_p_p.h
+++ b/src/quicktemplates2/qquickoverlay_p_p.h
@@ -83,7 +83,7 @@ public:
QVector<QQuickPopup *> stackingOrderPopups() const;
QVector<QQuickDrawer *> stackingOrderDrawers() const;
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
QQmlComponent *modal;
QQmlComponent *modeless;
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp
index c71ecd42..ad1e4ebd 100644
--- a/src/quicktemplates2/qquickpage.cpp
+++ b/src/quicktemplates2/qquickpage.cpp
@@ -36,10 +36,7 @@
#include "qquickpage_p.h"
#include "qquickcontrol_p_p.h"
-#include "qquicktoolbar_p.h"
-#include "qquicktabbar_p.h"
-
-#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include "qquickpagelayout_p_p.h"
QT_BEGIN_NAMESPACE
@@ -61,7 +58,7 @@ QT_BEGIN_NAMESPACE
toolbar header and an application-wide tabbar footer.
\qml
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
visible: true
@@ -85,81 +82,42 @@ QT_BEGIN_NAMESPACE
\sa ApplicationWindow, {Container Controls}
*/
-class QQuickPagePrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+class QQuickPagePrivate : public QQuickControlPrivate
{
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;
+ QQuickItem *getContentItem() override;
+ qreal contentWidth;
+ qreal contentHeight;
QString title;
- QQuickItem *header;
- QQuickItem *footer;
+ QScopedPointer<QQuickPageLayout> layout;
};
-QQuickPagePrivate::QQuickPagePrivate() : header(nullptr), footer(nullptr)
+QQuickPagePrivate::QQuickPagePrivate()
+ : contentWidth(0),
+ contentHeight(0)
{
}
-void QQuickPagePrivate::relayout()
+QQuickItem *QQuickPagePrivate::getContentItem()
{
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();
+ if (!contentItem)
+ contentItem = new QQuickItem(q);
+ return contentItem;
}
QQuickPage::QQuickPage(QQuickItem *parent) :
QQuickControl(*(new QQuickPagePrivate), parent)
{
+ Q_D(QQuickPage);
setFlag(ItemIsFocusScope);
setAcceptedMouseButtons(Qt::AllButtons);
+ d->layout.reset(new QQuickPageLayout(this));
}
/*!
@@ -221,43 +179,25 @@ void QQuickPage::setTitle(const QString &title)
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.
+ \note Assigning a ToolBar, TabBar, or DialogButtonBox as a page header
+ automatically sets the respective \l ToolBar::position, \l TabBar::position,
+ or \l DialogButtonBox::position property to \c Header.
\sa footer, ApplicationWindow::header
*/
QQuickItem *QQuickPage::header() const
{
Q_D(const QQuickPage);
- return d->header;
+ return d->layout->header();
}
void QQuickPage::setHeader(QQuickItem *header)
{
Q_D(QQuickPage);
- if (d->header == header)
+ if (!d->layout->setHeader(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();
+ d->layout->update();
emit headerChanged();
}
@@ -267,47 +207,79 @@ void QQuickPage::setHeader(QQuickItem *header)
This property holds the page footer item. The footer item is positioned to
the bottom, and resized to the width of the page. The default value is \c null.
- \note Assigning a ToolBar or TabBar as a page footer sets the respective
- \l ToolBar::position or \l TabBar::position property automatically to \c Footer.
+ \note Assigning a ToolBar, TabBar, or DialogButtonBox as a page footer
+ automatically sets the respective \l ToolBar::position, \l TabBar::position,
+ or \l DialogButtonBox::position property to \c Footer.
\sa header, ApplicationWindow::footer
*/
QQuickItem *QQuickPage::footer() const
{
Q_D(const QQuickPage);
- return d->footer;
+ return d->layout->footer();
}
void QQuickPage::setFooter(QQuickItem *footer)
{
Q_D(QQuickPage);
- if (d->footer == footer)
+ if (!d->layout->setFooter(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();
+ d->layout->update();
emit footerChanged();
}
/*!
+ \qmlproperty real QtQuick.Controls::Page::contentWidth
+ \since QtQuick.Controls 2.1
+
+ This property holds the content width. It is used for calculating the total
+ implicit width of the page.
+
+ \sa contentHeight
+*/
+qreal QQuickPage::contentWidth() const
+{
+ Q_D(const QQuickPage);
+ return d->contentWidth;
+}
+
+void QQuickPage::setContentWidth(qreal width)
+{
+ Q_D(QQuickPage);
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::Page::contentHeight
+ \since QtQuick.Controls 2.1
+
+ This property holds the content height. It is used for calculating the total
+ implicit height of the page.
+
+ \sa contentWidth
+*/
+qreal QQuickPage::contentHeight() const
+{
+ Q_D(const QQuickPage);
+ return d->contentHeight;
+}
+
+void QQuickPage::setContentHeight(qreal height)
+{
+ Q_D(QQuickPage);
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
+}
+
+/*!
\qmlproperty list<Object> QtQuick.Controls::Page::contentData
\default
@@ -324,7 +296,7 @@ void QQuickPage::setFooter(QQuickItem *footer)
QQmlListProperty<QObject> QQuickPage::contentData()
{
Q_D(QQuickPage);
- return QQmlListProperty<QObject>(d->contentItem, nullptr,
+ return QQmlListProperty<QObject>(d->getContentItem(), nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -347,7 +319,7 @@ QQmlListProperty<QObject> QQuickPage::contentData()
QQmlListProperty<QQuickItem> QQuickPage::contentChildren()
{
Q_D(QQuickPage);
- return QQmlListProperty<QQuickItem>(d->contentItem, nullptr,
+ return QQmlListProperty<QQuickItem>(d->getContentItem(), nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
@@ -368,14 +340,21 @@ void QQuickPage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeo
{
Q_D(QQuickPage);
QQuickControl::geometryChanged(newGeometry, oldGeometry);
- d->relayout();
+ d->layout->update();
}
void QQuickPage::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
{
Q_D(QQuickPage);
QQuickControl::paddingChange(newPadding, oldPadding);
- d->relayout();
+ d->layout->update();
+}
+
+void QQuickPage::spacingChange(qreal newSpacing, qreal oldSpacing)
+{
+ Q_D(QQuickPage);
+ QQuickControl::spacingChange(newSpacing, oldSpacing);
+ d->layout->update();
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h
index 64f7602f..6493cee7 100644
--- a/src/quicktemplates2/qquickpage_p.h
+++ b/src/quicktemplates2/qquickpage_p.h
@@ -61,6 +61,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPage : public QQuickControl
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(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL REVISION 1)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL REVISION 1)
Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
Q_CLASSINFO("DefaultProperty", "contentData")
@@ -77,6 +79,12 @@ public:
QQuickItem *footer() const;
void setFooter(QQuickItem *footer);
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
QQmlListProperty<QObject> contentData();
QQmlListProperty<QQuickItem> contentChildren();
@@ -84,12 +92,15 @@ Q_SIGNALS:
void titleChanged();
void headerChanged();
void footerChanged();
+ Q_REVISION(1) void contentWidthChanged();
+ Q_REVISION(1) void contentHeightChanged();
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;
+ void spacingChange(qreal newSpacing, qreal oldSpacing) override;
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickpagelayout.cpp b/src/quicktemplates2/qquickpagelayout.cpp
new file mode 100644
index 00000000..b787dd08
--- /dev/null
+++ b/src/quicktemplates2/qquickpagelayout.cpp
@@ -0,0 +1,190 @@
+/****************************************************************************
+**
+** 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 "qquickpagelayout_p_p.h"
+#include "qquickcontrol_p.h"
+#include "qquicktoolbar_p.h"
+#include "qquicktabbar_p.h"
+#include "qquickdialogbuttonbox_p.h"
+
+#include <QtQuick/private/qquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static const QQuickItemPrivate::ChangeTypes ItemChanges = QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility | QQuickItemPrivate::Destroyed
+ | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
+
+namespace {
+ enum Position {
+ Header,
+ Footer
+ };
+
+ Q_STATIC_ASSERT(int(Header) == int(QQuickTabBar::Header));
+ Q_STATIC_ASSERT(int(Footer) == int(QQuickTabBar::Footer));
+
+ Q_STATIC_ASSERT(int(Header) == int(QQuickToolBar::Header));
+ Q_STATIC_ASSERT(int(Footer) == int(QQuickToolBar::Footer));
+
+ Q_STATIC_ASSERT(int(Header) == int(QQuickDialogButtonBox::Header));
+ Q_STATIC_ASSERT(int(Footer) == int(QQuickDialogButtonBox::Footer));
+}
+
+static void setPosition(QQuickItem *item, Position position)
+{
+ if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(item))
+ toolBar->setPosition(static_cast<QQuickToolBar::Position>(position));
+ else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(item))
+ tabBar->setPosition(static_cast<QQuickTabBar::Position>(position));
+ else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(item))
+ buttonBox->setPosition(static_cast<QQuickDialogButtonBox::Position>(position));
+}
+
+QQuickPageLayout::QQuickPageLayout(QQuickControl *control)
+ : m_header(nullptr), m_footer(nullptr), m_control(control)
+{
+}
+
+QQuickPageLayout::~QQuickPageLayout()
+{
+ if (m_header)
+ QQuickItemPrivate::get(m_header)->removeItemChangeListener(this, ItemChanges);
+ if (m_footer)
+ QQuickItemPrivate::get(m_footer)->removeItemChangeListener(this, ItemChanges);
+}
+
+QQuickItem *QQuickPageLayout::header() const
+{
+ return m_header;
+}
+
+bool QQuickPageLayout::setHeader(QQuickItem *header)
+{
+ if (m_header == header)
+ return false;
+
+ if (m_header) {
+ QQuickItemPrivate::get(m_header)->removeItemChangeListener(this, ItemChanges);
+ m_header->setParentItem(nullptr);
+ }
+ m_header = header;
+ if (header) {
+ header->setParentItem(m_control);
+ QQuickItemPrivate::get(header)->addItemChangeListener(this, ItemChanges);
+ if (qFuzzyIsNull(header->z()))
+ header->setZ(1);
+ setPosition(header, Header);
+ }
+ return true;
+}
+
+QQuickItem *QQuickPageLayout::footer() const
+{
+ return m_footer;
+}
+
+bool QQuickPageLayout::setFooter(QQuickItem *footer)
+{
+ if (m_footer == footer)
+ return false;
+
+ if (m_footer) {
+ QQuickItemPrivate::get(m_footer)->removeItemChangeListener(this, ItemChanges);
+ m_footer->setParentItem(nullptr);
+ }
+ m_footer = footer;
+ if (footer) {
+ footer->setParentItem(m_control);
+ QQuickItemPrivate::get(footer)->addItemChangeListener(this, ItemChanges);
+ if (qFuzzyIsNull(footer->z()))
+ footer->setZ(1);
+ setPosition(footer, Footer);
+ }
+ return true;
+}
+
+void QQuickPageLayout::update()
+{
+ QQuickItem *content = m_control->contentItem();
+
+ const qreal hh = m_header && m_header->isVisible() ? m_header->height() : 0;
+ const qreal fh = m_footer && m_footer->isVisible() ? m_footer->height() : 0;
+ const qreal hsp = hh > 0 ? m_control->spacing() : 0;
+ const qreal fsp = fh > 0 ? m_control->spacing() : 0;
+
+ content->setY(m_control->topPadding() + hh + hsp);
+ content->setX(m_control->leftPadding());
+ content->setWidth(m_control->availableWidth());
+ content->setHeight(m_control->availableHeight() - hh - fh - hsp - fsp);
+
+ if (m_header)
+ m_header->setWidth(m_control->width());
+
+ if (m_footer) {
+ m_footer->setY(m_control->height() - m_footer->height());
+ m_footer->setWidth(m_control->width());
+ }
+}
+
+void QQuickPageLayout::itemVisibilityChanged(QQuickItem *)
+{
+ update();
+}
+
+void QQuickPageLayout::itemImplicitWidthChanged(QQuickItem *)
+{
+ update();
+}
+
+void QQuickPageLayout::itemImplicitHeightChanged(QQuickItem *)
+{
+ update();
+}
+
+void QQuickPageLayout::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
+{
+ update();
+}
+
+void QQuickPageLayout::itemDestroyed(QQuickItem *item)
+{
+ if (item == m_header)
+ m_header = nullptr;
+ else if (item == m_footer)
+ m_footer = nullptr;
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpagelayout_p_p.h b/src/quicktemplates2/qquickpagelayout_p_p.h
new file mode 100644
index 00000000..fbeaa877
--- /dev/null
+++ b/src/quicktemplates2/qquickpagelayout_p_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 QQUICKPAGELAYOUT_P_P_H
+#define QQUICKPAGELAYOUT_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/qquickitemchangelistener_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickControl;
+
+class QQuickPageLayout : public QQuickItemChangeListener
+{
+public:
+ explicit QQuickPageLayout(QQuickControl *control);
+ ~QQuickPageLayout();
+
+ QQuickItem *header() const;
+ bool setHeader(QQuickItem *header);
+
+ QQuickItem *footer() const;
+ bool setFooter(QQuickItem *footer);
+
+ void update();
+
+protected:
+ void itemVisibilityChanged(QQuickItem *item) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ void itemDestroyed(QQuickItem *item) override;
+
+private:
+ QQuickItem *m_header;
+ QQuickItem *m_footer;
+ QQuickControl *m_control;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPAGELAYOUT_P_P_H
diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp
index 9f9c139b..ea296eb6 100644
--- a/src/quicktemplates2/qquickpane.cpp
+++ b/src/quicktemplates2/qquickpane.cpp
@@ -108,6 +108,14 @@ QQuickPanePrivate::QQuickPanePrivate() : contentWidth(0), contentHeight(0)
{
}
+QQuickItem *QQuickPanePrivate::getContentItem()
+{
+ Q_Q(QQuickPane);
+ if (!contentItem)
+ contentItem = new QQuickItem(q);
+ return contentItem;
+}
+
QQuickPane::QQuickPane(QQuickItem *parent) :
QQuickControl(*(new QQuickPanePrivate), parent)
{
@@ -191,7 +199,7 @@ void QQuickPane::setContentHeight(qreal height)
QQmlListProperty<QObject> QQuickPane::contentData()
{
Q_D(QQuickPane);
- return QQmlListProperty<QObject>(d->contentItem, nullptr,
+ return QQmlListProperty<QObject>(d->getContentItem(), nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -214,7 +222,7 @@ QQmlListProperty<QObject> QQuickPane::contentData()
QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
{
Q_D(QQuickPane);
- return QQmlListProperty<QQuickItem>(d->contentItem, nullptr,
+ return QQmlListProperty<QQuickItem>(d->getContentItem(), nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
diff --git a/src/quicktemplates2/qquickpane_p_p.h b/src/quicktemplates2/qquickpane_p_p.h
index acc0d0ab..62789664 100644
--- a/src/quicktemplates2/qquickpane_p_p.h
+++ b/src/quicktemplates2/qquickpane_p_p.h
@@ -61,6 +61,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPanePrivate : public QQuickControlP
public:
QQuickPanePrivate();
+ QQuickItem *getContentItem() override;
+
qreal contentWidth;
qreal contentHeight;
};
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index bdcfe6ca..b0281cdf 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -40,6 +40,7 @@
#include "qquickshortcutcontext_p_p.h"
#include "qquickoverlay_p_p.h"
#include "qquickcontrol_p_p.h"
+#include "qquickdialog_p.h"
#include <QtGui/private/qshortcutmap_p.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -64,7 +65,7 @@ QT_BEGIN_NAMESPACE
\qml
import QtQuick.Window 2.2
- import QtQuick.Controls 2.0
+ import QtQuick.Controls 2.1
ApplicationWindow {
id: window
@@ -252,6 +253,14 @@ void QQuickPopupPrivate::init()
QObject::connect(popupItem, &QQuickControl::paddingChanged, q, &QQuickPopup::paddingChanged);
}
+static void closeOrReject(QQuickPopup *popup)
+{
+ if (QQuickDialog *dialog = qobject_cast<QQuickDialog*>(popup))
+ dialog->reject();
+ else
+ popup->close();
+}
+
bool QQuickPopupPrivate::tryClose(QQuickItem *item, QMouseEvent *event)
{
Q_Q(QQuickPopup);
@@ -261,7 +270,7 @@ bool QQuickPopupPrivate::tryClose(QQuickItem *item, QMouseEvent *event)
if (onOutside || onOutsideParent) {
if (!popupItem->contains(item->mapToItem(popupItem, event->pos()))) {
if (!onOutsideParent || !parentItem || !parentItem->contains(item->mapToItem(parentItem, event->pos()))) {
- q->close();
+ closeOrReject(q);
return true;
}
}
@@ -436,6 +445,8 @@ public:
void resolveFont() override;
+ QQuickItem *getContentItem() override;
+
int backId;
int escapeId;
QQuickPopup *popup;
@@ -467,6 +478,14 @@ void QQuickPopupItemPrivate::resolveFont()
inheritFont(window->font());
}
+QQuickItem *QQuickPopupItemPrivate::getContentItem()
+{
+ Q_Q(QQuickPopupItem);
+ if (!contentItem)
+ contentItem = new QQuickItem(q);
+ return contentItem;
+}
+
QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup) :
QQuickControl(*(new QQuickPopupItemPrivate(popup)), nullptr)
{
@@ -476,7 +495,7 @@ QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup) :
setAcceptedMouseButtons(Qt::AllButtons);
// TODO: switch to QStyleHints::useHoverEffects in Qt 5.8
- setAcceptHoverEvents(true);
+ setHoverEnabled(true);
// setAcceptHoverEvents(QGuiApplication::styleHints()->useHoverEffects());
// connect(QGuiApplication::styleHints(), &QStyleHints::useHoverEffectsChanged, this, &QQuickItem::setAcceptHoverEvents);
}
@@ -521,7 +540,7 @@ bool QQuickPopupItem::event(QEvent *event)
if (event->type() == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
if (se->shortcutId() == d->escapeId || se->shortcutId() == d->backId) {
- d->popup->close();
+ closeOrReject(d->popup);
return true;
}
}
@@ -636,6 +655,13 @@ void QQuickPopupItem::paddingChange(const QMarginsF &newPadding, const QMarginsF
d->popup->paddingChange(newPadding, oldPadding);
}
+void QQuickPopupItem::spacingChange(qreal newSpacing, qreal oldSpacing)
+{
+ Q_D(QQuickPopupItem);
+ QQuickControl::spacingChange(newSpacing, oldSpacing);
+ d->popup->spacingChange(newSpacing, oldSpacing);
+}
+
QFont QQuickPopupItem::defaultFont() const
{
Q_D(const QQuickPopupItem);
@@ -698,7 +724,7 @@ void QQuickPopupPositioner::setParentItem(QQuickItem *parent)
m_popup->reposition();
}
-void QQuickPopupPositioner::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+void QQuickPopupPositioner::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
{
if (m_parentItem && m_popup->popupItem->isVisible())
m_popup->reposition();
@@ -1265,6 +1291,35 @@ qreal QQuickPopup::availableHeight() const
}
/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty real QtQuick.Controls::Popup::spacing
+
+ This property holds the spacing.
+
+ Spacing is useful for popups that have multiple or repetitive building
+ blocks. For example, some styles use spacing to determine the distance
+ between the header, content, and footer of \l Dialog. Spacing is not
+ enforced by Popup, so each style may interpret it differently, and some
+ may ignore it altogether.
+*/
+qreal QQuickPopup::spacing() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->spacing();
+}
+
+void QQuickPopup::setSpacing(qreal spacing)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setSpacing(spacing);
+}
+
+void QQuickPopup::resetSpacing()
+{
+ setSpacing(0);
+}
+
+/*!
\qmlproperty real QtQuick.Controls::Popup::margins
This property holds the default margins around the popup.
@@ -2352,6 +2407,13 @@ void QQuickPopup::paddingChange(const QMarginsF &newPadding, const QMarginsF &ol
emit availableHeightChanged();
}
+void QQuickPopup::spacingChange(qreal newSpacing, qreal oldSpacing)
+{
+ Q_UNUSED(newSpacing);
+ Q_UNUSED(oldSpacing);
+ emit spacingChanged();
+}
+
QFont QQuickPopup::defaultFont() const
{
return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 6393dcdc..0cff8fd7 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -84,6 +84,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
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 spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL REVISION 1)
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)
@@ -154,6 +155,10 @@ public:
qreal availableWidth() const;
qreal availableHeight() const;
+ qreal spacing() const;
+ void setSpacing(qreal spacing);
+ void resetSpacing();
+
qreal margins() const;
void setMargins(qreal margins);
void resetMargins();
@@ -293,6 +298,7 @@ Q_SIGNALS:
void contentHeightChanged();
void availableWidthChanged();
void availableHeightChanged();
+ Q_REVISION(1) void spacingChanged();
void marginsChanged();
void topMarginChanged();
void leftMarginChanged();
@@ -354,6 +360,7 @@ protected:
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 void spacingChange(qreal newSpacing, qreal oldSpacing);
virtual QFont defaultFont() const;
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index 0c12b077..ca02530e 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -111,6 +111,7 @@ protected:
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;
+ void spacingChange(qreal newSpacing, qreal oldSpacing) override;
QFont defaultFont() const override;
@@ -135,7 +136,7 @@ public:
void setParentItem(QQuickItem *parent);
protected:
- void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) override;
+ void itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &) override;
void itemParentChanged(QQuickItem *, QQuickItem *parent) override;
void itemChildRemoved(QQuickItem *, QQuickItem *child) override;
diff --git a/src/quicktemplates2/qquickpresshandler.cpp b/src/quicktemplates2/qquickpresshandler.cpp
index 1e1a17bc..5c868ee2 100644
--- a/src/quicktemplates2/qquickpresshandler.cpp
+++ b/src/quicktemplates2/qquickpresshandler.cpp
@@ -48,6 +48,8 @@ QQuickPressHandler::QQuickPressHandler()
: control(nullptr)
, longPress(false)
, pressAndHoldSignalIndex(-1)
+ , pressedSignalIndex(-1)
+ , releasedSignalIndex(-1)
, delayedMousePressEvent(nullptr)
{ }
@@ -61,6 +63,21 @@ void QQuickPressHandler::mousePressEvent(QMouseEvent *event)
} else {
timer.stop();
}
+
+ if (pressedSignalIndex == -1)
+ pressedSignalIndex = control->metaObject()->indexOfSignal("pressed(QQuickMouseEvent*)");
+ Q_ASSERT(pressedSignalIndex != -1);
+
+ if (QObjectPrivate::get(control)->isSignalConnected(pressedSignalIndex)) {
+ QQuickMouseEvent mev;
+ mev.reset(pressPos.x(), pressPos.y(), event->button(), event->buttons(),
+ QGuiApplication::keyboardModifiers(), false/*isClick*/, false/*wasHeld*/);
+ mev.setAccepted(true);
+ QQuickMouseEvent *mevPtr = &mev;
+ void *args[] = { nullptr, &mevPtr };
+ QMetaObject::metacall(control, QMetaObject::InvokeMetaMethod, pressedSignalIndex, args);
+ event->setAccepted(mev.isAccepted());
+ }
}
void QQuickPressHandler::mouseMoveEvent(QMouseEvent *event)
@@ -69,10 +86,26 @@ void QQuickPressHandler::mouseMoveEvent(QMouseEvent *event)
timer.stop();
}
-void QQuickPressHandler::mouseReleaseEvent(QMouseEvent *)
+void QQuickPressHandler::mouseReleaseEvent(QMouseEvent *event)
{
- if (!longPress)
+ if (!longPress) {
timer.stop();
+
+ if (releasedSignalIndex == -1)
+ releasedSignalIndex = control->metaObject()->indexOfSignal("released(QQuickMouseEvent*)");
+ Q_ASSERT(releasedSignalIndex != -1);
+
+ if (QObjectPrivate::get(control)->isSignalConnected(releasedSignalIndex)) {
+ QQuickMouseEvent mev;
+ mev.reset(pressPos.x(), pressPos.y(), event->button(), event->buttons(),
+ QGuiApplication::keyboardModifiers(), false/*isClick*/, false/*wasHeld*/);
+ mev.setAccepted(true);
+ QQuickMouseEvent *mevPtr = &mev;
+ void *args[] = { nullptr, &mevPtr };
+ QMetaObject::metacall(control, QMetaObject::InvokeMetaMethod, releasedSignalIndex, args);
+ event->setAccepted(mev.isAccepted());
+ }
+ }
}
void QQuickPressHandler::timerEvent(QTimerEvent *)
@@ -86,8 +119,9 @@ void QQuickPressHandler::timerEvent(QTimerEvent *)
longPress = QObjectPrivate::get(control)->isSignalConnected(pressAndHoldSignalIndex);
if (longPress) {
- QQuickMouseEvent mev(pressPos.x(), pressPos.y(), Qt::LeftButton, Qt::LeftButton,
- QGuiApplication::keyboardModifiers(), false/*isClick*/, true/*wasHeld*/);
+ QQuickMouseEvent mev;
+ mev.reset(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;
diff --git a/src/quicktemplates2/qquickpresshandler_p_p.h b/src/quicktemplates2/qquickpresshandler_p_p.h
index dec6f202..e432fe10 100644
--- a/src/quicktemplates2/qquickpresshandler_p_p.h
+++ b/src/quicktemplates2/qquickpresshandler_p_p.h
@@ -74,6 +74,8 @@ struct QQuickPressHandler
QPointF pressPos;
bool longPress;
int pressAndHoldSignalIndex;
+ int pressedSignalIndex;
+ int releasedSignalIndex;
QMouseEvent *delayedMousePressEvent;
};
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 26a5b010..2f2b621c 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -91,7 +91,8 @@ public:
position(0),
handle(nullptr),
slider(slider),
- pressed(false)
+ pressed(false),
+ hovered(false)
{
}
@@ -112,6 +113,7 @@ private:
QQuickItem *handle;
QQuickRangeSlider *slider;
bool pressed;
+ bool hovered;
};
bool QQuickRangeSliderNodePrivate::isFirst() const
@@ -275,6 +277,22 @@ void QQuickRangeSliderNode::setPressed(bool pressed)
emit pressedChanged();
}
+bool QQuickRangeSliderNode::isHovered() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ return d->hovered;
+}
+
+void QQuickRangeSliderNode::setHovered(bool hovered)
+{
+ Q_D(QQuickRangeSliderNode);
+ if (d->hovered == hovered)
+ return;
+
+ d->hovered = hovered;
+ emit hoveredChanged();
+}
+
void QQuickRangeSliderNode::increase()
{
Q_D(QQuickRangeSliderNode);
@@ -308,6 +326,8 @@ public:
{
}
+ void updateHover(const QPointF &pos);
+
qreal from;
qreal to;
qreal stepSize;
@@ -318,6 +338,15 @@ public:
QQuickRangeSlider::SnapMode snapMode;
};
+void QQuickRangeSliderPrivate::updateHover(const QPointF &pos)
+{
+ Q_Q(QQuickRangeSlider);
+ QQuickItem *firstHandle = first->handle();
+ QQuickItem *secondHandle = second->handle();
+ first->setHovered(firstHandle && firstHandle->isEnabled() && firstHandle->contains(q->mapToItem(firstHandle, pos)));
+ second->setHovered(secondHandle && secondHandle->isEnabled() && secondHandle->contains(q->mapToItem(secondHandle, pos)));
+}
+
static qreal valueAt(const QQuickRangeSlider *slider, qreal position)
{
return slider->from() + (slider->to() - slider->from()) * position;
@@ -431,6 +460,7 @@ void QQuickRangeSlider::setTo(qreal to)
\qmlproperty real QtQuick.Controls::RangeSlider::first.visualPosition
\qmlproperty Item QtQuick.Controls::RangeSlider::first.handle
\qmlproperty bool QtQuick.Controls::RangeSlider::first.pressed
+ \qmlproperty bool QtQuick.Controls::RangeSlider::first.hovered
\table
\header
@@ -471,6 +501,10 @@ void QQuickRangeSlider::setTo(qreal to)
\row
\li pressed
\li This property holds whether the first handle is pressed.
+ \row
+ \li hovered
+ \li This property holds whether the first handle is hovered.
+ This property was introduced in QtQuick.Controls 2.1.
\endtable
\sa first.increase(), first.decrease()
@@ -488,6 +522,7 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const
\qmlproperty real QtQuick.Controls::RangeSlider::second.visualPosition
\qmlproperty Item QtQuick.Controls::RangeSlider::second.handle
\qmlproperty bool QtQuick.Controls::RangeSlider::second.pressed
+ \qmlproperty bool QtQuick.Controls::RangeSlider::second.hovered
\table
\header
@@ -528,6 +563,10 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const
\row
\li pressed
\li This property holds whether the second handle is pressed.
+ \row
+ \li hovered
+ \li This property holds whether the second handle is hovered.
+ This property was introduced in QtQuick.Controls 2.1.
\endtable
\sa second.increase(), second.decrease()
@@ -731,6 +770,28 @@ void QQuickRangeSlider::keyPressEvent(QKeyEvent *event)
}
}
+void QQuickRangeSlider::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::hoverEnterEvent(event);
+ d->updateHover(event->posF());
+}
+
+void QQuickRangeSlider::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::hoverMoveEvent(event);
+ d->updateHover(event->posF());
+}
+
+void QQuickRangeSlider::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickRangeSlider);
+ QQuickControl::hoverLeaveEvent(event);
+ d->first->setHovered(false);
+ d->second->setHovered(false);
+}
+
void QQuickRangeSlider::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QQuickRangeSlider);
diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h
index 4c2eb4bb..1b102e87 100644
--- a/src/quicktemplates2/qquickrangeslider_p.h
+++ b/src/quicktemplates2/qquickrangeslider_p.h
@@ -105,6 +105,9 @@ Q_SIGNALS:
protected:
void focusInEvent(QFocusEvent *event) override;
+ void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
@@ -135,6 +138,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSliderNode : public QObject
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)
+ Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1)
public:
explicit QQuickRangeSliderNode(qreal value, QQuickRangeSlider *slider);
@@ -152,6 +156,9 @@ public:
bool isPressed() const;
void setPressed(bool pressed);
+ bool isHovered() const;
+ void setHovered(bool hovered);
+
public Q_SLOTS:
void increase();
void decrease();
@@ -162,6 +169,7 @@ Q_SIGNALS:
void visualPositionChanged();
void handleChanged();
void pressedChanged();
+ Q_REVISION(1) void hoveredChanged();
private:
Q_DISABLE_COPY(QQuickRangeSliderNode)
diff --git a/src/quicktemplates2/qquickroundbutton.cpp b/src/quicktemplates2/qquickroundbutton.cpp
new file mode 100644
index 00000000..4169b269
--- /dev/null
+++ b/src/quicktemplates2/qquickroundbutton.cpp
@@ -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$
+**
+****************************************************************************/
+
+#include "qquickroundbutton_p.h"
+
+#include <QtQuickTemplates2/private/qquickbutton_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype RoundButton
+ \inherits Button
+ \instantiates QQuickRoundButton
+ \inqmlmodule QtQuick.Controls
+ \since 5.8
+ \ingroup qtquickcontrols2-buttons
+ \brief A push-button control with rounded corners that can be clicked by the user.
+
+ \image qtquickcontrols2-roundbutton.png
+
+ RoundButton is identical to \l Button, except that it has a \l radius property
+ which allows the corners to be rounded without having to customize the
+ \l background.
+
+ \snippet qtquickcontrols2-roundbutton.qml 1
+
+ \sa {Customizing RoundButton}, {Button Controls}
+*/
+
+class QQuickRoundButtonPrivate : public QQuickButtonPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickRoundButton)
+
+public:
+ QQuickRoundButtonPrivate();
+
+ qreal radius;
+ bool explicitRadius;
+
+ void setRadius(qreal newRadius = -1.0);
+};
+
+QQuickRoundButtonPrivate::QQuickRoundButtonPrivate() :
+ radius(0),
+ explicitRadius(false)
+{
+}
+
+void QQuickRoundButtonPrivate::setRadius(qreal newRadius)
+{
+ Q_Q(QQuickRoundButton);
+ const qreal oldRadius = radius;
+ if (newRadius < 0)
+ radius = qMax<qreal>(0, qMin(width, height) / 2);
+ else
+ radius = newRadius;
+
+ if (!qFuzzyCompare(radius, oldRadius))
+ emit q->radiusChanged();
+}
+
+QQuickRoundButton::QQuickRoundButton(QQuickItem *parent) :
+ QQuickButton(*(new QQuickRoundButtonPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty real QtQuick.Controls::RoundButton::radius
+
+ This property holds the radius of the button.
+
+ To create a relatively square button that has slightly rounded corners,
+ use a small value, such as \c 3.
+
+ To create a completely circular button (the default), use a value that is
+ equal to half of the width or height of the button, and make the button's
+ width and height identical.
+
+ To reset this property back to the default value, set its value to
+ \c undefined.
+*/
+qreal QQuickRoundButton::radius() const
+{
+ Q_D(const QQuickRoundButton);
+ return d->radius;
+}
+
+void QQuickRoundButton::setRadius(qreal radius)
+{
+ Q_D(QQuickRoundButton);
+ d->explicitRadius = true;
+ d->setRadius(radius);
+}
+
+void QQuickRoundButton::resetRadius()
+{
+ Q_D(QQuickRoundButton);
+ d->explicitRadius = false;
+ d->setRadius();
+}
+
+void QQuickRoundButton::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickRoundButton);
+ QQuickControl::geometryChanged(newGeometry, oldGeometry);
+ if (!d->explicitRadius)
+ d->setRadius();
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickroundbutton_p.h b/src/quicktemplates2/qquickroundbutton_p.h
new file mode 100644
index 00000000..f308ddd3
--- /dev/null
+++ b/src/quicktemplates2/qquickroundbutton_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 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 QQUICKROUNDBUTTON_P_H
+#define QQUICKROUNDBUTTON_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 QQuickRoundButtonPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRoundButton : public QQuickButton
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal radius READ radius WRITE setRadius RESET resetRadius NOTIFY radiusChanged FINAL)
+
+public:
+ explicit QQuickRoundButton(QQuickItem *parent = nullptr);
+
+ qreal radius() const;
+ void setRadius(qreal radius);
+ void resetRadius();
+
+Q_SIGNALS:
+ void radiusChanged();
+
+protected:
+ void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+
+private:
+ Q_DISABLE_COPY(QQuickRoundButton)
+ Q_DECLARE_PRIVATE(QQuickRoundButton)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickRoundButton)
+
+#endif // QQUICKROUNDBUTTON_P_H
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 7ac1df34..c291e4b1 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -168,7 +168,7 @@ public:
}
qreal positionAt(const QPoint &point) const;
-
+ void updateActive();
void resizeContent() override;
qreal size;
@@ -190,6 +190,12 @@ qreal QQuickScrollBarPrivate::positionAt(const QPoint &point) const
return (point.y() - q->topPadding()) / q->availableHeight();
}
+void QQuickScrollBarPrivate::updateActive()
+{
+ Q_Q(QQuickScrollBar);
+ q->setActive(moving || pressed || hovered);
+}
+
void QQuickScrollBarPrivate::resizeContent()
{
Q_Q(QQuickScrollBar);
@@ -349,7 +355,7 @@ void QQuickScrollBar::setPressed(bool pressed)
d->pressed = pressed;
setAccessibleProperty("pressed", pressed);
- setActive(d->pressed || d->moving);
+ d->updateActive();
emit pressedChanged();
}
@@ -443,6 +449,12 @@ void QQuickScrollBar::mouseReleaseEvent(QMouseEvent *event)
setPressed(false);
}
+void QQuickScrollBar::hoverChange()
+{
+ Q_D(QQuickScrollBar);
+ d->updateActive();
+}
+
#ifndef QT_NO_ACCESSIBILITY
void QQuickScrollBar::accessibilityActiveChanged(bool active)
{
@@ -473,7 +485,7 @@ public:
void layoutHorizontal(bool move = true);
void layoutVertical(bool move = true);
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
void itemDestroyed(QQuickItem *item) override;
QQuickFlickable *flickable;
@@ -485,14 +497,14 @@ void QQuickScrollBarAttachedPrivate::activateHorizontal()
{
QQuickScrollBarPrivate *p = QQuickScrollBarPrivate::get(horizontal);
p->moving = flickable->isMovingHorizontally();
- horizontal->setActive(p->moving || p->pressed);
+ p->updateActive();
}
void QQuickScrollBarAttachedPrivate::activateVertical()
{
QQuickScrollBarPrivate *p = QQuickScrollBarPrivate::get(vertical);
p->moving = flickable->isMovingVertically();
- vertical->setActive(p->moving || p->pressed);
+ p->updateActive();
}
// TODO: QQuickFlickable::maxXYExtent()
@@ -548,16 +560,24 @@ void QQuickScrollBarAttachedPrivate::layoutVertical(bool move)
vertical->setX(vertical->isMirrored() ? 0 : flickable->width() - vertical->width());
}
-void QQuickScrollBarAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+void QQuickScrollBarAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QQuickGeometryChange change, const QRectF &diff)
{
Q_UNUSED(item);
- Q_UNUSED(newGeometry);
+ Q_UNUSED(change);
if (horizontal && horizontal->height() > 0) {
- bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
+#ifdef QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING // TODO: correct/rename diff to oldGeometry
+ bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), diff.height() - horizontal->height());
+#else
+ bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), item->height() - diff.height() - horizontal->height());
+#endif
layoutHorizontal(move);
}
if (vertical && vertical->width() > 0) {
- bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
+#ifdef QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING // TODO: correct/rename diff to oldGeometry
+ bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), diff.width() - vertical->width());
+#else
+ bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), item->width() - diff.width() - vertical->width());
+#endif
layoutVertical(move);
}
}
@@ -576,7 +596,7 @@ QQuickScrollBarAttached::QQuickScrollBarAttached(QQuickFlickable *flickable) :
Q_D(QQuickScrollBarAttached);
if (flickable) {
QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
- p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ p->updateOrAddGeometryChangeListener(d, QQuickGeometryChange::Size);
}
}
diff --git a/src/quicktemplates2/qquickscrollbar_p.h b/src/quicktemplates2/qquickscrollbar_p.h
index 8feba604..b82e0438 100644
--- a/src/quicktemplates2/qquickscrollbar_p.h
+++ b/src/quicktemplates2/qquickscrollbar_p.h
@@ -105,6 +105,8 @@ protected:
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
+ void hoverChange() override;
+
#ifndef QT_NO_ACCESSIBILITY
void accessibilityActiveChanged(bool active) override;
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp
index 7d93215d..66830ec1 100644
--- a/src/quicktemplates2/qquickscrollindicator.cpp
+++ b/src/quicktemplates2/qquickscrollindicator.cpp
@@ -303,7 +303,7 @@ public:
void layoutHorizontal(bool move = true);
void layoutVertical(bool move = true);
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
void itemDestroyed(QQuickItem *item) override;
QQuickFlickable *flickable;
@@ -341,16 +341,24 @@ void QQuickScrollIndicatorAttachedPrivate::layoutVertical(bool move)
vertical->setX(flickable->width() - vertical->width());
}
-void QQuickScrollIndicatorAttachedPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+void QQuickScrollIndicatorAttachedPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
{
Q_UNUSED(item);
- Q_UNUSED(newGeometry);
+ Q_UNUSED(change);
if (horizontal && horizontal->height() > 0) {
- bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
+#ifdef QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING // TODO: correct/rename diff to oldGeometry
+ bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), diff.height() - horizontal->height());
+#else
+ bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), item->height() - diff.height() - horizontal->height());
+#endif
layoutHorizontal(move);
}
if (vertical && vertical->width() > 0) {
- bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
+#ifdef QT_QUICK_NEW_GEOMETRY_CHANGED_HANDLING // TODO: correct/rename diff to oldGeometry
+ bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), diff.width() - vertical->width());
+#else
+ bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), item->width() - diff.width() - vertical->width());
+#endif
layoutVertical(move);
}
}
@@ -369,7 +377,7 @@ QQuickScrollIndicatorAttached::QQuickScrollIndicatorAttached(QQuickFlickable *fl
Q_D(QQuickScrollIndicatorAttached);
if (flickable) {
QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
- p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ p->updateOrAddGeometryChangeListener(d, QQuickGeometryChange::Size);
}
}
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 454002c2..c0680725 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -86,7 +86,6 @@ public:
{
}
- qreal valueAt(qreal position) const;
qreal snapPosition(qreal position) const;
qreal positionAt(const QPoint &point) const;
void setPosition(qreal position);
@@ -104,11 +103,6 @@ public:
QQuickItem *handle;
};
-qreal QQuickSliderPrivate::valueAt(qreal position) const
-{
- return from + (to - from) * position;
-}
-
qreal QQuickSliderPrivate::snapPosition(qreal position) const
{
const qreal range = to - from;
@@ -232,10 +226,11 @@ void QQuickSlider::setTo(qreal to)
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.
+ handle is dragged, but only after the value has been chosen and the slider
+ has been released. The \l valueAt() method can be used to get continuous
+ updates.
- \sa position
+ \sa position, valueAt()
*/
qreal QQuickSlider::value() const
{
@@ -268,7 +263,7 @@ void QQuickSlider::setValue(qreal value)
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
+ \sa value, visualPosition, valueAt()
*/
qreal QQuickSlider::position() const
{
@@ -434,6 +429,25 @@ void QQuickSlider::setHandle(QQuickItem *handle)
}
/*!
+ \since QtQuick.Controls 2.1
+ \qmlmethod real QtQuick.Controls::Slider::valueAt(real position)
+
+ Returns the value for the given \a position.
+
+ The \l value property is not updated while the handle is dragged, but this
+ method can be used to get continuous value updates:
+
+ \snippet qtquickcontrols2-tooltip-slider.qml 1
+
+ \sa value, position
+*/
+qreal QQuickSlider::valueAt(qreal position) const
+{
+ Q_D(const QQuickSlider);
+ return d->from + (d->to - d->from) * position;
+}
+
+/*!
\qmlmethod void QtQuick.Controls::Slider::increase()
Increases the value by \l stepSize or \c 0.1 if stepSize is not defined.
@@ -534,7 +548,7 @@ void QQuickSlider::mouseReleaseEvent(QMouseEvent *event)
qreal pos = d->positionAt(event->pos());
if (d->snapMode != NoSnap)
pos = d->snapPosition(pos);
- qreal val = d->valueAt(pos);
+ qreal val = valueAt(pos);
if (!qFuzzyCompare(val, d->value))
setValue(val);
else if (d->snapMode != NoSnap)
diff --git a/src/quicktemplates2/qquickslider_p.h b/src/quicktemplates2/qquickslider_p.h
index f6c1401a..d17af5c4 100644
--- a/src/quicktemplates2/qquickslider_p.h
+++ b/src/quicktemplates2/qquickslider_p.h
@@ -105,6 +105,8 @@ public:
QQuickItem *handle() const;
void setHandle(QQuickItem *handle);
+ Q_REVISION(1) Q_INVOKABLE qreal valueAt(qreal position) const;
+
public Q_SLOTS:
void increase();
void decrease();
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index 473b6643..506405fe 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -109,6 +109,7 @@ public:
void updateUpEnabled();
bool downEnabled() const;
void updateDownEnabled();
+ void updateHover(const QPointF &pos);
void startRepeatDelay();
void startPressRepeat();
@@ -190,6 +191,15 @@ void QQuickSpinBoxPrivate::updateDownEnabled()
downIndicator->setEnabled(from < to ? value > from : value < from);
}
+void QQuickSpinBoxPrivate::updateHover(const QPointF &pos)
+{
+ Q_Q(QQuickSpinBox);
+ QQuickItem *ui = up->indicator();
+ QQuickItem *di = down->indicator();
+ up->setHovered(ui && ui->isEnabled() && ui->contains(q->mapToItem(ui, pos)));
+ down->setHovered(di && di->isEnabled() && di->contains(q->mapToItem(di, pos)));
+}
+
void QQuickSpinBoxPrivate::startRepeatDelay()
{
Q_Q(QQuickSpinBox);
@@ -553,8 +563,10 @@ void QQuickSpinBox::setValueFromText(const QJSValue &callback)
\qmlpropertygroup QtQuick.Controls::SpinBox::up
\qmlproperty bool QtQuick.Controls::SpinBox::up.pressed
\qmlproperty Item QtQuick.Controls::SpinBox::up.indicator
+ \qmlproperty bool QtQuick.Controls::SpinBox::up.hovered
- These properties hold the up indicator item and whether it is pressed.
+ These properties hold the up indicator item and whether it is pressed or
+ hovered. The \c up.hovered property was introduced in QtQuick.Controls 2.1.
\sa increase()
*/
@@ -568,8 +580,10 @@ QQuickSpinButton *QQuickSpinBox::up() const
\qmlpropertygroup QtQuick.Controls::SpinBox::down
\qmlproperty bool QtQuick.Controls::SpinBox::down.pressed
\qmlproperty Item QtQuick.Controls::SpinBox::down.indicator
+ \qmlproperty bool QtQuick.Controls::SpinBox::down.hovered
- These properties hold the down indicator item and whether it is pressed.
+ These properties hold the down indicator item and whether it is pressed or
+ hovered. The \c down.hovered property was introduced in QtQuick.Controls 2.1.
\sa decrease()
*/
@@ -605,6 +619,28 @@ void QQuickSpinBox::decrease()
setValue(d->value - d->effectiveStepSize());
}
+void QQuickSpinBox::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::hoverEnterEvent(event);
+ d->updateHover(event->posF());
+}
+
+void QQuickSpinBox::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::hoverMoveEvent(event);
+ d->updateHover(event->posF());
+}
+
+void QQuickSpinBox::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::hoverLeaveEvent(event);
+ d->down->setHovered(false);
+ d->up->setHovered(false);
+}
+
void QQuickSpinBox::keyPressEvent(QKeyEvent *event)
{
Q_D(QQuickSpinBox);
@@ -757,8 +793,9 @@ QAccessible::Role QQuickSpinBox::accessibleRole() const
class QQuickSpinButtonPrivate : public QObjectPrivate
{
public:
- QQuickSpinButtonPrivate() : pressed(false), indicator(nullptr) { }
+ QQuickSpinButtonPrivate() : pressed(false), hovered(false), indicator(nullptr) { }
bool pressed;
+ bool hovered;
QQuickItem *indicator;
};
@@ -783,6 +820,22 @@ void QQuickSpinButton::setPressed(bool pressed)
emit pressedChanged();
}
+bool QQuickSpinButton::isHovered() const
+{
+ Q_D(const QQuickSpinButton);
+ return d->hovered;
+}
+
+void QQuickSpinButton::setHovered(bool hovered)
+{
+ Q_D(QQuickSpinButton);
+ if (d->hovered == hovered)
+ return;
+
+ d->hovered = hovered;
+ emit hoveredChanged();
+}
+
QQuickItem *QQuickSpinButton::indicator() const
{
Q_D(const QQuickSpinButton);
diff --git a/src/quicktemplates2/qquickspinbox_p.h b/src/quicktemplates2/qquickspinbox_p.h
index 3898a28b..b34f81a2 100644
--- a/src/quicktemplates2/qquickspinbox_p.h
+++ b/src/quicktemplates2/qquickspinbox_p.h
@@ -118,6 +118,9 @@ Q_SIGNALS:
protected:
bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
+ void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
@@ -146,6 +149,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinButton : public QObject
{
Q_OBJECT
Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1)
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
public:
@@ -154,11 +158,15 @@ public:
bool isPressed() const;
void setPressed(bool pressed);
+ bool isHovered() const;
+ void setHovered(bool hovered);
+
QQuickItem *indicator() const;
void setIndicator(QQuickItem *indicator);
Q_SIGNALS:
void pressedChanged();
+ Q_REVISION(1) void hoveredChanged();
void indicatorChanged();
private:
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index df9ab74f..d16d7b16 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -314,12 +314,7 @@ QQuickStackView::~QQuickStackView()
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);
+ return new QQuickStackAttached(object);
}
/*!
@@ -463,8 +458,11 @@ QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavio
An \a operation can be optionally specified as the last argument. Supported
operations:
- \value StackView.Transition An operation with transitions.
+ \value StackView.Transition An operation with default transitions (default).
\value StackView.Immediate An immediate operation without transitions.
+ \value StackView.PushTransition An operation with push transitions (since QtQuick.Controls 2.1).
+ \value StackView.ReplaceTransition An operation with replace transitions (since QtQuick.Controls 2.1).
+ \value StackView.PopTransition An operation with pop transitions (since QtQuick.Controls 2.1).
\sa initialItem, {Pushing Items}
*/
@@ -480,7 +478,7 @@ void QQuickStackView::push(QQmlV4Function *args)
QV4::ExecutionEngine *v4 = args->v4engine();
QV4::Scope scope(v4);
- Operation operation = d->elements.isEmpty() ? Immediate : Transition;
+ Operation operation = d->elements.isEmpty() ? Immediate : PushTransition;
QV4::ScopedValue lastArg(scope, (*args)[args->length() - 1]);
if (lastArg->isInt32())
operation = static_cast<Operation>(lastArg->toInt32());
@@ -499,7 +497,9 @@ void QQuickStackView::push(QQmlV4Function *args)
if (d->pushElements(elements)) {
emit depthChanged();
QQuickStackElement *enter = d->elements.top();
- d->pushTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->startTransition(QQuickStackTransition::pushEnter(operation, enter, this),
+ QQuickStackTransition::pushExit(operation, exit, this),
+ operation == Immediate);
d->setCurrentItem(enter->item);
}
@@ -524,8 +524,11 @@ void QQuickStackView::push(QQmlV4Function *args)
An \a operation can be optionally specified as the last argument. Supported
operations:
- \value StackView.Transition An operation with transitions.
+ \value StackView.Transition An operation with default transitions (default).
\value StackView.Immediate An immediate operation without transitions.
+ \value StackView.PushTransition An operation with push transitions (since QtQuick.Controls 2.1).
+ \value StackView.ReplaceTransition An operation with replace transitions (since QtQuick.Controls 2.1).
+ \value StackView.PopTransition An operation with pop transitions (since QtQuick.Controls 2.1).
Examples:
\code
@@ -571,7 +574,7 @@ void QQuickStackView::pop(QQmlV4Function *args)
}
}
- Operation operation = Transition;
+ Operation operation = PopTransition;
if (argc > 0) {
QV4::ScopedValue lastArg(scope, (*args)[argc - 1]);
if (lastArg->isInt32())
@@ -581,10 +584,14 @@ void QQuickStackView::pop(QQmlV4Function *args)
QQuickItem *previousItem = nullptr;
if (d->popElements(enter)) {
- if (exit)
+ if (exit) {
+ exit->removal = true;
previousItem = exit->item;
+ }
emit depthChanged();
- d->popTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->startTransition(QQuickStackTransition::popExit(operation, exit, this),
+ QQuickStackTransition::popEnter(operation, enter, this),
+ operation == Immediate);
d->setCurrentItem(enter->item);
}
@@ -647,8 +654,39 @@ void QQuickStackView::pop(QQmlV4Function *args)
An \a operation can be optionally specified as the last argument. Supported
operations:
- \value StackView.Transition An operation with transitions.
+ \value StackView.Transition An operation with default transitions (default).
\value StackView.Immediate An immediate operation without transitions.
+ \value StackView.PushTransition An operation with push transitions (since QtQuick.Controls 2.1).
+ \value StackView.ReplaceTransition An operation with replace transitions (since QtQuick.Controls 2.1).
+ \value StackView.PopTransition An operation with pop transitions (since QtQuick.Controls 2.1).
+
+ The following example illustrates the use of push and pop transitions with replace().
+
+ \code
+ StackView {
+ id: stackView
+
+ initialItem: Component {
+ id: page
+
+ Page {
+ Row {
+ spacing: 20
+ anchors.centerIn: parent
+
+ Button {
+ text: "<"
+ onClicked: stackView.replace(page, StackView.PopTransition)
+ }
+ Button {
+ text: ">"
+ onClicked: stackView.replace(page, StackView.PushTransition)
+ }
+ }
+ }
+ }
+ }
+ \endcode
\sa push(), {Replacing Items}
*/
@@ -664,7 +702,7 @@ void QQuickStackView::replace(QQmlV4Function *args)
QV4::ExecutionEngine *v4 = args->v4engine();
QV4::Scope scope(v4);
- Operation operation = d->elements.isEmpty() ? Immediate : Transition;
+ Operation operation = d->elements.isEmpty() ? Immediate : ReplaceTransition;
QV4::ScopedValue lastArg(scope, (*args)[args->length() - 1]);
if (lastArg->isInt32())
operation = static_cast<Operation>(lastArg->toInt32());
@@ -691,8 +729,12 @@ void QQuickStackView::replace(QQmlV4Function *args)
if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) {
if (depth != d->elements.count())
emit depthChanged();
+ if (exit)
+ exit->removal = true;
QQuickStackElement *enter = d->elements.top();
- d->replaceTransition(enter, exit, boundingRect(), operation == Immediate);
+ d->startTransition(QQuickStackTransition::replaceExit(operation, exit, this),
+ QQuickStackTransition::replaceEnter(operation, enter, this),
+ operation == Immediate);
d->setCurrentItem(enter->item);
}
@@ -978,19 +1020,25 @@ void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem
emit q->statusChanged();
}
-QQuickStackAttached::QQuickStackAttached(QQuickItem *parent) :
+QQuickStackAttached::QQuickStackAttached(QObject *parent) :
QObject(*(new QQuickStackAttachedPrivate), parent)
{
Q_D(QQuickStackAttached);
- QQuickItemPrivate::get(parent)->addItemChangeListener(d, QQuickItemPrivate::Parent);
- d->itemParentChanged(parent, parent->parentItem());
+ QQuickItem *item = qobject_cast<QQuickItem *>(parent);
+ if (item) {
+ QQuickItemPrivate::get(item)->addItemChangeListener(d, QQuickItemPrivate::Parent);
+ d->itemParentChanged(item, item->parentItem());
+ } else if (parent) {
+ qmlInfo(parent) << "StackView must be attached to an Item";
+ }
}
QQuickStackAttached::~QQuickStackAttached()
{
Q_D(QQuickStackAttached);
- QQuickItem *parentItem = static_cast<QQuickItem *>(parent());
- QQuickItemPrivate::get(parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Parent);
+ QQuickItem *parentItem = qobject_cast<QQuickItem *>(parent());
+ if (parentItem)
+ QQuickItemPrivate::get(parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Parent);
}
/*!
@@ -1038,4 +1086,59 @@ QQuickStackView::Status QQuickStackAttached::status() const
return d->element ? d->element->status : QQuickStackView::Inactive;
}
+/*!
+ \qmlattachedsignal QtQuick.Controls::StackView::activated()
+ \since QtQuick.Controls 2.1
+
+ This attached signal is emitted when the item it's attached to is activated in the stack.
+
+ \sa status
+*/
+
+/*!
+ \qmlattachedsignal QtQuick.Controls::StackView::deactivated()
+ \since QtQuick.Controls 2.1
+
+ This attached signal is emitted when the item it's attached to is deactivated in the stack.
+
+ \sa status
+*/
+
+/*!
+ \qmlattachedsignal QtQuick.Controls::StackView::activating()
+ \since QtQuick.Controls 2.1
+
+ This attached signal is emitted when the item it's attached to is in the process of being
+ activated in the stack.
+
+ \sa status
+*/
+
+/*!
+ \qmlattachedsignal QtQuick.Controls::StackView::deactivating()
+ \since QtQuick.Controls 2.1
+
+ This attached signal is emitted when the item it's attached to is in the process of being
+ dectivated in the stack.
+
+ \sa status
+*/
+
+/*!
+ \qmlattachedsignal QtQuick.Controls::StackView::removed()
+ \since QtQuick.Controls 2.1
+
+ This attached signal is emitted when the item it's attached to has been
+ removed from the stack. It can be used to safely destroy an Item that was
+ pushed onto the stack, for example:
+
+ \code
+ Item {
+ StackView.onRemoved: destroy() // Will be destroyed sometime after this call.
+ }
+ \endcode
+
+ \sa status
+*/
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
index 050bfde9..2657695d 100644
--- a/src/quicktemplates2/qquickstackview_p.cpp
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -72,7 +72,7 @@ private:
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),
+ context(nullptr), component(nullptr), view(nullptr),
status(QQuickStackView::Inactive)
{
}
@@ -85,6 +85,7 @@ QQuickStackElement::~QQuickStackElement()
if (ownComponent)
delete component;
+ QQuickStackAttached *attached = attachedStackObject(this);
if (item) {
if (ownItem) {
item->setParentItem(nullptr);
@@ -99,15 +100,16 @@ QQuickStackElement::~QQuickStackElement()
if (item->parentItem() != originalParent) {
item->setParentItem(originalParent);
} else {
- QQuickStackAttached *attached = attachedStackObject(this);
if (attached)
QQuickStackAttachedPrivate::get(attached)->itemParentChanged(item, nullptr);
}
}
}
+ if (attached)
+ emit attached->removed();
+
delete context;
- delete incubator;
}
QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickStackView *view)
@@ -120,12 +122,9 @@ QQuickStackElement *QQuickStackElement::fromString(const QString &str, QQuickSta
QQuickStackElement *QQuickStackElement::fromObject(QObject *object, QQuickStackView *view)
{
+ Q_UNUSED(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();
@@ -154,9 +153,8 @@ bool QQuickStackElement::load(QQuickStackView *parent)
context = new QQmlContext(creationContext);
context->setContextObject(parent);
- delete incubator;
- incubator = new QQuickStackIncubator(this);
- component->create(*incubator, context);
+ QQuickStackIncubator incubator(this);
+ component->create(incubator, context);
if (component->isError())
qWarning() << qPrintable(component->errorString().trimmed());
} else {
@@ -189,14 +187,15 @@ void QQuickStackElement::initialize()
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);
+ QQmlEngine *engine = qmlEngine(view);
+ Q_ASSERT(engine);
+ QV4::ExecutionEngine *v4 = QQmlEnginePrivate::getV4Engine(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);
+ QV4::ScopedValue qmlObject(scope, QV4::QObjectWrapper::wrap(v4, item));
+ QQmlComponentPrivate::setInitialProperties(v4, qmlContext, qmlObject, ipv);
properties.clear();
}
@@ -232,8 +231,28 @@ void QQuickStackElement::setStatus(QQuickStackView::Status value)
status = value;
QQuickStackAttached *attached = attachedStackObject(this);
- if (attached)
- emit attached->statusChanged();
+ if (!attached)
+ return;
+
+ switch (value) {
+ case QQuickStackView::Inactive:
+ emit attached->deactivated();
+ break;
+ case QQuickStackView::Deactivating:
+ emit attached->deactivating();
+ break;
+ case QQuickStackView::Activating:
+ emit attached->activating();
+ break;
+ case QQuickStackView::Active:
+ emit attached->activated();
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+
+ emit attached->statusChanged();
}
void QQuickStackElement::transitionNextReposition(QQuickItemViewTransitioner *transitioner, QQuickItemViewTransitioner::TransitionType type, bool asTarget)
@@ -422,84 +441,24 @@ void QQuickStackViewPrivate::ensureTransitioner()
}
}
-void QQuickStackViewPrivate::popTransition(QQuickStackElement *enter, QQuickStackElement *exit, const QRectF &viewBounds, bool immediate)
+void QQuickStackViewPrivate::startTransition(const QQuickStackTransition &first, const QQuickStackTransition &second, bool immediate)
{
- ensureTransitioner();
+ if (first.element)
+ first.element->transitionNextReposition(transitioner, first.type, first.target);
+ if (second.element)
+ second.element->transitionNextReposition(transitioner, second.type, second.target);
- 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);
+ if (first.element) {
+ if (immediate || !first.element->item || !first.element->prepareTransition(transitioner, first.viewBounds))
+ completeTransition(first.element, transitioner->removeTransition, first.status);
else
- exit->startTransition(transitioner, QQuickStackView::Deactivating);
+ first.element->startTransition(transitioner, first.status);
}
- if (enter) {
- if (immediate || !enter->item || !enter->prepareTransition(transitioner, QRectF()))
- completeTransition(enter, transitioner->removeDisplacedTransition, QQuickStackView::Activating);
+ if (second.element) {
+ if (immediate || !second.element->item || !second.element->prepareTransition(transitioner, second.viewBounds))
+ completeTransition(second.element, transitioner->removeDisplacedTransition, second.status);
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);
+ second.element->startTransition(transitioner, second.status);
}
if (transitioner) {
@@ -554,4 +513,119 @@ void QQuickStackViewPrivate::setBusy(bool b)
emit q->busyChanged();
}
+static QQuickStackTransition exitTransition(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ QQuickStackTransition st;
+ st.status = QQuickStackView::Deactivating;
+ st.transition = nullptr;
+ st.element = element;
+
+ const QQuickItemViewTransitioner *transitioner = QQuickStackViewPrivate::get(view)->transitioner;
+
+ switch (operation) {
+ case QQuickStackView::PushTransition:
+ st.target = false;
+ st.type = QQuickItemViewTransitioner::AddTransition;
+ st.viewBounds = QRectF();
+ if (transitioner)
+ st.transition = transitioner->addDisplacedTransition;
+ break;
+ case QQuickStackView::ReplaceTransition:
+ st.target = false;
+ st.type = QQuickItemViewTransitioner::MoveTransition;
+ st.viewBounds = QRectF();
+ if (transitioner)
+ st.transition = transitioner->moveDisplacedTransition;
+ break;
+ case QQuickStackView::PopTransition:
+ st.target = true;
+ st.type = QQuickItemViewTransitioner::RemoveTransition;
+ st.viewBounds = view->boundingRect();
+ if (transitioner)
+ st.transition = transitioner->removeTransition;
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+
+ return st;
+}
+
+static QQuickStackTransition enterTransition(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ QQuickStackTransition st;
+ st.status = QQuickStackView::Activating;
+ st.transition = nullptr;
+ st.element = element;
+
+ const QQuickItemViewTransitioner *transitioner = QQuickStackViewPrivate::get(view)->transitioner;
+
+ switch (operation) {
+ case QQuickStackView::PushTransition:
+ st.target = true;
+ st.type = QQuickItemViewTransitioner::AddTransition;
+ st.viewBounds = view->boundingRect();
+ if (transitioner)
+ st.transition = transitioner->addTransition;
+ break;
+ case QQuickStackView::ReplaceTransition:
+ st.target = true;
+ st.type = QQuickItemViewTransitioner::MoveTransition;
+ st.viewBounds = view->boundingRect();
+ if (transitioner)
+ st.transition = transitioner->moveTransition;
+ break;
+ case QQuickStackView::PopTransition:
+ st.target = false;
+ st.type = QQuickItemViewTransitioner::RemoveTransition;
+ st.viewBounds = QRectF();
+ if (transitioner)
+ st.transition = transitioner->removeDisplacedTransition;
+ break;
+ default:
+ Q_UNREACHABLE();
+ break;
+ }
+
+ return st;
+}
+
+static QQuickStackView::Operation operationTransition(QQuickStackView::Operation operation, QQuickStackView::Operation transition)
+{
+ if (operation == QQuickStackView::Immediate || operation == QQuickStackView::Transition)
+ return transition;
+ return operation;
+}
+
+QQuickStackTransition QQuickStackTransition::popExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ return exitTransition(operationTransition(operation, QQuickStackView::PopTransition), element, view);
+}
+
+QQuickStackTransition QQuickStackTransition::popEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ return enterTransition(operationTransition(operation, QQuickStackView::PopTransition), element, view);
+}
+
+QQuickStackTransition QQuickStackTransition::pushExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ return exitTransition(operationTransition(operation, QQuickStackView::PushTransition), element, view);
+}
+
+QQuickStackTransition QQuickStackTransition::pushEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ return enterTransition(operationTransition(operation, QQuickStackView::PushTransition), element, view);
+}
+
+QQuickStackTransition QQuickStackTransition::replaceExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ return exitTransition(operationTransition(operation, QQuickStackView::ReplaceTransition), element, view);
+}
+
+QQuickStackTransition QQuickStackTransition::replaceEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view)
+{
+ return enterTransition(operationTransition(operation, QQuickStackView::ReplaceTransition), element, view);
+}
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h
index f994f361..7491f8f6 100644
--- a/src/quicktemplates2/qquickstackview_p.h
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -121,8 +121,11 @@ public:
Q_INVOKABLE QQuickItem *find(const QJSValue &callback, LoadBehavior behavior = DontLoad);
enum Operation {
- Transition,
- Immediate
+ Transition = -1, // deprecated
+ Immediate = 0,
+ PushTransition = 1,
+ ReplaceTransition = 2,
+ PopTransition = 3,
};
Q_ENUM(Operation)
@@ -168,7 +171,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickStackAttached : public QObject
Q_PROPERTY(QQuickStackView::Status status READ status NOTIFY statusChanged FINAL)
public:
- explicit QQuickStackAttached(QQuickItem *parent = nullptr);
+ explicit QQuickStackAttached(QObject *parent = nullptr);
~QQuickStackAttached();
int index() const;
@@ -179,6 +182,11 @@ Q_SIGNALS:
void indexChanged();
void viewChanged();
void statusChanged();
+ /*Q_REVISION(1)*/ void activated();
+ /*Q_REVISION(1)*/ void activating();
+ /*Q_REVISION(1)*/ void deactivated();
+ /*Q_REVISION(1)*/ void deactivating();
+ /*Q_REVISION(1)*/ void removed();
private:
Q_DISABLE_COPY(QQuickStackAttached)
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
index 6abaaad6..5b3b1445 100644
--- a/src/quicktemplates2/qquickstackview_p_p.h
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
class QQmlContext;
class QQmlComponent;
-class QQmlIncubator;
+struct QQuickStackTransition;
class QQuickStackElement : public QQuickItemViewTransitionableItem, public QQuickItemChangeListener
{
@@ -93,7 +93,6 @@ public:
bool heightValid;
QQmlContext *context;
QQmlComponent *component;
- QQmlIncubator *incubator;
QQuickStackView *view;
QPointer<QQuickItem> originalParent;
QQuickStackView::Status status;
@@ -125,9 +124,7 @@ public:
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 startTransition(const QQuickStackTransition &first, const QQuickStackTransition &second, bool immediate);
void completeTransition(QQuickStackElement *element, QQuickTransition *transition, QQuickStackView::Status status);
void viewItemTransitionFinished(QQuickItemViewTransitionableItem *item) override;
@@ -141,6 +138,25 @@ public:
QQuickItemViewTransitioner *transitioner;
};
+struct QQuickStackTransition
+{
+ static QQuickStackTransition popExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view);
+ static QQuickStackTransition popEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view);
+
+ static QQuickStackTransition pushExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view);
+ static QQuickStackTransition pushEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view);
+
+ static QQuickStackTransition replaceExit(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view);
+ static QQuickStackTransition replaceEnter(QQuickStackView::Operation operation, QQuickStackElement *element, QQuickStackView *view);
+
+ bool target;
+ QQuickStackView::Status status;
+ QQuickItemViewTransitioner::TransitionType type;
+ QRectF viewBounds;
+ QQuickStackElement *element;
+ QQuickTransition *transition;
+};
+
class QQuickStackAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
{
Q_DECLARE_PUBLIC(QQuickStackAttached)
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index 3dec1f2e..fe678b80 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -100,6 +100,12 @@ QT_BEGIN_NAMESPACE
*/
namespace {
+ typedef QQuickSwipeDelegateAttached Attached;
+
+ Attached *attachedObject(QQuickItem *item) {
+ return qobject_cast<Attached*>(qmlAttachedPropertiesObject<QQuickSwipeDelegate>(item, false));
+ }
+
enum PositionAnimation {
DontAnimatePosition,
AnimatePosition
@@ -550,6 +556,14 @@ void QQuickSwipe::setComplete(bool complete)
d->complete = complete;
emit completeChanged();
+ if (d->complete)
+ emit completed();
+}
+
+void QQuickSwipe::close()
+{
+ setPosition(0);
+ setComplete(false);
}
class QQuickSwipeDelegatePrivate : public QQuickItemDelegatePrivate
@@ -583,9 +597,22 @@ bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseE
return true;
}
+ // The position is non-zero, this press could be either for a delegate or the control itself
+ // (the control can be clicked to e.g. close the swipe). Either way, we must begin measuring
+ // mouse movement in case it turns into a swipe, in which case we grab the mouse.
swipePrivate->positionBeforePress = swipePrivate->position;
swipePrivate->velocityCalculator.startMeasuring(event->pos(), event->timestamp());
pressPoint = item->mapToItem(q, event->pos());
+
+ // When a delegate uses the attached properties and signals, it declares that it wants mouse events.
+ Attached *attached = attachedObject(item);
+ if (attached) {
+ attached->setPressed(true);
+ // Stop the event from propagating, as QQuickItem explicitly ignores events.
+ event->accept();
+ return true;
+ }
+
return false;
}
@@ -611,7 +638,8 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
if (item == q && !pressed)
return false;
- const qreal distance = (event->pos() - pressPoint).x();
+ const QPointF mappedEventPos = item->mapToItem(q, event->pos());
+ const qreal distance = (mappedEventPos - pressPoint).x();
if (!q->keepMouseGrab()) {
// Taken from QQuickDrawerPrivate::grabMouse; see comments there.
int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
@@ -620,9 +648,12 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
QQuickItem *grabber = q->window()->mouseGrabberItem();
if (!grabber || !grabber->keepMouseGrab()) {
q->grabMouse();
- q->setKeepMouseGrab(overThreshold);
+ q->setKeepMouseGrab(true);
q->setPressed(true);
swipe.setComplete(false);
+
+ if (Attached *attached = attachedObject(item))
+ attached->setPressed(false);
}
}
}
@@ -682,7 +713,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
static const qreal exposeVelocityThreshold = 300.0;
-bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *, QMouseEvent *event)
+bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event)
{
Q_Q(QQuickSwipeDelegate);
QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&swipe);
@@ -709,6 +740,14 @@ bool QQuickSwipeDelegatePrivate::handleMouseReleaseEvent(QQuickItem *, QMouseEve
swipePrivate->wasComplete = false;
}
+ if (Attached *attached = attachedObject(item)) {
+ const bool wasPressed = attached->isPressed();
+ if (wasPressed) {
+ attached->setPressed(false);
+ emit attached->clicked();
+ }
+ }
+
// Only consume child events if we had grabbed the mouse.
return hadGrabbedMouse;
}
@@ -752,6 +791,17 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
}
/*!
+ \since QtQuick.Controls 2.1
+ \qmlmethod void QtQuick.Controls::SwipeDelegate::swipe.close()
+
+ This method sets the \c position of the swipe to \c 0. Any animations
+ defined for the \l {Item::}{x} position of \l {Control::}{contentItem}
+ and \l {Control::}{background} will be triggered.
+
+ \sa swipe
+*/
+
+/*!
\qmlpropertygroup QtQuick.Controls::SwipeDelegate::swipe
\qmlproperty real QtQuick.Controls::SwipeDelegate::swipe.position
\qmlproperty bool QtQuick.Controls::SwipeDelegate::swipe.complete
@@ -764,7 +814,7 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
\table
\header
- \li Property
+ \li Name
\li Description
\row
\li position
@@ -826,9 +876,18 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
If \c right has not been set, or the position hasn't changed since
creation of the SwipeDelegate, this property will be \c null.
+ \row
+ \li completed()
+ \li This signal is emitted when \c complete becomes \c true.
+
+ It is useful for performing some action upon completion of a swipe.
+ For example, it can be used to remove the delegate from the list
+ that it is in.
+
+ This signal was added in QtQuick.Controls 2.1.
\endtable
- \sa {Control::}{contentItem}, {Control::}{background}
+ \sa {Control::}{contentItem}, {Control::}{background}, swipe.close()
*/
QQuickSwipe *QQuickSwipeDelegate::swipe() const
{
@@ -836,6 +895,11 @@ QQuickSwipe *QQuickSwipeDelegate::swipe() const
return const_cast<QQuickSwipe*>(&d->swipe);
}
+QQuickSwipeDelegateAttached *QQuickSwipeDelegate::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickSwipeDelegateAttached(object);
+}
+
static bool isChildOrGrandchildOf(QQuickItem *child, QQuickItem *item)
{
return item && (child == item || item->isAncestorOf(child));
@@ -866,6 +930,14 @@ bool QQuickSwipeDelegate::childMouseEventFilter(QQuickItem *child, QEvent *event
QMouseEvent *mouseEvent = static_cast<QMouseEvent *>(event);
QQuickItemDelegate::mouseReleaseEvent(mouseEvent);
return d->handleMouseReleaseEvent(child, mouseEvent);
+ } case QEvent::UngrabMouse: {
+ // If the mouse was pressed over e.g. rightItem and then dragged down,
+ // the ListView would eventually grab the mouse, at which point we must
+ // clear the pressed flag so that it doesn't stay pressed after the release.
+ Attached *attached = attachedObject(child);
+ if (attached)
+ attached->setPressed(false);
+ return false;
} default:
return false;
}
@@ -918,4 +990,155 @@ QAccessible::Role QQuickSwipeDelegate::accessibleRole() const
}
#endif
+class QQuickSwipeDelegateAttachedPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwipeDelegateAttached)
+
+public:
+ QQuickSwipeDelegateAttachedPrivate() :
+ pressed(false)
+ {
+ }
+
+ // True when left/right/behind is non-interactive and is pressed.
+ bool pressed;
+};
+
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlattachedsignal QtQuick.Controls::SwipeDelegate::clicked()
+
+ This signal can be attached to a non-interactive item declared in
+ \c swipe.left, \c swipe.right, or \c swipe.behind, in order to react to
+ clicks. Items can only be clicked when \c swipe.complete is \c true.
+
+ For interactive controls (such as \l Button) declared in these
+ items, use their respective \c clicked() signal instead.
+
+ To respond to clicks on the SwipeDelegate itself, use its
+ \l {AbstractButton::}{clicked()} signal.
+
+ \note See the documentation for \l pressed for information on
+ how to use the event-related properties correctly.
+
+ \sa pressed
+*/
+
+QQuickSwipeDelegateAttached::QQuickSwipeDelegateAttached(QObject *object) :
+ QObject(*(new QQuickSwipeDelegateAttachedPrivate), object)
+{
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (item) {
+ // This allows us to be notified when an otherwise non-interactive item
+ // is pressed and clicked. The alternative is much more more complex:
+ // iterating through children that contain the event pos and finding
+ // the first one with an attached object.
+ item->setAcceptedMouseButtons(Qt::AllButtons);
+ } else {
+ qWarning() << "Attached properties of SwipeDelegate must be accessed through an Item";
+ }
+}
+
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlattachedproperty bool QtQuick.Controls::SwipeDelegate::pressed
+ \readonly
+
+ This property can be attached to a non-interactive item declared in
+ \c swipe.left, \c swipe.right, or \c swipe.behind, in order to detect if it
+ is pressed. Items can only be pressed when \c swipe.complete is \c true.
+
+ For example:
+
+ \code
+ swipe.right: Label {
+ anchors.right: parent.right
+ height: parent.height
+ text: "Action"
+ color: "white"
+ padding: 12
+ background: Rectangle {
+ color: SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
+ }
+ }
+ \endcode
+
+ It is possible to have multiple items which individually receive mouse and
+ touch events. For example, to have two actions in the \c swipe.right item,
+ use the following code:
+
+ \code
+ swipe.right: Row {
+ anchors.right: parent.right
+ height: parent.height
+
+ Label {
+ id: moveLabel
+ text: qsTr("Move")
+ color: "white"
+ verticalAlignment: Label.AlignVCenter
+ padding: 12
+ height: parent.height
+
+ SwipeDelegate.onClicked: console.log("Moving...")
+
+ background: Rectangle {
+ color: moveLabel.SwipeDelegate.pressed ? Qt.darker("#ffbf47", 1.1) : "#ffbf47"
+ }
+ }
+ Label {
+ id: deleteLabel
+ text: qsTr("Delete")
+ color: "white"
+ verticalAlignment: Label.AlignVCenter
+ padding: 12
+ height: parent.height
+
+ SwipeDelegate.onClicked: console.log("Deleting...")
+
+ background: Rectangle {
+ color: deleteLabel.SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
+ }
+ }
+ }
+ \endcode
+
+ Note how the \c color assignment in each \l {Control::}{background} item
+ qualifies the attached property with the \c id of the label. This
+ is important; using the attached properties on an item causes that item
+ to accept events. Suppose we had left out the \c id in the previous example:
+
+ \code
+ color: SwipeDelegate.pressed ? Qt.darker("tomato", 1.1) : "tomato"
+ \endcode
+
+ The \l Rectangle background item is a child of the label, so it naturally
+ receives events before it. In practice, this means that the background
+ color will change, but the \c onClicked handler in the label will never
+ get called.
+
+ For interactive controls (such as \l Button) declared in these
+ items, use their respective \c pressed property instead.
+
+ For presses on the SwipeDelegate itself, use its
+ \l {AbstractButton::}{pressed} property.
+
+ \sa clicked()
+*/
+bool QQuickSwipeDelegateAttached::isPressed() const
+{
+ Q_D(const QQuickSwipeDelegateAttached);
+ return d->pressed;
+}
+
+void QQuickSwipeDelegateAttached::setPressed(bool pressed)
+{
+ Q_D(QQuickSwipeDelegateAttached);
+ if (pressed == d->pressed)
+ return;
+
+ d->pressed = pressed;
+ emit pressedChanged();
+}
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswipedelegate_p.h b/src/quicktemplates2/qquickswipedelegate_p.h
index e71455b0..49f6c939 100644
--- a/src/quicktemplates2/qquickswipedelegate_p.h
+++ b/src/quicktemplates2/qquickswipedelegate_p.h
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
class QQuickSwipeDelegatePrivate;
class QQuickSwipe;
+class QQuickSwipeDelegateAttached;
+class QQuickSwipeDelegateAttachedPrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeDelegate : public QQuickItemDelegate
{
@@ -65,6 +67,8 @@ public:
QQuickSwipe *swipe() const;
+ static QQuickSwipeDelegateAttached *qmlAttachedProperties(QObject *object);
+
protected:
bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
@@ -125,9 +129,12 @@ public:
QQuickItem *rightItem() const;
void setRightItem(QQuickItem *item);
+ Q_REVISION(1) Q_INVOKABLE void close();
+
Q_SIGNALS:
void positionChanged();
void completeChanged();
+ Q_REVISION(1) void completed();
void leftChanged();
void behindChanged();
void rightChanged();
@@ -140,8 +147,29 @@ private:
Q_DECLARE_PRIVATE(QQuickSwipe)
};
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeDelegateAttached : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(bool pressed READ isPressed NOTIFY pressedChanged FINAL)
+
+public:
+ explicit QQuickSwipeDelegateAttached(QObject *object = nullptr);
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+Q_SIGNALS:
+ void pressedChanged();
+ void clicked();
+
+private:
+ Q_DISABLE_COPY(QQuickSwipeDelegateAttached)
+ Q_DECLARE_PRIVATE(QQuickSwipeDelegateAttached)
+};
+
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickSwipeDelegate)
+QML_DECLARE_TYPEINFO(QQuickSwipeDelegate, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKSWIPEDELEGATE_P_H
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index 82d05fbe..ef98c59b 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -69,6 +69,29 @@ QT_BEGIN_NAMESPACE
\l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove}
pages dynamically at run time.
+ It is generally not advisable to add excessive amounts of pages to a
+ SwipeView. However, when the amount of pages grows larger, or individual
+ pages are relatively complex, it may be desired free up resources by
+ unloading pages that are outside the reach. The following example presents
+ how to use \l Loader to keep a maximum of three pages simultaneously
+ instantiated.
+
+ \code
+ SwipeView {
+ Repeater {
+ model: 6
+ Loader {
+ active: SwipeView.isCurrentItem || SwipeView.isNextItem || SwipeView.isPreviousItem
+ sourceComponent: Text {
+ text: index
+ Component.onCompleted: console.log("created:", index)
+ Component.onDestruction: console.log("destroyed:", index)
+ }
+ }
+ }
+ }
+ \endcode
+
\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
@@ -83,10 +106,14 @@ class QQuickSwipeViewPrivate : public QQuickContainerPrivate
Q_DECLARE_PUBLIC(QQuickSwipeView)
public:
+ QQuickSwipeViewPrivate() : interactive(true) { }
+
void resizeItem(QQuickItem *item);
void resizeItems();
static QQuickSwipeViewPrivate *get(QQuickSwipeView *view);
+
+ bool interactive;
};
void QQuickSwipeViewPrivate::resizeItems()
@@ -120,15 +147,34 @@ QQuickSwipeView::QQuickSwipeView(QQuickItem *parent) :
setActiveFocusOnTab(true);
}
-QQuickSwipeViewAttached *QQuickSwipeView::qmlAttachedProperties(QObject *object)
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty bool QtQuick.Controls::SwipeView::interactive
+
+ This property describes whether the user can interact with the SwipeView.
+ The user cannot swipe a view that is not interactive.
+
+ The default value is \c true.
+*/
+bool QQuickSwipeView::isInteractive() const
{
- QQuickItem *item = qobject_cast<QQuickItem *>(object);
- if (!item) {
- qWarning() << "SwipeView: attached properties must be accessed from within a child item";
- return nullptr;
- }
+ Q_D(const QQuickSwipeView);
+ return d->interactive;
+}
+
+void QQuickSwipeView::setInteractive(bool interactive)
+{
+ Q_D(QQuickSwipeView);
+ if (d->interactive == interactive)
+ return;
- return new QQuickSwipeViewAttached(item);
+ d->interactive = interactive;
+ emit interactiveChanged();
+}
+
+QQuickSwipeViewAttached *QQuickSwipeView::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickSwipeViewAttached(object);
}
void QQuickSwipeView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -172,6 +218,26 @@ QAccessible::Role QQuickSwipeView::accessibleRole() const
*/
/*!
+ \qmlattachedproperty bool QtQuick.Controls::SwipeView::isNextItem
+ \since QtQuick.Controls 2.1
+ \readonly
+
+ This attached property is \c true if this child is the next item.
+
+ It is attached to each child item of the SwipeView.
+*/
+
+/*!
+ \qmlattachedproperty bool QtQuick.Controls::SwipeView::isPreviousItem
+ \since QtQuick.Controls 2.1
+ \readonly
+
+ This attached property is \c true if this child is the previous item.
+
+ It is attached to each child item of the SwipeView.
+*/
+
+/*!
\qmlattachedproperty SwipeView QtQuick.Controls::SwipeView::view
\readonly
@@ -184,11 +250,11 @@ class QQuickSwipeViewAttachedPrivate : public QObjectPrivate, public QQuickItemC
{
Q_DECLARE_PUBLIC(QQuickSwipeViewAttached)
public:
- QQuickSwipeViewAttachedPrivate(QQuickItem *item) :
- item(item),
+ QQuickSwipeViewAttachedPrivate() :
+ item(nullptr),
swipeView(nullptr),
index(-1),
- isCurrent(false)
+ currentIndex(-1)
{
}
@@ -203,19 +269,16 @@ public:
void itemDestroyed(QQuickItem *) override;
void updateIndex();
- void updateIsCurrent();
+ void updateCurrentIndex();
void setView(QQuickSwipeView *view);
void setIndex(int i);
- void setIsCurrent(bool current);
+ void setCurrentIndex(int i);
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;
+ int currentIndex;
};
void QQuickSwipeViewAttachedPrivate::updateIndex()
@@ -223,9 +286,9 @@ void QQuickSwipeViewAttachedPrivate::updateIndex()
setIndex(swipeView ? QQuickSwipeViewPrivate::get(swipeView)->contentModel->indexOf(item, nullptr) : -1);
}
-void QQuickSwipeViewAttachedPrivate::updateIsCurrent()
+void QQuickSwipeViewAttachedPrivate::updateCurrentIndex()
{
- setIsCurrent(swipeView ? swipeView->currentIndex() == index : false);
+ setCurrentIndex(swipeView ? swipeView->currentIndex() : -1);
}
void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
@@ -238,7 +301,7 @@ void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
p->removeItemChangeListener(this, QQuickItemPrivate::Children);
disconnect(swipeView, &QQuickSwipeView::currentIndexChanged,
- this, &QQuickSwipeViewAttachedPrivate::updateIsCurrent);
+ this, &QQuickSwipeViewAttachedPrivate::updateCurrentIndex);
disconnect(swipeView, &QQuickSwipeView::contentChildrenChanged,
this, &QQuickSwipeViewAttachedPrivate::updateIndex);
}
@@ -250,7 +313,7 @@ void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
p->addItemChangeListener(this, QQuickItemPrivate::Children);
connect(swipeView, &QQuickSwipeView::currentIndexChanged,
- this, &QQuickSwipeViewAttachedPrivate::updateIsCurrent);
+ this, &QQuickSwipeViewAttachedPrivate::updateCurrentIndex);
connect(swipeView, &QQuickSwipeView::contentChildrenChanged,
this, &QQuickSwipeViewAttachedPrivate::updateIndex);
}
@@ -259,17 +322,26 @@ void QQuickSwipeViewAttachedPrivate::setView(QQuickSwipeView *view)
emit q->viewChanged();
updateIndex();
- updateIsCurrent();
+ updateCurrentIndex();
}
-void QQuickSwipeViewAttachedPrivate::setIsCurrent(bool current)
+void QQuickSwipeViewAttachedPrivate::setCurrentIndex(int i)
{
- if (current == isCurrent)
+ if (i == currentIndex)
return;
- isCurrent = current;
Q_Q(QQuickSwipeViewAttached);
- emit q->isCurrentItemChanged();
+ const bool wasCurrent = q->isCurrentItem();
+ const bool wasNext = q->isNextItem();
+ const bool wasPrevious = q->isPreviousItem();
+
+ currentIndex = i;
+ if (wasCurrent != q->isCurrentItem())
+ emit q->isCurrentItemChanged();
+ if (wasNext != q->isNextItem())
+ emit q->isNextItemChanged();
+ if (wasPrevious != q->isPreviousItem())
+ emit q->isPreviousItemChanged();
}
void QQuickSwipeViewAttachedPrivate::setIndex(int i)
@@ -323,15 +395,20 @@ void QQuickSwipeViewAttachedPrivate::itemDestroyed(QQuickItem *item)
QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
}
-QQuickSwipeViewAttached::QQuickSwipeViewAttached(QQuickItem *item) :
- QObject(*(new QQuickSwipeViewAttachedPrivate(item)), item)
+QQuickSwipeViewAttached::QQuickSwipeViewAttached(QObject *parent) :
+ QObject(*(new QQuickSwipeViewAttachedPrivate), parent)
{
Q_D(QQuickSwipeViewAttached);
- if (item->parentItem())
- d->updateView(item->parentItem());
-
- QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- p->addItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
+ d->item = qobject_cast<QQuickItem *>(parent);
+ if (d->item) {
+ if (d->item->parentItem())
+ d->updateView(d->item->parentItem());
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);
+ p->addItemChangeListener(d, QQuickItemPrivate::Parent | QQuickItemPrivate::Destroyed);
+ } else if (parent) {
+ qmlInfo(parent) << "SwipeView: attached properties must be accessed from within a child item";
+ }
}
QQuickSwipeViewAttached::~QQuickSwipeViewAttached()
@@ -357,7 +434,19 @@ int QQuickSwipeViewAttached::index() const
bool QQuickSwipeViewAttached::isCurrentItem() const
{
Q_D(const QQuickSwipeViewAttached);
- return d->swipeView ? d->swipeView->currentIndex() == d->index : false;
+ return d->index != -1 && d->currentIndex != -1 && d->index == d->currentIndex;
+}
+
+bool QQuickSwipeViewAttached::isNextItem() const
+{
+ Q_D(const QQuickSwipeViewAttached);
+ return d->index != -1 && d->currentIndex != -1 && d->index == d->currentIndex + 1;
+}
+
+bool QQuickSwipeViewAttached::isPreviousItem() const
+{
+ Q_D(const QQuickSwipeViewAttached);
+ return d->index != -1 && d->currentIndex != -1 && d->index == d->currentIndex - 1;
}
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswipeview_p.h b/src/quicktemplates2/qquickswipeview_p.h
index c6cb62ba..8c489d53 100644
--- a/src/quicktemplates2/qquickswipeview_p.h
+++ b/src/quicktemplates2/qquickswipeview_p.h
@@ -58,12 +58,19 @@ class QQuickSwipeViewPrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipeView : public QQuickContainer
{
Q_OBJECT
+ Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive NOTIFY interactiveChanged FINAL REVISION 1)
public:
explicit QQuickSwipeView(QQuickItem *parent = nullptr);
+ bool isInteractive() const;
+ void setInteractive(bool interactive);
+
static QQuickSwipeViewAttached *qmlAttachedProperties(QObject *object);
+Q_SIGNALS:
+ Q_REVISION(1) void interactiveChanged();
+
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void itemAdded(int index, QQuickItem *item) override;
@@ -84,19 +91,25 @@ 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(bool isNextItem READ isNextItem NOTIFY isNextItemChanged FINAL REVISION 1)
+ Q_PROPERTY(bool isPreviousItem READ isPreviousItem NOTIFY isPreviousItemChanged FINAL REVISION 1)
Q_PROPERTY(QQuickSwipeView *view READ view NOTIFY viewChanged FINAL)
public:
- explicit QQuickSwipeViewAttached(QQuickItem *delegateItem);
+ explicit QQuickSwipeViewAttached(QObject *parent = nullptr);
~QQuickSwipeViewAttached();
int index() const;
bool isCurrentItem() const;
+ bool isNextItem() const;
+ bool isPreviousItem() const;
QQuickSwipeView *view() const;
Q_SIGNALS:
void indexChanged();
void isCurrentItemChanged();
+ /*Q_REVISION(1)*/ void isNextItemChanged();
+ /*Q_REVISION(1)*/ void isPreviousItemChanged();
void viewChanged();
private:
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index ee3436f9..9aead901 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -104,7 +104,7 @@ public:
void updateCurrentIndex();
void updateLayout();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
bool updatingLayout;
QQuickTabBar::Position position;
@@ -164,7 +164,7 @@ void QQuickTabBarPrivate::updateLayout()
}
}
-void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
{
if (!updatingLayout)
updateLayout();
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index a66d7bf5..56a538ee 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -101,15 +101,40 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlsignal QtQuick.Controls::TextArea::pressAndHold(MouseEvent mouse)
+ \qmlsignal QtQuick.Controls::TextArea::pressAndHold(MouseEvent event)
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
+ The \l {MouseEvent}{event} parameter provides information about the press, including the x and y
position of the press, and which button is pressed.
+
+ \sa pressed, released
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::TextArea::pressed(MouseEvent event)
+ \since QtQuick.Controls 2.1
+
+ This signal is emitted when the text area is pressed by the user.
+ The \l {MouseEvent}{event} parameter provides information about the press,
+ including the x and y position of the press, and which button is pressed.
+
+ \sa released, pressAndHold
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::TextArea::released(MouseEvent event)
+ \since QtQuick.Controls 2.1
+
+ This signal is emitted when the text area is released by the user.
+ The \l {MouseEvent}{event} parameter provides information about the release,
+ including the x and y position of the press, and which button is pressed.
+
+ \sa pressed, pressAndHold
*/
QQuickTextAreaPrivate::QQuickTextAreaPrivate()
- : background(nullptr), focusReason(Qt::OtherFocusReason), accessibleAttached(nullptr), flickable(nullptr)
+ : hovered(false), explicitHoverEnabled(false), background(nullptr),
+ focusReason(Qt::OtherFocusReason), accessibleAttached(nullptr), flickable(nullptr)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -160,7 +185,7 @@ void QQuickTextAreaPrivate::attachFlickable(QQuickFlickable *item)
QObject::connect(flickable, &QQuickFlickable::contentXChanged, q, &QQuickItem::update);
QObject::connect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
- QQuickItemPrivate::get(flickable)->updateOrAddGeometryChangeListener(this, QQuickItemPrivate::SizeChange);
+ QQuickItemPrivate::get(flickable)->updateOrAddGeometryChangeListener(this, QQuickGeometryChange::Size);
QObjectPrivate::connect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
QObjectPrivate::connect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
@@ -180,7 +205,7 @@ void QQuickTextAreaPrivate::detachFlickable()
QObject::disconnect(flickable, &QQuickFlickable::contentXChanged, q, &QQuickItem::update);
QObject::disconnect(flickable, &QQuickFlickable::contentYChanged, q, &QQuickItem::update);
- QQuickItemPrivate::get(flickable)->updateOrRemoveGeometryChangeListener(this, QQuickItemPrivate::SizeChange);
+ QQuickItemPrivate::get(flickable)->updateOrRemoveGeometryChangeListener(this, QQuickGeometryChange::Size);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl);
@@ -247,11 +272,11 @@ void QQuickTextAreaPrivate::resizeFlickableContent()
flickable->setContentHeight(q->contentHeight() + q->topPadding() + q->bottomPadding());
}
-void QQuickTextAreaPrivate::itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry)
+void QQuickTextAreaPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
{
Q_UNUSED(item);
- Q_UNUSED(newGeometry);
- Q_UNUSED(oldGeometry);
+ Q_UNUSED(change);
+ Q_UNUSED(diff);
resizeFlickableControl();
}
@@ -285,6 +310,7 @@ QQuickTextArea::QQuickTextArea(QQuickItem *parent) :
{
Q_D(QQuickTextArea);
setActiveFocusOnTab(true);
+ setAcceptedMouseButtons(Qt::AllButtons);
d->setImplicitResizeEnabled(false);
d->pressHandler.control = this;
#ifndef QT_NO_CURSOR
@@ -332,6 +358,21 @@ void QQuickTextAreaPrivate::inheritFont(const QFont &f)
emit q->fontChanged();
}
+void QQuickTextAreaPrivate::updateHoverEnabled(bool enabled, bool xplicit)
+{
+ Q_Q(QQuickTextArea);
+ if (!xplicit && explicitHoverEnabled)
+ return;
+
+ bool wasEnabled = q->isHoverEnabled();
+ explicitHoverEnabled = xplicit;
+ if (wasEnabled != enabled) {
+ q->setAcceptHoverEvents(enabled);
+ QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
+ emit q->hoverEnabledChanged();
+ }
+}
+
void QQuickTextAreaPrivate::_q_readOnlyChanged(bool isReadOnly)
{
#ifndef QT_NO_ACCESSIBILITY
@@ -468,6 +509,64 @@ void QQuickTextArea::setFocusReason(Qt::FocusReason reason)
emit focusReasonChanged();
}
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty bool QtQuick.Controls::TextArea::hovered
+ \readonly
+
+ This property holds whether the text area is hovered.
+
+ \sa hoverEnabled
+*/
+bool QQuickTextArea::isHovered() const
+{
+ Q_D(const QQuickTextArea);
+ return d->hovered;
+}
+
+void QQuickTextArea::setHovered(bool hovered)
+{
+ Q_D(QQuickTextArea);
+ if (hovered == d->hovered)
+ return;
+
+ d->hovered = hovered;
+ emit hoveredChanged();
+}
+
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty bool QtQuick.Controls::TextArea::hoverEnabled
+
+ This property determines whether the text area accepts hover events. The default value is \c true.
+
+ \sa hovered
+*/
+bool QQuickTextArea::isHoverEnabled() const
+{
+ Q_D(const QQuickTextArea);
+ return d->hoverEnabled;
+}
+
+void QQuickTextArea::setHoverEnabled(bool enabled)
+{
+ Q_D(QQuickTextArea);
+ if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
+ return;
+
+ d->updateHoverEnabled(enabled, true); // explicit=true
+}
+
+void QQuickTextArea::resetHoverEnabled()
+{
+ Q_D(QQuickTextArea);
+ if (!d->explicitHoverEnabled)
+ return;
+
+ d->explicitHoverEnabled = false;
+ d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
+}
+
bool QQuickTextArea::contains(const QPointF &point) const
{
Q_D(const QQuickTextArea);
@@ -487,6 +586,8 @@ void QQuickTextArea::componentComplete()
{
Q_D(QQuickTextArea);
QQuickTextEdit::componentComplete();
+ if (!d->explicitHoverEnabled)
+ setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
#ifndef QT_NO_ACCESSIBILITY
if (!d->accessibleAttached && QAccessible::isActive())
d->accessibilityActiveChanged(true);
@@ -500,8 +601,11 @@ void QQuickTextArea::itemChange(QQuickItem::ItemChange change, const QQuickItem:
{
Q_D(QQuickTextArea);
QQuickTextEdit::itemChange(change, value);
- if (change == ItemParentHasChanged && value.item)
+ if (change == ItemParentHasChanged && value.item) {
d->resolveFont();
+ if (!d->explicitHoverEnabled)
+ d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
+ }
}
void QQuickTextArea::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -551,6 +655,22 @@ void QQuickTextArea::focusOutEvent(QFocusEvent *event)
setFocusReason(event->reason());
}
+void QQuickTextArea::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextArea);
+ QQuickTextEdit::hoverEnterEvent(event);
+ setHovered(d->hoverEnabled);
+ event->setAccepted(d->hoverEnabled);
+}
+
+void QQuickTextArea::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextArea);
+ QQuickTextEdit::hoverLeaveEvent(event);
+ setHovered(false);
+ event->setAccepted(d->hoverEnabled);
+}
+
void QQuickTextArea::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickTextArea);
@@ -560,7 +680,12 @@ void QQuickTextArea::mousePressEvent(QMouseEvent *event)
QQuickTextEdit::mousePressEvent(d->pressHandler.delayedMousePressEvent);
d->pressHandler.clearDelayedMouseEvent();
}
+ // Calling the base class implementation will result in QQuickTextControl's
+ // press handler being called, which ignores events that aren't Qt::LeftButton.
+ const bool wasAccepted = event->isAccepted();
QQuickTextEdit::mousePressEvent(event);
+ if (wasAccepted)
+ event->accept();
}
}
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index f00943aa..35bddba0 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -67,6 +67,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit
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)
+ Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION 1)
+ Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1)
public:
explicit QQuickTextArea(QQuickItem *parent = nullptr);
@@ -86,6 +88,13 @@ public:
Qt::FocusReason focusReason() const;
void setFocusReason(Qt::FocusReason reason);
+ bool isHovered() const;
+ void setHovered(bool hovered);
+
+ bool isHoverEnabled() const;
+ void setHoverEnabled(bool enabled);
+ void resetHoverEnabled();
+
bool contains(const QPointF &point) const override;
Q_SIGNALS:
@@ -95,7 +104,11 @@ Q_SIGNALS:
void backgroundChanged();
void placeholderTextChanged();
void focusReasonChanged();
+ Q_REVISION(1) void hoveredChanged();
+ Q_REVISION(1) void hoverEnabledChanged();
void pressAndHold(QQuickMouseEvent *event);
+ Q_REVISION(1) void pressed(QQuickMouseEvent *event);
+ Q_REVISION(1) void released(QQuickMouseEvent *event);
protected:
void classBegin() override;
@@ -107,6 +120,8 @@ protected:
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
+ void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h
index 1598a87e..ed74ac9a 100644
--- a/src/quicktemplates2/qquicktextarea_p_p.h
+++ b/src/quicktemplates2/qquicktextarea_p_p.h
@@ -81,13 +81,15 @@ public:
void resolveFont();
void inheritFont(const QFont &f);
+ void updateHoverEnabled(bool h, bool e);
+
void attachFlickable(QQuickFlickable *flickable);
void detachFlickable();
void ensureCursorVisible();
void resizeFlickableControl();
void resizeFlickableContent();
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
qreal getImplicitWidth() const override;
qreal getImplicitHeight() const override;
@@ -104,6 +106,8 @@ public:
void deleteDelegate(QObject *object);
+ bool hovered;
+ bool explicitHoverEnabled;
QFont font;
QQuickItem *background;
QString placeholder;
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index 610df907..2bb902a1 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -82,15 +82,41 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlsignal QtQuick.Controls::TextField::pressAndHold(MouseEvent mouse)
+ \qmlsignal QtQuick.Controls::TextField::pressAndHold(MouseEvent event)
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
+ The \l {MouseEvent}{event} parameter provides information about the press, including the x and y
position of the press, and which button is pressed.
+
+ \sa pressed, released
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::TextField::pressed(MouseEvent event)
+ \since QtQuick.Controls 2.1
+
+ This signal is emitted when the text field is pressed by the user.
+ The \l {MouseEvent}{event} parameter provides information about the press,
+ including the x and y position of the press, and which button is pressed.
+
+ \sa released, pressAndHold
+*/
+
+/*!
+ \qmlsignal QtQuick.Controls::TextField::released(MouseEvent event)
+ \since QtQuick.Controls 2.1
+
+ This signal is emitted when the text field is released by the user.
+ The \l {MouseEvent}{event} parameter provides information about the release,
+ including the x and y position of the press, and which button is pressed.
+
+ \sa pressed, pressAndHold
*/
QQuickTextFieldPrivate::QQuickTextFieldPrivate()
- : background(nullptr)
+ : hovered(false)
+ , explicitHoverEnabled(false)
+ , background(nullptr)
, focusReason(Qt::OtherFocusReason)
, accessibleAttached(nullptr)
{
@@ -152,6 +178,7 @@ QQuickTextField::QQuickTextField(QQuickItem *parent) :
Q_D(QQuickTextField);
d->pressHandler.control = this;
d->setImplicitResizeEnabled(false);
+ setAcceptedMouseButtons(Qt::AllButtons);
setActiveFocusOnTab(true);
#ifndef QT_NO_CURSOR
setCursor(Qt::IBeamCursor);
@@ -195,6 +222,21 @@ void QQuickTextFieldPrivate::inheritFont(const QFont &f)
emit q->fontChanged();
}
+void QQuickTextFieldPrivate::updateHoverEnabled(bool enabled, bool xplicit)
+{
+ Q_Q(QQuickTextField);
+ if (!xplicit && explicitHoverEnabled)
+ return;
+
+ bool wasEnabled = q->isHoverEnabled();
+ explicitHoverEnabled = xplicit;
+ if (wasEnabled != enabled) {
+ q->setAcceptHoverEvents(enabled);
+ QQuickControlPrivate::updateHoverEnabledRecur(q, enabled);
+ emit q->hoverEnabledChanged();
+ }
+}
+
void QQuickTextFieldPrivate::_q_readOnlyChanged(bool isReadOnly)
{
#ifndef QT_NO_ACCESSIBILITY
@@ -346,6 +388,64 @@ void QQuickTextField::setFocusReason(Qt::FocusReason reason)
emit focusReasonChanged();
}
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty bool QtQuick.Controls::TextField::hovered
+ \readonly
+
+ This property holds whether the text field is hovered.
+
+ \sa hoverEnabled
+*/
+bool QQuickTextField::isHovered() const
+{
+ Q_D(const QQuickTextField);
+ return d->hovered;
+}
+
+void QQuickTextField::setHovered(bool hovered)
+{
+ Q_D(QQuickTextField);
+ if (hovered == d->hovered)
+ return;
+
+ d->hovered = hovered;
+ emit hoveredChanged();
+}
+
+/*!
+ \since QtQuick.Controls 2.1
+ \qmlproperty bool QtQuick.Controls::TextField::hoverEnabled
+
+ This property determines whether the text field accepts hover events. The default value is \c false.
+
+ \sa hovered
+*/
+bool QQuickTextField::isHoverEnabled() const
+{
+ Q_D(const QQuickTextField);
+ return d->hoverEnabled;
+}
+
+void QQuickTextField::setHoverEnabled(bool enabled)
+{
+ Q_D(QQuickTextField);
+ if (d->explicitHoverEnabled && enabled == d->hoverEnabled)
+ return;
+
+ d->updateHoverEnabled(enabled, true); // explicit=true
+}
+
+void QQuickTextField::resetHoverEnabled()
+{
+ Q_D(QQuickTextField);
+ if (!d->explicitHoverEnabled)
+ return;
+
+ d->explicitHoverEnabled = false;
+ d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
+}
+
void QQuickTextField::classBegin()
{
Q_D(QQuickTextField);
@@ -357,6 +457,8 @@ void QQuickTextField::componentComplete()
{
Q_D(QQuickTextField);
QQuickTextInput::componentComplete();
+ if (!d->explicitHoverEnabled)
+ setAcceptHoverEvents(QQuickControlPrivate::calcHoverEnabled(d->parentItem));
#ifndef QT_NO_ACCESSIBILITY
if (!d->accessibleAttached && QAccessible::isActive())
d->accessibilityActiveChanged(true);
@@ -370,8 +472,11 @@ void QQuickTextField::itemChange(QQuickItem::ItemChange change, const QQuickItem
{
Q_D(QQuickTextField);
QQuickTextInput::itemChange(change, value);
- if (change == ItemParentHasChanged && value.item)
+ if (change == ItemParentHasChanged && value.item) {
d->resolveFont();
+ if (!d->explicitHoverEnabled)
+ d->updateHoverEnabled(QQuickControlPrivate::calcHoverEnabled(d->parentItem), false); // explicit=false
+ }
}
void QQuickTextField::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -409,6 +514,22 @@ void QQuickTextField::focusOutEvent(QFocusEvent *event)
setFocusReason(event->reason());
}
+void QQuickTextField::hoverEnterEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextField);
+ QQuickTextInput::hoverEnterEvent(event);
+ setHovered(d->hoverEnabled);
+ event->setAccepted(d->hoverEnabled);
+}
+
+void QQuickTextField::hoverLeaveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickTextField);
+ QQuickTextInput::hoverLeaveEvent(event);
+ setHovered(false);
+ event->setAccepted(d->hoverEnabled);
+}
+
void QQuickTextField::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickTextField);
diff --git a/src/quicktemplates2/qquicktextfield_p.h b/src/quicktemplates2/qquicktextfield_p.h
index 591d6edd..57521592 100644
--- a/src/quicktemplates2/qquicktextfield_p.h
+++ b/src/quicktemplates2/qquicktextfield_p.h
@@ -66,6 +66,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextField : public QQuickTextInput
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)
+ Q_PROPERTY(bool hovered READ isHovered NOTIFY hoveredChanged FINAL REVISION 1)
+ Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1)
public:
explicit QQuickTextField(QQuickItem *parent = nullptr);
@@ -83,6 +85,13 @@ public:
Qt::FocusReason focusReason() const;
void setFocusReason(Qt::FocusReason reason);
+ bool isHovered() const;
+ void setHovered(bool hovered);
+
+ bool isHoverEnabled() const;
+ void setHoverEnabled(bool enabled);
+ void resetHoverEnabled();
+
Q_SIGNALS:
void fontChanged();
void implicitWidthChanged3();
@@ -90,7 +99,11 @@ Q_SIGNALS:
void backgroundChanged();
void placeholderTextChanged();
void focusReasonChanged();
- void pressAndHold(QQuickMouseEvent *mouse);
+ Q_REVISION(1) void hoveredChanged();
+ Q_REVISION(1) void hoverEnabledChanged();
+ void pressAndHold(QQuickMouseEvent *event);
+ Q_REVISION(1) void pressed(QQuickMouseEvent *event);
+ Q_REVISION(1) void released(QQuickMouseEvent *event);
protected:
void classBegin() override;
@@ -102,6 +115,8 @@ protected:
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
+ void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverLeaveEvent(QHoverEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
diff --git a/src/quicktemplates2/qquicktextfield_p_p.h b/src/quicktemplates2/qquicktextfield_p_p.h
index 5800f448..fb973ad4 100644
--- a/src/quicktemplates2/qquicktextfield_p_p.h
+++ b/src/quicktemplates2/qquicktextfield_p_p.h
@@ -79,6 +79,8 @@ public:
void resolveFont();
void inheritFont(const QFont &f);
+ void updateHoverEnabled(bool h, bool e);
+
qreal getImplicitWidth() const override;
qreal getImplicitHeight() const override;
@@ -95,6 +97,8 @@ public:
void deleteDelegate(QObject *object);
+ bool hovered;
+ bool explicitHoverEnabled;
QFont font;
QQuickItem *background;
QString placeholder;
diff --git a/src/quicktemplates2/qquicktoolseparator.cpp b/src/quicktemplates2/qquicktoolseparator.cpp
new file mode 100644
index 00000000..36c5ac12
--- /dev/null
+++ b/src/quicktemplates2/qquicktoolseparator.cpp
@@ -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$
+**
+****************************************************************************/
+
+#include "qquicktoolseparator_p.h"
+
+#include "qquickcontrol_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ToolSeparator
+ \inherits Control
+ \instantiates QQuickToolSeparator
+ \inqmlmodule QtQuick.Controls
+ \since 5.8
+ \ingroup qtquickcontrols2-separators
+ \brief Separates a group of items in a toolbar from adjacent items.
+
+ ToolSeparator is used to visually distinguish between groups of items in a
+ toolbar by separating them with a line. It can be used in horizontal or
+ vertical toolbars by setting the \l orientation property to \c Qt.Vertical
+ or \c Qt.Horizontal, respectively.
+
+ \image qtquickcontrols2-toolseparator.png
+
+ \snippet qtquickcontrols2-toolseparator.qml 1
+
+ \sa {Customizing ToolSeparator}, {Separator Controls}
+*/
+
+class QQuickToolSeparatorPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickToolSeparator)
+
+public:
+ QQuickToolSeparatorPrivate() :
+ orientation(Qt::Vertical)
+ {
+ }
+
+ Qt::Orientation orientation;
+};
+
+QQuickToolSeparator::QQuickToolSeparator(QQuickItem *parent) :
+ QQuickControl(*(new QQuickToolSeparatorPrivate), parent)
+{
+}
+
+/*!
+ \qmlproperty enumeration QtQuick.Controls::ToolSeparator::orientation
+
+ This property holds the orientation of the tool separator.
+
+ Possible values:
+ \value Qt.Horizontal A horizontal separator is used in a vertical toolbar.
+ \value Qt.Vertical A vertical separator is used in a horizontal toolbar. (default)
+*/
+Qt::Orientation QQuickToolSeparator::orientation() const
+{
+ Q_D(const QQuickToolSeparator);
+ return d->orientation;
+}
+
+void QQuickToolSeparator::setOrientation(Qt::Orientation orientation)
+{
+ Q_D(QQuickToolSeparator);
+ if (d->orientation == orientation)
+ return;
+
+ d->orientation = orientation;
+ emit orientationChanged();
+}
+
+/*!
+ \readonly
+ \qmlproperty bool QtQuick.Controls::ToolSeparator::horizontal
+
+ This property holds whether \l orientation is equal to \c Qt.Horizontal.
+
+ It is useful for \l {Customizing ToolSeparator}{customizing ToolSeparator}.
+
+ \sa orientation, vertical
+*/
+bool QQuickToolSeparator::isHorizontal() const
+{
+ Q_D(const QQuickToolSeparator);
+ return d->orientation == Qt::Horizontal;
+}
+
+/*!
+ \readonly
+ \qmlproperty bool QtQuick.Controls::ToolSeparator::vertical
+
+ This property holds whether \l orientation is equal to \c Qt.Vertical.
+
+ It is useful for \l {Customizing ToolSeparator}{customizing ToolSeparator}.
+
+ \sa orientation, horizontal
+*/
+bool QQuickToolSeparator::isVertical() const
+{
+ Q_D(const QQuickToolSeparator);
+ return d->orientation == Qt::Vertical;
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickToolSeparator::accessibleRole() const
+{
+ return QAccessible::Separator;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktoolseparator_p.h b/src/quicktemplates2/qquicktoolseparator_p.h
new file mode 100644
index 00000000..c3376c22
--- /dev/null
+++ b/src/quicktemplates2/qquicktoolseparator_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 QQUICKTOOLSEPARATOR_P_H
+#define QQUICKTOOLSEPARATOR_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 QQuickToolSeparatorPrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolSeparator : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL)
+ Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL)
+
+public:
+ explicit QQuickToolSeparator(QQuickItem *parent = nullptr);
+
+ Qt::Orientation orientation() const;
+ void setOrientation(Qt::Orientation orientation);
+
+ bool isHorizontal() const;
+ bool isVertical() const;
+
+Q_SIGNALS:
+ void orientationChanged();
+
+protected:
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickToolSeparator)
+ Q_DECLARE_PRIVATE(QQuickToolSeparator)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickToolSeparator)
+
+#endif // QQUICKTOOLSEPARATOR_P_H
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 3bd47457..b60dec22 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -345,7 +345,7 @@ QQuickToolTip *QQuickToolTipAttachedPrivate::instance(bool create) const
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());
+ component.setData("import QtQuick.Controls 2.1; ToolTip { }", QUrl());
QObject *object = component.create();
if (object)
diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h
index 9b628747..3be9214b 100644
--- a/src/quicktemplates2/qquicktooltip_p.h
+++ b/src/quicktemplates2/qquicktooltip_p.h
@@ -110,7 +110,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolTipAttached : public QObject
Q_PROPERTY(QQuickToolTip *toolTip READ toolTip CONSTANT FINAL)
public:
- explicit QQuickToolTipAttached(QObject *parent);
+ explicit QQuickToolTipAttached(QObject *parent = nullptr);
QString text() const;
void setText(const QString &text);
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 9f19f661..cf5df27a 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -36,8 +36,10 @@
#include "qquicktumbler_p.h"
+#include <QtQml/qqmlinfo.h>
#include <QtQuick/private/qquickflickable_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+#include <QtQuickTemplates2/private/qquicktumbler_p_p.h>
QT_BEGIN_NAMESPACE
@@ -59,51 +61,48 @@ QT_BEGIN_NAMESPACE
}
\endcode
- \section1 Non-wrapping Tumbler
+ Tumbler allows the user to select an option from a spinnable \e "wheel" of
+ items. It is useful for when there are too many options to use, for
+ example, a RadioButton, and too few options to require the use of an
+ editable SpinBox. It is convenient in that it requires no keyboard usage
+ and wraps around at each end when there are a large number of items.
- 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:
+ The API is similar to that of views like \l ListView and \l PathView; a
+ \l model and \l delegate can be set, and the \l count and \l currentItem
+ properties provide read-only access to information about the view.
- \snippet tst_tumbler.qml contentItem
+ Unlike views like \l PathView and \l ListView, however, there is always a
+ current item (when the model isn't empty). This means that when \l count is
+ equal to \c 0, \l currentIndex will be \c -1. In all other cases, it will
+ be greater than or equal to \c 0.
+
+ By default, Tumbler \l {wrap}{wraps} when it reaches the top and bottom, as
+ long as there are more items in the model than there are visible items;
+ that is, when \l count is greater than \l visibleItemCount:
+
+ \snippet qtquickcontrols2-tumbler-timePicker.qml tumbler
\sa {Customizing Tumbler}, {Input Controls}
*/
-class QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+QQuickTumblerPrivate::QQuickTumblerPrivate() :
+ delegate(nullptr),
+ visibleItemCount(5),
+ wrap(true),
+ explicitWrap(false),
+ ignoreWrapChanges(false),
+ view(nullptr),
+ viewContentItem(nullptr),
+ viewContentItemType(UnsupportedContentItemType),
+ currentIndex(-1),
+ pendingCurrentIndex(-1),
+ ignoreCurrentIndexChanges(false),
+ count(0)
{
- 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)
+QQuickTumblerPrivate::~QQuickTumblerPrivate()
{
- 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 {
@@ -111,44 +110,55 @@ namespace {
{
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;
+/*
+ Finds the contentItem of the view that is a child of the control's \a contentItem.
+ The type is stored in \a type.
+*/
+QQuickItem *QQuickTumblerPrivate::determineViewType(QQuickItem *contentItem)
+{
+ if (contentItem->inherits("QQuickPathView")) {
+ view = contentItem;
+ viewContentItem = contentItem;
+ viewContentItemType = PathViewContentItem;
+ return contentItem;
+ } else if (contentItem->inherits("QQuickListView")) {
+ view = contentItem;
+ viewContentItem = qobject_cast<QQuickFlickable*>(contentItem)->contentItem();
+ viewContentItemType = ListViewContentItem;
+ return contentItem;
+ } else {
+ const auto childItems = contentItem->childItems();
+ for (QQuickItem *childItem : childItems) {
+ QQuickItem *item = determineViewType(childItem);
+ if (item)
+ return item;
+ }
}
- static inline ContentItemType contentItemType(QQuickItem *rootContentItem)
- {
- if (rootContentItem->inherits("QQuickPathView"))
- return PathViewContentItem;
- else if (rootContentItem->inherits("QQuickListView"))
- return ListViewContentItem;
+ resetViewData();
+ return nullptr;
+}
- return UnsupportedContentItemType;
- }
+void QQuickTumblerPrivate::resetViewData()
+{
+ view = nullptr;
+ viewContentItem = nullptr;
+ viewContentItemType = 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;
- }
+QList<QQuickItem *> QQuickTumblerPrivate::viewContentItemChildItems() const
+{
+ if (!viewContentItem)
+ return QList<QQuickItem *>();
- return UnsupportedContentItemType;
- }
+ return viewContentItem->childItems();
+}
+
+QQuickTumblerPrivate *QQuickTumblerPrivate::get(QQuickTumbler *tumbler)
+{
+ return tumbler->d_func();
}
void QQuickTumblerPrivate::_q_updateItemHeights()
@@ -157,7 +167,7 @@ void QQuickTumblerPrivate::_q_updateItemHeights()
// which doesn't affect them, only their getters.
Q_Q(const QQuickTumbler);
const qreal itemHeight = delegateHeight(q);
- const auto items = contentItemChildItems(contentItem);
+ const auto items = viewContentItemChildItems();
for (QQuickItem *childItem : items)
childItem->setHeight(itemHeight);
}
@@ -166,11 +176,49 @@ void QQuickTumblerPrivate::_q_updateItemWidths()
{
Q_Q(const QQuickTumbler);
const qreal availableWidth = q->availableWidth();
- const auto items = contentItemChildItems(contentItem);
+ const auto items = viewContentItemChildItems();
for (QQuickItem *childItem : items)
childItem->setWidth(availableWidth);
}
+void QQuickTumblerPrivate::_q_onViewCurrentIndexChanged()
+{
+ Q_Q(QQuickTumbler);
+ if (view && !ignoreCurrentIndexChanges) {
+ const int oldCurrentIndex = currentIndex;
+ currentIndex = view->property("currentIndex").toInt();
+ if (oldCurrentIndex != currentIndex)
+ emit q->currentIndexChanged();
+ }
+}
+
+void QQuickTumblerPrivate::_q_onViewCountChanged()
+{
+ Q_Q(QQuickTumbler);
+
+ setCount(view->property("count").toInt());
+
+ if (count > 0) {
+ if (pendingCurrentIndex != -1) {
+ // If there was an attempt to set currentIndex at creation, try to finish that attempt now.
+ // componentComplete() is too early, because the count might only be known sometime after completion.
+ q->setCurrentIndex(pendingCurrentIndex);
+ // If we could successfully set the currentIndex, consider it done.
+ // Otherwise, we'll try again later in updatePolish().
+ if (currentIndex == pendingCurrentIndex)
+ pendingCurrentIndex = -1;
+ else
+ q->polish();
+ } else if (currentIndex == -1) {
+ // If new items were added and our currentIndex was -1, we must
+ // enforce our rule of a non-negative currentIndex when count > 0.
+ q->setCurrentIndex(0);
+ }
+ } else {
+ q->setCurrentIndex(-1);
+ }
+}
+
void QQuickTumblerPrivate::itemChildAdded(QQuickItem *, QQuickItem *)
{
_q_updateItemWidths();
@@ -196,6 +244,9 @@ QQuickTumbler::QQuickTumbler(QQuickItem *parent) :
QQuickTumbler::~QQuickTumbler()
{
+ Q_D(QQuickTumbler);
+ // Ensure that the item change listener is removed.
+ d->disconnectFromView();
}
/*!
@@ -215,8 +266,17 @@ void QQuickTumbler::setModel(const QVariant &model)
if (model == d->model)
return;
+ d->lockWrap();
+
d->model = model;
emit modelChanged();
+
+ d->unlockWrap();
+
+ // Don't try to correct the currentIndex if count() isn't known yet.
+ // We can check in setupViewData() instead.
+ if (isComponentComplete() && d->view && count() == 0)
+ setCurrentIndex(-1);
}
/*!
@@ -228,24 +288,67 @@ void QQuickTumbler::setModel(const QVariant &model)
int QQuickTumbler::count() const
{
Q_D(const QQuickTumbler);
- return d->contentItem->property("count").toInt();
+ return d->count;
}
/*!
\qmlproperty int QtQuick.Controls::Tumbler::currentIndex
This property holds the index of the current item.
+
+ The value of this property is \c -1 when \l count is equal to \c 0. In all
+ other cases, it will be greater than or equal to \c 0.
*/
int QQuickTumbler::currentIndex() const
{
Q_D(const QQuickTumbler);
- return d->contentItem ? d->contentItem->property("currentIndex").toInt() : -1;
+ return d->currentIndex;
}
void QQuickTumbler::setCurrentIndex(int currentIndex)
{
Q_D(QQuickTumbler);
- d->contentItem->setProperty("currentIndex", currentIndex);
+ if (currentIndex == d->currentIndex || currentIndex < -1)
+ return;
+
+ if (!isComponentComplete()) {
+ // Views can't set currentIndex until they're ready.
+ d->pendingCurrentIndex = currentIndex;
+ return;
+ }
+
+ // -1 doesn't make sense for a non-empty Tumbler, because unlike
+ // e.g. ListView, there's always one item selected.
+ // Wait until the component has finished before enforcing this rule, though,
+ // because the count might not be known yet.
+ if ((d->count > 0 && currentIndex == -1) || (currentIndex >= d->count)) {
+ return;
+ }
+
+ // The view might not have been created yet, as is the case
+ // if you create a Tumbler component and pass e.g. { currentIndex: 2 }
+ // to createObject().
+ if (d->view) {
+ // Only actually set our currentIndex if the view was able to set theirs.
+ bool couldSet = false;
+ if (d->count == 0 && currentIndex == -1) {
+ // PathView insists on using 0 as the currentIndex when there are no items.
+ couldSet = true;
+ } else {
+ d->ignoreCurrentIndexChanges = true;
+ d->view->setProperty("currentIndex", currentIndex);
+ d->ignoreCurrentIndexChanges = false;
+
+ couldSet = d->view->property("currentIndex").toInt() == currentIndex;
+ }
+
+ if (couldSet) {
+ // The view's currentIndex might not have actually changed, but ours has,
+ // and that's what user code sees.
+ d->currentIndex = currentIndex;
+ emit currentIndexChanged();
+ }
+ }
}
/*!
@@ -257,7 +360,7 @@ void QQuickTumbler::setCurrentIndex(int currentIndex)
QQuickItem *QQuickTumbler::currentItem() const
{
Q_D(const QQuickTumbler);
- return d->contentItem ? d->contentItem->property("currentItem").value<QQuickItem*>() : nullptr;
+ return d->view ? d->view->property("currentItem").value<QQuickItem*>() : nullptr;
}
/*!
@@ -304,15 +407,41 @@ void QQuickTumbler::setVisibleItemCount(int visibleItemCount)
emit visibleItemCountChanged();
}
-QQuickTumblerAttached *QQuickTumbler::qmlAttachedProperties(QObject *object)
+/*!
+ \qmlproperty bool QtQuick.Controls::Tumbler::wrap
+ \since QtQuick.Controls 2.1
+
+ This property determines whether or not the tumbler wraps around when it
+ reaches the top or bottom.
+
+ The default value is \c false when \l count is less than
+ \l visibleItemCount, as it is simpler to interact with a non-wrapping Tumbler
+ when there are only a few items. To override this behavior, explicitly set
+ the value of this property. To return to the default behavior, set this
+ property to \c undefined.
+*/
+bool QQuickTumbler::wrap() const
{
- QQuickItem *delegateItem = qobject_cast<QQuickItem *>(object);
- if (!delegateItem) {
- qWarning() << "Tumbler: attached properties of Tumbler must be accessed from within a delegate item";
- return nullptr;
- }
+ Q_D(const QQuickTumbler);
+ return d->wrap;
+}
+
+void QQuickTumbler::setWrap(bool wrap)
+{
+ Q_D(QQuickTumbler);
+ d->setWrap(wrap, true);
+}
- return new QQuickTumblerAttached(delegateItem);
+void QQuickTumbler::resetWrap()
+{
+ Q_D(QQuickTumbler);
+ d->explicitWrap = false;
+ d->setWrapBasedOnCount();
+}
+
+QQuickTumblerAttached *QQuickTumbler::qmlAttachedProperties(QObject *object)
+{
+ return new QQuickTumblerAttached(object);
}
void QQuickTumbler::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
@@ -333,6 +462,13 @@ void QQuickTumbler::componentComplete()
QQuickControl::componentComplete();
d->_q_updateItemHeights();
d->_q_updateItemWidths();
+
+ if (!d->view) {
+ // Force the view to be created.
+ emit wrapChanged();
+ // Determine the type of view for attached properties, etc.
+ d->setupViewData(d->contentItem);
+ }
}
void QQuickTumbler::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
@@ -341,59 +477,189 @@ void QQuickTumbler::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
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 (oldItem)
+ d->disconnectFromView();
if (newItem) {
- ContentItemType contentType = contentItemType(newItem);
- if (contentType == UnsupportedContentItemType) {
- qWarning() << "Tumbler: contentItems other than PathView and ListView are not supported";
- return;
+ // We wait until wrap is set to that we know which type of view to create.
+ // If we try to set up the view too early, we'll issue warnings about it not existing.
+ if (isComponentComplete()) {
+ // Make sure we use the new content item and not the current one, as that won't
+ // be changed until after contentItemChange() has finished.
+ d->setupViewData(newItem);
}
+ }
+}
+
+void QQuickTumblerPrivate::disconnectFromView()
+{
+ Q_Q(QQuickTumbler);
+ if (!view) {
+ // If a custom content item is declared, it can happen that
+ // the original contentItem exists without the view etc. having been
+ // determined yet, and then this is called when the custom content item
+ // is eventually set.
+ return;
+ }
- connect(newItem, SIGNAL(currentIndexChanged()), this, SIGNAL(currentIndexChanged()));
- connect(newItem, SIGNAL(currentItemChanged()), this, SIGNAL(currentItemChanged()));
- connect(newItem, SIGNAL(countChanged()), this, SIGNAL(countChanged()));
+ QObject::disconnect(view, SIGNAL(currentIndexChanged()), q, SLOT(_q_onViewCurrentIndexChanged()));
+ QObject::disconnect(view, SIGNAL(currentItemChanged()), q, SIGNAL(currentItemChanged()));
+ QObject::disconnect(view, SIGNAL(countChanged()), q, SLOT(_q_onViewCountChanged()));
- QQuickItem *actualNewContentItem = actualContentItem(newItem, contentType);
- QQuickItemPrivate *actualContentItemPrivate = QQuickItemPrivate::get(actualNewContentItem);
- actualContentItemPrivate->addItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItemPrivate *oldViewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
+ oldViewContentItemPrivate->removeItemChangeListener(this, 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);
- }
+ resetViewData();
+}
+
+void QQuickTumblerPrivate::setupViewData(QQuickItem *newControlContentItem)
+{
+ // Don't do anything if we've already set up.
+ if (view)
+ return;
+
+ determineViewType(newControlContentItem);
+
+ if (viewContentItemType == QQuickTumblerPrivate::UnsupportedContentItemType) {
+ qWarning() << "Tumbler: contentItem must contain either a PathView or a ListView";
+ return;
}
+
+ Q_Q(QQuickTumbler);
+ QObject::connect(view, SIGNAL(currentIndexChanged()), q, SLOT(_q_onViewCurrentIndexChanged()));
+ QObject::connect(view, SIGNAL(currentItemChanged()), q, SIGNAL(currentItemChanged()));
+ QObject::connect(view, SIGNAL(countChanged()), q, SLOT(_q_onViewCountChanged()));
+
+ QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(viewContentItem);
+ viewContentItemPrivate->addItemChangeListener(this, QQuickItemPrivate::Children);
+
+ // Sync the view's currentIndex with ours.
+ syncCurrentIndex();
}
-void QQuickTumbler::keyPressEvent(QKeyEvent *event)
+void QQuickTumblerPrivate::syncCurrentIndex()
{
- Q_D(QQuickTumbler);
+ const int actualViewIndex = view->property("currentIndex").toInt();
+ Q_Q(QQuickTumbler);
+
+ // Nothing to do.
+ if (actualViewIndex == currentIndex)
+ return;
+ // PathView likes to use 0 as currentIndex for empty models, but we use -1 for that.
+ if (q->count() == 0 && actualViewIndex == 0)
+ return;
+
+ ignoreCurrentIndexChanges = true;
+ view->setProperty("currentIndex", currentIndex);
+ ignoreCurrentIndexChanges = false;
+}
+
+void QQuickTumblerPrivate::setCount(int newCount)
+{
+ if (newCount == count)
+ return;
+
+ count = newCount;
+
+ Q_Q(QQuickTumbler);
+ setWrapBasedOnCount();
+
+ emit q->countChanged();
+}
+
+void QQuickTumblerPrivate::setWrapBasedOnCount()
+{
+ if (count == 0 || explicitWrap || ignoreWrapChanges)
+ return;
+
+ setWrap(count >= visibleItemCount, false);
+}
+
+void QQuickTumblerPrivate::setWrap(bool shouldWrap, bool isExplicit)
+{
+ if (isExplicit)
+ explicitWrap = true;
+
+ Q_Q(QQuickTumbler);
+ if (q->isComponentComplete() && shouldWrap == wrap)
+ return;
+
+ // 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 view changes.
+ const int oldCurrentIndex = currentIndex;
+
+ disconnectFromView();
+
+ wrap = shouldWrap;
+
+ // New views will set their currentIndex upon creation, which we'd otherwise
+ // take as the correct one, so we must ignore them.
+ ignoreCurrentIndexChanges = true;
+
+ // This will cause the view to be created if our contentItem is a TumblerView.
+ emit q->wrapChanged();
+
+ ignoreCurrentIndexChanges = false;
+
+ // The view should have been created now, so we can start determining its type, etc.
+ // If the delegates use attached properties, this will have already been called,
+ // in which case it will return early. If the delegate doesn't use attached properties,
+ // we need to call it here.
+ setupViewData(contentItem);
+
+ q->setCurrentIndex(oldCurrentIndex);
+}
+
+void QQuickTumblerPrivate::lockWrap()
+{
+ ignoreWrapChanges = true;
+}
+
+void QQuickTumblerPrivate::unlockWrap()
+{
+ ignoreWrapChanges = false;
+ setWrapBasedOnCount();
+}
+
+void QQuickTumbler::keyPressEvent(QKeyEvent *event)
+{
QQuickControl::keyPressEvent(event);
- if (event->isAutoRepeat())
+ Q_D(QQuickTumbler);
+ if (event->isAutoRepeat() || !d->view)
return;
if (event->key() == Qt::Key_Up) {
- QMetaObject::invokeMethod(d->contentItem, "decrementCurrentIndex");
+ QMetaObject::invokeMethod(d->view, "decrementCurrentIndex");
} else if (event->key() == Qt::Key_Down) {
- QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex");
+ QMetaObject::invokeMethod(d->view, "incrementCurrentIndex");
+ }
+}
+
+void QQuickTumbler::updatePolish()
+{
+ Q_D(QQuickTumbler);
+ if (d->pendingCurrentIndex != -1) {
+ // If the count is still 0, it's not going to happen.
+ if (d->count == 0) {
+ d->pendingCurrentIndex = -1;
+ return;
+ }
+
+ // If there is a pending currentIndex at this stage, it means that
+ // the view wouldn't set our currentIndex in _q_onViewCountChanged
+ // because it wasn't ready. Try one last time here.
+ setCurrentIndex(d->pendingCurrentIndex);
+
+ if (d->currentIndex != d->pendingCurrentIndex && d->currentIndex == -1) {
+ // If we *still* couldn't set it, it's probably invalid.
+ // See if we can at least enforce our rule of "non-negative currentIndex when count > 0" instead.
+ setCurrentIndex(0);
+ }
+
+ d->pendingCurrentIndex = -1;
}
}
@@ -401,13 +667,17 @@ class QQuickTumblerAttachedPrivate : public QObjectPrivate, public QQuickItemCha
{
Q_DECLARE_PUBLIC(QQuickTumblerAttached)
public:
- QQuickTumblerAttachedPrivate(QQuickItem *delegateItem) :
+ QQuickTumblerAttachedPrivate() :
tumbler(nullptr),
index(-1),
displacement(0)
{
+ }
+
+ void init(QQuickItem *delegateItem)
+ {
if (!delegateItem->parentItem()) {
- qWarning() << "Tumbler: attached properties must be accessed from within a delegate item that has a parent";
+ qWarning() << "Tumbler: attached properties must be accessed through a delegate item that has a parent";
return;
}
@@ -418,20 +688,15 @@ public:
}
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() {
+ QQuickItem *parentItem = delegateItem;
+ while ((parentItem = parentItem->parentItem())) {
+ if ((tumbler = qobject_cast<QQuickTumbler*>(parentItem)))
+ break;
+ }
}
- void itemGeometryChanged(QQuickItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
void itemChildAdded(QQuickItem *, QQuickItem *) override;
void itemChildRemoved(QQuickItem *, QQuickItem *) override;
@@ -446,7 +711,7 @@ public:
qreal displacement;
};
-void QQuickTumblerAttachedPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+void QQuickTumblerAttachedPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
{
_q_calculateDisplacement();
}
@@ -477,41 +742,43 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
const int previousDisplacement = displacement;
displacement = 0;
+ // Can happen if the attached properties are accessed on the wrong type of item or the tumbler was destroyed.
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) {
+ // Can happen if there is no ListView or PathView within the contentItem.
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(tumbler);
+ if (!tumblerPrivate->viewContentItem) {
emitIfDisplacementChanged(previousDisplacement, displacement);
return;
}
- ContentItemType contentType = contentItemType(tumbler->contentItem());
- if (contentType == UnsupportedContentItemType) {
+ // The attached property gets created before our count is updated, so just cheat here
+ // to avoid having to listen to count changes.
+ const int count = tumblerPrivate->view->property("count").toInt();
+ // This can happen in tests, so it may happen in normal usage too.
+ if (count == 0) {
emitIfDisplacementChanged(previousDisplacement, displacement);
return;
}
- qreal offset = 0;
-
- if (contentType == PathViewContentItem) {
- offset = tumbler->contentItem()->property("offset").toReal();
+ if (tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem) {
+ const qreal offset = tumblerPrivate->view->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);
+ const 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 contentY = tumblerPrivate->view->property("contentY").toReal();
const qreal delegateH = delegateHeight(tumbler);
- const qreal preferredHighlightBegin = tumbler->contentItem()->property("preferredHighlightBegin").toReal();
+ const qreal preferredHighlightBegin = tumblerPrivate->view->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;
@@ -527,19 +794,34 @@ void QQuickTumblerAttachedPrivate::emitIfDisplacementChanged(qreal oldDisplaceme
emit q->displacementChanged();
}
-QQuickTumblerAttached::QQuickTumblerAttached(QQuickItem *delegateItem) :
- QObject(*(new QQuickTumblerAttachedPrivate(delegateItem)), delegateItem)
+QQuickTumblerAttached::QQuickTumblerAttached(QObject *parent) :
+ QObject(*(new QQuickTumblerAttachedPrivate), parent)
{
Q_D(QQuickTumblerAttached);
+ QQuickItem *delegateItem = qobject_cast<QQuickItem *>(parent);
+ if (delegateItem)
+ d->init(delegateItem);
+ else if (parent)
+ qmlInfo(parent) << "Tumbler: attached properties of Tumbler must be accessed through a delegate item";
+
if (d->tumbler) {
- QQuickItem *rootContentItem = d->tumbler->contentItem();
- const ContentItemType contentType = contentItemType(rootContentItem);
- QQuickItemPrivate *p = QQuickItemPrivate::get(actualContentItem(rootContentItem, contentType));
+ // When the Tumbler is completed, wrapChanged() is emitted to let QQuickTumblerView
+ // know that it can create the view. The view itself might instantiate delegates
+ // that use attached properties. At this point, setupViewData() hasn't been called yet
+ // (it's called on the next line in componentComplete()), so we call it here so that
+ // we have access to the view.
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
+ tumblerPrivate->setupViewData(tumblerPrivate->contentItem);
+
+ if (!tumblerPrivate->viewContentItem)
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
p->addItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
- const char *contentItemSignal = contentType == PathViewContentItem
+ const char *contentItemSignal = tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem
? SIGNAL(offsetChanged()) : SIGNAL(contentYChanged());
- connect(d->tumbler->contentItem(), contentItemSignal, this, SLOT(_q_calculateDisplacement()));
+ connect(tumblerPrivate->view, contentItemSignal, this, SLOT(_q_calculateDisplacement()));
d->_q_calculateDisplacement();
}
@@ -548,17 +830,15 @@ QQuickTumblerAttached::QQuickTumblerAttached(QQuickItem *delegateItem) :
QQuickTumblerAttached::~QQuickTumblerAttached()
{
Q_D(QQuickTumblerAttached);
- if (!d->tumbler || !d->tumbler->contentItem())
+ if (!d->tumbler)
return;
- QQuickItem *rootContentItem = d->tumbler->contentItem();
- const ContentItemType contentType = contentItemType(rootContentItem);
- QQuickItem *actualItem = actualContentItem(rootContentItem, contentType);
- if (!actualItem)
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
+ if (!tumblerPrivate->viewContentItem)
return;
- QQuickItemPrivate *p = QQuickItemPrivate::get(actualItem);
- p->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
+ QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
+ viewContentItemPrivate->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
}
/*!
diff --git a/src/quicktemplates2/qquicktumbler_p.h b/src/quicktemplates2/qquicktumbler_p.h
index e28102e4..1c8cfa18 100644
--- a/src/quicktemplates2/qquicktumbler_p.h
+++ b/src/quicktemplates2/qquicktumbler_p.h
@@ -66,6 +66,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumbler : public QQuickControl
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)
+ Q_PROPERTY(bool wrap READ wrap WRITE setWrap RESET resetWrap NOTIFY wrapChanged FINAL REVISION 1)
public:
explicit QQuickTumbler(QQuickItem *parent = nullptr);
@@ -86,6 +87,10 @@ public:
int visibleItemCount() const;
void setVisibleItemCount(int visibleItemCount);
+ bool wrap() const;
+ void setWrap(bool wrap);
+ void resetWrap();
+
static QQuickTumblerAttached *qmlAttachedProperties(QObject *object);
Q_SIGNALS:
@@ -95,12 +100,14 @@ Q_SIGNALS:
void currentItemChanged();
void delegateChanged();
void visibleItemCountChanged();
+ Q_REVISION(1) void wrapChanged();
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;
+ void updatePolish() override;
private:
Q_DISABLE_COPY(QQuickTumbler)
@@ -108,6 +115,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_updateItemWidths())
Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
+ Q_PRIVATE_SLOT(d_func(), void _q_onViewCurrentIndexChanged())
+ Q_PRIVATE_SLOT(d_func(), void _q_onViewCountChanged())
};
class QQuickTumblerAttachedPrivate;
@@ -119,7 +128,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerAttached : public QObject
Q_PROPERTY(qreal displacement READ displacement NOTIFY displacementChanged FINAL)
public:
- explicit QQuickTumblerAttached(QQuickItem *delegateItem);
+ explicit QQuickTumblerAttached(QObject *parent = nullptr);
~QQuickTumblerAttached();
QQuickTumbler *tumbler() const;
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h
new file mode 100644
index 00000000..daced3a3
--- /dev/null
+++ b/src/quicktemplates2/qquicktumbler_p_p.h
@@ -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$
+**
+****************************************************************************/
+
+#ifndef QQUICKTUMBLER_P_P_H
+#define QQUICKTUMBLER_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/qquickitemchangelistener_p.h>
+#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickTumbler;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QQuickTumbler)
+
+public:
+ QQuickTumblerPrivate();
+ ~QQuickTumblerPrivate();
+
+ enum ContentItemType {
+ UnsupportedContentItemType,
+ PathViewContentItem,
+ ListViewContentItem
+ };
+
+ QQuickItem *determineViewType(QQuickItem *contentItem);
+ void resetViewData();
+ QList<QQuickItem *> viewContentItemChildItems() const;
+
+ static QQuickTumblerPrivate *get(QQuickTumbler *tumbler);
+
+ QVariant model;
+ QQmlComponent *delegate;
+ int visibleItemCount;
+ bool wrap;
+ bool explicitWrap;
+ bool ignoreWrapChanges;
+ QQuickItem *view;
+ QQuickItem *viewContentItem;
+ ContentItemType viewContentItemType;
+ int currentIndex;
+ int pendingCurrentIndex;
+ bool ignoreCurrentIndexChanges;
+ int count;
+
+ void _q_updateItemHeights();
+ void _q_updateItemWidths();
+ void _q_onViewCurrentIndexChanged();
+ void _q_onViewCountChanged();
+
+ void disconnectFromView();
+ void setupViewData(QQuickItem *newControlContentItem);
+ void syncCurrentIndex();
+
+ void setCount(int newCount);
+ void setWrapBasedOnCount();
+ void setWrap(bool shouldWrap, bool isExplicit);
+ void lockWrap();
+ void unlockWrap();
+
+ void itemChildAdded(QQuickItem *, QQuickItem *) override;
+ void itemChildRemoved(QQuickItem *, QQuickItem *) override;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKTUMBLER_P_P_H
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index 5877b3d0..939d2f0e 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -6,6 +6,7 @@ HEADERS += \
$$PWD/qquickapplicationwindow_p.h \
$$PWD/qquickbusyindicator_p.h \
$$PWD/qquickbutton_p.h \
+ $$PWD/qquickbutton_p_p.h \
$$PWD/qquickbuttongroup_p.h \
$$PWD/qquickcheckbox_p.h \
$$PWD/qquickcheckdelegate_p.h \
@@ -15,6 +16,10 @@ HEADERS += \
$$PWD/qquickcontrol_p.h \
$$PWD/qquickcontrol_p_p.h \
$$PWD/qquickdial_p.h \
+ $$PWD/qquickdialog_p.h \
+ $$PWD/qquickdialog_p_p.h \
+ $$PWD/qquickdialogbuttonbox_p.h \
+ $$PWD/qquickdialogbuttonbox_p_p.h \
$$PWD/qquickdrawer_p.h \
$$PWD/qquickdrawer_p_p.h \
$$PWD/qquickframe_p.h \
@@ -27,10 +32,12 @@ HEADERS += \
$$PWD/qquickmenu_p.h \
$$PWD/qquickmenu_p_p.h \
$$PWD/qquickmenuitem_p.h \
+ $$PWD/qquickmenuseparator_p.h \
$$PWD/qquickoverlay_p.h \
$$PWD/qquickoverlay_p_p.h \
$$PWD/qquickpage_p.h \
$$PWD/qquickpageindicator_p.h \
+ $$PWD/qquickpagelayout_p_p.h \
$$PWD/qquickpane_p.h \
$$PWD/qquickpane_p_p.h \
$$PWD/qquickpopup_p.h \
@@ -40,6 +47,7 @@ HEADERS += \
$$PWD/qquickradiobutton_p.h \
$$PWD/qquickradiodelegate_p.h \
$$PWD/qquickrangeslider_p.h \
+ $$PWD/qquickroundbutton_p.h \
$$PWD/qquickscrollbar_p.h \
$$PWD/qquickscrollindicator_p.h \
$$PWD/qquickshortcutcontext_p_p.h \
@@ -59,8 +67,10 @@ HEADERS += \
$$PWD/qquicktextfield_p_p.h \
$$PWD/qquicktoolbar_p.h \
$$PWD/qquicktoolbutton_p.h \
+ $$PWD/qquicktoolseparator_p.h \
$$PWD/qquicktooltip_p.h \
$$PWD/qquicktumbler_p.h \
+ $$PWD/qquicktumbler_p_p.h \
$$PWD/qquickvelocitycalculator_p_p.h
SOURCES += \
@@ -75,6 +85,8 @@ SOURCES += \
$$PWD/qquickcontainer.cpp \
$$PWD/qquickcontrol.cpp \
$$PWD/qquickdial.cpp \
+ $$PWD/qquickdialog.cpp \
+ $$PWD/qquickdialogbuttonbox.cpp \
$$PWD/qquickdrawer.cpp \
$$PWD/qquickframe.cpp \
$$PWD/qquickgroupbox.cpp \
@@ -82,9 +94,11 @@ SOURCES += \
$$PWD/qquicklabel.cpp \
$$PWD/qquickmenu.cpp \
$$PWD/qquickmenuitem.cpp \
+ $$PWD/qquickmenuseparator.cpp \
$$PWD/qquickoverlay.cpp \
$$PWD/qquickpage.cpp \
$$PWD/qquickpageindicator.cpp \
+ $$PWD/qquickpagelayout.cpp \
$$PWD/qquickpane.cpp \
$$PWD/qquickpopup.cpp \
$$PWD/qquickpresshandler.cpp \
@@ -92,6 +106,7 @@ SOURCES += \
$$PWD/qquickradiobutton.cpp \
$$PWD/qquickradiodelegate.cpp \
$$PWD/qquickrangeslider.cpp \
+ $$PWD/qquickroundbutton.cpp \
$$PWD/qquickscrollbar.cpp \
$$PWD/qquickscrollindicator.cpp \
$$PWD/qquickshortcutcontext.cpp \
@@ -109,6 +124,7 @@ SOURCES += \
$$PWD/qquicktextfield.cpp \
$$PWD/qquicktoolbar.cpp \
$$PWD/qquicktoolbutton.cpp \
+ $$PWD/qquicktoolseparator.cpp \
$$PWD/qquicktooltip.cpp \
$$PWD/qquicktumbler.cpp \
$$PWD/qquickvelocitycalculator.cpp