aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc38
-rw-r--r--examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml8
-rw-r--r--examples/quickcontrols2/gallery/pages/ButtonPage.qml65
-rw-r--r--examples/quickcontrols2/gallery/pages/CheckBoxPage.qml57
-rw-r--r--examples/quickcontrols2/gallery/pages/ComboBoxPage.qml6
-rw-r--r--examples/quickcontrols2/gallery/pages/DialPage.qml4
-rw-r--r--examples/quickcontrols2/gallery/pages/FramePage.qml10
-rw-r--r--examples/quickcontrols2/gallery/pages/GroupBoxPage.qml10
-rw-r--r--examples/quickcontrols2/gallery/pages/MenuPage.qml8
-rw-r--r--examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml6
-rw-r--r--examples/quickcontrols2/gallery/pages/PopupPage.qml8
-rw-r--r--examples/quickcontrols2/gallery/pages/ProgressBarPage.qml8
-rw-r--r--examples/quickcontrols2/gallery/pages/RadioButtonPage.qml55
-rw-r--r--examples/quickcontrols2/gallery/pages/RangeSliderPage.qml8
-rw-r--r--examples/quickcontrols2/gallery/pages/ScrollablePage.qml61
-rw-r--r--examples/quickcontrols2/gallery/pages/SliderPage.qml8
-rw-r--r--examples/quickcontrols2/gallery/pages/SpinBoxPage.qml6
-rw-r--r--examples/quickcontrols2/gallery/pages/SwitchPage.qml55
-rw-r--r--examples/quickcontrols2/gallery/pages/TextAreaPage.qml38
-rw-r--r--examples/quickcontrols2/gallery/pages/TextFieldPage.qml6
-rw-r--r--examples/quickcontrols2/gallery/pages/ToolTipPage.qml4
-rw-r--r--examples/quickcontrols2/gallery/pages/TumblerPage.qml4
-rw-r--r--src/imports/controls/AbstractButton.qml48
-rw-r--r--src/imports/controls/ComboBox.qml5
-rw-r--r--src/imports/controls/TabButton.qml4
-rw-r--r--src/imports/controls/controls.pri1
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-custom.pngbin1294 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-disabled.pngbin1569 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-flat.gifbin0 -> 2388 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gifbin0 -> 1856 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button.gifbin2171 -> 1863 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-button.pngbin1518 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.pngbin1905 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.pngbin1529 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.pngbin1628 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.pngbin1339 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gifbin0 -> 4033 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox.gifbin0 -> 2864 bytes
-rw-r--r--src/imports/controls/doc/qtquickcontrols2.qdocconf3
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-label.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml52
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml)0
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml (renamed from src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml)0
-rw-r--r--src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc10
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc22
-rw-r--r--src/imports/controls/material/ComboBox.qml6
-rw-r--r--src/imports/controls/material/TabButton.qml4
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp6
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp14
-rw-r--r--src/imports/controls/universal/ComboBox.qml6
-rw-r--r--src/quickcontrols2/qquickstyleattached.cpp7
-rw-r--r--src/quicktemplates2/qquickbutton.cpp15
-rw-r--r--src/quicktemplates2/qquickcheckbox.cpp17
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp15
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp9
-rw-r--r--src/quicktemplates2/qquickcontainer_p_p.h1
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp2
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp2
-rw-r--r--src/quicktemplates2/qquickpopup.cpp126
-rw-r--r--src/quicktemplates2/qquickpopup_p.h2
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h3
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp4
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp10
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp36
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp37
-rw-r--r--src/quicktemplates2/qquicktooltip_p.h6
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp30
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml36
-rw-r--r--tests/auto/controls/data/tst_combobox.qml63
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml32
-rw-r--r--tests/auto/controls/data/tst_tabbar.qml32
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml76
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml137
-rw-r--r--tests/auto/focus/data/visualFocus.qml54
-rw-r--r--tests/auto/focus/tst_focus.cpp31
-rw-r--r--tests/auto/popup/data/activeFocusOnClose3.qml68
-rw-r--r--tests/auto/popup/tst_popup.cpp33
-rw-r--r--tests/auto/qquickmaterialstyle/data/tst_material.qml34
-rw-r--r--tests/auto/sanity/tst_sanity.cpp3
-rw-r--r--tests/auto/snippets/tst_snippets.cpp115
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-button-flat.qml56
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml56
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-button.qml2
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml77
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-checkbox.qml72
-rw-r--r--tests/manual/gifs/tst_gifs.cpp72
175 files changed, 1580 insertions, 445 deletions
diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
index 2450d495..5c80587d 100644
--- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
+++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
@@ -187,7 +187,7 @@ This line determines where the example will be copied to when running
Now we can build and run the application:
-\image qtquickcontrols2-chattutorial-chapter1.png
+\borderedimage qtquickcontrols2-chattutorial-chapter1.png
\section1 Chapter 2: Lists
@@ -261,7 +261,7 @@ The image will be \c 40 pixels wide and \c 40 pixels high. We'll base the
height of the delegate on the image's height, so that we don't have any empty
vertical space.
-\image qtquickcontrols2-chattutorial-chapter2.png
+\borderedimage qtquickcontrols2-chattutorial-chapter2.png
\section1 Chapter 3: Navigation
@@ -312,7 +312,7 @@ In chapter 2, we added a ListView below the header. If you run the application
for that chapter, you'll see that the contents of the view can be scrolled over
the top of the header:
-\image qtquickcontrols2-chattutorial-chapter2-listview-header.gif
+\borderedimage qtquickcontrols2-chattutorial-chapter2-listview-header.gif
This is not that nice, especially if the text in the
delegates is long enough that it reaches the text in the header. What we
@@ -332,7 +332,7 @@ usual, comes from the application style. Here it is in action:
\printuntil }
\printuntil }
-\image qtquickcontrols2-chattutorial-chapter3-listview-header.gif
+\borderedimage qtquickcontrols2-chattutorial-chapter3-listview-header.gif
It has no layout of its own, so we center the label within it ourselves.
@@ -433,7 +433,7 @@ After filling the width and height of its parent, we also set some margins on
the view. This gives us a nice alignment with the placeholder text in the
"compose message" field:
-\image qtquickcontrols2-chattutorial-chapter3-view-margins.png
+\borderedimage qtquickcontrols2-chattutorial-chapter3-view-margins.png
Next, we set \l {ListView::}{displayMarginBeginning} and \l
{ListView::}{displayMarginEnd}. These properties ensure that the delegates
@@ -485,7 +485,7 @@ does not go outside of the screen.
Finally, the button is only enabled when there is actually a message to send.
-\image qtquickcontrols2-chattutorial-chapter3.gif
+\borderedimage qtquickcontrols2-chattutorial-chapter3.gif
\section1 Chapter 4: Models
@@ -663,7 +663,7 @@ timestamp that we want to display below every message:
\printuntil }
\printuntil }
-\image qtquickcontrols2-chattutorial-chapter4-message-timestamp.png
+\borderedimage qtquickcontrols2-chattutorial-chapter4-message-timestamp.png
Now that we have a proper model, we can use its \c recipient role in the
expression for the \c sentByMe property.
@@ -685,7 +685,7 @@ smaller value. However, in the image below, the message text is quite long, so
the smaller value (the width of the view) is chosen, ensuring that the text
stops at the opposite edge of the screen:
-\image qtquickcontrols2-chattutorial-chapter4-long-message.png
+\borderedimage qtquickcontrols2-chattutorial-chapter4-long-message.png
In order to display the timestamp for each message that we discussed earlier,
we use a Label. The date and time are formatted with
@@ -701,7 +701,7 @@ First, we call the invokable \c sendMessage() function of the model, which
inserts a new row into the Conversations database table. Then, we clear the
text field to make way for future input.
-\image qtquickcontrols2-chattutorial-chapter4.gif
+\borderedimage qtquickcontrols2-chattutorial-chapter4.gif
\section1 Chapter 5: Styling
@@ -714,12 +714,12 @@ So far, we've just been testing the application with the Default style. If we
run it with the \l {Material Style}, for example, we'll immediately see some issues.
Here is the Contacts page:
-\image qtquickcontrols2-chattutorial-chapter5-contacts-material-test.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-material-test.png
The header text is black on a dark blue background, which is very difficult to
read. The same thing occurs with the Conversations page:
-\image qtquickcontrols2-chattutorial-chapter5-conversations-material-test.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-material-test.png
The solution is to tell the toolbar that it should use the \e "Dark" theme, so
that this information is propagated to its children, allowing them to switch
@@ -789,13 +789,13 @@ We'll make the same changes to \c ConversationPage.qml:
Now both pages look correct:
-\image qtquickcontrols2-chattutorial-chapter5-contacts-material.png
-\image qtquickcontrols2-chattutorial-chapter5-conversations-material.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-material.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-material.png
Let's try out the Universal style:
-\image qtquickcontrols2-chattutorial-chapter5-contacts-universal.png
-\image qtquickcontrols2-chattutorial-chapter5-conversations-universal.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-universal.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-universal.png
No issues there. For a relatively simple application such as this one, there
should be very few adjustments necessary when switching styles.
@@ -814,8 +814,8 @@ Theme=Dark
Once this is done, build and run the application. This is what you should see:
-\image qtquickcontrols2-chattutorial-chapter5-contacts-material-dark.png
-\image qtquickcontrols2-chattutorial-chapter5-conversations-material-dark.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-material-dark.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-material-dark.png
Both pages look fine. Now add an entry for the Universal style:
@@ -826,8 +826,8 @@ Theme=Dark
After building and running the application, you should see these results:
-\image qtquickcontrols2-chattutorial-chapter5-contacts-universal-dark.png
-\image qtquickcontrols2-chattutorial-chapter5-conversations-universal-dark.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-contacts-universal-dark.png
+\borderedimage qtquickcontrols2-chattutorial-chapter5-conversations-universal-dark.png
\section1 Summary
diff --git a/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml
index 908d8f6d..d9e5f788 100644
--- a/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml
+++ b/examples/quickcontrols2/gallery/pages/BusyIndicatorPage.qml
@@ -41,12 +41,12 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
@@ -57,7 +57,7 @@ Pane {
}
BusyIndicator {
- readonly property int size: Math.min(pane.availableWidth, pane.availableHeight) / 5
+ readonly property int size: Math.min(page.availableWidth, page.availableHeight) / 5
width: size
height: size
anchors.horizontalCenter: parent.horizontalCenter
diff --git a/examples/quickcontrols2/gallery/pages/ButtonPage.qml b/examples/quickcontrols2/gallery/pages/ButtonPage.qml
index 181cc2fc..7e945fa1 100644
--- a/examples/quickcontrols2/gallery/pages/ButtonPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ButtonPage.qml
@@ -41,51 +41,42 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Flickable {
- id: flickable
- contentHeight: pane.height
+ScrollablePage {
+ id: page
- readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3))
+ readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, page.availableWidth / 3))
- Pane {
- id: pane
+ Column {
+ spacing: 40
width: parent.width
- Column {
- id: column
- spacing: 40
+ Label {
width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Button presents a push-button that can be pushed or clicked by the user. "
+ + "Buttons are normally used to perform an action, or to answer a question."
+ }
- Label {
- width: parent.width
- wrapMode: Label.Wrap
- horizontalAlignment: Qt.AlignHCenter
- text: "Button presents a push-button that can be pushed or clicked by the user. "
- + "Buttons are normally used to perform an action, or to answer a question."
- }
-
- Column {
- spacing: 20
- anchors.horizontalCenter: parent.horizontalCenter
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
- Button {
- text: "First"
- width: itemWidth
- }
- Button {
- id: button
- text: "Second"
- width: itemWidth
- highlighted: true
- }
- Button {
- text: "Third"
- enabled: false
- width: itemWidth
- }
+ Button {
+ text: "First"
+ width: itemWidth
+ }
+ Button {
+ id: button
+ text: "Second"
+ width: itemWidth
+ highlighted: true
+ }
+ Button {
+ text: "Third"
+ enabled: false
+ width: itemWidth
}
}
}
-
- ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml b/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml
index 3793cc1f..8d48d32d 100644
--- a/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/CheckBoxPage.qml
@@ -41,46 +41,37 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Flickable {
- id: flickable
- contentHeight: pane.height
+ScrollablePage {
+ id: page
- Pane {
- id: pane
+ Column {
+ spacing: 40
width: parent.width
- Column {
- id: column
- spacing: 40
+ Label {
width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "CheckBox presents an option button that can be toggled on or off. "
+ + "Check boxes are typically used to select one or more options from a set of options."
+ }
- Label {
- width: parent.width
- wrapMode: Label.Wrap
- horizontalAlignment: Qt.AlignHCenter
- text: "CheckBox presents an option button that can be toggled on or off. "
- + "Check boxes are typically used to select one or more options from a set of options."
- }
-
- Column {
- spacing: 20
- anchors.horizontalCenter: parent.horizontalCenter
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
- CheckBox {
- text: "First"
- checked: true
- }
- CheckBox {
- text: "Second"
- }
- CheckBox {
- text: "Third"
- checked: true
- enabled: false
- }
+ CheckBox {
+ text: "First"
+ checked: true
+ }
+ CheckBox {
+ text: "Second"
+ }
+ CheckBox {
+ text: "Third"
+ checked: true
+ enabled: false
}
}
}
-
- ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml b/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml
index bf2b70d8..c800ba73 100644
--- a/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ComboBoxPage.qml
@@ -41,8 +41,8 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
@@ -58,7 +58,7 @@ Pane {
ComboBox {
model: ["First", "Second", "Third"]
- width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, page.availableWidth / 3))
anchors.horizontalCenter: parent.horizontalCenter
}
}
diff --git a/examples/quickcontrols2/gallery/pages/DialPage.qml b/examples/quickcontrols2/gallery/pages/DialPage.qml
index 2901cb4d..b60fa032 100644
--- a/examples/quickcontrols2/gallery/pages/DialPage.qml
+++ b/examples/quickcontrols2/gallery/pages/DialPage.qml
@@ -41,8 +41,8 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
diff --git a/examples/quickcontrols2/gallery/pages/FramePage.qml b/examples/quickcontrols2/gallery/pages/FramePage.qml
index 579e7e2d..b2d24dff 100644
--- a/examples/quickcontrols2/gallery/pages/FramePage.qml
+++ b/examples/quickcontrols2/gallery/pages/FramePage.qml
@@ -41,14 +41,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
- readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, pane.availableWidth / 3 * 2))
+ readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, page.availableWidth / 3 * 2))
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
@@ -62,7 +62,7 @@ Pane {
Column {
spacing: 20
- width: pane.itemWidth
+ width: page.itemWidth
RadioButton {
text: "First"
diff --git a/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml b/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml
index 52676721..c4ceb45d 100644
--- a/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/GroupBoxPage.qml
@@ -41,14 +41,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
- readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, pane.availableWidth / 3 * 2))
+ readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, page.availableWidth / 3 * 2))
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
@@ -63,7 +63,7 @@ Pane {
Column {
spacing: 20
- width: pane.itemWidth
+ width: page.itemWidth
RadioButton {
text: "First"
diff --git a/examples/quickcontrols2/gallery/pages/MenuPage.qml b/examples/quickcontrols2/gallery/pages/MenuPage.qml
index 18321038..49e6da07 100644
--- a/examples/quickcontrols2/gallery/pages/MenuPage.qml
+++ b/examples/quickcontrols2/gallery/pages/MenuPage.qml
@@ -41,12 +41,12 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
@@ -59,7 +59,7 @@ Pane {
id: button
text: "Open"
anchors.horizontalCenter: parent.horizontalCenter
- width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, page.availableWidth / 3))
onClicked: optionsMenu.open()
}
diff --git a/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml b/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml
index 8f17a302..43982b43 100644
--- a/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml
+++ b/examples/quickcontrols2/gallery/pages/PageIndicatorPage.qml
@@ -41,12 +41,12 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/PopupPage.qml b/examples/quickcontrols2/gallery/pages/PopupPage.qml
index 432ff8d8..ac3b02b7 100644
--- a/examples/quickcontrols2/gallery/pages/PopupPage.qml
+++ b/examples/quickcontrols2/gallery/pages/PopupPage.qml
@@ -41,12 +41,12 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
@@ -60,7 +60,7 @@ Pane {
id: button
text: "Open"
anchors.horizontalCenter: parent.horizontalCenter
- width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, page.availableWidth / 3))
onClicked: settingsDialog.open()
}
diff --git a/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml b/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml
index 85024c07..1548192f 100644
--- a/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ProgressBarPage.qml
@@ -41,14 +41,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
- readonly property int itemWidth: Math.max(bar.implicitWidth, pane.availableWidth / 3)
+ readonly property int itemWidth: Math.max(bar.implicitWidth, page.availableWidth / 3)
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml b/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml
index e6f178a8..452d0425 100644
--- a/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml
+++ b/examples/quickcontrols2/gallery/pages/RadioButtonPage.qml
@@ -41,45 +41,36 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Flickable {
- id: flickable
- contentHeight: pane.height
+ScrollablePage {
+ id: page
- Pane {
- id: pane
+ Column {
+ spacing: 40
width: parent.width
- Column {
- id: column
- spacing: 40
+ Label {
width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "RadioButton presents an option button that can be toggled on or off. "
+ + "Radio buttons are typically used to select one option from a set of options."
+ }
- Label {
- width: parent.width
- wrapMode: Label.Wrap
- horizontalAlignment: Qt.AlignHCenter
- text: "RadioButton presents an option button that can be toggled on or off. "
- + "Radio buttons are typically used to select one option from a set of options."
- }
-
- Column {
- spacing: 20
- anchors.horizontalCenter: parent.horizontalCenter
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
- RadioButton {
- text: "First"
- }
- RadioButton {
- text: "Second"
- checked: true
- }
- RadioButton {
- text: "Third"
- enabled: false
- }
+ RadioButton {
+ text: "First"
+ }
+ RadioButton {
+ text: "Second"
+ checked: true
+ }
+ RadioButton {
+ text: "Third"
+ enabled: false
}
}
}
-
- ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml b/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml
index df354fd4..6a74e348 100644
--- a/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml
+++ b/examples/quickcontrols2/gallery/pages/RangeSliderPage.qml
@@ -41,14 +41,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
- readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, pane.availableWidth / 3))
+ readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, page.availableWidth / 3))
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ScrollablePage.qml b/examples/quickcontrols2/gallery/pages/ScrollablePage.qml
new file mode 100644
index 00000000..2a0f1165
--- /dev/null
+++ b/examples/quickcontrols2/gallery/pages/ScrollablePage.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+Page {
+ id: page
+
+ default property alias content: pane.contentItem
+
+ Flickable {
+ anchors.fill: parent
+ contentHeight: pane.implicitHeight
+ flickableDirection: Flickable.AutoFlickIfNeeded
+
+ Pane {
+ id: pane
+ width: parent.width
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+ }
+}
diff --git a/examples/quickcontrols2/gallery/pages/SliderPage.qml b/examples/quickcontrols2/gallery/pages/SliderPage.qml
index 886af3df..03cb7696 100644
--- a/examples/quickcontrols2/gallery/pages/SliderPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SliderPage.qml
@@ -41,14 +41,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
- readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, pane.availableWidth / 3))
+ readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, page.availableWidth / 3))
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml b/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml
index b8b42b49..c75982c2 100644
--- a/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SpinBoxPage.qml
@@ -41,14 +41,14 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
readonly property int itemWidth: Math.max(box.implicitWidth, Math.min(box.implicitWidth * 2, pane.availableWidth / 3))
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/SwitchPage.qml b/examples/quickcontrols2/gallery/pages/SwitchPage.qml
index 24fe5478..ccaa4e1e 100644
--- a/examples/quickcontrols2/gallery/pages/SwitchPage.qml
+++ b/examples/quickcontrols2/gallery/pages/SwitchPage.qml
@@ -41,45 +41,36 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Flickable {
- id: flickable
- contentHeight: pane.height
+ScrollablePage {
+ id: page
- Pane {
- id: pane
+ Column {
+ spacing: 40
width: parent.width
- Column {
- id: column
- spacing: 40
+ Label {
width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Switch is an option button that can be dragged or toggled on or off. "
+ + "Switches are typically used to select between two states."
+ }
- Label {
- width: parent.width
- wrapMode: Label.Wrap
- horizontalAlignment: Qt.AlignHCenter
- text: "Switch is an option button that can be dragged or toggled on or off. "
- + "Switches are typically used to select between two states."
- }
-
- Column {
- spacing: 20
- anchors.horizontalCenter: parent.horizontalCenter
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
- Switch {
- text: "First"
- }
- Switch {
- text: "Second"
- checked: true
- }
- Switch {
- text: "Third"
- enabled: false
- }
+ Switch {
+ text: "First"
+ }
+ Switch {
+ text: "Second"
+ checked: true
+ }
+ Switch {
+ text: "Third"
+ enabled: false
}
}
}
-
- ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/examples/quickcontrols2/gallery/pages/TextAreaPage.qml b/examples/quickcontrols2/gallery/pages/TextAreaPage.qml
index 696b1983..97669f2f 100644
--- a/examples/quickcontrols2/gallery/pages/TextAreaPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TextAreaPage.qml
@@ -41,34 +41,26 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Flickable {
- id: flickable
- contentHeight: pane.height
+ScrollablePage {
+ id: page
- Pane {
- id: pane
+ Column {
+ spacing: 40
width: parent.width
- Column {
- spacing: 40
- anchors.fill: parent
-
- Label {
- width: parent.width
- wrapMode: Label.Wrap
- horizontalAlignment: Qt.AlignHCenter
- text: "TextArea is a multi-line text editor."
- }
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "TextArea is a multi-line text editor."
+ }
- TextArea {
- width: Math.max(implicitWidth, Math.min(implicitWidth * 3, pane.availableWidth / 3))
- anchors.horizontalCenter: parent.horizontalCenter
+ TextArea {
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 3, pane.availableWidth / 3))
+ anchors.horizontalCenter: parent.horizontalCenter
- wrapMode: TextArea.Wrap
- text: "TextArea\n...\n...\n..."
- }
+ wrapMode: TextArea.Wrap
+ text: "TextArea\n...\n...\n..."
}
}
-
- ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/examples/quickcontrols2/gallery/pages/TextFieldPage.qml b/examples/quickcontrols2/gallery/pages/TextFieldPage.qml
index d41a17a1..9917da33 100644
--- a/examples/quickcontrols2/gallery/pages/TextFieldPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TextFieldPage.qml
@@ -41,12 +41,12 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
- anchors.fill: parent
+ width: parent.width
Label {
width: parent.width
diff --git a/examples/quickcontrols2/gallery/pages/ToolTipPage.qml b/examples/quickcontrols2/gallery/pages/ToolTipPage.qml
index f5df5623..98ecd92e 100644
--- a/examples/quickcontrols2/gallery/pages/ToolTipPage.qml
+++ b/examples/quickcontrols2/gallery/pages/ToolTipPage.qml
@@ -41,8 +41,8 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
diff --git a/examples/quickcontrols2/gallery/pages/TumblerPage.qml b/examples/quickcontrols2/gallery/pages/TumblerPage.qml
index 2e248bfc..3b290dcb 100644
--- a/examples/quickcontrols2/gallery/pages/TumblerPage.qml
+++ b/examples/quickcontrols2/gallery/pages/TumblerPage.qml
@@ -41,8 +41,8 @@
import QtQuick 2.6
import QtQuick.Controls 2.1
-Pane {
- id: pane
+ScrollablePage {
+ id: page
Column {
spacing: 40
diff --git a/src/imports/controls/AbstractButton.qml b/src/imports/controls/AbstractButton.qml
new file mode 100644
index 00000000..487b452b
--- /dev/null
+++ b/src/imports/controls/AbstractButton.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Templates 2.0 as T
+
+T.AbstractButton {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem ? contentItem.y + contentItem.baselineOffset : 0
+}
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 89c59beb..a024f20b 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -108,15 +108,18 @@ T.ComboBox {
popup: T.Popup {
y: control.height - (control.visualFocus ? 0 : 1)
width: control.width
- implicitHeight: listview.contentHeight
+ implicitHeight: contentItem.implicitHeight
topMargin: 6
bottomMargin: 6
contentItem: ListView {
id: listview
clip: true
+ implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
+ highlightRangeMode: ListView.ApplyRange
+ highlightMoveDuration: 0
Rectangle {
z: 10
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index d7a5a7cd..446d6004 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -43,9 +43,9 @@ T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.contentWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.contentHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index 499ec171..79e03db5 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -11,6 +11,7 @@ SOURCES += \
$$PWD/qquickdefaultstyle.cpp
QML_CONTROLS = \
+ AbstractButton.qml \
ApplicationWindow.qml \
BusyIndicator.qml \
Button.qml \
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png b/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png
deleted file mode 100644
index 5e68ed44..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-button-custom.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png
deleted file mode 100644
index 3375152c..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-button-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif b/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif
new file mode 100644
index 00000000..e2bd8b6f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-flat.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif b/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif
new file mode 100644
index 00000000..7de076d3
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button-highlighted.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button.gif b/src/imports/controls/doc/images/qtquickcontrols2-button.gif
index 89dcba31..7f2de718 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-button.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-button.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-button.png b/src/imports/controls/doc/images/qtquickcontrols2-button.png
deleted file mode 100644
index d8a39e55..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-button.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png
deleted file mode 100644
index 71cb90ca..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-checked.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png
deleted file mode 100644
index 0c4d3bf7..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png
deleted file mode 100644
index 5fb6daaf..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png
deleted file mode 100644
index 69700ee0..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif
new file mode 100644
index 00000000..50986f1b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif
new file mode 100644
index 00000000..beacdb37
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif
Binary files differ
diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf
index 49725b93..15da00ad 100644
--- a/src/imports/controls/doc/qtquickcontrols2.qdocconf
+++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf
@@ -37,7 +37,8 @@ depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquic
exampledirs += ../../../../examples/quickcontrols2 \
../ \
../../../quicktemplates2 \
- snippets
+ snippets \
+ snippets/screenshots
examplesinstallpath = quickcontrols2
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
index 847ad736..847ad736 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-busyindicator-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-busyindicator-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
index dbe53f4d..dbe53f4d 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
index c7399b9a..c7399b9a 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
index ea220fde..ea220fde 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
index 385d4abb..385d4abb 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
index edf0b324..edf0b324 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-button-pressed.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-button-pressed.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
index e5c466da..e5c466da 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-checked.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-checked.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
index 9645a4b6..9645a4b6 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
index 3bfbb730..3bfbb730 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
index fd7c7fea..fd7c7fea 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
index dba9e7e9..dba9e7e9 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkbox-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkbox-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml
index 83f0ef86..83f0ef86 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-checkdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-checkdelegate-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
index 12d56a56..12d56a56 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
index 2817d956..2817d956 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-delegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-delegate.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
index 1ac43234..1ac43234 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-combobox-popup.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-combobox-popup.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
index 6742abf6..6742abf6 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
index d9a61682..d9a61682 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-dial-handle.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-dial-handle.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
index f2b5d254..f2b5d254 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-frame-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
index 98f177ef..98f177ef 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-frame.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-frame.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
index db58593f..db58593f 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-checkable.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-checkable.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
index bf21e022..bf21e022 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
index bef99d0b..bef99d0b 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox-label.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox-label.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
index 7d4f328c..7d4f328c 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-groupbox.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-groupbox.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
index 0935d8f6..0935d8f6 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
index 733434e8..733434e8 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-itemdelegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-itemdelegate.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
index 2eedb29f..2eedb29f 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-label-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
index cf59c49a..cf59c49a 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-label.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-label.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
index f4507714..f4507714 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-menu-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-menu-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
index 225ba423..225ba423 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
index c7ae046f..c7ae046f 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-delegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-delegate.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml
index 88cadc27..88cadc27 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator-interactive.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator-interactive.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
index cf91d6f2..cf91d6f2 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-pageindicator.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pageindicator.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
index 42c30795..42c30795 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-pane-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
index b7b8fa5d..b7b8fa5d 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-pane.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-pane.qml
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml
new file mode 100644
index 00000000..32025cc7
--- /dev/null
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-popup-custom.qml
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+import QtQuick.Window 2.2
+
+Item {
+ id: root
+ width: 200
+ height: 200
+
+ Binding {
+ target: root
+ property: "visible"
+ value: root.Window.active
+ }
+//! [1]
+Popup {
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 200
+ border.color: "#444"
+ }
+ contentItem: Column {}
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
index c29956e4..c29956e4 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml
index 885f058a..885f058a 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml
index 1a4eb8cc..1a4eb8cc 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-progressbar-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml
index 6d144589..6d144589 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-checked.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
index 1d9661a5..1d9661a5 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml
index 3aefc293..3aefc293 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml
index 2de742a4..2de742a4 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml
index cc4248c4..cc4248c4 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiobutton-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
index 91125921..91125921 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-radiodelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiodelegate-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
index 86fae061..86fae061 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml
index e7ef44ef..e7ef44ef 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml
index 4328c203..4328c203 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml
index a8d58ae0..a8d58ae0 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-first-handle.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-first-handle.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml
index f2cbb1fa..f2cbb1fa 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml
index 37b4940d..37b4940d 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml
index 9e206ecb..9e206ecb 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-rangeslider-second-handle.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-rangeslider-second-handle.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
index 1570aff4..1570aff4 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-active.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-active.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
index 05b3f3aa..05b3f3aa 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollbar-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
index 954b449c..954b449c 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-active.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-active.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
index 97930e1e..97930e1e 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-scrollindicator-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
index 6201cbf8..6201cbf8 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml
index bd60a974..bd60a974 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml
index 05ee2ee3..05ee2ee3 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
index fa23972c..fa23972c 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-handle.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-handle.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml
index ab824904..ab824904 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-slider-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
index cfbd8400..cfbd8400 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
index ad22b856..ad22b856 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-double.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-double.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
index ecd2a659..ecd2a659 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-down.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-down.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
index e6b7c735..e6b7c735 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-textual.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-textual.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
index 0b2c3fea..0b2c3fea 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox-up.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox-up.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
index d8c54714..d8c54714 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-spinbox.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-spinbox.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
index 087e17fe..087e17fe 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipedelegate-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
index 3afcc3e2..3afcc3e2 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-swipeview-indicator.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-swipeview-indicator.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
index 3a6dfc7c..3a6dfc7c 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-checked.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-checked.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
index 5152040d..5152040d 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
index 6eb53084..6eb53084 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
index 6ca19062..6ca19062 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
index 339874d7..339874d7 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switch-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switch-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml
index e06af484..e06af484 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-switchdelegate-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-switchdelegate-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
index 305101c0..305101c0 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml
index 2a4fac0e..2a4fac0e 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar-flickable.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar-flickable.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
index e3a67c30..e3a67c30 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbar.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbar.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
index 9fef1e59..9fef1e59 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tabbutton.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tabbutton.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
index dd6035c0..dd6035c0 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
index 500e09c3..500e09c3 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-textarea-flickable.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textarea-flickable.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
index 8e5d897c..8e5d897c 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
index 21c351c4..21c351c4 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-disabled.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-disabled.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
index ddea7c51..ddea7c51 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-focused.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-focused.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
index 29f7fb9c..29f7fb9c 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-textfield-normal.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-textfield-normal.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
index e8d268c5..e8d268c5 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
index 98a13b7b..98a13b7b 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbar.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
index 449266c1..449266c1 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-toolbutton-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbutton-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
index 27b03a63..27b03a63 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-hover.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-hover.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
index 7d285528..7d285528 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-pressandhold.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-pressandhold.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
index ca08ce72..ca08ce72 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip-slider.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip-slider.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
index ef08e174..ef08e174 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tooltip.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
index f1c2b806..f1c2b806 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-custom.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-custom.qml
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
index 4d2c7349..4d2c7349 100644
--- a/src/imports/controls/doc/snippets/qtquickcontrols2-tumbler-delegate.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tumbler-delegate.qml
diff --git a/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc b/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc
new file mode 100644
index 00000000..31f5d2db
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickpopup-padding.qdocinc
@@ -0,0 +1,10 @@
+//! [padding]
+
+The padding properties are used to control the geometry of the
+\l {contentItem}{content item}.
+
+Popup uses the same approach to padding as \l {Control::padding}{Control}.
+For a visual explanation of the padding system, see the \l {Control Layout}
+section of the documentation.
+
+//! [padding]
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index 3e804bd4..bdd69f8e 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -433,8 +433,8 @@
\section2 Customizing ItemDelegate
- ItemDelegate consists of three visual items: \l {Control::background}{background},
- \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
+ ItemDelegate consists of two visual items: \l {Control::background}{background}
+ and \l {Control::contentItem}{content item}.
\image qtquickcontrols2-itemdelegate-custom.png
@@ -506,6 +506,24 @@
\snippet qtquickcontrols2-pane-custom.qml file
+ \section2 Customizing Popup
+
+ Popup consists of a \l {Popup::background}{background} and
+ \l {Popup::contentItem}{content item}.
+
+ \image qtquickcontrols2-popup-custom.png
+
+ \quotefromfile qtquickcontrols2-popup-custom.qml
+ \skipto import QtQuick 2.6
+ \printuntil import QtQuick.Controls 2.0
+ \codeline
+ \skipto Popup
+ \printuntil {
+ \printuntil }
+ \printuntil }
+ \printuntil }
+
+
\section2 Customizing ProgressBar
ProgressBar consists of two visual items: \l {Control::background}{background}
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 87ab1b2d..7376aecc 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -119,7 +119,7 @@ T.ComboBox {
popup: T.Popup {
width: control.width
- implicitHeight: listview.contentHeight
+ implicitHeight: contentItem.implicitHeight
transformOrigin: Item.Top
topMargin: 12
bottomMargin: 12
@@ -141,10 +141,12 @@ T.ComboBox {
}
contentItem: ListView {
- id: listview
clip: true
+ implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
+ highlightRangeMode: ListView.ApplyRange
+ highlightMoveDuration: 0
T.ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml
index cac0f19a..b2106626 100644
--- a/src/imports/controls/material/TabButton.qml
+++ b/src/imports/controls/material/TabButton.qml
@@ -43,9 +43,9 @@ T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.contentWidth + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.contentHeight + topPadding + bottomPadding)
+ contentItem.implicitHeight + topPadding + bottomPadding)
baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 12
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 0e9f31df..3fb2a7f8 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -391,7 +391,7 @@ static bool globalBackgroundCustom = true;
static const QRgb backgroundColorLight = 0xFFFAFAFA;
static const QRgb backgroundColorDark = 0xFF303030;
static const QRgb dialogColorLight = 0xFFFFFFFF;
-static const QRgb dialogColorDark = 0xFF303030;
+static const QRgb dialogColorDark = 0xFF424242;
static const QRgb primaryTextColorLight = 0xDD000000;
static const QRgb primaryTextColorDark = 0xFFFFFFFF;
static const QRgb secondaryTextColorLight = 0x89000000;
@@ -469,6 +469,8 @@ void QQuickMaterialStyle::setTheme(Theme theme)
propagateTheme();
emit themeChanged();
emit paletteChanged();
+ if (!m_customAccent)
+ emit accentChanged();
if (!m_hasBackground)
emit backgroundChanged();
if (!m_hasForeground)
@@ -484,6 +486,8 @@ void QQuickMaterialStyle::inheritTheme(Theme theme)
propagateTheme();
emit themeChanged();
emit paletteChanged();
+ if (!m_customAccent)
+ emit accentChanged();
if (!m_hasBackground)
emit backgroundChanged();
if (!m_hasForeground)
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index b466d4d7..1b75636a 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -34,22 +34,14 @@
**
****************************************************************************/
-#include <QtQml/qqmlextensionplugin.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qcoreapplication.h>
#include <QtCore/private/qfileselector_p.h>
-
#include <QtQuickControls2/qquickstyle.h>
#include <QtQuickControls2/private/qquickstyle_p.h>
-#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
-#include <QtQuickTemplates2/private/qquickbuttongroup_p.h>
-#include <QtQuickTemplates2/private/qquickcontainer_p.h>
-#include <QtQuickTemplates2/private/qquickcontrol_p.h>
-#include <QtQuickTemplates2/private/qquickpopup_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 <QtQuickTemplates2/private/qquickcontainer_p.h>
#include <QtQuickControls2/private/qquicktumblerview_p.h>
#include "qquickbusyindicatorring_p.h"
@@ -85,7 +77,6 @@ QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlu
void QtQuickControls2Plugin::registerTypes(const char *uri)
{
- qmlRegisterType<QQuickAbstractButton>(uri, 2, 0, "AbstractButton");
qmlRegisterType<QQuickButtonGroup>(uri, 2, 0, "ButtonGroup");
qmlRegisterType<QQuickButtonGroupAttached>();
@@ -97,6 +88,7 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
QQuickStyleSelector selector;
selector.setBaseUrl(typeUrl());
+ 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");
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index e259d092..461291f9 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -114,7 +114,7 @@ T.ComboBox {
popup: T.Popup {
width: control.width
- implicitHeight: Math.min(396, listview.contentHeight)
+ implicitHeight: Math.min(396, contentItem.implicitHeight)
topMargin: 8
bottomMargin: 8
@@ -122,10 +122,12 @@ T.ComboBox {
Universal.accent: control.Universal.accent
contentItem: ListView {
- id: listview
clip: true
+ implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex
+ highlightRangeMode: ListView.ApplyRange
+ highlightMoveDuration: 0
T.ScrollIndicator.vertical: ScrollIndicator { }
}
diff --git a/src/quickcontrols2/qquickstyleattached.cpp b/src/quickcontrols2/qquickstyleattached.cpp
index 7c9935ea..2ef07fd6 100644
--- a/src/quickcontrols2/qquickstyleattached.cpp
+++ b/src/quickcontrols2/qquickstyleattached.cpp
@@ -262,10 +262,13 @@ void QQuickStyleAttached::parentStyleChange(QQuickStyleAttached *newParent, QQui
void QQuickStyleAttached::itemWindowChanged(QQuickWindow *window)
{
- Q_UNUSED(window);
+ QQuickStyleAttached *parentStyle = nullptr;
QQuickItem *item = qobject_cast<QQuickItem *>(sender());
if (item)
- setParentStyle(findParentStyle(metaObject(), item));
+ parentStyle = findParentStyle(metaObject(), item);
+ if (!parentStyle)
+ parentStyle = attachedStyle(metaObject(), window);
+ setParentStyle(parentStyle);
}
void QQuickStyleAttached::itemParentChanged(QQuickItem *item, QQuickItem *parent)
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index 591c4316..ca85b008 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -57,17 +57,6 @@ QT_BEGIN_NAMESPACE
a question. Typical buttons are \e OK, \e Apply, \e Cancel, \e Close,
\e Yes, \e No, and \e Help.
- \table
- \row \li \image qtquickcontrols2-button-normal.png
- \li A button in its normal state.
- \row \li \image qtquickcontrols2-button-pressed.png
- \li A button that is pressed.
- \row \li \image qtquickcontrols2-button-focused.png
- \li A button that has active focus.
- \row \li \image qtquickcontrols2-button-disabled.png
- \li A button that is disabled.
- \endtable
-
A button emits the signal \l {AbstractButton::}{clicked()} when it is activated by the user.
Connect to this signal to perform the button's action. Buttons also
provide the signals \l {AbstractButton::}{canceled()}, \l {AbstractButton::}{doubleClicked()}, \l {AbstractButton::}{pressed()},
@@ -154,6 +143,8 @@ QFont QQuickButton::defaultFont() const
This property holds whether the button is highlighted.
+ \image qtquickcontrols2-button-highlighted.gif
+
A button can be highlighted in order to draw the user's attention towards
it. It has no effect on keyboard interaction.
@@ -180,6 +171,8 @@ void QQuickButton::setHighlighted(bool highlighted)
This property holds whether the button is flat.
+ \image qtquickcontrols2-button-flat.gif
+
A flat button typically does not draw a background unless it is pressed or checked.
The default value is \c false.
diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp
index a777c2b4..ae967c34 100644
--- a/src/quicktemplates2/qquickcheckbox.cpp
+++ b/src/quicktemplates2/qquickcheckbox.cpp
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
\ingroup qtquickcontrols2-buttons
\brief An option button that can be checked or unchecked.
+ \image qtquickcontrols2-checkbox.gif
+
CheckBox presents an option button that can be toggled on (checked) or
off (unchecked). Check boxes are typically used to select one or more
options from a set of options. For larger sets of options, such as those
@@ -65,17 +67,6 @@ QT_BEGIN_NAMESPACE
the checkbox. This state is useful when several child nodes are selected
in a treeview, for example.
- \table
- \row \li \image qtquickcontrols2-checkbox-normal.png
- \li A check box in its normal state.
- \row \li \image qtquickcontrols2-checkbox-checked.png
- \li A check box that is checked.
- \row \li \image qtquickcontrols2-checkbox-focused.png
- \li A check box that has active focus.
- \row \li \image qtquickcontrols2-checkbox-disabled.png
- \li A check box that is disabled.
- \endtable
-
\code
ColumnLayout {
CheckBox {
@@ -120,6 +111,10 @@ QQuickCheckBox::QQuickCheckBox(QQuickItem *parent) :
This property holds whether the checkbox is a tri-state checkbox.
+ In the animation below, the first checkbox is tri-state:
+
+ \image qtquickcontrols2-checkbox-tristate.gif
+
The default is \c false, i.e., the checkbox has only two states.
*/
bool QQuickCheckBox::isTristate() const
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 4ae78a01..dbcf1cfa 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -170,6 +170,7 @@ public:
void updateCurrentText();
void incrementCurrentIndex();
void decrementCurrentIndex();
+ void updateHighlightedIndex();
void setHighlightedIndex(int index);
void createDelegateModel();
@@ -201,19 +202,17 @@ void QQuickComboBoxPrivate::showPopup()
{
if (popup && !popup->isVisible())
popup->open();
- setHighlightedIndex(currentIndex);
}
void QQuickComboBoxPrivate::hidePopup(bool accept)
{
Q_Q(QQuickComboBox);
- if (popup && popup->isVisible())
- popup->close();
if (accept) {
q->setCurrentIndex(highlightedIndex);
emit q->activated(currentIndex);
}
- setHighlightedIndex(-1);
+ if (popup && popup->isVisible())
+ popup->close();
}
void QQuickComboBoxPrivate::togglePopup(bool accept)
@@ -304,6 +303,11 @@ void QQuickComboBoxPrivate::decrementCurrentIndex()
}
}
+void QQuickComboBoxPrivate::updateHighlightedIndex()
+{
+ setHighlightedIndex(popup->isVisible() ? currentIndex : -1);
+}
+
void QQuickComboBoxPrivate::setHighlightedIndex(int index)
{
Q_Q(QQuickComboBox);
@@ -686,10 +690,13 @@ void QQuickComboBox::setPopup(QQuickPopup *popup)
if (d->popup == popup)
return;
+ if (d->popup)
+ QObjectPrivate::disconnect(d->popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::updateHighlightedIndex);
d->deleteDelegate(d->popup);
if (popup) {
QQuickPopupPrivate::get(popup)->allowVerticalFlip = true;
popup->setClosePolicy(QQuickPopup::CloseOnEscape | QQuickPopup::CloseOnPressOutsideParent);
+ QObjectPrivate::connect(popup, &QQuickPopup::visibleChanged, d, &QQuickComboBoxPrivate::updateHighlightedIndex);
}
d->popup = popup;
emit popupChanged();
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index d9859b7d..f7b6da00 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -144,7 +144,8 @@ static QQuickItem *effectiveContentItem(QQuickItem *item)
return item;
}
-QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(nullptr), currentIndex(-1), updatingCurrent(false)
+QQuickContainerPrivate::QQuickContainerPrivate() : contentModel(nullptr), currentIndex(-1), updatingCurrent(false),
+ changeTypes(Destroyed | Parent | SiblingOrder)
{
}
@@ -164,7 +165,7 @@ void QQuickContainerPrivate::cleanup()
for (int i = 0; i < count; ++i) {
QQuickItem *item = itemAt(i);
if (item)
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder);
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes);
}
if (contentItem) {
@@ -196,7 +197,7 @@ void QQuickContainerPrivate::insertItem(int index, QQuickItem *item)
updatingCurrent = true;
item->setParentItem(effectiveContentItem(contentItem));
- QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder);
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, changeTypes);
contentModel->insert(index, item);
q->itemAdded(index, item);
@@ -242,7 +243,7 @@ void QQuickContainerPrivate::removeItem(int index, QQuickItem *item)
currentChanged = true;
}
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Destroyed | QQuickItemPrivate::Parent | QQuickItemPrivate::SiblingOrder);
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, changeTypes);
item->setParentItem(nullptr);
contentModel->remove(index);
diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h
index 30076a31..3b60ad8c 100644
--- a/src/quicktemplates2/qquickcontainer_p_p.h
+++ b/src/quicktemplates2/qquickcontainer_p_p.h
@@ -90,6 +90,7 @@ public:
QQmlObjectModel *contentModel;
int currentIndex;
bool updatingCurrent;
+ QQuickItemPrivate::ChangeTypes changeTypes;
};
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 6e35e64e..e89cc54d 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -907,7 +907,7 @@ void QQuickControl::setFocusReason(Qt::FocusReason reason)
Qt::FocusReason oldReason = d->focusReason;
d->focusReason = reason;
emit focusReasonChanged();
- if (d->activeFocus && isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
+ if (isKeyFocusReason(oldReason) != isKeyFocusReason(reason))
emit visualFocusChanged();
}
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 433ea590..f15d65ad 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -422,7 +422,7 @@ bool QQuickDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent
static QList<QQuickStateAction> prepareTransition(QQuickDrawer *drawer, QQuickTransition *transition, qreal to)
{
QList<QQuickStateAction> actions;
- if (!transition || !QQuickPopupPrivate::get(drawer)->window)
+ if (!transition || !QQuickPopupPrivate::get(drawer)->window || !transition->enabled())
return actions;
qmlExecuteDeferred(transition);
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index a8e07533..45d0e67c 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -91,7 +91,10 @@ QT_BEGIN_NAMESPACE
scene, it is recommended to use ApplicationWindow. ApplicationWindow also
provides background dimming effects.
- \sa {Popup Controls}, ApplicationWindow
+ Popup lays out its content in a similar fashion to \l Control. For more
+ information, see the \l {Control Layout} section of the documentation.
+
+ \sa {Popup Controls}, {Customizing Popup}, ApplicationWindow
*/
/*!
@@ -162,6 +165,10 @@ QQuickPopupPrivate::QQuickPopupPrivate()
{
}
+QQuickPopupPrivate::~QQuickPopupPrivate()
+{
+}
+
void QQuickPopupPrivate::init()
{
Q_Q(QQuickPopup);
@@ -245,12 +252,14 @@ void QQuickPopupPrivate::finalizeExitTransition()
popupItem->setParentItem(nullptr);
popupItem->setVisible(false);
- if (hadActiveFocusBeforeExitTransition) {
- QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
- if (applicationWindow)
- applicationWindow->contentItem()->setFocus(true);
- else if (window)
- window->contentItem()->setFocus(true);
+ if (hadActiveFocusBeforeExitTransition && window) {
+ if (!qobject_cast<QQuickPopupItem *>(window->activeFocusItem())) {
+ QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
+ if (applicationWindow)
+ applicationWindow->contentItem()->setFocus(true);
+ else
+ window->contentItem()->setFocus(true);
+ }
}
visible = false;
@@ -777,6 +786,9 @@ QQuickPopupTransitionManager::QQuickPopupTransitionManager(QQuickPopupPrivate *p
void QQuickPopupTransitionManager::transitionEnter()
{
+ if (popup->transitionState == QQuickPopupPrivate::ExitTransition)
+ cancel();
+
if (!popup->prepareEnterTransition())
return;
@@ -830,36 +842,32 @@ QQuickPopup::~QQuickPopup()
\qmlmethod void QtQuick.Controls::Popup::open()
Opens the popup.
+
+ \sa visible
*/
void QQuickPopup::open()
{
- Q_D(QQuickPopup);
- if (d->visible)
- return;
-
- if (d->complete)
- d->transitionManager.transitionEnter();
+ setVisible(true);
}
/*!
\qmlmethod void QtQuick.Controls::Popup::close()
Closes the popup.
+
+ \sa visible
*/
void QQuickPopup::close()
{
- Q_D(QQuickPopup);
- if (!d->visible)
- return;
-
- if (d->complete)
- d->transitionManager.transitionExit();
+ setVisible(false);
}
/*!
\qmlproperty real QtQuick.Controls::Popup::x
This property holds the x-coordinate of the popup.
+
+ \sa y, z
*/
qreal QQuickPopup::x() const
{
@@ -877,6 +885,8 @@ void QQuickPopup::setX(qreal x)
\qmlproperty real QtQuick.Controls::Popup::y
This property holds the y-coordinate of the popup.
+
+ \sa x, z
*/
qreal QQuickPopup::y() const
{
@@ -920,7 +930,14 @@ void QQuickPopup::setPosition(const QPointF &pos)
\qmlproperty real QtQuick.Controls::Popup::z
This property holds the z-value of the popup. Z-value determines
- the stacking order of popups. The default z-value is \c 0.
+ the stacking order of popups.
+
+ If two visible popups have the same z-value, the last one that
+ was opened will be on top.
+
+ The default z-value is \c 0.
+
+ \sa x, y
*/
qreal QQuickPopup::z() const
{
@@ -1085,7 +1102,8 @@ void QQuickPopup::setContentHeight(qreal height)
\qmlproperty real QtQuick.Controls::Popup::availableWidth
\readonly
- This property holds the width available after deducting horizontal padding.
+ This property holds the width available to the \l contentItem after
+ deducting horizontal padding from the \l {Item::}{width} of the popup.
\sa padding, leftPadding, rightPadding
*/
@@ -1099,7 +1117,8 @@ qreal QQuickPopup::availableWidth() const
\qmlproperty real QtQuick.Controls::Popup::availableHeight
\readonly
- This property holds the height available after deducting vertical padding.
+ This property holds the height available to the \l contentItem after
+ deducting vertical padding from the \l {Item::}{height} of the popup.
\sa padding, topPadding, bottomPadding
*/
@@ -1275,6 +1294,8 @@ void QQuickPopup::resetBottomMargin()
This property holds the default padding.
+ \include qquickpopup-padding.qdocinc
+
\sa availableWidth, availableHeight, topPadding, leftPadding, rightPadding, bottomPadding
*/
qreal QQuickPopup::padding() const
@@ -1300,6 +1321,8 @@ void QQuickPopup::resetPadding()
This property holds the top padding.
+ \include qquickpopup-padding.qdocinc
+
\sa padding, bottomPadding, availableHeight
*/
qreal QQuickPopup::topPadding() const
@@ -1325,6 +1348,8 @@ void QQuickPopup::resetTopPadding()
This property holds the left padding.
+ \include qquickpopup-padding.qdocinc
+
\sa padding, rightPadding, availableWidth
*/
qreal QQuickPopup::leftPadding() const
@@ -1350,6 +1375,8 @@ void QQuickPopup::resetLeftPadding()
This property holds the right padding.
+ \include qquickpopup-padding.qdocinc
+
\sa padding, leftPadding, availableWidth
*/
qreal QQuickPopup::rightPadding() const
@@ -1375,6 +1402,8 @@ void QQuickPopup::resetRightPadding()
This property holds the bottom padding.
+ \include qquickpopup-padding.qdocinc
+
\sa padding, topPadding, availableHeight
*/
qreal QQuickPopup::bottomPadding() const
@@ -1502,6 +1531,14 @@ void QQuickPopup::setParentItem(QQuickItem *parent)
\note If the background item has no explicit size specified, it automatically
follows the popup's size. In most cases, there is no need to specify
width or height for a background item.
+
+ \note Most popups use the implicit size of the background item to calculate
+ the implicit size of the popup itself. If you replace the background item
+ with a custom one, you should also consider providing a sensible implicit
+ size for it (unless it is an item like \l Image which has its own implicit
+ size).
+
+ \sa {Customizing Popup}
*/
QQuickItem *QQuickPopup::background() const
{
@@ -1528,6 +1565,17 @@ void QQuickPopup::setBackground(QQuickItem *background)
popup is made visible, the content item is automatically reparented to
the \l {ApplicationWindow::overlay}{overlay item} of its application
window.
+
+ \note The content item is automatically resized to fit within the
+ \l padding of the popup.
+
+ \note Most popups use the implicit size of the content item to calculate
+ the implicit size of the popup itself. If you replace the content item
+ with a custom one, you should also consider providing a sensible implicit
+ size for it (unless it is an item like \l Text which has its own implicit
+ size).
+
+ \sa {Customizing Popup}
*/
QQuickItem *QQuickPopup::contentItem() const
{
@@ -1547,7 +1595,13 @@ void QQuickPopup::setContentItem(QQuickItem *item)
This property holds the list of content data.
- \sa Item::data
+ The list contains all objects that have been declared in QML as children
+ of the popup.
+
+ \note Unlike \c contentChildren, \c contentData does include non-visual QML
+ objects.
+
+ \sa Item::data, contentChildren
*/
QQmlListProperty<QObject> QQuickPopup::contentData()
{
@@ -1564,7 +1618,13 @@ QQmlListProperty<QObject> QQuickPopup::contentData()
This property holds the list of content children.
- \sa Item::children
+ The list contains all items that have been declared in QML as children
+ of the popup.
+
+ \note Unlike \c contentData, \c contentChildren does not include non-visual
+ QML objects.
+
+ \sa Item::children, contentData
*/
QQmlListProperty<QQuickItem> QQuickPopup::contentChildren()
{
@@ -1599,7 +1659,14 @@ void QQuickPopup::setClip(bool clip)
/*!
\qmlproperty bool QtQuick.Controls::Popup::focus
- This property holds whether the popup has focus. The default value is \c false.
+ This property holds whether the popup wants focus.
+
+ When the popup actually receives focus, \l activeFocus will be \c true.
+ For more information, see \l {Keyboard Focus in Qt Quick}.
+
+ The default value is \c false.
+
+ \sa activeFocus
*/
bool QQuickPopup::hasFocus() const
{
@@ -1621,6 +1688,8 @@ void QQuickPopup::setFocus(bool focus)
\readonly
This property holds whether the popup has active focus.
+
+ \sa focus, {Keyboard Focus in Qt Quick}
*/
bool QQuickPopup::hasActiveFocus() const
{
@@ -1695,6 +1764,8 @@ void QQuickPopup::resetDim()
\qmlproperty bool QtQuick.Controls::Popup::visible
This property holds whether the popup is visible. The default value is \c false.
+
+ \sa open(), close()
*/
bool QQuickPopup::isVisible() const
{
@@ -1705,15 +1776,16 @@ bool QQuickPopup::isVisible() const
void QQuickPopup::setVisible(bool visible)
{
Q_D(QQuickPopup);
- if (d->visible == visible)
+ if (d->visible == visible && d->transitionState != QQuickPopupPrivate::ExitTransition)
return;
- d->visible = visible;
if (d->complete) {
if (visible)
d->transitionManager.transitionEnter();
else
d->transitionManager.transitionExit();
+ } else {
+ d->visible = visible;
}
}
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 9ef5c64b..a024c68f 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -233,7 +233,7 @@ public:
void resetDim();
bool isVisible() const;
- void setVisible(bool visible);
+ virtual void setVisible(bool visible);
qreal opacity() const;
void setOpacity(qreal opacity);
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index 4ad8d171..a9eeacd8 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -142,12 +142,13 @@ private:
QQuickPopupPrivate *m_popup;
};
-class QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener
+class Q_AUTOTEST_EXPORT QQuickPopupPrivate : public QObjectPrivate, public QQuickItemChangeListener
{
Q_DECLARE_PUBLIC(QQuickPopup)
public:
QQuickPopupPrivate();
+ ~QQuickPopupPrivate();
static QQuickPopupPrivate *get(QQuickPopup *popup)
{
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index fcce8374..72dac1c6 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -648,7 +648,7 @@ void QQuickSpinBox::keyReleaseEvent(QKeyEvent *event)
Q_D(QQuickSpinBox);
QQuickControl::keyReleaseEvent(event);
- if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
+ if (d->editable && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return))
d->updateValue();
d->up->setPressed(false);
@@ -740,7 +740,7 @@ void QQuickSpinBox::itemChange(ItemChange change, const ItemChangeData &value)
{
Q_D(QQuickSpinBox);
QQuickControl::itemChange(change, value);
- if (change == ItemActiveFocusHasChanged && !value.boolValue)
+ if (d->editable && change == ItemActiveFocusHasChanged && !value.boolValue)
d->updateValue();
}
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
index ad08df5a..2657695d 100644
--- a/src/quicktemplates2/qquickstackview_p.cpp
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -137,6 +137,16 @@ bool QQuickStackElement::load(QQuickStackView *parent)
if (!item) {
ownItem = true;
+ if (component->isLoading()) {
+ QObject::connect(component, &QQmlComponent::statusChanged, [this](QQmlComponent::Status status) {
+ if (status == QQmlComponent::Ready)
+ load(view);
+ else if (status == QQmlComponent::Error)
+ qWarning() << qPrintable(component->errorString().trimmed());
+ });
+ return true;
+ }
+
QQmlContext *creationContext = component->creationContext();
if (!creationContext)
creationContext = qmlContext(parent);
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 6fe734bb..6d7a505a 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -86,11 +86,15 @@ public:
void updateCurrentIndex();
void updateLayout();
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+
+ bool updatingLayout;
QQuickTabBar::Position position;
};
-QQuickTabBarPrivate::QQuickTabBarPrivate() : position(QQuickTabBar::Header)
+QQuickTabBarPrivate::QQuickTabBarPrivate() : updatingLayout(false), position(QQuickTabBar::Header)
{
+ changeTypes |= Geometry;
}
void QQuickTabBarPrivate::updateCurrentItem()
@@ -113,21 +117,41 @@ void QQuickTabBarPrivate::updateLayout()
Q_Q(QQuickTabBar);
const int count = contentModel->count();
if (count > 0 && contentItem) {
- const qreal itemWidth = (contentItem->width() - qMax(0, count - 1) * spacing) / count;
+ qreal reservedWidth = 0;
+ QVector<QQuickItem *> resizableItems;
+ resizableItems.reserve(count);
for (int i = 0; i < count; ++i) {
QQuickItem *item = q->itemAt(i);
if (item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
- item->setWidth(itemWidth);
- p->widthValid = false;
- }
+ if (!p->widthValid)
+ resizableItems += item;
+ else
+ reservedWidth += item->width();
+ }
+ }
+
+ if (!resizableItems.isEmpty()) {
+ const qreal totalSpacing = qMax(0, count - 1) * spacing;
+ const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / resizableItems.count();
+
+ updatingLayout = true;
+ for (QQuickItem *item : qAsConst(resizableItems)) {
+ item->setWidth(itemWidth);
+ QQuickItemPrivate::get(item)->widthValid = false;
}
+ updatingLayout = false;
}
}
}
+void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
+{
+ if (!updatingLayout)
+ updateLayout();
+}
+
QQuickTabBar::QQuickTabBar(QQuickItem *parent) :
QQuickContainer(*(new QQuickTabBarPrivate), parent)
{
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 27449194..c05f5a0b 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -244,25 +244,27 @@ void QQuickToolTip::setTimeout(int timeout)
emit timeoutChanged();
}
-QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
-{
- return new QQuickToolTipAttached(object);
-}
-
-void QQuickToolTip::open()
+void QQuickToolTip::setVisible(bool visible)
{
Q_D(QQuickToolTip);
- if (d->delay > 0)
- d->startDelay();
- else
- QQuickPopup::open();
+ if (visible) {
+ if (!d->visible && d->delay > 0) {
+ d->startDelay();
+ return;
+ }
+ } else {
+ d->stopDelay();
+ }
+ QQuickPopup::setVisible(visible);
}
-void QQuickToolTip::close()
+QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
{
- Q_D(QQuickToolTip);
- d->stopDelay();
- QQuickPopup::close();
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (!item)
+ qmlInfo(object) << "ToolTip must be attached to an Item";
+
+ return new QQuickToolTipAttached(object);
}
QFont QQuickToolTip::defaultFont() const
@@ -291,10 +293,10 @@ void QQuickToolTip::timerEvent(QTimerEvent *event)
Q_D(QQuickToolTip);
if (event->timerId() == d->timeoutTimer.timerId()) {
d->stopTimeout();
- close();
+ QQuickPopup::setVisible(false);
} else if (event->timerId() == d->delayTimer.timerId()) {
d->stopDelay();
- QQuickPopup::open();
+ QQuickPopup::setVisible(true);
}
}
@@ -349,9 +351,6 @@ QQuickToolTip *QQuickToolTipAttachedPrivate::instance(bool create) const
QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) :
QObject(*(new QQuickToolTipAttachedPrivate), parent)
{
- QQuickItem *item = qobject_cast<QQuickItem *>(parent);
- if (!item && parent)
- qmlInfo(parent) << "ToolTip must be attached to an Item";
}
/*!
diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h
index 96c75c3b..d9f41f80 100644
--- a/src/quicktemplates2/qquicktooltip_p.h
+++ b/src/quicktemplates2/qquicktooltip_p.h
@@ -75,11 +75,9 @@ public:
int timeout() const;
void setTimeout(int timeout);
- static QQuickToolTipAttached *qmlAttachedProperties(QObject *object);
+ void setVisible(bool visible) override;
-public Q_SLOTS:
- void open();
- void close();
+ static QQuickToolTipAttached *qmlAttachedProperties(QObject *object);
Q_SIGNALS:
void textChanged();
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 82188df8..b7e47ec8 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -701,6 +701,7 @@ public:
void itemChildRemoved(QQuickItem *, QQuickItem *) override;
void _q_calculateDisplacement();
+ void emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement);
// The Tumbler that contains the delegate. Required to calculated the displacement.
QPointer<QQuickTumbler> tumbler;
@@ -742,20 +743,26 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
displacement = 0;
// Can happen if the attached properties are accessed on the wrong type of item or the tumbler was destroyed.
- if (!tumbler)
+ if (!tumbler) {
+ emitIfDisplacementChanged(previousDisplacement, displacement);
return;
+ }
// Can happen if there is no ListView or PathView within the contentItem.
QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(tumbler);
- if (!tumblerPrivate->viewContentItem)
+ if (!tumblerPrivate->viewContentItem) {
+ emitIfDisplacementChanged(previousDisplacement, displacement);
return;
+ }
// 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)
+ if (count == 0) {
+ emitIfDisplacementChanged(previousDisplacement, displacement);
return;
+ }
if (tumblerPrivate->viewContentItemType == QQuickTumblerPrivate::PathViewContentItem) {
const qreal offset = tumblerPrivate->view->property("offset").toReal();
@@ -777,8 +784,13 @@ void QQuickTumblerAttachedPrivate::_q_calculateDisplacement()
displacement = reverseDisplacement - index;
}
+ emitIfDisplacementChanged(previousDisplacement, displacement);
+}
+
+void QQuickTumblerAttachedPrivate::emitIfDisplacementChanged(qreal oldDisplacement, qreal newDisplacement)
+{
Q_Q(QQuickTumblerAttached);
- if (displacement != previousDisplacement)
+ if (newDisplacement != oldDisplacement)
emit q->displacementChanged();
}
@@ -817,6 +829,16 @@ QQuickTumblerAttached::QQuickTumblerAttached(QObject *parent) :
QQuickTumblerAttached::~QQuickTumblerAttached()
{
+ Q_D(QQuickTumblerAttached);
+ if (!d->tumbler)
+ return;
+
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(d->tumbler);
+ if (!tumblerPrivate->viewContentItem)
+ return;
+
+ QQuickItemPrivate *viewContentItemPrivate = QQuickItemPrivate::get(tumblerPrivate->viewContentItem);
+ viewContentItemPrivate->removeItemChangeListener(d, QQuickItemPrivate::Geometry | QQuickItemPrivate::Children);
}
/*!
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index cb12f6f1..27fc4525 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -55,6 +55,11 @@ TestCase {
AbstractButton {}
}
+ Component {
+ id: item
+ Item { }
+ }
+
function test_text() {
var control = button.createObject(testCase);
verify(control);
@@ -67,4 +72,35 @@ TestCase {
control.destroy();
}
+
+ function test_baseline() {
+ var control = button.createObject(testCase, {padding: 6})
+ verify(control)
+ compare(control.baselineOffset, 0)
+ control.contentItem = item.createObject(control, {baselineOffset: 12})
+ compare(control.baselineOffset, 18)
+ control.destroy()
+ }
+
+ function test_implicitSize() {
+ var control = button.createObject(testCase)
+ verify(control)
+
+ compare(control.implicitWidth, 0)
+ compare(control.implicitHeight, 0)
+
+ control.contentItem = item.createObject(control, {implicitWidth: 10, implicitHeight: 20})
+ compare(control.implicitWidth, 10)
+ compare(control.implicitHeight, 20)
+
+ control.background = item.createObject(control, {implicitWidth: 20, implicitHeight: 30})
+ compare(control.implicitWidth, 20)
+ compare(control.implicitHeight, 30)
+
+ control.padding = 100
+ compare(control.implicitWidth, 210)
+ compare(control.implicitHeight, 220)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 4db8c439..5ae1e0a6 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -62,7 +62,17 @@ TestCase {
}
Component {
+ id: signalSpy
+ SignalSpy { }
+ }
+
+ Component {
id: comboBox
+ ComboBox { }
+ }
+
+ Component {
+ id: emptyBox
ComboBox {
delegate: ItemDelegate {
width: popup.width
@@ -131,7 +141,7 @@ TestCase {
}
function test_objects() {
- var control = comboBox.createObject(testCase)
+ var control = emptyBox.createObject(testCase)
verify(control)
var items = [
@@ -238,7 +248,7 @@ TestCase {
}
function test_textRole(data) {
- var control = comboBox.createObject(testCase)
+ var control = emptyBox.createObject(testCase)
verify(control)
control.model = data.model
@@ -443,7 +453,7 @@ TestCase {
keyClick(Qt.Key_Space)
compare(control.currentIndex, 1)
- compare(control.highlightedIndex, -1)
+ tryCompare(control, "highlightedIndex", -1)
control.destroy()
}
@@ -861,4 +871,51 @@ TestCase {
control.destroy()
}
+
+ // QTBUG-55030
+ function test_highlightRange() {
+ var control = comboBox.createObject(testCase, {model: 100})
+ verify(control)
+
+ control.currentIndex = 50
+ compare(control.currentIndex, 50)
+ compare(control.highlightedIndex, -1)
+
+ var openedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "opened"})
+ verify(openedSpy.valid)
+
+ control.popup.open()
+ compare(control.highlightedIndex, 50)
+ tryCompare(openedSpy, "count", 1)
+
+ var listview = control.popup.contentItem
+ verify(listview)
+
+ var first = listview.itemAt(0, listview.contentY)
+ verify(first)
+ compare(first.text, "50")
+
+ var closedSpy = signalSpy.createObject(control, {target: control.popup, signalName: "closed"})
+ verify(closedSpy.valid)
+
+ control.popup.close()
+ tryCompare(closedSpy, "count", 1)
+ compare(control.highlightedIndex, -1)
+
+ control.currentIndex = 99
+ compare(control.currentIndex, 99)
+ compare(control.highlightedIndex, -1)
+
+ control.popup.open()
+ compare(control.highlightedIndex, 99)
+ tryCompare(openedSpy, "count", 2)
+
+ var last = listview.itemAt(0, listview.contentY + listview.height - 1)
+ verify(last)
+ compare(last.text, "99")
+
+ openedSpy.target = null
+ closedSpy.target = null
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index 9e836285..81c67681 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -507,4 +507,36 @@ TestCase {
control.destroy()
}
+
+ function test_valueFromText_data() {
+ return [
+ { tag: "editable", editable: true },
+ { tag: "non-editable", editable: false }
+ ]
+ }
+
+ function test_valueFromText(data) {
+ var control = spinBox.createObject(testCase, {editable: data.editable})
+ verify(control)
+
+ control.forceActiveFocus()
+ verify(control.activeFocus)
+
+ var valueFromTextCalls = 0
+ control.valueFromText = function(text, locale) {
+ ++valueFromTextCalls
+ return Number.fromLocaleString(locale, text);
+ }
+
+ keyClick(Qt.Key_Enter)
+ compare(valueFromTextCalls, data.editable ? 1 : 0)
+
+ keyClick(Qt.Key_Return)
+ compare(valueFromTextCalls, data.editable ? 2 : 0)
+
+ control.focus = false
+ compare(valueFromTextCalls, data.editable ? 3 : 0)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml
index 666fc2cb..92e80952 100644
--- a/tests/auto/controls/data/tst_tabbar.qml
+++ b/tests/auto/controls/data/tst_tabbar.qml
@@ -514,17 +514,37 @@ TestCase {
control.destroy()
}
- function test_layout() {
- var control = tabBar.createObject(testCase, {spacing: 0, width: 200})
+ function test_layout_data() {
+ return [
+ { tag: "spacing:0", spacing: 0 },
+ { tag: "spacing:1", spacing: 1 },
+ { tag: "spacing:10", spacing: 10 },
+ ]
+ }
+
+ function test_layout(data) {
+ var control = tabBar.createObject(testCase, {spacing: data.spacing, width: 200})
- var tab1 = tabButton.createObject(control)
+ var tab1 = tabButton.createObject(control, {text: "First"})
control.addItem(tab1)
tryCompare(tab1, "width", control.width)
- var tab2 = tabButton.createObject(control)
+ var tab2 = tabButton.createObject(control, {text: "Second"})
control.addItem(tab2)
- tryCompare(tab1, "width", control.width / 2)
- tryCompare(tab2, "width", control.width / 2)
+ tryCompare(tab1, "width", (control.width - data.spacing) / 2)
+ compare(tab2.width, (control.width - data.spacing) / 2)
+
+ var tab3 = tabButton.createObject(control, {width: 50, text: "Third"})
+ control.addItem(tab3)
+ tryCompare(tab1, "width", (control.width - 2 * data.spacing - 50) / 2)
+ compare(tab2.width, (control.width - 2 * data.spacing - 50) / 2)
+ compare(tab3.width, 50)
+
+ var expectedWidth = tab3.contentItem.implicitWidth + tab3.leftPadding + tab3.rightPadding
+ tab3.width = tab3.implicitWidth
+ tryCompare(tab1, "width", (control.width - 2 * data.spacing - expectedWidth) / 2)
+ tryCompare(tab2, "width", (control.width - 2 * data.spacing - expectedWidth) / 2)
+ compare(tab3.width, expectedWidth)
control.destroy()
}
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index 1e6ecf01..d9c95dbf 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -156,8 +156,10 @@ TestCase {
function test_delay_data() {
return [
- {tag: "0", delay: 0},
- {tag: "100", delay: 100},
+ {tag: "imperative:0", delay: 0, imperative: true},
+ {tag: "imperative:100", delay: 100, imperative: true},
+ {tag: "declarative:0", delay: 0, imperative: false},
+ {tag: "declarative:100", delay: 100, imperative: false}
]
}
@@ -165,18 +167,31 @@ TestCase {
var control = toolTip.createObject(testCase, {delay: data.delay})
compare(control.visible, false)
- control.open()
+ if (data.imperative)
+ control.open()
+ else
+ control.visible = true
compare(control.visible, data.delay <= 0)
tryCompare(control, "visible", true)
control.destroy()
}
- function test_timeout() {
+ function test_timeout_data() {
+ return [
+ {tag: "imperative", imperative: true},
+ {tag: "declarative", imperative: false}
+ ]
+ }
+
+ function test_timeout(data) {
var control = toolTip.createObject(testCase, {timeout: 100})
compare(control.visible, false)
- control.open()
+ if (data.imperative)
+ control.open()
+ else
+ control.visible = true
compare(control.visible, true)
tryCompare(control, "visible", false)
@@ -185,6 +200,55 @@ TestCase {
function test_warning() {
ignoreWarning(Qt.resolvedUrl("tst_tooltip.qml") + ":68:5: QML QtObject: ToolTip must be attached to an Item")
- object.ToolTip.text = ""
+ ignoreWarning("<Unknown File>:1:30: QML ToolTip: cannot find any window to open popup in.")
+ object.ToolTip.show("") // don't crash (QTBUG-56243)
+ }
+
+ Component {
+ id: toolTipWithExitTransition
+
+ ToolTip {
+ enter: Transition {
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 100 }
+ }
+ exit: Transition {
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 1000 }
+ }
+ }
+ }
+
+ function test_makeVisibleWhileExitTransitionRunning_data() {
+ return [
+ { tag: "imperative", imperative: true },
+ { tag: "declarative", imperative: false }
+ ]
+ }
+
+ function test_makeVisibleWhileExitTransitionRunning(data) {
+ var control = toolTipWithExitTransition.createObject(testCase)
+
+ // Show, hide, and show the tooltip again. Its exit transition should
+ // start and get cancelled, and then its enter transition should run.
+ if (data.imperative)
+ control.open()
+ else
+ control.visible = true
+ tryCompare(control, "opacity", 1)
+
+ if (data.imperative)
+ control.close()
+ else
+ control.visible = false
+ verify(control.exit.running)
+ wait(100) // TODO: replace with tryVerify() in 5.8
+ verify(control.opacity < 1)
+
+ if (data.imperative)
+ control.open()
+ else
+ control.visible = true
+ tryCompare(control, "opacity", 1)
+
+ control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index 6f1f0200..b3230ca4 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.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 test suite of the Qt Toolkit.
@@ -51,6 +51,9 @@ TestCase {
name: "Tumbler"
property var tumbler: null
+ // With the help of cleanup(), ensures that all items created during a test function
+ // are destroyed if that test fails.
+ property Item cleanupItem
readonly property real implicitTumblerWidth: 60
readonly property real implicitTumblerHeight: 200
readonly property real defaultImplicitDelegateHeight: implicitTumblerHeight / 3
@@ -66,20 +69,37 @@ TestCase {
}
}
+ Component {
+ id: itemComponent
+
+ Item {
+ anchors.fill: parent
+ }
+ }
+
function init() {
- createTumbler();
+ cleanupItem = itemComponent.createObject(testCase);
+ verify(cleanupItem);
}
function cleanup() {
- tumbler.destroy();
- tumblerView = null;
+ var destroyed = false;
+ cleanupItem.Component.destruction.connect(function() { destroyed = true; });
+
+ cleanupItem.destroy();
+
+ // Waiting until it's deleted before continuing makes debugging
+ // test failures much easier, because there aren't unrelated items hanging around.
+ // TODO: Replace with tryVerify(!tumbler) in 5.8.
+ while (!destroyed)
+ wait(0)
}
function createTumbler(args) {
if (args === undefined)
- tumbler = tumblerComponent.createObject(testCase);
+ tumbler = tumblerComponent.createObject(cleanupItem);
else
- tumbler = tumblerComponent.createObject(testCase, args);
+ tumbler = tumblerComponent.createObject(cleanupItem, args);
verify(tumbler, "Tumbler: failed to create an instance");
tumblerView = findView(tumbler);
verify(tumblerView);
@@ -128,6 +148,7 @@ TestCase {
}
function test_wrapWithoutAttachedProperties() {
+ createTumbler();
verify(tumbler.wrap);
tumbler.delegate = noAttachedPropertiesDelegate;
@@ -136,7 +157,14 @@ TestCase {
verify(findView(tumbler));
}
+ // TODO: test that currentIndex is maintained between contentItem changes...
+// function tst_dynamicContentItemChange() {
+// }
+
function test_currentIndex() {
+ createTumbler();
+ compare(tumbler.contentItem.parent, tumbler);
+
tumbler.model = 5;
compare(tumbler.currentIndex, 0);
@@ -256,7 +284,7 @@ TestCase {
function test_currentIndexAtCreation(data) {
// Test setting currentIndex at creation time
- var tumbler = data.component.createObject(testCase);
+ tumbler = data.component.createObject(cleanupItem);
verify(tumbler);
// A "statically declared" currentIndex will be pending until the count has changed,
// which happens when the model is set, which happens on the TumblerView's next polish.
@@ -279,11 +307,11 @@ TestCase {
} else {
fuzzyCompare(tumblerView.contentY, tumblerDelegateHeight * data.currentIndex - tumblerView.preferredHighlightBegin, fuzz);
}
-
- tumbler.destroy();
}
function test_keyboardNavigation() {
+ createTumbler();
+
tumbler.model = 5;
tumbler.forceActiveFocus();
tumblerView.highlightMoveDuration = 0;
@@ -312,6 +340,8 @@ TestCase {
}
function test_itemsCorrectlyPositioned() {
+ createTumbler();
+
tumbler.model = 4;
tumbler.height = 120;
compare(tumblerDelegateHeight, 40);
@@ -320,7 +350,7 @@ TestCase {
wait(tumblerView.highlightMoveDuration);
var firstItemCenterPos = itemCenterPos(1);
var firstItem = tumblerView.itemAt(firstItemCenterPos.x, firstItemCenterPos.y);
- var actualPos = testCase.mapFromItem(firstItem, 0, 0);
+ var actualPos = cleanupItem.mapFromItem(firstItem, 0, 0);
compare(actualPos.x, tumbler.leftPadding);
compare(actualPos.y, tumbler.topPadding + 40);
@@ -331,7 +361,7 @@ TestCase {
firstItem = tumblerView.itemAt(firstItemCenterPos.x, firstItemCenterPos.y);
verify(firstItem);
// Test QTBUG-40298.
- actualPos = testCase.mapFromItem(firstItem, 0, 0);
+ actualPos = cleanupItem.mapFromItem(firstItem, 0, 0);
compare(actualPos.x, tumbler.leftPadding);
compare(actualPos.y, tumbler.topPadding);
@@ -348,8 +378,11 @@ TestCase {
}
function test_focusPastTumbler() {
+ tumbler = tumblerComponent.createObject(cleanupItem);
+ verify(tumbler);
+
var mouseArea = Qt.createQmlObject(
- "import QtQuick 2.2; TextInput { activeFocusOnTab: true; width: 50; height: 50 }", testCase, "");
+ "import QtQuick 2.2; TextInput { activeFocusOnTab: true; width: 50; height: 50 }", cleanupItem, "");
tumbler.forceActiveFocus();
verify(tumbler.activeFocus);
@@ -357,16 +390,12 @@ TestCase {
keyClick(Qt.Key_Tab);
verify(!tumbler.activeFocus);
verify(mouseArea.activeFocus);
-
- mouseArea.destroy();
}
function test_datePicker() {
- tumbler.destroy();
-
var component = Qt.createComponent("TumblerDatePicker.qml");
compare(component.status, Component.Ready, component.errorString());
- tumbler = component.createObject(testCase);
+ tumbler = component.createObject(cleanupItem);
// Should not be any warnings.
tryCompare(tumbler.dayTumbler, "currentIndex", 0);
@@ -396,6 +425,44 @@ TestCase {
tryCompare(tumbler.dayTumbler, "currentIndex", 27);
}
+ Component {
+ id: timePickerComponent
+
+ Row {
+ property alias minuteTumbler: minuteTumbler
+ property alias amPmTumbler: amPmTumbler
+
+ Tumbler {
+ id: minuteTumbler
+ currentIndex: 6
+ model: 60
+ width: 50
+ height: 150
+ }
+
+ Tumbler {
+ id: amPmTumbler
+ model: ["AM", "PM"]
+ width: 50
+ height: 150
+ contentItem: ListView {
+ anchors.fill: parent
+ model: amPmTumbler.model
+ delegate: amPmTumbler.delegate
+ }
+ }
+ }
+ }
+
+ function test_listViewTimePicker() {
+ var root = timePickerComponent.createObject(cleanupItem);
+ verify(root);
+
+ mouseDrag(root.minuteTumbler, root.minuteTumbler.width / 2, root.minuteTumbler.height / 2, 0, 50);
+ // Shouldn't crash.
+ mouseDrag(root.amPmTumbler, root.amPmTumbler.width / 2, root.amPmTumbler.height / 2, 0, 50);
+ }
+
function test_displacement_data() {
var data = [
// At 0 offset, the first item is current.
@@ -451,6 +518,8 @@ TestCase {
}
function test_displacement(data) {
+ createTumbler();
+
// TODO: test setting these in the opposite order (delegate after model
// doesn't seem to cause a change in delegates in PathView)
tumbler.wrap = true;
@@ -468,6 +537,8 @@ TestCase {
}
function test_wrap() {
+ createTumbler();
+
tumbler.model = 5;
compare(tumbler.count, 5);
@@ -501,6 +572,9 @@ TestCase {
}
function test_countWrap() {
+ tumbler = tumblerComponent.createObject(cleanupItem);
+ verify(tumbler);
+
// Check that a count that is less than visibleItemCount results in wrap being set to false.
verify(2 < tumbler.visibleItemCount);
tumbler.model = 2;
@@ -510,7 +584,7 @@ TestCase {
function test_explicitlyNonwrapping() {
// Check that explicitly setting wrap to false works even when it was implicitly false.
- var explicitlyNonWrapping = twoItemTumbler.createObject(testCase);
+ var explicitlyNonWrapping = twoItemTumbler.createObject(cleanupItem);
verify(explicitlyNonWrapping);
tryCompare(explicitlyNonWrapping, "wrap", false);
@@ -523,13 +597,11 @@ TestCase {
// Test resetting wrap back to the default behavior.
explicitlyNonWrapping.wrap = undefined;
compare(explicitlyNonWrapping.wrap, true);
-
- explicitlyNonWrapping.destroy();
}
function test_explicitlyWrapping() {
// Check that explicitly setting wrap to true works even when it was implicitly true.
- var explicitlyWrapping = tenItemTumbler.createObject(testCase);
+ var explicitlyWrapping = tenItemTumbler.createObject(cleanupItem);
verify(explicitlyWrapping);
compare(explicitlyWrapping.wrap, true);
@@ -541,8 +613,6 @@ TestCase {
// Test resetting wrap back to the default behavior.
explicitlyWrapping.wrap = undefined;
compare(explicitlyWrapping.wrap, false);
-
- explicitlyWrapping.destroy();
}
Component {
@@ -603,7 +673,7 @@ TestCase {
}
function test_customContentItemAtConstruction(data) {
- var tumbler = data.component.createObject(testCase);
+ var tumbler = data.component.createObject(cleanupItem);
// Shouldn't assert.
tumbler.model = 5;
@@ -622,8 +692,6 @@ TestCase {
compare(tumbler.count, 5);
compare(tumblerView.currentIndex, 3);
compare(tumbler.currentIndex, 3);
-
- tumbler.destroy();
}
function test_customContentItemAfterConstruction_data() {
@@ -634,6 +702,8 @@ TestCase {
}
function test_customContentItemAfterConstruction(data) {
+ createTumbler();
+
tumbler.model = 5;
compare(tumbler.count, 5);
@@ -692,6 +762,8 @@ TestCase {
}
function test_displacementListView(data) {
+ createTumbler();
+
tumbler.wrap = false;
tumbler.delegate = displacementDelegate;
tumbler.model = 5;
@@ -761,6 +833,8 @@ TestCase {
}
function test_listViewFlickAboveBounds(data) {
+ createTumbler();
+
tumbler.wrap = false;
tumbler.delegate = displacementDelegate;
tumbler.model = data.model;
@@ -826,6 +900,8 @@ TestCase {
}
function test_visibleItemCount(data) {
+ createTumbler();
+
tumbler.delegate = objectNameDelegate;
tumbler.visibleItemCount = data.visibleItemCount;
@@ -851,6 +927,9 @@ TestCase {
}
function test_attachedProperties() {
+ tumbler = tumblerComponent.createObject(cleanupItem);
+ verify(tumbler);
+
// TODO: crashes somewhere in QML's guts
// tumbler.model = 5;
// tumbler.delegate = wrongDelegateTypeComponent;
@@ -862,8 +941,8 @@ TestCase {
noParentDelegateComponent.createObject(null);
ignoreWarning("Tumbler: attempting to access attached property on item without an \"index\" property");
- var object = noParentDelegateComponent.createObject(testCase);
- object.destroy();
+ var object = noParentDelegateComponent.createObject(cleanupItem);
+ verify(object);
}
property Component paddingDelegate: Text {
@@ -910,6 +989,8 @@ TestCase {
}
function test_padding(data) {
+ createTumbler();
+
tumbler.delegate = paddingDelegate;
tumbler.model = 5;
compare(tumbler.padding, 0);
diff --git a/tests/auto/focus/data/visualFocus.qml b/tests/auto/focus/data/visualFocus.qml
new file mode 100644
index 00000000..0af87652
--- /dev/null
+++ b/tests/auto/focus/data/visualFocus.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Column {
+ width: 400
+ height: 400
+ Button {
+ text: "Button"
+ property bool showFocus: visualFocus
+ }
+ TextField {
+ text: "TextField"
+ }
+}
diff --git a/tests/auto/focus/tst_focus.cpp b/tests/auto/focus/tst_focus.cpp
index dec4fecd..409f2fc7 100644
--- a/tests/auto/focus/tst_focus.cpp
+++ b/tests/auto/focus/tst_focus.cpp
@@ -63,6 +63,8 @@ private slots:
void reason_data();
void reason();
+
+ void visualFocus();
};
void tst_focus::initTestCase()
@@ -245,6 +247,35 @@ void tst_focus::reason()
QCOMPARE(control->property("visualFocus"), QVariant(true));
}
+void tst_focus::visualFocus()
+{
+ QQuickView view;
+ view.setSource(testFileUrl("visualFocus.qml"));
+ view.show();
+ view.requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(&view));
+
+ QQuickItem *column = view.rootObject();
+ QVERIFY(column);
+ QCOMPARE(column->childItems().count(), 2);
+
+ QQuickControl *button = qobject_cast<QQuickControl *>(column->childItems().first());
+ QVERIFY(button);
+
+ QQuickItem *textfield = column->childItems().last();
+ QVERIFY(textfield);
+
+ button->forceActiveFocus(Qt::TabFocusReason);
+ QVERIFY(button->hasActiveFocus());
+ QVERIFY(button->hasVisualFocus());
+ QVERIFY(button->property("showFocus").toBool());
+
+ QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, QPoint(textfield->x() + textfield->width() / 2, textfield->y() + textfield->height() / 2));
+ QVERIFY(!button->hasActiveFocus());
+ QVERIFY(!button->hasVisualFocus());
+ QVERIFY(!button->property("showFocus").toBool());
+}
+
QTEST_MAIN(tst_focus)
#include "tst_focus.moc"
diff --git a/tests/auto/popup/data/activeFocusOnClose3.qml b/tests/auto/popup/data/activeFocusOnClose3.qml
new file mode 100644
index 00000000..5a1c8231
--- /dev/null
+++ b/tests/auto/popup/data/activeFocusOnClose3.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 400
+ height: 400
+
+ property alias popup1: popup1
+ property alias popup2: popup2
+
+ Button {
+ focus: true
+ }
+
+ Popup {
+ id: popup1
+ focus: true
+ enter: Transition { PauseAnimation { duration: 200 } }
+ exit: Transition { PauseAnimation { duration: 200 } }
+ }
+
+ Popup {
+ id: popup2
+ focus: true
+ enter: Transition { PauseAnimation { duration: 100 } }
+ exit: Transition { PauseAnimation { duration: 100 } }
+ }
+}
diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp
index 6d1e1e3c..af6ccf34 100644
--- a/tests/auto/popup/tst_popup.cpp
+++ b/tests/auto/popup/tst_popup.cpp
@@ -64,6 +64,7 @@ private slots:
void closePolicy();
void activeFocusOnClose1();
void activeFocusOnClose2();
+ void activeFocusOnClose3();
void hover_data();
void hover();
void wheel_data();
@@ -454,6 +455,38 @@ void tst_popup::activeFocusOnClose2()
QVERIFY(popup1->hasActiveFocus());
}
+void tst_popup::activeFocusOnClose3()
+{
+ // Test that a closing popup that had focus doesn't steal focus from
+ // another popup that the focus was transferred to.
+ QQuickApplicationHelper helper(this, QStringLiteral("activeFocusOnClose3.qml"));
+ QQuickApplicationWindow *window = helper.appWindow;
+ window->show();
+ window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickPopup *popup1 = helper.appWindow->property("popup1").value<QQuickPopup*>();
+ QVERIFY(popup1);
+
+ QQuickPopup *popup2 = helper.appWindow->property("popup2").value<QQuickPopup*>();
+ QVERIFY(popup2);
+
+ popup1->open();
+ QVERIFY(popup1->isVisible());
+ QTRY_VERIFY(popup1->hasActiveFocus());
+
+ popup2->open();
+ popup1->close();
+
+ QSignalSpy closedSpy(popup1, SIGNAL(closed()));
+ QVERIFY(closedSpy.isValid());
+ QVERIFY(closedSpy.wait());
+
+ QVERIFY(!popup1->isVisible());
+ QVERIFY(popup2->isVisible());
+ QTRY_VERIFY(popup2->hasActiveFocus());
+}
+
void tst_popup::hover_data()
{
QTest::addColumn<QString>("source");
diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml
index 63385a6e..9985997b 100644
--- a/tests/auto/qquickmaterialstyle/data/tst_material.qml
+++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml
@@ -41,6 +41,7 @@
import QtQuick 2.2
import QtQuick.Window 2.2
import QtTest 1.0
+import QtQuick.Templates 2.1 as T
import QtQuick.Controls 2.1
import QtQuick.Controls.Material 2.1
@@ -127,6 +128,7 @@ TestCase {
visible: true
property alias popup: popupInstance
property alias label: labelInstance
+ property alias label2: labelInstance2
Popup {
id: popupInstance
Label {
@@ -136,6 +138,14 @@ TestCase {
}
Component.onCompleted: open()
}
+ T.Popup {
+ contentItem: Label {
+ id: labelInstance2
+ text: "test"
+ color: Material.textSelectionColor
+ }
+ Component.onCompleted: open()
+ }
}
}
@@ -291,16 +301,19 @@ TestCase {
var popupObject = popupComponent.createObject(testCase)
compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString())
compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString())
+ compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString())
popupObject.Material[prop] = data.value1
compare(popupObject.Material[prop], data.value1)
compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString())
compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString())
+ compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString())
popupObject.Material[prop] = data.value2
compare(popupObject.Material[prop], data.value2)
compare(popupObject.popup.Material.textSelectionColor.toString(), popupObject.Material.textSelectionColor.toString())
compare(popupObject.label.color.toString(), popupObject.Material.textSelectionColor.toString())
+ compare(popupObject.label2.color.toString(), popupObject.Material.textSelectionColor.toString())
popupObject.destroy()
}
@@ -500,11 +513,11 @@ TestCase {
compare(control.Material[prop], "#80808080")
// unknown
- ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: 123")
+ ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: 123")
control.Material[prop] = 123
- ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: foo")
+ ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: foo")
control.Material[prop] = "foo"
- ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":57:9: QML Button: unknown Material." + prop + " value: #1")
+ ignoreWarning(Qt.resolvedUrl("tst_material.qml") + ":58:9: QML Button: unknown Material." + prop + " value: #1")
control.Material[prop] = "#1"
control.destroy()
@@ -677,4 +690,19 @@ TestCase {
window.destroy()
}
+
+ Component {
+ id: busyIndicator
+ BusyIndicator { }
+ }
+
+ function test_shade() {
+ var control = busyIndicator.createObject(testCase)
+
+ compare(control.contentItem.color.toString(), Material.color(Material.Pink, Material.Shade500))
+ control.Material.theme = Material.Dark
+ compare(control.contentItem.color.toString(), Material.color(Material.Pink, Material.Shade200))
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index 10348ba4..23b56384 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -139,10 +139,11 @@ private:
void tst_Sanity::initTestCase()
{
QDirIterator it(QQC2_IMPORT_PATH, QStringList() << "*.qml" << "*.js", QDir::Files, QDirIterator::Subdirectories);
+ const QStringList excludeDirs = QStringList() << QStringLiteral("snippets") << QStringLiteral("screenshots") << QStringLiteral("designer");
while (it.hasNext()) {
it.next();
QFileInfo info = it.fileInfo();
- if (info.dir().dirName() != QStringLiteral("snippets") && info.dir().dirName() != QStringLiteral("designer"))
+ if (!excludeDirs.contains(info.dir().dirName()))
files.insert(info.dir().dirName() + "/" + info.fileName(), info.filePath());
}
}
diff --git a/tests/auto/snippets/tst_snippets.cpp b/tests/auto/snippets/tst_snippets.cpp
index 6ca9e72c..7972591b 100644
--- a/tests/auto/snippets/tst_snippets.cpp
+++ b/tests/auto/snippets/tst_snippets.cpp
@@ -46,75 +46,100 @@ class tst_Snippets : public QObject
private slots:
void initTestCase();
+ void verify();
+ void verify_data();
+
void screenshots();
void screenshots_data();
private:
- QMap<QString, QStringPair> filePaths;
- QStringList nonVisualSnippets;
+ QMap<QString, QStringPair> snippetPaths;
+ QMap<QString, QStringPair> screenshotSnippetPaths;
};
+static QMap<QString, QStringPair> findSnippets(const QDir &inputDir, const QDir &outputDir = QDir())
+{
+ QMap<QString, QStringPair> snippetPaths;
+ QDirIterator it(inputDir.path(), QStringList() << "qtquick*.qml" << "qtlabs*.qml", QDir::Files | QDir::Readable);
+ while (it.hasNext()) {
+ QFileInfo fi(it.next());
+ const QString outDirPath = !outputDir.path().isEmpty() ? outputDir.filePath(fi.baseName() + ".png") : QString();
+ snippetPaths.insert(fi.baseName(), qMakePair(fi.filePath(), outDirPath));
+ }
+ return snippetPaths;
+}
+
void tst_Snippets::initTestCase()
{
- QDir outdir(QDir::current().filePath("screenshots"));
- QVERIFY(outdir.exists() || QDir::current().mkpath("screenshots"));
+ qInfo() << "Snippets are taken from" << QQC2_SNIPPETS_PATH;
- QString datadir(QQC2_SNIPPETS_PATH);
- QVERIFY(!datadir.isEmpty());
+ QDir snippetsDir(QQC2_SNIPPETS_PATH);
+ QVERIFY(!snippetsDir.path().isEmpty());
- qInfo() << datadir;
+ snippetPaths = findSnippets(snippetsDir);
+ QVERIFY(!snippetPaths.isEmpty());
- QDirIterator it(datadir, QStringList() << "qtquick*.qml" << "qtlabs*.qml", QDir::Files | QDir::Readable, QDirIterator::Subdirectories);
- while (it.hasNext()) {
- QFileInfo fi(it.next());
- filePaths.insert(fi.baseName(), qMakePair(fi.filePath(), outdir.filePath(fi.baseName() + ".png")));
- }
- QVERIFY(!filePaths.isEmpty());
+ QDir screenshotOutputDir(QDir::current().filePath("screenshots"));
+ QVERIFY(screenshotOutputDir.exists() || QDir::current().mkpath("screenshots"));
- nonVisualSnippets << "qtquickcontrols2-stackview-custom.qml"
- << "qtquickcontrols2-swipeview-custom.qml"
- << "qtquickcontrols2-tooltip-custom.qml";
+ QDir screenshotSnippetsDir(QQC2_SNIPPETS_PATH "/screenshots");
+ QVERIFY(!screenshotSnippetsDir.path().isEmpty());
+
+ screenshotSnippetPaths = findSnippets(screenshotSnippetsDir, screenshotOutputDir);
+ QVERIFY(!screenshotSnippetPaths.isEmpty());
}
Q_DECLARE_METATYPE(QList<QQmlError>)
-void tst_Snippets::screenshots()
+static void loadAndShow(QQuickView *view, const QString &source)
{
- QFETCH(QString, input);
- QFETCH(QString, output);
-
qRegisterMetaType<QList<QQmlError> >();
-
- QQuickView view;
- QSignalSpy warnings(view.engine(), SIGNAL(warnings(QList<QQmlError>)));
+ QSignalSpy warnings(view->engine(), SIGNAL(warnings(QList<QQmlError>)));
QVERIFY(warnings.isValid());
- view.setSource(QUrl::fromLocalFile(input));
- QCOMPARE(view.status(), QQuickView::Ready);
- QVERIFY(view.errors().isEmpty());
- QVERIFY(view.rootObject());
+ view->setSource(QUrl::fromLocalFile(source));
+ QCOMPARE(view->status(), QQuickView::Ready);
+ QVERIFY(view->errors().isEmpty());
+ QVERIFY(view->rootObject());
QVERIFY(warnings.isEmpty());
- view.show();
- view.requestActivate();
- QVERIFY(QTest::qWaitForWindowActive(&view));
+ view->show();
+ view->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(view));
+}
- bool generateScreenshot = true;
- for (const QString &baseName : qAsConst(nonVisualSnippets)) {
- if (input.contains(baseName)) {
- generateScreenshot = false;
- break;
- }
- }
+void tst_Snippets::verify()
+{
+ QFETCH(QString, input);
- if (generateScreenshot) {
- QSharedPointer<QQuickItemGrabResult> result = view.contentItem()->grabToImage();
- QSignalSpy spy(result.data(), SIGNAL(ready()));
- QVERIFY(spy.isValid());
- QVERIFY(spy.wait());
- QVERIFY(result->saveToFile(output));
- }
+ QQuickView view;
+ loadAndShow(&view, input);
+ QGuiApplication::processEvents();
+}
+
+void tst_Snippets::verify_data()
+{
+ QTest::addColumn<QString>("input");
+
+ QMap<QString, QStringPair>::const_iterator it;
+ for (it = snippetPaths.constBegin(); it != snippetPaths.constEnd(); ++it)
+ QTest::newRow(qPrintable(it.key())) << it.value().first;
+}
+
+void tst_Snippets::screenshots()
+{
+ QFETCH(QString, input);
+ QFETCH(QString, output);
+
+ QQuickView view;
+ loadAndShow(&view, input);
+
+ QSharedPointer<QQuickItemGrabResult> result = view.contentItem()->grabToImage();
+ QSignalSpy spy(result.data(), SIGNAL(ready()));
+ QVERIFY(spy.isValid());
+ QVERIFY(spy.wait());
+ QVERIFY(result->saveToFile(output));
QGuiApplication::processEvents();
}
@@ -125,7 +150,7 @@ void tst_Snippets::screenshots_data()
QTest::addColumn<QString>("output");
QMap<QString, QStringPair>::const_iterator it;
- for (it = filePaths.constBegin(); it != filePaths.constEnd(); ++it)
+ for (it = screenshotSnippetPaths.constBegin(); it != screenshotSnippetPaths.constEnd(); ++it)
QTest::newRow(qPrintable(it.key())) << it.value().first << it.value().second;
}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-button-flat.qml b/tests/manual/gifs/data/qtquickcontrols2-button-flat.qml
new file mode 100644
index 00000000..e20e3bc2
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-button-flat.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+Window {
+ width: button.width
+ height: button.height
+ visible: true
+
+ Button {
+ id: button
+ text: pressed ? "Pressed" : "Button"
+ flat: true
+ anchors.centerIn: parent
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml b/tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml
new file mode 100644
index 00000000..b031c731
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-button-highlighted.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+Window {
+ width: button.width
+ height: button.height
+ visible: true
+
+ Button {
+ id: button
+ text: pressed ? "Pressed" : "Button"
+ highlighted: true
+ anchors.centerIn: parent
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-button.qml b/tests/manual/gifs/data/qtquickcontrols2-button.qml
index 6cbcc42a..65262589 100644
--- a/tests/manual/gifs/data/qtquickcontrols2-button.qml
+++ b/tests/manual/gifs/data/qtquickcontrols2-button.qml
@@ -49,7 +49,7 @@ Window {
Button {
id: button
- text: pressed ? "Pressed" : "Normal"
+ text: pressed ? "Pressed" : "Button"
anchors.centerIn: parent
}
}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml b/tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml
new file mode 100644
index 00000000..ef7e18d4
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-checkbox-tristate.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
+
+Window {
+ width: column.implicitWidth
+ height: column.implicitHeight
+ visible: true
+
+ property alias english: english
+ property alias norwegian: norwegian
+
+ ColumnLayout {
+ id: column
+ anchors.centerIn: parent
+
+ CheckBox {
+ text: qsTr("Languages")
+ checkState: english.checked && norwegian.checked
+ ? Qt.Checked : (english.checked || norwegian.checked) ? Qt.PartiallyChecked : Qt.Unchecked
+ tristate: true
+ }
+ CheckBox {
+ id: english
+ text: qsTr("English")
+ checked: true
+ leftPadding: indicator.width
+ }
+ CheckBox {
+ id: norwegian
+ text: qsTr("Norwegian")
+ checked: true
+ leftPadding: indicator.width
+ }
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml
new file mode 100644
index 00000000..ef53721d
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
+
+Window {
+ width: column.implicitWidth
+ height: column.implicitHeight
+ visible: true
+
+ property alias second: second
+ property alias third: third
+
+ ColumnLayout {
+ id: column
+ anchors.centerIn: parent
+
+ CheckBox {
+ checked: true
+ text: qsTr("First")
+ }
+ CheckBox {
+ id: second
+ text: qsTr("Second")
+ }
+ CheckBox {
+ id: third
+ checked: true
+ text: qsTr("Third")
+ }
+ }
+}
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index 919ba104..2eebc180 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -54,6 +54,7 @@ private slots:
void rangeSlider();
void busyIndicator();
void switchGif();
+ void button_data();
void button();
void tabBar();
void menu();
@@ -64,6 +65,8 @@ private slots:
void delegates();
void dial_data();
void dial();
+ void checkBox();
+ void checkBoxTriState();
private:
void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements,
@@ -328,14 +331,23 @@ void tst_Gifs::switchGif()
gifRecorder.waitForFinish();
}
+void tst_Gifs::button_data()
+{
+ QTest::addColumn<QString>("qmlFileName");
+ QTest::newRow("button") << QString::fromLatin1("qtquickcontrols2-button.qml");
+ QTest::newRow("button-flat") << QString::fromLatin1("qtquickcontrols2-button-flat.qml");
+ QTest::newRow("button-highlighted") << QString::fromLatin1("qtquickcontrols2-button-highlighted.qml");
+}
+
void tst_Gifs::button()
{
+ QFETCH(QString, qmlFileName);
+
GifRecorder gifRecorder;
gifRecorder.setDataDirPath(dataDirPath);
gifRecorder.setOutputDir(outputDir);
gifRecorder.setRecordingDuration(3);
- gifRecorder.setQmlFileName("qtquickcontrols2-button.qml");
- gifRecorder.setHighQuality(true);
+ gifRecorder.setQmlFileName(qmlFileName);
gifRecorder.start();
@@ -600,6 +612,62 @@ void tst_Gifs::dial()
gifRecorder.waitForFinish();
}
+void tst_Gifs::checkBox()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(5);
+ gifRecorder.setQmlFileName("qtquickcontrols2-checkbox.qml");
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *second = window->property("second").value<QQuickItem*>();
+ QVERIFY(second);
+ QQuickItem *third = window->property("third").value<QQuickItem*>();
+ QVERIFY(third);
+
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ second->mapToScene(QPointF(second->width() / 2, second->height() / 2)).toPoint(), 400);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ third->mapToScene(QPointF(third->width() / 2, third->height() / 2)).toPoint(), 800);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ third->mapToScene(QPointF(third->width() / 2, third->height() / 2)).toPoint(), 800);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ second->mapToScene(QPointF(second->width() / 2, second->height() / 2)).toPoint(), 800);
+
+ gifRecorder.waitForFinish();
+}
+
+void tst_Gifs::checkBoxTriState()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(6);
+ gifRecorder.setQmlFileName("qtquickcontrols2-checkbox-tristate.qml");
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *english = window->property("english").value<QQuickItem*>();
+ QVERIFY(english);
+ QQuickItem *norwegian = window->property("norwegian").value<QQuickItem*>();
+ QVERIFY(norwegian);
+
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ norwegian->mapToScene(QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint(), 1000);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier,
+ english->mapToScene(QPointF(english->width() / 2, english->height() / 2)).toPoint(), 1000);
+
+ gifRecorder.waitForFinish();
+}
+
QTEST_MAIN(tst_Gifs)
#include "tst_gifs.moc"