aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quickcontrols2/gallery/gallery.qml17
-rw-r--r--src/imports/controls/BusyIndicator.qml2
-rw-r--r--src/imports/controls/Button.qml5
-rw-r--r--src/imports/controls/CheckBox.qml6
-rw-r--r--src/imports/controls/CheckDelegate.qml6
-rw-r--r--src/imports/controls/CheckIndicator.qml1
-rw-r--r--src/imports/controls/ComboBox.qml14
-rw-r--r--src/imports/controls/Dial.qml4
-rw-r--r--src/imports/controls/Drawer.qml9
-rw-r--r--src/imports/controls/Frame.qml4
-rw-r--r--src/imports/controls/GroupBox.qml6
-rw-r--r--src/imports/controls/ItemDelegate.qml4
-rw-r--r--src/imports/controls/Menu.qml4
-rw-r--r--src/imports/controls/MenuItem.qml6
-rw-r--r--src/imports/controls/Page.qml4
-rw-r--r--src/imports/controls/PageIndicator.qml4
-rw-r--r--src/imports/controls/Pane.qml4
-rw-r--r--src/imports/controls/ProgressBar.qml4
-rw-r--r--src/imports/controls/RadioButton.qml6
-rw-r--r--src/imports/controls/RadioDelegate.qml6
-rw-r--r--src/imports/controls/RadioIndicator.qml1
-rw-r--r--src/imports/controls/RangeSlider.qml7
-rw-r--r--src/imports/controls/ScrollBar.qml2
-rw-r--r--src/imports/controls/ScrollIndicator.qml2
-rw-r--r--src/imports/controls/Slider.qml5
-rw-r--r--src/imports/controls/SpinBox.qml11
-rw-r--r--src/imports/controls/StackView.qml12
-rw-r--r--src/imports/controls/SwipeDelegate.qml4
-rw-r--r--src/imports/controls/SwipeView.qml4
-rw-r--r--src/imports/controls/Switch.qml4
-rw-r--r--src/imports/controls/SwitchDelegate.qml6
-rw-r--r--src/imports/controls/SwitchIndicator.qml1
-rw-r--r--src/imports/controls/TabBar.qml4
-rw-r--r--src/imports/controls/TabButton.qml4
-rw-r--r--src/imports/controls/TextField.qml2
-rw-r--r--src/imports/controls/ToolBar.qml4
-rw-r--r--src/imports/controls/ToolButton.qml4
-rw-r--r--src/imports/controls/ToolTip.qml4
-rw-r--r--src/imports/controls/Tumbler.qml4
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gifbin3241 -> 17357 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gifbin4033 -> 8784 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox.gifbin2864 -> 6403 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkbox.pngbin2573 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gifbin0 -> 10487 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gifbin14330 -> 15290 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-combobox.gifbin0 -> 7873 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-combobox.pngbin4984 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-drawer.gifbin0 -> 55780 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gifbin14448 -> 16287 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-accent.pngbin0 -> 1633 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-background.pngbin0 -> 1883 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-button.pngbin1272 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-elevation.pngbin0 -> 3087 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-foreground.pngbin0 -> 1726 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-theme.pngbin0 -> 2002 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup.pngbin0 -> 21693 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup.svg391
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar-disabled.pngbin133 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gifbin0 -> 5882 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.pngbin229 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar-normal.pngbin133 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-progressbar.gifbin0 -> 2072 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.pngbin2591 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.pngbin2179 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.pngbin2328 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.pngbin2027 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gifbin0 -> 7993 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiobutton.pngbin3491 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gifbin16357 -> 16859 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.pngbin0 -> 5459 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.pngbin0 -> 5280 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gifbin0 -> 42352 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.pngbin387 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-disabled.pngbin1019 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-focused.pngbin1154 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-normal.pngbin1154 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gifbin0 -> 18138 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gifbin0 -> 7201 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gifbin0 -> 18377 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider.gifbin16972 -> 13697 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-slider.pngbin1117 -> 0 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gifbin0 -> 23801 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gifbin0 -> 42790 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gifbin0 -> 28882 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gifbin0 -> 23744 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-swipeview.gifbin0 -> 35983 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-toolbar.pngbin3358 -> 1186 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-tooltip.pngbin1483 -> 6315 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-accent.pngbin0 -> 1079 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-background.pngbin0 -> 1326 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.pngbin0 -> 1027 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-universal-theme.pngbin0 -> 1386 bytes
-rw-r--r--src/imports/controls/doc/qtquickcontrols2.qdocconf1
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml42
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml51
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml)15
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml)17
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml93
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml97
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml65
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml44
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml)15
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml (renamed from src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml)18
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml34
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml33
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml27
-rw-r--r--src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml6
-rw-r--r--src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc13
-rw-r--r--src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc15
-rw-r--r--src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc63
-rw-r--r--src/imports/controls/doc/src/includes/qquickswitch.qdocinc4
-rw-r--r--src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc53
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc4
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc94
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc32
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc19
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc66
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc2
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc9
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-input.qdoc4
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-material.qdoc126
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc67
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc112
-rw-r--r--src/imports/controls/material/ComboBox.qml8
-rw-r--r--src/imports/controls/material/images/drop-indicator.pngbin342 -> 192 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator.svg5
-rw-r--r--src/imports/controls/material/images/drop-indicator@2x.pngbin273 -> 221 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@3x.pngbin406 -> 256 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@4x.pngbin520 -> 289 bytes
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp14
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h4
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp8
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme.cpp4
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp20
-rw-r--r--src/quickcontrols2/qquickstyle.cpp22
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp4
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp99
-rw-r--r--src/quicktemplates2/qquickbusyindicator.cpp14
-rw-r--r--src/quicktemplates2/qquickbutton.cpp2
-rw-r--r--src/quicktemplates2/qquickbuttongroup.cpp2
-rw-r--r--src/quicktemplates2/qquickcheckbox.cpp2
-rw-r--r--src/quicktemplates2/qquickcheckdelegate.cpp6
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp267
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h5
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp2
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp37
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h1
-rw-r--r--src/quicktemplates2/qquickdial.cpp8
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp34
-rw-r--r--src/quicktemplates2/qquickframe.cpp9
-rw-r--r--src/quicktemplates2/qquickframe_p.h4
-rw-r--r--src/quicktemplates2/qquickgroupbox.cpp23
-rw-r--r--src/quicktemplates2/qquickgroupbox_p.h5
-rw-r--r--src/quicktemplates2/qquickitemdelegate.cpp2
-rw-r--r--src/quicktemplates2/qquicklabel.cpp4
-rw-r--r--src/quicktemplates2/qquickmenu.cpp2
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp2
-rw-r--r--src/quicktemplates2/qquickpage.cpp12
-rw-r--r--src/quicktemplates2/qquickpage_p.h1
-rw-r--r--src/quicktemplates2/qquickpopup.cpp281
-rw-r--r--src/quicktemplates2/qquickpopup_p.h7
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h8
-rw-r--r--src/quicktemplates2/qquickprogressbar.cpp42
-rw-r--r--src/quicktemplates2/qquickradiobutton.cpp28
-rw-r--r--src/quicktemplates2/qquickradiodelegate.cpp20
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp35
-rw-r--r--src/quicktemplates2/qquickscrollbar.cpp84
-rw-r--r--src/quicktemplates2/qquickscrollindicator.cpp70
-rw-r--r--src/quicktemplates2/qquickshortcutcontext.cpp83
-rw-r--r--src/quicktemplates2/qquickshortcutcontext_p_p.h65
-rw-r--r--src/quicktemplates2/qquickslider.cpp41
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp37
-rw-r--r--src/quicktemplates2/qquickstackview.cpp66
-rw-r--r--src/quicktemplates2/qquickstackview_p.h4
-rw-r--r--src/quicktemplates2/qquickswipe_p.h117
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp77
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p.h56
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p_p.h76
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp9
-rw-r--r--src/quicktemplates2/qquickswipeview_p.h4
-rw-r--r--src/quicktemplates2/qquickswitch.cpp16
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp10
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp13
-rw-r--r--src/quicktemplates2/qquicktabbutton.cpp6
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp30
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp22
-rw-r--r--src/quicktemplates2/qquicktoolbar.cpp23
-rw-r--r--src/quicktemplates2/qquicktoolbutton.cpp6
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp26
-rw-r--r--src/quicktemplates2/qquicktooltip_p.h1
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp8
-rw-r--r--src/quicktemplates2/quicktemplates2.pri4
-rw-r--r--tests/auto/accessibility/data/abstractbutton.qml6
-rw-r--r--tests/auto/accessibility/data/busyindicator.qml10
-rw-r--r--tests/auto/accessibility/data/button.qml11
-rw-r--r--tests/auto/accessibility/data/checkbox.qml11
-rw-r--r--tests/auto/accessibility/data/checkdelegate.qml6
-rw-r--r--tests/auto/accessibility/data/combobox.qml6
-rw-r--r--tests/auto/accessibility/data/container.qml4
-rw-r--r--tests/auto/accessibility/data/control.qml10
-rw-r--r--tests/auto/accessibility/data/dayofweekrow-2.qml10
-rw-r--r--tests/auto/accessibility/data/dayofweekrow.qml11
-rw-r--r--tests/auto/accessibility/data/dial.qml10
-rw-r--r--tests/auto/accessibility/data/drawer.qml4
-rw-r--r--tests/auto/accessibility/data/frame.qml4
-rw-r--r--tests/auto/accessibility/data/groupbox.qml6
-rw-r--r--tests/auto/accessibility/data/itemdelegate.qml6
-rw-r--r--tests/auto/accessibility/data/label.qml11
-rw-r--r--tests/auto/accessibility/data/menu.qml10
-rw-r--r--tests/auto/accessibility/data/menuitem.qml6
-rw-r--r--tests/auto/accessibility/data/monthgrid-2.qml11
-rw-r--r--tests/auto/accessibility/data/monthgrid.qml13
-rw-r--r--tests/auto/accessibility/data/page.qml6
-rw-r--r--tests/auto/accessibility/data/pageindicator.qml10
-rw-r--r--tests/auto/accessibility/data/pane.qml4
-rw-r--r--tests/auto/accessibility/data/popup.qml10
-rw-r--r--tests/auto/accessibility/data/progressbar.qml15
-rw-r--r--tests/auto/accessibility/data/radiobutton.qml11
-rw-r--r--tests/auto/accessibility/data/radiodelegate.qml6
-rw-r--r--tests/auto/accessibility/data/rangeslider.qml21
-rw-r--r--tests/auto/accessibility/data/scrollbar.qml10
-rw-r--r--tests/auto/accessibility/data/scrollindicator.qml10
-rw-r--r--tests/auto/accessibility/data/slider.qml19
-rw-r--r--tests/auto/accessibility/data/spinbox.qml17
-rw-r--r--tests/auto/accessibility/data/stackview.qml4
-rw-r--r--tests/auto/accessibility/data/swipedelegate.qml6
-rw-r--r--tests/auto/accessibility/data/swipeview.qml4
-rw-r--r--tests/auto/accessibility/data/switch.qml11
-rw-r--r--tests/auto/accessibility/data/switchdelegate.qml6
-rw-r--r--tests/auto/accessibility/data/tabbar.qml10
-rw-r--r--tests/auto/accessibility/data/tabbutton.qml15
-rw-r--r--tests/auto/accessibility/data/textarea.qml11
-rw-r--r--tests/auto/accessibility/data/textfield.qml11
-rw-r--r--tests/auto/accessibility/data/toolbar.qml10
-rw-r--r--tests/auto/accessibility/data/toolbutton.qml11
-rw-r--r--tests/auto/accessibility/data/tooltip.qml6
-rw-r--r--tests/auto/accessibility/data/tumbler.qml4
-rw-r--r--tests/auto/accessibility/data/weeknumbercolumn-2.qml10
-rw-r--r--tests/auto/accessibility/data/weeknumbercolumn.qml11
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp55
-rw-r--r--tests/auto/controls/data/tst_button.qml166
-rw-r--r--tests/auto/controls/data/tst_buttongroup.qml33
-rw-r--r--tests/auto/controls/data/tst_checkbox.qml126
-rw-r--r--tests/auto/controls/data/tst_combobox.qml195
-rw-r--r--tests/auto/controls/data/tst_control.qml44
-rw-r--r--tests/auto/controls/data/tst_popup.qml104
-rw-r--r--tests/auto/controls/data/tst_radiobutton.qml80
-rw-r--r--tests/auto/controls/data/tst_rangeslider.qml36
-rw-r--r--tests/auto/controls/data/tst_scrollbar.qml59
-rw-r--r--tests/auto/controls/data/tst_scrollindicator.qml16
-rw-r--r--tests/auto/controls/data/tst_slider.qml22
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml99
-rw-r--r--tests/auto/controls/data/tst_stackview.qml12
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml54
-rw-r--r--tests/auto/controls/data/tst_swipeview.qml17
-rw-r--r--tests/auto/controls/data/tst_tabbar.qml20
-rw-r--r--tests/auto/controls/data/tst_toolbutton.qml40
-rw-r--r--tests/auto/drawer/BLACKLIST2
-rw-r--r--tests/auto/drawer/tst_drawer.cpp13
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml2
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-checkbox.qml8
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml81
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-combobox.qml59
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-drawer.qml89
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-progressbar-indeterminate.qml57
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-progressbar.qml71
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml73
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml67
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-slider-snap.qml79
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-stackview-pop.qml102
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-stackview-push.qml97
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-stackview-replace.qml102
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-stackview-unwind.qml102
-rw-r--r--tests/manual/gifs/data/qtquickcontrols2-swipeview.qml89
-rw-r--r--tests/manual/gifs/tst_gifs.cpp332
-rw-r--r--tests/manual/testbench/main.cpp2
-rw-r--r--tests/manual/testbench/qml.qrc2
-rw-r--r--tests/manual/testbench/testbench.qml (renamed from tests/manual/testbench/main.qml)140
283 files changed, 5437 insertions, 1772 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml
index cc818abd..aadbcdec 100644
--- a/examples/quickcontrols2/gallery/gallery.qml
+++ b/examples/quickcontrols2/gallery/gallery.qml
@@ -57,6 +57,15 @@ ApplicationWindow {
property string style: "Default"
}
+ Shortcut {
+ sequence: "Esc"
+ enabled: stackView.depth > 1
+ onActivated: {
+ stackView.pop()
+ listView.currentIndex = -1
+ }
+ }
+
header: ToolBar {
Material.foreground: "white"
@@ -126,6 +135,8 @@ ApplicationWindow {
ListView {
id: listView
+
+ focus: true
currentIndex: -1
anchors.fill: parent
@@ -134,10 +145,8 @@ ApplicationWindow {
text: model.title
highlighted: ListView.isCurrentItem
onClicked: {
- if (listView.currentIndex != index) {
- listView.currentIndex = index
- stackView.push(model.source)
- }
+ listView.currentIndex = index
+ stackView.push(model.source)
drawer.close()
}
}
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index 44c61355..9be1f046 100644
--- a/src/imports/controls/BusyIndicator.qml
+++ b/src/imports/controls/BusyIndicator.qml
@@ -47,7 +47,6 @@ T.BusyIndicator {
padding: 6
- //! [contentItem]
contentItem: BusyRing {
id: ring
implicitWidth: 48
@@ -61,5 +60,4 @@ T.BusyIndicator {
running: control.visible && control.running
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
index f875a97a..1a974eed 100644
--- a/src/imports/controls/Button.qml
+++ b/src/imports/controls/Button.qml
@@ -50,7 +50,6 @@ T.Button {
leftPadding: padding + 2
rightPadding: padding + 2
- //! [contentItem]
contentItem: Text {
text: control.text
font: control.font
@@ -60,13 +59,10 @@ T.Button {
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
- opacity: enabled ? 1 : 0.3
visible: !control.flat || control.down || control.checked || control.highlighted
color: control.checked || control.highlighted ?
(control.visualFocus ? (control.down ? "#599bff" : "#0066ff") : (control.down ? "#585a5c" : "#353637")) :
@@ -74,5 +70,4 @@ T.Button {
border.color: "#0066ff"
border.width: control.visualFocus ? 2 : 0
}
- //! [background]
}
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index 3615948a..632097b1 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -51,17 +51,13 @@ T.CheckBox {
padding: 6
spacing: 6
- opacity: enabled ? 1 : 0.2
- //! [indicator]
indicator: CheckIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
}
- //! [indicator]
- //! [contentItem]
contentItem: Text {
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
@@ -73,6 +69,6 @@ T.CheckBox {
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+ opacity: enabled ? 1 : 0.3
}
- //! [contentItem]
}
diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml
index dcef7f77..96cb48e0 100644
--- a/src/imports/controls/CheckDelegate.qml
+++ b/src/imports/controls/CheckDelegate.qml
@@ -52,7 +52,6 @@ T.CheckDelegate {
padding: 12
spacing: 12
- //! [contentItem]
contentItem: Text {
leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0
@@ -65,23 +64,18 @@ T.CheckDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [indicator]
indicator: CheckIndicator {
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
control: control
}
- //! [indicator]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted
color: control.down ? "#bdbebf" : "#eeeeee"
}
- //! [background]
}
diff --git a/src/imports/controls/CheckIndicator.qml b/src/imports/controls/CheckIndicator.qml
index d78e9e30..5aad92ef 100644
--- a/src/imports/controls/CheckIndicator.qml
+++ b/src/imports/controls/CheckIndicator.qml
@@ -47,6 +47,7 @@ Rectangle {
color: control.enabled ? (control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : "#ffffff") : "#353637"
border.width: control.visualFocus ? 2 : 1
border.color: control.enabled ? (control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")) : "transparent"
+ opacity: enabled ? 1 : 0.3
Image {
x: (parent.width - width) / 2
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 09930aad..31f2e5d9 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -54,28 +54,22 @@ T.ComboBox {
leftPadding: padding + 6
rightPadding: padding + 6
- opacity: enabled ? 1 : 0.3
-
- //! [delegate]
delegate: ItemDelegate {
width: control.popup.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
font.weight: control.currentIndex === index ? Font.DemiBold : Font.Normal
highlighted: control.highlightedIndex == index
}
- //! [delegate]
- //! [indicator]
indicator: Image {
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
source: "image://default/double-arrow/" + (control.visualFocus ? "#0066ff" : "#353637")
sourceSize.width: width
sourceSize.height: height
+ opacity: enabled ? 1 : 0.3
}
- //! [indicator]
- //! [contentItem]
contentItem: Text {
leftPadding: control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
rightPadding: !control.mirrored && control.indicator ? control.indicator.width + control.spacing : 0
@@ -86,10 +80,9 @@ T.ComboBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
+ opacity: enabled ? 1 : 0.3
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 120
implicitHeight: 40
@@ -99,9 +92,7 @@ T.ComboBox {
border.color: "#0066ff"
border.width: control.visualFocus ? 2 : 0
}
- //! [background]
- //! [popup]
popup: T.Popup {
y: control.height - (control.visualFocus ? 0 : 1)
width: control.width
@@ -132,5 +123,4 @@ T.ComboBox {
background: Rectangle { }
}
- //! [popup]
}
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index aa138126..cd4d6ba2 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -45,7 +45,6 @@ T.Dial {
implicitWidth: 184
implicitHeight: 184
- //! [background]
background: DialRing {
width: control.availableWidth
height: control.availableHeight
@@ -53,9 +52,7 @@ T.Dial {
progress: control.position
opacity: control.enabled ? 1 : 0.3
}
- //! [background]
- //! [handle]
handle: Image {
id: handleItem
x: background.x + background.width / 2 - handle.width / 2
@@ -78,5 +75,4 @@ T.Dial {
}
]
}
- //! [handle]
}
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml
index 9791bf0c..6e9ab71f 100644
--- a/src/imports/controls/Drawer.qml
+++ b/src/imports/controls/Drawer.qml
@@ -53,19 +53,11 @@ T.Drawer {
rightPadding: control.edge === Qt.LeftEdge
bottomPadding: control.edge === Qt.TopEdge
- //! [enter]
enter: Transition { SmoothedAnimation { velocity: 5 } }
- //! [enter]
-
- //! [exit]
exit: Transition { SmoothedAnimation { velocity: 5 } }
- //! [exit]
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
Rectangle {
readonly property bool horizontal: control.edge === Qt.LeftEdge || control.edge === Qt.RightEdge
@@ -76,5 +68,4 @@ T.Drawer {
y: control.edge === Qt.TopEdge ? parent.height - 1 : 0
}
}
- //! [background]
}
diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml
index cb2ffd35..b7968cb4 100644
--- a/src/imports/controls/Frame.qml
+++ b/src/imports/controls/Frame.qml
@@ -48,14 +48,10 @@ T.Frame {
padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: "transparent"
border.color: "#bdbebf"
}
- //! [background]
}
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index 0e9d79fc..31f4963f 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -52,11 +52,8 @@ T.GroupBox {
padding: 12
topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [label]
label: Text {
x: control.leftPadding
width: control.availableWidth
@@ -68,9 +65,7 @@ T.GroupBox {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [label]
- //! [background]
background: Rectangle {
y: control.topPadding - control.padding
width: parent.width
@@ -79,5 +74,4 @@ T.GroupBox {
color: "transparent"
border.color: "#bdbebf"
}
- //! [background]
}
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index d884a328..519ef3bf 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -50,7 +50,6 @@ T.ItemDelegate {
padding: 12
spacing: 12
- //! [contentItem]
contentItem: Text {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
@@ -63,14 +62,11 @@ T.ItemDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted || control.visualFocus
color: control.visualFocus ? (control.pressed ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#eeeeee")
}
- //! [background]
}
diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml
index e349a89d..d9a97cee 100644
--- a/src/imports/controls/Menu.qml
+++ b/src/imports/controls/Menu.qml
@@ -48,7 +48,6 @@ T.Menu {
margins: 0
- //! [contentItem]
contentItem: ListView {
implicitHeight: contentHeight
model: control.contentModel
@@ -60,14 +59,11 @@ T.Menu {
ScrollIndicator.vertical: ScrollIndicator {}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
color: "#ffffff"
border.color: "#353637"
}
- //! [background]
}
diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml
index ead943b0..69f00900 100644
--- a/src/imports/controls/MenuItem.qml
+++ b/src/imports/controls/MenuItem.qml
@@ -49,7 +49,6 @@ T.MenuItem {
padding: 6
- //! [contentItem]
contentItem: Text {
leftPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
@@ -62,9 +61,7 @@ T.MenuItem {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [indicator]
indicator: Image {
x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
y: control.topPadding + (control.availableHeight - height) / 2
@@ -72,9 +69,7 @@ T.MenuItem {
visible: control.checked
source: control.checkable ? "qrc:/qt-project.org/imports/QtQuick/Controls.2/images/check.png" : ""
}
- //! [indicator]
- //! [background]
background: Item {
implicitWidth: 200
implicitHeight: 40
@@ -87,5 +82,4 @@ T.MenuItem {
color: control.visualFocus || control.down ? "#eeeeee" : "transparent"
}
}
- //! [background]
}
diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml
index 3cbb1569..4ed7efb1 100644
--- a/src/imports/controls/Page.qml
+++ b/src/imports/controls/Page.qml
@@ -40,13 +40,9 @@ import QtQuick.Templates 2.0 as T
T.Page {
id: control
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: "#ffffff"
}
- //! [background]
}
diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml
index 5b61acd5..933bc839 100644
--- a/src/imports/controls/PageIndicator.qml
+++ b/src/imports/controls/PageIndicator.qml
@@ -48,7 +48,6 @@ T.PageIndicator {
padding: 6
spacing: 6
- //! [delegate]
delegate: Rectangle {
implicitWidth: 8
implicitHeight: 8
@@ -59,9 +58,7 @@ T.PageIndicator {
opacity: index === currentIndex ? 0.95 : pressed ? 0.7 : 0.45
Behavior on opacity { OpacityAnimator { duration: 100 } }
}
- //! [delegate]
- //! [contentItem]
contentItem: Row {
spacing: control.spacing
@@ -70,5 +67,4 @@ T.PageIndicator {
delegate: control.delegate
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml
index eb79129c..feb8eb58 100644
--- a/src/imports/controls/Pane.qml
+++ b/src/imports/controls/Pane.qml
@@ -48,13 +48,9 @@ T.Pane {
padding: 12
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
color: "#ffffff"
}
- //! [background]
}
diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml
index fb312b18..45e990ee 100644
--- a/src/imports/controls/ProgressBar.qml
+++ b/src/imports/controls/ProgressBar.qml
@@ -47,7 +47,6 @@ T.ProgressBar {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem.implicitHeight + topPadding + bottomPadding)
- //! [contentItem]
contentItem: ProgressStrip {
id: strip
implicitHeight: 6
@@ -61,9 +60,7 @@ T.ProgressBar {
running: control.visible && control.indeterminate
}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 6
@@ -74,5 +71,4 @@ T.ProgressBar {
color: "#e4e4e4"
}
- //! [background]
}
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 8a2d7c99..1100273a 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -51,17 +51,13 @@ T.RadioButton {
padding: 6
spacing: 6
- opacity: enabled ? 1 : 0.2
- //! [indicator]
indicator: RadioIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
}
- //! [indicator]
- //! [contentItem]
contentItem: Text {
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
@@ -73,6 +69,6 @@ T.RadioButton {
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+ opacity: enabled ? 1 : 0.3
}
- //! [contentItem]
}
diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml
index d745054a..620417a8 100644
--- a/src/imports/controls/RadioDelegate.qml
+++ b/src/imports/controls/RadioDelegate.qml
@@ -52,7 +52,6 @@ T.RadioDelegate {
padding: 12
spacing: 12
- //! [contentItem]
contentItem: Text {
leftPadding: control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: !control.mirrored ? control.indicator.width + control.spacing : 0
@@ -65,23 +64,18 @@ T.RadioDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [indicator]
indicator: RadioIndicator {
x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
control: control
}
- //! [indicator]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted
color: control.down ? "#bdbebf" : "#eeeeee"
}
- //! [background]
}
diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml
index 08c24cc5..05ff6673 100644
--- a/src/imports/controls/RadioIndicator.qml
+++ b/src/imports/controls/RadioIndicator.qml
@@ -44,6 +44,7 @@ Rectangle {
color: control.down ? (control.visualFocus ? "#cce0ff" : "#f6f6f6") : (control.visualFocus ? "#f0f6ff" : "#ffffff")
border.width: control.visualFocus ? 2 : 1
border.color: control.visualFocus ? "#0066ff" : (control.down ? "#808080" : "#909090")
+ opacity: enabled ? 1 : 0.3
property Item control
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml
index 7353e2b5..181550a4 100644
--- a/src/imports/controls/RangeSlider.qml
+++ b/src/imports/controls/RangeSlider.qml
@@ -49,7 +49,6 @@ T.RangeSlider {
padding: 6
- //! [firstHandle]
first.handle: Rectangle {
x: control.leftPadding + (horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
@@ -62,9 +61,7 @@ T.RangeSlider {
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [firstHandle]
- //! [secondHandle]
second.handle: Rectangle {
x: control.leftPadding + (horizontal ? control.second.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height))
@@ -77,9 +74,7 @@ T.RangeSlider {
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [secondHandle]
- //! [background]
background: Rectangle {
x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
@@ -88,11 +83,9 @@ T.RangeSlider {
width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight
radius: 3
- opacity: control.enabled ? 1 : 0.3
color: "#e0e0e0"
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [background]
}
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
index 8ccbc328..c77463aa 100644
--- a/src/imports/controls/ScrollBar.qml
+++ b/src/imports/controls/ScrollBar.qml
@@ -47,7 +47,6 @@ T.ScrollBar {
padding: 2
- //! [contentItem]
contentItem: Rectangle {
id: handle
@@ -73,5 +72,4 @@ T.ScrollBar {
}
}
}
- //! [contentItem]
}
diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml
index cd7b53fd..c129e5b8 100644
--- a/src/imports/controls/ScrollIndicator.qml
+++ b/src/imports/controls/ScrollIndicator.qml
@@ -47,7 +47,6 @@ T.ScrollIndicator {
padding: 2
- //! [contentItem]
contentItem: Rectangle {
id: indicator
@@ -74,5 +73,4 @@ T.ScrollIndicator {
}
]
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml
index 896dbca0..5e4dc699 100644
--- a/src/imports/controls/Slider.qml
+++ b/src/imports/controls/Slider.qml
@@ -47,7 +47,6 @@ T.Slider {
padding: 6
- //! [handle]
handle: Rectangle {
x: control.leftPadding + (horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
@@ -60,9 +59,7 @@ T.Slider {
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [handle]
- //! [background]
background: Rectangle {
x: control.leftPadding + (horizontal ? 0 : (control.availableWidth - width) / 2)
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : 0)
@@ -71,11 +68,9 @@ T.Slider {
width: horizontal ? control.availableWidth : implicitWidth
height: horizontal ? implicitHeight : control.availableHeight
radius: 3
- opacity: control.enabled ? 1 : 0.3
color: "#e0e0e0"
scale: horizontal && control.mirrored ? -1 : 1
readonly property bool horizontal: control.orientation === Qt.Horizontal
}
- //! [background]
}
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
index 89853116..dee368e2 100644
--- a/src/imports/controls/SpinBox.qml
+++ b/src/imports/controls/SpinBox.qml
@@ -54,15 +54,12 @@ T.SpinBox {
leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
rightPadding: padding + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
- //! [validator]
validator: IntValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
top: Math.max(control.from, control.to)
}
- //! [validator]
- //! [contentItem]
contentItem: TextInput {
z: 2
text: control.textFromValue(control.value, control.locale)
@@ -90,9 +87,7 @@ T.SpinBox {
border.width: 2
}
}
- //! [contentItem]
- //! [up.indicator]
up.indicator: Rectangle {
x: control.mirrored ? 0 : parent.width - width
height: parent.height
@@ -115,9 +110,7 @@ T.SpinBox {
color: enabled ? "#353637" : "#bdbebf"
}
}
- //! [up.indicator]
- //! [down.indicator]
down.indicator: Rectangle {
x: control.mirrored ? parent.width - width : 0
height: parent.height
@@ -133,13 +126,9 @@ T.SpinBox {
color: enabled ? "#353637" : "#bdbebf"
}
}
- //! [down.indicator]
- //! [background]
background: Rectangle {
- opacity: control.enabled ? 1 : 0.3
implicitWidth: 140
border.color: "#e0e0e0"
}
- //! [background]
}
diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml
index aa95c6a7..f70ecf97 100644
--- a/src/imports/controls/StackView.qml
+++ b/src/imports/controls/StackView.qml
@@ -41,39 +41,27 @@ import QtQuick.Templates 2.0 as T
T.StackView {
id: control
- //! [popEnter]
popEnter: Transition {
XAnimator { from: (control.mirrored ? -1 : 1) * -control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
- //! [popEnter]
- //! [popExit]
popExit: Transition {
XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * control.width; duration: 400; easing.type: Easing.OutCubic }
}
- //! [popExit]
- //! [pushEnter]
pushEnter: Transition {
XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
- //! [pushEnter]
- //! [pushExit]
pushExit: Transition {
XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic }
}
- //! [pushExit]
- //! [replaceEnter]
replaceEnter: Transition {
XAnimator { from: (control.mirrored ? -1 : 1) * control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
- //! [replaceEnter]
- //! [replaceExit]
replaceExit: Transition {
XAnimator { from: 0; to: (control.mirrored ? -1 : 1) * -control.width; duration: 400; easing.type: Easing.OutCubic }
}
- //! [replaceExit]
}
diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml
index 7ffd5a29..6c84dae0 100644
--- a/src/imports/controls/SwipeDelegate.qml
+++ b/src/imports/controls/SwipeDelegate.qml
@@ -50,7 +50,6 @@ T.SwipeDelegate {
padding: 12
spacing: 12
- //! [contentItem]
contentItem: Text {
leftPadding: control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
rightPadding: !control.mirrored ? (control.indicator ? control.indicator.width : 0) + control.spacing : 0
@@ -71,9 +70,7 @@ T.SwipeDelegate {
}
}
}
- //! [contentItem]
- //! [background]
background: Rectangle {
color: control.visualFocus ? (control.down ? "#cce0ff" : "#e5efff") : (control.down ? "#bdbebf" : "#ffffff")
@@ -85,5 +82,4 @@ T.SwipeDelegate {
}
}
}
- //! [background]
}
diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml
index 71676f12..c4e5a570 100644
--- a/src/imports/controls/SwipeView.qml
+++ b/src/imports/controls/SwipeView.qml
@@ -46,9 +46,6 @@ T.SwipeView {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
contentItem.implicitHeight + topPadding + bottomPadding)
- Accessible.role: Accessible.PageTabList
-
- //! [contentItem]
contentItem: ListView {
model: control.contentModel
currentIndex: control.currentIndex
@@ -63,5 +60,4 @@ T.SwipeView {
preferredHighlightEnd: 0
highlightMoveDuration: 250
}
- //! [contentItem]
}
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 0810626f..b4717d05 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -52,15 +52,12 @@ T.Switch {
padding: 6
spacing: 6
- //! [indicator]
indicator: SwitchIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
}
- //! [indicator]
- //! [contentItem]
contentItem: Text {
leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
@@ -73,5 +70,4 @@ T.Switch {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
}
diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml
index 430fc8ec..f5383628 100644
--- a/src/imports/controls/SwitchDelegate.qml
+++ b/src/imports/controls/SwitchDelegate.qml
@@ -52,15 +52,12 @@ T.SwitchDelegate {
padding: 12
spacing: 12
- //! [indicator]
indicator: SwitchIndicator {
x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
control: control
}
- //! [indicator]
- //! [contentItem]
contentItem: Text {
leftPadding: control.indicator && !control.mirrored ? 0 : control.indicator.width + control.spacing
rightPadding: control.indicator && control.mirrored ? 0 : control.indicator.width + control.spacing
@@ -73,14 +70,11 @@ T.SwitchDelegate {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
visible: control.down || control.highlighted
color: control.down ? "#bdbebf" : "#eeeeee"
}
- //! [background]
}
diff --git a/src/imports/controls/SwitchIndicator.qml b/src/imports/controls/SwitchIndicator.qml
index f11f7147..261d9999 100644
--- a/src/imports/controls/SwitchIndicator.qml
+++ b/src/imports/controls/SwitchIndicator.qml
@@ -47,7 +47,6 @@ Item {
width: 56
height: 16
radius: 8
- opacity: control.enabled ? 1 : 0.3
color: control.checked ? (control.visualFocus ? "#0066ff" : "#353637") : "#e0e0e0"
border.width: control.visualFocus ? 2 : 0
border.color: "#0066ff"
diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml
index 6a575167..22b5329e 100644
--- a/src/imports/controls/TabBar.qml
+++ b/src/imports/controls/TabBar.qml
@@ -47,7 +47,6 @@ T.TabBar {
spacing: 1
- //! [contentItem]
contentItem: ListView {
implicitWidth: contentWidth
implicitHeight: 40
@@ -66,9 +65,6 @@ T.TabBar {
preferredHighlightBegin: 40
preferredHighlightEnd: width - 40
}
- //! [contentItem]
- //! [background]
background: Rectangle { }
- //! [background]
}
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index 56b57602..2c5b2708 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -48,7 +48,6 @@ T.TabButton {
padding: 6
- //! [contentItem]
contentItem: Text {
text: control.text
font: control.font
@@ -58,12 +57,9 @@ T.TabButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitHeight: 40
color: control.down ? (control.checked ? "#e4e4e4" : "#585a5c") : (control.checked ? "transparent" : "#353637")
}
- //! [background]
}
diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml
index 35703940..fc07e7bb 100644
--- a/src/imports/controls/TextField.qml
+++ b/src/imports/controls/TextField.qml
@@ -72,7 +72,6 @@ T.TextField {
elide: Text.ElideRight
}
- //! [background]
background: Rectangle {
implicitWidth: 200
implicitHeight: 40
@@ -80,5 +79,4 @@ T.TextField {
color: control.enabled ? "#ffffff" : "#353637"
border.color: control.activeFocus ? "#0066ff" : (control.enabled ? "#bdbebf" : "transparent")
}
- //! [background]
}
diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml
index a787df61..02b6c6f3 100644
--- a/src/imports/controls/ToolBar.qml
+++ b/src/imports/controls/ToolBar.qml
@@ -46,14 +46,10 @@ T.ToolBar {
contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
- //! [contentItem]
contentItem: Item { }
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitHeight: 40
color: "#eeeeee"
}
- //! [background]
}
diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml
index 2887d6b4..1fda5ba3 100644
--- a/src/imports/controls/ToolButton.qml
+++ b/src/imports/controls/ToolButton.qml
@@ -48,7 +48,6 @@ T.ToolButton {
padding: 6
- //! [contentItem]
contentItem: Text {
text: control.text
font: control.font
@@ -57,9 +56,7 @@ T.ToolButton {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [contentItem]
- //! [background]
background: Rectangle {
implicitWidth: 40
implicitHeight: 40
@@ -68,5 +65,4 @@ T.ToolButton {
opacity: control.down ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0
visible: control.down || (control.enabled && (control.checked || control.highlighted))
}
- //! [background]
}
diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml
index 876e2274..322757c7 100644
--- a/src/imports/controls/ToolTip.qml
+++ b/src/imports/controls/ToolTip.qml
@@ -54,17 +54,13 @@ T.ToolTip {
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
- //! [contentItem]
contentItem: Text {
text: control.text
font: control.font
// TODO: wrapMode: Label.Wrap
}
- //! [contentItem]
- //! [background]
background: Rectangle {
border.color: "#353637"
}
- //! [background]
}
diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml
index 13bc0859..571d8089 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -43,7 +43,6 @@ T.Tumbler {
implicitWidth: 60
implicitHeight: 200
- //! [delegate]
delegate: Text {
id: label
text: modelData
@@ -53,9 +52,7 @@ T.Tumbler {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- //! [delegate]
- //! [contentItem]
contentItem: PathView {
id: pathView
model: control.model
@@ -77,5 +74,4 @@ T.Tumbler {
property real delegateHeight: control.availableHeight / control.visibleItemCount
}
- //! [contentItem]
}
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif
index 31ab2d1c..653d200f 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-busyindicator.gif
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
index 50986f1b..56a15867 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox-tristate.gif
+++ 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
index beacdb37..d70c0ee4 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.png b/src/imports/controls/doc/images/qtquickcontrols2-checkbox.png
deleted file mode 100644
index a824949c..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkbox.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif
new file mode 100644
index 00000000..8d058d6c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate-tristate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif
index d379f63c..da3fab98 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-checkdelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-combobox.gif b/src/imports/controls/doc/images/qtquickcontrols2-combobox.gif
new file mode 100644
index 00000000..966a2d4a
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-combobox.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-combobox.png b/src/imports/controls/doc/images/qtquickcontrols2-combobox.png
deleted file mode 100644
index e687fb0e..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-combobox.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif b/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif
new file mode 100644
index 00000000..736f34f6
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-drawer.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif
index 0e8554ff..dccb6efc 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-itemdelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png
new file mode 100644
index 00000000..be0c8212
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-accent.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-background.png b/src/imports/controls/doc/images/qtquickcontrols2-material-background.png
new file mode 100644
index 00000000..132fb538
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-button.png b/src/imports/controls/doc/images/qtquickcontrols2-material-button.png
deleted file mode 100644
index 5181d8b1..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-material-button.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png b/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png
new file mode 100644
index 00000000..38c6dc00
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-elevation.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png
new file mode 100644
index 00000000..122f7f9b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-foreground.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png
new file mode 100644
index 00000000..7109f57f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-theme.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.png b/src/imports/controls/doc/images/qtquickcontrols2-popup.png
new file mode 100644
index 00000000..4514948d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.svg b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
new file mode 100644
index 00000000..1d78addf
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
@@ -0,0 +1,391 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="679.31317"
+ height="357.84125"
+ viewBox="0 0 679.31314 357.84124"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="qtquickcontrols2-popup.svg"
+ inkscape:export-xdpi="90"
+ inkscape:export-ydpi="90">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow1Mstart"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4191"
+ d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="matrix(0.4,0,0,0.4,4,0)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mend"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="Arrow2Mend"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4212"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
+ d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
+ transform="scale(-0.6,-0.6)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-3"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-9"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-0"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-5"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-2"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(-0.8,-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-2"
+ d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ transform="scale(0.8,0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.4"
+ inkscape:cx="359.69451"
+ inkscape:cy="143.84745"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1920"
+ inkscape:window-height="1016"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
+ units="px" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(91.482322,-255.11685)">
+ <rect
+ style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4136"
+ width="564.41473"
+ height="248.82799"
+ x="-30.289024"
+ y="321.69858" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138"
+ style="font-style:normal;font-weight:normal;font-size:15.41801071px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(1.1690183,0,0,1.1690183,19.800223,-141.31953)"><flowRegion
+ id="flowRegion4140"><rect
+ id="rect4142"
+ width="129.78784"
+ height="31.668232"
+ x="-34.519978"
+ y="400.22751"
+ style="font-size:15.41801071px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4144"
+ style="font-size:20.55734825px;fill:#000000">Background</flowPara><flowPara
+ id="flowPara4146" /></flowRoot> <rect
+ style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:27.60000038;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
+ id="rect4148"
+ width="464.22452"
+ height="165.94499"
+ x="18.895706"
+ y="364.74274" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6"
+ style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,144.03104,146.23557)"><flowRegion
+ id="flowRegion4140-6"><rect
+ id="rect4142-6"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:40px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6">Content item</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL);marker-end:url(#TriangleOutL)"
+ d="m 27.018805,516.90108 0,-133.62042"
+ id="path4179"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93839902;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2);marker-end:url(#TriangleOutL-9)"
+ d="m 26.776662,538.68728 451.028788,0"
+ id="path4179-7"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2"
+ style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,10.003309,144.31674)"><flowRegion
+ id="flowRegion4140-6-6"><rect
+ id="rect4142-6-1"
+ width="117.17769"
+ height="101.01524"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:20px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara9732"
+ style="font-size:17.5px;fill:#000000">Available height</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,10.811464,253.07573)"><flowRegion
+ id="flowRegion4140-6-6-4"><rect
+ id="rect4142-6-1-4"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048">Available width</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1"
+ style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,210.99354,300.96896)"><flowRegion
+ id="flowRegion4140-6-9"><rect
+ id="rect4142-6-0"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:25px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2"
+ style="font-size:17.5px">Width</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.90119678;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)"
+ d="m -26.522148,583.27143 557.292688,0"
+ id="path4179-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.9011969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)"
+ d="m -43.461661,566.30584 0,-239.7552"
+ id="path4179-9"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1-7"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-112.00353,150.83655)"><flowRegion
+ id="flowRegion4140-6-9-7"><rect
+ id="rect4142-6-0-5"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2-9"
+ style="font-size:17.5px;fill:#000000">Height</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-3"
+ style="font-style:normal;font-weight:normal;font-size:60px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,166.31611,-24.786365)"><flowRegion
+ id="flowRegion4140-6-67"><rect
+ id="rect4142-6-5"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:60px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-3">Popup</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,186.57489,257.45801)"><flowRegion
+ id="flowRegion4140-6-6-4-6"><rect
+ id="rect4142-6-1-4-2"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048-9">Bottom padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,193.9747,48.798368)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2"><rect
+ id="rect4142-6-1-4-2-7"
+ width="252.53812"
+ height="61.619293"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;fill:#000000"
+ id="flowPara10048-9-0">Top padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,457.80767,148.11921)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3"><rect
+ id="rect4142-6-1-4-2-6"
+ width="81.109558"
+ height="93.762154"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ id="flowPara4386">Right padding</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2"
+ style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-54.735211,151.06168)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5"><rect
+ id="rect4142-6-1-4-2-6-4"
+ width="81.109558"
+ height="93.762154"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ id="flowPara4386-0">Left padding</flowPara></flowRoot> </g>
+</svg>
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-disabled.png
deleted file mode 100644
index 9ce19e92..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gif b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gif
new file mode 100644
index 00000000..d6756d16
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.png b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.png
deleted file mode 100644
index ec2e9ae9..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-indeterminate.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-progressbar-normal.png
deleted file mode 100644
index 9ce19e92..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-progressbar-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-progressbar.gif b/src/imports/controls/doc/images/qtquickcontrols2-progressbar.gif
new file mode 100644
index 00000000..49af5f45
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-progressbar.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.png
deleted file mode 100644
index d22a595b..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-checked.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png
deleted file mode 100644
index 11a99d6f..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.png
deleted file mode 100644
index d7c79ed1..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.png
deleted file mode 100644
index 8a49bf58..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif
new file mode 100644
index 00000000..4cbf3ed9
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.png b/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.png
deleted file mode 100644
index 6c217968..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-radiobutton.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif
index 851064e9..b6afd6fe 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-radiodelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.png
new file mode 100644
index 00000000..8817ad5c
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollbar-non-attached.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.png
new file mode 100644
index 00000000..758e0451
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator-non-attached.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif
new file mode 100644
index 00000000..73007820
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png b/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png
deleted file mode 100644
index ea0923cc..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-scrollindicator.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-disabled.png b/src/imports/controls/doc/images/qtquickcontrols2-slider-disabled.png
deleted file mode 100644
index 919a9a2b..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-slider-disabled.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-focused.png b/src/imports/controls/doc/images/qtquickcontrols2-slider-focused.png
deleted file mode 100644
index e6c4179c..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-slider-focused.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-slider-normal.png
deleted file mode 100644
index e6c4179c..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-slider-normal.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gif
new file mode 100644
index 00000000..ab233c5b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-nosnap.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gif
new file mode 100644
index 00000000..8eb4011f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-snapalways.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gif
new file mode 100644
index 00000000..f3b1d5c7
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider-snaponrelease.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider.gif b/src/imports/controls/doc/images/qtquickcontrols2-slider.gif
index 7cb84b56..2ee56334 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-slider.gif
+++ b/src/imports/controls/doc/images/qtquickcontrols2-slider.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-slider.png b/src/imports/controls/doc/images/qtquickcontrols2-slider.png
deleted file mode 100644
index 2e27a604..00000000
--- a/src/imports/controls/doc/images/qtquickcontrols2-slider.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gif
new file mode 100644
index 00000000..1971c2e0
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-pop.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gif
new file mode 100644
index 00000000..0218cc0f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-push.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gif
new file mode 100644
index 00000000..63a6b2b4
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-replace.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gif b/src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gif
new file mode 100644
index 00000000..28c051d8
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-stackview-unwind.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif b/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif
new file mode 100644
index 00000000..4af26c10
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-swipeview.gif
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
index f4808ca9..1fe353cc 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-toolbar.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png b/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png
index 0a4d57e5..902d6ee5 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-tooltip.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png
new file mode 100644
index 00000000..be1a4a89
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-accent.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png
new file mode 100644
index 00000000..c91ab14d
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png
new file mode 100644
index 00000000..e06b573b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-foreground.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png
new file mode 100644
index 00000000..f299b853
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-universal-theme.png
Binary files differ
diff --git a/src/imports/controls/doc/qtquickcontrols2.qdocconf b/src/imports/controls/doc/qtquickcontrols2.qdocconf
index e83e418e..a9a48343 100644
--- a/src/imports/controls/doc/qtquickcontrols2.qdocconf
+++ b/src/imports/controls/doc/qtquickcontrols2.qdocconf
@@ -35,7 +35,6 @@ depends = qtcore qtgui qtdoc qtqml qtquick qtquickdialogs qtquickcontrols qtquic
# Note: paths passed to \example command must contain the parent directory, e.g.
# \example controls/tabs
exampledirs += ../../../../examples/quickcontrols2 \
- ../ \
../../../quicktemplates2 \
../../calendar \
../../../../tests/auto/controls/data \
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml
new file mode 100644
index 00000000..5238d876
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-accent.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ padding: 4
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ highlighted: true
+ Material.accent: Material.Orange
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml
new file mode 100644
index 00000000..264d5d28
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-background.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ padding: 4
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ highlighted: true
+ Material.background: Material.Teal
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml
new file mode 100644
index 00000000..3ce1a722
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-elevation.qml
@@ -0,0 +1,51 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
+
+Pane {
+ contentWidth: 120
+ contentHeight: 120
+ padding: 10
+ bottomPadding: 20
+
+//! [1]
+Pane {
+ width: 120
+ height: 120
+
+ Material.elevation: 6
+
+ Label {
+ text: qsTr("I'm a card!")
+ anchors.centerIn: parent
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml
index c1b1acce..1fe96121 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-checked.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-foreground.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,8 +27,15 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
-RadioButton {
- text: "Checked"
- checked: true
+Pane {
+ padding: 4
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ Material.foreground: Material.Pink
+}
+//! [1]
}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml
index a332d4c5..6bd91d5d 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-normal.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-theme.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,7 +27,18 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
+import QtQuick.Controls.Material 2.0
-ProgressBar {
- value: 0.5
+Pane {
+ padding: 10
+
+//! [1]
+Pane {
+ Material.theme: Material.Dark
+
+ Button {
+ text: qsTr("Button")
+ }
+}
+//! [1]
}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml
new file mode 100644
index 00000000..f80ebfe2
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollbar-non-attached.qml
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+
+Item {
+ width: 200
+ height: 200
+
+//! [1]
+Rectangle {
+ id: frame
+ clip: true
+ width: 160
+ height: 160
+ border.color: "black"
+ anchors.centerIn: parent
+
+ Text {
+ id: content
+ text: "ABC"
+ font.pixelSize: 160
+ x: -hbar.position * width
+ y: -vbar.position * height
+ }
+
+ ScrollBar {
+ id: vbar
+ hoverEnabled: true
+ active: hovered || pressed
+ orientation: Qt.Vertical
+ size: frame.height / content.height
+ anchors.top: parent.top
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+
+ ScrollBar {
+ id: hbar
+ hoverEnabled: true
+ active: hovered || pressed
+ orientation: Qt.Horizontal
+ size: frame.width / content.width
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: parent.bottom
+ }
+}
+//! [1]
+
+Component.onCompleted: {
+ hbar.active = true
+ vbar.active = true
+}
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml
new file mode 100644
index 00000000..2734f33a
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-scrollindicator-non-attached.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+
+Item {
+ width: 200
+ height: 200
+
+//! [1]
+Rectangle {
+ id: frame
+ clip: true
+ width: 160
+ height: 160
+ border.color: "black"
+ anchors.centerIn: parent
+
+ Text {
+ id: content
+ text: "ABC"
+ font.pixelSize: 169
+
+ MouseArea {
+ id: mouseArea
+ drag.target: content
+ drag.minimumX: frame.width - width
+ drag.minimumY: frame.height - height
+ drag.maximumX: 0
+ drag.maximumY: 0
+ anchors.fill: content
+ }
+ }
+
+ ScrollIndicator {
+ id: verticalIndicator
+ active: mouseArea.pressed
+ orientation: Qt.Vertical
+ size: frame.height / content.height
+ position: -content.y / content.height
+ anchors { top: parent.top; right: parent.right; bottom: parent.bottom }
+ }
+
+ ScrollIndicator {
+ id: horizontalIndicator
+ active: mouseArea.pressed
+ orientation: Qt.Horizontal
+ size: frame.width / content.width
+ position: -content.x / content.width
+ anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
+ }
+}
+//! [1]
+
+Component.onCompleted: {
+ horizontalIndicator.active = true;
+ verticalIndicator.active = true;
+}
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
new file mode 100644
index 00000000..db077057
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+
+//! [1]
+ListView {
+ width: 200
+ height: 300
+ clip: true
+ model: ListModel {
+ id: listModel
+ ListElement { title: "Electricity bill" }
+ ListElement { title: "Happy Birthday!" }
+ ListElement { title: "FW: Cat pictures" }
+ ListElement { title: "Hotel visit receipt" }
+ ListElement { title: "Customer service" }
+ }
+ delegate: SwipeDelegate {
+ id: swipeDelegate
+ text: title
+ width: parent.width
+
+ onClicked: if (swipe.complete) listModel.remove(index)
+
+ swipe.right: Rectangle {
+ color: swipeDelegate.swipe.complete && swipeDelegate.pressed ? "#333" : "#444"
+ width: parent.width
+ height: parent.height
+
+ Label {
+ font.pixelSize: swipeDelegate.font.pixelSize
+ text: qsTr("Remove")
+ color: "white"
+ anchors.centerIn: parent
+ }
+ }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml
new file mode 100644
index 00000000..afcfa87f
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-accent.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ highlighted: true
+ Universal.accent: Universal.Orange
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml
new file mode 100644
index 00000000..32a1b43b
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-background.qml
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
+
+Pane {
+ padding: 10
+
+//! [1]
+Pane {
+ Universal.background: Universal.Steel
+
+ Button {
+ text: qsTr("Button")
+ }
+}
+//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml
index 7ab68910..6ca35d74 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-disabled.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-foreground.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,8 +27,15 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
-RadioButton {
- text: "Disabled"
- enabled: false
+Pane {
+ padding: 10
+
+//! [1]
+Button {
+ text: qsTr("Button")
+ Universal.foreground: Universal.Pink
+}
+//! [1]
}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml
index 81c9f4ac..85e4a406 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-progressbar-disabled.qml
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-universal-theme.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -27,8 +27,18 @@
import QtQuick 2.0
import QtQuick.Controls 2.0
+import QtQuick.Controls.Universal 2.0
-ProgressBar {
- value: 0.5
- enabled: false
+Pane {
+ padding: 10
+
+//! [1]
+Pane {
+ Universal.theme: Universal.Dark
+
+ Button {
+ text: qsTr("Button")
+ }
+}
+//! [1]
}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml
deleted file mode 100644
index 316a4653..00000000
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-focused.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Controls 2.0
-
-RadioButton {
- text: "Focused"
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml
deleted file mode 100644
index b5ea853b..00000000
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-radiobutton-normal.qml
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Controls 2.0
-
-RadioButton {
- text: "Normal"
-}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml
deleted file mode 100644
index bde161aa..00000000
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-disabled.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Controls 2.0
-
-Slider {
- value: 0.5
- enabled: false
-}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml
deleted file mode 100644
index b32f8b5a..00000000
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-focused.qml
+++ /dev/null
@@ -1,34 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Controls 2.0
-
-Slider {
- value: 0.5
- focus: true
-}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml
deleted file mode 100644
index 8363e862..00000000
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-slider-normal.qml
+++ /dev/null
@@ -1,33 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2015 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Free Documentation License Usage
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of
-** this file. Please review the following information to ensure
-** the GNU Free Documentation License version 1.3 requirements
-** will be met: http://www.gnu.org/copyleft/fdl.html.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QtQuick.Controls 2.0
-
-Slider {
- value: 0.5
-}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
index fd6754f8..246f3ae5 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-toolbar.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -29,19 +29,34 @@ import QtQuick 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0
+Item {
+ width: children[0].implicitWidth * 2
+ height: children[0].implicitHeight
+ Binding {
+ target: children[0]
+ property: "width"
+ value: width
+ }
//! [1]
ToolBar {
RowLayout {
anchors.fill: parent
ToolButton {
- text: qsTr("\u25C0 Qt")
+ text: qsTr("‹")
onClicked: stack.pop()
}
- Item { Layout.fillWidth: true }
- Switch {
- checked: true
- text: qsTr("Notifications")
+ Label {
+ text: "Title"
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: qsTr("â‹®")
+ onClicked: menu.open()
}
}
}
//! [1]
+}
diff --git a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
index c85f91bb..146fe477 100644
--- a/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
+++ b/src/imports/controls/doc/snippets/screenshots/qtquickcontrols2-tooltip.qml
@@ -42,10 +42,10 @@ Item {
//! [1]
Button {
- text: qsTr("Button")
+ text: qsTr("Save")
- ToolTip.visible: pressed
- ToolTip.text: qsTr("A descriptive tool tip of what the button does")
+ ToolTip.visible: down
+ ToolTip.text: qsTr("Save the active project")
}
//! [1]
}
diff --git a/src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc b/src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc
new file mode 100644
index 00000000..02d92de0
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickcontrol-background.qdocinc
@@ -0,0 +1,13 @@
+//! [notes]
+
+\note If the background item has no explicit size specified, it automatically
+ follows the control's size. In most cases, there is no need to specify
+ width or height for a background item.
+
+\note Most controls use the implicit size of the background item to calculate
+the implicit size of the control itself. If you replace the background item
+with a custom one, you should also consider providing a sensible implicit
+size for it (unless it is an item like \l Image which has its own implicit
+size).
+
+//! [notes]
diff --git a/src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc b/src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc
new file mode 100644
index 00000000..b69e9e60
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickcontrol-focusreason.qdocinc
@@ -0,0 +1,15 @@
+This property holds the reason of the last focus change.
+
+\note This property does not indicate whether the control has \l {Item::activeFocus}
+ {active focus}, but the reason why the control either gained or lost focus.
+
+\value Qt.MouseFocusReason A mouse action occurred.
+\value Qt.TabFocusReason The Tab key was pressed.
+\value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
+\value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
+\value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
+\value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
+\value Qt.MenuBarFocusReason The menu bar took focus.
+\value Qt.OtherFocusReason Another reason, usually application-specific.
+
+\sa Item::activeFocus
diff --git a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
new file mode 100644
index 00000000..c5d94279
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
@@ -0,0 +1,63 @@
+//! [conf]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c Theme
+ \li Specifies the default \l {material-theme-attached-prop}{Material theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c Accent
+ \li Specifies the default \l {material-accent-attached-prop}{Material accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "Teal".
+ \row
+ \li \c Primary
+ \li Specifies the default \l {material-primary-attached-prop}{Material primary color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "BlueGrey".
+ \row
+ \li \c Foreground
+ \li Specifies the default \l {material-foreground-attached-prop}{Material foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Brown".
+ \row
+ \li \c Background
+ \li Specifies the default \l {material-background-attached-prop}{Material background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Grey".
+\endtable
+//! [conf]
+
+//! [env]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_THEME
+ \li Specifies the default \l {material-theme-attached-prop}{Material theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_ACCENT
+ \li Specifies the default \l {material-accent-attached-prop}{Material accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "Teal".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_PRIMARY
+ \li Specifies the default \l {material-primary-attached-prop}{Material primary color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Material colors}, for example \c "BlueGrey".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_FOREGROUND
+ \li Specifies the default \l {material-foreground-attached-prop}{Material foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Brown".
+ \row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_BACKGROUND
+ \li Specifies the default \l {material-background-attached-prop}{Material background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Material colors},
+ for example \c "Grey".
+\endtable
+//! [env]
diff --git a/src/imports/controls/doc/src/includes/qquickswitch.qdocinc b/src/imports/controls/doc/src/includes/qquickswitch.qdocinc
index 32ccbb89..985f85d9 100644
--- a/src/imports/controls/doc/src/includes/qquickswitch.qdocinc
+++ b/src/imports/controls/doc/src/includes/qquickswitch.qdocinc
@@ -2,7 +2,7 @@
This property holds the logical position of the thumb indicator.
-The position is defined as a percentage of the indicator's size, scaled to
+The position is expressed as a fraction of the indicator's size, in the range
\c 0.0 - \c 1.0. The position can be used for example to determine whether
the thumb has been dragged past the halfway point. For visualizing a thumb
indicator, the right-to-left aware \l visualPosition should be used instead.
@@ -16,7 +16,7 @@ indicator, the right-to-left aware \l visualPosition should be used instead.
This property holds the visual position of the thumb indicator.
-The position is defined as a percentage of the indicator's size, scaled to
+The position is expressed as a fraction of the indicator's size, in the range
\c 0.0 - \c 1.0. When the control is \l {Control::mirrored}{mirrored}, the
value is equal to \c {1.0 - position}. This makes the value suitable for
visualizing the thumb indicator taking right-to-left support into account.
diff --git a/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc
new file mode 100644
index 00000000..a7ecbaef
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickuniversalstyle.qdocinc
@@ -0,0 +1,53 @@
+//! [conf]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c Theme
+ \li Specifies the default \l {universal-theme-attached-prop}{Universal theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c Accent
+ \li Specifies the default \l {universal-accent-attached-prop}{Universal accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Universal colors}, for example \c "Violet".
+ \row
+ \li \c Foreground
+ \li Specifies the default \l {universal-foreground-attached-prop}{Universal foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Brown".
+ \row
+ \li \c Background
+ \li Specifies the default \l {universal-background-attached-prop}{Universal background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Steel".
+\endtable
+//! [conf]
+
+//! [env]
+\table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_THEME
+ \li Specifies the default \l {universal-theme-attached-prop}{Universal theme}.
+ The value can be one of the available themes, for example \c "Dark".
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_ACCENT
+ \li Specifies the default \l {universal-accent-attached-prop}{Universal accent color}.
+ The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
+ one of the \l {pre-defined Universal colors}, for example \c "Violet".
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND
+ \li Specifies the default \l {universal-foreground-attached-prop}{Universal foreground color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Brown".
+ \row
+ \li \c QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND
+ \li Specifies the default \l {universal-background-attached-prop}{Universal background color}.
+ The value can be any \l {colorbasictypedocs}{color}, or one of the \l {pre-defined Universal colors},
+ for example \c "Steel".
+\endtable
+//! [env]
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
index d6a9ac78..5e2c9370 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-buttons.qdoc
@@ -66,7 +66,7 @@
\section1 CheckBox Control
- \image qtquickcontrols2-checkbox.png
+ \image qtquickcontrols2-checkbox.gif
\l CheckBox is used to build multi-selection option lists. Any number of
options can be selected, including none, but the options should
@@ -102,7 +102,7 @@
\section1 RadioButton Control
- \image qtquickcontrols2-radiobutton.png
+ \image qtquickcontrols2-radiobutton.gif
\l RadioButton is used to select only one option from a set of options.
Selecting one option automatically deselects the one selected before.
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
new file mode 100644
index 00000000..29bfc99c
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-configuration.html
+ \title Qt Quick Controls 2 Configuration File
+
+ Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf,
+ that is built into an application's resources.
+
+ The configuration file can specify the preferred style and certain style-specific
+ attributes. The following example specifies that the preferred style is the \l {Material style}.
+ Furthermore, when the application is run with the Material style, its theme is light and the
+ accent and primary colors are teal and blue grey, respectively. However, if the application
+ is run with the \l {Universal style} instead, the theme is dark and the accent color is red.
+
+ \code
+ [Controls]
+ Style=Material
+
+ [Universal]
+ Theme=Dark
+ Accent=Red
+
+ [Material]
+ Theme=Light
+ Accent=Teal
+ Primary=BlueGrey
+ \endcode
+
+ \l {Material style} specific values that can be specified in a \c Material
+ section of the configuration file:
+
+ \include qquickmaterialstyle.qdocinc conf
+
+ \l {Universal style} specific values that can be specified in a \c Universal
+ section of the configuration file:
+
+ \include qquickuniversalstyle.qdocinc conf
+
+ In order to make it possible for Qt Quick Controls 2 to find the configuration file,
+ it must be built into application's resources using the \l {The Qt Resource System}.
+ Here's an example \c .qrc file:
+
+ \code
+ <!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/">
+ <file>qtquickcontrols2.conf</file>
+ </qresource>
+ </RCC>
+ \endcode
+
+ \note Qt Quick Controls 2 uses a file selector to load the configuration file. It
+ is possible to provide a different configuration file for different platforms and
+ locales. See \l QFileSelector documentation for more details.
+
+ Finally, the \c .qrc file must be listed in the application's \c .pro file so that
+ the build system knows about it. For example:
+
+ \code
+ RESOURCES = application.qrc
+ \endcode
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \li \l{Supported Environment Variables in Qt Quick Controls 2}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index f37519de..71ffe350 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -335,6 +335,38 @@
\l {Customizing a Control} section. The code can be used as a starting
point to implement a custom look and feel.
+ \section2 Customizing ApplicationWindow
+
+ ApplicationWindow consists of one visual item:
+ \l {ApplicationWindow::background}{background}. It is also possible
+ to customize the \l {ApplicationWindow::overlay}{modal} and
+ \l {ApplicationWindow::overlay}{modeless} items.
+
+ \code
+ import QtQuick 2.7
+ import QtQuick.Controls 2.0
+
+ ApplicationWindow {
+ visible: true
+
+ background: Rectangle {
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#ffffff" }
+ GradientStop { position: 1; color: "#c1bbf9" }
+ }
+ }
+
+ overlay.modal: Rectangle {
+ color: "#8f28282a"
+ }
+
+ overlay.modeless: Rectangle {
+ color: "#2f28282a"
+ }
+ }
+ \endcode
+
+
\section2 Customizing BusyIndicator
BusyIndicator consists of two visual items: \l {Control::background}{background}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
index 45ea7db7..a85890f5 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-differences.qdoc
@@ -109,20 +109,20 @@
\li Yes
\li No
\row
- \li Runtime style changes
- \li Yes
- \li Yes
+ \li Runtime style/theme changes
+ \li Yes \sup 1
+ \li Yes \sup 2
\row
\li Can be used on Desktop
\li Yes
- \li Yes \b *
+ \li Yes \sup 3
\row
\li Can be used on Mobile
- \li Yes
+ \li Yes \sup 4
\li Yes
\row
\li Can be used on Embedded
- \li Yes
+ \li Yes \sup 4
\li Yes
\row
\li Internal event handling
@@ -130,7 +130,12 @@
\li C++
\endtable
- \b {* No hover effects}
+ \list 1
+ \li Not officially supported, but technically possible via private APIs
+ \li Only themes for specific styles can be changed at runtime, styles are fixed
+ \li No hover effects
+ \li Performance may not be optimal
+ \endlist
\section2 Porting Qt Quick Controls Code
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
new file mode 100644
index 00000000..7c1b1c16
--- /dev/null
+++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtquickcontrols2-environment.html
+ \title Supported Environment Variables in Qt Quick Controls 2
+
+ This page contains a list of all environment variables that Qt Quick Controls 2
+ supports. The environment variables are primarily meant for testing purposes, but
+ they can also be used to set system-wide defaults.
+
+ \table
+ \header
+ \li Variable
+ \li Description
+ \row
+ \li \c QT_QUICK_CONTROLS_STYLE
+ \li Specifies the default \l {Styling Qt Quick Controls 2}{Qt Quick Controls 2 style}.
+ The value can be either one of the built-in styles, for example \c "Material",
+ or the path to a custom style such as \c ":/mystyle".
+ \row
+ \li \c QT_QUICK_CONTROLS_CONF
+ \li Specifies the location of the \l {Qt Quick Controls 2 configuration file}.
+ By default, the configuration file is loaded from the application's
+ resources in \c ":/qtquickcontrols2.conf".
+ \endtable
+
+ \l {Material style} specific environment variables:
+
+ \include qquickmaterialstyle.qdocinc env
+
+ \l {Universal style} specific environment variables:
+
+ \include qquickuniversalstyle.qdocinc env
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Quick Controls 2}
+ \li \l{Qt Quick Controls 2 Configuration File}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
index de3d0c37..cdb20a27 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -69,6 +69,8 @@
\li \l{Using File Selectors with Qt Quick Controls 2}
\li \l{Differences between Qt Quick Controls}
\li \l{Deploying Qt Quick Controls 2 Applications}
+ \li \l{Qt Quick Controls 2 Configuration File}
+ \li \l{Supported Environment Variables in Qt Quick Controls 2}
\endlist
\section1 Reference
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc
index 47e6be82..84367278 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-indicators.qdoc
@@ -52,6 +52,13 @@
\l BusyIndicator can be used to show that an operation is in progress,
and that the UI has to wait for the operation to complete.
+ \section1 ProgressBar Control
+
+ \image qtquickcontrols2-progressbar.gif
+
+ \l ProgressBar indicates the progress of an operation. The value should be
+ updated regularly.
+
\section1 ScrollBar Control
\image qtquickcontrols2-scrollbar.gif
@@ -62,7 +69,7 @@
\section1 ScrollIndicator Control
- \image qtquickcontrols2-scrollindicator.png
+ \image qtquickcontrols2-scrollindicator.gif
\l ScrollIndicator is a non-interactive indicator that indicates the
current scroll position, and can be used to scroll to a specific position in a
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
index 70d5f54c..ce7b6aa4 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
@@ -42,7 +42,7 @@
\section1 ComboBox Control
- \image qtquickcontrols2-combobox.png
+ \image qtquickcontrols2-combobox.gif
\l ComboBox is used to select a value from a static multiple-line drop-down list.
It is not possible to add new values, and only one option can be selected.
@@ -85,7 +85,7 @@
\section1 Slider Control
- \image qtquickcontrols2-slider.png
+ \image qtquickcontrols2-slider.gif
\l Slider is used to select a value by sliding a handle along a track.
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
index a90581ec..9842fee6 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -79,28 +79,6 @@
\image qtquickcontrols2-material-attributes.png
- The following example illustrates how to create a red \e stop button with light text:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import QtQuick.Controls 2.0
- import QtQuick.Controls.Material 2.0
-
- Button {
- text: "Stop"
- highlighted: true
-
- Material.accent: Material.Red
- Material.theme: Material.Dark
- }
- \endqml
- \li
- \image qtquickcontrols2-material-button.png
- \endtable
-
All attributes can be specified for any window or item, and they automatically
propagate to children in the same manner as \l {Control::font}{fonts}. In the
following example, the window and all three radio buttons appear in the dark
@@ -134,37 +112,22 @@
\endtable
In addition to specifying the attributes in QML, it is also possible to
- specify them via environment variables or in a \l {qtquickcontrols2-conf}
- {configuration file}. Attributes specified in QML take precedence over all
- other methods.
+ specify them via environment variables or in a configuration file. Attributes
+ specified in QML take precedence over all other methods.
+
+ \section3 Configuration File
+
+ \include qquickmaterialstyle.qdocinc conf
+
+ See \l {Qt Quick Controls 2 Configuration File} for more details about the
+ configuration file.
\section3 Environment Variables
- \table
- \header
- \li Variable
- \li Description
- \row
- \li \c QT_QUICK_CONTROLS_MATERIAL_THEME
- \li The value can be one of the available \l {material-theme-attached-prop}{themes},
- for example \c "Dark".
- \row
- \li \c QT_QUICK_CONTROLS_MATERIAL_ACCENT
- \li The value can be any \l {colorbasictypedocs}{color}, but it is recommended
- to use one of the \l {pre-defined Material colors}, for example \c "Teal".
- \row
- \li \c QT_QUICK_CONTROLS_MATERIAL_PRIMARY
- \li The value can be any \l {colorbasictypedocs}{color}, but it is recommended
- to use one of the \l {pre-defined Material colors}, for example \c "BlueGrey".
- \row
- \li \c QT_QUICK_CONTROLS_MATERIAL_FOREGROUND
- \li The value can be any \l {colorbasictypedocs}{color}, or one of the
- \l {pre-defined Material colors}.
- \row
- \li \c QT_QUICK_CONTROLS_MATERIAL_BACKGROUND
- \li The value can be any \l {colorbasictypedocs}{color}, or one of the
- \l {pre-defined Material colors}.
- \endtable
+ \include qquickmaterialstyle.qdocinc env
+
+ See \l {Supported Environment Variables in Qt Quick Controls 2} for the full
+ list of supported environment variables.
\section2 Dependency
@@ -263,6 +226,17 @@
The default value is \c Material.Pink.
+ In the following example, the accent color of the highlighted button is
+ changed to \c Material.Orange:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-accent.qml 1
+ \li
+ \image qtquickcontrols2-material-accent.png
+ \endtable
+
\note Even though the accent can be any \l {colorbasictypedocs}{color}, it is
recommended to use one of the \l {pre-defined Material colors} that have been
designed to work well with the rest of the Material style palette.
@@ -276,6 +250,17 @@
The default value is theme-specific (light or dark).
+ In the following example, the background color of the button is changed to
+ \c Material.Teal:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-background.qml 1
+ \li
+ \image qtquickcontrols2-material-background.png
+ \endtable
+
\endstyleproperty
\styleproperty {Material.elevation} {int} {material-elevation-attached-prop}
@@ -286,6 +271,18 @@
The default value is control-specific.
+ In the following example, the elevation of the pane is set to \c 6
+ in order to achieve the look of an
+ \l {https://material.google.com/components/cards.html}{elevated card}:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-elevation.qml 1
+ \li
+ \image qtquickcontrols2-material-elevation.png
+ \endtable
+
\endstyleproperty
\styleproperty {Material.foreground} {color} {material-foreground-attached-prop}
@@ -295,6 +292,17 @@
The default value is theme-specific (light or dark).
+ In the following example, the foreground color of the button is set to \c
+ Material.Pink:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-foreground.qml 1
+ \li
+ \image qtquickcontrols2-material-foreground.png
+ \endtable
+
\endstyleproperty
\styleproperty {Material.primary} {color} {material-primary-attached-prop}
@@ -302,6 +310,8 @@
This attached property holds the primary color of the theme. The property
can be attached to any window or item. The value is propagated to children.
+ The primary color is used as the background color of ToolBar by default.
+
The default value is \c Material.Indigo.
\note Even though the primary can be any \l {colorbasictypedocs}{color}, it is
@@ -319,6 +329,17 @@
\value Material.Light Light theme (default)
\value Material.Dark Dark theme
+ In the following example, the theme for both the pane and the button is set
+ to \c Material.Dark:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-material-theme.qml 1
+ \li
+ \image qtquickcontrols2-material-theme.png
+ \endtable
+
\endstyleproperty
\section1 Attached Method Documentation
@@ -331,9 +352,6 @@
defaults to \c Material.Shade500.
\qml
- import QtQuick 2.0
- import QtQuick.Controls.Material 2.0
-
Rectangle {
color: Material.color(Material.Red)
}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
index d63cbe69..d9c03ec3 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -83,28 +83,15 @@
\section2 Using QQuickStyle in C++
- \l QQuickStyle provides API for configuring a specific style. The following
+ \l QQuickStyle provides C++ API for configuring a specific style. The following
example runs a Qt Quick Controls 2 application with the Material style:
\code
- #include <QGuiApplication>
- #include <QQmlApplicationEngine>
- #include <QQuickStyle>
-
- int main(int argc, char *argv[])
- {
- QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
- QGuiApplication app(argc, argv);
-
- QQuickStyle::setStyle("Material");
-
- QQmlApplicationEngine engine;
- engine.load(QUrl("qrc:/main.qml"));
-
- return app.exec();
- }
+ QQuickStyle::setStyle("Material");
\endcode
+ See the detailed description of \l QQuickStyle for more details.
+
\section2 Command line argument
Passing a \c -style command line argument is the convenient way to test different
@@ -126,55 +113,25 @@
QT_QUICK_CONTROLS_STYLE=universal ./app
\endcode
+ See \l {Supported Environment Variables in Qt Quick Controls 2} for the full list
+ of supported environment variables.
+
\section2 Configuration file
- \target qtquickcontrols2-conf
Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf,
that is built into an application's resources.
The configuration file can specify the preferred style (may be overridden by either
of the methods described earlier) and certain style-specific attributes. The following
- example specifies that the preferred style is the Material style. Furthermore, when the
- application is run with the Material style, its theme is light and the accent and primary
- colors are teal and blue grey, respectively. However, if the application is run with the
- Universal style instead, the theme is dark and the accent color is red.
+ example specifies that the preferred style is the Material style.
\code
[Controls]
Style=Material
-
- [Universal]
- Theme=Dark
- Accent=Red
-
- [Material]
- Theme=Light
- Accent=Teal
- Primary=BlueGrey
\endcode
- In order to make it possible for Qt Quick Controls 2 to find the configuration file,
- it must be built into application's resources using the \l {The Qt Resource System}.
- Here's an example \c .qrc file:
-
- \code
- <!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/">
- <file>qtquickcontrols2.conf</file>
- </qresource>
- </RCC>
- \endcode
-
- \note Qt Quick Controls 2 uses a file selector to load the configuration file. It
- is possible to provide a different configuration file for different platforms and
- locales. See \l QFileSelector documentation for more details.
-
- Finally, the \c .qrc file must be listed in the application's \c .pro file so that
- the build system knows about it. For example:
-
- \code
- RESOURCES = application.qrc
- \endcode
+ See \l {Qt Quick Controls 2 Configuration File} for more details about the
+ configuration file.
\section1 Related Information
\list
@@ -183,5 +140,7 @@
\li \l {Universal Style}
\li \l{Using File Selectors with Qt Quick Controls 2}
\li \l {Deploying Qt Quick Controls 2 Applications}
+ \li \l {Qt Quick Controls 2 Configuration File}
+ \li \l {Supported Environment Variables in Qt Quick Controls 2}
\endlist
*/
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
index 02dc93c9..c0e2daee 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -78,28 +78,6 @@
\image qtquickcontrols2-universal-attributes.png
- The following example illustrates how to create a red \e stop button with light text:
-
- \table
- \row
- \li
- \qml
- import QtQuick 2.0
- import QtQuick.Controls 2.0
- import QtQuick.Controls.Universal 2.0
-
- Button {
- text: "Stop"
- highlighted: true
-
- Universal.accent: Universal.Red
- Universal.theme: Universal.Dark
- }
- \endqml
- \li
- \image qtquickcontrols2-universal-button.png
- \endtable
-
Both attributes can be specified for any window or item, and they automatically
propagate to children in the same manner as \l {Control::font}{fonts}. In the
following example, the window and all three radio buttons appear in the dark
@@ -133,33 +111,22 @@
\endtable
In addition to specifying the attributes in QML, it is also possible to
- specify them via environment variables or in a \l {qtquickcontrols2-conf}
- {configuration file}. Attributes specified in QML take precedence over all
- other methods.
+ specify them via environment variables or in a configuration file. Attributes
+ specified in QML take precedence over all other methods.
+
+ \section3 Configuration File
+
+ \include qquickuniversalstyle.qdocinc conf
+
+ See \l {Qt Quick Controls 2 Configuration File} for more details about the
+ configuration file.
\section3 Environment Variables
- \table
- \header
- \li Variable
- \li Description
- \row
- \li \c QT_QUICK_CONTROLS_UNIVERSAL_THEME
- \li The value can be one of the available \l {universal-theme-attached-prop}{themes},
- for example \c "Dark".
- \row
- \li \c QT_QUICK_CONTROLS_UNIVERSAL_ACCENT
- \li The value can be any \l {colorbasictypedocs}{color}, but it is recommended
- to use one of the \l {pre-defined Universal colors}, for example \c "Violet".
- \row
- \li \c QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND
- \li The value can be any \l {colorbasictypedocs}{color}, or one of the
- \l {pre-defined Universal colors}.
- \row
- \li \c QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND
- \li The value can be any \l {colorbasictypedocs}{color}, or one of the
- \l {pre-defined Universal colors}.
- \endtable
+ \include qquickuniversalstyle.qdocinc env
+
+ See \l {Supported Environment Variables in Qt Quick Controls 2} for the full
+ list of supported environment variables.
\section2 Dependency
@@ -209,8 +176,21 @@
This attached property holds the accent color of the theme. The property
can be attached to any window or item. The value is propagated to children.
+ The default value is \c Universal.Cobalt.
+
+ In the following example, the accent color of the highlighted button is
+ changed to \c Universal.Orange:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-accent.qml 1
+ \li
+ \image qtquickcontrols2-universal-accent.png
+ \endtable
+
\note Even though the accent can be any \l {colorbasictypedocs}{color}, it is
- recommended to use one of the \l {pre-defined Universal colors} that have been
+ recommended to use one of the \l {pre-defined Universal colors} that have been
designed to work well with the rest of the Universal style palette.
\endstyleproperty
@@ -222,6 +202,17 @@
The default value is theme-specific (light or dark).
+ In the following example, the background color of the pane is changed to
+ \c Universal.Steel:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-background.qml 1
+ \li
+ \image qtquickcontrols2-universal-background.png
+ \endtable
+
\endstyleproperty
\styleproperty {Universal.foreground} {color} {universal-foreground-attached-prop}
@@ -231,6 +222,17 @@
The default value is theme-specific (light or dark).
+ In the following example, the foreground color of the button is set to \c
+ Universal.Pink:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-foreground.qml 1
+ \li
+ \image qtquickcontrols2-universal-foreground.png
+ \endtable
+
\styleproperty {Universal.theme} {enumeration} {universal-theme-attached-prop}
\target universal-theme-attached-prop
This attached property holds whether the theme is light or dark. The property
@@ -240,6 +242,17 @@
\value Universal.Light Light theme (default)
\value Universal.Dark Dark theme
+ In the following example, the theme for both the pane and the button is set
+ to \c Universal.Dark:
+
+ \table
+ \row
+ \li
+ \snippet qtquickcontrols2-universal-theme.qml 1
+ \li
+ \image qtquickcontrols2-universal-theme.png
+ \endtable
+
\endstyleproperty
\section1 Attached Method Documentation
@@ -250,9 +263,6 @@
\l {pre-defined Universal colors}{pre-defined Universal color}.
\qml
- import QtQuick 2.0
- import QtQuick.Controls.Universal 2.0
-
Rectangle {
color: Universal.color(Universal.Red)
}
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 05981baa..183bcef9 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -54,7 +54,10 @@ T.ComboBox {
baselineOffset: contentItem.y + contentItem.baselineOffset
spacing: 6
- padding: 16
+ // external vertical padding is 6 (to increase touch area)
+ padding: 12
+ leftPadding: padding - 4
+ rightPadding: padding - 4
// Don't use toolTextColor, as that is often white when we have a white background.
Material.foreground: Material.foreground === Material.toolTextColor ? undefined : Material.foreground
@@ -89,6 +92,9 @@ T.ComboBox {
implicitWidth: 120
implicitHeight: 48
+ // external vertical padding is 6 (to increase touch area)
+ y: 6
+ height: parent.height - 12
radius: 2
color: control.Material.dialogColor
diff --git a/src/imports/controls/material/images/drop-indicator.png b/src/imports/controls/material/images/drop-indicator.png
index b4396ec6..08bb4855 100644
--- a/src/imports/controls/material/images/drop-indicator.png
+++ b/src/imports/controls/material/images/drop-indicator.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator.svg b/src/imports/controls/material/images/drop-indicator.svg
new file mode 100644
index 00000000..94b5ca15
--- /dev/null
+++ b/src/imports/controls/material/images/drop-indicator.svg
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" version="1.1">
+ <path d="M7,10l5,5,5-5z" fill="#757575"/>
+</svg>
diff --git a/src/imports/controls/material/images/drop-indicator@2x.png b/src/imports/controls/material/images/drop-indicator@2x.png
index 1c711bc2..ccdfc2b1 100644
--- a/src/imports/controls/material/images/drop-indicator@2x.png
+++ b/src/imports/controls/material/images/drop-indicator@2x.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator@3x.png b/src/imports/controls/material/images/drop-indicator@3x.png
index 06dd8bd2..00cae691 100644
--- a/src/imports/controls/material/images/drop-indicator@3x.png
+++ b/src/imports/controls/material/images/drop-indicator@3x.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator@4x.png b/src/imports/controls/material/images/drop-indicator@4x.png
index b2157c30..0a61cb01 100644
--- a/src/imports/controls/material/images/drop-indicator@4x.png
+++ b/src/imports/controls/material/images/drop-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 6c6a0e3e..1c19bbd3 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -400,6 +400,10 @@ static const QRgb hintTextColorLight = 0x60000000;
static const QRgb hintTextColorDark = 0x4CFFFFFF;
static const QRgb dividerColorLight = 0x1E000000;
static const QRgb dividerColorDark = 0x1EFFFFFF;
+static const QRgb iconColorLight = 0x89000000;
+static const QRgb iconColorDark = 0xFFFFFFFF;
+static const QRgb iconDisabledColorLight = 0x42000000;
+static const QRgb iconDisabledColorDark = 0x4CFFFFFF;
static const QRgb raisedButtonColorLight = 0xFFD6D7D7;
static const QRgb raisedButtonColorDark = 0x3FCCCCCC;
static const QRgb raisedButtonDisabledColorLight = dividerColorLight;
@@ -863,6 +867,16 @@ QColor QQuickMaterialStyle::dividerColor() const
return QColor::fromRgba(m_theme == Light ? dividerColorLight : dividerColorDark);
}
+QColor QQuickMaterialStyle::iconColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? iconColorLight : iconColorDark);
+}
+
+QColor QQuickMaterialStyle::iconDisabledColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? iconDisabledColorLight : iconDisabledColorDark);
+}
+
QColor QQuickMaterialStyle::buttonColor(bool highlighted, bool pressed, bool hover) const
{
Shade shade = pressed ? (m_theme == Light ? Shade700 : Shade100)
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 6a841803..af5638f1 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -74,6 +74,8 @@ class QQuickMaterialStyle : public QQuickStyleAttached
Q_PROPERTY(QColor textSelectionColor READ textSelectionColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dropShadowColor READ dropShadowColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor dividerColor READ dividerColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor iconColor READ iconColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor iconDisabledColor READ iconDisabledColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor buttonColor READ buttonColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor buttonHoverColor READ buttonHoverColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor buttonPressColor READ buttonPressColor NOTIFY paletteChanged FINAL)
@@ -201,6 +203,8 @@ public:
QColor textSelectionColor() const;
QColor dropShadowColor() const;
QColor dividerColor() const;
+ QColor iconColor() const;
+ QColor iconDisabledColor() const;
QColor buttonColor() const;
QColor buttonHoverColor() const;
QColor buttonPressColor() const;
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index 0d2f8a70..1967a74b 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -45,15 +45,15 @@ QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
QFont font;
- font.setFamily(QStringLiteral("Roboto"));
+ font.setFamily(QLatin1String("Roboto"));
QString family = QFontInfo(font).family();
- if (family != QStringLiteral("Roboto")) {
- font.setFamily(QStringLiteral("Noto"));
+ if (family != QLatin1String("Roboto")) {
+ font.setFamily(QLatin1String("Noto"));
family = QFontInfo(font).family();
}
- if (family == QStringLiteral("Roboto") || family == QStringLiteral("Noto")) {
+ if (family == QLatin1String("Roboto") || family == QLatin1String("Noto")) {
systemFont.setFamily(family);
buttonFont.setFamily(family);
toolTipFont.setFamily(family);
diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp
index 51642c4a..dc516b45 100644
--- a/src/imports/controls/universal/qquickuniversaltheme.cpp
+++ b/src/imports/controls/universal/qquickuniversaltheme.cpp
@@ -44,8 +44,8 @@ QT_BEGIN_NAMESPACE
QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
- const QFont font(QStringLiteral("Segoe UI"));
- if (QFontInfo(font).family() == QStringLiteral("Segoe UI")) {
+ const QFont font(QLatin1String("Segoe UI"));
+ if (QFontInfo(font).family() == QLatin1String("Segoe UI")) {
const QString family = font.family();
systemFont.setFamily(family);
groupBoxTitleFont.setFamily(family);
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index b0ec18d3..e93b80c7 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -65,9 +65,11 @@
#include <QtQuickTemplates2/private/qquickrangeslider_p.h>
#include <QtQuickTemplates2/private/qquickscrollbar_p.h>
#include <QtQuickTemplates2/private/qquickscrollindicator_p.h>
+#include <QtQuickTemplates2/private/qquickshortcutcontext_p_p.h>
#include <QtQuickTemplates2/private/qquickslider_p.h>
#include <QtQuickTemplates2/private/qquickspinbox_p.h>
#include <QtQuickTemplates2/private/qquickstackview_p.h>
+#include <QtQuickTemplates2/private/qquickswipe_p.h>
#include <QtQuickTemplates2/private/qquickswipedelegate_p.h>
#include <QtQuickTemplates2/private/qquickswipeview_p.h>
#include <QtQuickTemplates2/private/qquickswitch_p.h>
@@ -88,6 +90,11 @@ static inline void initResources()
#endif
}
+// qtdeclarative/src/quick/util/qquickshortcut.cpp
+typedef bool (*ShortcutContextMatcher)(QObject *, Qt::ShortcutContext);
+extern ShortcutContextMatcher qt_quick_shortcut_context_matcher();
+extern void qt_quick_set_shortcut_context_matcher(ShortcutContextMatcher matcher);
+
QT_BEGIN_NAMESPACE
class QtQuickTemplates2Plugin: public QQmlExtensionPlugin
@@ -97,12 +104,25 @@ class QtQuickTemplates2Plugin: public QQmlExtensionPlugin
public:
QtQuickTemplates2Plugin(QObject *parent = nullptr);
+ ~QtQuickTemplates2Plugin();
+
void registerTypes(const char *uri);
+
+private:
+ ShortcutContextMatcher originalContextMatcher;
};
QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent) : QQmlExtensionPlugin(parent)
{
initResources();
+
+ originalContextMatcher = qt_quick_shortcut_context_matcher();
+ qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher);
+}
+
+QtQuickTemplates2Plugin::~QtQuickTemplates2Plugin()
+{
+ qt_quick_set_shortcut_context_matcher(originalContextMatcher);
}
void QtQuickTemplates2Plugin::registerTypes(const char *uri)
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index f432eded..143f599a 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -40,6 +40,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qdebug.h>
#include <QtCore/qsettings.h>
+#include <QtCore/qlibraryinfo.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtQml/private/qqmlmetatype_p.h>
#include <QtQml/qqmlengine.h>
@@ -49,7 +50,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QQuickStyle
- \brief The QQQuickStyle class allows configuring the application style.
+ \brief The QQuickStyle class allows configuring the application style.
\inmodule QtQuickControls2
\since 5.7
@@ -82,6 +83,23 @@ QT_BEGIN_NAMESPACE
\sa {Styling Qt Quick Controls 2}
*/
+// TODO: QQmlImportDatabase::defaultImportPathList()
+static QStringList defaultImportPathList()
+{
+ QStringList importPaths;
+ importPaths.reserve(3);
+ importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+ const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
+ importPaths += QString::fromLatin1(envImportPath).split(QDir::listSeparator(), QString::SkipEmptyParts);
+ }
+
+ importPaths += QStringLiteral("qrc:/qt-project.org/imports");
+ importPaths += QCoreApplication::applicationDirPath();
+ return importPaths;
+}
+
struct QQuickStyleSpec
{
QQuickStyleSpec() : resolved(false) { }
@@ -125,7 +143,7 @@ struct QQuickStyleSpec
if (QGuiApplication::instance()) {
if (!style.contains(QLatin1Char('/'))) {
const QString targetPath = QStringLiteral("QtQuick/Controls.2");
- const QStringList importPaths = QQmlEngine().importPathList();
+ const QStringList importPaths = defaultImportPathList();
for (const QString &importPath : importPaths) {
QDir importDir(importPath);
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 7e8c6ced..75854d04 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -56,7 +56,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief Base type of all button controls.
+ \brief Abstract base type providing functionality common to buttons.
AbstractButton provides the interface for controls with button-like
behavior; for example, push buttons and checkable controls like
@@ -527,7 +527,7 @@ void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
QQuickControl::mouseMoveEvent(event);
setPressed(d->keepPressed || contains(event->pos()));
- if (d->autoRepeat)
+ if (!d->pressed && d->autoRepeat)
d->stopPressRepeat();
else if (d->holdTimer > 0 && (!d->pressed || QLineF(d->pressPoint, event->localPos()).length() > QGuiApplication::styleHints()->startDragDistance()))
d->stopPressAndHold();
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 67fcd78b..3a454353 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
- \brief Provides a top-level application window.
+ \brief Styled top-level window with support for a header and footer.
ApplicationWindow is a \l Window which makes it convenient to add
a \l header and \l footer item to the window.
@@ -89,11 +89,46 @@ QT_BEGIN_NAMESPACE
ApplicationWindow supports popups via its \l overlay property, which
ensures that popups are displayed above other content and that the
- background is dimmed when a modal popup is visible.
+ background is dimmed when a \l {Popup::}{modal} or \l {Popup::dim}
+ {dimmed} popup is visible.
\note By default, an ApplicationWindow is not visible.
- \sa Page, {Container Controls}
+ \section2 Attached ApplicationWindow Properties
+
+ Due to how \l {Scope and Naming Resolution} works in QML, it is possible
+ to reference the \c id of the application root element anywhere in its
+ child QML objects. Even though this approach is fine for many applications
+ and use cases, for a generic QML component it may not be acceptable as it
+ creates a dependency to the surrounding environment.
+
+ ApplicationWindow provides a set of attached properties that can be used
+ to access the window and its building blocks from places where no direct
+ access to the window is available, without creating a dependency to a
+ certain window \c id. A QML component that uses the ApplicationWindow
+ attached properties works in any window regardless of its \c id. The
+ following example uses the attached \c overlay property to position the
+ popup to the center of the window, despite the position of the button
+ that opens the popup.
+
+ \code
+ Button {
+ onClicked: popup.open()
+
+ Popup {
+ id: popup
+
+ parent: ApplicationWindow.overlay
+
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 100
+ height: 100
+ }
+ }
+ \endcode
+
+ \sa {Customizing ApplicationWindow}, Page, {Container Controls}
*/
class QQuickApplicationWindowPrivate : public QQuickItemChangeListener
@@ -274,9 +309,15 @@ QQuickApplicationWindow::~QQuickApplicationWindow()
The background item is stacked under the \l {contentItem}{content item},
but above the \l {Window::color}{background color} of the window.
+ The background item is useful for images and gradients, for example,
+ but the \l {Window::}{color} property is preferable for solid colors,
+ as it doesn't need to create an item.
+
\note If the background item has no explicit size specified, it automatically
follows the control's size. In most cases, there is no need to specify
width or height for a background item.
+
+ \sa {Customizing ApplicationWindow}, contentItem, header, footer, overlay
*/
QQuickItem *QQuickApplicationWindow::background() const
{
@@ -308,6 +349,14 @@ void QQuickApplicationWindow::setBackground(QQuickItem *background)
This property holds the window header item. The header item is positioned to
the top, and resized to the width of the window. The default value is \c null.
+ \code
+ ApplicationWindow {
+ header: TabBar {
+ // ...
+ }
+ }
+ \endcode
+
\note Assigning a ToolBar or TabBar as a window header sets the respective
\l ToolBar::position or \l TabBar::position property automatically to \c Header.
@@ -354,6 +403,14 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header)
This property holds the window footer item. The footer item is positioned to
the bottom, and resized to the width of the window. The default value is \c null.
+ \code
+ ApplicationWindow {
+ footer: ToolBar {
+ // ...
+ }
+ }
+ \endcode
+
\note Assigning a ToolBar or TabBar as a window footer sets the respective
\l ToolBar::position or \l TabBar::position property automatically to \c Footer.
@@ -401,6 +458,17 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer)
This default property holds the list of all objects declared as children of
the window.
+ The data property allows you to freely mix visual children, resources and
+ other windows in an ApplicationWindow.
+
+ If you assign an Item to the contentData list, it becomes a child of the
+ window's contentItem, so that it appears inside the window. The item's
+ parent will be the window's \l contentItem.
+
+ It should not generally be necessary to refer to the contentData property,
+ as it is the default property for ApplicationWindow and thus all child
+ items are automatically assigned to this property.
+
\sa contentItem
*/
QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
@@ -413,6 +481,11 @@ QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
\readonly
This property holds the window content item.
+
+ The content item is stacked above the \l background item, and under the
+ \l header, \l footer, and \l overlay items.
+
+ \sa background, header, footer, overlay
*/
QQuickItem *QQuickApplicationWindow::contentItem() const
{
@@ -469,6 +542,14 @@ QQuickItem *QQuickApplicationWindow::activeFocusControl() const
\li This property holds a component to use as a visual item that implements
background dimming for modeless popups. It is created for and stacked below
visible dimming popups.
+ \row
+ \li overlay.pressed()
+ \li This signal is emitted when the overlay is pressed by the user while
+ a popup is visible.
+ \row
+ \li overlay.released()
+ \li This signal is emitted when the overlay is released by the user while
+ a modal popup is visible.
\endtable
\sa Popup::modal, Popup::dim
@@ -689,6 +770,8 @@ QQuickApplicationWindowAttached::QQuickApplicationWindowAttached(QObject *parent
This attached property holds the application window. The property can be attached
to any item. The value is \c null if the item is not in an ApplicationWindow.
+
+ \sa {Attached ApplicationWindow Properties}
*/
QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const
{
@@ -702,6 +785,8 @@ QQuickApplicationWindow *QQuickApplicationWindowAttached::window() const
This attached property holds the window content item. The property can be attached
to any item. The value is \c null if the item is not in an ApplicationWindow.
+
+ \sa {Attached ApplicationWindow Properties}
*/
QQuickItem *QQuickApplicationWindowAttached::contentItem() const
{
@@ -720,7 +805,7 @@ QQuickItem *QQuickApplicationWindowAttached::contentItem() const
The value is \c null if the item is not in an ApplicationWindow, or the window has
no active focus.
- \sa Window::activeFocusItem
+ \sa Window::activeFocusItem, {Attached ApplicationWindow Properties}
*/
QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
{
@@ -737,6 +822,8 @@ QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
This attached property holds the window header item. The property can be attached
to any item. The value is \c null if the item is not in an ApplicationWindow, or
the window has no header item.
+
+ \sa {Attached ApplicationWindow Properties}
*/
QQuickItem *QQuickApplicationWindowAttached::header() const
{
@@ -753,6 +840,8 @@ QQuickItem *QQuickApplicationWindowAttached::header() const
This attached property holds the window footer item. The property can be attached
to any item. The value is \c null if the item is not in an ApplicationWindow, or
the window has no footer item.
+
+ \sa {Attached ApplicationWindow Properties}
*/
QQuickItem *QQuickApplicationWindowAttached::footer() const
{
@@ -768,6 +857,8 @@ QQuickItem *QQuickApplicationWindowAttached::footer() const
This attached property holds the window overlay item. The property can be attached
to any item. The value is \c null if the item is not in an ApplicationWindow.
+
+ \sa {Attached ApplicationWindow Properties}
*/
QQuickOverlay *QQuickApplicationWindowAttached::overlay() const
{
diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp
index 73181ec7..2cd3f62d 100644
--- a/src/quicktemplates2/qquickbusyindicator.cpp
+++ b/src/quicktemplates2/qquickbusyindicator.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
- \brief Indicates activity while content is being loaded.
+ \brief Indicates background activity, for example, while content is being loaded.
\image qtquickcontrols2-busyindicator.gif
@@ -61,6 +61,18 @@ QT_BEGIN_NAMESPACE
}
\endqml
+ BusyIndicator is similar to an indeterminate \l ProgressBar. Both can be
+ used to indicate background activity. The main difference is visual, and
+ that ProgressBar can also present a concrete amount of progress (when it
+ can be determined). Due to the visual difference, busy indicators and
+ indeterminate progress bars fit different places in user interfaces.
+ Typical places for a busy indicator:
+ \list
+ \li in the corner of a \l ToolBar
+ \li as an overlay on top of a \l Page
+ \li on the side of an \l ItemDelegate
+ \endlist
+
\sa {Customizing BusyIndicator}, {Indicator Controls}, ProgressBar
*/
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index fc34aba4..ca6d4551 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief A push-button control that can be clicked by the user.
+ \brief Push-button that can be clicked to perform a command or answer a question.
\image qtquickcontrols2-button.gif
diff --git a/src/quicktemplates2/qquickbuttongroup.cpp b/src/quicktemplates2/qquickbuttongroup.cpp
index 3d3e9c05..6ed75a2b 100644
--- a/src/quicktemplates2/qquickbuttongroup.cpp
+++ b/src/quicktemplates2/qquickbuttongroup.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup utilities
- \brief A mutually-exclusive group of checkable controls.
+ \brief Mutually-exclusive group of checkable buttons.
ButtonGroup is a non-visual, mutually exclusive group of buttons.
It is used with controls such as RadioButton, where only one of the options
diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp
index ae967c34..fd5ab6ba 100644
--- a/src/quicktemplates2/qquickcheckbox.cpp
+++ b/src/quicktemplates2/qquickcheckbox.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief An option button that can be checked or unchecked.
+ \brief Check button that can be toggled on or off.
\image qtquickcontrols2-checkbox.gif
diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp
index 249aaa95..51bc8501 100644
--- a/src/quicktemplates2/qquickcheckdelegate.cpp
+++ b/src/quicktemplates2/qquickcheckdelegate.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
- \brief An item delegate that can be checked or unchecked.
+ \brief Item delegate with a check indicator that can be toggled on or off.
\image qtquickcontrols2-checkdelegate.gif
@@ -108,6 +108,10 @@ QQuickCheckDelegate::QQuickCheckDelegate(QQuickItem *parent) :
This property determines whether the check delegate has three states.
+ In the animation below, the first checkdelegate is tri-state:
+
+ \image qtquickcontrols2-checkdelegate-tristate.gif
+
The default is \c false, i.e., the delegate has only two states.
*/
bool QQuickCheckDelegate::isTristate() const
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 278f8608..01f0f699 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -56,17 +56,17 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief A combined button and popup list taking minimal space.
+ \brief Combined button and popup list for selecting options.
- \image qtquickcontrols2-combobox.png
+ \image qtquickcontrols2-combobox.gif
ComboBox is a combined button and popup list. It provides a means of
presenting a list of options to the user in a way that takes up the
minimum amount of screen space.
ComboBox is populated with a data model. The data model is commonly
- a JavaScript array, a \l ListModel or an integer, but also other types
- of \l {qml-data-models}{data models} are supported.
+ a JavaScript array, a \l ListModel or an integer, but other types
+ of \l {qml-data-models}{data models} are also supported.
\code
ComboBox {
@@ -74,6 +74,8 @@ QT_BEGIN_NAMESPACE
}
\endcode
+ \section1 ComboBox Model Roles
+
ComboBox is able to visualize standard \l {qml-data-models}{data models}
that provide the \c modelData role:
\list
@@ -108,6 +110,12 @@ QT_BEGIN_NAMESPACE
This signal is emitted when the item at \a index is activated by the user.
+ An item is activated when it is selected while the popup is open,
+ causing the popup to close (and \l currentIndex to change),
+ or while the popup is closed and the combo box is navigated via
+ keyboard, causing the \l currentIndex to change.
+ The \l currentIndex property is set to \a index.
+
\sa currentIndex
*/
@@ -116,9 +124,17 @@ QT_BEGIN_NAMESPACE
This signal is emitted when the item at \a index in the popup list is highlighted by the user.
+ The highlighted signal is only emitted when the popup is open and an item
+ is highlighted, but not necessarily \l activated.
+
\sa highlightedIndex
*/
+namespace {
+ enum Activation { NoActivate, Activate };
+ enum Highlighting { NoHighlight, Highlight };
+}
+
class QQuickComboBoxDelegateModel : public QQmlDelegateModel
{
public:
@@ -170,8 +186,12 @@ public:
void updateCurrentText();
void incrementCurrentIndex();
void decrementCurrentIndex();
+ void setCurrentIndex(int index, Activation activate);
void updateHighlightedIndex();
- void setHighlightedIndex(int index);
+ void setHighlightedIndex(int index, Highlighting highlight);
+
+ void keySearch(const QString &text);
+ int match(int start, const QString &text, Qt::MatchFlags flags) const;
void createDelegateModel();
@@ -230,8 +250,7 @@ void QQuickComboBoxPrivate::itemClicked()
Q_Q(QQuickComboBox);
int index = delegateModel->indexOf(q->sender(), nullptr);
if (index != -1) {
- setHighlightedIndex(index);
- emit q->highlighted(index);
+ setHighlightedIndex(index, Highlight);
hidePopup(true);
}
}
@@ -262,6 +281,8 @@ void QQuickComboBoxPrivate::updateCurrentText()
QString text = q->textAt(currentIndex);
if (currentText != text) {
currentText = text;
+ if (!hasDisplayText)
+ q->setAccessibleName(text);
emit q->currentTextChanged();
}
if (!hasDisplayText && displayText != text) {
@@ -270,44 +291,51 @@ void QQuickComboBoxPrivate::updateCurrentText()
}
}
+void QQuickComboBoxPrivate::setCurrentIndex(int index, Activation activate)
+{
+ Q_Q(QQuickComboBox);
+ if (currentIndex == index)
+ return;
+
+ currentIndex = index;
+ emit q->currentIndexChanged();
+
+ if (componentComplete)
+ updateCurrentText();
+
+ if (activate)
+ emit q->activated(index);
+}
+
void QQuickComboBoxPrivate::incrementCurrentIndex()
{
Q_Q(QQuickComboBox);
if (isPopupVisible()) {
- if (highlightedIndex < q->count() - 1) {
- setHighlightedIndex(highlightedIndex + 1);
- emit q->highlighted(highlightedIndex);
- }
+ if (highlightedIndex < q->count() - 1)
+ setHighlightedIndex(highlightedIndex + 1, Highlight);
} else {
- if (currentIndex < q->count() - 1) {
- q->setCurrentIndex(currentIndex + 1);
- emit q->activated(currentIndex);
- }
+ if (currentIndex < q->count() - 1)
+ setCurrentIndex(currentIndex + 1, Activate);
}
}
void QQuickComboBoxPrivate::decrementCurrentIndex()
{
- Q_Q(QQuickComboBox);
if (isPopupVisible()) {
- if (highlightedIndex > 0) {
- setHighlightedIndex(highlightedIndex - 1);
- emit q->highlighted(highlightedIndex);
- }
+ if (highlightedIndex > 0)
+ setHighlightedIndex(highlightedIndex - 1, Highlight);
} else {
- if (currentIndex > 0) {
- q->setCurrentIndex(currentIndex - 1);
- emit q->activated(currentIndex);
- }
+ if (currentIndex > 0)
+ setCurrentIndex(currentIndex - 1, Activate);
}
}
void QQuickComboBoxPrivate::updateHighlightedIndex()
{
- setHighlightedIndex(popup->isVisible() ? currentIndex : -1);
+ setHighlightedIndex(popup->isVisible() ? currentIndex : -1, NoHighlight);
}
-void QQuickComboBoxPrivate::setHighlightedIndex(int index)
+void QQuickComboBoxPrivate::setHighlightedIndex(int index, Highlighting highlight)
{
Q_Q(QQuickComboBox);
if (highlightedIndex == index)
@@ -315,6 +343,68 @@ void QQuickComboBoxPrivate::setHighlightedIndex(int index)
highlightedIndex = index;
emit q->highlightedIndexChanged();
+
+ if (highlight)
+ emit q->highlighted(index);
+}
+
+void QQuickComboBoxPrivate::keySearch(const QString &text)
+{
+ int index = match(currentIndex + 1, text, Qt::MatchStartsWith | Qt::MatchWrap);
+ if (index != -1)
+ setCurrentIndex(index, Activate);
+}
+
+int QQuickComboBoxPrivate::match(int start, const QString &text, Qt::MatchFlags flags) const
+{
+ Q_Q(const QQuickComboBox);
+ uint matchType = flags & 0x0F;
+ bool wrap = flags & Qt::MatchWrap;
+ Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+ int from = start;
+ int to = q->count();
+
+ // iterates twice if wrapping
+ for (int i = 0; (wrap && i < 2) || (!wrap && i < 1); ++i) {
+ for (int idx = from; idx < to; ++idx) {
+ QString t = q->textAt(idx);
+ switch (matchType) {
+ case Qt::MatchExactly:
+ if (t == text)
+ return idx;
+ break;
+ case Qt::MatchRegExp:
+ if (QRegExp(text, cs).exactMatch(t))
+ return idx;
+ break;
+ case Qt::MatchWildcard:
+ if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
+ return idx;
+ break;
+ case Qt::MatchStartsWith:
+ if (t.startsWith(text, cs))
+ return idx;
+ break;
+ case Qt::MatchEndsWith:
+ if (t.endsWith(text, cs))
+ return idx;
+ break;
+ case Qt::MatchFixedString:
+ if (t.compare(text, cs) == 0)
+ return idx;
+ break;
+ case Qt::MatchContains:
+ default:
+ if (t.contains(text, cs))
+ return idx;
+ break;
+ }
+ }
+ // prepare for the next iteration
+ from = 0;
+ to = start;
+ }
+ return -1;
}
void QQuickComboBoxPrivate::createDelegateModel()
@@ -468,6 +558,10 @@ void QQuickComboBox::setPressed(bool pressed)
This property holds the index of the highlighted item in the combo box popup list.
+ When a highlighted item is activated, the popup is closed, \l currentIndex
+ is set to \c highlightedIndex, and the value of this property is reset to
+ \c -1, as there is no longer a highlighted item.
+
\sa highlighted(), currentIndex
*/
int QQuickComboBox::highlightedIndex() const
@@ -481,7 +575,7 @@ int QQuickComboBox::highlightedIndex() const
This property holds the index of the current item in the combo box.
- \sa activated(), currentText
+ \sa activated(), currentText, highlightedIndex
*/
int QQuickComboBox::currentIndex() const
{
@@ -493,13 +587,7 @@ void QQuickComboBox::setCurrentIndex(int index)
{
Q_D(QQuickComboBox);
d->hasCurrentIndex = true;
- if (d->currentIndex == index)
- return;
-
- d->currentIndex = index;
- emit currentIndexChanged();
- if (isComponentComplete())
- d->updateCurrentText();
+ d->setCurrentIndex(index, NoActivate);
}
/*!
@@ -549,6 +637,7 @@ void QQuickComboBox::setDisplayText(const QString &text)
return;
d->displayText = text;
+ setAccessibleName(text);
emit displayTextChanged();
}
@@ -567,7 +656,10 @@ void QQuickComboBox::resetDisplayText()
This property holds the model role used for populating the combo box.
- \sa model, currentText, displayText
+ When the model has multiple roles, \c textRole can be set to determine
+ which role should be displayed.
+
+ \sa model, currentText, displayText, {ComboBox Model Roles}
*/
QString QQuickComboBox::textRole() const
{
@@ -592,6 +684,22 @@ void QQuickComboBox::setTextRole(const QString &role)
This property holds a delegate that presents an item in the combo box popup.
+ It is recommended to use \l ItemDelegate (or any other \l AbstractButton
+ derivatives) as the delegate. This ensures that the interaction works as
+ expected, and the popup will automatically close when appropriate. When
+ other types are used as the delegate, the popup must be closed manually.
+ For example, if \l MouseArea is used:
+
+ \code
+ delegate: Rectangle {
+ // ...
+ MouseArea {
+ // ...
+ onClicked: comboBox.popup.close()
+ }
+ }
+ \endcode
+
\sa ItemDelegate, {Customizing ComboBox}
*/
QQmlComponent *QQuickComboBox::delegate() const
@@ -618,6 +726,8 @@ void QQuickComboBox::setDelegate(QQmlComponent* delegate)
\qmlproperty Item QtQuick.Controls::ComboBox::indicator
This property holds the drop indicator item.
+
+ \sa {Customizing ComboBox}
*/
QQuickItem *QQuickComboBox::indicator() const
{
@@ -645,6 +755,12 @@ void QQuickComboBox::setIndicator(QQuickItem *indicator)
This property holds the popup.
+ The popup can be opened or closed manually, if necessary:
+
+ \code
+ onSpecialEvent: comboBox.popup.close()
+ \endcode
+
\sa {Customizing ComboBox}
*/
QQuickPopup *QQuickComboBox::popup() const
@@ -716,52 +832,15 @@ QString QQuickComboBox::textAt(int index) const
*/
int QQuickComboBox::find(const QString &text, Qt::MatchFlags flags) const
{
- int itemCount = count();
- uint matchType = flags & 0x0F;
- Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
-
- for (int idx = 0; idx < itemCount; ++idx) {
- QString t = textAt(idx);
- switch (matchType) {
- case Qt::MatchExactly:
- if (t == text)
- return idx;
- break;
- case Qt::MatchRegExp:
- if (QRegExp(text, cs).exactMatch(t))
- return idx;
- break;
- case Qt::MatchWildcard:
- if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
- return idx;
- break;
- case Qt::MatchStartsWith:
- if (t.startsWith(text, cs))
- return idx;
- break;
- case Qt::MatchEndsWith:
- if (t.endsWith(text, cs))
- return idx;
- break;
- case Qt::MatchFixedString:
- if (t.compare(text, cs) == 0)
- return idx;
- break;
- case Qt::MatchContains:
- default:
- if (t.contains(text, cs))
- return idx;
- break;
- }
- }
- return -1;
+ Q_D(const QQuickComboBox);
+ return d->match(0, text, flags);
}
/*!
\qmlmethod void QtQuick.Controls::ComboBox::incrementCurrentIndex()
Increments the current index of the combo box, or the highlighted
- index if the popup list when it is visible.
+ index if the popup list is visible.
\sa currentIndex, highlightedIndex
*/
@@ -775,7 +854,7 @@ void QQuickComboBox::incrementCurrentIndex()
\qmlmethod void QtQuick.Controls::ComboBox::decrementCurrentIndex()
Decrements the current index of the combo box, or the highlighted
- index if the popup list when it is visible.
+ index if the popup list is visible.
\sa currentIndex, highlightedIndex
*/
@@ -797,8 +876,6 @@ void QQuickComboBox::keyPressEvent(QKeyEvent *event)
{
Q_D(QQuickComboBox);
QQuickControl::keyPressEvent(event);
- if (!d->popup)
- return;
switch (event->key()) {
case Qt::Key_Escape:
@@ -825,7 +902,25 @@ void QQuickComboBox::keyPressEvent(QKeyEvent *event)
d->incrementCurrentIndex();
event->accept();
break;
+ case Qt::Key_Home:
+ if (d->isPopupVisible())
+ d->setHighlightedIndex(0, Highlight);
+ else
+ d->setCurrentIndex(0, Activate);
+ event->accept();
+ break;
+ case Qt::Key_End:
+ if (d->isPopupVisible())
+ d->setHighlightedIndex(count() - 1, Highlight);
+ else
+ d->setCurrentIndex(count() - 1, Activate);
+ event->accept();
+ break;
default:
+ if (!event->text().isEmpty())
+ d->keySearch(event->text());
+ else
+ event->ignore();
break;
}
}
@@ -923,4 +1018,20 @@ QFont QQuickComboBox::defaultFont() const
return QQuickControlPrivate::themeFont(QPlatformTheme::ComboMenuItemFont);
}
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickComboBox::accessibleRole() const
+{
+ return QAccessible::ComboBox;
+}
+
+void QQuickComboBox::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
+}
+#endif // QT_NO_ACCESSIBILITY
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index 26b7688e..4cbdd77b 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -146,6 +146,11 @@ protected:
QFont defaultFont() const override;
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
private:
Q_DISABLE_COPY(QQuickComboBox)
Q_DECLARE_PRIVATE(QQuickComboBox)
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index be2acf39..c95cfc75 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
- \brief A container control base type.
+ \brief Abstract base type providing functionality common to containers.
Container is the base type of container-like user interface controls that
allow dynamic insertion and removal of items.
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index d571a2d4..cb891ee9 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickControl
\inqmlmodule QtQuick.Controls
\since 5.7
- \brief The base type of user interface controls.
+ \brief Abstract base type providing functionality common to all controls.
Control is the base type of user interface controls. It receives input
events from the window system, and paints a representation of itself on
@@ -871,21 +871,9 @@ void QQuickControl::setFocusPolicy(Qt::FocusPolicy policy)
\qmlproperty enumeration QtQuick.Controls::Control::focusReason
\readonly
- This property holds the reason of the last focus change.
+ \include qquickcontrol-focusreason.qdocinc
- \note This property does not indicate whether the control has \l {Item::activeFocus}
- {active focus}, but the reason why the control either gained or lost focus.
-
- \value Qt.MouseFocusReason A mouse action occurred.
- \value Qt.TabFocusReason The Tab key was pressed.
- \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
- \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
- \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
- \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
- \value Qt.MenuBarFocusReason The menu bar took focus.
- \value Qt.OtherFocusReason Another reason, usually application-specific.
-
- \sa visualFocus, Item::activeFocus
+ \sa visualFocus
*/
Qt::FocusReason QQuickControl::focusReason() const
{
@@ -1016,15 +1004,7 @@ void QQuickControl::setWheelEnabled(bool enabled)
}
\endcode
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
-
- \note Most controls use the implicit size of the background item to calculate
- the implicit size of the control itself. If you replace the background item
- with a custom one, you should also consider providing a sensible implicit
- size for it (unless it is an item like \l Image which has its own implicit
- size).
+ \input qquickcontrol-background.qdocinc notes
\sa {Control Layout}
*/
@@ -1152,6 +1132,13 @@ void QQuickControl::hoverEnterEvent(QHoverEvent *event)
event->setAccepted(d->hoverEnabled);
}
+void QQuickControl::hoverMoveEvent(QHoverEvent *event)
+{
+ Q_D(QQuickControl);
+ setHovered(d->hoverEnabled && contains(event->pos()));
+ event->setAccepted(d->hoverEnabled);
+}
+
void QQuickControl::hoverLeaveEvent(QHoverEvent *event)
{
Q_D(QQuickControl);
@@ -1170,6 +1157,8 @@ void QQuickControl::mousePressEvent(QMouseEvent *event)
void QQuickControl::mouseMoveEvent(QMouseEvent *event)
{
+ Q_D(QQuickControl);
+ setHovered(d->hoverEnabled && contains(event->pos()));
event->accept();
}
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
index 9027743a..d9827017 100644
--- a/src/quicktemplates2/qquickcontrol_p.h
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -176,6 +176,7 @@ protected:
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
void hoverEnterEvent(QHoverEvent *event) override;
+ void hoverMoveEvent(QHoverEvent *event) override;
void hoverLeaveEvent(QHoverEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index 48d02faa..79aff781 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -49,12 +49,14 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief A circular dial that is rotated to set a value.
+ \brief Circular dial that is rotated to set a value.
The Dial is similar to a traditional dial knob that is found on devices
such as stereos or industrial equipment. It allows the user to specify a
value within a range.
+ \image qtquickcontrols2-dial-no-wrap.gif
+
The value of the dial is set with the \l value property. The range is
set with the \l from and \l to properties. To enable or disable wrapping,
use the \l wrap property.
@@ -278,8 +280,8 @@ void QQuickDial::setValue(qreal value)
This property holds the logical position of the handle.
- The position is defined as a percentage of the control's angle range (the
- range within which the handle can be moved) scaled to \c {0.0 - 1.0}.
+ The position is expressed as a fraction of the control's angle range (the
+ range within which the handle can be moved) in the range \c {0.0 - 1.0}.
Unlike the \l value property, the \c position is continuously updated while
the handle is dragged.
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index d35b30cf..1dae911e 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -53,21 +53,17 @@ QT_BEGIN_NAMESPACE
\since 5.7
\ingroup qtquickcontrols2-navigation
\ingroup qtquickcontrols2-popups
- \brief Provides a swipe-based side panel.
+ \brief Side panel that can be opened and closed using a swipe gesture.
Drawer provides a swipe-based side panel, similar to those often used in
touch interfaces to provide a central location for navigation.
- \table
- \row
- \li \image qtquickcontrols2-drawer-wireframe.png
- Drawer can be positioned at any of the four edges of the content item. \br
- In this image, it is against the left edge of the window.
+ \image qtquickcontrols2-drawer.gif
- \li \image qtquickcontrols2-drawer-expanded-wireframe.png
- The drawer is then opened by \e "dragging" it out from the left edge \br
- of the window.
- \endtable
+ Drawer can be positioned at any of the four edges of the content item.
+ The drawer above is positioned against the left edge of the window. The
+ drawer is then opened by \e "dragging" it out from the left edge of the
+ window.
\code
import QtQuick 2.7
@@ -156,7 +152,9 @@ QT_BEGIN_NAMESPACE
the drawer is opened, don't apply a translation.
\note On some platforms, certain edges may be reserved for system
- gestures and therefore cannot be used with Drawer.
+ gestures and therefore cannot be used with Drawer. For example, the
+ top and bottom edges may be reserved for system notifications and
+ control centers on Android and iOS.
\sa SwipeView, {Customizing Drawer}, {Navigation Controls}, {Popup Controls}
*/
@@ -481,13 +479,13 @@ QQuickDrawer::QQuickDrawer(QObject *parent) :
/*!
\qmlproperty enumeration QtQuick.Controls::Drawer::edge
- This property holds the edge of the content item at which the drawer will
+ This property holds the edge of the window at which the drawer will
open from. The acceptable values are:
- \value Qt.TopEdge The top edge of the content item.
- \value Qt.LeftEdge The left edge of the content item (default).
- \value Qt.RightEdge The right edge of the content item.
- \value Qt.BottomEdge The bottom edge of the content item.
+ \value Qt.TopEdge The top edge of the window.
+ \value Qt.LeftEdge The left edge of the window (default).
+ \value Qt.RightEdge The right edge of the window.
+ \value Qt.BottomEdge The bottom edge of the window.
*/
Qt::Edge QQuickDrawer::edge() const
{
@@ -511,8 +509,8 @@ void QQuickDrawer::setEdge(Qt::Edge edge)
\qmlproperty real QtQuick.Controls::Drawer::position
This property holds the position of the drawer relative to its final
- destination. That is, the position will be \c 0 when the drawer
- is fully closed, and \c 1 when fully open.
+ destination. That is, the position will be \c 0.0 when the drawer
+ is fully closed, and \c 1.0 when fully open.
*/
qreal QQuickDrawer::position() const
{
diff --git a/src/quicktemplates2/qquickframe.cpp b/src/quicktemplates2/qquickframe.cpp
index bcc387c1..9deef6be 100644
--- a/src/quicktemplates2/qquickframe.cpp
+++ b/src/quicktemplates2/qquickframe.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
- \brief A logical group of controls within a visual frame.
+ \brief Visual frame for a logical group of controls.
Frame is used to layout a logical group of controls together within a
visual frame. Frame does not provide a layout of its own, but requires
@@ -78,4 +78,11 @@ QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
{
}
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickFrame::accessibleRole() const
+{
+ return QAccessible::Border;
+}
+#endif // QT_NO_ACCESSIBILITY
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickframe_p.h b/src/quicktemplates2/qquickframe_p.h
index 12a65afd..093da248 100644
--- a/src/quicktemplates2/qquickframe_p.h
+++ b/src/quicktemplates2/qquickframe_p.h
@@ -64,6 +64,10 @@ public:
protected:
QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
private:
Q_DISABLE_COPY(QQuickFrame)
Q_DECLARE_PRIVATE(QQuickFrame)
diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp
index 27c325ef..dd6d1883 100644
--- a/src/quicktemplates2/qquickgroupbox.cpp
+++ b/src/quicktemplates2/qquickgroupbox.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
- \brief A logical group of controls within a titled visual frame.
+ \brief Visual frame and title for a logical group of controls.
GroupBox is used to layout a logical group of controls together, within
a \l {title}{titled} visual frame. GroupBox does not provide a layout of its own, but
@@ -56,8 +56,8 @@ QT_BEGIN_NAMESPACE
or a \l ColumnLayout.
Items declared as children of a GroupBox are automatically parented to the
- GroupBox's contentItem. Items created dynamically need to be explicitly
- parented to the contentItem.
+ GroupBox's \l {Control::}{contentItem}. Items created dynamically need to be
+ explicitly parented to the contentItem.
If only a single item is used within a GroupBox, it will resize to fit the
implicit size of its contained item. This makes it particularly suitable
@@ -118,6 +118,7 @@ void QQuickGroupBox::setTitle(const QString &title)
return;
d->title = title;
+ setAccessibleName(title);
emit titleChanged();
}
@@ -152,4 +153,20 @@ QFont QQuickGroupBox::defaultFont() const
return QQuickControlPrivate::themeFont(QPlatformTheme::GroupBoxTitleFont);
}
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickGroupBox::accessibleRole() const
+{
+ return QAccessible::Grouping;
+}
+
+void QQuickGroupBox::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickGroupBox);
+ QQuickFrame::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->title);
+}
+#endif // QT_NO_ACCESSIBILITY
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickgroupbox_p.h b/src/quicktemplates2/qquickgroupbox_p.h
index 0f1bdc54..98f6ad06 100644
--- a/src/quicktemplates2/qquickgroupbox_p.h
+++ b/src/quicktemplates2/qquickgroupbox_p.h
@@ -76,6 +76,11 @@ Q_SIGNALS:
protected:
QFont defaultFont() const override;
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
+#endif
+
private:
Q_DISABLE_COPY(QQuickGroupBox)
Q_DECLARE_PRIVATE(QQuickGroupBox)
diff --git a/src/quicktemplates2/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp
index 9b21eb30..411cb224 100644
--- a/src/quicktemplates2/qquickitemdelegate.cpp
+++ b/src/quicktemplates2/qquickitemdelegate.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\instantiates QQuickItemDelegate
\inqmlmodule QtQuick.Controls
\since 5.7
- \brief A standard view item that can be used in various views and controls.
+ \brief Basic item delegate that can be used in various views and controls.
\image qtquickcontrols2-itemdelegate.gif
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index 03bed16f..ebd1755a 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup text
- \brief A text label with inherited styling and font.
+ \brief Styled text label with inherited font.
Label extends \l Text with styling and \l {Control::font}{font}
inheritance. The default colors and font are style specific. Label
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-label.qml 1
- You can use the properties of Text to change the appearance of the text as desired:
+ You can use the properties of \l Text to change the appearance of the text as desired:
\qml
Label {
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index 509a4022..2203e574 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
\since 5.7
\ingroup qtquickcontrols2-menus
\ingroup qtquickcontrols2-popups
- \brief A menu control that can be used as a context menu or popup menu.
+ \brief Menu popup that can be used as a context menu or popup menu.
\image qtquickcontrols2-menu.png
diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
index 902889b0..564d3f38 100644
--- a/src/quicktemplates2/qquickmenuitem.cpp
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-menus
- \brief A menu item within a Menu.
+ \brief Presents an item within a Menu.
MenuItem is a convenience type that implements the AbstractButton API,
providing a familiar way to respond to menu items being \l triggered, for
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp
index 9ee0970b..c71ecd42 100644
--- a/src/quicktemplates2/qquickpage.cpp
+++ b/src/quicktemplates2/qquickpage.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
- \brief A control that makes it convenient to add a header and footer to a page.
+ \brief Styled page control with support for a header and footer.
Page is a container control which makes it convenient to add
a \l header and \l footer item to a page.
@@ -211,6 +211,7 @@ void QQuickPage::setTitle(const QString &title)
return;
d->title = title;
+ setAccessibleName(title);
emit titleChanged();
}
@@ -382,6 +383,15 @@ QAccessible::Role QQuickPage::accessibleRole() const
{
return QAccessible::PageTab;
}
+
+void QQuickPage::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickPage);
+ QQuickControl::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->title);
+}
#endif
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h
index 2cb77378..64f7602f 100644
--- a/src/quicktemplates2/qquickpage_p.h
+++ b/src/quicktemplates2/qquickpage_p.h
@@ -93,6 +93,7 @@ protected:
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
#endif
private:
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 124b8c5b..bdcfe6ca 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -37,9 +37,12 @@
#include "qquickpopup_p.h"
#include "qquickpopup_p_p.h"
#include "qquickapplicationwindow_p.h"
+#include "qquickshortcutcontext_p_p.h"
#include "qquickoverlay_p_p.h"
#include "qquickcontrol_p_p.h"
+#include <QtGui/private/qshortcutmap_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtQml/qqmlinfo.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/private/qquicktransition_p.h>
@@ -54,16 +57,16 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-popups
- \brief The base type of popup-like user interface controls.
+ \brief Base type of popup-like user interface controls.
Popup is the base type of popup-like user interface controls. It can be
- used with Window or ApplicationWindow.
+ used with \l Window or \l ApplicationWindow.
\qml
import QtQuick.Window 2.2
import QtQuick.Controls 2.0
- Window {
+ ApplicationWindow {
id: window
width: 400
height: 400
@@ -91,8 +94,79 @@ QT_BEGIN_NAMESPACE
scene, it is recommended to use ApplicationWindow. ApplicationWindow also
provides background dimming effects.
- Popup lays out its content in a similar fashion to \l Control. For more
- information, see the \l {Control Layout} section of the documentation.
+ Popup does not provide a layout of its own, but requires you to position
+ its contents, for instance by creating a \l RowLayout or a \l ColumnLayout.
+
+ Items declared as children of a Popup are automatically parented to the
+ Popups's \l contentItem. Items created dynamically need to be explicitly
+ parented to the contentItem.
+
+ \section1 Popup Layout
+
+ The following diagram illustrates the layout of a typical popup:
+
+ \image qtquickcontrols2-popup.png
+
+ The \l implicitWidth and \l implicitHeight of a popup are typically based
+ on the implicit sizes of the background and the content item plus any
+ \l padding. These properties determine how large the popup will be when no
+ explicit \l width or \l height is specified.
+
+ The \l background item fills the entire width and height of the popup,
+ unless an explicit size has been given for it.
+
+ The geometry of the \l contentItem is determined by the \l padding.
+
+ \section1 Popup Sizing
+
+ If only a single item is used within a Popup, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \code
+ Popup {
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+ }
+ \endcode
+
+ Sometimes there might be two items within the popup:
+
+ \code
+ Popup {
+ SwipeView {
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
+
+ In this case, Popup cannot calculate a sensible implicit size. Since we're
+ anchoring the \l PageIndicator over the \l SwipeView, we can simply set the
+ content size to the view's implicit size:
+
+ \code
+ Popup {
+ contentWidth: view.implicitWidth
+ contentHeight: view.implicitHeight
+
+ SwipeView {
+ id: view
+ // ...
+ }
+ PageIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+ }
+ \endcode
\sa {Popup Controls}, {Customizing Popup}, ApplicationWindow
*/
@@ -128,6 +202,7 @@ QQuickPopupPrivate::QQuickPopupPrivate()
, hasDim(false)
, visible(false)
, complete(false)
+ , positioning(false)
, hasWidth(false)
, hasHeight(false)
, hasTopMargin(false)
@@ -361,10 +436,15 @@ public:
void resolveFont() override;
+ int backId;
+ int escapeId;
QQuickPopup *popup;
};
-QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup) : popup(popup)
+QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup)
+ : backId(0),
+ escapeId(0),
+ popup(popup)
{
isTabFence = true;
}
@@ -401,6 +481,53 @@ QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup) :
// connect(QGuiApplication::styleHints(), &QStyleHints::useHoverEffectsChanged, this, &QQuickItem::setAcceptHoverEvents);
}
+void QQuickPopupItem::updatePolish()
+{
+ Q_D(QQuickPopupItem);
+ return QQuickPopupPrivate::get(d->popup)->reposition();
+}
+
+void QQuickPopupItem::grabShortcut()
+{
+#ifndef QT_NO_SHORTCUT
+ Q_D(QQuickPopupItem);
+ QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance();
+ if (!d->backId)
+ d->backId = pApp->shortcutMap.addShortcut(this, Qt::Key_Back, Qt::WindowShortcut, QQuickShortcutContext::matcher);
+ if (!d->escapeId)
+ d->escapeId = pApp->shortcutMap.addShortcut(this, Qt::Key_Escape, Qt::WindowShortcut, QQuickShortcutContext::matcher);
+#endif // QT_NO_SHORTCUT
+}
+
+void QQuickPopupItem::ungrabShortcut()
+{
+#ifndef QT_NO_SHORTCUT
+ Q_D(QQuickPopupItem);
+ QGuiApplicationPrivate *pApp = QGuiApplicationPrivate::instance();
+ if (d->backId) {
+ pApp->shortcutMap.removeShortcut(d->backId, this);
+ d->backId = 0;
+ }
+ if (d->escapeId) {
+ pApp->shortcutMap.removeShortcut(d->escapeId, this);
+ d->escapeId = 0;
+ }
+#endif // QT_NO_SHORTCUT
+}
+
+bool QQuickPopupItem::event(QEvent *event)
+{
+ Q_D(QQuickPopupItem);
+ if (event->type() == QEvent::Shortcut) {
+ QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
+ if (se->shortcutId() == d->escapeId || se->shortcutId() == d->backId) {
+ d->popup->close();
+ return true;
+ }
+ }
+ return QQuickItem::event(event);
+}
+
bool QQuickPopupItem::childMouseEventFilter(QQuickItem *child, QEvent *event)
{
Q_D(QQuickPopupItem);
@@ -521,6 +648,13 @@ QAccessible::Role QQuickPopupItem::accessibleRole() const
Q_D(const QQuickPopupItem);
return d->popup->accessibleRole();
}
+
+void QQuickPopupItem::accessibilityActiveChanged(bool active)
+{
+ Q_D(const QQuickPopupItem);
+ QQuickControl::accessibilityActiveChanged(active);
+ d->popup->accessibilityActiveChanged(active);
+}
#endif // QT_NO_ACCESSIBILITY
QQuickPopupPositioner::QQuickPopupPositioner(QQuickPopupPrivate *popup) :
@@ -594,6 +728,11 @@ void QQuickPopupPrivate::reposition()
if (!popupItem->isVisible())
return;
+ if (positioning) {
+ popupItem->polish();
+ return;
+ }
+
const qreal w = popupItem->width();
const qreal h = popupItem->height();
const qreal iw = popupItem->implicitWidth();
@@ -702,6 +841,8 @@ void QQuickPopupPrivate::reposition()
}
}
+ positioning = true;
+
popupItem->setPosition(rect.topLeft());
const QPointF effectivePos = parentItem ? parentItem->mapFromScene(rect.topLeft()) : rect.topLeft();
@@ -718,6 +859,8 @@ void QQuickPopupPrivate::reposition()
popupItem->setWidth(rect.width());
if (!hasHeight && heightAdjusted && rect.height() > 0)
popupItem->setHeight(rect.height());
+
+ positioning = false;
}
void QQuickPopupPrivate::resizeOverlay()
@@ -825,6 +968,7 @@ QQuickPopup::~QQuickPopup()
{
Q_D(QQuickPopup);
setParentItem(nullptr);
+ d->popupItem->ungrabShortcut();
delete d->popupItem;
}
@@ -1044,8 +1188,9 @@ void QQuickPopup::setImplicitHeight(qreal height)
This property holds the content width. It is used for calculating the
total implicit width of the Popup.
- \note If only a single item is used within the Popup, the implicit width
- of its contained item is used as the content width.
+ For more information, see \l {Popup Sizing}.
+
+ \sa contentHeight
*/
qreal QQuickPopup::contentWidth() const
{
@@ -1069,8 +1214,9 @@ void QQuickPopup::setContentWidth(qreal width)
This property holds the content height. It is used for calculating the
total implicit height of the Popup.
- \note If only a single item is used within the Popup, the implicit height
- of its contained item is used as the content height.
+ For more information, see \l {Popup Sizing}.
+
+ \sa contentWidth
*/
qreal QQuickPopup::contentHeight() const
{
@@ -1443,6 +1589,28 @@ void QQuickPopup::resetLocale()
\qmlproperty font QtQuick.Controls::Popup::font
This property holds the font currently set for the popup.
+
+ Popup propagates explicit font properties to its children. If you change a specific
+ property on a popup's font, that property propagates to all of the popup's children,
+ overriding any system defaults for that property.
+
+ \code
+ Popup {
+ font.family: "Courier"
+
+ Column {
+ Label {
+ text: qsTr("This will use Courier...")
+ }
+
+ Switch {
+ text: qsTr("... and so will this")
+ }
+ }
+ }
+ \endcode
+
+ \sa Control::font, ApplicationWindow::font
*/
QFont QQuickPopup::font() const
{
@@ -1782,7 +1950,10 @@ void QQuickPopup::setVisible(bool visible)
/*!
\qmlproperty real QtQuick.Controls::Popup::opacity
- This property holds the opacity of the popup. The default value is \c 1.0.
+ This property holds the opacity of the popup. Opacity is specified as a number between
+ \c 0.0 (fully transparent) and \c 1.0 (fully opaque). The default value is \c 1.0.
+
+ \sa visible
*/
qreal QQuickPopup::opacity() const
{
@@ -1800,6 +1971,10 @@ void QQuickPopup::setOpacity(qreal opacity)
\qmlproperty real QtQuick.Controls::Popup::scale
This property holds the scale factor of the popup. The default value is \c 1.0.
+
+ A scale of less than \c 1.0 causes the popup to be rendered at a smaller size,
+ and a scale greater than \c 1.0 renders the popup at a larger size. A negative
+ scale causes the popup to be mirrored when rendered.
*/
qreal QQuickPopup::scale() const
{
@@ -1832,6 +2007,10 @@ void QQuickPopup::setScale(qreal scale)
has active focus.
The default value is \c {Popup.CloseOnEscape | Popup.CloseOnPressOutside}.
+
+ \note There is a known limitation that the \c Popup.CloseOnReleaseOutside
+ and \c Popup.CloseOnReleaseOutsideParent policies only work with
+ \l modal popups.
*/
QQuickPopup::ClosePolicy QQuickPopup::closePolicy() const
{
@@ -1845,6 +2024,12 @@ void QQuickPopup::setClosePolicy(ClosePolicy policy)
if (d->closePolicy == policy)
return;
d->closePolicy = policy;
+ if (isVisible()) {
+ if (policy & QQuickPopup::CloseOnEscape)
+ d->popupItem->grabShortcut();
+ else
+ d->popupItem->ungrabShortcut();
+ }
emit closePolicyChanged();
}
@@ -1875,8 +2060,20 @@ void QQuickPopup::setTransformOrigin(TransformOrigin origin)
/*!
\qmlproperty Transition QtQuick.Controls::Popup::enter
- This property holds the transition that is applied to the content item
+ This property holds the transition that is applied to the popup item
when the popup is opened and enters the screen.
+
+ The following example animates the opacity of the popup when it enters
+ the screen:
+ \code
+ Popup {
+ enter: Transition {
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0 }
+ }
+ }
+ \endcode
+
+ \sa exit
*/
QQuickTransition *QQuickPopup::enter() const
{
@@ -1896,8 +2093,20 @@ void QQuickPopup::setEnter(QQuickTransition *transition)
/*!
\qmlproperty Transition QtQuick.Controls::Popup::exit
- This property holds the transition that is applied to the content item
+ This property holds the transition that is applied to the popup item
when the popup is closed and exits the screen.
+
+ The following example animates the opacity of the popup when it exits
+ the screen:
+ \code
+ Popup {
+ exit: Transition {
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0 }
+ }
+ }
+ \endcode
+
+ \sa enter
*/
QQuickTransition *QQuickPopup::exit() const
{
@@ -1989,12 +2198,6 @@ void QQuickPopup::keyPressEvent(QKeyEvent *event)
if (hasActiveFocus() && (event->key() == Qt::Key_Tab || event->key() == Qt::Key_Backtab))
QQuickItemPrivate::focusNextPrev(d->popupItem, event->key() == Qt::Key_Tab);
-
- if (event->key() != Qt::Key_Escape && event->key() != Qt::Key_Back)
- return;
-
- if (d->closePolicy.testFlag(CloseOnEscape))
- close();
}
void QQuickPopup::keyReleaseEvent(QKeyEvent *event)
@@ -2091,7 +2294,7 @@ void QQuickPopup::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe
void QQuickPopup::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
{
- Q_UNUSED(data);
+ Q_D(QQuickPopup);
switch (change) {
case QQuickItem::ItemActiveFocusHasChanged:
@@ -2100,6 +2303,13 @@ void QQuickPopup::itemChange(QQuickItem::ItemChange change, const QQuickItem::It
case QQuickItem::ItemOpacityHasChanged:
emit opacityChanged();
break;
+ case QQuickItem::ItemVisibleHasChanged:
+ if (isComponentComplete() && d->closePolicy & CloseOnEscape) {
+ if (data.boolValue)
+ d->popupItem->grabShortcut();
+ else
+ d->popupItem->ungrabShortcut();
+ }
default:
break;
}
@@ -2150,10 +2360,39 @@ QFont QQuickPopup::defaultFont() const
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role QQuickPopup::accessibleRole() const
{
- return QAccessible::LayeredPane;
+ return QAccessible::Dialog;
+}
+
+void QQuickPopup::accessibilityActiveChanged(bool active)
+{
+ Q_UNUSED(active);
}
#endif // QT_NO_ACCESSIBILITY
+QString QQuickPopup::accessibleName() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->accessibleName();
+}
+
+void QQuickPopup::setAccessibleName(const QString &name)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setAccessibleName(name);
+}
+
+QVariant QQuickPopup::accessibleProperty(const char *propertyName)
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->accessibleProperty(propertyName);
+}
+
+bool QQuickPopup::setAccessibleProperty(const char *propertyName, const QVariant &value)
+{
+ Q_D(QQuickPopup);
+ return d->popupItem->setAccessibleProperty(propertyName, value);
+}
+
QT_END_NAMESPACE
#include "moc_qquickpopup_p.cpp"
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index a024c68f..6393dcdc 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -359,8 +359,15 @@ protected:
#ifndef QT_NO_ACCESSIBILITY
virtual QAccessible::Role accessibleRole() const;
+ virtual void accessibilityActiveChanged(bool active);
#endif
+ QString accessibleName() const;
+ void setAccessibleName(const QString &name);
+
+ QVariant accessibleProperty(const char *propertyName);
+ bool setAccessibleProperty(const char *propertyName, const QVariant &value);
+
private:
Q_DISABLE_COPY(QQuickPopup)
Q_DECLARE_PRIVATE(QQuickPopup)
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index c8c83ada..0c12b077 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -86,7 +86,13 @@ class QQuickPopupItem : public QQuickControl
public:
explicit QQuickPopupItem(QQuickPopup *popup);
+ void grabShortcut();
+ void ungrabShortcut();
+
protected:
+ void updatePolish() override;
+
+ bool event(QEvent *event) override;
bool childMouseEventFilter(QQuickItem *child, QEvent *event) override;
void focusInEvent(QFocusEvent *event) override;
void focusOutEvent(QFocusEvent *event) override;
@@ -110,6 +116,7 @@ protected:
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
#endif
private:
@@ -185,6 +192,7 @@ public:
bool hasDim;
bool visible;
bool complete;
+ bool positioning;
bool hasWidth;
bool hasHeight;
bool hasTopMargin;
diff --git a/src/quicktemplates2/qquickprogressbar.cpp b/src/quicktemplates2/qquickprogressbar.cpp
index 9c091ba1..d8ada6f4 100644
--- a/src/quicktemplates2/qquickprogressbar.cpp
+++ b/src/quicktemplates2/qquickprogressbar.cpp
@@ -48,23 +48,42 @@ QT_BEGIN_NAMESPACE
\ingroup qtquickcontrols2-indicators
\brief Indicates the progress of an operation.
+ \image qtquickcontrols2-progressbar.gif
+
ProgressBar indicates the progress of an operation. The value should be updated
regularly. The range is defined by \l from and \l to, which both can contain any value.
- \table
- \row \li \image qtquickcontrols2-progressbar-normal.png
- \li A progress bar in its normal state.
- \row \li \image qtquickcontrols2-progressbar-disabled.png
- \li A progress bar that is disabled.
- \endtable
-
\code
ProgressBar {
value: 0.5
}
\endcode
- \sa {Customizing ProgressBar}, BusyIndicator
+ ProgressBar also supports a special \l indeterminate mode, which is useful,
+ for example, when unable to determine the size of the item being downloaded,
+ or if the download progress gets interrupted due to a network disconnection.
+
+ \image qtquickcontrols2-progressbar-indeterminate.gif
+
+ \code
+ ProgressBar {
+ indeterminate: true
+ }
+ \endcode
+
+ The indeterminate mode is similar to a \l BusyIndicator. Both can be used
+ to indicate background activity. The main difference is visual, and that
+ ProgressBar can also present a concrete amount of progress (when it can be
+ determined). Due to the visual difference, indeterminate progress bars and
+ busy indicators fit different places in user interfaces. Typical places for
+ an indeterminate progress bar:
+ \list
+ \li at the bottom of a \l ToolBar
+ \li inline within the content of a \l Page
+ \li in an \l ItemDelegate to show the progress of a particular item
+ \endlist
+
+ \sa {Customizing ProgressBar}, BusyIndicator, {Indicator Controls}
*/
class QQuickProgressBarPrivate : public QQuickControlPrivate
@@ -173,7 +192,7 @@ void QQuickProgressBar::setValue(qreal value)
This property holds the logical position of the progress.
- The position is defined as a percentage of the value, scaled to
+ The position is expressed as a fraction of the value, in the range
\c {0.0 - 1.0}. For visualizing the progress, the right-to-left
aware \l visualPosition should be used instead.
@@ -193,7 +212,7 @@ qreal QQuickProgressBar::position() const
This property holds the visual position of the progress.
- The position is defined as a percentage of the value, scaled to \c {0.0 - 1.0}.
+ The position is expressed as a fraction of the value, in the range \c {0.0 - 1.0}.
When the control is \l {Control::mirrored}{mirrored}, \c visuaPosition is equal
to \c {1.0 - position}. This makes \c visualPosition suitable for visualizing
the progress, taking right-to-left support into account.
@@ -214,8 +233,7 @@ qreal QQuickProgressBar::visualPosition() const
A progress bar in indeterminate mode displays that an operation is in progress, but it
doesn't show how much progress has been made.
- See below for an example:
- \image qtquickcontrols2-progressbar-indeterminate.png
+ \image qtquickcontrols2-progressbar-indeterminate.gif
*/
bool QQuickProgressBar::isIndeterminate() const
diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp
index 2aafbfbd..acddb50d 100644
--- a/src/quicktemplates2/qquickradiobutton.cpp
+++ b/src/quicktemplates2/qquickradiobutton.cpp
@@ -48,27 +48,29 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief An option button that can be toggled on or off.
+ \brief Exclusive radio button that can be toggled on or off.
+
+ \image qtquickcontrols2-radiobutton.gif
RadioButton presents an option button that can be toggled on (checked) or
off (unchecked). Radio buttons are typically used to select one option
from a set of options.
- \table
- \row \li \image qtquickcontrols2-radiobutton-normal.png
- \li A radio button in its normal state.
- \row \li \image qtquickcontrols2-radiobutton-checked.png
- \li A radio button that is checked.
- \row \li \image qtquickcontrols2-radiobutton-focused.png
- \li A radio button that has active focus.
- \row \li \image qtquickcontrols2-radiobutton-disabled.png
- \li A radio button that is disabled.
- \endtable
+ RadioButton inherits its API from \l AbstractButton. For instance,
+ you can set \l {AbstractButton::text}{text} and react to
+ \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
+ The state of the radio button can be set with the
+ \l {AbstractButton::}{checked} property.
Radio buttons are \l {AbstractButton::autoExclusive}{auto-exclusive}
by default. Only one button can be checked at any time amongst radio
buttons that belong to the same parent item; checking another button
- automatically unchecks the previously checked one.
+ automatically unchecks the previously checked one. For radio buttons
+ that do not share a common parent, ButtonGroup can be used to manage
+ exclusivity.
+
+ \l RadioDelegate is similar to RadioButton, except that it is typically
+ used in views.
\code
ColumnLayout {
@@ -85,7 +87,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- \sa ButtonGroup, {Customizing RadioButton}, {Button Controls}
+ \sa ButtonGroup, {Customizing RadioButton}, {Button Controls}, RadioDelegate
*/
QQuickRadioButton::QQuickRadioButton(QQuickItem *parent) :
diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp
index 01a27cc9..4580dcf2 100644
--- a/src/quicktemplates2/qquickradiodelegate.cpp
+++ b/src/quicktemplates2/qquickradiodelegate.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
- \brief An item delegate that can be checked or unchecked.
+ \brief Exclusive item delegate with a radio indicator that can be toggled on or off.
\image qtquickcontrols2-radiodelegate.gif
@@ -56,9 +56,23 @@ QT_BEGIN_NAMESPACE
off (unchecked). Radio delegates are typically used to select one option
from a set of options.
- The state of the radio delegate can be set with the
+ RadioDelegate inherits its API from \l ItemDelegate, which is inherited
+ from AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton
+ API. The state of the radio delegate can be set with the
\l {AbstractButton::}{checked} property.
+ Radio delegates are \l {AbstractButton::autoExclusive}{auto-exclusive}
+ by default. Only one delegate can be checked at any time amongst radio
+ delegates that belong to the same parent item; checking another delegate
+ automatically unchecks the previously checked one. For radio delegates
+ that do not share a common parent, ButtonGroup can be used to manage
+ exclusivity.
+
+ \l RadioButton is similar to RadioDelegate, except that it is typically
+ not used in views, but rather when there are only a few options, and often
+ with the requirement that each button is uniquely identifiable.
+
\code
ButtonGroup {
id: buttonGroup
@@ -74,7 +88,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- \sa {Customizing RadioDelegate}, {Delegate Controls}
+ \sa {Customizing RadioDelegate}, {Delegate Controls}, RadioButton
*/
QQuickRadioDelegate::QQuickRadioDelegate(QQuickItem *parent) :
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 21904a94..26a5b010 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -49,20 +49,34 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief A slider control used to select a range of values.
+ \brief Used to select a range of values by sliding two handles along a track.
\image qtquickcontrols2-rangeslider.gif
RangeSlider is used to select a range specified by two values, by sliding
each handle along a track.
+ In the example below, custom \l from and \l to values are set, and the
+ initial positions of the \l first and \l second handles are set:
+
\code
RangeSlider {
- first.value: 0.25
- second.value: 0.75
+ from: 1
+ to: 100
+ first.value: 25
+ second.value: 75
}
\endcode
+ The \l {first.position} and \l {second.position} properties are expressed as
+ fractions of the control's size, in the range \c {0.0 - 1.0}.
+ The \l {first.visualPosition} and \l {second.visualPosition} properties are
+ the same, except that they are reversed in a
+ \l {Right-to-left User Interfaces}{right-to-left} application.
+ The \c visualPosition is useful for positioning the handles when styling
+ RangeSlider. In the example above, \l {first.visualPosition} will be \c 0.24
+ in a left-to-right application, and \c 0.76 in a right-to-left application.
+
\sa {Customizing RangeSlider}, {Input Controls}
*/
@@ -441,7 +455,7 @@ void QQuickRangeSlider::setTo(qreal to)
\li visualPosition
\li This property holds the visual position of the first handle.
- The position is defined as a percentage of the control's size, scaled to
+ The position is expressed as a fraction of the control's size, in the range
\c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
value is equal to \c {1.0 - position}. This makes the value suitable for
visualizing the slider, taking right-to-left support into account.
@@ -449,8 +463,8 @@ void QQuickRangeSlider::setTo(qreal to)
\li position
\li This property holds the logical position of the first handle.
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike \l {first.value}{value}, position is
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike \l {first.value}{value}, position is
continuously updated while the handle is dragged. For visualizing a
slider, the right-to-left aware
\l {first.visualPosition}{visualPosition} should be used instead.
@@ -498,7 +512,7 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const
\li visualPosition
\li This property holds the visual position of the second handle.
- The position is defined as a percentage of the control's size, scaled to
+ The position is expressed as a fraction of the control's size, in the range
\c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
value is equal to \c {1.0 - position}. This makes the value suitable for
visualizing the slider, taking right-to-left support into account.
@@ -506,8 +520,8 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const
\li position
\li This property holds the logical position of the second handle.
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike \l {second.value}{value}, position is
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike \l {second.value}{value}, position is
continuously updated while the handle is dragged. For visualizing a
slider, the right-to-left aware
\l {second.visualPosition}{visualPosition} should be used instead.
@@ -557,6 +571,9 @@ void QQuickRangeSlider::setStepSize(qreal step)
\value RangeSlider.SnapAlways The slider snaps while the handle is dragged.
\value RangeSlider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
+ For visual explanations of the various modes, see the
+ \l {Slider::}{snapMode} documentation of \l Slider.
+
\sa stepSize
*/
QQuickRangeSlider::SnapMode QQuickRangeSlider::snapMode() const
diff --git a/src/quicktemplates2/qquickscrollbar.cpp b/src/quicktemplates2/qquickscrollbar.cpp
index 19f7aea4..7ac1df34 100644
--- a/src/quicktemplates2/qquickscrollbar.cpp
+++ b/src/quicktemplates2/qquickscrollbar.cpp
@@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
- \brief An interactive scroll bar control.
+ \brief Vertical or horizontal interactive scroll bar.
\image qtquickcontrols2-scrollbar.gif
@@ -65,9 +65,12 @@ QT_BEGIN_NAMESPACE
}
\endcode
- \note When ScrollBar is attached \l {ScrollBar::vertical}{vertically} or
+ \section1 Attaching ScrollBar to a Flickable
+
+ When ScrollBar is attached \l {ScrollBar::vertical}{vertically} or
\l {ScrollBar::horizontal}{horizontally} to a Flickable, its geometry and
the following properties are automatically set and updated as appropriate:
+
\list
\li \l orientation
\li \l position
@@ -75,6 +78,29 @@ QT_BEGIN_NAMESPACE
\li \l active
\endlist
+ An attached ScrollBar re-parents itself to the target Flickable. A vertically
+ attached ScrollBar resizes itself to the height of the Flickable, and positions
+ itself to either side of it based on the \l {Control::mirrored}{layout direction}.
+ A horizontally attached ScrollBar resizes itself to the width of the Flickable,
+ and positions itself to the bottom. The automatic geometry management can be disabled
+ by specifying another parent for the attached ScrollBar. This can be useful, for
+ example, if the ScrollBar should be placed outside a clipping Flickable. This is
+ demonstrated by the following example:
+
+ \code
+ Flickable {
+ id: flickable
+ clip: true
+ // ...
+ ScrollBar.vertical: ScrollBar {
+ parent: flickable.parent
+ anchors.top: flickable.top
+ anchors.left: flickable.right
+ anchors.bottom: flickable.bottom
+ }
+ }
+ \endcode
+
Notice that ScrollBar does not filter key events of the Flickable it is
attached to. The following example illustrates how to implement scrolling
with up and down keys:
@@ -90,6 +116,8 @@ QT_BEGIN_NAMESPACE
}
\endcode
+ \section1 Binding the Active State of Horizontal and Vertical Scroll Bars
+
Horizontal and vertical scroll bars do not share the \l active state with
each other by default. In order to keep both bars visible whilst scrolling
to either direction, establish a two-way binding between the active states
@@ -97,6 +125,29 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-scrollbar-active.qml 1
+ \section1 Non-attached Scroll Bars
+
+ It is possible to create an instance of ScrollBar without using the
+ attached property API. This is useful when the behavior of the attached
+ scoll bar is not sufficient or a \l Flickable is not in use. In the
+ following example, horizontal and vertical scroll bars are used to
+ scroll over the text without using \l Flickable:
+
+ \snippet qtquickcontrols2-scrollbar-non-attached.qml 1
+
+ \image qtquickcontrols2-scrollbar-non-attached.png
+
+ When using a non-attached ScrollBar, the following must be done manually:
+
+ \list
+ \li Layout the scroll bar (with the \l {Item::}{x} and \l {Item::}{y} or
+ \l {Item::anchors}{anchor} properties, for example).
+ \li Set the \l size and \l position properties to determine the size and position
+ of the scroll bar in relation to the scrolled item.
+ \li Set the \l active property to determine when the scroll bar will be
+ visible.
+ \endlist
+
\sa ScrollIndicator, {Customizing ScrollBar}, {Indicator Controls}
*/
@@ -176,6 +227,9 @@ QQuickScrollBarAttached *QQuickScrollBar::qmlAttachedProperties(QObject *object)
This property holds the size of the scroll bar, scaled to \c {0.0 - 1.0}.
\sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
qreal QQuickScrollBar::size() const
{
@@ -202,6 +256,9 @@ void QQuickScrollBar::setSize(qreal size)
This property holds the position of the scroll bar, scaled to \c {0.0 - 1.0}.
\sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
qreal QQuickScrollBar::position() const
{
@@ -250,6 +307,12 @@ void QQuickScrollBar::setStepSize(qreal step)
This property holds whether the scroll bar is active, i.e. when it's \l pressed
or the attached Flickable is \l {Flickable::moving}{moving}.
+
+ It is possible to keep \l {Binding the Active State of Horizontal and Vertical Scroll Bars}
+ {both horizontal and vertical bars visible} while scrolling in either direction.
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
bool QQuickScrollBar::isActive() const
{
@@ -298,6 +361,9 @@ void QQuickScrollBar::setPressed(bool pressed)
Possible values:
\value Qt.Horizontal Horizontal
\value Qt.Vertical Vertical (default)
+
+ This property is automatically set when the scroll bar is
+ \l {Attaching ScrollBar to a Flickable}{attached to a flickable}.
*/
Qt::Orientation QQuickScrollBar::orientation() const
{
@@ -328,9 +394,10 @@ void QQuickScrollBar::increase()
{
Q_D(QQuickScrollBar);
qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ bool wasActive = d->active;
setActive(true);
setPosition(d->position + step);
- setActive(false);
+ setActive(wasActive);
}
/*!
@@ -344,9 +411,10 @@ void QQuickScrollBar::decrease()
{
Q_D(QQuickScrollBar);
qreal step = qFuzzyIsNull(d->stepSize) ? 0.1 : d->stepSize;
+ bool wasActive = d->active;
setActive(true);
setPosition(d->position - step);
- setActive(false);
+ setActive(wasActive);
}
void QQuickScrollBar::mousePressEvent(QMouseEvent *event)
@@ -463,6 +531,8 @@ void QQuickScrollBarAttachedPrivate::mirrorVertical()
void QQuickScrollBarAttachedPrivate::layoutHorizontal(bool move)
{
Q_ASSERT(horizontal && flickable);
+ if (horizontal->parentItem() != flickable)
+ return;
horizontal->setWidth(flickable->width());
if (move)
horizontal->setY(flickable->height() - horizontal->height());
@@ -471,6 +541,8 @@ void QQuickScrollBarAttachedPrivate::layoutHorizontal(bool move)
void QQuickScrollBarAttachedPrivate::layoutVertical(bool move)
{
Q_ASSERT(vertical && flickable);
+ if (vertical->parentItem() != flickable)
+ return;
vertical->setHeight(flickable->height());
if (move)
vertical->setX(vertical->isMirrored() ? 0 : flickable->width() - vertical->width());
@@ -531,6 +603,8 @@ QQuickScrollBarAttached::~QQuickScrollBarAttached()
ScrollBar.horizontal: ScrollBar { }
}
\endcode
+
+ \sa {Attaching ScrollBar to a Flickable}
*/
QQuickScrollBar *QQuickScrollBarAttached::horizontal() const
{
@@ -589,6 +663,8 @@ void QQuickScrollBarAttached::setHorizontal(QQuickScrollBar *horizontal)
ScrollBar.vertical: ScrollBar { }
}
\endcode
+
+ \sa {Attaching ScrollBar to a Flickable}
*/
QQuickScrollBar *QQuickScrollBarAttached::vertical() const
{
diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp
index 1c2700bc..7d93215d 100644
--- a/src/quicktemplates2/qquickscrollindicator.cpp
+++ b/src/quicktemplates2/qquickscrollindicator.cpp
@@ -50,14 +50,14 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-indicators
- \brief A non-interactive scroll indicator control.
+ \brief Vertical or horizontal non-interactive scroll indicator.
+
+ \image qtquickcontrols2-scrollindicator.gif
ScrollIndicator is a non-interactive indicator that indicates the current scroll
position. A scroll indicator can be either \l vertical or \l horizontal, and can
be attached to any \l Flickable, such as \l ListView and \l GridView.
- \image qtquickcontrols2-scrollindicator.png
-
\code
Flickable {
// ...
@@ -65,9 +65,12 @@ QT_BEGIN_NAMESPACE
}
\endcode
+ \section1 Attaching ScrollIndicator to a Flickable
+
\note When ScrollIndicator is attached \l {ScrollIndicator::vertical}{vertically}
or \l {ScrollIndicator::horizontal}{horizontally} to a Flickable, its geometry and
the following properties are automatically set and updated as appropriate:
+
\list
\li \l orientation
\li \l position
@@ -75,6 +78,31 @@ QT_BEGIN_NAMESPACE
\li \l active
\endlist
+ An attached ScrollIndicator re-parents itself to the target Flickable. A vertically
+ attached ScrollIndicator resizes itself to the height of the Flickable, and positions
+ itself to either side of it based on the \l {Control::mirrored}{layout direction}.
+ A horizontally attached ScrollIndicator resizes itself to the width of the Flickable,
+ and positions itself to the bottom. The automatic geometry management can be disabled
+ by specifying another parent for the attached ScrollIndicator. This can be useful, for
+ example, if the ScrollIndicator should be placed outside a clipping Flickable. This is
+ demonstrated by the following example:
+
+ \code
+ Flickable {
+ id: flickable
+ clip: true
+ // ...
+ ScrollIndicator.vertical: ScrollIndicator {
+ parent: flickable.parent
+ anchors.top: flickable.top
+ anchors.left: flickable.right
+ anchors.bottom: flickable.bottom
+ }
+ }
+ \endcode
+
+ \section1 Binding the Active State of Horizontal and Vertical Scroll Indicators
+
Horizontal and vertical scroll indicators do not share the \l active state with
each other by default. In order to keep both indicators visible whilst scrolling
to either direction, establish a two-way binding between the active states as
@@ -82,6 +110,19 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-scrollindicator-active.qml 1
+ \section1 Non-attached Scroll Indicators
+
+ It is possible to create an instance of ScrollIndicator without using the
+ attached property API. This is useful when the behavior of the attached
+ scoll indicator is not sufficient or a \l Flickable is not in use. In the
+ following example, horizontal and vertical scroll indicators are used to
+ indicate how far the user has scrolled over the text (using \l MouseArea
+ instead of \l Flickable):
+
+ \snippet qtquickcontrols2-scrollindicator-non-attached.qml 1
+
+ \image qtquickcontrols2-scrollindicator-non-attached.png
+
\sa ScrollBar, {Customizing ScrollIndicator}, {Indicator Controls}
*/
@@ -143,6 +184,9 @@ QQuickScrollIndicatorAttached *QQuickScrollIndicator::qmlAttachedProperties(QObj
This property holds the size of the indicator, scaled to \c {0.0 - 1.0}.
\sa {Flickable::visibleArea.heightRatio}{Flickable::visibleArea}
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
*/
qreal QQuickScrollIndicator::size() const
{
@@ -167,6 +211,9 @@ void QQuickScrollIndicator::setSize(qreal size)
This property holds the position of the indicator, scaled to \c {0.0 - 1.0}.
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
+
\sa {Flickable::visibleArea.yPosition}{Flickable::visibleArea}
*/
qreal QQuickScrollIndicator::position() const
@@ -192,6 +239,12 @@ void QQuickScrollIndicator::setPosition(qreal position)
This property holds whether the indicator is active, that is, when the
attached Flickable is \l {Flickable::moving}{moving}.
+
+ It is possible to keep \l {Binding the Active State of Horizontal and Vertical Scroll Indicators}
+ {both horizontal and vertical indicators visible} while scrolling in either direction.
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
*/
bool QQuickScrollIndicator::isActive() const
{
@@ -217,6 +270,9 @@ void QQuickScrollIndicator::setActive(bool active)
Possible values:
\value Qt.Horizontal Horizontal
\value Qt.Vertical Vertical (default)
+
+ This property is automatically set when the scroll indicator is
+ \l {Attaching ScrollIndicator to a Flickable}{attached to a flickable}.
*/
Qt::Orientation QQuickScrollIndicator::orientation() const
{
@@ -268,6 +324,8 @@ void QQuickScrollIndicatorAttachedPrivate::activateVertical()
void QQuickScrollIndicatorAttachedPrivate::layoutHorizontal(bool move)
{
Q_ASSERT(horizontal && flickable);
+ if (horizontal->parentItem() != flickable)
+ return;
horizontal->setWidth(flickable->width());
if (move)
horizontal->setY(flickable->height() - horizontal->height());
@@ -276,6 +334,8 @@ void QQuickScrollIndicatorAttachedPrivate::layoutHorizontal(bool move)
void QQuickScrollIndicatorAttachedPrivate::layoutVertical(bool move)
{
Q_ASSERT(vertical && flickable);
+ if (vertical->parentItem() != flickable)
+ return;
vertical->setHeight(flickable->height());
if (move && !QQuickItemPrivate::get(vertical)->isMirrored())
vertical->setX(flickable->width() - vertical->width());
@@ -336,6 +396,8 @@ QQuickScrollIndicatorAttached::~QQuickScrollIndicatorAttached()
ScrollIndicator.horizontal: ScrollIndicator { }
}
\endcode
+
+ \sa {Attaching ScrollIndicator to a Flickable}
*/
QQuickScrollIndicator *QQuickScrollIndicatorAttached::horizontal() const
{
@@ -392,6 +454,8 @@ void QQuickScrollIndicatorAttached::setHorizontal(QQuickScrollIndicator *horizon
ScrollIndicator.vertical: ScrollIndicator { }
}
\endcode
+
+ \sa {Attaching ScrollIndicator to a Flickable}
*/
QQuickScrollIndicator *QQuickScrollIndicatorAttached::vertical() const
{
diff --git a/src/quicktemplates2/qquickshortcutcontext.cpp b/src/quicktemplates2/qquickshortcutcontext.cpp
new file mode 100644
index 00000000..04aa4f4d
--- /dev/null
+++ b/src/quicktemplates2/qquickshortcutcontext.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickshortcutcontext_p_p.h"
+#include "qquickoverlay_p_p.h"
+#include "qquickpopup_p.h"
+
+#include <QtGui/qguiapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+static bool isBlockedByPopup(QQuickItem *item)
+{
+ if (!item || !item->window())
+ return false;
+
+ QQuickOverlay *overlay = QQuickOverlay::overlay(item->window());
+ const auto popups = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups();
+ for (QQuickPopup *popup : popups) {
+ if (popup->isModal() || popup->closePolicy() & QQuickPopup::CloseOnEscape)
+ return item != popup->popupItem() && !popup->popupItem()->isAncestorOf(item);
+ }
+
+ return false;
+}
+
+bool QQuickShortcutContext::matcher(QObject *obj, Qt::ShortcutContext context)
+{
+ QQuickItem *item = nullptr;
+ switch (context) {
+ case Qt::ApplicationShortcut:
+ return true;
+ case Qt::WindowShortcut:
+ while (obj && !obj->isWindowType()) {
+ obj = obj->parent();
+ item = qobject_cast<QQuickItem *>(obj);
+ if (item) {
+ obj = item->window();
+ } else if (QQuickPopup *popup = qobject_cast<QQuickPopup *>(obj)) {
+ obj = popup->window();
+ item = popup->popupItem();
+ }
+ }
+ return obj && obj == QGuiApplication::focusWindow() && !isBlockedByPopup(item);
+ default:
+ return false;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickshortcutcontext_p_p.h b/src/quicktemplates2/qquickshortcutcontext_p_p.h
new file mode 100644
index 00000000..3866dfd8
--- /dev/null
+++ b/src/quicktemplates2/qquickshortcutcontext_p_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSHORTCUTCONTEXT_P_P_H
+#define QQUICKSHORTCUTCONTEXT_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qnamespace.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QObject;
+
+struct Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickShortcutContext
+{
+ static bool matcher(QObject *object, Qt::ShortcutContext context);
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSHORTCUTCONTEXT_P_P_H
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 2bae9e72..454002c2 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -48,27 +48,30 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief Selects a value by sliding a handle along a track.
+ \brief Used to select a value by sliding a handle along a track.
\image qtquickcontrols2-slider.gif
Slider is used to select a value by sliding a handle along a track.
- \table
- \row \li \image qtquickcontrols2-slider-normal.png
- \li A slider in its normal state.
- \row \li \image qtquickcontrols2-slider-focused.png
- \li A slider that has active focus.
- \row \li \image qtquickcontrols2-slider-disabled.png
- \li A slider that is disabled.
- \endtable
+ In the example below, custom \l from, \l value, and \l to values are set:
\code
Slider {
- value: 0.5
+ from: 1
+ value: 25
+ to: 100
}
\endcode
+ The \l position property is expressed as a fraction of the control's size,
+ in the range \c {0.0 - 1.0}. The \l visualPosition property is
+ the same, except that it is reversed in a
+ \l {Right-to-left User Interfaces}{right-to-left} application. The
+ visualPosition is useful for positioning the handle when styling Slider.
+ In the example above, \l visualPosition will be \c 0.24 in a left-to-right
+ application, and \c 0.76 in a right-to-left application.
+
\sa {Customizing Slider}, {Input Controls}
*/
@@ -260,8 +263,8 @@ void QQuickSlider::setValue(qreal value)
This property holds the logical position of the handle.
- The position is defined as a percentage of the control's size, scaled
- to \c {0.0 - 1.0}. Unlike the \l value property, the \c position is
+ The position is expressed as a fraction of the control's size, in the range
+ \c {0.0 - 1.0}. Unlike the \l value property, the \c position is
continuously updated while the handle is dragged. For visualizing a
slider, the right-to-left aware \l visualPosition should be used instead.
@@ -279,7 +282,7 @@ qreal QQuickSlider::position() const
This property holds the visual position of the handle.
- The position is defined as a percentage of the control's size, scaled to
+ The position is expressed as a fraction of the control's size, in the range
\c {0.0 - 1.0}. When the control is \l {Control::mirrored}{mirrored}, the
value is equal to \c {1.0 - position}. This makes the value suitable for
visualizing the slider, taking right-to-left support into account.
@@ -327,6 +330,18 @@ void QQuickSlider::setStepSize(qreal step)
\value Slider.SnapAlways The slider snaps while the handle is dragged.
\value Slider.SnapOnRelease The slider does not snap while being dragged, but only after the handle is released.
+ In the following table, the various modes are illustrated with animations.
+ The movement of the mouse cursor and the \l stepSize (\c 0.2) are identical
+ in each animation.
+
+ \table
+ \header
+ \row \li \b Value \li \b Example
+ \row \li \c Slider.NoSnap \li \image qtquickcontrols2-slider-nosnap.gif
+ \row \li \c Slider.SnapAlways \li \image qtquickcontrols2-slider-snapalways.gif
+ \row \li \c Slider.SnapOnRelease \li \image qtquickcontrols2-slider-snaponrelease.gif
+ \endtable
+
\sa stepSize
*/
QQuickSlider::SnapMode QQuickSlider::snapMode() const
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index 116d1e12..473b6643 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -57,7 +57,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup input
- \brief A spinbox control that allows the user to select from a set of preset values.
+ \brief Allows the user to select from a set of preset values.
\image qtquickcontrols2-spinbox.png
@@ -242,7 +242,8 @@ bool QQuickSpinBoxPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *
bool pressed = up->isPressed() || down->isPressed();
q->setAccessibleProperty("pressed", pressed);
- stopPressRepeat();
+ if (!pressed)
+ stopPressRepeat();
return pressed;
}
@@ -420,7 +421,16 @@ void QQuickSpinBox::setEditable(bool editable)
This property holds the input text validator for editable spinboxes. By
default, SpinBox uses \l IntValidator to accept input of integer numbers.
- \snippet SpinBox.qml validator
+ \code
+ SpinBox {
+ id: control
+ validator: IntValidator {
+ locale: control.locale.name
+ bottom: Math.min(control.from, control.to)
+ top: Math.max(control.from, control.to)
+ }
+ }
+ \endcode
\sa editable, textFromValue, valueFromText, {Control::locale}{locale}
*/
@@ -446,6 +456,12 @@ void QQuickSpinBox::setValidator(QValidator *validator)
This property holds a callback function that is called whenever
an integer value needs to be converted to display text.
+ The default function can be overridden to display custom text for a given
+ value. This applies to both editable and non-editable spinboxes;
+ for example, when using the up and down buttons or a mouse wheel to
+ increment and decrement the value, the new value is converted to display
+ text using this function.
+
The callback function signature is \c {string function(value, locale)}.
The function can have one or two arguments, where the first argument
is the value to be converted, and the optional second argument is the
@@ -457,6 +473,10 @@ void QQuickSpinBox::setValidator(QValidator *validator)
textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }
\endcode
+ \note When applying a custom \c textFromValue implementation for editable
+ spinboxes, a matching \l valueFromText implementation must be provided
+ to be able to convert the custom text back to an integer value.
+
\sa valueFromText, validator, {Control::locale}{locale}
*/
QJSValue QQuickSpinBox::textFromValue() const
@@ -487,6 +507,9 @@ void QQuickSpinBox::setTextFromValue(const QJSValue &callback)
This property holds a callback function that is called whenever
input text needs to be converted to an integer value.
+ This function only needs to be overridden when \l textFromValue
+ is overridden for an editable spinbox.
+
The callback function signature is \c {int function(text, locale)}.
The function can have one or two arguments, where the first argument
is the text to be converted, and the optional second argument is the
@@ -498,6 +521,10 @@ void QQuickSpinBox::setTextFromValue(const QJSValue &callback)
valueFromText: function(text, locale) { return Number.fromLocaleString(locale, text); }
\endcode
+ \note When applying a custom \l textFromValue implementation for editable
+ spinboxes, a matching \c valueFromText implementation must be provided
+ to be able to convert the custom text back to an integer value.
+
\sa textFromValue, validator, {Control::locale}{locale}
*/
QJSValue QQuickSpinBox::valueFromText() const
@@ -555,7 +582,7 @@ QQuickSpinButton *QQuickSpinBox::down() const
/*!
\qmlmethod void QtQuick.Controls::SpinBox::increase()
- Increases the value by \l stepSize.
+ Increases the value by \l stepSize, or \c 1 if stepSize is not defined.
\sa stepSize
*/
@@ -568,7 +595,7 @@ void QQuickSpinBox::increase()
/*!
\qmlmethod void QtQuick.Controls::SpinBox::decrease()
- Decreases the value by \l stepSize.
+ Decreases the value by \l stepSize, or \c 1 if stepSize is not defined.
\sa stepSize
*/
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index 8cb06d06..df9ab74f 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -126,6 +126,33 @@ QT_BEGIN_NAMESPACE
application UI, "pop" navigates backward, and "replace" replaces the
\l currentItem.
+ \section2 Pushing Items
+
+ In the following animation, three \l Label controls are pushed onto a
+ stack view with the \l push() function:
+
+ \image qtquickcontrols2-stackview-push.gif
+
+ The stack now contains the following items: \c [A, B, C].
+
+ \note When the stack is empty, a push() operation will not have a
+ transition animation because there is nothing to transition from (typically
+ on application start-up).
+
+ \section2 Popping Items
+
+ Continuing on from the example above, the topmost item on the stack is
+ removed with a call to \l pop():
+
+ \image qtquickcontrols2-stackview-pop.gif
+
+ The stack now contains the following items: \c [A, B].
+
+ \note A pop() operation on a stack with depth 1 or 0 does nothing. In such
+ cases, the stack can be emptied using the \l clear() method.
+
+ \section3 Unwinding Items via Pop
+
Sometimes, it is necessary to go back more than a single step in the stack.
For example, to return to a "main" item or some kind of section item in the
application. In such cases, it is possible to specify an item as a
@@ -135,22 +162,20 @@ QT_BEGIN_NAMESPACE
explicitly unwind to the bottom of the stack, it is recommended to use
\l{pop()}{pop(null)}, although any non-existent item will do.
- Given the stack [A, B, C]:
+ In the following animation, we unwind the stack to the first item by
+ calling \c pop(null):
- \list
- \li \l{push()}{push(D)} => [A, B, C, D] - "push" transition animation
- between C and D
- \li pop() => [A, B] - "pop" transition animation between C and B
- \li \l{replace()}{replace(D)} => [A, B, D] - "replace" transition between
- C and D
- \li \l{pop()}{pop(A)} => [A] - "pop" transition between C and A
- \endlist
+ \image qtquickcontrols2-stackview-unwind.gif
- \note When the stack is empty, a push() operation will not have a
- transition animation because there is nothing to transition from (typically
- on application start-up). A pop() operation on a stack with depth 1 or
- 0 does nothing. In such cases, the stack can be emptied using the clear()
- method.
+ The stack now contains a single item: \c [A].
+
+ \section2 Replacing Items
+
+ In the following animation, we \l replace the topmost item with \c D:
+
+ \image qtquickcontrols2-stackview-replace.gif
+
+ The stack now contains the following items: \c [A, B, D].
\section1 Deep Linking
@@ -441,7 +466,7 @@ QQuickItem *QQuickStackView::find(const QJSValue &callback, LoadBehavior behavio
\value StackView.Transition An operation with transitions.
\value StackView.Immediate An immediate operation without transitions.
- \sa initialItem
+ \sa initialItem, {Pushing Items}
*/
void QQuickStackView::push(QQmlV4Function *args)
{
@@ -510,7 +535,7 @@ void QQuickStackView::push(QQmlV4Function *args)
stackView.pop(null)
\endcode
- \sa clear()
+ \sa clear(), {Popping Items}, {Unwinding Items via Pop}
*/
void QQuickStackView::pop(QQmlV4Function *args)
{
@@ -625,7 +650,7 @@ void QQuickStackView::pop(QQmlV4Function *args)
\value StackView.Transition An operation with transitions.
\value StackView.Immediate An immediate operation without transitions.
- \sa push()
+ \sa push(), {Replacing Items}
*/
void QQuickStackView::replace(QQmlV4Function *args)
{
@@ -925,6 +950,13 @@ bool QQuickStackView::childMouseEventFilter(QQuickItem *item, QEvent *event)
return window && !window->mouseGrabberItem();
}
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickStackView::accessibleRole() const
+{
+ return QAccessible::LayeredPane;
+}
+#endif
+
void QQuickStackAttachedPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
{
Q_Q(QQuickStackAttached);
diff --git a/src/quicktemplates2/qquickstackview_p.h b/src/quicktemplates2/qquickstackview_p.h
index 5c119627..f994f361 100644
--- a/src/quicktemplates2/qquickstackview_p.h
+++ b/src/quicktemplates2/qquickstackview_p.h
@@ -149,6 +149,10 @@ protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
bool childMouseEventFilter(QQuickItem *, QEvent *) override;
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
private:
Q_DISABLE_COPY(QQuickStackView)
Q_DECLARE_PRIVATE(QQuickStackView)
diff --git a/src/quicktemplates2/qquickswipe_p.h b/src/quicktemplates2/qquickswipe_p.h
new file mode 100644
index 00000000..f701c63c
--- /dev/null
+++ b/src/quicktemplates2/qquickswipe_p.h
@@ -0,0 +1,117 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWIPE_P_H
+#define QQUICKSWIPE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQmlComponent;
+class QQuickItem;
+class QQuickSwipeDelegate;
+class QQuickSwipePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
+ Q_PROPERTY(bool complete READ isComplete NOTIFY completeChanged FINAL)
+ Q_PROPERTY(QQmlComponent *left READ left WRITE setLeft NOTIFY leftChanged FINAL)
+ Q_PROPERTY(QQmlComponent *behind READ behind WRITE setBehind NOTIFY behindChanged FINAL)
+ Q_PROPERTY(QQmlComponent *right READ right WRITE setRight NOTIFY rightChanged FINAL)
+ Q_PROPERTY(QQuickItem *leftItem READ leftItem NOTIFY leftItemChanged FINAL)
+ Q_PROPERTY(QQuickItem *behindItem READ behindItem NOTIFY behindItemChanged FINAL)
+ Q_PROPERTY(QQuickItem *rightItem READ rightItem NOTIFY rightItemChanged FINAL)
+
+public:
+ explicit QQuickSwipe(QQuickSwipeDelegate *control);
+
+ qreal position() const;
+ void setPosition(qreal position);
+
+ bool isComplete() const;
+ void setComplete(bool complete);
+
+ QQmlComponent *left() const;
+ void setLeft(QQmlComponent *left);
+
+ QQmlComponent *behind() const;
+ void setBehind(QQmlComponent *behind);
+
+ QQmlComponent *right() const;
+ void setRight(QQmlComponent *right);
+
+ QQuickItem *leftItem() const;
+ void setLeftItem(QQuickItem *item);
+
+ QQuickItem *behindItem() const;
+ void setBehindItem(QQuickItem *item);
+
+ QQuickItem *rightItem() const;
+ void setRightItem(QQuickItem *item);
+
+Q_SIGNALS:
+ void positionChanged();
+ void completeChanged();
+ void leftChanged();
+ void behindChanged();
+ void rightChanged();
+ void leftItemChanged();
+ void behindItemChanged();
+ void rightItemChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickSwipe)
+ Q_DECLARE_PRIVATE(QQuickSwipe)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSWIPE_P_H
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index ae7a7d90..0eac7fe1 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qquickswipedelegate_p.h"
+#include "qquickswipedelegate_p_p.h"
#include "qquickcontrol_p_p.h"
#include "qquickitemdelegate_p_p.h"
#include "qquickvelocitycalculator_p_p.h"
@@ -53,15 +54,21 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
- \brief A swipable item delegate.
+ \brief Swipable item delegate.
SwipeDelegate presents a view item that can be swiped left or right to
expose more options or information. It is used as a delegate in views such
as \l ListView.
- SwipeDelegate inherits its API from AbstractButton. For instance, you can set
- \l {AbstractButton::text}{text} and react to
- \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
+ In the following example, SwipeDelegate is used in a \l ListView to allow
+ items to be removed from it by swiping to the left:
+
+ \snippet qtquickcontrols2-swipedelegate.qml 1
+
+ SwipeDelegate inherits its API from \l ItemDelegate, which is inherited
+ from AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton
+ API.
Information regarding the progress of a swipe, as well as the components
that should be shown upon swiping, are both available through the
@@ -136,6 +143,8 @@ public:
void warnAboutMixingDelegates();
void warnAboutSettingDelegatesWhileVisible();
+ bool hasDelegates() const;
+
QQuickSwipeDelegate *control;
// Same range as position, but is set before press events so that we can
// keep track of which direction the user must swipe when using left and right delegates.
@@ -336,6 +345,11 @@ void QQuickSwipePrivate::warnAboutSettingDelegatesWhileVisible()
qmlInfo(control) << "left/right/behind properties may only be set when swipe.position is 0";
}
+bool QQuickSwipePrivate::hasDelegates() const
+{
+ return left || right || behind;
+}
+
QQuickSwipe::QQuickSwipe(QQuickSwipeDelegate *control) :
QObject(*(new QQuickSwipePrivate(control)))
{
@@ -370,6 +384,8 @@ void QQuickSwipe::setLeft(QQmlComponent *left)
d->leftItem = nullptr;
}
+ d->control->setFiltersChildMouseEvents(d->hasDelegates());
+
emit leftChanged();
}
@@ -402,6 +418,8 @@ void QQuickSwipe::setBehind(QQmlComponent *behind)
d->behindItem = nullptr;
}
+ d->control->setFiltersChildMouseEvents(d->hasDelegates());
+
emit behindChanged();
}
@@ -434,6 +452,8 @@ void QQuickSwipe::setRight(QQmlComponent *right)
d->rightItem = nullptr;
}
+ d->control->setFiltersChildMouseEvents(d->hasDelegates());
+
emit rightChanged();
}
@@ -546,24 +566,10 @@ void QQuickSwipe::setComplete(bool complete)
emit completeChanged();
}
-class QQuickSwipeDelegatePrivate : public QQuickItemDelegatePrivate
+QQuickSwipeDelegatePrivate::QQuickSwipeDelegatePrivate(QQuickSwipeDelegate *control) :
+ swipe(control)
{
- Q_DECLARE_PUBLIC(QQuickSwipeDelegate)
-
-public:
- QQuickSwipeDelegatePrivate(QQuickSwipeDelegate *control) :
- swipe(control)
- {
- }
-
- bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event);
- bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
- bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
-
- void resizeContent() override;
-
- QQuickSwipe swipe;
-};
+}
bool QQuickSwipeDelegatePrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
{
@@ -607,7 +613,7 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
const qreal distance = (event->pos() - pressPoint).x();
if (!q->keepMouseGrab()) {
- // Taken from QQuickDrawer::handleMouseMoveEvent; see comments there.
+ // Taken from QQuickDrawerPrivate::grabMouse; see comments there.
int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
const bool overThreshold = QQuickWindowPrivate::dragOverThreshold(distance, Qt::XAxis, event, threshold);
if (window && overThreshold) {
@@ -667,6 +673,13 @@ bool QQuickSwipeDelegatePrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEv
swipe.setPosition(position);
}
+ } else {
+ // The swipe wasn't initiated.
+ if (event->pos().y() < 0 || event->pos().y() > height) {
+ // The mouse went outside the vertical bounds of the control, so
+ // we should no longer consider it pressed.
+ q->setPressed(false);
+ }
}
event->accept();
@@ -742,7 +755,6 @@ void QQuickSwipeDelegatePrivate::resizeContent()
QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
QQuickItemDelegate(*(new QQuickSwipeDelegatePrivate(this)), parent)
{
- setFiltersChildMouseEvents(true);
}
/*!
@@ -762,13 +774,13 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
\li Description
\row
\li position
- \li This property holds the position of the swipe relative to either
+ \li This read-only property holds the position of the swipe relative to either
side of the control. When this value reaches either
\c -1.0 (left side) or \c 1.0 (right side) and the mouse button is
released, \c complete will be \c true.
\row
\li complete
- \li This property holds whether the control is fully exposed after
+ \li This read-only property holds whether the control is fully exposed after
having been swiped to the left or right.
When complete is \c true, any interactive items declared in \c left,
@@ -804,19 +816,19 @@ QQuickSwipeDelegate::QQuickSwipeDelegate(QQuickItem *parent) :
\include qquickswipedelegate-interaction.qdocinc
\row
\li leftItem
- \li This property holds the item instantiated from the \c left component.
+ \li This read-only property holds the item instantiated from the \c left component.
If \c left has not been set, or the position hasn't changed since
creation of the SwipeDelegate, this property will be \c null.
\row
\li behindItem
- \li This property holds the item instantiated from the \c behind component.
+ \li This read-only property holds the item instantiated from the \c behind component.
If \c behind has not been set, or the position hasn't changed since
creation of the SwipeDelegate, this property will be \c null.
\row
\li rightItem
- \li This property holds the item instantiated from the \c right component.
+ \li This read-only property holds the item instantiated from the \c right component.
If \c right has not been set, or the position hasn't changed since
creation of the SwipeDelegate, this property will be \c null.
@@ -879,14 +891,17 @@ void QQuickSwipeDelegate::mousePressEvent(QMouseEvent *event)
void QQuickSwipeDelegate::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QQuickSwipeDelegate);
- d->handleMouseMoveEvent(this, event);
+ if (filtersChildMouseEvents())
+ d->handleMouseMoveEvent(this, event);
+ else
+ QQuickItemDelegate::mouseMoveEvent(event);
}
void QQuickSwipeDelegate::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QQuickSwipeDelegate);
- QQuickItemDelegate::mouseReleaseEvent(event);
- d->handleMouseReleaseEvent(this, event);
+ if (!filtersChildMouseEvents() || !d->handleMouseReleaseEvent(this, event))
+ QQuickItemDelegate::mouseReleaseEvent(event);
}
void QQuickSwipeDelegate::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
diff --git a/src/quicktemplates2/qquickswipedelegate_p.h b/src/quicktemplates2/qquickswipedelegate_p.h
index e71455b0..2e1c515d 100644
--- a/src/quicktemplates2/qquickswipedelegate_p.h
+++ b/src/quicktemplates2/qquickswipedelegate_p.h
@@ -84,62 +84,6 @@ private:
Q_DECLARE_PRIVATE(QQuickSwipeDelegate)
};
-class QQuickSwipePrivate;
-
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSwipe : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal position READ position NOTIFY positionChanged FINAL)
- Q_PROPERTY(bool complete READ isComplete NOTIFY completeChanged FINAL)
- Q_PROPERTY(QQmlComponent *left READ left WRITE setLeft NOTIFY leftChanged FINAL)
- Q_PROPERTY(QQmlComponent *behind READ behind WRITE setBehind NOTIFY behindChanged FINAL)
- Q_PROPERTY(QQmlComponent *right READ right WRITE setRight NOTIFY rightChanged FINAL)
- Q_PROPERTY(QQuickItem *leftItem READ leftItem NOTIFY leftItemChanged FINAL)
- Q_PROPERTY(QQuickItem *behindItem READ behindItem NOTIFY behindItemChanged FINAL)
- Q_PROPERTY(QQuickItem *rightItem READ rightItem NOTIFY rightItemChanged FINAL)
-
-public:
- explicit QQuickSwipe(QQuickSwipeDelegate *control);
-
- qreal position() const;
- void setPosition(qreal position);
-
- bool isComplete() const;
- void setComplete(bool complete);
-
- QQmlComponent *left() const;
- void setLeft(QQmlComponent *left);
-
- QQmlComponent *behind() const;
- void setBehind(QQmlComponent *behind);
-
- QQmlComponent *right() const;
- void setRight(QQmlComponent *right);
-
- QQuickItem *leftItem() const;
- void setLeftItem(QQuickItem *item);
-
- QQuickItem *behindItem() const;
- void setBehindItem(QQuickItem *item);
-
- QQuickItem *rightItem() const;
- void setRightItem(QQuickItem *item);
-
-Q_SIGNALS:
- void positionChanged();
- void completeChanged();
- void leftChanged();
- void behindChanged();
- void rightChanged();
- void leftItemChanged();
- void behindItemChanged();
- void rightItemChanged();
-
-private:
- Q_DISABLE_COPY(QQuickSwipe)
- Q_DECLARE_PRIVATE(QQuickSwipe)
-};
-
QT_END_NAMESPACE
QML_DECLARE_TYPE(QQuickSwipeDelegate)
diff --git a/src/quicktemplates2/qquickswipedelegate_p_p.h b/src/quicktemplates2/qquickswipedelegate_p_p.h
new file mode 100644
index 00000000..0387ad70
--- /dev/null
+++ b/src/quicktemplates2/qquickswipedelegate_p_p.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKSWIPEDELEGATE_P_P_H
+#define QQUICKSWIPEDELEGATE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickTemplates2/private/qquickitemdelegate_p_p.h>
+#include <QtQuickTemplates2/private/qquickswipe_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickSwipeDelegate;
+
+class QQuickSwipeDelegatePrivate : public QQuickItemDelegatePrivate
+{
+ Q_DECLARE_PUBLIC(QQuickSwipeDelegate)
+
+public:
+ QQuickSwipeDelegatePrivate(QQuickSwipeDelegate *control);
+
+ bool handleMousePressEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
+ bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
+
+ void resizeContent() override;
+
+ QQuickSwipe swipe;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKSWIPEDELEGATE_P_P_H
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index e5c98f4d..82d05fbe 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
SwipeView provides a swipe-based navigation model.
- \image qtquickcontrols2-swipeview-wireframe.png
+ \image qtquickcontrols2-swipeview.gif
SwipeView is populated with a set of pages. One page is visible at a time.
The user can navigate between the pages by swiping sideways. Notice that
@@ -146,6 +146,13 @@ void QQuickSwipeView::itemAdded(int, QQuickItem *item)
item->setSize(QSizeF(d->contentItem->width(), d->contentItem->height()));
}
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickSwipeView::accessibleRole() const
+{
+ return QAccessible::PageTabList;
+}
+#endif
+
/*!
\qmlattachedproperty int QtQuick.Controls::SwipeView::index
\readonly
diff --git a/src/quicktemplates2/qquickswipeview_p.h b/src/quicktemplates2/qquickswipeview_p.h
index 49d3b840..c6cb62ba 100644
--- a/src/quicktemplates2/qquickswipeview_p.h
+++ b/src/quicktemplates2/qquickswipeview_p.h
@@ -68,6 +68,10 @@ protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void itemAdded(int index, QQuickItem *item) override;
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const override;
+#endif
+
private:
Q_DISABLE_COPY(QQuickSwipeView)
Q_DECLARE_PRIVATE(QQuickSwipeView)
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
index a7d17e86..fa08a1d8 100644
--- a/src/quicktemplates2/qquickswitch.cpp
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -51,23 +51,17 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief An option button that can be toggled on or off.
+ \brief Switch button that can be toggled on or off.
\image qtquickcontrols2-switch.gif
Switch is an option button that can be dragged or toggled on (checked) or
off (unchecked). Switches are typically used to select between two states.
+ For larger sets of options, such as those in a list, consider using
+ \l SwitchDelegate instead.
- \table
- \row \li \image qtquickcontrols2-switch-normal.png
- \li A switch in its normal state.
- \row \li \image qtquickcontrols2-switch-checked.png
- \li A switch that is checked.
- \row \li \image qtquickcontrols2-switch-focused.png
- \li A switch that has active focus.
- \row \li \image qtquickcontrols2-switch-disabled.png
- \li A switch that is disabled.
- \endtable
+ Switch inherits its API from \l AbstractButton. For instance, the state
+ of the switch can be set with the \l {AbstractButton::}{checked} property.
\code
ColumnLayout {
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index 62b677e5..81e282d9 100644
--- a/src/quicktemplates2/qquickswitchdelegate.cpp
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -47,15 +47,19 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-delegates
- \brief An item delegate that can be toggled on or off.
+ \brief Item delegate with a switch indicator that can be toggled on or off.
\image qtquickcontrols2-switchdelegate.gif
SwitchDelegate presents an item delegate that can be toggled on (checked) or
off (unchecked). Switch delegates are typically used to select one or more
- options from a set of options.
+ options from a set of options. For smaller sets of options, or for options
+ that need to be uniquely identifiable, consider using \l Switch instead.
- The state of the check delegate can be set with the
+ SwitchDelegate inherits its API from \l ItemDelegate, which is inherited
+ from \l AbstractButton. For instance, you can set \l {AbstractButton::text}{text},
+ and react to \l {AbstractButton::clicked}{clicks} using the \l AbstractButton
+ API. The state of the switch delegate can be set with the
\l {AbstractButton::}{checked} property.
\code
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 6d11f72a..ee3436f9 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\since 5.7
\ingroup qtquickcontrols2-navigation
\ingroup qtquickcontrols2-containers
- \brief A bar with icons allowing to switch between different views or subtasks.
+ \brief Allows the user to switch between different views or subtasks.
TabBar provides a tab-based navigation model.
@@ -60,6 +60,13 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-tabbar.qml 1
+ As shown above, TabBar is typically populated with a static set of tab buttons
+ that are defined inline as children of the tab bar. It is also possible to
+ \l {Container::addItem()}{add}, \l {Container::insertItem()}{insert},
+ \l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove}
+ items dynamically at run time. The items can be accessed using
+ \l {Container::}{itemAt()} or \l {Container::}{contentChildren}.
+
\section2 Resizing Tabs
By default, TabBar resizes its buttons to fit the width of the control.
@@ -176,8 +183,8 @@ QQuickTabBar::QQuickTabBar(QQuickItem *parent) :
This property holds the position of the tab bar.
- \note If the tab bar is assigned as a header or footer of ApplicationWindow
- or Page, the appropriate position is set automatically.
+ \note If the tab bar is assigned as a header or footer of \l ApplicationWindow
+ or \l Page, the appropriate position is set automatically.
Possible values:
\value TabBar.Header The tab bar is at the top, as a window or page header.
diff --git a/src/quicktemplates2/qquicktabbutton.cpp b/src/quicktemplates2/qquicktabbutton.cpp
index 6c8ba1f4..b5cbdd12 100644
--- a/src/quicktemplates2/qquicktabbutton.cpp
+++ b/src/quicktemplates2/qquicktabbutton.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-navigation
- \brief A tab button control that can be found on a TabBar.
+ \brief Button with a look suitable for a TabBar.
\image qtquickcontrols2-tabbutton.png
@@ -56,6 +56,10 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-tabbutton.qml 1
+ TabButton inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
+ using the AbstractButton API.
+
\sa TabBar, {Customizing TabButton}, {Button Controls}, {Navigation Controls}
*/
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index dcdafe22..a66d7bf5 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief A multi line text input control.
+ \brief Multi-line text input area.
TextArea is a multi-line text editor. TextArea extends TextEdit with
a \l {placeholderText}{placeholder text} functionality, and adds decoration.
@@ -79,6 +79,8 @@ QT_BEGIN_NAMESPACE
decoration of the TextArea scrolls together with the rest of the scrollable
content.
+ \section2 Scrollable TextArea
+
If you want to make a TextArea scrollable, for example, when it covers
an entire application page, attach it to a \l Flickable and combine with a
\l ScrollBar or \l ScrollIndicator.
@@ -87,7 +89,7 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-textarea-flickable.qml 1
- A TextArea that is attached to a Flickable does the following:
+ A TextArea that is attached to a \l Flickable does the following:
\list
\li Sets the content size automatically
@@ -391,9 +393,7 @@ void QQuickTextArea::setFont(const QFont &font)
This property holds the background item.
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
+ \input qquickcontrol-background.qdocinc notes
\sa {Customizing TextArea}
*/
@@ -450,21 +450,7 @@ void QQuickTextArea::setPlaceholderText(const QString &text)
/*!
\qmlproperty enumeration QtQuick.Controls::TextArea::focusReason
- This property holds the reason of the last focus change.
-
- \note This property does not indicate whether the control has \l {Item::activeFocus}
- {active focus}, but the reason why the control either gained or lost focus.
-
- \value Qt.MouseFocusReason A mouse action occurred.
- \value Qt.TabFocusReason The Tab key was pressed.
- \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
- \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
- \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
- \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
- \value Qt.MenuBarFocusReason The menu bar took focus.
- \value Qt.OtherFocusReason Another reason, usually application-specific.
-
- \sa Item::activeFocus
+ \include qquickcontrol-focusreason.qdocinc
*/
Qt::FocusReason QQuickTextArea::focusReason() const
{
@@ -646,9 +632,7 @@ QQuickTextAreaAttached::~QQuickTextAreaAttached()
This property attaches a text area to a \l Flickable.
- \snippet qtquickcontrols2-textarea-flickable.qml 1
-
- \sa ScrollBar, ScrollIndicator
+ \sa ScrollBar, ScrollIndicator, {Scrollable TextArea}
*/
QQuickTextArea *QQuickTextAreaAttached::flickable() const
{
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index f893bdb5..610df907 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -58,7 +58,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief A single line text input control.
+ \brief Single-line text input field.
TextField is a single line text editor. TextField extends TextInput with
a \l {placeholderText}{placeholder text} functionality, and adds decoration.
@@ -271,9 +271,7 @@ void QQuickTextField::setFont(const QFont &font)
This property holds the background item.
- \note If the background item has no explicit size specified, it automatically
- follows the control's size. In most cases, there is no need to specify
- width or height for a background item.
+ \input qquickcontrol-background.qdocinc notes
\sa {Customizing TextField}
*/
@@ -330,21 +328,7 @@ void QQuickTextField::setPlaceholderText(const QString &text)
/*!
\qmlproperty enumeration QtQuick.Controls::TextField::focusReason
- This property holds the reason of the last focus change.
-
- \note This property does not indicate whether the control has \l {Item::activeFocus}
- {active focus}, but the reason why the control either gained or lost focus.
-
- \value Qt.MouseFocusReason A mouse action occurred.
- \value Qt.TabFocusReason The Tab key was pressed.
- \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
- \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
- \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
- \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
- \value Qt.MenuBarFocusReason The menu bar took focus.
- \value Qt.OtherFocusReason Another reason, usually application-specific.
-
- \sa Item::activeFocus
+ \include qquickcontrol-focusreason.qdocinc
*/
Qt::FocusReason QQuickTextField::focusReason() const
{
diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp
index 9342c27a..12ecb702 100644
--- a/src/quicktemplates2/qquicktoolbar.cpp
+++ b/src/quicktemplates2/qquicktoolbar.cpp
@@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-containers
- \brief A container with context-sensitive controls.
+ \brief Container for context-sensitive controls.
ToolBar is a container of application-wide and context sensitive
actions and controls, such as navigation buttons and search fields.
@@ -69,14 +69,19 @@ QT_BEGIN_NAMESPACE
RowLayout {
anchors.fill: parent
ToolButton {
- text: qsTr("\u25C0 %1").arg(Qt.application.name)
- enabled: stack.depth > 1
+ text: qsTr("‹")
onClicked: stack.pop()
}
- Item { Layout.fillWidth: true }
- Switch {
- checked: true
- text: qsTr("Notifications")
+ Label {
+ text: "Title"
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+ ToolButton {
+ text: qsTr("â‹®")
+ onClicked: menu.open()
}
}
}
@@ -109,8 +114,8 @@ QQuickToolBar::QQuickToolBar(QQuickItem *parent) :
This property holds the position of the toolbar.
- \note If the toolbar is assigned as a header or footer of ApplicationWindow
- or Page, the appropriate position is set automatically.
+ \note If the toolbar is assigned as a header or footer of \l ApplicationWindow
+ or \l Page, the appropriate position is set automatically.
Possible values:
\value ToolBar.Header The toolbar is at the top, as a window or page header.
diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp
index c1f47b97..e8827b4c 100644
--- a/src/quicktemplates2/qquicktoolbutton.cpp
+++ b/src/quicktemplates2/qquicktoolbutton.cpp
@@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-buttons
- \brief A button with a layout suitable for a ToolBar.
+ \brief Button with a look suitable for a ToolBar.
ToolButton is functionally similar to \l Button, but provides a look that
is more suitable within a \l ToolBar.
@@ -57,6 +57,10 @@ QT_BEGIN_NAMESPACE
\snippet qtquickcontrols2-toolbar.qml 1
+ ToolButton inherits its API from AbstractButton. For instance, you can set
+ \l {AbstractButton::text}{text}, and react to \l {AbstractButton::clicked}{clicks}
+ using the AbstractButton API.
+
\sa ToolBar, {Customizing ToolButton}, {Button Controls}
*/
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index a1601ad6..3bd47457 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -62,6 +62,8 @@ QT_BEGIN_NAMESPACE
\image qtquickcontrols2-tooltip.png
+ \section2 Attached Tool Tips
+
The most straight-forward way to setup tool tips for controls is to
specify \l text and \l {visible}{visibility} via attached properties.
The following example illustrates this approach:
@@ -186,6 +188,7 @@ void QQuickToolTip::setText(const QString &text)
return;
d->text = text;
+ setAccessibleName(text);
emit textChanged();
}
@@ -305,6 +308,15 @@ QAccessible::Role QQuickToolTip::accessibleRole() const
{
return QAccessible::ToolTip;
}
+
+void QQuickToolTip::accessibilityActiveChanged(bool active)
+{
+ Q_D(QQuickToolTip);
+ QQuickPopup::accessibilityActiveChanged(active);
+
+ if (active)
+ setAccessibleName(d->text);
+}
#endif
class QQuickToolTipAttachedPrivate : public QObjectPrivate
@@ -358,6 +370,8 @@ QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) :
This attached property holds the text of the shared tool tip.
The property can be attached to any item.
+
+ \sa {Attached Tool Tips}
*/
QString QQuickToolTipAttached::text() const
{
@@ -384,7 +398,7 @@ void QQuickToolTipAttached::setText(const QString &text)
This attached property holds the delay (milliseconds) of the shared tool tip.
The property can be attached to any item.
- \sa {Delay and Timeout}
+ \sa {Attached Tool Tips}, {Delay and Timeout}
*/
int QQuickToolTipAttached::delay() const
{
@@ -411,7 +425,7 @@ void QQuickToolTipAttached::setDelay(int delay)
This attached property holds the timeout (milliseconds) of the shared tool tip.
The property can be attached to any item.
- \sa {Delay and Timeout}
+ \sa {Attached Tool Tips}, {Delay and Timeout}
*/
int QQuickToolTipAttached::timeout() const
{
@@ -437,6 +451,8 @@ void QQuickToolTipAttached::setTimeout(int timeout)
This attached property holds whether the shared tool tip is visible.
The property can be attached to any item.
+
+ \sa {Attached Tool Tips}
*/
bool QQuickToolTipAttached::isVisible() const
{
@@ -462,6 +478,8 @@ void QQuickToolTipAttached::setVisible(bool visible)
This attached property holds the shared tool tip instance. The property
can be attached to any item.
+
+ \sa {Attached Tool Tips}
*/
QQuickToolTip *QQuickToolTipAttached::toolTip() const
{
@@ -474,6 +492,8 @@ QQuickToolTip *QQuickToolTipAttached::toolTip() const
This attached method shows the shared tooltip with \a text and \a timeout (milliseconds).
The method can be attached to any item.
+
+ \sa {Attached Tool Tips}
*/
void QQuickToolTipAttached::show(const QString &text, int ms)
{
@@ -495,6 +515,8 @@ void QQuickToolTipAttached::show(const QString &text, int ms)
\qmlattachedmethod void QtQuick.Controls::ToolTip::hide()
This attached method hides the shared tooltip. The method can be attached to any item.
+
+ \sa {Attached Tool Tips}
*/
void QQuickToolTipAttached::hide()
{
diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h
index 730e38d9..9b628747 100644
--- a/src/quicktemplates2/qquicktooltip_p.h
+++ b/src/quicktemplates2/qquicktooltip_p.h
@@ -92,6 +92,7 @@ protected:
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role accessibleRole() const override;
+ void accessibilityActiveChanged(bool active) override;
#endif
private:
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 8c9c1d10..9f19f661 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -48,7 +48,9 @@ QT_BEGIN_NAMESPACE
\inqmlmodule QtQuick.Controls
\since 5.7
\ingroup qtquickcontrols2-input
- \brief A spinnable wheel of items that can be selected.
+ \brief Spinnable wheel of items that can be selected.
+
+ \image qtquickcontrols2-tumbler-wrap.gif
\code
Tumbler {
@@ -65,8 +67,6 @@ QT_BEGIN_NAMESPACE
\snippet tst_tumbler.qml contentItem
- \image qtquickcontrols2-tumbler-wrap.gif
-
\sa {Customizing Tumbler}, {Input Controls}
*/
@@ -261,7 +261,7 @@ QQuickItem *QQuickTumbler::currentItem() const
}
/*!
- \qmlproperty component QtQuick.Controls::Tumbler::delegate
+ \qmlproperty Component QtQuick.Controls::Tumbler::delegate
This property holds the delegate used to display each item.
*/
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index 0a9d2fd5..5caa1bd7 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -42,11 +42,14 @@ HEADERS += \
$$PWD/qquickrangeslider_p.h \
$$PWD/qquickscrollbar_p.h \
$$PWD/qquickscrollindicator_p.h \
+ $$PWD/qquickshortcutcontext_p_p.h \
$$PWD/qquickslider_p.h \
$$PWD/qquickspinbox_p.h \
$$PWD/qquickstackview_p.h \
$$PWD/qquickstackview_p_p.h \
+ $$PWD/qquickswipe_p.h \
$$PWD/qquickswipedelegate_p.h \
+ $$PWD/qquickswipedelegate_p_p.h \
$$PWD/qquickswipeview_p.h \
$$PWD/qquickswitch_p.h \
$$PWD/qquickswitchdelegate_p.h \
@@ -93,6 +96,7 @@ SOURCES += \
$$PWD/qquickrangeslider.cpp \
$$PWD/qquickscrollbar.cpp \
$$PWD/qquickscrollindicator.cpp \
+ $$PWD/qquickshortcutcontext.cpp \
$$PWD/qquickslider.cpp \
$$PWD/qquickspinbox.cpp \
$$PWD/qquickstackview.cpp \
diff --git a/tests/auto/accessibility/data/abstractbutton.qml b/tests/auto/accessibility/data/abstractbutton.qml
new file mode 100644
index 00000000..368f4582
--- /dev/null
+++ b/tests/auto/accessibility/data/abstractbutton.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+AbstractButton {
+ text: "AbstractButton"
+}
diff --git a/tests/auto/accessibility/data/busyindicator.qml b/tests/auto/accessibility/data/busyindicator.qml
index 4bde9634..b15ea80a 100644
--- a/tests/auto/accessibility/data/busyindicator.qml
+++ b/tests/auto/accessibility/data/busyindicator.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- BusyIndicator {
- id: busyindicator
- objectName: "busyindicator"
- }
-}
+BusyIndicator { }
diff --git a/tests/auto/accessibility/data/button.qml b/tests/auto/accessibility/data/button.qml
index 75925185..0fd14210 100644
--- a/tests/auto/accessibility/data/button.qml
+++ b/tests/auto/accessibility/data/button.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Button {
- id: button
- objectName: "button"
- text: "Button"
- }
+Button {
+ text: "Button"
}
diff --git a/tests/auto/accessibility/data/checkbox.qml b/tests/auto/accessibility/data/checkbox.qml
index 9700663d..e70d7d83 100644
--- a/tests/auto/accessibility/data/checkbox.qml
+++ b/tests/auto/accessibility/data/checkbox.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- CheckBox {
- id: checkbox
- objectName: "checkbox"
- text: "CheckBox"
- }
+CheckBox {
+ text: "CheckBox"
}
diff --git a/tests/auto/accessibility/data/checkdelegate.qml b/tests/auto/accessibility/data/checkdelegate.qml
new file mode 100644
index 00000000..0a1a4a4f
--- /dev/null
+++ b/tests/auto/accessibility/data/checkdelegate.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+CheckDelegate {
+ text: "CheckDelegate"
+}
diff --git a/tests/auto/accessibility/data/combobox.qml b/tests/auto/accessibility/data/combobox.qml
new file mode 100644
index 00000000..42e4d47b
--- /dev/null
+++ b/tests/auto/accessibility/data/combobox.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+ComboBox {
+ model: ["ComboBox"]
+}
diff --git a/tests/auto/accessibility/data/container.qml b/tests/auto/accessibility/data/container.qml
new file mode 100644
index 00000000..806ebe78
--- /dev/null
+++ b/tests/auto/accessibility/data/container.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Container { }
diff --git a/tests/auto/accessibility/data/control.qml b/tests/auto/accessibility/data/control.qml
index ceaba509..4831a6c6 100644
--- a/tests/auto/accessibility/data/control.qml
+++ b/tests/auto/accessibility/data/control.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Control {
- id: control
- objectName: "control"
- }
-}
+Control { }
diff --git a/tests/auto/accessibility/data/dayofweekrow-2.qml b/tests/auto/accessibility/data/dayofweekrow-2.qml
index 26569836..265f975a 100644
--- a/tests/auto/accessibility/data/dayofweekrow-2.qml
+++ b/tests/auto/accessibility/data/dayofweekrow-2.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import Qt.labs.calendar 1.0
-Window {
- visible: true
-
- DayOfWeekRow {
- id: dayofweekrow
- objectName: "dayofweekrow"
- }
-}
+DayOfWeekRow { }
diff --git a/tests/auto/accessibility/data/dayofweekrow.qml b/tests/auto/accessibility/data/dayofweekrow.qml
index c799aba1..a3ab92dd 100644
--- a/tests/auto/accessibility/data/dayofweekrow.qml
+++ b/tests/auto/accessibility/data/dayofweekrow.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import Qt.labs.calendar 1.0
-Window {
- visible: true
-
- DayOfWeekRow {
- id: dayofweekrow
- objectName: "dayofweekrow"
- Accessible.name: "DayOfWeekRow"
- }
+DayOfWeekRow {
+ Accessible.name: "DayOfWeekRow"
}
diff --git a/tests/auto/accessibility/data/dial.qml b/tests/auto/accessibility/data/dial.qml
index 6b2333b1..39b85550 100644
--- a/tests/auto/accessibility/data/dial.qml
+++ b/tests/auto/accessibility/data/dial.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Dial {
- id: dial
- objectName: "dial"
- }
-}
+Dial { }
diff --git a/tests/auto/accessibility/data/drawer.qml b/tests/auto/accessibility/data/drawer.qml
new file mode 100644
index 00000000..12652164
--- /dev/null
+++ b/tests/auto/accessibility/data/drawer.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Drawer { }
diff --git a/tests/auto/accessibility/data/frame.qml b/tests/auto/accessibility/data/frame.qml
new file mode 100644
index 00000000..6fcbab23
--- /dev/null
+++ b/tests/auto/accessibility/data/frame.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Frame { }
diff --git a/tests/auto/accessibility/data/groupbox.qml b/tests/auto/accessibility/data/groupbox.qml
new file mode 100644
index 00000000..c48b4847
--- /dev/null
+++ b/tests/auto/accessibility/data/groupbox.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+GroupBox {
+ title: "GroupBox"
+}
diff --git a/tests/auto/accessibility/data/itemdelegate.qml b/tests/auto/accessibility/data/itemdelegate.qml
new file mode 100644
index 00000000..9b647315
--- /dev/null
+++ b/tests/auto/accessibility/data/itemdelegate.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+ItemDelegate {
+ text: "ItemDelegate"
+}
diff --git a/tests/auto/accessibility/data/label.qml b/tests/auto/accessibility/data/label.qml
index 409898d4..bb87a4e9 100644
--- a/tests/auto/accessibility/data/label.qml
+++ b/tests/auto/accessibility/data/label.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Label {
- id: label
- objectName: "label"
- text: "Label"
- }
+Label {
+ text: "Label"
}
diff --git a/tests/auto/accessibility/data/menu.qml b/tests/auto/accessibility/data/menu.qml
index bb777064..def3020b 100644
--- a/tests/auto/accessibility/data/menu.qml
+++ b/tests/auto/accessibility/data/menu.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Menu {
- id: menu
- objectName: "menu"
- }
-}
+Menu { }
diff --git a/tests/auto/accessibility/data/menuitem.qml b/tests/auto/accessibility/data/menuitem.qml
new file mode 100644
index 00000000..70c2ff33
--- /dev/null
+++ b/tests/auto/accessibility/data/menuitem.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+MenuItem {
+ text: "MenuItem"
+}
diff --git a/tests/auto/accessibility/data/monthgrid-2.qml b/tests/auto/accessibility/data/monthgrid-2.qml
index 76af6646..603a208b 100644
--- a/tests/auto/accessibility/data/monthgrid-2.qml
+++ b/tests/auto/accessibility/data/monthgrid-2.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import Qt.labs.calendar 1.0
-Window {
- visible: true
-
- MonthGrid {
- id: monthgrid
- objectName: "monthgrid"
- title: "MonthGrid"
- }
+MonthGrid {
+ title: "MonthGrid"
}
diff --git a/tests/auto/accessibility/data/monthgrid.qml b/tests/auto/accessibility/data/monthgrid.qml
index 7c8d6451..92a45f0f 100644
--- a/tests/auto/accessibility/data/monthgrid.qml
+++ b/tests/auto/accessibility/data/monthgrid.qml
@@ -1,14 +1,7 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import Qt.labs.calendar 1.0
-Window {
- visible: true
-
- MonthGrid {
- id: monthgrid
- objectName: "monthgrid"
- title: "MonthGrid"
- Accessible.name: title
- }
+MonthGrid {
+ title: "MonthGrid"
+ Accessible.name: title
}
diff --git a/tests/auto/accessibility/data/page.qml b/tests/auto/accessibility/data/page.qml
new file mode 100644
index 00000000..59139855
--- /dev/null
+++ b/tests/auto/accessibility/data/page.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Page {
+ title: "Page"
+}
diff --git a/tests/auto/accessibility/data/pageindicator.qml b/tests/auto/accessibility/data/pageindicator.qml
index b42d3f9e..bb69a27a 100644
--- a/tests/auto/accessibility/data/pageindicator.qml
+++ b/tests/auto/accessibility/data/pageindicator.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- PageIndicator {
- id: pageindicator
- objectName: "pageindicator"
- }
-}
+PageIndicator { }
diff --git a/tests/auto/accessibility/data/pane.qml b/tests/auto/accessibility/data/pane.qml
new file mode 100644
index 00000000..1de210ec
--- /dev/null
+++ b/tests/auto/accessibility/data/pane.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Pane { }
diff --git a/tests/auto/accessibility/data/popup.qml b/tests/auto/accessibility/data/popup.qml
index 70fe2e5f..05e968e5 100644
--- a/tests/auto/accessibility/data/popup.qml
+++ b/tests/auto/accessibility/data/popup.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Popup {
- id: popup
- objectName: "popup"
- }
-}
+Popup { }
diff --git a/tests/auto/accessibility/data/progressbar.qml b/tests/auto/accessibility/data/progressbar.qml
index 283db003..5e9b11f1 100644
--- a/tests/auto/accessibility/data/progressbar.qml
+++ b/tests/auto/accessibility/data/progressbar.qml
@@ -1,15 +1,8 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- ProgressBar {
- id: progressbar
- objectName: "progressbar"
- from: 0
- to: 100
- value: 50
- }
+ProgressBar {
+ from: 0
+ to: 100
+ value: 50
}
diff --git a/tests/auto/accessibility/data/radiobutton.qml b/tests/auto/accessibility/data/radiobutton.qml
index 1883fff8..58bdf225 100644
--- a/tests/auto/accessibility/data/radiobutton.qml
+++ b/tests/auto/accessibility/data/radiobutton.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- RadioButton {
- id: radiobutton
- objectName: "radiobutton"
- text: "RadioButton"
- }
+RadioButton {
+ text: "RadioButton"
}
diff --git a/tests/auto/accessibility/data/radiodelegate.qml b/tests/auto/accessibility/data/radiodelegate.qml
new file mode 100644
index 00000000..93ccafde
--- /dev/null
+++ b/tests/auto/accessibility/data/radiodelegate.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+RadioDelegate {
+ text: "RadioDelegate"
+}
diff --git a/tests/auto/accessibility/data/rangeslider.qml b/tests/auto/accessibility/data/rangeslider.qml
index ce3dc872..45b1d4ae 100644
--- a/tests/auto/accessibility/data/rangeslider.qml
+++ b/tests/auto/accessibility/data/rangeslider.qml
@@ -1,18 +1,11 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- RangeSlider {
- id: rangeSlider
- objectName: "rangeslider"
- from: 0
- to: 100
- first.value: 25
- second.value: 75
- stepSize: 1
- orientation: "Horizontal"
- }
+RangeSlider {
+ from: 0
+ to: 100
+ first.value: 25
+ second.value: 75
+ stepSize: 1
+ orientation: Qt.Horizontal
}
diff --git a/tests/auto/accessibility/data/scrollbar.qml b/tests/auto/accessibility/data/scrollbar.qml
index 2e360422..f0598b4b 100644
--- a/tests/auto/accessibility/data/scrollbar.qml
+++ b/tests/auto/accessibility/data/scrollbar.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- ScrollBar {
- id: scrollbar
- objectName: "scrollbar"
- }
-}
+ScrollBar { }
diff --git a/tests/auto/accessibility/data/scrollindicator.qml b/tests/auto/accessibility/data/scrollindicator.qml
index e933dece..4cb81c4e 100644
--- a/tests/auto/accessibility/data/scrollindicator.qml
+++ b/tests/auto/accessibility/data/scrollindicator.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- ScrollIndicator {
- id: scrollindicator
- objectName: "scrollindicator"
- }
-}
+ScrollIndicator { }
diff --git a/tests/auto/accessibility/data/slider.qml b/tests/auto/accessibility/data/slider.qml
index 060bb66c..775ce7d0 100644
--- a/tests/auto/accessibility/data/slider.qml
+++ b/tests/auto/accessibility/data/slider.qml
@@ -1,17 +1,10 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Slider {
- id: slider
- objectName: "slider"
- from: 0
- to: 100
- value: 50
- stepSize: 1
- orientation: "Horizontal"
- }
+Slider {
+ from: 0
+ to: 100
+ value: 50
+ stepSize: 1
+ orientation: Qt.Horizontal
}
diff --git a/tests/auto/accessibility/data/spinbox.qml b/tests/auto/accessibility/data/spinbox.qml
index 9d29bccc..029cbc65 100644
--- a/tests/auto/accessibility/data/spinbox.qml
+++ b/tests/auto/accessibility/data/spinbox.qml
@@ -1,16 +1,9 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- SpinBox {
- id: spinbox
- objectName: "spinbox"
- from: 0
- to: 100
- value: 50
- stepSize: 1
- }
+SpinBox {
+ from: 0
+ to: 100
+ value: 50
+ stepSize: 1
}
diff --git a/tests/auto/accessibility/data/stackview.qml b/tests/auto/accessibility/data/stackview.qml
new file mode 100644
index 00000000..cf3b76c2
--- /dev/null
+++ b/tests/auto/accessibility/data/stackview.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+StackView { }
diff --git a/tests/auto/accessibility/data/swipedelegate.qml b/tests/auto/accessibility/data/swipedelegate.qml
new file mode 100644
index 00000000..a8acb5e0
--- /dev/null
+++ b/tests/auto/accessibility/data/swipedelegate.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+SwipeDelegate {
+ text: "SwipeDelegate"
+}
diff --git a/tests/auto/accessibility/data/swipeview.qml b/tests/auto/accessibility/data/swipeview.qml
new file mode 100644
index 00000000..018ab772
--- /dev/null
+++ b/tests/auto/accessibility/data/swipeview.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+SwipeView { }
diff --git a/tests/auto/accessibility/data/switch.qml b/tests/auto/accessibility/data/switch.qml
index 9913e3f1..8bb43893 100644
--- a/tests/auto/accessibility/data/switch.qml
+++ b/tests/auto/accessibility/data/switch.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- Switch {
- //id: switch
- objectName: "switch"
- text: "Switch"
- }
+Switch {
+ text: "Switch"
}
diff --git a/tests/auto/accessibility/data/switchdelegate.qml b/tests/auto/accessibility/data/switchdelegate.qml
new file mode 100644
index 00000000..9f2324c0
--- /dev/null
+++ b/tests/auto/accessibility/data/switchdelegate.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+SwitchDelegate {
+ text: "SwitchDelegate"
+}
diff --git a/tests/auto/accessibility/data/tabbar.qml b/tests/auto/accessibility/data/tabbar.qml
index 127c4e81..4b1f73a1 100644
--- a/tests/auto/accessibility/data/tabbar.qml
+++ b/tests/auto/accessibility/data/tabbar.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- TabBar {
- id: tabbar
- objectName: "tabbar"
- }
-}
+TabBar { }
diff --git a/tests/auto/accessibility/data/tabbutton.qml b/tests/auto/accessibility/data/tabbutton.qml
index cfb04ca2..6b979bc8 100644
--- a/tests/auto/accessibility/data/tabbutton.qml
+++ b/tests/auto/accessibility/data/tabbutton.qml
@@ -1,17 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- TabBar {
- id: tabbar
- objectName: "TabBar"
- TabButton {
- id: tabbutton
- objectName: "tabbutton"
- text: "TabButton"
- }
- }
+TabButton {
+ text: "TabButton"
}
diff --git a/tests/auto/accessibility/data/textarea.qml b/tests/auto/accessibility/data/textarea.qml
index 381c08bd..93b5b220 100644
--- a/tests/auto/accessibility/data/textarea.qml
+++ b/tests/auto/accessibility/data/textarea.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- TextArea {
- id: textarea
- objectName: "textarea"
- text: "TextArea"
- }
+TextArea {
+ text: "TextArea"
}
diff --git a/tests/auto/accessibility/data/textfield.qml b/tests/auto/accessibility/data/textfield.qml
index 5db46d82..06ba1a58 100644
--- a/tests/auto/accessibility/data/textfield.qml
+++ b/tests/auto/accessibility/data/textfield.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- TextField {
- id: textfield
- objectName: "textfield"
- text: "TextField"
- }
+TextField {
+ text: "TextField"
}
diff --git a/tests/auto/accessibility/data/toolbar.qml b/tests/auto/accessibility/data/toolbar.qml
index c0503aef..7b3ba07f 100644
--- a/tests/auto/accessibility/data/toolbar.qml
+++ b/tests/auto/accessibility/data/toolbar.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- ToolBar {
- id: toolbar
- objectName: "toolbar"
- }
-}
+ToolBar { }
diff --git a/tests/auto/accessibility/data/toolbutton.qml b/tests/auto/accessibility/data/toolbutton.qml
index 63aacddc..79f155ec 100644
--- a/tests/auto/accessibility/data/toolbutton.qml
+++ b/tests/auto/accessibility/data/toolbutton.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import QtQuick.Controls 2.0
-Window {
- visible: true
-
- ToolButton {
- id: toolbutton
- objectName: "toolbutton"
- text: "ToolButton"
- }
+ToolButton {
+ text: "ToolButton"
}
diff --git a/tests/auto/accessibility/data/tooltip.qml b/tests/auto/accessibility/data/tooltip.qml
new file mode 100644
index 00000000..1d1bae28
--- /dev/null
+++ b/tests/auto/accessibility/data/tooltip.qml
@@ -0,0 +1,6 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+ToolTip {
+ text: "ToolTip"
+}
diff --git a/tests/auto/accessibility/data/tumbler.qml b/tests/auto/accessibility/data/tumbler.qml
new file mode 100644
index 00000000..11c737d7
--- /dev/null
+++ b/tests/auto/accessibility/data/tumbler.qml
@@ -0,0 +1,4 @@
+import QtQuick 2.5
+import QtQuick.Controls 2.0
+
+Tumbler { }
diff --git a/tests/auto/accessibility/data/weeknumbercolumn-2.qml b/tests/auto/accessibility/data/weeknumbercolumn-2.qml
index bc3b1739..7d682315 100644
--- a/tests/auto/accessibility/data/weeknumbercolumn-2.qml
+++ b/tests/auto/accessibility/data/weeknumbercolumn-2.qml
@@ -1,12 +1,4 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import Qt.labs.calendar 1.0
-Window {
- visible: true
-
- WeekNumberColumn {
- id: weeknumbercolumn
- objectName: "weeknumbercolumn"
- }
-}
+WeekNumberColumn { }
diff --git a/tests/auto/accessibility/data/weeknumbercolumn.qml b/tests/auto/accessibility/data/weeknumbercolumn.qml
index 7fadb5da..6b024872 100644
--- a/tests/auto/accessibility/data/weeknumbercolumn.qml
+++ b/tests/auto/accessibility/data/weeknumbercolumn.qml
@@ -1,13 +1,6 @@
import QtQuick 2.5
-import QtQuick.Window 2.2
import Qt.labs.calendar 1.0
-Window {
- visible: true
-
- WeekNumberColumn {
- id: weeknumbercolumn
- objectName: "weeknumbercolumn"
- Accessible.name: "WeekNumberColumn"
- }
+WeekNumberColumn {
+ Accessible.name: "WeekNumberColumn"
}
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index e97e4702..99f6391e 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -34,27 +34,21 @@
**
****************************************************************************/
-#include <qtest.h>
-#include <QtTest/QSignalSpy>
+#include <QtTest/qtest.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlcontext.h>
-#include <QtQuick/qquickview.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
#include "../shared/util.h"
-#include "../shared/visualtestutil.h"
#ifndef QT_NO_ACCESSIBILITY
#include <QtQuick/private/qquickaccessibleattached_p.h>
#endif
-using namespace QQuickVisualTestUtil;
-
class tst_accessibility : public QQmlDataTest
{
Q_OBJECT
-public:
private slots:
void a11y_data();
@@ -70,35 +64,47 @@ void tst_accessibility::a11y_data()
QTest::addColumn<int>("role");
QTest::addColumn<QString>("text");
+ QTest::newRow("AbstractButton") << "abstractbutton" << 0x0000002B << "AbstractButton"; //QAccessible::Button
QTest::newRow("BusyIndicator") << "busyindicator" << 0x00000027 << ""; //QAccessible::Indicator
QTest::newRow("Button") << "button" << 0x0000002B << "Button"; //QAccessible::Button
QTest::newRow("CheckBox") << "checkbox" << 0x0000002C << "CheckBox"; //QAccessible::CheckBox
- // Frame
- // GroupBox
+ QTest::newRow("CheckDelegate") << "checkdelegate" << 0x0000002C << "CheckDelegate"; //QAccessible::CheckBox
+ QTest::newRow("ComboBox") << "combobox" << 0x0000002E << "ComboBox"; //QAccessible::ComboBox
+ QTest::newRow("Container") << "container" << 0x00000000 << ""; //QAccessible::NoRole
+ QTest::newRow("Control") << "control" << 0x00000000 << ""; //QAccessible::NoRole
+ QTest::newRow("Dial") << "dial" << 0x00000031 << ""; //QAccessible::Dial
+ QTest::newRow("Drawer") << "drawer" << 0x00000012 << ""; //QAccessible::Dialog
+ QTest::newRow("Frame") << "frame" << 0x00000013 << ""; //QAccessible::Border
+ QTest::newRow("GroupBox") << "groupbox" << 0x00000014 << "GroupBox"; //QAccessible::Grouping
+ QTest::newRow("ItemDelegate") << "itemdelegate" << 0x00000022 << "ItemDelegate"; //QAccessible::ListItem
QTest::newRow("Label") << "label" << 0x00000029 << "Label"; //QAccessible::StaticText
QTest::newRow("Menu") << "menu" << 0x0000000B << ""; //QAccessible::PopupMenu
+ QTest::newRow("MenuItem") << "menuitem" << 0x0000000C << "MenuItem"; //QAccessible::MenuItem
+ QTest::newRow("Page") << "page" << 0x00000025 << "Page"; //QAccessible::PageTab
QTest::newRow("PageIndicator") << "pageindicator" << 0x00000027 << ""; //QAccessible::Indicator
- QTest::newRow("Popup") << "popup" << 0x00000080 << ""; //QAccessible::LayeredPane
+ QTest::newRow("Pane") << "pane" << 0x00000010 << ""; //QAccessible::Pane
+ QTest::newRow("Popup") << "popup" << 0x00000012 << ""; //QAccessible::Dialog
QTest::newRow("ProgressBar") << "progressbar" << 0x00000030 << ""; //QAccessible::ProgressBar
QTest::newRow("RadioButton") << "radiobutton" << 0x0000002D << "RadioButton"; //QAccessible::RadioButton
+ QTest::newRow("RadioDelegate") << "radiodelegate" << 0x0000002D << "RadioDelegate"; //QAccessible::RadioButton
QTest::newRow("RangeSlider") << "rangeslider" << 0x00000033 << ""; //QAccessible::Slider
QTest::newRow("ScrollBar") << "scrollbar" << 0x00000003 << ""; //QAccessible::ScrollBar
QTest::newRow("ScrollIndicator") << "scrollindicator" << 0x00000027 << ""; //QAccessible::Indicator
QTest::newRow("Slider") << "slider" << 0x00000033 << ""; //QAccessible::Slider
QTest::newRow("SpinBox") << "spinbox" << 0x00000034 << ""; //QAccessible::SpinBox
- // StackView
+ QTest::newRow("StackView") << "stackview" << 0x00000080 << ""; //QAccessible::LayeredPane
+ QTest::newRow("SwipeDelegate") << "swipedelegate" << 0x00000022 << "SwipeDelegate"; //QAccessible::ListItem
+ QTest::newRow("SwipeView") << "swipeview" << 0x0000003C << ""; //QAccessible::Pane
QTest::newRow("Switch") << "switch" << 0x0000002B << "Switch"; //QAccessible::Button
+ QTest::newRow("SwitchDelegate") << "switchdelegate" << 0x00000022 << "SwitchDelegate"; //QAccessible::ListItem
QTest::newRow("TabBar") << "tabbar" << 0x0000003C << ""; //QAccessible::PageTabList
QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab
QTest::newRow("TextArea") << "textarea" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
QTest::newRow("TextField") << "textfield" << 0x0000002A << ""; //QAccessible::Accessible.EditableText
QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar
QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button
-
- QTest::newRow("Dial") << "dial" << 0x00000031 << ""; //QAccessible::Dial
- // Drawer
- // SwipeView
- // Tumbler
+ QTest::newRow("ToolTip") << "tooltip" << 0x0000000D << "ToolTip"; //QAccessible::ToolTip
+ QTest::newRow("Tumbler") << "tumbler" << 0x00000000 << ""; //QAccessible::NoRole (TODO)
QTest::newRow("DayOfWeekRow") << "dayofweekrow" << 0x0 << "DayOfWeekRow"; //QAccessible::NoRole
QTest::newRow("MonthGrid") << "monthgrid" << 0x0 << "MonthGrid"; //QAccessible::NoRole
@@ -119,7 +125,6 @@ void tst_accessibility::a11y()
QFETCH(int, role);
QFETCH(QString, text);
- QQmlComponent component(&engine);
QString fn = name;
#ifdef QT_NO_ACCESSIBILITY
if (name == QLatin1Literal("dayofweekrow")
@@ -127,20 +132,16 @@ void tst_accessibility::a11y()
|| name == QLatin1Literal("weeknumbercolumn"))
fn += QLatin1Literal("-2");
#endif
+
+ QQmlComponent component(&engine);
component.loadUrl(testFileUrl(fn + ".qml"));
- QObject* created = component.create();
- QVERIFY2(created, qPrintable(component.errorString()));
- QScopedPointer<QObject> cleanup(created);
- QVERIFY(!cleanup.isNull());
- QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
- QVERIFY(window);
- window->show();
- QVERIFY(QTest::qWaitForWindowActive(window));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
- QQuickItem *item = findItem<QQuickItem>(window->contentItem(), name);
+ QQuickItem *item = qobject_cast<QQuickItem *>(object.data());
if (!item) {
- QQuickPopup *popup = window->contentItem()->findChild<QQuickPopup *>(name);
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(object.data());
if (popup)
item = popup->popupItem();
}
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index f8717a88..9038f1d6 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -52,16 +52,21 @@ TestCase {
Component {
id: button
- Button {
- id: control
+ Button { }
+ }
- property SignalSequenceSpy spy: SignalSequenceSpy {
- target: control
- signals: ["pressed", "released", "canceled", "clicked", "doubleClicked", "pressedChanged", "downChanged", "checkedChanged"]
- }
+ Component {
+ id: signalSequenceSpy
+ SignalSequenceSpy {
+ signals: ["pressed", "released", "canceled", "clicked", "doubleClicked", "pressedChanged", "downChanged", "checkedChanged"]
}
}
+ Component {
+ id: signalSpy
+ SignalSpy { }
+ }
+
function test_text() {
var control = button.createObject(testCase)
verify(control)
@@ -79,52 +84,54 @@ TestCase {
var control = button.createObject(testCase)
verify(control)
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
// click
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }],
["downChanged", { "down": false }],
"released",
"clicked"]
mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// release outside
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }],
["downChanged", { "down": false }]]
mouseMove(control, control.width * 2, control.height * 2, 0, Qt.LeftButton)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["canceled", { "pressed": false }]]
+ sequenceSpy.expectedSequence = [["canceled", { "pressed": false }]]
mouseRelease(control, control.width * 2, control.height * 2, Qt.LeftButton)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// right button
- control.spy.expectedSequence = []
+ sequenceSpy.expectedSequence = []
mousePress(control, control.width / 2, control.height / 2, Qt.RightButton)
compare(control.pressed, false)
mouseRelease(control, control.width / 2, control.height / 2, Qt.RightButton)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// double click
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed",
["pressedChanged", { "pressed": false }],
@@ -140,7 +147,7 @@ TestCase {
"released",
"clicked"]
mouseDoubleClickSequence(control, control.width / 2, control.height / 2, Qt.LeftButton)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
@@ -152,8 +159,10 @@ TestCase {
control.forceActiveFocus()
verify(control.activeFocus)
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
// click
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed",
["pressedChanged", { "pressed": false }],
@@ -161,15 +170,15 @@ TestCase {
"released",
"clicked"]
keyClick(Qt.Key_Space)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// no change
- control.spy.expectedSequence = []
+ sequenceSpy.expectedSequence = []
var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
- control.spy.reset()
+ sequenceSpy.reset()
keyClick(keys[i])
- verify(control.spy.success)
+ verify(sequenceSpy.success)
}
control.destroy()
@@ -179,8 +188,6 @@ TestCase {
return "actual event:" + JSON.stringify(actual) + ", expected event:" + JSON.stringify(expected)
}
- SignalSpy { id: clickSpy; signalName: "clicked" }
-
function test_autoRepeat() {
var control = button.createObject(testCase)
verify(control)
@@ -192,50 +199,77 @@ TestCase {
control.forceActiveFocus()
verify(control.activeFocus)
- clickSpy.target = control
+ var clickSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"})
verify(clickSpy.valid)
+ var pressSpy = signalSpy.createObject(control, {target: control, signalName: "pressed"})
+ verify(pressSpy.valid)
+ var releaseSpy = signalSpy.createObject(control, {target: control, signalName: "released"})
+ verify(releaseSpy.valid)
- var repeatCount = 2
- var repeatSequence = [["pressedChanged", { "pressed": true }],
- ["downChanged", { "down": true }],
- "pressed",
- "released",
- "clicked",
- "pressed",
- "released",
- "clicked",
- "pressed"]
-
- // auto-repeat a couple of mouse clicks
- control.spy.expectedSequence = repeatSequence
+ // auto-repeat mouse click
mousePress(control)
compare(control.pressed, true)
- tryCompare(clickSpy, "count", repeatCount)
- verify(control.spy.success)
-
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false }],
- ["downChanged", { "down": false }],
- "released",
- "clicked"]
+ clickSpy.wait()
+ clickSpy.wait()
+ compare(pressSpy.count, clickSpy.count + 1)
+ compare(releaseSpy.count, clickSpy.count)
mouseRelease(control)
compare(control.pressed, false)
- verify(control.spy.success)
+ compare(clickSpy.count, pressSpy.count)
+ compare(releaseSpy.count, pressSpy.count)
- // auto-repeat a couple of key clicks
clickSpy.clear()
- control.spy.expectedSequence = repeatSequence
+ pressSpy.clear()
+ releaseSpy.clear()
+
+ // auto-repeat key click
keyPress(Qt.Key_Space)
compare(control.pressed, true)
- tryCompare(clickSpy, "count", repeatCount)
- verify(control.spy.success)
-
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false }],
- ["downChanged", { "down": false }],
- "released",
- "clicked"]
+ clickSpy.wait()
+ clickSpy.wait()
+ compare(pressSpy.count, clickSpy.count + 1)
+ compare(releaseSpy.count, clickSpy.count)
keyRelease(Qt.Key_Space)
compare(control.pressed, false)
- verify(control.spy.success)
+ compare(clickSpy.count, pressSpy.count)
+ compare(releaseSpy.count, pressSpy.count)
+
+ clickSpy.clear()
+ pressSpy.clear()
+ releaseSpy.clear()
+
+ mousePress(control)
+ compare(control.pressed, true)
+ clickSpy.wait()
+ compare(pressSpy.count, clickSpy.count + 1)
+ compare(releaseSpy.count, clickSpy.count)
+
+ // move inside during repeat -> continue repeat
+ mouseMove(control, control.width / 4, control.height / 4)
+ clickSpy.wait()
+ compare(pressSpy.count, clickSpy.count + 1)
+ compare(releaseSpy.count, clickSpy.count)
+
+ clickSpy.clear()
+ pressSpy.clear()
+ releaseSpy.clear()
+
+ // move outside during repeat -> stop repeat
+ mouseMove(control, -1, -1)
+ // NOTE: The following wait() is NOT a reliable way to test that the
+ // auto-repeat timer is not running, but there's no way dig into the
+ // private APIs from QML. If this test ever fails in the future, it
+ // indicates that the auto-repeat timer logic is broken.
+ wait(125)
+ compare(clickSpy.count, 0)
+ compare(pressSpy.count, 0)
+ compare(releaseSpy.count, 0)
+
+ mouseRelease(control, -1, -1)
+ compare(control.pressed, false)
+ compare(clickSpy.count, 0)
+ compare(pressSpy.count, 0)
+ compare(releaseSpy.count, 0)
control.destroy()
}
@@ -253,7 +287,9 @@ TestCase {
verify(control.hasOwnProperty("checkable"))
verify(!control.checkable)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed",
["pressedChanged", { "pressed": false }],
@@ -262,9 +298,9 @@ TestCase {
"clicked"]
mouseClick(control)
verify(!control.checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed",
["pressedChanged", { "pressed": false }],
@@ -275,9 +311,9 @@ TestCase {
control.checkable = true
mouseClick(control)
verify(control.checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }],
["downChanged", { "down": true }],
"pressed",
["pressedChanged", { "pressed": false }],
@@ -287,7 +323,7 @@ TestCase {
"clicked"]
mouseClick(control)
verify(!control.checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
diff --git a/tests/auto/controls/data/tst_buttongroup.qml b/tests/auto/controls/data/tst_buttongroup.qml
index bb0ffe00..754e4f0b 100644
--- a/tests/auto/controls/data/tst_buttongroup.qml
+++ b/tests/auto/controls/data/tst_buttongroup.qml
@@ -55,30 +55,9 @@ TestCase {
ButtonGroup { }
}
- SignalSpy {
- id: checkedButtonSpy
- signalName: "checkedButtonChanged"
- }
-
- SignalSpy {
- id: buttonsSpy
- signalName: "buttonsChanged"
- }
-
- function init() {
- verify(!checkedButtonSpy.target)
- compare(checkedButtonSpy.count, 0)
-
- verify(!buttonsSpy.target)
- compare(buttonsSpy.count, 0)
- }
-
- function cleanup() {
- checkedButtonSpy.target = null
- checkedButtonSpy.clear()
-
- buttonsSpy.target = null
- buttonsSpy.clear()
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
function test_null() {
@@ -105,7 +84,7 @@ TestCase {
var group = buttonGroup.createObject(testCase)
verify(group)
- checkedButtonSpy.target = group
+ var checkedButtonSpy = signalSpy.createObject(testCase, {target: group, signalName: "checkedButtonChanged"})
verify(checkedButtonSpy.valid)
verify(!group.checkedButton)
@@ -176,7 +155,7 @@ TestCase {
var group = buttonGroup.createObject(testCase)
verify(group)
- buttonsSpy.target = group
+ var buttonsSpy = signalSpy.createObject(testCase, {target: group, signalName: "buttonsChanged"})
verify(buttonsSpy.valid)
compare(group.buttons.length, 0)
@@ -301,7 +280,7 @@ TestCase {
var group = buttonGroup.createObject(testCase)
verify(group)
- buttonsSpy.target = group
+ var buttonsSpy = signalSpy.createObject(testCase, {target: group, signalName: "buttonsChanged"})
verify(buttonsSpy.valid)
var button1 = button.createObject(testCase, {objectName: "button1", checked: true})
diff --git a/tests/auto/controls/data/tst_checkbox.qml b/tests/auto/controls/data/tst_checkbox.qml
index 7969b589..044b0006 100644
--- a/tests/auto/controls/data/tst_checkbox.qml
+++ b/tests/auto/controls/data/tst_checkbox.qml
@@ -52,13 +52,13 @@ TestCase {
Component {
id: checkBox
- CheckBox {
- id: control
+ CheckBox { }
+ }
- property SignalSequenceSpy spy: SignalSequenceSpy {
- target: control
- signals: ["pressed", "released", "canceled", "clicked", "pressedChanged", "checkedChanged", "checkStateChanged"]
- }
+ Component {
+ id: signalSequenceSpy
+ SignalSequenceSpy {
+ signals: ["pressed", "released", "canceled", "clicked", "pressedChanged", "checkedChanged", "checkStateChanged"]
}
}
@@ -79,24 +79,26 @@ TestCase {
var control = checkBox.createObject(testCase)
verify(control)
- control.spy.expectedSequence = []
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = []
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["checkStateChanged", { "checked": true, "checkState": Qt.Checked }],
+ sequenceSpy.expectedSequence = [["checkStateChanged", { "checked": true, "checkState": Qt.Checked }],
["checkedChanged", { "checked": true, "checkState": Qt.Checked }]]
control.checked = true
compare(control.checked, true)
compare(control.checkState, Qt.Checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["checkStateChanged", { "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["checkStateChanged", { "checked": false, "checkState": Qt.Unchecked }],
["checkedChanged", { "checked": false, "checkState": Qt.Unchecked }]]
control.checked = false
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
@@ -105,24 +107,26 @@ TestCase {
var control = checkBox.createObject(testCase)
verify(control)
- control.spy.expectedSequence = []
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = []
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["checkStateChanged", { "checked": true, "checkState": Qt.Checked }],
+ sequenceSpy.expectedSequence = [["checkStateChanged", { "checked": true, "checkState": Qt.Checked }],
["checkedChanged", { "checked": true, "checkState": Qt.Checked }]]
control.checkState = Qt.Checked
compare(control.checked, true)
compare(control.checkState, Qt.Checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["checkStateChanged", { "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["checkStateChanged", { "checked": false, "checkState": Qt.Unchecked }],
["checkedChanged", { "checked": false, "checkState": Qt.Unchecked }]]
control.checkState = Qt.Unchecked
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
@@ -131,14 +135,16 @@ TestCase {
var control = checkBox.createObject(testCase)
verify(control)
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
// check
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
["checkedChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
"released",
@@ -147,15 +153,15 @@ TestCase {
compare(control.checked, true)
compare(control.checkState, Qt.Checked)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// uncheck
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
+ verify(sequenceSpy.success)
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
["checkStateChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
["checkedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
"released",
@@ -164,34 +170,34 @@ TestCase {
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// release outside
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }]]
+ verify(sequenceSpy.success)
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }]]
mouseMove(control, control.width * 2, control.height * 2, 0, Qt.LeftButton)
compare(control.pressed, false)
- verify(control.spy.success)
- control.spy.expectedSequence = [["canceled", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }]]
+ verify(sequenceSpy.success)
+ sequenceSpy.expectedSequence = [["canceled", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }]]
mouseRelease(control, control.width * 2, control.height * 2, Qt.LeftButton)
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// right button
- control.spy.expectedSequence = []
+ sequenceSpy.expectedSequence = []
mousePress(control, control.width / 2, control.height / 2, Qt.RightButton)
compare(control.pressed, false)
mouseRelease(control, control.width / 2, control.height / 2, Qt.RightButton)
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
@@ -200,13 +206,15 @@ TestCase {
var control = checkBox.createObject(testCase)
verify(control)
- control.spy.expectedSequence = []
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = []
control.forceActiveFocus()
verify(control.activeFocus)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// check
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
@@ -216,10 +224,10 @@ TestCase {
keyClick(Qt.Key_Space)
compare(control.checked, true)
compare(control.checkState, Qt.Checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// uncheck
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
["checkStateChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
@@ -229,16 +237,16 @@ TestCase {
keyClick(Qt.Key_Space)
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// no change
- control.spy.expectedSequence = []
+ sequenceSpy.expectedSequence = []
var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
- control.spy.reset()
+ sequenceSpy.reset()
keyClick(keys[i])
compare(control.checked, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
}
control.destroy()
@@ -323,7 +331,9 @@ TestCase {
function test_tristate() {
var control = checkBox.createObject(testCase)
- control.spy.expectedSequence = []
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = []
control.forceActiveFocus()
verify(control.activeFocus)
@@ -331,16 +341,16 @@ TestCase {
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- control.spy.expectedSequence = [["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }],
+ sequenceSpy.expectedSequence = [["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }],
["checkedChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }]]
control.checkState = Qt.PartiallyChecked
compare(control.tristate, true)
compare(control.checked, true)
compare(control.checkState, Qt.PartiallyChecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// key: partial -> checked
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.PartiallyChecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.PartiallyChecked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }],
["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
@@ -349,10 +359,10 @@ TestCase {
keyClick(Qt.Key_Space)
compare(control.checked, true)
compare(control.checkState, Qt.Checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// key: checked -> unchecked
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
["checkStateChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
@@ -362,10 +372,10 @@ TestCase {
keyClick(Qt.Key_Space)
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// key: unchecked -> partial
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }],
@@ -375,10 +385,10 @@ TestCase {
keyClick(Qt.Key_Space)
compare(control.checked, true)
compare(control.checkState, Qt.PartiallyChecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// mouse: partial -> checked
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.PartiallyChecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.PartiallyChecked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }],
["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
@@ -387,10 +397,10 @@ TestCase {
mouseClick(control)
compare(control.checked, true)
compare(control.checkState, Qt.Checked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// mouse: checked -> unchecked
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true, "checkState": Qt.Checked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": true, "checkState": Qt.Checked }],
["checkStateChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
@@ -400,10 +410,10 @@ TestCase {
mouseClick(control)
compare(control.checked, false)
compare(control.checkState, Qt.Unchecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// mouse: unchecked -> partial
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false, "checkState": Qt.Unchecked }],
"pressed",
["pressedChanged", { "pressed": false, "checked": false, "checkState": Qt.Unchecked }],
["checkStateChanged", { "pressed": false, "checked": true, "checkState": Qt.PartiallyChecked }],
@@ -413,7 +423,7 @@ TestCase {
mouseClick(control)
compare(control.checked, true)
compare(control.checkState, Qt.PartiallyChecked)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 479b1002..607de2e8 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -51,16 +51,6 @@ TestCase {
when: windowShown
name: "ComboBox"
- SignalSpy {
- id: activatedSpy
- signalName: "activated"
- }
-
- SignalSpy {
- id: highlightedSpy
- signalName: "highlighted"
- }
-
Component {
id: signalSpy
SignalSpy { }
@@ -80,22 +70,6 @@ TestCase {
}
}
- function init() {
- verify(!activatedSpy.target)
- compare(activatedSpy.count, 0)
-
- verify(!highlightedSpy.target)
- compare(highlightedSpy.count, 0)
- }
-
- function cleanup() {
- activatedSpy.target = null
- activatedSpy.clear()
-
- highlightedSpy.target = null
- highlightedSpy.clear()
- }
-
function test_defaults() {
var control = comboBox.createObject(testCase)
verify(control)
@@ -332,10 +306,10 @@ TestCase {
var control = comboBox.createObject(testCase, {model: 3})
verify(control)
- activatedSpy.target = control
+ var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"})
verify(activatedSpy.valid)
- highlightedSpy.target = control
+ var highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"})
verify(highlightedSpy.valid)
waitForRendering(control)
@@ -457,7 +431,7 @@ TestCase {
control.destroy()
}
- function test_keys_data() {
+ function test_keys_space_enter_escape_data() {
return [
{ tag: "space-space", key1: Qt.Key_Space, key2: Qt.Key_Space, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
{ tag: "space-enter", key1: Qt.Key_Space, key2: Qt.Key_Enter, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
@@ -470,7 +444,7 @@ TestCase {
]
}
- function test_keys(data) {
+ function test_keys_space_enter_escape(data) {
var control = comboBox.createObject(testCase, {model: 3})
verify(control)
@@ -493,7 +467,6 @@ TestCase {
// hide popup
keyPress(data.key2)
compare(control.pressed, data.hidePress)
- compare(control.popup.visible, data.showPopup)
keyRelease(data.key2)
compare(control.pressed, false)
tryCompare(control.popup, "visible", !data.hidePopup)
@@ -501,6 +474,162 @@ TestCase {
control.destroy()
}
+ function test_keys_home_end() {
+ var control = comboBox.createObject(testCase, {model: 5})
+ verify(control)
+
+ control.forceActiveFocus()
+ verify(control.activeFocus)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, -1)
+
+ var activatedCount = 0
+ var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"})
+ verify(activatedSpy.valid)
+
+ var highlightedCount = 0
+ var highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"})
+ verify(highlightedSpy.valid)
+
+ var currentIndexCount = 0
+ var currentIndexSpy = signalSpy.createObject(control, {target: control, signalName: "currentIndexChanged"})
+ verify(currentIndexSpy.valid)
+
+ var highlightedIndexCount = 0
+ var highlightedIndexSpy = signalSpy.createObject(control, {target: control, signalName: "highlightedIndexChanged"})
+ verify(highlightedIndexSpy.valid)
+
+ // end (popup closed)
+ keyClick(Qt.Key_End)
+ compare(control.currentIndex, 4)
+ compare(currentIndexSpy.count, ++currentIndexCount)
+
+ compare(control.highlightedIndex, -1)
+ compare(highlightedIndexSpy.count, highlightedIndexCount)
+
+ compare(activatedSpy.count, ++activatedCount)
+ compare(activatedSpy.signalArguments[activatedCount-1][0], 4)
+
+ compare(highlightedSpy.count, highlightedCount)
+
+ // repeat (no changes/signals)
+ keyClick(Qt.Key_End)
+ compare(currentIndexSpy.count, currentIndexCount)
+ compare(highlightedIndexSpy.count, highlightedIndexCount)
+ compare(activatedSpy.count, activatedCount)
+ compare(highlightedSpy.count, highlightedCount)
+
+ // home (popup closed)
+ keyClick(Qt.Key_Home)
+ compare(control.currentIndex, 0)
+ compare(currentIndexSpy.count, ++currentIndexCount)
+
+ compare(control.highlightedIndex, -1)
+ compare(highlightedIndexSpy.count, highlightedIndexCount)
+
+ compare(activatedSpy.count, ++activatedCount)
+ compare(activatedSpy.signalArguments[activatedCount-1][0], 0)
+
+ compare(highlightedSpy.count, highlightedCount)
+
+ // repeat (no changes/signals)
+ keyClick(Qt.Key_Home)
+ compare(currentIndexSpy.count, currentIndexCount)
+ compare(highlightedIndexSpy.count, highlightedIndexCount)
+ compare(activatedSpy.count, activatedCount)
+ compare(highlightedSpy.count, highlightedCount)
+
+ control.popup.open()
+ compare(control.highlightedIndex, 0)
+ compare(highlightedIndexSpy.count, ++highlightedIndexCount)
+ compare(highlightedSpy.count, highlightedCount)
+
+ // end (popup open)
+ keyClick(Qt.Key_End)
+ compare(control.currentIndex, 0)
+ compare(currentIndexSpy.count, currentIndexCount)
+
+ compare(control.highlightedIndex, 4)
+ compare(highlightedIndexSpy.count, ++highlightedIndexCount)
+
+ compare(activatedSpy.count, activatedCount)
+
+ compare(highlightedSpy.count, ++highlightedCount)
+ compare(highlightedSpy.signalArguments[highlightedCount-1][0], 4)
+
+ // repeat (no changes/signals)
+ keyClick(Qt.Key_End)
+ compare(currentIndexSpy.count, currentIndexCount)
+ compare(highlightedIndexSpy.count, highlightedIndexCount)
+ compare(activatedSpy.count, activatedCount)
+ compare(highlightedSpy.count, highlightedCount)
+
+ // home (popup open)
+ keyClick(Qt.Key_Home)
+ compare(control.currentIndex, 0)
+ compare(currentIndexSpy.count, currentIndexCount)
+
+ compare(control.highlightedIndex, 0)
+ compare(highlightedIndexSpy.count, ++highlightedIndexCount)
+
+ compare(activatedSpy.count, activatedCount)
+
+ compare(highlightedSpy.count, ++highlightedCount)
+ compare(highlightedSpy.signalArguments[highlightedCount-1][0], 0)
+
+ // repeat (no changes/signals)
+ keyClick(Qt.Key_Home)
+ compare(currentIndexSpy.count, currentIndexCount)
+ compare(highlightedIndexSpy.count, highlightedIndexCount)
+ compare(activatedSpy.count, activatedCount)
+ compare(highlightedSpy.count, highlightedCount)
+
+ control.destroy()
+ }
+
+ function test_keySearch() {
+ var control = comboBox.createObject(testCase, {model: ["Banana", "Coco", "Coconut", "Apple", "Cocomuffin"]})
+ verify(control)
+
+ control.forceActiveFocus()
+ verify(control.activeFocus)
+
+ compare(control.currentIndex, 0)
+ compare(control.currentText, "Banana")
+
+ keyPress(Qt.Key_C)
+ compare(control.currentIndex, 1)
+ compare(control.currentText, "Coco")
+
+ // no match
+ keyPress(Qt.Key_N)
+ compare(control.currentIndex, 1)
+ compare(control.currentText, "Coco")
+
+ keyPress(Qt.Key_C)
+ compare(control.currentIndex, 2)
+ compare(control.currentText, "Coconut")
+
+ keyPress(Qt.Key_C)
+ compare(control.currentIndex, 4)
+ compare(control.currentText, "Cocomuffin")
+
+ // wrap
+ keyPress(Qt.Key_C)
+ compare(control.currentIndex, 1)
+ compare(control.currentText, "Coco")
+
+ keyPress(Qt.Key_A)
+ compare(control.currentIndex, 3)
+ compare(control.currentText, "Apple")
+
+ keyPress(Qt.Key_B)
+ compare(control.currentIndex, 0)
+ compare(control.currentText, "Banana")
+
+ control.destroy()
+ }
+
function test_popup() {
var control = comboBox.createObject(testCase, {model: 3})
verify(control)
@@ -544,10 +673,10 @@ TestCase {
var control = comboBox.createObject(testCase, {model: 3})
verify(control)
- activatedSpy.target = control
+ var activatedSpy = signalSpy.createObject(control, {target: control, signalName: "activated"})
verify(activatedSpy.valid)
- highlightedSpy.target = control
+ var highlightedSpy = signalSpy.createObject(control, {target: control, signalName: "highlighted"})
verify(highlightedSpy.valid)
mouseClick(control)
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml
index 4b7a60dc..3018498e 100644
--- a/tests/auto/controls/data/tst_control.qml
+++ b/tests/auto/controls/data/tst_control.qml
@@ -71,21 +71,6 @@ TestCase {
SignalSpy { }
}
- SignalSpy {
- id: mirroredSpy
- signalName: "mirroredChanged"
- }
-
- SignalSpy {
- id: availableWidthSpy
- signalName: "availableWidthChanged"
- }
-
- SignalSpy {
- id: availableHeightSpy
- signalName: "availableHeightChanged"
- }
-
function test_padding() {
var control = component.createObject(testCase)
verify(control)
@@ -150,10 +135,10 @@ TestCase {
var control = component.createObject(testCase)
verify(control)
- availableWidthSpy.target = control
- availableHeightSpy.target = control
-
+ var availableWidthSpy = signalSpy.createObject(control, {target: control, signalName: "availableWidthChanged"})
verify(availableWidthSpy.valid)
+
+ var availableHeightSpy = signalSpy.createObject(control, {target: control, signalName: "availableHeightChanged"})
verify(availableHeightSpy.valid)
var availableWidthChanges = 0
@@ -222,7 +207,7 @@ TestCase {
var control = component.createObject(testCase)
verify(control)
- mirroredSpy.target = control
+ var mirroredSpy = signalSpy.createObject(control, {target: control, signalName: "mirroredChanged"})
verify(mirroredSpy.valid)
control.locale = Qt.locale("en_US")
@@ -862,8 +847,15 @@ TestCase {
compare(control.mirroredspy_5.count, 1)
}
- function test_hover() {
- var control = component.createObject(testCase, {width: 100, height: 100})
+ function test_hover_data() {
+ return [
+ { tag: "normal", target: component, pressed: false },
+ { tag: "pressed", target: button, pressed: true }
+ ]
+ }
+
+ function test_hover(data) {
+ var control = data.target.createObject(testCase, {width: 100, height: 100})
verify(control)
compare(control.hovered, false)
@@ -877,9 +869,19 @@ TestCase {
mouseMove(control, control.width / 2, control.height / 2)
compare(control.hovered, true)
+ if (data.pressed) {
+ mousePress(control, control.width / 2, control.height / 2)
+ compare(control.hovered, true)
+ }
+
mouseMove(control, -10, -10)
compare(control.hovered, false)
+ if (data.pressed) {
+ mouseRelease(control, -10, control.height / 2)
+ compare(control.hovered, false)
+ }
+
mouseMove(control, control.width / 2, control.height / 2)
compare(control.hovered, true)
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
index 8d8f94b7..0ca8ce57 100644
--- a/tests/auto/controls/data/tst_popup.qml
+++ b/tests/auto/controls/data/tst_popup.qml
@@ -72,65 +72,28 @@ TestCase {
Rectangle { }
}
- SignalSpy {
- id: availableWidthSpy
- signalName: "availableWidthChanged"
- }
-
- SignalSpy {
- id: availableHeightSpy
- signalName: "availableHeightChanged"
- }
-
- SignalSpy {
- id: paddingSpy
- signalName: "paddingChanged"
- }
-
- SignalSpy {
- id: topPaddingSpy
- signalName: "topPaddingChanged"
- }
-
- SignalSpy {
- id: leftPaddingSpy
- signalName: "leftPaddingChanged"
- }
-
- SignalSpy {
- id: rightPaddingSpy
- signalName: "rightPaddingChanged"
- }
-
- SignalSpy {
- id: bottomPaddingSpy
- signalName: "bottomPaddingChanged"
- }
-
- SignalSpy {
- id: xSpy
- signalName: "xChanged"
- }
-
- SignalSpy {
- id: ySpy
- signalName: "yChanged"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
function test_padding() {
var control = popupTemplate.createObject(testCase)
verify(control)
- paddingSpy.target = control
- topPaddingSpy.target = control
- leftPaddingSpy.target = control
- rightPaddingSpy.target = control
- bottomPaddingSpy.target = control
-
+ var paddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "paddingChanged"})
verify(paddingSpy.valid)
+
+ var topPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "topPaddingChanged"})
verify(topPaddingSpy.valid)
+
+ var leftPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "leftPaddingChanged"})
verify(leftPaddingSpy.valid)
+
+ var rightPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "rightPaddingChanged"})
verify(rightPaddingSpy.valid)
+
+ var bottomPaddingSpy = signalSpy.createObject(testCase, {target: control, signalName: "bottomPaddingChanged"})
verify(bottomPaddingSpy.valid)
var paddingChanges = 0
@@ -229,10 +192,10 @@ TestCase {
var control = popupTemplate.createObject(testCase)
verify(control)
- availableWidthSpy.target = control
- availableHeightSpy.target = control
-
+ var availableWidthSpy = signalSpy.createObject(testCase, {target: control, signalName: "availableWidthChanged"})
verify(availableWidthSpy.valid)
+
+ var availableHeightSpy = signalSpy.createObject(testCase, {target: control, signalName: "availableHeightChanged"})
verify(availableHeightSpy.valid)
var availableWidthChanges = 0
@@ -302,10 +265,10 @@ TestCase {
verify(control)
verify(control.visible)
- xSpy.target = control
- ySpy.target = control
-
+ var xSpy = signalSpy.createObject(testCase, {target: control, signalName: "xChanged"})
verify(xSpy.valid)
+
+ var ySpy = signalSpy.createObject(testCase, {target: control, signalName: "yChanged"})
verify(ySpy.valid)
// moving outside margins does not trigger change notifiers
@@ -1266,4 +1229,35 @@ TestCase {
control.destroy()
}
+
+ Component {
+ id: xyBindingLoop
+ ApplicationWindow {
+ id: window
+ width: 360
+ height: 360
+ visible: true
+ property alias popup: popup
+
+ Popup {
+ id: popup
+ visible: true
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ Label {
+ text: "Content"
+ anchors.fill: parent
+ }
+ }
+ }
+ }
+
+ function test_xyBindingLoop() {
+ var window = xyBindingLoop.createObject(testCase)
+ var control = window.popup
+ waitForRendering(control.contentItem)
+ compare(control.x, (control.parent.width - control.width) / 2)
+ compare(control.y, (control.parent.height - control.height) / 2)
+ window.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_radiobutton.qml b/tests/auto/controls/data/tst_radiobutton.qml
index bd3850c8..e86b862e 100644
--- a/tests/auto/controls/data/tst_radiobutton.qml
+++ b/tests/auto/controls/data/tst_radiobutton.qml
@@ -52,13 +52,13 @@ TestCase {
Component {
id: radioButton
- RadioButton {
- id: control
+ RadioButton { }
+ }
- property SignalSequenceSpy spy: SignalSequenceSpy {
- target: control
- signals: ["pressed", "released", "canceled", "clicked", "pressedChanged", "checkedChanged"]
- }
+ Component {
+ id: signalSequenceSpy
+ SignalSequenceSpy {
+ signals: ["pressed", "released", "canceled", "clicked", "pressedChanged", "checkedChanged"]
}
}
@@ -79,19 +79,21 @@ TestCase {
var control = radioButton.createObject(testCase)
verify(control)
- control.spy.expectedSequence = [] // No change expected
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = [] // No change expected
compare(control.checked, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.expectedSequence = ["checkedChanged"]
+ sequenceSpy.expectedSequence = ["checkedChanged"]
control.checked = true
compare(control.checked, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
- control.spy.reset()
+ sequenceSpy.reset()
control.checked = false
compare(control.checked, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
@@ -100,59 +102,61 @@ TestCase {
var control = radioButton.createObject(testCase)
verify(control)
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
// check
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false }],
+ verify(sequenceSpy.success)
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": false }],
["checkedChanged", { "pressed": false, "checked": true }],
"released",
"clicked"]
mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.checked, true)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// attempt uncheck
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": true }],
+ verify(sequenceSpy.success)
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": true }],
"released",
"clicked"]
mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.checked, true)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// release outside
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true }],
"pressed"]
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
compare(control.pressed, true)
- verify(control.spy.success)
- control.spy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": true }]]
+ verify(sequenceSpy.success)
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false, "checked": true }]]
mouseMove(control, control.width * 2, control.height * 2, 0, Qt.LeftButton)
compare(control.pressed, false)
- control.spy.expectedSequence = [["canceled", { "pressed": false, "checked": true }]]
+ sequenceSpy.expectedSequence = [["canceled", { "pressed": false, "checked": true }]]
mouseRelease(control, control.width * 2, control.height * 2, Qt.LeftButton)
compare(control.checked, true)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// right button
- control.spy.expectedSequence = []
+ sequenceSpy.expectedSequence = []
mousePress(control, control.width / 2, control.height / 2, Qt.RightButton)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
mouseRelease(control, control.width / 2, control.height / 2, Qt.RightButton)
compare(control.checked, true)
compare(control.pressed, false)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
control.destroy()
}
@@ -161,13 +165,15 @@ TestCase {
var control = radioButton.createObject(testCase)
verify(control)
- control.spy.expectedSequence = []
+ var sequenceSpy = signalSequenceSpy.createObject(control, {target: control})
+
+ sequenceSpy.expectedSequence = []
control.forceActiveFocus()
verify(control.activeFocus)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// check
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": false }],
"pressed",
["pressedChanged", { "pressed": false, "checked": false }],
["checkedChanged", { "pressed": false, "checked": true }],
@@ -175,26 +181,26 @@ TestCase {
"clicked"]
keyClick(Qt.Key_Space)
compare(control.checked, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// attempt uncheck
- control.spy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true }],
+ sequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true, "checked": true }],
"pressed",
["pressedChanged", { "pressed": false, "checked": true }],
"released",
"clicked"]
keyClick(Qt.Key_Space)
compare(control.checked, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
// no change
- control.spy.expectedSequence = []
+ sequenceSpy.expectedSequence = []
var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab]
for (var i = 0; i < keys.length; ++i) {
- control.spy.reset()
+ sequenceSpy.reset()
keyClick(keys[i])
compare(control.checked, true)
- verify(control.spy.success)
+ verify(sequenceSpy.success)
}
control.destroy()
diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml
index 581a079c..3167be0b 100644
--- a/tests/auto/controls/data/tst_rangeslider.qml
+++ b/tests/auto/controls/data/tst_rangeslider.qml
@@ -50,14 +50,9 @@ TestCase {
when: windowShown
name: "RangeSlider"
- SignalSpy {
- id: firstPressedSpy
- signalName: "pressedChanged"
- }
-
- SignalSpy {
- id: secondPressedSpy
- signalName: "pressedChanged"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
Component {
@@ -84,21 +79,6 @@ TestCase {
}
}
- function init() {
- verify(!firstPressedSpy.target)
- compare(firstPressedSpy.count, 0)
-
- verify(!secondPressedSpy.target)
- compare(secondPressedSpy.count, 0)
- }
-
- function cleanup() {
- firstPressedSpy.target = null
- firstPressedSpy.clear()
- secondPressedSpy.target = null
- secondPressedSpy.clear()
- }
-
function test_defaults() {
var control = sliderComponent.createObject(testCase)
verify(control)
@@ -303,10 +283,10 @@ TestCase {
var control = sliderComponent.createObject(testCase, { orientation: data.orientation })
verify(control)
- firstPressedSpy.target = control.first
+ var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"})
verify(firstPressedSpy.valid)
- secondPressedSpy.target = control.second
+ var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"})
verify(secondPressedSpy.valid)
mousePress(control, control.width * 0.25, control.height * 0.75, Qt.LeftButton)
@@ -473,7 +453,7 @@ TestCase {
var pressedCount = 0
- firstPressedSpy.target = control.first
+ var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"})
verify(firstPressedSpy.valid)
control.first.handle.forceActiveFocus()
@@ -511,7 +491,7 @@ TestCase {
control.stepSize = 0.25
pressedCount = 0;
- secondPressedSpy.target = control.second
+ var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"})
verify(secondPressedSpy.valid)
control.second.handle.forceActiveFocus()
@@ -553,7 +533,7 @@ TestCase {
var control = sliderComponent.createObject(testCase, { leftPadding: 10, rightPadding: 20 })
verify(control)
- firstPressedSpy.target = control.first
+ var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"})
verify(firstPressedSpy.valid)
mousePress(control, control.first.handle.x, control.first.handle.y, Qt.LeftButton)
diff --git a/tests/auto/controls/data/tst_scrollbar.qml b/tests/auto/controls/data/tst_scrollbar.qml
index 7dc60d97..7c83cca9 100644
--- a/tests/auto/controls/data/tst_scrollbar.qml
+++ b/tests/auto/controls/data/tst_scrollbar.qml
@@ -50,9 +50,9 @@ TestCase {
when: windowShown
name: "ScrollBar"
- SignalSpy{
- id: pressedSpy
- signalName: "pressedChanged"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
Component {
@@ -72,16 +72,6 @@ TestCase {
}
}
- function init() {
- verify(!pressedSpy.target)
- compare(pressedSpy.count, 0)
- }
-
- function cleanup() {
- pressedSpy.target = null
- pressedSpy.clear()
- }
-
function test_attach() {
var container = flickable.createObject(testCase)
verify(container)
@@ -151,6 +141,22 @@ TestCase {
compare(horizontal.size, container.visibleArea.widthRatio)
compare(horizontal.position, container.visibleArea.xPosition)
+ var oldY = vertical.y
+ var oldHeight = vertical.height
+ vertical.parent = testCase
+ vertical.y -= 10
+ container.height += 10
+ compare(vertical.y, oldY - 10)
+ compare(vertical.height, oldHeight)
+
+ var oldX = horizontal.x
+ var oldWidth = horizontal.width
+ horizontal.parent = testCase
+ horizontal.x -= 10
+ container.width += 10
+ compare(horizontal.x, oldX - 10)
+ compare(horizontal.width, oldWidth)
+
container.destroy()
}
@@ -165,7 +171,7 @@ TestCase {
var control = scrollBar.createObject(testCase, data.properties)
verify(control)
- pressedSpy.target = control
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
verify(pressedSpy.valid)
mousePress(control, 0, 0, Qt.LeftButton)
@@ -211,6 +217,31 @@ TestCase {
control.destroy()
}
+ function test_increase_decrease_data() {
+ return [
+ { tag: "increase:active", increase: true, active: true },
+ { tag: "decrease:active", increase: false, active: true },
+ { tag: "increase:inactive", increase: true, active: false },
+ { tag: "decrease:inactive", increase: false, active: false }
+ ]
+ }
+
+ function test_increase_decrease(data) {
+ var control = scrollBar.createObject(testCase, {position: 0.5, active: data.active})
+ verify(control)
+
+ if (data.increase) {
+ control.increase()
+ compare(control.position, 0.6)
+ } else {
+ control.decrease()
+ compare(control.position, 0.4)
+ }
+ compare(control.active, data.active)
+
+ control.destroy()
+ }
+
function test_stepSize_data() {
return [
{ tag: "0.0", stepSize: 0.0 },
diff --git a/tests/auto/controls/data/tst_scrollindicator.qml b/tests/auto/controls/data/tst_scrollindicator.qml
index 90d9287a..f5e57e2d 100644
--- a/tests/auto/controls/data/tst_scrollindicator.qml
+++ b/tests/auto/controls/data/tst_scrollindicator.qml
@@ -136,6 +136,22 @@ TestCase {
compare(horizontal.size, container.visibleArea.widthRatio)
compare(horizontal.position, container.visibleArea.xPosition)
+ var oldY = vertical.y
+ var oldHeight = vertical.height
+ vertical.parent = testCase
+ vertical.y -= 10
+ container.height += 10
+ compare(vertical.y, oldY - 10)
+ compare(vertical.height, oldHeight)
+
+ var oldX = horizontal.x
+ var oldWidth = horizontal.width
+ horizontal.parent = testCase
+ horizontal.x -= 10
+ container.width += 10
+ compare(horizontal.x, oldX - 10)
+ compare(horizontal.width, oldWidth)
+
container.destroy()
}
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index bec4d236..4a698076 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -50,9 +50,9 @@ TestCase {
when: windowShown
name: "Slider"
- SignalSpy{
- id: pressedSpy
- signalName: "pressedChanged"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
Component {
@@ -60,16 +60,6 @@ TestCase {
Slider { }
}
- function init() {
- verify(!pressedSpy.target)
- compare(pressedSpy.count, 0)
- }
-
- function cleanup() {
- pressedSpy.target = null
- pressedSpy.clear()
- }
-
function test_defaults() {
var control = slider.createObject(testCase)
verify(control)
@@ -232,7 +222,7 @@ TestCase {
var control = slider.createObject(testCase, {orientation: data.orientation})
verify(control)
- pressedSpy.target = control
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
verify(pressedSpy.valid)
mousePress(control, 0, 0, Qt.LeftButton)
@@ -308,7 +298,7 @@ TestCase {
var pressedCount = 0
- pressedSpy.target = control
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
verify(pressedSpy.valid)
control.forceActiveFocus()
@@ -380,7 +370,7 @@ TestCase {
var control = slider.createObject(testCase, {leftPadding: 10, rightPadding: 20})
verify(control)
- pressedSpy.target = control
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
verify(pressedSpy.valid)
mousePress(control, 0, 0, Qt.LeftButton)
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index b370a05f..f2d8d3ef 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -50,14 +50,9 @@ TestCase {
when: windowShown
name: "SpinBox"
- SignalSpy{
- id: upPressedSpy
- signalName: "pressedChanged"
- }
-
- SignalSpy{
- id: downPressedSpy
- signalName: "pressedChanged"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
Component {
@@ -65,20 +60,6 @@ TestCase {
SpinBox { }
}
- function init() {
- verify(!upPressedSpy.target)
- compare(upPressedSpy.count, 0)
- verify(!downPressedSpy.target)
- compare(downPressedSpy.count, 0)
- }
-
- function cleanup() {
- upPressedSpy.target = null
- upPressedSpy.clear()
- downPressedSpy.target = null
- downPressedSpy.clear()
- }
-
function test_defaults() {
var control = spinBox.createObject(testCase)
verify(control)
@@ -190,9 +171,12 @@ TestCase {
var control = spinBox.createObject(testCase, {stepSize: 50})
verify(control)
- upPressedSpy.target = control.up
+ var upPressedSpy = signalSpy.createObject(control, {target: control.up, signalName: "pressedChanged"})
verify(upPressedSpy.valid)
+ var downPressedSpy = signalSpy.createObject(control, {target: control.down, signalName: "pressedChanged"})
+ verify(downPressedSpy.valid)
+
mousePress(control.up.indicator)
compare(upPressedSpy.count, 1)
compare(control.up.pressed, true)
@@ -225,9 +209,6 @@ TestCase {
compare(control.down.pressed, false)
compare(control.value, control.to)
- downPressedSpy.target = control.down
- verify(downPressedSpy.valid)
-
control.value = 50;
mousePress(control.down.indicator)
compare(downPressedSpy.count, 1)
@@ -271,10 +252,10 @@ TestCase {
var upPressedCount = 0
var downPressedCount = 0
- upPressedSpy.target = control.up
+ var upPressedSpy = signalSpy.createObject(control, {target: control.up, signalName: "pressedChanged"})
verify(upPressedSpy.valid)
- downPressedSpy.target = control.down
+ var downPressedSpy = signalSpy.createObject(control, {target: control.down, signalName: "pressedChanged"})
verify(downPressedSpy.valid)
control.forceActiveFocus()
@@ -510,4 +491,66 @@ TestCase {
control.destroy()
}
+
+ function test_autoRepeat() {
+ var control = spinBox.createObject(testCase)
+ verify(control)
+
+ compare(control.value, 0)
+
+ var valueSpy = signalSpy.createObject(control, {target: control, signalName: "valueChanged"})
+ verify(valueSpy.valid)
+
+ var countBefore = 0
+
+ // repeat up
+ mousePress(control.up.indicator)
+ verify(control.up.pressed)
+ compare(valueSpy.count, 0)
+ valueSpy.wait()
+ valueSpy.wait()
+ countBefore = valueSpy.count
+ mouseRelease(control.up.indicator)
+ verify(!control.up.pressed)
+ compare(valueSpy.count, countBefore)
+
+ valueSpy.clear()
+
+ // repeat down
+ mousePress(control.down.indicator)
+ verify(control.down.pressed)
+ compare(valueSpy.count, 0)
+ valueSpy.wait()
+ valueSpy.wait()
+ countBefore = valueSpy.count
+ mouseRelease(control.down.indicator)
+ verify(!control.down.pressed)
+ compare(valueSpy.count, countBefore)
+
+ mousePress(control.up.indicator)
+ verify(control.up.pressed)
+ valueSpy.wait()
+
+ // move inside during repeat -> continue repeat (QTBUG-57085)
+ mouseMove(control.up.indicator, control.up.indicator.width / 4, control.up.indicator.height / 4)
+ verify(control.up.pressed)
+ valueSpy.wait()
+
+ valueSpy.clear()
+
+ // move outside during repeat -> stop repeat
+ mouseMove(control.up.indicator, -1, -1)
+ verify(!control.up.pressed)
+ // NOTE: The following wait() is NOT a reliable way to test that the
+ // auto-repeat timer is not running, but there's no way dig into the
+ // private APIs from QML. If this test ever fails in the future, it
+ // indicates that the auto-repeat timer logic is broken.
+ wait(125)
+ compare(valueSpy.count, 0)
+
+ mouseRelease(control.up.indicator, -1, -1)
+ verify(!control.up.pressed)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index ab6ce332..28a22306 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -59,6 +59,11 @@ TestCase {
StackView { }
}
+ Component {
+ id: signalSpy
+ SignalSpy { }
+ }
+
function test_initialItem() {
var control1 = stackView.createObject(testCase)
verify(control1)
@@ -87,18 +92,13 @@ TestCase {
control.destroy()
}
- SignalSpy {
- id: busySpy
- signalName: "busyChanged"
- }
-
function test_busy() {
var control = stackView.createObject(testCase)
verify(control)
compare(control.busy, false)
var busyCount = 0
- busySpy.target = control
+ var busySpy = signalSpy.createObject(control, {target: control, signalName: "busyChanged"})
verify(busySpy.valid)
control.push(component)
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index 16cfea14..0404fd86 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -304,7 +304,7 @@ TestCase {
var control = swipeDelegateComponent.createObject(testCase);
verify(control);
- var overDragDistance = dragDistance * 1.1;
+ var overDragDistance = Math.round(dragDistance * 1.1);
mouseSignalSequenceSpy.target = control;
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed"];
@@ -361,7 +361,7 @@ TestCase {
verify(control.swipe.rightItem);
verify(!control.swipe.rightItem.visible);
- mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "released", "clicked"];
+ mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "canceled"];
mouseRelease(control, control.width / 2, control.height / 2);
verify(!control.pressed);
compare(control.swipe.position, 1.0);
@@ -388,7 +388,8 @@ TestCase {
verify(!control.swipe.complete);
compare(control.swipe.position, 1.0 - overDragDistance / control.width);
- mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "released", "clicked"];
+ // Since we went over the drag distance, we should expect canceled() to be emitted.
+ mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "canceled"];
mouseRelease(control, control.width * 0.4, control.height / 2);
verify(!control.pressed);
compare(control.swipe.position, 1.0);
@@ -409,7 +410,7 @@ TestCase {
verify(!control.swipe.complete);
compare(control.swipe.position, 0.4);
- mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "released", "clicked"];
+ mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "canceled"];
mouseRelease(control, control.width * -0.1, control.height / 2);
verify(!control.pressed);
compare(control.swipe.position, 0.0);
@@ -433,7 +434,7 @@ TestCase {
var control = swipeDelegateComponent.createObject(testCase);
verify(control);
- var distance = dragDistance * 1.1;
+ var distance = Math.round(dragDistance * 1.1);
if (distance >= control.width / 2)
skip("This test requires a startDragDistance that is less than half the width of the control");
@@ -826,7 +827,7 @@ TestCase {
control.swipe.left = smallLeftComponent;
// Ensure that the position is scaled to the width of the currently visible delegate.
- var overDragDistance = dragDistance * 1.1;
+ var overDragDistance = Math.round(dragDistance * 1.1);
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width / 2 + overDragDistance, control.height / 2, Qt.LeftButton);
verify(control.swipe.leftItem);
@@ -885,7 +886,7 @@ TestCase {
mousePress(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
compare(leftVisibleSpy.count, 0);
compare(rightVisibleSpy.count, 0);
- var newX = control.swipe.leftItem.width - dragDistance * 1.1;
+ var newX = control.swipe.leftItem.width - Math.round(dragDistance * 1.1);
mouseMove(control, newX, control.height / 2, Qt.LeftButton, Qt.LeftButton);
compare(leftVisibleSpy.count, 0);
compare(rightVisibleSpy.count, 0);
@@ -1033,4 +1034,43 @@ TestCase {
control.destroy();
}
+
+ function test_releaseOutside_data() {
+ return [
+ { tag: "no delegates", component: emptySwipeDelegateComponent },
+ { tag: "delegates", component: swipeDelegateComponent },
+ ];
+ }
+
+ function test_releaseOutside(data) {
+ var control = data.component.createObject(testCase);
+ verify(control);
+
+ // Press and then release below the control.
+ mouseSignalSequenceSpy.target = control;
+ mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed", ["pressedChanged", { "pressed": false }]];
+ mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
+ mouseMove(control, control.width / 2, control.height + 10, Qt.LeftButton);
+ verify(mouseSignalSequenceSpy.success);
+
+ mouseSignalSequenceSpy.expectedSequence = ["canceled"];
+ mouseRelease(control, control.width / 2, control.height + 10, Qt.LeftButton);
+ verify(mouseSignalSequenceSpy.success);
+
+ // Press and then release to the right of the control.
+ var hasDelegates = control.swipe.left || control.swipe.right || control.swipe.behind;
+ mouseSignalSequenceSpy.target = control;
+ mouseSignalSequenceSpy.expectedSequence = hasDelegates
+ ? [["pressedChanged", { "pressed": true }], "pressed"]
+ : [["pressedChanged", { "pressed": true }], "pressed", ["pressedChanged", { "pressed": false }]];
+ mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
+ mouseMove(control, control.width + 10, control.height / 2, Qt.LeftButton);
+ if (hasDelegates)
+ verify(control.swipe.position > 0);
+ verify(mouseSignalSequenceSpy.success);
+
+ mouseSignalSequenceSpy.expectedSequence = hasDelegates ? [["pressedChanged", { "pressed": false }], "canceled"] : ["canceled"];
+ mouseRelease(control, control.width + 10, control.height / 2, Qt.LeftButton);
+ verify(mouseSignalSequenceSpy.success);
+ }
}
diff --git a/tests/auto/controls/data/tst_swipeview.qml b/tests/auto/controls/data/tst_swipeview.qml
index df22bb09..3afcdf16 100644
--- a/tests/auto/controls/data/tst_swipeview.qml
+++ b/tests/auto/controls/data/tst_swipeview.qml
@@ -60,20 +60,16 @@ TestCase {
Text { }
}
- SignalSpy {
- id: currentItemChangedSpy
- signalName: "currentItemChanged"
- }
-
- function cleanup() {
- currentItemChangedSpy.clear()
- currentItemChangedSpy.target = null
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
function test_current() {
var control = swipeView.createObject(testCase)
- currentItemChangedSpy.target = control
+ var currentItemChangedSpy = signalSpy.createObject(testCase, {target: control, signalName: "currentItemChanged"})
+ verify(currentItemChangedSpy.valid)
compare(control.count, 0)
compare(control.currentIndex, -1)
@@ -146,7 +142,8 @@ TestCase {
control.currentIndexChanged.connect(verifyCurrentIndexCountDiff)
control.countChanged.connect(verifyCurrentIndexCountDiff)
- currentItemChangedSpy.target = control;
+ var currentItemChangedSpy = signalSpy.createObject(testCase, {target: control, signalName: "currentItemChanged"})
+ verify(currentItemChangedSpy.valid)
compare(control.count, 0)
compare(control.currentIndex, -1)
diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml
index eee3205f..9268f765 100644
--- a/tests/auto/controls/data/tst_tabbar.qml
+++ b/tests/auto/controls/data/tst_tabbar.qml
@@ -85,19 +85,9 @@ TestCase {
}
}
- SignalSpy {
- id: contentChildrenSpy
- signalName: "contentChildrenChanged"
- }
-
- function init() {
- verify(!contentChildrenSpy.target)
- compare(contentChildrenSpy.count, 0)
- }
-
- function cleanup() {
- contentChildrenSpy.target = null
- contentChildrenSpy.clear()
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
function test_defaults() {
@@ -176,7 +166,7 @@ TestCase {
control.currentIndexChanged.connect(verifyCurrentIndexCountDiff)
control.countChanged.connect(verifyCurrentIndexCountDiff)
- contentChildrenSpy.target = control
+ var contentChildrenSpy = signalSpy.createObject(testCase, {target: control, signalName: "contentChildrenChanged"})
verify(contentChildrenSpy.valid)
compare(control.count, 0)
@@ -293,7 +283,7 @@ TestCase {
return true
}
- contentChildrenSpy.target = control
+ var contentChildrenSpy = signalSpy.createObject(testCase, {target: control, signalName: "contentChildrenChanged"})
verify(contentChildrenSpy.valid)
verify(compareObjectNames(control.contentData, ["object", "button1", "timer", "button2", ""]))
diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml
index 1417c8e2..73431ca6 100644
--- a/tests/auto/controls/data/tst_toolbutton.qml
+++ b/tests/auto/controls/data/tst_toolbutton.qml
@@ -50,19 +50,9 @@ TestCase {
when: windowShown
name: "ToolButton"
- SignalSpy {
- id: pressedSpy
- signalName: "pressedChanged"
- }
-
- SignalSpy {
- id: downSpy
- signalName: "downChanged"
- }
-
- SignalSpy {
- id: clickedSpy
- signalName: "clicked"
+ Component {
+ id: signalSpy
+ SignalSpy { }
}
Component {
@@ -70,20 +60,6 @@ TestCase {
ToolButton { }
}
- function init() {
- verify(!pressedSpy.target)
- verify(!clickedSpy.target)
- compare(pressedSpy.count, 0)
- compare(clickedSpy.count, 0)
- }
-
- function cleanup() {
- pressedSpy.target = null
- clickedSpy.target = null
- pressedSpy.clear()
- clickedSpy.clear()
- }
-
function test_text() {
var control = toolButton.createObject(testCase)
verify(control)
@@ -101,11 +77,13 @@ TestCase {
var control = toolButton.createObject(testCase)
verify(control)
- pressedSpy.target = control
- downSpy.target = control
- clickedSpy.target = control
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
verify(pressedSpy.valid)
+
+ var downSpy = signalSpy.createObject(control, {target: control, signalName: "downChanged"})
verify(downSpy.valid)
+
+ var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"})
verify(clickedSpy.valid)
// check
@@ -170,7 +148,7 @@ TestCase {
var control = toolButton.createObject(testCase)
verify(control)
- clickedSpy.target = control
+ var clickedSpy = signalSpy.createObject(control, {target: control, signalName: "clicked"})
verify(clickedSpy.valid)
control.forceActiveFocus()
diff --git a/tests/auto/drawer/BLACKLIST b/tests/auto/drawer/BLACKLIST
deleted file mode 100644
index 1b06b49c..00000000
--- a/tests/auto/drawer/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-[touch]
-windows
diff --git a/tests/auto/drawer/tst_drawer.cpp b/tests/auto/drawer/tst_drawer.cpp
index 80385421..ab652466 100644
--- a/tests/auto/drawer/tst_drawer.cpp
+++ b/tests/auto/drawer/tst_drawer.cpp
@@ -380,7 +380,7 @@ void tst_Drawer::reposition()
window->setWidth(window->width() + 100);
QTRY_COMPARE(geometry(dimmer), QRectF(0, 150, window->width(), window->height() - 150));
- QCOMPARE(geometry(popupItem), QRectF(window->width() - drawer->width(), 150, window->width() / 2, window->height() - 150));
+ QTRY_COMPARE(geometry(popupItem), QRectF(window->width() - drawer->width(), 150, window->width() / 2, window->height() - 150));
drawer->close();
QTRY_COMPARE(geometry(popupItem), QRectF(window->width(), 150, window->width() / 2, window->height() - 150));
@@ -714,6 +714,11 @@ void tst_Drawer::touch()
QQuickDrawer *drawer = window->property("drawer").value<QQuickDrawer*>();
QVERIFY(drawer);
+ QSignalSpy drawerOpenedSpy(drawer, SIGNAL(opened()));
+ QSignalSpy drawerClosedSpy(drawer, SIGNAL(closed()));
+ QVERIFY(drawerOpenedSpy.isValid());
+ QVERIFY(drawerClosedSpy.isValid());
+
struct TouchDeviceDeleter
{
static inline void cleanup(QTouchDevice *device)
@@ -732,7 +737,8 @@ void tst_Drawer::touch()
QTest::touchEvent(window, device.data()).move(0, QPoint(100, 100));
QTRY_COMPARE(drawer->position(), 0.5);
QTest::touchEvent(window, device.data()).release(0, QPoint(100, 100));
- QTRY_COMPARE(drawer->position(), 1.0);
+ QVERIFY(drawerOpenedSpy.wait());
+ QCOMPARE(drawer->position(), 1.0);
// drag to close
QTest::touchEvent(window, device.data()).press(0, QPoint(300, 100));
@@ -744,7 +750,8 @@ void tst_Drawer::touch()
QTest::touchEvent(window, device.data()).move(0, QPoint(100, 100));
QTRY_COMPARE(drawer->position(), 0.5);
QTest::touchEvent(window, device.data()).release(0, QPoint(100, 100));
- QTRY_COMPARE(drawer->position(), 0.0);
+ QVERIFY(drawerClosedSpy.wait());
+ QCOMPARE(drawer->position(), 0.0);
}
void tst_Drawer::grabber()
diff --git a/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml b/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml
index f4a51afb..5c655cab 100644
--- a/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml
+++ b/tests/manual/gifs/data/qtquickcontrols2-busyindicator.qml
@@ -51,7 +51,7 @@ Window {
BusyIndicator {
id: busyIndicator
- running: false
+ running: true
anchors.centerIn: parent
}
}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml
index ef53721d..3195c1c9 100644
--- a/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml
+++ b/tests/manual/gifs/data/qtquickcontrols2-checkbox.qml
@@ -48,8 +48,8 @@ Window {
height: column.implicitHeight
visible: true
- property alias second: second
- property alias third: third
+ property alias control2: control2
+ property alias control3: control3
ColumnLayout {
id: column
@@ -60,11 +60,11 @@ Window {
text: qsTr("First")
}
CheckBox {
- id: second
+ id: control2
text: qsTr("Second")
}
CheckBox {
- id: third
+ id: control3
checked: true
text: qsTr("Third")
}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml b/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml
new file mode 100644
index 00000000..eddb71d5
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-checkdelegate-tristate.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Controls 2.0
+import QtQuick.Layouts 1.1
+import QtQuick.Window 2.0
+
+Window {
+ id: window
+ width: 170
+ height: column.implicitHeight
+ visible: true
+
+ property alias english: english
+ property alias norwegian: norwegian
+
+ ColumnLayout {
+ id: column
+ anchors.fill: parent
+
+ CheckDelegate {
+ text: qsTr("Languages")
+ checkState: english.checked && norwegian.checked
+ ? Qt.Checked : (english.checked || norwegian.checked) ? Qt.PartiallyChecked : Qt.Unchecked
+ tristate: true
+ Layout.fillWidth: true
+ }
+ CheckDelegate {
+ id: english
+ text: qsTr("English")
+ checked: true
+ leftPadding: indicator.width + 14
+ Layout.fillWidth: true
+ }
+ CheckDelegate {
+ id: norwegian
+ text: qsTr("Norwegian")
+ checked: true
+ leftPadding: indicator.width + 14
+ Layout.fillWidth: true
+ }
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-combobox.qml b/tests/manual/gifs/data/qtquickcontrols2-combobox.qml
new file mode 100644
index 00000000..718ed166
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-combobox.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** 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: 140
+ height: 180
+ visible: true
+
+ property alias comboBox: comboBox
+
+ ComboBox {
+ id: comboBox
+ model: ["First", "Second", "Third"]
+ y: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-drawer.qml b/tests/manual/gifs/data/qtquickcontrols2-drawer.qml
new file mode 100644
index 00000000..49f2cf50
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-drawer.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** 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.Window 2.0
+
+ApplicationWindow {
+ id: window
+ width: 300
+ height: 300
+ visible: true
+
+ property alias drawer: drawer
+
+ Drawer {
+ id: drawer
+ width: window.width * 0.66
+ height: window.height
+ rightPadding: 0
+
+ Rectangle {
+ border.width: 1
+ anchors.fill: parent
+
+ Label {
+ text: "Drawer"
+ font.pixelSize: 32
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ Rectangle {
+ border.width: 1
+ anchors.fill: parent
+
+ Label {
+ text: "Content"
+ font.pixelSize: 32
+ anchors.centerIn: parent
+ }
+ }
+
+ Rectangle {
+ z: 1
+ color: "black"
+ width: 1
+ height: parent.height
+ parent: window.overlay
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-progressbar-indeterminate.qml b/tests/manual/gifs/data/qtquickcontrols2-progressbar-indeterminate.qml
new file mode 100644
index 00000000..0785b279
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-progressbar-indeterminate.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+Window {
+ width: progressBar.implicitWidth
+ height: 64
+ visible: true
+
+ property alias progressBar: progressBar
+
+ ProgressBar {
+ id: progressBar
+ indeterminate: true
+ anchors.centerIn: parent
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-progressbar.qml b/tests/manual/gifs/data/qtquickcontrols2-progressbar.qml
new file mode 100644
index 00000000..13d5075d
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-progressbar.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+Window {
+ width: progressBar.implicitWidth
+ height: 64
+ visible: true
+
+ property alias progressBar: progressBar
+
+ ProgressBar {
+ id: progressBar
+ value: 0.5
+ anchors.centerIn: parent
+
+ Timer {
+ running: true
+ interval: 500
+ onTriggered: animation.start()
+ }
+
+ NumberAnimation {
+ id: animation
+ target: progressBar
+ property: "value"
+ to: 1
+ duration: 2000
+ }
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml b/tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml
new file mode 100644
index 00000000..576668f3
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-radiobutton.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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 control1: control1
+ property alias control2: control2
+ property alias control3: control3
+
+ ColumnLayout {
+ id: column
+ anchors.centerIn: parent
+
+ RadioButton {
+ id: control1
+ text: qsTr("First")
+ checked: true
+ }
+ RadioButton {
+ id: control2
+ text: qsTr("Second")
+ }
+ RadioButton {
+ id: control3
+ text: qsTr("Third")
+ }
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml b/tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml
new file mode 100644
index 00000000..091e5250
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-scrollindicator.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** 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: 100
+ height: 120
+ visible: true
+ color: "#eeeeee"
+
+ ListView {
+ anchors.fill: parent
+
+ ScrollIndicator.vertical: ScrollIndicator {
+ active: true
+ }
+
+ model: 10
+ delegate: Label {
+ text: qsTr("Item %1").arg(index + 1)
+ width: 100
+ height: 40
+ leftPadding: 10
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-slider-snap.qml b/tests/manual/gifs/data/qtquickcontrols2-slider-snap.qml
new file mode 100644
index 00000000..aa2351fc
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-slider-snap.qml
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+Window {
+ width: slider.implicitWidth
+ height: slider.implicitHeight
+ visible: true
+
+ property alias slider: slider
+
+ Slider {
+ id: slider
+ stepSize: 0.2
+ anchors.centerIn: parent
+
+ Rectangle {
+ anchors.fill: slider.handle
+ radius: width / 2
+ color: slider.pressed ? "#aa666666" : "transparent"
+ }
+
+ contentItem: Item {
+ Repeater {
+ id: repeater
+ model: 6
+
+ Rectangle {
+ x: ((slider.contentItem.width - slider.handle.width) * (index / (repeater.count - 1)))
+ - width / 2 + slider.handle.width / 2
+ y: parent.height
+ width: 1
+ height: 4
+ color: "#888"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-stackview-pop.qml b/tests/manual/gifs/data/qtquickcontrols2-stackview-pop.qml
new file mode 100644
index 00000000..2b4d3ee3
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-stackview-pop.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 160
+ height: 160
+ visible: true
+ color: "#eeeeee"
+
+ property int maxDepth: 3
+
+ function itemText(index) {
+ return String.fromCharCode(65 + index);
+ }
+
+ Component {
+ id: labelComponent
+
+ Label {
+ font.pixelSize: 60
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+
+ Component.onCompleted: {
+ for (var i = 0; i < maxDepth; ++i) {
+ stackView.push(labelComponent, { text: itemText(i) }, StackView.Immediate);
+ }
+ }
+ }
+
+ Label {
+ id: operationLabel
+ text: "pop()"
+ font.pixelSize: 16
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.margins: 10
+ }
+
+ Timer {
+ id: operationTimer
+ running: true
+ interval: 1500
+ onTriggered: {
+ stackView.pop();
+ hideOperationTimer.start();
+ }
+ }
+
+ Timer {
+ id: hideOperationTimer
+ interval: operationTimer.interval
+ onTriggered: operationLabel.visible = false
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-stackview-push.qml b/tests/manual/gifs/data/qtquickcontrols2-stackview-push.qml
new file mode 100644
index 00000000..dd318f1d
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-stackview-push.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 160
+ height: 160
+ visible: true
+ color: "#eeeeee"
+
+ property int itemIndex: 0
+ property int maxDepth: 3
+
+ function itemText(index) {
+ return String.fromCharCode(65 + index);
+ }
+
+ Component {
+ id: labelComponent
+
+ Label {
+ font.pixelSize: 60
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+ }
+
+ Label {
+ id: operationLabel
+ text: "push(" + itemText(Math.max(0, Math.min(maxDepth - 1, itemIndex - 1))) + ")"
+ font.pixelSize: 16
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.margins: 10
+ }
+
+ Timer {
+ id: operationTimer
+ running: true
+ interval: 1500
+ repeat: stackView.depth < maxDepth - 1
+ onRepeatChanged: if (!repeat) hideOperationTimer.start()
+
+ onTriggered: stackView.push(labelComponent, { text: itemText(itemIndex++) })
+ }
+
+ Timer {
+ id: hideOperationTimer
+ interval: operationTimer.interval * 2
+ onTriggered: operationLabel.visible = false
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-stackview-replace.qml b/tests/manual/gifs/data/qtquickcontrols2-stackview-replace.qml
new file mode 100644
index 00000000..2586a81b
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-stackview-replace.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 160
+ height: 160
+ visible: true
+ color: "#eeeeee"
+
+ property int maxDepth: 3
+
+ function itemText(index) {
+ return String.fromCharCode(65 + index);
+ }
+
+ Component {
+ id: labelComponent
+
+ Label {
+ font.pixelSize: 60
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+
+ Component.onCompleted: {
+ for (var i = 0; i < maxDepth; ++i) {
+ stackView.push(labelComponent, { text: itemText(i) }, StackView.Immediate);
+ }
+ }
+ }
+
+ Label {
+ id: operationLabel
+ text: "replace(D)"
+ font.pixelSize: 16
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.margins: 10
+ }
+
+ Timer {
+ id: operationTimer
+ running: true
+ interval: 1500
+ onTriggered: {
+ stackView.replace(labelComponent, { text: "D" });
+ hideOperationTimer.start();
+ }
+ }
+
+ Timer {
+ id: hideOperationTimer
+ interval: operationTimer.interval
+ onTriggered: operationLabel.visible = false
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-stackview-unwind.qml b/tests/manual/gifs/data/qtquickcontrols2-stackview-unwind.qml
new file mode 100644
index 00000000..6fb6b2a8
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-stackview-unwind.qml
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.0
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 160
+ height: 160
+ visible: true
+ color: "#eeeeee"
+
+ property int maxDepth: 3
+
+ function itemText(index) {
+ return String.fromCharCode(65 + index);
+ }
+
+ Component {
+ id: labelComponent
+
+ Label {
+ font.pixelSize: 60
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+
+ Component.onCompleted: {
+ for (var i = 0; i < maxDepth; ++i) {
+ stackView.push(labelComponent, { text: itemText(i) }, StackView.Immediate);
+ }
+ }
+ }
+
+ Label {
+ id: operationLabel
+ text: "pop(null)"
+ font.pixelSize: 16
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.margins: 10
+ }
+
+ Timer {
+ id: operationTimer
+ running: true
+ interval: 1500
+ onTriggered: {
+ stackView.pop(null);
+ hideOperationTimer.start();
+ }
+ }
+
+ Timer {
+ id: hideOperationTimer
+ interval: operationTimer.interval
+ onTriggered: operationLabel.visible = false
+ }
+}
diff --git a/tests/manual/gifs/data/qtquickcontrols2-swipeview.qml b/tests/manual/gifs/data/qtquickcontrols2-swipeview.qml
new file mode 100644
index 00000000..d721591a
--- /dev/null
+++ b/tests/manual/gifs/data/qtquickcontrols2-swipeview.qml
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** 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: 300
+ height: 300
+ visible: true
+
+ property alias swipeView: view
+
+ Rectangle {
+ border.width: 1
+ anchors.fill: parent
+ }
+
+ SwipeView {
+ id: view
+ anchors.fill: parent
+
+ Label {
+ text: "First\nPage"
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ }
+
+ Label {
+ text: "Second\nPage"
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ }
+
+ Label {
+ text: "Third\nPage"
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ }
+ }
+
+ PageIndicator {
+ id: indicator
+
+ count: view.count
+ currentIndex: view.currentIndex
+
+ anchors.bottom: view.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index e6fa9d61..d3fb5f6d 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -51,6 +51,8 @@ private slots:
void tumblerWrap();
void slider();
+ void sliderSnap_data();
+ void sliderSnap();
void rangeSlider();
void busyIndicator();
void switchGif();
@@ -58,6 +60,7 @@ private slots:
void button();
void tabBar();
void menu();
+ void swipeView();
void swipeDelegate_data();
void swipeDelegate();
void swipeDelegateBehind();
@@ -65,9 +68,18 @@ private slots:
void delegates();
void dial_data();
void dial();
- void checkBox();
- void checkBoxTriState();
void scrollBar();
+ void scrollIndicator();
+ void progressBar_data();
+ void progressBar();
+ void triState_data();
+ void triState();
+ void checkables_data();
+ void checkables();
+ void comboBox();
+ void stackView_data();
+ void stackView();
+ void drawer();
private:
void moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoint &to, int movements,
@@ -98,8 +110,8 @@ void tst_Gifs::moveSmoothly(QQuickWindow *window, const QPoint &from, const QPoi
int yDifference = to.y() - from.y();
for (int movement = 0; movement < movements; ++movement) {
QPoint pos = QPoint(
- from.x() + curve.valueForProgress(movement / qreal(qAbs(xDifference))) * xDifference,
- from.y() + curve.valueForProgress(movement / qreal(qAbs(yDifference))) * yDifference);
+ from.x() + qRound(curve.valueForProgress(movement / qreal(qAbs(xDifference))) * xDifference),
+ from.y() + qRound(curve.valueForProgress(movement / qreal(qAbs(yDifference))) * yDifference));
QTest::mouseMove(window, pos, movementDelay);
}
}
@@ -234,6 +246,58 @@ void tst_Gifs::slider()
gifRecorder.waitForFinish();
}
+void tst_Gifs::sliderSnap_data()
+{
+ QTest::addColumn<QString>("gifBaseName");
+ QTest::addColumn<int>("snapMode");
+ QTest::newRow("NoSnap") << "qtquickcontrols2-slider-nosnap" << 0;
+ QTest::newRow("SnapAlways") << "qtquickcontrols2-slider-snapalways" << 1;
+ QTest::newRow("SnapOnRelease") << "qtquickcontrols2-slider-snaponrelease" << 2;
+}
+
+void tst_Gifs::sliderSnap()
+{
+ QFETCH(QString, gifBaseName);
+ QFETCH(int, snapMode);
+
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(8);
+ gifRecorder.setHighQuality(true);
+ gifRecorder.setQmlFileName("qtquickcontrols2-slider-snap.qml");
+ gifRecorder.setOutputFileBaseName(gifBaseName);
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *slider = window->property("slider").value<QQuickItem*>();
+ QVERIFY(slider);
+ QVERIFY(slider->setProperty("snapMode", QVariant(snapMode)));
+ QCOMPARE(slider->property("snapMode").toInt(), snapMode);
+ QQuickItem *handle = slider->property("handle").value<QQuickItem*>();
+ QVERIFY(handle);
+
+ const QPoint startPos(slider->property("leftPadding").toReal(), slider->height() / 2);
+ const int trackWidth = slider->property("availableWidth").toReal();
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, startPos, 200);
+ QPoint pos1 = startPos + QPoint(trackWidth * 0.3, 0);
+ moveSmoothly(window, startPos, pos1, pos1.x() - startPos.x(), QEasingCurve::OutQuint, 30);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos1, 0);
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, startPos, 400);
+ const QPoint pos2 = startPos + QPoint(trackWidth * 0.6, 0);
+ moveSmoothly(window, pos1, pos2, pos2.x() - pos1.x(), QEasingCurve::OutQuint, 30);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos2, 0);
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos2, 400);
+ moveSmoothly(window, pos2, startPos, qAbs(startPos.x() - pos2.x()) / 2, QEasingCurve::OutQuint, 30);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, startPos, 0);
+
+ gifRecorder.waitForFinish();
+}
+
void tst_Gifs::rangeSlider()
{
GifRecorder gifRecorder;
@@ -288,7 +352,7 @@ void tst_Gifs::busyIndicator()
GifRecorder gifRecorder;
gifRecorder.setDataDirPath(dataDirPath);
gifRecorder.setOutputDir(outputDir);
- gifRecorder.setRecordingDuration(3);
+ gifRecorder.setRecordingDuration(6);
gifRecorder.setHighQuality(true);
gifRecorder.setQmlFileName("qtquickcontrols2-busyindicator.qml");
@@ -296,17 +360,17 @@ void tst_Gifs::busyIndicator()
QQuickWindow *window = gifRecorder.window();
// Record nothing for a bit to make it smoother.
- QTest::qWait(400);
+ QTest::qWait(800 * 2);
QQuickItem *busyIndicator = window->property("busyIndicator").value<QQuickItem*>();
QVERIFY(busyIndicator);
- busyIndicator->setProperty("running", true);
+ busyIndicator->setProperty("running", false);
// 800 ms is the duration of one rotation animation cycle for BusyIndicator.
QTest::qWait(800 * 2);
- busyIndicator->setProperty("running", false);
+ busyIndicator->setProperty("running", true);
gifRecorder.waitForFinish();
}
@@ -418,6 +482,31 @@ void tst_Gifs::menu()
gifRecorder.waitForFinish();
}
+void tst_Gifs::swipeView()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(8);
+ gifRecorder.setQmlFileName(QStringLiteral("qtquickcontrols2-swipeview.qml"));
+ gifRecorder.setHighQuality(true);
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *swipeView = window->property("swipeView").value<QQuickItem*>();
+ QVERIFY(swipeView);
+
+ QTest::qWait(1200);
+ swipeView->setProperty("currentIndex", 1);
+ QTest::qWait(2000);
+ swipeView->setProperty("currentIndex", 2);
+ QTest::qWait(2000);
+ swipeView->setProperty("currentIndex", 0);
+
+ gifRecorder.waitForFinish();
+}
+
void tst_Gifs::swipeDelegate_data()
{
QTest::addColumn<QString>("qmlFileName");
@@ -610,41 +699,104 @@ void tst_Gifs::dial()
gifRecorder.waitForFinish();
}
-void tst_Gifs::checkBox()
+void tst_Gifs::checkables_data()
{
+ QTest::addColumn<QString>("name");
+ QTest::addColumn<QVector<int> >("pressIndices");
+
+ QTest::newRow("checkbox") << "checkbox" << (QVector<int>() << 1 << 2 << 2 << 1);
+ QTest::newRow("radiobutton") << "radiobutton" << (QVector<int>() << 1 << 2 << 1 << 0);
+}
+
+void tst_Gifs::checkables()
+{
+ QFETCH(QString, name);
+ QFETCH(QVector<int>, pressIndices);
+
GifRecorder gifRecorder;
gifRecorder.setDataDirPath(dataDirPath);
gifRecorder.setOutputDir(outputDir);
- gifRecorder.setRecordingDuration(5);
- gifRecorder.setQmlFileName("qtquickcontrols2-checkbox.qml");
+ gifRecorder.setRecordingDuration(6);
+ gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-%1.qml").arg(name));
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);
+
+ for (int i = 0; i < pressIndices.size(); ++i) {
+ const int pressIndex = pressIndices.at(i);
+ const char *controlId = qPrintable(QString::fromLatin1("control%1").arg(pressIndex + 1));
+ QQuickItem *control = window->property(controlId).value<QQuickItem*>();
+ QVERIFY(control);
+
+ const QPoint pos = control->mapToScene(QPointF(control->width() / 2, control->height() / 2)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos, 800);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, pos, 300);
+ }
gifRecorder.waitForFinish();
}
-void tst_Gifs::checkBoxTriState()
+void tst_Gifs::comboBox()
{
GifRecorder gifRecorder;
gifRecorder.setDataDirPath(dataDirPath);
gifRecorder.setOutputDir(outputDir);
gifRecorder.setRecordingDuration(6);
- gifRecorder.setQmlFileName("qtquickcontrols2-checkbox-tristate.qml");
+ gifRecorder.setQmlFileName(QStringLiteral("qtquickcontrols2-combobox.qml"));
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QQuickItem *comboBox = window->property("comboBox").value<QQuickItem*>();
+ QVERIFY(comboBox);
+
+ // Open the popup.
+ const QPoint center = comboBox->mapToScene(
+ QPoint(comboBox->width() / 2, comboBox->height() / 2)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, center, 800);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, center, 80);
+
+ // Select the third item.
+ QObject *popup = comboBox->property("popup").value<QObject*>();
+ QVERIFY(popup);
+ QQuickItem *popupContent = popup->property("contentItem").value<QQuickItem*>();
+ QVERIFY(popupContent);
+ const QPoint lastItemPos = popupContent->mapToScene(
+ QPoint(popupContent->width() / 2, popupContent->height() * 0.8)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, lastItemPos, 600);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, lastItemPos, 200);
+
+ // Open the popup.
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, center, 1500);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, center, 80);
+
+ // Select the first item.
+ const QPoint firstItemPos = popupContent->mapToScene(
+ QPoint(popupContent->width() / 2, popupContent->height() * 0.2)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, firstItemPos, 600);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, firstItemPos, 200);
+
+ gifRecorder.waitForFinish();
+}
+
+void tst_Gifs::triState_data()
+{
+ QTest::addColumn<QString>("name");
+
+ QTest::newRow("checkbox-tristate") << "checkbox-tristate";
+ QTest::newRow("checkdelegate-tristate") << "checkdelegate-tristate";
+}
+
+void tst_Gifs::triState()
+{
+ QFETCH(QString, name);
+
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(6);
+ gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-%1.qml").arg(name));
gifRecorder.start();
@@ -654,14 +806,21 @@ void tst_Gifs::checkBoxTriState()
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);
+ const QPoint englishCenter = english->mapToScene(
+ QPointF(english->width() / 2, english->height() / 2)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 1000);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 300);
+
+ const QPoint norwegianCenter = norwegian->mapToScene(
+ QPointF(norwegian->width() / 2, norwegian->height() / 2)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 1000);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 300);
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 1000);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, norwegianCenter, 300);
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 1000);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, englishCenter, 300);
gifRecorder.waitForFinish();
}
@@ -699,6 +858,111 @@ void tst_Gifs::scrollBar()
gifRecorder.waitForFinish();
}
+void tst_Gifs::scrollIndicator()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(6);
+ gifRecorder.setQmlFileName("qtquickcontrols2-scrollindicator.qml");
+
+ gifRecorder.start();
+
+ // Flick in the center of the screen to show that there's a scroll indicator.
+ QQuickWindow *window = gifRecorder.window();
+ const QPoint windowBottom = QPoint(0, window->height() - 1);
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, windowBottom, 100);
+ QTest::mouseMove(window, windowBottom - QPoint(0, 10), 30);
+ QTest::mouseMove(window, windowBottom - QPoint(0, 30), 30);
+ QTest::mouseMove(window, windowBottom - QPoint(0, 60), 30);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowBottom - QPoint(0, 100), 30);
+
+ // Scroll back down.
+ const QPoint windowTop = QPoint(0, 0);
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, windowTop, 2000);
+ QTest::mouseMove(window, windowTop + QPoint(0, 10), 30);
+ QTest::mouseMove(window, windowTop + QPoint(0, 30), 30);
+ QTest::mouseMove(window, windowTop + QPoint(0, 60), 30);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, windowTop + QPoint(0, 100), 30);
+
+ gifRecorder.waitForFinish();
+}
+
+void tst_Gifs::progressBar_data()
+{
+ QTest::addColumn<bool>("indeterminate");
+
+ QTest::newRow("indeterminate:false") << false;
+ QTest::newRow("indeterminate:true") << true;
+}
+
+void tst_Gifs::progressBar()
+{
+ QFETCH(bool, indeterminate);
+
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(4);
+ gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-progressbar%1").arg(
+ indeterminate ? QLatin1String("-indeterminate.qml") : QLatin1String(".qml")));
+
+ gifRecorder.start();
+ gifRecorder.waitForFinish();
+}
+
+void tst_Gifs::stackView_data()
+{
+ QTest::addColumn<QString>("name");
+ QTest::addColumn<int>("duration");
+
+ QTest::newRow("push") << "push" << 8;
+ QTest::newRow("pop") << "pop" << 6;
+ QTest::newRow("unwind") << "unwind" << 6;
+ QTest::newRow("replace") << "replace" << 6;
+}
+
+void tst_Gifs::stackView()
+{
+ QFETCH(QString, name);
+ QFETCH(int, duration);
+
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(duration);
+ gifRecorder.setHighQuality(true);
+ gifRecorder.setQmlFileName(QString::fromLatin1("qtquickcontrols2-stackview-%1.qml").arg(name));
+
+ gifRecorder.start();
+ gifRecorder.waitForFinish();
+}
+
+void tst_Gifs::drawer()
+{
+ GifRecorder gifRecorder;
+ gifRecorder.setDataDirPath(dataDirPath);
+ gifRecorder.setOutputDir(outputDir);
+ gifRecorder.setRecordingDuration(4);
+ gifRecorder.setHighQuality(true);
+ gifRecorder.setQmlFileName("qtquickcontrols2-drawer.qml");
+
+ gifRecorder.start();
+
+ QQuickWindow *window = gifRecorder.window();
+ QObject *drawer = window->property("drawer").value<QObject*>();
+ qreal width = drawer->property("width").toReal();
+
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1), 100);
+ moveSmoothly(window, QPoint(1, 1), QPoint(width, 1), width, QEasingCurve::InOutBack, 1);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(width, 1), 30);
+
+ QTest::qWait(1000);
+ QMetaObject::invokeMethod(drawer, "close");
+
+ gifRecorder.waitForFinish();
+}
+
QTEST_MAIN(tst_Gifs)
#include "tst_gifs.moc"
diff --git a/tests/manual/testbench/main.cpp b/tests/manual/testbench/main.cpp
index a782b5fe..5a54dab3 100644
--- a/tests/manual/testbench/main.cpp
+++ b/tests/manual/testbench/main.cpp
@@ -54,7 +54,7 @@ int main(int argc, char *argv[])
// TODO: move style selection into app UI and use settings to save choices.
// qputenv("QT_QUICK_CONTROLS_STYLE", "material");
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/testbench.qml")));
return app.exec();
}
diff --git a/tests/manual/testbench/qml.qrc b/tests/manual/testbench/qml.qrc
index 5f6483ac..9f4b1783 100644
--- a/tests/manual/testbench/qml.qrc
+++ b/tests/manual/testbench/qml.qrc
@@ -1,5 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>main.qml</file>
+ <file>testbench.qml</file>
</qresource>
</RCC>
diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/testbench.qml
index 2fdc52af..3e8b3d0f 100644
--- a/tests/manual/testbench/main.qml
+++ b/tests/manual/testbench/testbench.qml
@@ -625,14 +625,14 @@ ApplicationWindow {
Frame {
Tumbler {
model: 5
- implicitWidth: 100
+ implicitWidth: 80
implicitHeight: 100
}
}
Frame {
Tumbler {
model: 5
- implicitWidth: 100
+ implicitWidth: 80
implicitHeight: 100
enabled: false
}
@@ -641,11 +641,147 @@ ApplicationWindow {
RowLayout {
Dial {
+ implicitWidth: 100
+ implicitHeight: 100
}
Dial {
+ implicitWidth: 100
+ implicitHeight: 100
enabled: false
}
}
+
+ ListModel {
+ id: checkableDelegateModel
+ ListElement { label: "Normal" }
+ ListElement { label: "Pressed"; press: true }
+ ListElement { label: "Checked"; check: true }
+ ListElement { label: "CH + PR"; check: true; press: true }
+ ListElement { label: "Disabled"; disabled: true }
+ }
+
+ RowLayout {
+ Frame {
+ Column {
+ width: 200
+
+ Repeater {
+ model: checkableDelegateModel
+ delegate: CheckDelegate {
+ text: label
+ width: parent.width
+ down: press
+ checked: check
+ enabled: !disabled
+ ButtonGroup.group: radioButtonGroup
+ }
+ }
+ }
+ }
+
+ ButtonGroup {
+ id: radioButtonGroup
+ }
+
+ Frame {
+ Column {
+ width: 200
+
+ Repeater {
+ model: checkableDelegateModel
+ delegate: RadioDelegate {
+ text: label
+ down: press
+ width: parent.width
+ checked: check
+ enabled: !disabled
+ ButtonGroup.group: radioButtonGroup
+ }
+ }
+ }
+ }
+
+ Frame {
+ Column {
+ width: 200
+
+ Repeater {
+ model: checkableDelegateModel
+ delegate: SwitchDelegate {
+ text: label
+ width: parent.width
+ checked: check
+ down: press
+ enabled: !disabled
+ }
+ }
+ }
+ }
+ }
+
+ ListModel {
+ id: regularDelegateModel
+ ListElement { label: "Normal" }
+ ListElement { label: "Pressed"; press: true }
+ ListElement { label: "Disabled"; disabled: true }
+ }
+
+ RowLayout {
+ Frame {
+ Column {
+ width: 200
+
+ Repeater {
+ model: regularDelegateModel
+ delegate: ItemDelegate {
+ text: label
+ width: parent.width
+ down: press
+ enabled: !disabled
+ }
+ }
+ }
+ }
+ Frame {
+ Column {
+ id: listView
+ width: 200
+ clip: true
+
+ Repeater {
+ model: regularDelegateModel
+ delegate: SwipeDelegate {
+ id: swipeDelegate
+ text: label
+ width: parent.width
+ down: press
+ enabled: !disabled
+
+ Component {
+ id: removeComponent
+
+ Rectangle {
+ color: swipeDelegate.swipe.complete && swipeDelegate.pressed ? "#333" : "#444"
+ width: parent.width
+ height: parent.height
+ clip: true
+
+ Label {
+ font.pixelSize: swipeDelegate.font.pixelSize
+ text: "Boop"
+ color: "white"
+ anchors.centerIn: parent
+ }
+ }
+ }
+
+ swipe.left: removeComponent
+ swipe.right: removeComponent
+ }
+ }
+ }
+ }
+ }
}
}
}