aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-05 12:13:56 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-05 12:13:56 +0100
commit719dd0dd2721739f51f0cc711f42f176e74e8529 (patch)
treecbc58e3e8e2786631d741b0d5a94f685b12b2fe3
parent1c7daa22ebfb4682e18c8afb911e8c784127ade3 (diff)
parent408eb756d0a429c7b9c8189b7475b0ddfaa7a21e (diff)
Merge remote-tracking branch 'origin/5.6' into dev
-rw-r--r--.gitignore3
-rw-r--r--examples/controls/controls.pro3
-rw-r--r--examples/controls/gallery/gallery.cpp63
-rw-r--r--examples/controls/gallery/gallery.pro15
-rw-r--r--examples/controls/gallery/gallery.qml335
-rw-r--r--examples/controls/gallery/gallery.qrc51
-rw-r--r--examples/controls/gallery/images/arrow.pngbin0 -> 352 bytes
-rw-r--r--examples/controls/gallery/images/arrow@2x.pngbin0 -> 524 bytes
-rw-r--r--examples/controls/gallery/images/arrow@3x.pngbin0 -> 719 bytes
-rw-r--r--examples/controls/gallery/images/arrow@4x.pngbin0 -> 922 bytes
-rw-r--r--examples/controls/gallery/images/arrows.pngbin0 -> 429 bytes
-rw-r--r--examples/controls/gallery/images/arrows@2x.pngbin0 -> 663 bytes
-rw-r--r--examples/controls/gallery/images/arrows@3x.pngbin0 -> 943 bytes
-rw-r--r--examples/controls/gallery/images/arrows@4x.pngbin0 -> 1236 bytes
-rw-r--r--examples/controls/gallery/images/drawer.pngbin0 -> 123 bytes
-rw-r--r--examples/controls/gallery/images/drawer@2x.pngbin0 -> 126 bytes
-rw-r--r--examples/controls/gallery/images/drawer@3x.pngbin0 -> 130 bytes
-rw-r--r--examples/controls/gallery/images/drawer@4x.pngbin0 -> 131 bytes
-rw-r--r--examples/controls/gallery/images/menu.pngbin0 -> 123 bytes
-rw-r--r--examples/controls/gallery/images/menu@2x.pngbin0 -> 158 bytes
-rw-r--r--examples/controls/gallery/images/menu@3x.pngbin0 -> 193 bytes
-rw-r--r--examples/controls/gallery/images/menu@4x.pngbin0 -> 223 bytes
-rw-r--r--examples/controls/gallery/images/qt-logo.pngbin0 -> 1601 bytes
-rw-r--r--examples/controls/gallery/images/qt-logo@2x.pngbin0 -> 3186 bytes
-rw-r--r--examples/controls/gallery/images/qt-logo@3x.pngbin0 -> 4828 bytes
-rw-r--r--examples/controls/gallery/images/qt-logo@4x.pngbin0 -> 6957 bytes
-rw-r--r--examples/controls/gallery/pages/BusyIndicatorPage.qml66
-rw-r--r--examples/controls/gallery/pages/ButtonPage.qml90
-rw-r--r--examples/controls/gallery/pages/CheckBoxPage.qml86
-rw-r--r--examples/controls/gallery/pages/ComboBoxPage.qml65
-rw-r--r--examples/controls/gallery/pages/DialPage.qml64
-rw-r--r--examples/controls/gallery/pages/DrawerPage.qml73
-rw-r--r--examples/controls/gallery/pages/FramePage.qml84
-rw-r--r--examples/controls/gallery/pages/GroupBoxPage.qml85
-rw-r--r--examples/controls/gallery/pages/MenuPage.qml67
-rw-r--r--examples/controls/gallery/pages/PageIndicatorPage.qml64
-rw-r--r--examples/controls/gallery/pages/PopupPage.qml68
-rw-r--r--examples/controls/gallery/pages/ProgressBarPage.qml74
-rw-r--r--examples/controls/gallery/pages/RadioButtonPage.qml85
-rw-r--r--examples/controls/gallery/pages/RangeSliderPage.qml68
-rw-r--r--examples/controls/gallery/pages/ScrollBarPage.qml77
-rw-r--r--examples/controls/gallery/pages/ScrollIndicatorPage.qml77
-rw-r--r--examples/controls/gallery/pages/SliderPage.qml67
-rw-r--r--examples/controls/gallery/pages/SpinBoxPage.qml68
-rw-r--r--examples/controls/gallery/pages/StackViewPage.qml84
-rw-r--r--examples/controls/gallery/pages/SwipeViewPage.qml85
-rw-r--r--examples/controls/gallery/pages/SwitchPage.qml85
-rw-r--r--examples/controls/gallery/pages/TabBarPage.qml97
-rw-r--r--examples/controls/gallery/pages/TextAreaPage.qml74
-rw-r--r--examples/controls/gallery/pages/TextFieldPage.qml65
-rw-r--r--examples/controls/gallery/pages/TumblerPage.qml64
-rw-r--r--examples/controls/gallery/qtlabscontrols.conf10
-rw-r--r--examples/examples.pro3
-rw-r--r--src/controls/qquickpaddedrectangle.cpp23
-rw-r--r--src/controls/qquickpaddedrectangle_p.h4
-rw-r--r--src/controls/qquickstyle.cpp20
-rw-r--r--src/controls/qquickstyle_p.h5
-rw-r--r--src/controls/qquickstyleselector.cpp22
-rw-r--r--src/controls/qquickstyleselector_p.h2
-rw-r--r--src/imports/calendar/plugins.qmltypes7
-rw-r--r--src/imports/calendar/qquickcalendar_p.h5
-rw-r--r--src/imports/calendar/qquickcalendarmodel_p.h5
-rw-r--r--src/imports/calendar/qquickdayofweekmodel_p.h5
-rw-r--r--src/imports/calendar/qquickdayofweekrow.cpp29
-rw-r--r--src/imports/calendar/qquickdayofweekrow_p.h11
-rw-r--r--src/imports/calendar/qquickmonthgrid.cpp29
-rw-r--r--src/imports/calendar/qquickmonthgrid_p.h11
-rw-r--r--src/imports/calendar/qquickmonthmodel_p.h5
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn.cpp27
-rw-r--r--src/imports/calendar/qquickweeknumbercolumn_p.h11
-rw-r--r--src/imports/calendar/qquickweeknumbermodel_p.h5
-rw-r--r--src/imports/controls/ApplicationWindow.qml4
-rw-r--r--src/imports/controls/BusyIndicator.qml26
-rw-r--r--src/imports/controls/Button.qml4
-rw-r--r--src/imports/controls/CheckBox.qml4
-rw-r--r--src/imports/controls/ComboBox.qml132
-rw-r--r--src/imports/controls/Dial.qml20
-rw-r--r--src/imports/controls/Drawer.qml8
-rw-r--r--src/imports/controls/GroupBox.qml6
-rw-r--r--src/imports/controls/ItemDelegate.qml6
-rw-r--r--src/imports/controls/MenuItem.qml10
-rw-r--r--src/imports/controls/Pane.qml60
-rw-r--r--src/imports/controls/Popup.qml42
-rw-r--r--src/imports/controls/ProgressBar.qml13
-rw-r--r--src/imports/controls/RadioButton.qml2
-rw-r--r--src/imports/controls/SpinBox.qml7
-rw-r--r--src/imports/controls/Switch.qml2
-rw-r--r--src/imports/controls/ToolButton.qml6
-rw-r--r--src/imports/controls/controls.pri3
-rw-r--r--src/imports/controls/controls.pro6
-rw-r--r--src/imports/controls/designer/ControlSection.qml14
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-background.pngbin0 -> 2903 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.pngbin0 -> 2913 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.pngbin0 -> 5012 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox-popup.pngbin0 -> 4969 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-combobox.pngbin0 -> 4993 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-default.pngbin0 -> 19608 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.pngbin0 -> 17156 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-gallery-menu.pngbin0 -> 17209 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.pngbin0 -> 23502 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.pngbin0 -> 8264 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-material-button.pngbin0 -> 1272 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-material-dark.pngbin0 -> 4981 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-material.pngbin0 -> 23669 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pane-background.pngbin0 -> 341 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-pane.pngbin0 -> 5022 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-universal-button.pngbin0 -> 2172 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-universal-dark.pngbin0 -> 5450 bytes
-rw-r--r--src/imports/controls/doc/images/qtlabscontrols-universal.pngbin0 -> 18382 bytes
-rw-r--r--src/imports/controls/doc/qtlabscontrols.qdocconf15
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml54
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml47
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml43
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml48
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtlabscontrols-pane.qml41
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-containers.qdoc7
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-customize.qdoc45
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-default.qdoc53
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-differences.qdoc283
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-examples.qdoc68
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc61
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-index.qdoc255
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-input.qdoc6
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-material.qdoc172
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-styles.qdoc119
-rw-r--r--src/imports/controls/doc/src/qtlabscontrols-universal.qdoc177
-rw-r--r--src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc54
-rw-r--r--src/imports/controls/doc/src/templates/qtlabstemplates.qdoc63
-rw-r--r--src/imports/controls/images/check.pngbin474 -> 424 bytes
-rw-r--r--src/imports/controls/images/check@2x.pngbin881 -> 766 bytes
-rw-r--r--src/imports/controls/images/check@3x.pngbin1319 -> 1090 bytes
-rw-r--r--src/imports/controls/images/check@4x.pngbin1717 -> 1344 bytes
-rw-r--r--src/imports/controls/images/dial-indicator.pngbin249 -> 185 bytes
-rw-r--r--src/imports/controls/images/dial-indicator@2x.pngbin1113 -> 243 bytes
-rw-r--r--src/imports/controls/images/dial-indicator@3x.pngbin1173 -> 284 bytes
-rw-r--r--src/imports/controls/images/dial-indicator@4x.pngbin1224 -> 307 bytes
-rw-r--r--src/imports/controls/images/drop-indicator.pngbin0 -> 157 bytes
-rw-r--r--src/imports/controls/images/drop-indicator@2x.pngbin0 -> 226 bytes
-rw-r--r--src/imports/controls/images/drop-indicator@3x.pngbin0 -> 297 bytes
-rw-r--r--src/imports/controls/images/drop-indicator@4x.pngbin0 -> 376 bytes
-rw-r--r--src/imports/controls/images/spinner_large.pngbin15085 -> 0 bytes
-rw-r--r--src/imports/controls/images/spinner_medium.pngbin5934 -> 0 bytes
-rw-r--r--src/imports/controls/images/spinner_small.pngbin4582 -> 0 bytes
-rw-r--r--src/imports/controls/material/ApplicationWindow.qml5
-rw-r--r--src/imports/controls/material/Button.qml39
-rw-r--r--src/imports/controls/material/ComboBox.qml173
-rw-r--r--src/imports/controls/material/Dial.qml10
-rw-r--r--src/imports/controls/material/Drawer.qml8
-rw-r--r--src/imports/controls/material/GroupBox.qml6
-rw-r--r--src/imports/controls/material/ItemDelegate.qml2
-rw-r--r--src/imports/controls/material/Menu.qml96
-rw-r--r--src/imports/controls/material/MenuItem.qml155
-rw-r--r--src/imports/controls/material/Pane.qml61
-rw-r--r--src/imports/controls/material/Popup.qml54
-rw-r--r--src/imports/controls/material/SpinBox.qml1
-rw-r--r--src/imports/controls/material/StackView.qml24
-rw-r--r--src/imports/controls/material/Switch.qml18
-rw-r--r--src/imports/controls/material/TabButton.qml4
-rw-r--r--src/imports/controls/material/ToolBar.qml12
-rw-r--r--src/imports/controls/material/ToolButton.qml9
-rw-r--r--src/imports/controls/material/images/drop-indicator.pngbin0 -> 342 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@2x.pngbin0 -> 273 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@3x.pngbin0 -> 406 bytes
-rw-r--r--src/imports/controls/material/images/drop-indicator@4x.pngbin0 -> 520 bytes
-rw-r--r--src/imports/controls/material/material.pri5
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring.cpp3
-rw-r--r--src/imports/controls/material/qquickmaterialprogressring_p.h5
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp725
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h20
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp8
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h2
-rw-r--r--src/imports/controls/material/qtlabsmaterialstyleplugin.cpp4
-rw-r--r--src/imports/controls/material/qtlabsmaterialstyleplugin.qrc4
-rw-r--r--src/imports/controls/plugins.qmltypes1578
-rw-r--r--src/imports/controls/qquickbusyindicatorring.cpp209
-rw-r--r--src/imports/controls/qquickbusyindicatorring_p.h82
-rw-r--r--src/imports/controls/qtlabscontrolsplugin.cpp81
-rw-r--r--src/imports/controls/qtlabscontrolsplugin.qrc9
-rw-r--r--src/imports/controls/universal/ApplicationWindow.qml13
-rw-r--r--src/imports/controls/universal/BusyIndicator.qml2
-rw-r--r--src/imports/controls/universal/Button.qml4
-rw-r--r--src/imports/controls/universal/CheckBox.qml6
-rw-r--r--src/imports/controls/universal/ComboBox.qml141
-rw-r--r--src/imports/controls/universal/Dial.qml10
-rw-r--r--src/imports/controls/universal/GroupBox.qml6
-rw-r--r--src/imports/controls/universal/ItemDelegate.qml13
-rw-r--r--src/imports/controls/universal/Label.qml2
-rw-r--r--src/imports/controls/universal/Menu.qml68
-rw-r--r--src/imports/controls/universal/MenuItem.qml103
-rw-r--r--src/imports/controls/universal/Pane.qml61
-rw-r--r--src/imports/controls/universal/ProgressBar.qml4
-rw-r--r--src/imports/controls/universal/RadioButton.qml4
-rw-r--r--src/imports/controls/universal/RangeSlider.qml6
-rw-r--r--src/imports/controls/universal/Slider.qml6
-rw-r--r--src/imports/controls/universal/SpinBox.qml29
-rw-r--r--src/imports/controls/universal/Switch.qml6
-rw-r--r--src/imports/controls/universal/TextArea.qml4
-rw-r--r--src/imports/controls/universal/TextField.qml4
-rw-r--r--src/imports/controls/universal/ToolButton.qml2
-rw-r--r--src/imports/controls/universal/images/downarrow.pngbin0 -> 200 bytes
-rw-r--r--src/imports/controls/universal/images/downarrow@2x.pngbin0 -> 263 bytes
-rw-r--r--src/imports/controls/universal/images/downarrow@3x.pngbin0 -> 329 bytes
-rw-r--r--src/imports/controls/universal/images/downarrow@4x.pngbin0 -> 358 bytes
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle.cpp66
-rw-r--r--src/imports/controls/universal/qquickuniversalfocusrectangle_p.h67
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider.cpp2
-rw-r--r--src/imports/controls/universal/qquickuniversalimageprovider_p.h2
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressring_p.h5
-rw-r--r--src/imports/controls/universal/qquickuniversalprogressstrip_p.h6
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle.cpp138
-rw-r--r--src/imports/controls/universal/qquickuniversalstyle_p.h14
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme.cpp20
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme_p.h4
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp6
-rw-r--r--src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc6
-rw-r--r--src/imports/controls/universal/universal.pri6
-rw-r--r--src/imports/templates/plugins.qmltypes159
-rw-r--r--src/imports/templates/qtlabstemplatesplugin.cpp10
-rw-r--r--src/src.pro4
-rw-r--r--src/templates/qquickabstractbutton.cpp27
-rw-r--r--src/templates/qquickabstractbutton_p.h9
-rw-r--r--src/templates/qquickabstractbutton_p_p.h3
-rw-r--r--src/templates/qquickapplicationwindow.cpp231
-rw-r--r--src/templates/qquickapplicationwindow_p.h38
-rw-r--r--src/templates/qquickbusyindicator_p.h4
-rw-r--r--src/templates/qquickbutton.cpp41
-rw-r--r--src/templates/qquickbutton_p.h17
-rw-r--r--src/templates/qquickbuttongroup_p.h3
-rw-r--r--src/templates/qquickcheckbox_p.h4
-rw-r--r--src/templates/qquickcombobox.cpp795
-rw-r--r--src/templates/qquickcombobox_p.h146
-rw-r--r--src/templates/qquickcontainer_p.h4
-rw-r--r--src/templates/qquickcontainer_p_p.h2
-rw-r--r--src/templates/qquickcontrol.cpp181
-rw-r--r--src/templates/qquickcontrol_p.h26
-rw-r--r--src/templates/qquickcontrol_p_p.h10
-rw-r--r--src/templates/qquickdial.cpp2
-rw-r--r--src/templates/qquickdial_p.h4
-rw-r--r--src/templates/qquickdrawer.cpp57
-rw-r--r--src/templates/qquickdrawer_p.h4
-rw-r--r--src/templates/qquickframe.cpp111
-rw-r--r--src/templates/qquickframe_p.h28
-rw-r--r--src/templates/qquickframe_p_p.h10
-rw-r--r--src/templates/qquickgroupbox.cpp17
-rw-r--r--src/templates/qquickgroupbox_p.h4
-rw-r--r--src/templates/qquickitemdelegate_p.h4
-rw-r--r--src/templates/qquicklabel_p.h4
-rw-r--r--src/templates/qquicklabel_p_p.h2
-rw-r--r--src/templates/qquickmenu.cpp16
-rw-r--r--src/templates/qquickmenu_p.h9
-rw-r--r--src/templates/qquickmenu_p_p.h6
-rw-r--r--src/templates/qquickmenuitem.cpp8
-rw-r--r--src/templates/qquickmenuitem_p.h6
-rw-r--r--src/templates/qquickoverlay.cpp189
-rw-r--r--src/templates/qquickoverlay_p.h16
-rw-r--r--src/templates/qquickpageindicator_p.h4
-rw-r--r--src/templates/qquickpane.cpp184
-rw-r--r--src/templates/qquickpane_p.h102
-rw-r--r--src/templates/qquickpane_p_p.h70
-rw-r--r--src/templates/qquickpopup.cpp (renamed from src/templates/qquickpanel.cpp)224
-rw-r--r--src/templates/qquickpopup_p.h (renamed from src/templates/qquickpanel_p.h)47
-rw-r--r--src/templates/qquickpopup_p_p.h (renamed from src/templates/qquickpanel_p_p.h)44
-rw-r--r--src/templates/qquickprogressbar.cpp2
-rw-r--r--src/templates/qquickprogressbar_p.h4
-rw-r--r--src/templates/qquickradiobutton_p.h4
-rw-r--r--src/templates/qquickrangeslider.cpp4
-rw-r--r--src/templates/qquickrangeslider_p.h6
-rw-r--r--src/templates/qquickscrollbar.cpp24
-rw-r--r--src/templates/qquickscrollbar_p.h6
-rw-r--r--src/templates/qquickscrollindicator.cpp20
-rw-r--r--src/templates/qquickscrollindicator_p.h6
-rw-r--r--src/templates/qquickslider.cpp2
-rw-r--r--src/templates/qquickslider_p.h4
-rw-r--r--src/templates/qquickspinbox.cpp87
-rw-r--r--src/templates/qquickspinbox_p.h14
-rw-r--r--src/templates/qquickstackview.cpp13
-rw-r--r--src/templates/qquickstackview_p.cpp31
-rw-r--r--src/templates/qquickstackview_p.h6
-rw-r--r--src/templates/qquickstackview_p_p.h6
-rw-r--r--src/templates/qquickswipeview_p.h3
-rw-r--r--src/templates/qquickswitch.cpp2
-rw-r--r--src/templates/qquickswitch_p.h4
-rw-r--r--src/templates/qquicktabbar_p.h4
-rw-r--r--src/templates/qquicktabbutton.cpp2
-rw-r--r--src/templates/qquicktabbutton_p.h4
-rw-r--r--src/templates/qquicktextarea.cpp56
-rw-r--r--src/templates/qquicktextarea_p.h12
-rw-r--r--src/templates/qquicktextarea_p_p.h3
-rw-r--r--src/templates/qquicktextfield.cpp47
-rw-r--r--src/templates/qquicktextfield_p.h12
-rw-r--r--src/templates/qquicktextfield_p_p.h3
-rw-r--r--src/templates/qquicktoolbar_p.h4
-rw-r--r--src/templates/qquicktoolbutton_p.h4
-rw-r--r--src/templates/qquicktumbler_p.h5
-rw-r--r--src/templates/templates.pri11
-rw-r--r--tests/auto/accessibility/tst_accessibility.cpp2
-rw-r--r--tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml5
-rw-r--r--tests/auto/applicationwindow/data/activeFocusControl.qml105
-rw-r--r--tests/auto/applicationwindow/data/attachedProperties.qml58
-rw-r--r--tests/auto/applicationwindow/data/font.qml87
-rw-r--r--tests/auto/applicationwindow/data/locale.qml67
-rw-r--r--tests/auto/applicationwindow/tst_applicationwindow.cpp264
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml9
-rw-r--r--tests/auto/controls/data/tst_button.qml31
-rw-r--r--tests/auto/controls/data/tst_combobox.qml584
-rw-r--r--tests/auto/controls/data/tst_control.qml273
-rw-r--r--tests/auto/controls/data/tst_itemdelegate.qml64
-rw-r--r--tests/auto/controls/data/tst_menuitem.qml64
-rw-r--r--tests/auto/controls/data/tst_pane.qml144
-rw-r--r--tests/auto/controls/data/tst_progressbar.qml14
-rw-r--r--tests/auto/controls/data/tst_rangeslider.qml19
-rw-r--r--tests/auto/controls/data/tst_slider.qml16
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml7
-rw-r--r--tests/auto/controls/data/tst_stackview.qml52
-rw-r--r--tests/auto/menu/data/applicationwindow.qml2
-rw-r--r--tests/auto/menu/tst_menu.cpp47
-rw-r--r--tests/auto/sanity/BLACKLIST6
-rw-r--r--tests/auto/shared/util.pri2
-rw-r--r--tests/auto/shared/visualtestutil.h26
-rw-r--r--tests/auto/universal/data/tst_universal.qml59
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp70
-rw-r--r--tests/manual/gifs/data/qtlabscontrols-switch.qml4
-rw-r--r--tests/manual/gifs/gifrecorder.cpp9
-rw-r--r--tests/manual/gifs/tst_gifs.cpp4
-rw-r--r--tests/manual/testbench/main.cpp3
-rw-r--r--tests/manual/testbench/main.qml775
329 files changed, 12789 insertions, 2323 deletions
diff --git a/.gitignore b/.gitignore
index ea3b4acc..93854f17 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,12 +5,15 @@
/lib
/mkspecs
+/examples/controls/gallery/gallery
+
/tests/auto/accessibility/tst_accessibility
/tests/auto/activeFocusOnTab/tst_activeFocusOnTab
/tests/auto/applicationwindow/tst_applicationwindow
/tests/auto/calendar/tst_calendar
/tests/auto/controls/tst_controls
/tests/auto/material/tst_material
+/tests/auto/menu/tst_menu
/tests/auto/pressandhold/tst_pressandhold
/tests/auto/sanity/tst_sanity
/tests/auto/snippets/tst_snippets
diff --git a/examples/controls/controls.pro b/examples/controls/controls.pro
new file mode 100644
index 00000000..889077f2
--- /dev/null
+++ b/examples/controls/controls.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ gallery
diff --git a/examples/controls/gallery/gallery.cpp b/examples/controls/gallery/gallery.cpp
new file mode 100644
index 00000000..778ecbc2
--- /dev/null
+++ b/examples/controls/gallery/gallery.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QQmlContext>
+#include <QSettings>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication::setApplicationName("Gallery");
+ QGuiApplication::setOrganizationName("QtProject");
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
+ QGuiApplication app(argc, argv);
+
+ QSettings settings;
+ qputenv("QT_LABS_CONTROLS_STYLE", settings.value("style").toByteArray());
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl("qrc:/gallery.qml"));
+ if (engine.rootObjects().isEmpty())
+ return -1;
+
+ return app.exec();
+}
diff --git a/examples/controls/gallery/gallery.pro b/examples/controls/gallery/gallery.pro
new file mode 100644
index 00000000..c31529b7
--- /dev/null
+++ b/examples/controls/gallery/gallery.pro
@@ -0,0 +1,15 @@
+TEMPLATE = app
+TARGET = gallery
+QT += quick
+
+SOURCES += \
+ gallery.cpp
+
+OTHER_FILES += \
+ gallery.qml
+
+RESOURCES += \
+ gallery.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/qtlabscontrols/gallery
+INSTALLS += target
diff --git a/examples/controls/gallery/gallery.qml b/examples/controls/gallery/gallery.qml
new file mode 100644
index 00000000..2bd7d40f
--- /dev/null
+++ b/examples/controls/gallery/gallery.qml
@@ -0,0 +1,335 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Layouts 1.3
+import Qt.labs.controls 1.0
+import Qt.labs.controls.material 1.0
+import Qt.labs.controls.universal 1.0
+import Qt.labs.settings 1.0
+
+ApplicationWindow {
+ id: window
+ width: 360
+ height: 520
+ visible: true
+ title: "Qt Labs Controls"
+
+ Settings {
+ id: settings
+ property string style: "Universal"
+ }
+
+ header: ToolBar {
+ RowLayout {
+ spacing: 20
+ anchors.fill: parent
+
+ ToolButton {
+ label: Image {
+ anchors.centerIn: parent
+ source: "qrc:/images/drawer.png"
+ }
+ onClicked: drawer.open()
+ }
+
+ Label {
+ id: titleLabel
+ text: "Gallery"
+ font.pixelSize: 20
+ elide: Label.ElideRight
+ horizontalAlignment: Qt.AlignHCenter
+ verticalAlignment: Qt.AlignVCenter
+ Layout.fillWidth: true
+ }
+
+ ToolButton {
+ label: Image {
+ anchors.centerIn: parent
+ source: "qrc:/images/menu.png"
+ }
+ onClicked: optionsMenu.open()
+ }
+ }
+ }
+
+ Drawer {
+ id: drawer
+
+ Pane {
+ padding: 0
+ width: Math.min(window.width, window.height) / 3 * 2
+ height: window.height
+
+ ListView {
+ id: listView
+ currentIndex: -1
+ anchors.fill: parent
+
+ delegate: ItemDelegate {
+ width: parent.width
+ text: model.title
+ highlighted: ListView.isCurrentItem
+ onClicked: {
+ if (listView.currentIndex != index) {
+ listView.currentIndex = index
+ titleLabel.text = model.title
+ stackView.replace(model.source)
+ }
+ drawer.close()
+ }
+ }
+
+ model: ListModel {
+ ListElement { title: "BusyIndicator"; source: "qrc:/pages/BusyIndicatorPage.qml" }
+ ListElement { title: "Button"; source: "qrc:/pages/ButtonPage.qml" }
+ ListElement { title: "CheckBox"; source: "qrc:/pages/CheckBoxPage.qml" }
+ ListElement { title: "ComboBox"; source: "qrc:/pages/ComboBoxPage.qml" }
+ ListElement { title: "Dial"; source: "qrc:/pages/DialPage.qml" }
+ ListElement { title: "Drawer"; source: "qrc:/pages/DrawerPage.qml" }
+ ListElement { title: "Frame"; source: "qrc:/pages/FramePage.qml" }
+ ListElement { title: "GroupBox"; source: "qrc:/pages/GroupBoxPage.qml" }
+ ListElement { title: "Menu"; source: "qrc:/pages/MenuPage.qml" }
+ ListElement { title: "PageIndicator"; source: "qrc:/pages/PageIndicatorPage.qml" }
+ ListElement { title: "Popup"; source: "qrc:/pages/PopupPage.qml" }
+ ListElement { title: "ProgressBar"; source: "qrc:/pages/ProgressBarPage.qml" }
+ ListElement { title: "RadioButton"; source: "qrc:/pages/RadioButtonPage.qml" }
+ ListElement { title: "RangeSlider"; source: "qrc:/pages/RangeSliderPage.qml" }
+ ListElement { title: "ScrollBar"; source: "qrc:/pages/ScrollBarPage.qml" }
+ ListElement { title: "ScrollIndicator"; source: "qrc:/pages/ScrollIndicatorPage.qml" }
+ ListElement { title: "Slider"; source: "qrc:/pages/SliderPage.qml" }
+ ListElement { title: "SpinBox"; source: "qrc:/pages/SpinBoxPage.qml" }
+ ListElement { title: "StackView"; source: "qrc:/pages/StackViewPage.qml" }
+ ListElement { title: "SwipeView"; source: "qrc:/pages/SwipeViewPage.qml" }
+ ListElement { title: "Switch"; source: "qrc:/pages/SwitchPage.qml" }
+ ListElement { title: "TabBar"; source: "qrc:/pages/TabBarPage.qml" }
+ ListElement { title: "TextArea"; source: "qrc:/pages/TextAreaPage.qml" }
+ ListElement { title: "TextField"; source: "qrc:/pages/TextFieldPage.qml" }
+ ListElement { title: "Tumbler"; source: "qrc:/pages/TumblerPage.qml" }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+ }
+ }
+ onClicked: close()
+ }
+
+ StackView {
+ id: stackView
+ anchors.fill: parent
+
+ initialItem: Pane {
+ id: pane
+ anchors.fill: parent
+
+ Image {
+ id: logo
+ width: pane.availableWidth / 2
+ height: pane.availableHeight / 2
+ anchors.centerIn: parent
+ anchors.verticalCenterOffset: -50
+ fillMode: Image.PreserveAspectFit
+ source: "qrc:/images/qt-logo.png"
+ }
+
+ Label {
+ color: "#26282a"
+ text: "Qt Labs Controls provides a set of controls that can be used to build complete interfaces in Qt Quick."
+ anchors.margins: 20
+ anchors.top: logo.bottom
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.bottom: arrow.top
+ horizontalAlignment: Label.AlignHCenter
+ verticalAlignment: Label.AlignVCenter
+ wrapMode: Label.Wrap
+ }
+
+ Image {
+ id: arrow
+ source: "qrc:/images/arrow.png"
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ }
+ }
+ }
+
+ Popup {
+ id: settingsPopup
+ modal: true
+ focus: true
+ onPressedOutside: close()
+
+ contentItem: Pane {
+ id: settingsPane
+ x: (window.width - width) / 2
+ y: window.height / 6
+ width: Math.min(window.width, window.height) / 3 * 2
+ contentHeight: settingsColumn.implicitHeight
+
+ Keys.onEscapePressed: settingsPopup.close()
+
+
+ ColumnLayout {
+ id: settingsColumn
+ spacing: 20
+ anchors.fill: parent
+
+ Label {
+ text: "Settings"
+ font.bold: true
+ }
+
+ RowLayout {
+ spacing: 10
+
+ Label {
+ text: "Style:"
+ }
+
+ ComboBox {
+ id: styleBox
+ property int styleIndex: -1
+ model: ["Default", "Material", "Universal"]
+ Component.onCompleted: {
+ styleIndex = find(settings.style)
+ if (styleIndex !== -1)
+ currentIndex = styleIndex
+ }
+ Layout.fillWidth: true
+ }
+ }
+
+ Label {
+ text: "Restart required"
+ opacity: styleBox.currentIndex !== styleBox.styleIndex ? 1.0 : 0.0
+ horizontalAlignment: Label.AlignHCenter
+ verticalAlignment: Label.AlignVCenter
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ }
+
+ RowLayout {
+ spacing: 10
+
+ Button {
+ id: okButton
+ text: "Ok"
+ onClicked: {
+ settings.style = styleBox.displayText
+ settingsPopup.close()
+ }
+ Layout.preferredWidth: 0
+ Layout.fillWidth: true
+ }
+
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ onClicked: {
+ styleBox.currentIndex = styleBox.styleIndex
+ settingsPopup.close()
+ }
+ Layout.preferredWidth: 0
+ Layout.fillWidth: true
+ }
+ }
+ }
+ }
+ }
+
+ Popup {
+ id: aboutDialog
+ modal: true
+ focus: true
+ onPressedOutside: close()
+
+ contentItem: Pane {
+ x: (window.width - width) / 2
+ y: (window.height - height) / 2
+ width: Math.min(window.width, window.height) / 3 * 2
+ contentHeight: aboutColumn.implicitHeight
+
+ Keys.onEscapePressed: aboutDialog.close()
+
+ Column {
+ id: aboutColumn
+
+ spacing: 20
+ anchors.fill: parent
+
+ Label {
+ text: "About"
+ font.bold: true
+ }
+
+ Label {
+ width: parent.width
+ text: "The Qt Labs Controls module is a technology preview of the next generation user interface controls based on Qt Quick."
+ wrapMode: Label.Wrap
+ font.pixelSize: 12
+ }
+
+ Label {
+ width: parent.width
+ text: "In comparison to the desktop oriented Qt Quick Controls 1, the experimental Qt Labs "
+ + "Controls are an order of magnitude simpler, lighter and faster, and are primarily targeting embedded "
+ + "and mobile platforms."
+ wrapMode: Label.Wrap
+ font.pixelSize: 12
+ }
+ }
+ }
+ }
+
+ Menu {
+ id: optionsMenu
+ contentItem.x: contentItem.parent ? (contentItem.parent.width - contentItem.width) : 0
+
+ MenuItem {
+ text: "Settings"
+ onTriggered: settingsPopup.open()
+ }
+ MenuItem {
+ text: "About"
+ onTriggered: aboutDialog.open()
+ }
+ }
+}
diff --git a/examples/controls/gallery/gallery.qrc b/examples/controls/gallery/gallery.qrc
new file mode 100644
index 00000000..89958333
--- /dev/null
+++ b/examples/controls/gallery/gallery.qrc
@@ -0,0 +1,51 @@
+<RCC>
+ <qresource prefix="/">
+ <file>gallery.qml</file>
+ <file>qtlabscontrols.conf</file>
+ <file>images/arrow.png</file>
+ <file>images/arrow@2x.png</file>
+ <file>images/arrow@3x.png</file>
+ <file>images/arrow@4x.png</file>
+ <file>images/arrows.png</file>
+ <file>images/arrows@2x.png</file>
+ <file>images/arrows@3x.png</file>
+ <file>images/arrows@4x.png</file>
+ <file>images/drawer.png</file>
+ <file>images/drawer@2x.png</file>
+ <file>images/drawer@3x.png</file>
+ <file>images/drawer@4x.png</file>
+ <file>images/menu.png</file>
+ <file>images/menu@2x.png</file>
+ <file>images/menu@3x.png</file>
+ <file>images/menu@4x.png</file>
+ <file>images/qt-logo.png</file>
+ <file>images/qt-logo@2x.png</file>
+ <file>images/qt-logo@3x.png</file>
+ <file>images/qt-logo@4x.png</file>
+ <file>pages/BusyIndicatorPage.qml</file>
+ <file>pages/ButtonPage.qml</file>
+ <file>pages/CheckBoxPage.qml</file>
+ <file>pages/ComboBoxPage.qml</file>
+ <file>pages/DialPage.qml</file>
+ <file>pages/DrawerPage.qml</file>
+ <file>pages/FramePage.qml</file>
+ <file>pages/GroupBoxPage.qml</file>
+ <file>pages/MenuPage.qml</file>
+ <file>pages/PageIndicatorPage.qml</file>
+ <file>pages/PopupPage.qml</file>
+ <file>pages/ProgressBarPage.qml</file>
+ <file>pages/RadioButtonPage.qml</file>
+ <file>pages/RangeSliderPage.qml</file>
+ <file>pages/ScrollBarPage.qml</file>
+ <file>pages/ScrollIndicatorPage.qml</file>
+ <file>pages/SliderPage.qml</file>
+ <file>pages/SpinBoxPage.qml</file>
+ <file>pages/StackViewPage.qml</file>
+ <file>pages/SwipeViewPage.qml</file>
+ <file>pages/SwitchPage.qml</file>
+ <file>pages/TabBarPage.qml</file>
+ <file>pages/TextAreaPage.qml</file>
+ <file>pages/TextFieldPage.qml</file>
+ <file>pages/TumblerPage.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/controls/gallery/images/arrow.png b/examples/controls/gallery/images/arrow.png
new file mode 100644
index 00000000..340139de
--- /dev/null
+++ b/examples/controls/gallery/images/arrow.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrow@2x.png b/examples/controls/gallery/images/arrow@2x.png
new file mode 100644
index 00000000..ef2016e9
--- /dev/null
+++ b/examples/controls/gallery/images/arrow@2x.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrow@3x.png b/examples/controls/gallery/images/arrow@3x.png
new file mode 100644
index 00000000..86c8506b
--- /dev/null
+++ b/examples/controls/gallery/images/arrow@3x.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrow@4x.png b/examples/controls/gallery/images/arrow@4x.png
new file mode 100644
index 00000000..ce70d95b
--- /dev/null
+++ b/examples/controls/gallery/images/arrow@4x.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrows.png b/examples/controls/gallery/images/arrows.png
new file mode 100644
index 00000000..f77e01fa
--- /dev/null
+++ b/examples/controls/gallery/images/arrows.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrows@2x.png b/examples/controls/gallery/images/arrows@2x.png
new file mode 100644
index 00000000..9615d436
--- /dev/null
+++ b/examples/controls/gallery/images/arrows@2x.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrows@3x.png b/examples/controls/gallery/images/arrows@3x.png
new file mode 100644
index 00000000..b6a53e1c
--- /dev/null
+++ b/examples/controls/gallery/images/arrows@3x.png
Binary files differ
diff --git a/examples/controls/gallery/images/arrows@4x.png b/examples/controls/gallery/images/arrows@4x.png
new file mode 100644
index 00000000..099ed1b5
--- /dev/null
+++ b/examples/controls/gallery/images/arrows@4x.png
Binary files differ
diff --git a/examples/controls/gallery/images/drawer.png b/examples/controls/gallery/images/drawer.png
new file mode 100644
index 00000000..1e974efa
--- /dev/null
+++ b/examples/controls/gallery/images/drawer.png
Binary files differ
diff --git a/examples/controls/gallery/images/drawer@2x.png b/examples/controls/gallery/images/drawer@2x.png
new file mode 100644
index 00000000..eba3b6cc
--- /dev/null
+++ b/examples/controls/gallery/images/drawer@2x.png
Binary files differ
diff --git a/examples/controls/gallery/images/drawer@3x.png b/examples/controls/gallery/images/drawer@3x.png
new file mode 100644
index 00000000..3584ed6d
--- /dev/null
+++ b/examples/controls/gallery/images/drawer@3x.png
Binary files differ
diff --git a/examples/controls/gallery/images/drawer@4x.png b/examples/controls/gallery/images/drawer@4x.png
new file mode 100644
index 00000000..60d93aff
--- /dev/null
+++ b/examples/controls/gallery/images/drawer@4x.png
Binary files differ
diff --git a/examples/controls/gallery/images/menu.png b/examples/controls/gallery/images/menu.png
new file mode 100644
index 00000000..a10473d9
--- /dev/null
+++ b/examples/controls/gallery/images/menu.png
Binary files differ
diff --git a/examples/controls/gallery/images/menu@2x.png b/examples/controls/gallery/images/menu@2x.png
new file mode 100644
index 00000000..649c2a08
--- /dev/null
+++ b/examples/controls/gallery/images/menu@2x.png
Binary files differ
diff --git a/examples/controls/gallery/images/menu@3x.png b/examples/controls/gallery/images/menu@3x.png
new file mode 100644
index 00000000..9554b695
--- /dev/null
+++ b/examples/controls/gallery/images/menu@3x.png
Binary files differ
diff --git a/examples/controls/gallery/images/menu@4x.png b/examples/controls/gallery/images/menu@4x.png
new file mode 100644
index 00000000..187c171c
--- /dev/null
+++ b/examples/controls/gallery/images/menu@4x.png
Binary files differ
diff --git a/examples/controls/gallery/images/qt-logo.png b/examples/controls/gallery/images/qt-logo.png
new file mode 100644
index 00000000..8b0772b0
--- /dev/null
+++ b/examples/controls/gallery/images/qt-logo.png
Binary files differ
diff --git a/examples/controls/gallery/images/qt-logo@2x.png b/examples/controls/gallery/images/qt-logo@2x.png
new file mode 100644
index 00000000..0d1d499b
--- /dev/null
+++ b/examples/controls/gallery/images/qt-logo@2x.png
Binary files differ
diff --git a/examples/controls/gallery/images/qt-logo@3x.png b/examples/controls/gallery/images/qt-logo@3x.png
new file mode 100644
index 00000000..c9aae358
--- /dev/null
+++ b/examples/controls/gallery/images/qt-logo@3x.png
Binary files differ
diff --git a/examples/controls/gallery/images/qt-logo@4x.png b/examples/controls/gallery/images/qt-logo@4x.png
new file mode 100644
index 00000000..ad0ebd03
--- /dev/null
+++ b/examples/controls/gallery/images/qt-logo@4x.png
Binary files differ
diff --git a/examples/controls/gallery/pages/BusyIndicatorPage.qml b/examples/controls/gallery/pages/BusyIndicatorPage.qml
new file mode 100644
index 00000000..2d538216
--- /dev/null
+++ b/examples/controls/gallery/pages/BusyIndicatorPage.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "BusyIndicator is used to indicate activity while content is being loaded,"
+ + " or the UI is blocked waiting for a resource to become available."
+ }
+
+ BusyIndicator {
+ readonly property int size: Math.min(pane.availableWidth, pane.availableHeight) / 5
+ width: size
+ height: size
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/ButtonPage.qml b/examples/controls/gallery/pages/ButtonPage.qml
new file mode 100644
index 00000000..329b53a7
--- /dev/null
+++ b/examples/controls/gallery/pages/ButtonPage.qml
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+ contentHeight: pane.height
+
+ readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3))
+
+ Pane {
+ id: pane
+ width: parent.width
+
+ Column {
+ id: column
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Button presents a push-button that can be pushed or clicked by the user. "
+ + "Buttons are normally used to perform an action, or to answer a question."
+ }
+
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Button {
+ text: "First"
+ width: itemWidth
+ }
+ Button {
+ id: button
+ text: "Second"
+ width: itemWidth
+ }
+ Button {
+ text: "Third"
+ enabled: false
+ width: itemWidth
+ }
+ }
+ }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
diff --git a/examples/controls/gallery/pages/CheckBoxPage.qml b/examples/controls/gallery/pages/CheckBoxPage.qml
new file mode 100644
index 00000000..861f144d
--- /dev/null
+++ b/examples/controls/gallery/pages/CheckBoxPage.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+ contentHeight: pane.height
+
+ Pane {
+ id: pane
+ width: parent.width
+
+ Column {
+ id: column
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "CheckBox presents an option button that can be toggled on or off. "
+ + "Check boxes are typically used to select one or more options from a set of options."
+ }
+
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ CheckBox {
+ text: "First"
+ checked: true
+ }
+ CheckBox {
+ text: "Second"
+ }
+ CheckBox {
+ text: "Third"
+ checked: true
+ enabled: false
+ }
+ }
+ }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
diff --git a/examples/controls/gallery/pages/ComboBoxPage.qml b/examples/controls/gallery/pages/ComboBoxPage.qml
new file mode 100644
index 00000000..3c497c48
--- /dev/null
+++ b/examples/controls/gallery/pages/ComboBoxPage.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "ComboBox is a combined button and popup list. It provides means of presenting a "
+ + "list of options to the user in a way that takes up the minimum amount of screen space."
+ }
+
+ ComboBox {
+ model: ["First", "Second", "Third"]
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/DialPage.qml b/examples/controls/gallery/pages/DialPage.qml
new file mode 100644
index 00000000..5277d7b0
--- /dev/null
+++ b/examples/controls/gallery/pages/DialPage.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "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."
+ }
+
+ Dial {
+ value: 0.5
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/DrawerPage.qml b/examples/controls/gallery/pages/DrawerPage.qml
new file mode 100644
index 00000000..910a0c7c
--- /dev/null
+++ b/examples/controls/gallery/pages/DrawerPage.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Drawer provides a swipe-based side panel, similar to those often used "
+ + "in touch interfaces to provide a central location for navigation."
+ }
+
+ Button {
+ text: "Open"
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+
+ onClicked: drawer.open()
+ }
+ }
+
+ Image {
+ source: "qrc:/images/arrow.png"
+ anchors.left: parent.left
+ anchors.bottom: parent.bottom
+ }
+}
diff --git a/examples/controls/gallery/pages/FramePage.qml b/examples/controls/gallery/pages/FramePage.qml
new file mode 100644
index 00000000..5b3ef4de
--- /dev/null
+++ b/examples/controls/gallery/pages/FramePage.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, pane.availableWidth / 3 * 2))
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Frame is used to layout a logical group of controls together, within a visual frame."
+ }
+
+ Frame {
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Column {
+ spacing: 20
+ width: itemWidth
+
+ RadioButton {
+ text: "First"
+ checked: true
+ width: parent.width
+ }
+ RadioButton {
+ id: button
+ text: "Second"
+ width: parent.width
+ }
+ RadioButton {
+ text: "Third"
+ width: parent.width
+ }
+ }
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/GroupBoxPage.qml b/examples/controls/gallery/pages/GroupBoxPage.qml
new file mode 100644
index 00000000..e9d67849
--- /dev/null
+++ b/examples/controls/gallery/pages/GroupBoxPage.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ readonly property int itemWidth: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 3, pane.availableWidth / 3 * 2))
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "GroupBox is used to layout a logical group of controls together, within a titled visual frame."
+ }
+
+ GroupBox {
+ title: "Title"
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Column {
+ spacing: 20
+ width: itemWidth
+
+ RadioButton {
+ text: "First"
+ checked: true
+ width: parent.width
+ }
+ RadioButton {
+ id: button
+ text: "Second"
+ width: parent.width
+ }
+ RadioButton {
+ text: "Third"
+ width: parent.width
+ }
+ }
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/MenuPage.qml b/examples/controls/gallery/pages/MenuPage.qml
new file mode 100644
index 00000000..119be559
--- /dev/null
+++ b/examples/controls/gallery/pages/MenuPage.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Menu can be used either as a context menu, or as a popup menu."
+ }
+
+ Button {
+ id: button
+ text: "Open"
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+
+ onClicked: optionsMenu.open()
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/PageIndicatorPage.qml b/examples/controls/gallery/pages/PageIndicatorPage.qml
new file mode 100644
index 00000000..f8557f24
--- /dev/null
+++ b/examples/controls/gallery/pages/PageIndicatorPage.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "PageIndicator is used to indicate the currently active page in a container of pages."
+ }
+
+ PageIndicator {
+ count: 5
+ currentIndex: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/PopupPage.qml b/examples/controls/gallery/pages/PopupPage.qml
new file mode 100644
index 00000000..d2685969
--- /dev/null
+++ b/examples/controls/gallery/pages/PopupPage.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Popup is used to display modal or modeless content that overlays other "
+ + "application content. In this example, the settings are shown in a popup."
+ }
+
+ Button {
+ id: button
+ text: "Open"
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+
+ onClicked: settingsPopup.open()
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/ProgressBarPage.qml b/examples/controls/gallery/pages/ProgressBarPage.qml
new file mode 100644
index 00000000..7beb4125
--- /dev/null
+++ b/examples/controls/gallery/pages/ProgressBarPage.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ readonly property int itemWidth: Math.max(bar.implicitWidth, pane.availableWidth / 3)
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "ProgressBar indicates the progress of an operation. It can be set in an "
+ + "indeterminate mode to indicate that the length of the operation is unknown."
+ }
+
+ ProgressBar {
+ id: bar
+ value: 0.5
+ width: itemWidth
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ ProgressBar {
+ indeterminate: true
+ width: itemWidth
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/RadioButtonPage.qml b/examples/controls/gallery/pages/RadioButtonPage.qml
new file mode 100644
index 00000000..fe6a751c
--- /dev/null
+++ b/examples/controls/gallery/pages/RadioButtonPage.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+ contentHeight: pane.height
+
+ Pane {
+ id: pane
+ width: parent.width
+
+ Column {
+ id: column
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "RadioButton presents an option button that can be toggled on or off. "
+ + "Radio buttons are typically used to select one option from a set of options."
+ }
+
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ RadioButton {
+ text: "First"
+ }
+ RadioButton {
+ text: "Second"
+ checked: true
+ }
+ RadioButton {
+ text: "Third"
+ enabled: false
+ }
+ }
+ }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
diff --git a/examples/controls/gallery/pages/RangeSliderPage.qml b/examples/controls/gallery/pages/RangeSliderPage.qml
new file mode 100644
index 00000000..c41097df
--- /dev/null
+++ b/examples/controls/gallery/pages/RangeSliderPage.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, pane.availableWidth / 3))
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "RangeSlider is used to select a range specified by two values, by sliding each handle along a track."
+ }
+
+ RangeSlider {
+ id: slider
+ first.value: 0.25
+ second.value: 0.75
+ width: itemWidth
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/ScrollBarPage.qml b/examples/controls/gallery/pages/ScrollBarPage.qml
new file mode 100644
index 00000000..0db1888d
--- /dev/null
+++ b/examples/controls/gallery/pages/ScrollBarPage.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+
+ contentHeight: pane.height
+
+ Pane {
+ id: pane
+ width: flickable.width
+ height: flickable.height * 1.25
+
+ Column {
+ id: column
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "ScrollBar is an interactive bar that can be used to scroll to a specific position. "
+ + "A scroll bar can be either vertical or horizontal, and can be attached to any Flickable, "
+ + "such as ListView and GridView."
+ }
+
+ Image {
+ rotation: 90
+ source: "qrc:/images/arrows.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+
+ ScrollBar.vertical: ScrollBar { }
+}
diff --git a/examples/controls/gallery/pages/ScrollIndicatorPage.qml b/examples/controls/gallery/pages/ScrollIndicatorPage.qml
new file mode 100644
index 00000000..658b7d15
--- /dev/null
+++ b/examples/controls/gallery/pages/ScrollIndicatorPage.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+
+ contentHeight: pane.height
+
+ Pane {
+ id: pane
+ width: flickable.width
+ height: flickable.height * 1.25
+
+ Column {
+ id: column
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "ScrollIndicator is a non-interactive indicator that indicates the current scroll position. "
+ + "A scroll indicator can be either vertical or horizontal, and can be attached to any Flickable, "
+ + "such as ListView and GridView."
+ }
+
+ Image {
+ rotation: 90
+ source: "qrc:/images/arrows.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
diff --git a/examples/controls/gallery/pages/SliderPage.qml b/examples/controls/gallery/pages/SliderPage.qml
new file mode 100644
index 00000000..550ccec9
--- /dev/null
+++ b/examples/controls/gallery/pages/SliderPage.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ readonly property int itemWidth: Math.max(slider.implicitWidth, Math.min(slider.implicitWidth * 2, pane.availableWidth / 3))
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Slider is used to select a value by sliding a handle along a track."
+ }
+
+ Slider {
+ id: slider
+ value: 0.5
+ width: itemWidth
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/SpinBoxPage.qml b/examples/controls/gallery/pages/SpinBoxPage.qml
new file mode 100644
index 00000000..c309ce8e
--- /dev/null
+++ b/examples/controls/gallery/pages/SpinBoxPage.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ readonly property int itemWidth: Math.max(box.implicitWidth, Math.min(box.implicitWidth * 2, pane.availableWidth / 3))
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "SpinBox allows the user to choose an integer value by clicking the up or down indicator buttons, "
+ + "by pressing up or down on the keyboard, or by entering a text value in the input field."
+ }
+
+ SpinBox {
+ id: box
+ value: 50
+ width: itemWidth
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/StackViewPage.qml b/examples/controls/gallery/pages/StackViewPage.qml
new file mode 100644
index 00000000..42e1df43
--- /dev/null
+++ b/examples/controls/gallery/pages/StackViewPage.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+StackView {
+ id: stackView
+ initialItem: page
+
+ Component {
+ id: page
+
+ Pane {
+ id: pane
+ width: parent ? parent.width : 0 // TODO: fix null parent on destruction
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "StackView provides a stack-based navigation model."
+ }
+
+ Button {
+ id: button
+ text: "Push"
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3))
+ onClicked: stackView.push(page)
+ }
+
+ Button {
+ text: "Pop"
+ enabled: stackView.depth > 1
+ width: Math.max(button.implicitWidth, Math.min(button.implicitWidth * 2, pane.availableWidth / 3))
+ anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: stackView.pop()
+ }
+ }
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/SwipeViewPage.qml b/examples/controls/gallery/pages/SwipeViewPage.qml
new file mode 100644
index 00000000..29739451
--- /dev/null
+++ b/examples/controls/gallery/pages/SwipeViewPage.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ SwipeView {
+ id: view
+ currentIndex: 1
+ anchors.fill: parent
+
+ Repeater {
+ model: 3
+
+ Pane {
+ width: view.width
+ height: view.height
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "SwipeView provides a swipe-based navigation model."
+ }
+
+ Image {
+ source: "qrc:/images/arrows.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+ }
+ }
+
+ PageIndicator {
+ count: view.count
+ currentIndex: view.currentIndex
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+}
diff --git a/examples/controls/gallery/pages/SwitchPage.qml b/examples/controls/gallery/pages/SwitchPage.qml
new file mode 100644
index 00000000..ebb4f2ee
--- /dev/null
+++ b/examples/controls/gallery/pages/SwitchPage.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+ contentHeight: pane.height
+
+ Pane {
+ id: pane
+ width: parent.width
+
+ Column {
+ id: column
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Switch is an option button that can be dragged or toggled on or off. "
+ + "Switches are typically used to select between two states."
+ }
+
+ Column {
+ spacing: 20
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ Switch {
+ text: "First"
+ }
+ Switch {
+ text: "Second"
+ checked: true
+ }
+ Switch {
+ text: "Third"
+ enabled: false
+ }
+ }
+ }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
diff --git a/examples/controls/gallery/pages/TabBarPage.qml b/examples/controls/gallery/pages/TabBarPage.qml
new file mode 100644
index 00000000..0ab4a100
--- /dev/null
+++ b/examples/controls/gallery/pages/TabBarPage.qml
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+ padding: 0
+
+ SwipeView {
+ id: swipeView
+ anchors.fill: parent
+ anchors.bottomMargin: tabBar.height
+ currentIndex: tabBar.currentIndex
+
+ Repeater {
+ model: 3
+
+ Pane {
+ width: swipeView.width
+ height: swipeView.height
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "TabBar provides a tab-based navigation model."
+ }
+
+ Image {
+ source: "qrc:/images/arrows.png"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+ }
+ }
+
+ TabBar {
+ id: tabBar
+ width: parent.width
+ anchors.bottom: parent.bottom
+ currentIndex: swipeView.currentIndex
+
+ TabButton {
+ text: "First"
+ }
+ TabButton {
+ text: "Second"
+ }
+ TabButton {
+ text: "Third"
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/TextAreaPage.qml b/examples/controls/gallery/pages/TextAreaPage.qml
new file mode 100644
index 00000000..8ca759c8
--- /dev/null
+++ b/examples/controls/gallery/pages/TextAreaPage.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Flickable {
+ id: flickable
+ contentHeight: pane.height
+
+ Pane {
+ id: pane
+ width: parent.width
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "TextArea is a multi-line text editor."
+ }
+
+ TextArea {
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 3, pane.availableWidth / 3))
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ wrapMode: TextArea.Wrap
+ text: "TextArea\n...\n...\n..."
+ }
+ }
+ }
+
+ ScrollIndicator.vertical: ScrollIndicator { }
+}
diff --git a/examples/controls/gallery/pages/TextFieldPage.qml b/examples/controls/gallery/pages/TextFieldPage.qml
new file mode 100644
index 00000000..761d2fa6
--- /dev/null
+++ b/examples/controls/gallery/pages/TextFieldPage.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ anchors.fill: parent
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "TextField is a single-line text editor."
+ }
+
+ TextField {
+ id: field
+ placeholderText: "TextField"
+ width: Math.max(implicitWidth, Math.min(implicitWidth * 2, pane.availableWidth / 3))
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/pages/TumblerPage.qml b/examples/controls/gallery/pages/TumblerPage.qml
new file mode 100644
index 00000000..b15407e5
--- /dev/null
+++ b/examples/controls/gallery/pages/TumblerPage.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+
+Pane {
+ id: pane
+
+ Column {
+ spacing: 40
+ width: parent.width
+
+ Label {
+ width: parent.width
+ wrapMode: Label.Wrap
+ horizontalAlignment: Qt.AlignHCenter
+ text: "Tumbler is used to select a value by spinning a wheel."
+ }
+
+ Tumbler {
+ model: 10
+ visibleItemCount: 5
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+}
diff --git a/examples/controls/gallery/qtlabscontrols.conf b/examples/controls/gallery/qtlabscontrols.conf
new file mode 100644
index 00000000..80041052
--- /dev/null
+++ b/examples/controls/gallery/qtlabscontrols.conf
@@ -0,0 +1,10 @@
+[Controls]
+Style=Universal
+
+[Material]
+Accent=LightGreen
+Theme=Light
+
+[Universal]
+Accent=Green
+Theme=Light
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 00000000..ab3cd2b2
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+SUBDIRS += \
+ controls
diff --git a/src/controls/qquickpaddedrectangle.cpp b/src/controls/qquickpaddedrectangle.cpp
index ee66a5a5..9542ca5f 100644
--- a/src/controls/qquickpaddedrectangle.cpp
+++ b/src/controls/qquickpaddedrectangle.cpp
@@ -180,18 +180,31 @@ void QQuickPaddedRectangle::setBottomPadding(qreal padding, bool has)
QSGNode *QQuickPaddedRectangle::updatePaintNode(QSGNode *node, UpdatePaintNodeData *data)
{
- QSGRectangleNode *rectangle = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(node, data));
- if (rectangle) {
+ QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(node);
+ if (!transformNode)
+ transformNode = new QSGTransformNode;
+
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(QQuickRectangle::updatePaintNode(transformNode->firstChild(), data));
+
+ if (rectNode) {
+ if (!transformNode->firstChild())
+ transformNode->appendChildNode(rectNode);
+
qreal top = topPadding();
qreal left = leftPadding();
qreal right = rightPadding();
qreal bottom = bottomPadding();
+
if (!qFuzzyIsNull(top) || !qFuzzyIsNull(left) || !qFuzzyIsNull(right) || !qFuzzyIsNull(bottom)) {
- rectangle->setRect(boundingRect().adjusted(left, top, -right, -bottom));
- rectangle->update();
+ QMatrix4x4 m;
+ m.translate(left, top);
+ transformNode->setMatrix(m);
+
+ rectNode->setRect(boundingRect().adjusted(0, 0, -left-right, -top-bottom));
+ rectNode->update();
}
}
- return rectangle;
+ return transformNode;
}
QT_END_NAMESPACE
diff --git a/src/controls/qquickpaddedrectangle_p.h b/src/controls/qquickpaddedrectangle_p.h
index 3ebb75b8..5c0a8919 100644
--- a/src/controls/qquickpaddedrectangle_p.h
+++ b/src/controls/qquickpaddedrectangle_p.h
@@ -111,8 +111,8 @@ private:
bool m_hasBottomPadding;
};
-Q_DECLARE_TYPEINFO(QQuickPaddedRectangle, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickPaddedRectangle)
+
#endif // QQUICKPADDEDRECTANGLE_P_H
diff --git a/src/controls/qquickstyle.cpp b/src/controls/qquickstyle.cpp
index b83f8c2a..5e1085c6 100644
--- a/src/controls/qquickstyle.cpp
+++ b/src/controls/qquickstyle.cpp
@@ -36,10 +36,15 @@
#include "qquickstyle_p.h"
+#include <QtCore/qfile.h>
+#include <QtCore/qsettings.h>
+#include <QtCore/qfileselector.h>
#include <QtQuick/private/qquickitem_p.h>
QT_BEGIN_NAMESPACE
+static const char *SettingsFilePath = ":/qtlabscontrols.conf";
+
static QQuickStyle *attachedStyle(const QMetaObject *type, QObject *object, bool create = false)
{
if (!object)
@@ -148,6 +153,21 @@ QQuickStyle::~QQuickStyle()
setParentStyle(Q_NULLPTR);
}
+QSharedPointer<QSettings> QQuickStyle::settings(const QString &group)
+{
+#ifndef QT_NO_SETTINGS
+ const QString filePath = QLatin1String(SettingsFilePath);
+ if (QFile::exists(filePath)) {
+ QFileSelector selector;
+ QSettings *settings = new QSettings(selector.select(filePath), QSettings::IniFormat);
+ if (!group.isEmpty())
+ settings->beginGroup(group);
+ return QSharedPointer<QSettings>(settings);
+ }
+#endif // QT_NO_SETTINGS
+ return QSharedPointer<QSettings>();
+}
+
QList<QQuickStyle *> QQuickStyle::childStyles() const
{
return m_childStyles;
diff --git a/src/controls/qquickstyle_p.h b/src/controls/qquickstyle_p.h
index 3d4431cd..02ee667a 100644
--- a/src/controls/qquickstyle_p.h
+++ b/src/controls/qquickstyle_p.h
@@ -52,10 +52,13 @@
#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
#include <QtCore/qpointer.h>
+#include <QtCore/qsharedpointer.h>
#include <QtQuick/private/qquickitemchangelistener_p.h>
QT_BEGIN_NAMESPACE
+class QSettings;
+
class QQuickStyle : public QObject, public QQuickItemChangeListener
{
Q_OBJECT
@@ -64,6 +67,8 @@ public:
explicit QQuickStyle(QObject *parent = Q_NULLPTR);
~QQuickStyle();
+ static QSharedPointer<QSettings> settings(const QString &group = QString());
+
protected:
void init();
diff --git a/src/controls/qquickstyleselector.cpp b/src/controls/qquickstyleselector.cpp
index a84645d2..6779836c 100644
--- a/src/controls/qquickstyleselector.cpp
+++ b/src/controls/qquickstyleselector.cpp
@@ -43,8 +43,10 @@
#include <QtCore/QFileInfo>
#include <QtCore/QLocale>
#include <QtCore/QDebug>
+#include <QtCore/QSettings>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtLabsControls/private/qquickstyle_p.h>
QT_BEGIN_NAMESPACE
@@ -58,9 +60,14 @@ QQuickStyleSelectorPrivate::QQuickStyleSelectorPrivate()
QQuickStyleSelector::QQuickStyleSelector() : d_ptr(new QQuickStyleSelectorPrivate)
{
Q_D(QQuickStyleSelector);
- d->style = QGuiApplicationPrivate::styleOverride;
+ d->style = QGuiApplicationPrivate::styleOverride.toLower();
if (d->style.isEmpty())
- d->style = QString::fromLatin1(qgetenv("QT_LABS_CONTROLS_STYLE"));
+ d->style = QString::fromLatin1(qgetenv("QT_LABS_CONTROLS_STYLE")).toLower();
+ if (d->style.isEmpty()) {
+ QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Controls"));
+ if (settings)
+ d->style = settings->value(QStringLiteral("Style")).toString().toLower();
+ }
}
QQuickStyleSelector::~QQuickStyleSelector()
@@ -156,7 +163,10 @@ QStringList QQuickStyleSelector::allSelectors() const
Q_D(const QQuickStyleSelector);
QMutexLocker locker(&sharedDataMutex);
QQuickStyleSelectorPrivate::updateSelectors();
- return QStringList(d->style) + sharedData->staticSelectors;
+ QStringList selectors = sharedData->staticSelectors;
+ if (!d->style.isEmpty())
+ selectors.prepend(d->style);
+ return selectors;
}
void QQuickStyleSelector::setBaseUrl(const QUrl &base)
@@ -172,12 +182,6 @@ QUrl QQuickStyleSelector::baseUrl() const
return d->baseUrl;
}
-QQuickStyleSelector *QQuickStyleSelector::instance()
-{
- static QQuickStyleSelector self;
- return &self;
-}
-
void QQuickStyleSelectorPrivate::updateSelectors()
{
if (!sharedData->staticSelectors.isEmpty())
diff --git a/src/controls/qquickstyleselector_p.h b/src/controls/qquickstyleselector_p.h
index 36ccf07c..64319098 100644
--- a/src/controls/qquickstyleselector_p.h
+++ b/src/controls/qquickstyleselector_p.h
@@ -69,8 +69,6 @@ public:
void setBaseUrl(const QUrl &base);
QUrl baseUrl() const;
- static QQuickStyleSelector *instance();
-
private:
QUrl select(const QUrl &filePath) const;
diff --git a/src/imports/calendar/plugins.qmltypes b/src/imports/calendar/plugins.qmltypes
index ba17e577..74c407c4 100644
--- a/src/imports/calendar/plugins.qmltypes
+++ b/src/imports/calendar/plugins.qmltypes
@@ -76,9 +76,9 @@ Module {
Property { name: "rightPadding"; type: "double" }
Property { name: "bottomPadding"; type: "double" }
Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "locale"; type: "QLocale" }
Property { name: "mirrored"; type: "bool"; isReadonly: true }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
}
@@ -88,7 +88,6 @@ Module {
prototype: "QQuickControl"
exports: ["Qt.labs.calendar/AbstractDayOfWeekRow 1.0"]
exportMetaObjectRevisions: [0]
- Property { name: "locale"; type: "QLocale" }
Property { name: "source"; type: "QVariant" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
}
@@ -100,7 +99,6 @@ Module {
exportMetaObjectRevisions: [0]
Property { name: "month"; type: "int" }
Property { name: "year"; type: "int" }
- Property { name: "locale"; type: "QLocale" }
Property { name: "source"; type: "QVariant" }
Property { name: "title"; type: "string" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
@@ -129,7 +127,6 @@ Module {
exportMetaObjectRevisions: [0]
Property { name: "month"; type: "int" }
Property { name: "year"; type: "int" }
- Property { name: "locale"; type: "QLocale" }
Property { name: "source"; type: "QVariant" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
}
diff --git a/src/imports/calendar/qquickcalendar_p.h b/src/imports/calendar/qquickcalendar_p.h
index 569be1d6..c44a6a1c 100644
--- a/src/imports/calendar/qquickcalendar_p.h
+++ b/src/imports/calendar/qquickcalendar_p.h
@@ -50,6 +50,7 @@
#include <QtCore/qobject.h>
#include <QtCore/qdatetime.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -77,8 +78,8 @@ public:
Q_ENUM(Month)
};
-Q_DECLARE_TYPEINFO(QQuickCalendar, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickCalendar)
+
#endif // QQUICKCALENDAR_P_H
diff --git a/src/imports/calendar/qquickcalendarmodel_p.h b/src/imports/calendar/qquickcalendarmodel_p.h
index f46dcc4c..4f17980a 100644
--- a/src/imports/calendar/qquickcalendarmodel_p.h
+++ b/src/imports/calendar/qquickcalendarmodel_p.h
@@ -51,6 +51,7 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qdatetime.h>
#include <QtQml/qqmlparserstatus.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -101,8 +102,8 @@ private:
Q_DECLARE_PRIVATE(QQuickCalendarModel)
};
-Q_DECLARE_TYPEINFO(QQuickCalendarModel, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickCalendarModel)
+
#endif // QQUICKCALENDARMODEL_P_H
diff --git a/src/imports/calendar/qquickdayofweekmodel_p.h b/src/imports/calendar/qquickdayofweekmodel_p.h
index 87e04695..90ebdc6c 100644
--- a/src/imports/calendar/qquickdayofweekmodel_p.h
+++ b/src/imports/calendar/qquickdayofweekmodel_p.h
@@ -50,6 +50,7 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qlocale.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -88,8 +89,8 @@ private:
Q_DECLARE_PRIVATE(QQuickDayOfWeekModel)
};
-Q_DECLARE_TYPEINFO(QQuickDayOfWeekModel, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickDayOfWeekModel)
+
#endif // QQUICKDAYOFWEEKMODEL_P_H
diff --git a/src/imports/calendar/qquickdayofweekrow.cpp b/src/imports/calendar/qquickdayofweekrow.cpp
index 3c146c1f..8788ac95 100644
--- a/src/imports/calendar/qquickdayofweekrow.cpp
+++ b/src/imports/calendar/qquickdayofweekrow.cpp
@@ -48,8 +48,8 @@ QT_BEGIN_NAMESPACE
\inqmlmodule Qt.labs.calendar
\brief A row of names for the days in a week.
- DayOfWeekRow presents day of week names in a row. The names of
- the days are ordered and formatted using the specified \l locale.
+ DayOfWeekRow presents day of week names in a row. The names of the days
+ are ordered and formatted using the specified \l {Control::locale}{locale}.
\image qtlabscalendar-dayofweekrow.png
\snippet qtlabscalendar-dayofweekrow.qml 1
@@ -98,24 +98,6 @@ QQuickDayOfWeekRow::QQuickDayOfWeekRow(QQuickItem *parent) :
Q_D(QQuickDayOfWeekRow);
d->model = new QQuickDayOfWeekModel(this);
d->source = QVariant::fromValue(d->model);
- connect(d->model, &QQuickDayOfWeekModel::localeChanged, this, &QQuickDayOfWeekRow::localeChanged);
-}
-
-/*!
- \qmlproperty Locale Qt.labs.calendar::DayOfWeekRow::locale
-
- This property holds the locale that is used to format names of the days in a week.
-*/
-QLocale QQuickDayOfWeekRow::locale() const
-{
- Q_D(const QQuickDayOfWeekRow);
- return d->model->locale();
-}
-
-void QQuickDayOfWeekRow::setLocale(const QLocale &locale)
-{
- Q_D(QQuickDayOfWeekRow);
- d->model->setLocale(locale);
}
/*!
@@ -190,6 +172,13 @@ void QQuickDayOfWeekRow::geometryChanged(const QRectF &newGeometry, const QRectF
d->resizeItems();
}
+void QQuickDayOfWeekRow::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_D(QQuickDayOfWeekRow);
+ QQuickControl::localeChange(newLocale, oldLocale);
+ d->model->setLocale(newLocale);
+}
+
void QQuickDayOfWeekRow::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
{
Q_D(QQuickDayOfWeekRow);
diff --git a/src/imports/calendar/qquickdayofweekrow_p.h b/src/imports/calendar/qquickdayofweekrow_p.h
index 5161ed89..d1e5e16f 100644
--- a/src/imports/calendar/qquickdayofweekrow_p.h
+++ b/src/imports/calendar/qquickdayofweekrow_p.h
@@ -49,7 +49,6 @@
//
#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE
@@ -59,16 +58,12 @@ class QQuickDayOfWeekRowPrivate;
class QQuickDayOfWeekRow : public QQuickControl
{
Q_OBJECT
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
public:
explicit QQuickDayOfWeekRow(QQuickItem *parent = Q_NULLPTR);
- QLocale locale() const;
- void setLocale(const QLocale &locale);
-
QVariant source() const;
void setSource(const QVariant &source);
@@ -76,13 +71,13 @@ public:
void setDelegate(QQmlComponent *delegate);
Q_SIGNALS:
- void localeChanged();
void sourceChanged();
void delegateChanged();
protected:
void componentComplete() Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) Q_DECL_OVERRIDE;
void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
private:
@@ -90,8 +85,8 @@ private:
Q_DECLARE_PRIVATE(QQuickDayOfWeekRow)
};
-Q_DECLARE_TYPEINFO(QQuickDayOfWeekRow, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickDayOfWeekRow)
+
#endif // QQUICKDAYOFWEEKROW_P_H
diff --git a/src/imports/calendar/qquickmonthgrid.cpp b/src/imports/calendar/qquickmonthgrid.cpp
index 432e15e5..ac49b62c 100644
--- a/src/imports/calendar/qquickmonthgrid.cpp
+++ b/src/imports/calendar/qquickmonthgrid.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
MonthGrid presents a calendar month in a grid. The contents are
calculated for a given \l month and \l year, using the specified
- \l locale.
+ \l {Control::locale}{locale}.
\image qtlabscalendar-monthgrid.png
\snippet qtlabscalendar-monthgrid.qml 1
@@ -173,7 +173,6 @@ QQuickMonthGrid::QQuickMonthGrid(QQuickItem *parent) :
d->source = QVariant::fromValue(d->model);
connect(d->model, &QQuickMonthModel::monthChanged, this, &QQuickMonthGrid::monthChanged);
connect(d->model, &QQuickMonthModel::yearChanged, this, &QQuickMonthGrid::yearChanged);
- connect(d->model, &QQuickMonthModel::localeChanged, this, &QQuickMonthGrid::localeChanged);
connect(d->model, &QQuickMonthModel::titleChanged, this, &QQuickMonthGrid::titleChanged);
}
@@ -245,23 +244,6 @@ void QQuickMonthGrid::setYear(int year)
}
/*!
- \qmlproperty Locale Qt.labs.calendar::MonthGrid::locale
-
- This property holds the locale that is used to calculate the contents.
-*/
-QLocale QQuickMonthGrid::locale() const
-{
- Q_D(const QQuickMonthGrid);
- return d->model->locale();
-}
-
-void QQuickMonthGrid::setLocale(const QLocale &locale)
-{
- Q_D(QQuickMonthGrid);
- d->model->setLocale(locale);
-}
-
-/*!
\internal
\qmlproperty model Qt.labs.calendar::MonthGrid::source
@@ -290,7 +272,7 @@ void QQuickMonthGrid::setSource(const QVariant &source)
This property is provided for convenience. MonthGrid itself does
not visualize the title. The default value consists of the month name,
- formatted using \l locale, and the year number.
+ formatted using \l {Control::locale}{locale}, and the year number.
*/
QString QQuickMonthGrid::title() const
{
@@ -367,6 +349,13 @@ void QQuickMonthGrid::geometryChanged(const QRectF &newGeometry, const QRectF &o
d->resizeItems();
}
+void QQuickMonthGrid::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_D(QQuickMonthGrid);
+ QQuickControl::localeChange(newLocale, oldLocale);
+ d->model->setLocale(newLocale);
+}
+
void QQuickMonthGrid::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
{
Q_D(QQuickMonthGrid);
diff --git a/src/imports/calendar/qquickmonthgrid_p.h b/src/imports/calendar/qquickmonthgrid_p.h
index c7caa7f5..b2d8124a 100644
--- a/src/imports/calendar/qquickmonthgrid_p.h
+++ b/src/imports/calendar/qquickmonthgrid_p.h
@@ -49,7 +49,6 @@
//
#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE
@@ -61,7 +60,6 @@ class QQuickMonthGrid : public QQuickControl
Q_OBJECT
Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
@@ -75,9 +73,6 @@ public:
int year() const;
void setYear(int year);
- QLocale locale() const;
- void setLocale(const QLocale &locale);
-
QVariant source() const;
void setSource(const QVariant &source);
@@ -90,7 +85,6 @@ public:
Q_SIGNALS:
void monthChanged();
void yearChanged();
- void localeChanged();
void sourceChanged();
void titleChanged();
void delegateChanged();
@@ -103,6 +97,7 @@ Q_SIGNALS:
protected:
void componentComplete() Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) Q_DECL_OVERRIDE;
void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
void updatePolish() Q_DECL_OVERRIDE;
@@ -117,8 +112,8 @@ private:
Q_DECLARE_PRIVATE(QQuickMonthGrid)
};
-Q_DECLARE_TYPEINFO(QQuickMonthGrid, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickMonthGrid)
+
#endif // QQUICKMONTHGRID_P_H
diff --git a/src/imports/calendar/qquickmonthmodel_p.h b/src/imports/calendar/qquickmonthmodel_p.h
index 6d79de9a..0f8347b5 100644
--- a/src/imports/calendar/qquickmonthmodel_p.h
+++ b/src/imports/calendar/qquickmonthmodel_p.h
@@ -51,6 +51,7 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qlocale.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -107,8 +108,8 @@ private:
Q_DECLARE_PRIVATE(QQuickMonthModel)
};
-Q_DECLARE_TYPEINFO(QQuickMonthModel, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickMonthModel)
+
#endif // QQUICKMONTHMODEL_P_H
diff --git a/src/imports/calendar/qquickweeknumbercolumn.cpp b/src/imports/calendar/qquickweeknumbercolumn.cpp
index d39b1e0a..04890411 100644
--- a/src/imports/calendar/qquickweeknumbercolumn.cpp
+++ b/src/imports/calendar/qquickweeknumbercolumn.cpp
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
WeekNumberColumn presents week numbers in a column. The week numbers
are calculated for a given \l month and \l year, using the specified
- \l locale.
+ \l {Control::locale}{locale}.
\image qtlabscalendar-weeknumbercolumn.png
\snippet qtlabscalendar-weeknumbercolumn.qml 1
@@ -102,7 +102,6 @@ QQuickWeekNumberColumn::QQuickWeekNumberColumn(QQuickItem *parent) :
d->source = QVariant::fromValue(d->model);
connect(d->model, &QQuickWeekNumberModel::monthChanged, this, &QQuickWeekNumberColumn::monthChanged);
connect(d->model, &QQuickWeekNumberModel::yearChanged, this, &QQuickWeekNumberColumn::yearChanged);
- connect(d->model, &QQuickWeekNumberModel::localeChanged, this, &QQuickWeekNumberColumn::localeChanged);
}
/*!
@@ -173,23 +172,6 @@ void QQuickWeekNumberColumn::setYear(int year)
}
/*!
- \qmlproperty Locale Qt.labs.calendar::WeekNumberColumn::locale
-
- This property holds the locale that is used to calculate the week numbers.
-*/
-QLocale QQuickWeekNumberColumn::locale() const
-{
- Q_D(const QQuickWeekNumberColumn);
- return d->model->locale();
-}
-
-void QQuickWeekNumberColumn::setLocale(const QLocale &locale)
-{
- Q_D(QQuickWeekNumberColumn);
- d->model->setLocale(locale);
-}
-
-/*!
\internal
\qmlproperty model Qt.labs.calendar::WeekNumberColumn::source
@@ -258,6 +240,13 @@ void QQuickWeekNumberColumn::geometryChanged(const QRectF &newGeometry, const QR
d->resizeItems();
}
+void QQuickWeekNumberColumn::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_D(QQuickWeekNumberColumn);
+ QQuickControl::localeChange(newLocale, oldLocale);
+ d->model->setLocale(newLocale);
+}
+
void QQuickWeekNumberColumn::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
{
Q_D(QQuickWeekNumberColumn);
diff --git a/src/imports/calendar/qquickweeknumbercolumn_p.h b/src/imports/calendar/qquickweeknumbercolumn_p.h
index f23d2948..2cacdeac 100644
--- a/src/imports/calendar/qquickweeknumbercolumn_p.h
+++ b/src/imports/calendar/qquickweeknumbercolumn_p.h
@@ -49,7 +49,6 @@
//
#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE
@@ -61,7 +60,6 @@ class QQuickWeekNumberColumn : public QQuickControl
Q_OBJECT
Q_PROPERTY(int month READ month WRITE setMonth NOTIFY monthChanged FINAL)
Q_PROPERTY(int year READ year WRITE setYear NOTIFY yearChanged FINAL)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
@@ -74,9 +72,6 @@ public:
int year() const;
void setYear(int year);
- QLocale locale() const;
- void setLocale(const QLocale &locale);
-
QVariant source() const;
void setSource(const QVariant &source);
@@ -86,13 +81,13 @@ public:
Q_SIGNALS:
void monthChanged();
void yearChanged();
- void localeChanged();
void sourceChanged();
void delegateChanged();
protected:
void componentComplete() Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
+ void localeChange(const QLocale &newLocale, const QLocale &oldLocale) Q_DECL_OVERRIDE;
void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) Q_DECL_OVERRIDE;
private:
@@ -100,8 +95,8 @@ private:
Q_DECLARE_PRIVATE(QQuickWeekNumberColumn)
};
-Q_DECLARE_TYPEINFO(QQuickWeekNumberColumn, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickWeekNumberColumn)
+
#endif // QQUICKWEEKNUMBERCOLUMN_P_H
diff --git a/src/imports/calendar/qquickweeknumbermodel_p.h b/src/imports/calendar/qquickweeknumbermodel_p.h
index 6b73bb36..2c8b484f 100644
--- a/src/imports/calendar/qquickweeknumbermodel_p.h
+++ b/src/imports/calendar/qquickweeknumbermodel_p.h
@@ -50,6 +50,7 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qlocale.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -96,8 +97,8 @@ private:
Q_DECLARE_PRIVATE(QQuickWeekNumberModel)
};
-Q_DECLARE_TYPEINFO(QQuickWeekNumberModel, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickWeekNumberModel)
+
#endif // QQUICKWEEKNUMBERMODEL_P_H
diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml
index 247752cb..5c43c956 100644
--- a/src/imports/controls/ApplicationWindow.qml
+++ b/src/imports/controls/ApplicationWindow.qml
@@ -42,4 +42,8 @@ T.ApplicationWindow {
id: window
color: "#ffffff"
+
+ overlay.background: Rectangle {
+ color: "#7f28282a"
+ }
}
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index 3e7191c2..1c55e75d 100644
--- a/src/imports/controls/BusyIndicator.qml
+++ b/src/imports/controls/BusyIndicator.qml
@@ -36,6 +36,7 @@
import QtQuick 2.6
import Qt.labs.controls 1.0
+import Qt.labs.controls.impl 1.0
import Qt.labs.templates 1.0 as T
T.BusyIndicator {
@@ -47,30 +48,17 @@ T.BusyIndicator {
padding: 6
//! [contentItem]
- contentItem: Item {
- id: delegate
+ contentItem: BusyRing {
+ id: ring
implicitWidth: 48
implicitHeight: 48
-
opacity: control.running ? 1 : 0
- Behavior on opacity { OpacityAnimator { duration: 250 } }
- Image {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: Math.min(parent.width, parent.height)
- height: width
- source: width <= 32 ? "qrc:/images/spinner_small.png" :
- width >= 48 ? "qrc:/images/spinner_large.png" :
- "qrc:/images/spinner_medium.png"
+ Behavior on opacity { OpacityAnimator { duration: 250 } }
- RotationAnimator on rotation {
- duration: 800
- loops: Animation.Infinite
- from: 0
- to: 360
- running: control.visible && (control.running || delegate.opacity > 0)
- }
+ BusyRingAnimator {
+ target: ring
+ running: control.visible && control.running
}
}
//! [contentItem]
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
index cc7a65b8..1196f56b 100644
--- a/src/imports/controls/Button.qml
+++ b/src/imports/controls/Button.qml
@@ -58,6 +58,7 @@ T.Button {
height: control.availableHeight
text: control.text
font: control.font
+ opacity: enabled || highlighted ? 1 : 0.3
color: control.highlighted ? "#ffffff" : (control.pressed ? "#26282a" : "#353637")
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
@@ -69,7 +70,8 @@ T.Button {
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
- color: control.pressed ? (control.highlighted ? "#585a5c" : "#bdbebf") : (control.highlighted ? "#353637" : "#ffffff")
+ opacity: enabled ? 1 : 0.3
+ color: control.pressed ? (control.highlighted ? "#585a5c" : "#e4e4e4") : (control.highlighted ? "#353637" : "#ffffff")
border.color: control.pressed ? "#26282a" : "#353637"
}
//! [background]
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index 5bfddbf3..b7d67fe6 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -60,13 +60,13 @@ T.CheckBox {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- color: control.enabled ? (control.pressed ? "#bdbebf" : "#ffffff") : "#353637"
+ color: control.enabled ? (control.pressed ? "#e4e4e4" : "#ffffff") : "#353637"
border.color: control.enabled ? (control.pressed ? "#26282a" : "#353637") : "transparent"
Image {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
- source: "qrc:/images/check.png"
+ source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/check.png"
visible: control.checked
}
}
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
new file mode 100644
index 00000000..e06372e7
--- /dev/null
+++ b/src/imports/controls/ComboBox.qml
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.2
+import Qt.labs.templates 1.0 as T
+
+T.ComboBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ spacing: 8
+ padding: 6
+ leftPadding: 8
+ rightPadding: 8
+
+ //! [delegate]
+ delegate: ItemDelegate {
+ width: control.width
+ text: control.textRole ? model[control.textRole] : modelData
+ checkable: true
+ autoExclusive: true
+ checked: control.currentIndex === index
+ highlighted: control.highlightedIndex === index
+ pressed: highlighted && control.pressed
+ }
+ //! [delegate]
+
+ //! [contentItem]
+ contentItem: Text {
+ text: control.displayText
+ font: control.font
+ color: "#ffffff"
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ rightPadding: 18 + control.spacing
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Item {
+ implicitWidth: 120
+ implicitHeight: 40
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ opacity: control.enabled ? 1.0 : 0.2
+ color: control.pressed || popup.visible ? "#585A5C" : "#353637"
+ }
+
+ Image {
+ x: parent.width - width - control.rightPadding
+ y: (parent.height - height) / 2
+ source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/drop-indicator.png"
+ }
+ }
+ //! [background]
+
+ //! [popup]
+ popup: T.Popup {
+ contentItem: Rectangle {
+ // TODO: Popup::anchors
+ readonly property var above: popup.visible ? control.mapToItem(null, 0, -height + 1) : Qt.point(0, 0)
+ readonly property var below: popup.visible ? control.mapToItem(null, 0, control.height - 1) : Qt.point(0, 0)
+
+ x: below.x
+ y: above.y >= 0 && below.y + height > control.Window.height ? above.y : below.y
+ width: control.width
+ height: listview.height
+
+ ListView {
+ id: listview
+ width: control.width
+ height: Math.min(200, contentHeight)
+
+ clip: true
+ model: control.delegateModel
+ currentIndex: control.highlightedIndex
+
+// ScrollIndicator.vertical: ScrollIndicator { }
+ }
+
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ color: "transparent"
+ border.color: "#353637"
+ }
+ }
+ }
+ //! [popup]
+}
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index 951d33ec..b6752d55 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -45,31 +45,27 @@ T.Dial {
//! [background]
background: Rectangle {
+ x: control.width / 2 - width / 2
+ y: control.height / 2 - height / 2
+ width: Math.max(64, Math.min(control.width, control.height))
+ height: Math.max(64, Math.min(control.width, control.height))
radius: width / 2
border.color: "#353637"
-
- Text {
- text: control.position.toFixed(1)
- color: "#353637"
- font.pixelSize: 60
- x: parent.width / 2 - width / 2
- y: parent.height / 2 - height / 2
- }
}
//! [background]
//! [handle]
handle: Image {
id: handleItem
- x: background.width / 2 - handle.width / 2
- y: background.height / 2 - handle.height / 2
+ x: background.x + background.width / 2 - handle.width / 2
+ y: background.y + background.height / 2 - handle.height / 2
width: 14
height: 10
- source: "qrc:/images/dial-indicator.png"
+ source: "qrc:/qt-project.org/imports/Qt/labs/controls/images/dial-indicator.png"
antialiasing: true
transform: [
Translate {
- y: -background.height * 0.4
+ y: -background.height * 0.4 + handle.height / 2
},
Rotation {
angle: control.angle
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml
index 2b50b7d4..eb4e3e57 100644
--- a/src/imports/controls/Drawer.qml
+++ b/src/imports/controls/Drawer.qml
@@ -40,16 +40,10 @@ import Qt.labs.templates 1.0 as T
T.Drawer {
id: control
+ parent: T.ApplicationWindow.overlay
width: parent ? parent.width : 0 // TODO: Window.width
height: parent ? parent.height : 0 // TODO: Window.height
- //! [background]
- background: Rectangle {
- color: "#28282a"
- opacity: position * 0.75
- }
- //! [background]
-
// TODO: make this a proper transition
animation: SmoothedAnimation {
velocity: 5
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index 8504fae9..08866606 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -40,7 +40,9 @@ import Qt.labs.templates 1.0 as T
T.GroupBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + leftPadding + rightPadding : 0,
+ contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
@@ -48,7 +50,7 @@ T.GroupBox {
spacing: 6
padding: 6
- topPadding: 6 + (label && title ? label.implicitHeight + spacing : 0)
+ topPadding: 6 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
//! [contentItem]
contentItem: Item { }
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index 5735d0b3..b5dfb4b6 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -47,6 +47,7 @@ T.ItemDelegate {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
Math.max(label ? label.implicitHeight : 0,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: label ? label.y + label.baselineOffset : 0
padding: 12
spacing: 12
@@ -74,7 +75,7 @@ T.ItemDelegate {
y: control.topPadding + (control.availableHeight - height) / 2
visible: control.checked
- source: control.checkable ? "qrc:/images/check.png" : ""
+ source: control.checkable ? "qrc:/qt-project.org/imports/Qt/labs/controls/images/check.png" : ""
}
//! [indicator]
@@ -82,7 +83,8 @@ T.ItemDelegate {
background: Rectangle {
implicitWidth: 100
implicitHeight: 40
- color: control.pressed ? "#bdbebf" : "transparent"
+ visible: control.pressed || control.highlighted
+ color: control.pressed ? "#bdbebf" : "#eeeeee"
}
//! [background]
}
diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml
index df51fc72..ae5a8e38 100644
--- a/src/imports/controls/MenuItem.qml
+++ b/src/imports/controls/MenuItem.qml
@@ -45,13 +45,13 @@ T.MenuItem {
+ (label && indicator ? spacing : 0) + leftPadding + rightPadding
implicitHeight: background ? background.implicitHeight
: (label ? label.implicitHeight : 0) + (indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
+ baselineOffset: label ? label.y + label.baselineOffset : 0
- padding: 12
- spacing: 12
+ padding: 6
//! [label]
label: Text {
- x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
y: control.topPadding
width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
height: control.availableHeight
@@ -68,11 +68,11 @@ T.MenuItem {
//! [indicator]
indicator: Image {
- x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ x: control.mirrored ? control.width - width - control.rightPadding : control.leftPadding
y: control.topPadding + (control.availableHeight - height) / 2
visible: control.checked
- source: control.checkable ? "qrc:/images/check.png" : ""
+ source: control.checkable ? "qrc:/qt-project.org/imports/Qt/labs/controls/images/check.png" : ""
}
//! [indicator]
diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml
new file mode 100644
index 00000000..7bd72493
--- /dev/null
+++ b/src/imports/controls/Pane.qml
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+
+T.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 6
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ color: "#ffffff"
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml
new file mode 100644
index 00000000..b7c6fe08
--- /dev/null
+++ b/src/imports/controls/Popup.qml
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+
+T.Popup {
+ id: control
+}
diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml
index 61e35921..732ae11d 100644
--- a/src/imports/controls/ProgressBar.qml
+++ b/src/imports/controls/ProgressBar.qml
@@ -45,8 +45,6 @@ T.ProgressBar {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
- padding: 6
-
//! [indicator]
indicator: Item {
x: control.leftPadding
@@ -62,12 +60,11 @@ T.ProgressBar {
Rectangle {
property real offset: indeterminate ? 0 : control.position
- x: 2 + (indeterminate ? offset * parent.width - 4 : 0)
+ x: indeterminate ? offset * parent.width : 0
y: (parent.height - height) / 2
- width: offset * (parent.width - x) - 2
- height: 2
+ width: offset * (parent.width - x)
+ height: 6
- radius: 3
color: control.enabled ? "#353637" : "#bdbebf"
SequentialAnimation on offset {
@@ -96,9 +93,7 @@ T.ProgressBar {
width: control.availableWidth
height: 6
- radius: 3
- border.color: "#bdbebf"
- color: "transparent"
+ color: "#e4e4e4"
}
//! [background]
}
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index e41d2d11..82d74b88 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -64,7 +64,7 @@ T.RadioButton {
radius: width / 2
border.width: 1
border.color: (control.pressed ? "#26282a" : "#353637")
- color: control.pressed ? "#bdbebf" : "#ffffff"
+ color: control.pressed ? "#e4e4e4" : "#ffffff"
Rectangle {
x: (parent.width - width) / 2
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
index ff27d8ba..4b42a839 100644
--- a/src/imports/controls/SpinBox.qml
+++ b/src/imports/controls/SpinBox.qml
@@ -48,6 +48,7 @@ T.SpinBox {
background ? background.implicitHeight : 0,
up.indicator ? up.indicator.implicitHeight : 0,
down.indicator ? down.indicator.implicitHeight : 0)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
leftPadding: 6 + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
@@ -67,7 +68,7 @@ T.SpinBox {
text: control.textFromValue(control.value, control.locale)
font: control.font
- color: control.enabled ? "#353637" : "#bdbebf"
+ color: "#353637"
// selectionColor: TODO
// selectedTextColor: TODO
horizontalAlignment: Qt.AlignHCenter
@@ -83,7 +84,7 @@ T.SpinBox {
x: control.mirrored ? 0 : parent.width - width
implicitWidth: 40
implicitHeight: 40
- color: up.pressed ? "#bdbebf" : "#ffffff"
+ color: up.pressed ? "#e4e4e4" : "#ffffff"
border.color: control.enabled ? "#353637" : "#bdbebf"
Rectangle {
@@ -108,7 +109,7 @@ T.SpinBox {
x: control.mirrored ? parent.width - width : 0
implicitWidth: 40
implicitHeight: 40
- color: down.pressed ? "#bdbebf" : "#ffffff"
+ color: down.pressed ? "#e4e4e4" : "#ffffff"
border.color: control.enabled ? "#353637" : "#bdbebf"
Rectangle {
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 3e224383..e1627d32 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -75,7 +75,7 @@ T.Switch {
width: 28
height: 28
radius: 16
- color: control.pressed ? "#bdbebf" : "#ffffff"
+ color: control.pressed ? "#e4e4e4" : "#ffffff"
border.width: 1
border.color: control.pressed ? "#26282a" : "#353637"
diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml
index 17fd03c5..d2b948da 100644
--- a/src/imports/controls/ToolButton.qml
+++ b/src/imports/controls/ToolButton.qml
@@ -69,9 +69,9 @@ T.ToolButton {
implicitWidth: 26
implicitHeight: 26
- color: Qt.darker("#33333333", control.checkable && control.checked ? 1.5 : 1.0)
- opacity: control.pressed ? 1.0 : control.checkable && control.checked ? 0.5 : 0
- visible: control.pressed || (control.checkable && control.checked)
+ color: Qt.darker("#33333333", control.enabled && (control.checked || control.highlighted) ? 1.5 : 1.0)
+ opacity: control.pressed ? 1.0 : control.enabled && (control.checked || control.highlighted) ? 0.5 : 0
+ visible: control.pressed || (control.enabled && (control.checked || control.highlighted))
}
//! [background]
}
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index 78c9a1d0..6b3c4fc9 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -3,6 +3,7 @@ QML_FILES = \
BusyIndicator.qml \
Button.qml \
CheckBox.qml \
+ ComboBox.qml \
Dial.qml \
Drawer.qml \
Frame.qml \
@@ -11,7 +12,9 @@ QML_FILES = \
Label.qml \
Menu.qml \
MenuItem.qml \
+ Pane.qml \
PageIndicator.qml \
+ Popup.qml \
ProgressBar.qml \
RadioButton.qml \
RangeSlider.qml \
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index c3c5702c..dc24d8b1 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -12,8 +12,12 @@ QMAKE_DOCS = $$PWD/doc/qtlabscontrols.qdocconf
OTHER_FILES += \
qmldir
+HEADERS += \
+ $$PWD/qquickbusyindicatorring_p.h
+
SOURCES += \
- $$PWD/qtlabscontrolsplugin.cpp
+ $$PWD/qtlabscontrolsplugin.cpp \
+ $$PWD/qquickbusyindicatorring.cpp
RESOURCES += \
$$PWD/qtlabscontrolsplugin.qrc
diff --git a/src/imports/controls/designer/ControlSection.qml b/src/imports/controls/designer/ControlSection.qml
index e026d620..0d7a07d2 100644
--- a/src/imports/controls/designer/ControlSection.qml
+++ b/src/imports/controls/designer/ControlSection.qml
@@ -67,19 +67,5 @@ Section {
Layout.fillWidth: true
}
}
-
- Label {
- text: qsTr("Direction")
- tooltip: qsTr("Layout direction of the control.")
- }
- SecondColumnLayout {
- ComboBox {
- backendValue: backendValues.layoutDirection
- implicitWidth: 180
- model: [ "LeftToRight", "RightToLeft" ]
- scope: "Qt"
- Layout.fillWidth: true
- }
- }
}
}
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-background.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-background.png
new file mode 100644
index 00000000..fa296270
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-combobox-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.png
new file mode 100644
index 00000000..9b8e8175
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-combobox-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.png
new file mode 100644
index 00000000..88462185
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-combobox-delegate.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox-popup.png b/src/imports/controls/doc/images/qtlabscontrols-combobox-popup.png
new file mode 100644
index 00000000..0e9eacbf
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-combobox-popup.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-combobox.png b/src/imports/controls/doc/images/qtlabscontrols-combobox.png
new file mode 100644
index 00000000..69fc9c95
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-combobox.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-default.png b/src/imports/controls/doc/images/qtlabscontrols-default.png
new file mode 100644
index 00000000..144ceacb
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-default.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.png b/src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.png
new file mode 100644
index 00000000..57ec1026
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-gallery-drawer.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-gallery-menu.png b/src/imports/controls/doc/images/qtlabscontrols-gallery-menu.png
new file mode 100644
index 00000000..5b34264e
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-gallery-menu.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.png b/src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.png
new file mode 100644
index 00000000..5c2bb682
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-gallery-welcome.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.png b/src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.png
new file mode 100644
index 00000000..8b619b5b
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-groupbox-checkable.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-material-button.png b/src/imports/controls/doc/images/qtlabscontrols-material-button.png
new file mode 100644
index 00000000..5181d8b1
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-material-button.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-material-dark.png b/src/imports/controls/doc/images/qtlabscontrols-material-dark.png
new file mode 100644
index 00000000..8afb2cd6
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-material-dark.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-material.png b/src/imports/controls/doc/images/qtlabscontrols-material.png
new file mode 100644
index 00000000..d7ce0e88
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-material.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pane-background.png b/src/imports/controls/doc/images/qtlabscontrols-pane-background.png
new file mode 100644
index 00000000..a379d915
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-pane-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-pane.png b/src/imports/controls/doc/images/qtlabscontrols-pane.png
new file mode 100644
index 00000000..ba0c0479
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-pane.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-universal-button.png b/src/imports/controls/doc/images/qtlabscontrols-universal-button.png
new file mode 100644
index 00000000..6ddec823
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-universal-button.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-universal-dark.png b/src/imports/controls/doc/images/qtlabscontrols-universal-dark.png
new file mode 100644
index 00000000..98701550
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-universal-dark.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtlabscontrols-universal.png b/src/imports/controls/doc/images/qtlabscontrols-universal.png
new file mode 100644
index 00000000..89a0f069
--- /dev/null
+++ b/src/imports/controls/doc/images/qtlabscontrols-universal.png
Binary files differ
diff --git a/src/imports/controls/doc/qtlabscontrols.qdocconf b/src/imports/controls/doc/qtlabscontrols.qdocconf
index 78cfc560..df004294 100644
--- a/src/imports/controls/doc/qtlabscontrols.qdocconf
+++ b/src/imports/controls/doc/qtlabscontrols.qdocconf
@@ -28,14 +28,14 @@ depends = qtcore qtgui qtdoc qtqml qtquick qtquicklayouts qtquickdialogs qtquick
# Specify the install path under QT_INSTALL_EXAMPLES
# Note: paths passed to \example command must contain the parent directory, e.g.
# \example controls/tabs
-exampledirs += ../../../../examples/labs \
+exampledirs += ../../../../examples/controls \
../ \
../../../templates \
../../calendar \
../../../../tests/auto/controls/data \
snippets
-examplesinstallpath = qtquickcontrols2/labs
+examplesinstallpath = qtquickcontrols2/controls
headerdirs += ../../../templates \
../../calendar \
@@ -49,3 +49,14 @@ navigation.landingpage = "Qt Labs Controls"
navigation.qmltypespage = "Qt Labs Controls QML Types"
tagfile = qtlabscontrols.tags
+
+# \styleimport {Qt.labs.controls.universal 1.0}
+macro.styleimport.HTML = "<table class=\"alignedsummary\"><tbody><tr><td class=\"memItemLeft rightAlign topAlign\"> Import Statement:</td><td class=\"memItemRight bottomAlign\"> import \1</td></tr></tbody></table>"
+
+# \styleproperty {Universal.accent} {enumeration} {html-target-id}
+# \target html-target-id
+# This property holds ...
+# (empty line)
+# \endstyleproperty
+macro.styleproperty.HTML = "<div class=\"qmlproto\"><table class=\"qmlname\"><tbody><tr valign=\"top\" class=\"odd\" id=\"\3\"><td class=\"tblQmlPropNode\"><p><span class=\"name\">\1</span> : <span class=\"type\">\2</span></p></td></tr></tbody></table></div>"
+macro.endstyleproperty = "\\br"
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml
new file mode 100644
index 00000000..d6715f07
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-background.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+ComboBox {
+ model: ["ComboBox"]
+ Rectangle {
+ anchors.fill: background
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml
new file mode 100644
index 00000000..08523088
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-contentItem.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+ComboBox {
+ model: ["ComboBox"]
+ Rectangle {
+ anchors.fill: contentItem
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml
new file mode 100644
index 00000000..60f56940
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-delegate.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+Item {
+ id: root
+ width: combo.width
+ height: combo.height + combo.popup.contentItem.height
+ ComboBox {
+ id: combo
+ model: ["First", "Second", "Third"]
+ popup.contentItem.parent: root
+ popup.contentItem.y: combo.height
+ delegate: ItemDelegate {
+ width: combo.width
+ text: modelData
+ checkable: true
+ autoExclusive: true
+ checked: combo.currentIndex === index
+ Rectangle {
+ visible: index === 0
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ }
+ }
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml
new file mode 100644
index 00000000..0fea67d1
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-combobox-popup.qml
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+Item {
+ id: root
+ width: combo.width
+ height: combo.height + combo.popup.contentItem.height
+ ComboBox {
+ id: combo
+ model: ["First", "Second", "Third"]
+ popup.contentItem.parent: root
+ popup.contentItem.y: combo.height
+ }
+ Rectangle {
+ parent: combo.popup.contentItem
+ anchors.fill: parent
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml b/src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml
new file mode 100644
index 00000000..4d7fe7fd
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-combobox.qml
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+Item {
+ id: root
+ width: combo.width
+ height: combo.height + combo.popup.contentItem.height
+ //! [1]
+ ComboBox {
+ id: combo
+ model: ["First", "Second", "Third"]
+ popup.contentItem.parent: root
+ popup.contentItem.y: combo.height
+ }
+ //! [1]
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml
new file mode 100644
index 00000000..1c1232c7
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-groupbox-checkable.qml
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.0
+import Qt.labs.controls 1.0
+
+//! [1]
+GroupBox {
+ label: CheckBox {
+ id: checkBox
+ checked: true
+ text: qsTr("Synchronize")
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ enabled: checkBox.checked
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml
new file mode 100644
index 00000000..d1d9f22f
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-pane-background.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+Pane {
+ width: 100
+ height: 100
+ background: Rectangle {
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml b/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml
new file mode 100644
index 00000000..09bfa6a0
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtlabscontrols-pane.qml
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import QtQuick.Layouts 1.0
+import Qt.labs.controls 1.0
+
+//! [1]
+Pane {
+ ColumnLayout {
+ anchors.fill: parent
+ CheckBox { text: qsTr("E-mail") }
+ CheckBox { text: qsTr("Calendar") }
+ CheckBox { text: qsTr("Contacts") }
+ }
+}
+//! [1]
diff --git a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
index cf47499c..a627a26a 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-containers.qdoc
@@ -57,6 +57,13 @@
\l GroupBox is used to layout a logical group of controls together,
within a titled visual frame.
+ \section1 Pane Control
+
+ \image qtlabscontrols-pane.png
+
+ \l Pane provides a background color that matches with the application
+ style and theme.
+
\section1 StackView Control
\image qtlabscontrols-stackview-wireframe.png
diff --git a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
index a7bd7d8b..4aff46a4 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-customize.qdoc
@@ -95,6 +95,38 @@
\snippet CheckBox.qml indicator
+
+ \section1 Customizing ComboBox
+
+ ComboBox consists of \l {Control::background}{background},
+ \l {Control::contentItem}{content item}, \l {ComboBox::popup}{popup},
+ and \l {ComboBox::delegate}{delegate}.
+
+ \section3 Background
+
+ \image qtlabscontrols-combobox-background.png
+
+ \snippet ComboBox.qml background
+
+ \section3 Content item
+
+ \image qtlabscontrols-combobox-contentItem.png
+
+ \snippet ComboBox.qml contentItem
+
+ \section3 Popup
+
+ \image qtlabscontrols-combobox-popup.png
+
+ \snippet ComboBox.qml popup
+
+ \section3 Delegate
+
+ \image qtlabscontrols-combobox-delegate.png
+
+ \snippet ComboBox.qml delegate
+
+
\section1 Customizing Dial
Dial consists of two visual items: \l {Control::background}{background}
@@ -208,7 +240,7 @@
\section1 Customizing Menu
- Menu consists of a \l {Panel::}{contentItem}.
+ Menu consists of a \l {Popup::}{contentItem}.
\section3 Content item
@@ -228,6 +260,17 @@
TODO
+ \section1 Customizing Pane
+
+ Pane consists of a \l {Control::background}{background}.
+
+ \section3 Background
+
+ \image qtlabscontrols-pane-background.png
+
+ \snippet Pane.qml background
+
+
\section1 Customizing ProgressBar
ProgressBar consists of two visual items: \l {Control::background}{background}
diff --git a/src/imports/controls/doc/src/qtlabscontrols-default.qdoc b/src/imports/controls/doc/src/qtlabscontrols-default.qdoc
new file mode 100644
index 00000000..c885c161
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-default.qdoc
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabscontrols-default.html
+ \title Default Style
+
+ The Default style is a basic all-round style.
+
+ The Default style a simple and light-weight style that offers the maximum
+ performance for Qt Labs Controls. It is built with a minimal amount of Qt
+ Quick primitives, and keeps animations and transitions to the minimum.
+
+ \image qtlabscontrols-default.png
+
+ The style is selected by default when running Qt Labs Controls applications.
+ It is built into the module's resources, so by default it is shipped with
+ any application that depends on the Qt Labs Controls module
+
+ \note The Default style is used as a fallback for other styles. If a style
+ does not implement a certain control, the Default style implementation of
+ that control is selected.
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Labs Controls}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc b/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
new file mode 100644
index 00000000..7fcce7a3
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-differences.qdoc
@@ -0,0 +1,283 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabscontrols-differences.html
+ \title Differences between Qt Quick Controls
+
+ Qt Quick Controls were originally developed to support desktop platforms,
+ with mobile and embedded support coming shortly afterwards. They have a
+ very broad scope, in that they provide a styling system flexible enough to
+ allow the development of applications that have either a platform-dependent
+ or platform-independent style.
+
+ On embedded systems, where the hardware has limited resources, this approach
+ can be inefficient. Qt Labs Controls were designed to solve this problem,
+ using
+ \l {https://blog.qt.io/blog/2015/03/31/qt-quick-controls-for-embedded/}{benchmarks}
+ to guide the development.
+
+ \section2 C++ and QML
+
+ In many cases, the internal state of a control can be more efficiently
+ processed in C++. For example, handling input events in C++ makes a
+ difference for controls that would otherwise need to create internal
+ MouseAreas and attached Keys objects.
+
+ \section2 Styles
+
+ Not only does handling events and logic in C++ increase performance, but it
+ allows the visual QML layer to be a simple, declarative layer on top. This
+ is reflected in the structure of the controls project: all visual
+ implementations sit in the \e imports folder, so that users who want to
+ create their own complete style can copy the folder and start tweaking.
+ Read more about implementing a style plugin \l {TODO}{here}.
+
+ In Qt Labs Controls, styles no longer provide components that are
+ dynamically instantiated by controls, but controls themselves consist of
+ item delegates that can be replaced. In effect, this means that delegates
+ are Qt Quick items that are instantiated on the spot, as properties of the
+ control, and are simply parented to the control.
+
+ \section2 Modularity and Simplicity
+
+ When it comes to more complex controls, it is sometimes better to split
+ them up into separate building blocks. As an example, the complex
+ ScrollView control:
+
+ \qml
+ ScrollView {
+ horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
+ Flickable {
+ // ...
+ }
+ }
+ \endqml
+
+ Is replaced with simple ScrollBar/ScrollIndicator controls that can be
+ attached to any Flickable:
+
+ \qml
+ Flickable {
+ // ...
+ ScrollBar.vertical: ScrollBar { }
+ }
+ \endqml
+
+ The API of Qt Labs Controls aims to be clean and simple. Common
+ operations are easy, and more advanced ones are liberally documented with
+ snippets that can be copied into your code.
+
+ \section2 Feature Comparison Table
+
+ \table
+ \header
+ \li
+ \li Qt Quick Controls
+ \li Qt Labs Controls
+ \row
+ \li Stylable delegates
+ \li Yes
+ \li Yes
+ \row
+ \li Pre-built native styles
+ \li Yes
+ \li No
+ \row
+ \li Runtime style changes
+ \li Yes
+ \li Yes
+ \row
+ \li Can be used on Desktop
+ \li Yes
+ \li Yes \b *
+ \row
+ \li Can be used on Mobile
+ \li Yes
+ \li Yes
+ \row
+ \li Can be used on Embedded
+ \li Yes
+ \li Yes
+ \row
+ \li Internal event handling
+ \li QML
+ \li C++
+ \endtable
+
+ \b {* No hover support}
+
+ \section2 Porting Qt Quick Controls Code
+
+ The API of Qt Labs Controls is very similar to Qt Quick Controls, but it
+ does come with some changes necessary to facilitate the improvements. The
+ majority of changes are to do with styling; all of a control's delegates
+ are now accessible in the control itself, instead of in a separate style
+ object.
+
+ For example, to style a button in Qt Quick Controls:
+
+ \badcode
+ Button {
+ style: ButtonStyle {
+ label: Label {
+ // ...
+ }
+ }
+ }
+ \endcode
+
+ To style a button in Qt Labs Controls:
+
+ \qml
+ Button {
+ label: Label {
+ // ...
+ }
+ }
+ \endqml
+
+ \section3 Preparing for Migration
+
+ With this in mind, a good way to prepare for a migration to Qt Quick
+ Labs is to place each control that you have a custom style for in its
+ own QML file. For example, the Qt Quick Controls button above could be moved to a
+ file named Button.qml, and used in the following manner:
+
+ \badcode
+ import "controls" as Controls
+
+ Controls.Button {
+ ...
+ }
+ \endcode
+
+ This works with both modules, and will reduce the amount of work needed
+ when the migration begins.
+
+ \section3 Type Changes
+
+ \table
+ \header
+ \li Qt Quick Controls
+ \li Qt Labs Controls
+ \row
+ \li \l [QtQuickControls] {Action}
+ \li No equivalent; see \l [QtQuick] {Shortcut} instead.
+ \row
+ \li \l [QtQuickControls] {ApplicationWindow}
+ \li \l [QtLabsControls] {ApplicationWindow}
+ \row
+ \li \l [QtQuickControls] {BusyIndicator}
+ \li \l [QtLabsControls] {BusyIndicator}
+ \row
+ \li \l [QtQuickControls] {Button}
+ \li \l [QtLabsControls] {Button}
+ \row
+ \li \l [QtQuickControls] {Calendar}
+ \li No equivalent; see \l [QML] {MonthGrid}, \l [QML] {DayOfWeekRow} and \l [QML] {WeekNumberColumn} instead.
+ \row
+ \li \l [QtQuickControls] {CheckBox}
+ \li \l [QtLabsControls] {CheckBox}
+ \row
+ \li \l [QtQuickControls] {ComboBox}
+ \li \l [QtLabsControls] {ComboBox}
+ \row
+ \li \l [QtQuickControls] {ExclusiveGroup}
+ \li \l [QtLabsControls] {ButtonGroup}
+ \row
+ \li \l [QtQuickControls] {GroupBox}
+
+ \li \l [QtLabsControls] {GroupBox}, or \l [QtLabsControls] {Frame}
+ if a title is not required.
+
+ \row
+ \li \l [QtQuickControls] {Label}
+ \li \l [QtLabsControls] {Label}
+ \row
+ \li \l [QtQuickControls] {Menu}
+ \li \l [QtLabsControls] {Menu}
+ \row
+ \li \l [QtQuickControls] {ProgressBar}
+ \li \l [QtLabsControls] {ProgressBar}
+ \row
+ \li \l [QtQuickControls] {RadioButton}
+ \li \l [QtLabsControls] {RadioButton}
+ \row
+ \li \l [QtQuickControls] {ScrollView}
+ \li \l [QtLabsControls] {ScrollBar},
+ \l [QtLabsControls] {ScrollIndicator}
+ \row
+ \li \l [QtQuickControls] {Slider}
+ \li \l [QtLabsControls] {Slider}
+ \row
+ \li \l [QtQuickControls] {SpinBox}
+ \li \l [QtLabsControls] {SpinBox}
+ \row
+ \li \l [QtQuickControls] {Stack},
+ \l [QtQuickControls] {StackView},
+ \l [QtQuickControls] {StackViewDelegate}
+ \li \l [QtLabsControls] {StackView}
+ \row
+ \li \l [QtQuickControls] {StatusBar}
+ \li No equivalent
+ \row
+ \li \l [QtQuickControls] {Switch}
+ \li \l [QtLabsControls] {Switch}
+ \row
+ \li \l [QtQuickControls] {Tab},
+ \l [QtQuickControls] {TabView}
+ \li \l [QtLabsControls] {TabBar} in combination with, for example,
+ \l [QtLabsControls] {SwipeView}.
+ \row
+ \li \l [QtQuickControls] {TableView}
+ \li No equivalent
+ \row
+ \li \l [QtQuickControls] {TextArea}
+ \li \l [QtLabsControls] {TextArea}
+ \row
+ \li \l [QtQuickControls] {TextField}
+ \li \l [QtLabsControls] {TextField}
+ \row
+ \li \l [QtQuickControls] {ToolBar}
+ \li \l [QtLabsControls] {ToolBar}
+ \row
+ \li \l [QtQuickControls] {ToolButton}
+ \li \l [QtLabsControls] {ToolButton}
+ \row
+ \li \l [QtQuickControls] {TreeView}
+ \li No equivalent
+ \endtable
+
+ \section1 Related Information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Quick Controls}
+ \li \l{Qt Labs Controls QML Types}{Qt Labs Controls QML Types}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-examples.qdoc b/src/imports/controls/doc/src/qtlabscontrols-examples.qdoc
new file mode 100644
index 00000000..04aabcfa
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-examples.qdoc
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \group qtlabscontrols-examples
+ \ingroup all-examples
+ \title Qt Labs Controls Examples
+ \brief A collection of examples for \l {Qt Labs Controls}
+
+ These examples demonstrate creating user interfaces using \l {Qt Labs Controls}.
+*/
+
+/*!
+ \example gallery
+ \title Qt Labs Controls - Gallery
+ \ingroup qtlabscontrols-examples
+ \brief A gallery of controls
+
+ \raw HTML
+ <div class="table"><table style="background:transparent; border:0px">
+ <tr><td style="border:0px">
+ \endraw
+ \image qtlabscontrols-gallery-welcome.png
+ \caption Welcome Screen
+ \raw HTML
+ </td><td style="border:0px">
+ \endraw
+ \image qtlabscontrols-gallery-drawer.png
+ \caption Side Drawer
+ \raw HTML
+ </td><td style="border:0px">
+ \endraw
+ \image qtlabscontrols-gallery-menu.png
+ \caption Options Menu
+ \raw HTML
+ </td></tr>
+ </table></div>
+ \endraw
+
+ This example project demonstrates the various UI controls provided by
+ \l {Qt Labs Controls}.
+
+ \include examples-run.qdocinc
+*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc b/src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc
new file mode 100644
index 00000000..557ef254
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-highdpi.qdoc
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabscontrols-highdpi.html
+ \title High-DPI Support in Qt Labs Controls
+
+ Qt Labs Controls support Qt's cross-platform high-DPI scaling introduced in Qt 5.6.
+ The feature is opt-in, and can be enabled by setting the \c Qt::AA_EnableHighDpiScaling
+ application attribute in C++ before QGuiApplication is constructed:
+
+ \code
+ #include <QGuiApplication>
+ #include <QQmlApplicationEngine>
+
+ int main(int argc, char *argv[])
+ {
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // <--
+ QGuiApplication app(argc, argv);
+ QQmlApplicationEngine engine("main.qml");
+ return app.exec();
+ }
+ \endcode
+
+ Alternatively, an environment variable \c QT_AUTO_SCREEN_SCALE_FACTOR=1 can be set
+ to enable automatic high-DPI scaling.
+
+ \warning \l {Qt Quick Controls}{Qt Quick Controls 1.x} are not compatible with Qt's
+ automatic high-DPI scaling. There is currently no available solution for high-DPI
+ support in applications wishing to mix Qt Quick Controls and Qt Labs Controls.
+
+ \section1 Related Information
+ \list
+ \li \l {High DPI Displays}
+ \li \l {Scalability}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-index.qdoc b/src/imports/controls/doc/src/qtlabscontrols-index.qdoc
index 936e65e8..dc198135 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-index.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-index.qdoc
@@ -42,249 +42,6 @@
\section2 Qt.labs.calendar Module
\generatelist {qmltypesbymodule Qt.labs.calendar}
- \section1 Differences between Qt Quick Controls
-
- Qt Quick Controls were originally developed to support desktop platforms,
- with mobile and embedded support coming shortly afterwards. They have a
- very broad scope, in that they provide a styling system flexible enough to
- allow the development of applications that have either a platform-dependent
- or platform-independent style.
-
- On embedded systems, where the hardware has limited resources, this approach
- can be inefficient. Qt Labs Controls were designed to solve this problem,
- using
- \l {https://blog.qt.io/blog/2015/03/31/qt-quick-controls-for-embedded/}{benchmarks}
- to guide the development.
-
- \section2 C++ and QML
-
- In many cases, the internal state of a control can be more efficiently
- processed in C++. For example, handling input events in C++ makes a
- difference for controls that would otherwise need to create internal
- MouseAreas and attached Keys objects.
-
- \section2 Styles
-
- Not only does handling events and logic in C++ increase performance, but it
- allows the visual QML layer to be a simple, declarative layer on top. This
- is reflected in the structure of the controls project: all visual
- implementations sit in the \e imports folder, so that users who want to
- create their own complete style can copy the folder and start tweaking.
- Read more about implementing a style plugin \l {TODO}{here}.
-
- In Qt Labs Controls, styles no longer provide components that are
- dynamically instantiated by controls, but controls themselves consist of
- item delegates that can be replaced. In effect, this means that delegates
- are Qt Quick items that are instantiated on the spot, as properties of the
- control, and are simply parented to the control.
-
- \section2 Modularity and Simplicity
-
- When it comes to more complex controls, it is sometimes better to split
- them up into separate building blocks. As an example, the complex
- ScrollView control:
-
- \qml
- ScrollView {
- horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
- Flickable {
- // ...
- }
- }
- \endqml
-
- Is replaced with simple ScrollBar/ScrollIndicator controls that can be
- attached to any Flickable:
-
- \qml
- Flickable {
- // ...
- ScrollBar.vertical: ScrollBar { }
- }
- \endqml
-
- The API of Qt Labs Controls aims to be clean and simple. Common
- operations are easy, and more advanced ones are liberally documented with
- snippets that can be copied into your code.
-
- \section2 Feature Comparison Table
-
- \table
- \header
- \li
- \li Qt Quick Controls
- \li Qt Labs Controls
- \row
- \li Stylable delegates
- \li Yes
- \li Yes
- \row
- \li Pre-built native styles
- \li Yes
- \li No
- \row
- \li Runtime style changes
- \li Yes
- \li Yes
- \row
- \li Can be used on Desktop
- \li Yes
- \li Yes \b *
- \row
- \li Can be used on Mobile
- \li Yes
- \li Yes
- \row
- \li Can be used on Embedded
- \li Yes
- \li Yes
- \row
- \li Internal event handling
- \li QML
- \li C++
- \endtable
-
- \b {* No hover support}
-
- \section2 Porting Qt Quick Controls Code
-
- The API of Qt Labs Controls is very similar to Qt Quick Controls, but it
- does come with some changes necessary to facilitate the improvements. The
- majority of changes are to do with styling; all of a control's delegates
- are now accessible in the control itself, instead of in a separate style
- object.
-
- For example, to style a button in Qt Quick Controls:
-
- \badcode
- Button {
- style: ButtonStyle {
- label: Label {
- // ...
- }
- }
- }
- \endcode
-
- To style a button in Qt Labs Controls:
-
- \qml
- Button {
- label: Label {
- // ...
- }
- }
- \endqml
-
- \section3 Preparing for Migration
-
- With this in mind, a good way to prepare for a migration to Qt Quick
- Labs is to place each control that you have a custom style for in its
- own QML file. For example, the Qt Quick Controls button above could be moved to a
- file named Button.qml, and used in the following manner:
-
- \badcode
- import "controls" as Controls
-
- Controls.Button {
- ...
- }
- \endcode
-
- This works with both modules, and will reduce the amount of work needed
- when the migration begins.
-
- \section3 Type Changes
-
- \table
- \header
- \li Qt Quick Controls
- \li Qt Labs Controls
- \row
- \li \l [QtQuickControls] {Action}
- \li No equivalent; see \l [QtQuick] {Shortcut} instead.
- \row
- \li \l [QtQuickControls] {ApplicationWindow}
- \li \l [QtLabsControls] {ApplicationWindow}
- \row
- \li \l [QtQuickControls] {BusyIndicator}
- \li \l [QtLabsControls] {BusyIndicator}
- \row
- \li \l [QtQuickControls] {Button}
- \li \l [QtLabsControls] {Button}
- \row
- \li \l [QtQuickControls] {Calendar}
- \li No equivalent; see \l [QML] {MonthGrid}, \l [QML] {DayOfWeekRow} and \l [QML] {WeekNumberColumn} instead.
- \row
- \li \l [QtQuickControls] {CheckBox}
- \li \l [QtLabsControls] {CheckBox}
- \row
- \li \l [QtQuickControls] {ExclusiveGroup}
- \li \l [QtLabsControls] {ButtonGroup}
- \row
- \li \l [QtQuickControls] {GroupBox}
-
- \li \l [QtLabsControls] {GroupBox}, or \l [QtLabsControls] {Frame}
- if a title is not required.
-
- \row
- \li \l [QtQuickControls] {Label}
- \li \l [QtLabsControls] {Label}
- \row
- \li \l [QtQuickControls] {Menu}
- \li \l [QtLabsControls] {Menu}
- \row
- \li \l [QtQuickControls] {ProgressBar}
- \li \l [QtLabsControls] {ProgressBar}
- \row
- \li \l [QtQuickControls] {RadioButton}
- \li \l [QtLabsControls] {RadioButton}
- \row
- \li \l [QtQuickControls] {ScrollView}
- \li \l [QtLabsControls] {ScrollBar},
- \l [QtLabsControls] {ScrollIndicator}
- \row
- \li \l [QtQuickControls] {Slider}
- \li \l [QtLabsControls] {Slider}
- \row
- \li \l [QtQuickControls] {SpinBox}
- \li \l [QtLabsControls] {SpinBox}
- \row
- \li \l [QtQuickControls] {Stack},
- \l [QtQuickControls] {StackView},
- \l [QtQuickControls] {StackViewDelegate}
- \li \l [QtLabsControls] {StackView}
- \row
- \li \l [QtQuickControls] {StatusBar}
- \li No equivalent
- \row
- \li \l [QtQuickControls] {Switch}
- \li \l [QtLabsControls] {Switch}
- \row
- \li \l [QtQuickControls] {Tab},
- \l [QtQuickControls] {TabView}
- \li \l [QtLabsControls] {TabBar} in combination with, for example,
- \l [QtLabsControls] {SwipeView}.
- \row
- \li \l [QtQuickControls] {TableView}
- \li No equivalent
- \row
- \li \l [QtQuickControls] {TextArea}
- \li \l [QtLabsControls] {TextArea}
- \row
- \li \l [QtQuickControls] {TextField}
- \li \l [QtLabsControls] {TextField}
- \row
- \li \l [QtQuickControls] {ToolBar}
- \li \l [QtLabsControls] {ToolBar}
- \row
- \li \l [QtQuickControls] {ToolButton}
- \li \l [QtLabsControls] {ToolButton}
- \row
- \li \l [QtQuickControls] {TreeView}
- \li No equivalent
- \endtable
-
\section1 Getting Started
A basic example of a QML file that makes use of controls is shown here:
@@ -304,11 +61,12 @@
A basic example of a source file that makes use of controls is shown here:
\code
- #include <QApplication>
+ #include <QGuiApplication>
#include <QQmlApplicationEngine>
int main(int argc, char *argv[])
{
+ QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine("main.qml");
return app.exec();
@@ -325,9 +83,13 @@
available to the context of the current QML engine. See QQmlContext for
more information.
- \section2 Deploying Qt Labs Controls
+ \section1 Important Concepts in Qt Labs Controls
- TODO
+ \list
+ \li \l{Styling Qt Labs Controls}
+ \li \l{High-DPI Support in Qt Labs Controls}
+ \li \l{Differences between Qt Quick Controls}
+ \endlist
\section1 Related Information
@@ -335,6 +97,7 @@
\li \l{Qt Quick}
\li \l{Qt Quick Layouts}
\li \l{Qt Labs Calendar}
+ \li \l{Qt Labs Templates}
\li \l{Qt Labs Controls QML Types}{Qt Labs Controls QML Types}
\endlist
*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-input.qdoc b/src/imports/controls/doc/src/qtlabscontrols-input.qdoc
index 130ca83d..06c0b40d 100644
--- a/src/imports/controls/doc/src/qtlabscontrols-input.qdoc
+++ b/src/imports/controls/doc/src/qtlabscontrols-input.qdoc
@@ -38,6 +38,12 @@
following sections offer guidelines for choosing the appropriate type
of input control, depending on the use case.
+ \section1 ComboBox Control
+
+ \image qtlabscontrols-combobox.png
+
+ \l ComboBox is used to select a value from a drop-down list.
+
\section1 Dial Control
\image qtlabscontrols-dial.png
diff --git a/src/imports/controls/doc/src/qtlabscontrols-material.qdoc b/src/imports/controls/doc/src/qtlabscontrols-material.qdoc
new file mode 100644
index 00000000..c963cb28
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-material.qdoc
@@ -0,0 +1,172 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabscontrols-material.html
+ \title Material Style
+
+ The Material Style is based on the Google Material Design Guidelines.
+ \l {detailed-description}{More...}
+
+ \styleimport {Qt.labs.controls.material 1.0}
+
+ \section1 Attached Properties
+
+ \list
+ \li \l {accent-attached-prop}{\b accent} : enumeration
+ \li \l {theme-attached-prop}{\b theme} : enumeration
+ \endlist
+
+ \section1 Detailed Description
+
+ The Material style is based on the \l {https://www.google.com/design/spec/material-design/introduction.html}
+ {Google Material Design Guidelines}. It allows for a unified experience
+ across platforms and device sizes.
+
+ \image qtlabscontrols-material.png
+ \caption The Material style in light and dark themes
+
+ \note The Material style is not a native Android style. The Material
+ style is a 100% cross-platform Qt Labs Controls style implementation that
+ follows the Google Material Design Guidelines. The style runs on any
+ platform, and looks more or less identical everywhere. Minor differences
+ may occur due to differences in available system fonts and font rendering
+ engines.
+
+ \section2 Customization
+
+ The Material style allows customizing two attributes, \l {theme-attached-prop}{theme}
+ and \l {accent-attached-prop}{accent}. The following example illustrates how to create
+ a red \e stop button with light text:
+
+ \table
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+ import Qt.labs.controls 1.0
+ import Qt.labs.controls.material 1.0
+
+ Button {
+ text: "Stop"
+ highlighted: true
+
+ Material.accent: Material.Red
+ Material.theme: Material.Dark
+ }
+ \endqml
+ \li
+ \image qtlabscontrols-material-button.png
+ \endtable
+
+ Both attributes can be specified for any window or item, and they automatically
+ propagate to children in the same manner as \l {Control::font}{fonts}. In the
+ following example, the window and all three radio buttons appear in the dark
+ theme using a purple accent color:
+
+ \table
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+ import Qt.labs.controls 1.0
+ import Qt.labs.controls.material 1.0
+
+ ApplicationWindow {
+ visible: true
+
+ Material.theme: Material.Dark
+ Material.accent: Material.Purple
+
+ Column {
+ anchors.centerIn: parent
+
+ RadioButton { text: qsTr("Small") }
+ RadioButton { text: qsTr("Medium"); checked: true }
+ RadioButton { text: qsTr("Large") }
+ }
+ }
+ \endqml
+ \li
+ \image qtlabscontrols-material-dark.png
+ \endtable
+
+ \note The Material style must be separately imported to gain access to
+ these style-specific attributes. It should be noted that regardless of the
+ references to the Material style, the same application code runs with any
+ other style. The Material style-specific attributes only have an effect
+ when the application is run with the Material style. Furthermore, in case
+ of explicit Material style-specific references, the Material style must
+ be deployed with the application.
+
+ \section1 Attached Property Documentation
+
+ \styleproperty {Material.accent} {enumeration} {accent-attached-prop}
+ \target accent-attached-prop
+ This attached property holds the accent color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ Available accents:
+ \value Material.Red Red (#F44336)
+ \value Material.Pink Pink (#E91E63)
+ \value Material.Purple Purple (#9C27B0)
+ \value Material.DeepPurple Deep Purple (#673AB7)
+ \value Material.Indigo Indigo (#3F51B5)
+ \value Material.Blue Blue (#2196F3)
+ \value Material.LightBlue Light Blue (#03A9F4)
+ \value Material.Cyan Cyan (#00BCD4)
+ \value Material.Teal Teal (#009688, default)
+ \value Material.Green Green (#4CAF50)
+ \value Material.LightGreen Light Green (#8BC34A)
+ \value Material.Lime Lime (#CDDC39)
+ \value Material.Yellow Yellow (#FFEB3B)
+ \value Material.Amber Amber (#FFC107)
+ \value Material.Orange Orange (#FF9800)
+ \value Material.DeepOrange Deep Orange (#FF5722)
+ \value Material.Brown Brown (#795548)
+ \value Material.Grey Grey (#9E9E9E)
+ \value Material.BlueGrey Blue Grey (#607D8B)
+
+ \endstyleproperty
+
+ \styleproperty {Material.theme} {enumeration} {theme-attached-prop}
+ \target theme-attached-prop
+ This attached property holds whether the theme is light or dark. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ Available themes:
+ \value Material.Light Light theme (default)
+ \value Material.Dark Dark theme
+
+ \endstyleproperty
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Labs Controls}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-styles.qdoc b/src/imports/controls/doc/src/qtlabscontrols-styles.qdoc
new file mode 100644
index 00000000..858a9105
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-styles.qdoc
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabscontrols-styles.html
+ \title Styling Qt Labs Controls
+
+ Qt Labs Controls comes with a selection of styles. The \l {Default Style}
+ {Default} style is a simple and light-weight all-round style that offers
+ the maximum performance for Qt Labs Controls. The more advanced
+ \l {Universal Style}{Universal} and \l {Material Style}{Material} styles
+ offer an appealing design, but require more system resources.
+
+ \section1 Usage
+
+ In order to run an application with a specific style, either pass a command
+ line argument, or set an environment variable. Alternatively, the preferred
+ style and style-specific attributes can be specified in a configuration file.
+
+ \section2 Command line argument
+
+ Passing a \c -style command line argument is the convenient way to test different
+ styles. It takes precedence over the other methods listed below. The following
+ example runs a Qt Labs Controls application with the Material style:
+
+ \code
+ ./app -style material
+ \endcode
+
+ \section2 Environment variable
+
+ Setting the \c QT_LABS_CONTROLS_STYLE environment variable can be used to set
+ a system-wide style preference. It takes precedence over the configuration file
+ mentioned below. The following example runs a Qt Labs Controls application with
+ the Universal style:
+
+ \code
+ QT_LABS_CONTROLS_STYLE=universal ./app
+ \endcode
+
+ \section2 Configuration file
+
+ Qt Labs Controls support a special configuration file, \c :/qtlabscontrols.conf,
+ that is built into an application's resources.
+
+ The configuration file can specify the preferred style (may be overridden by either
+ of the methods described earlier) and certain style-specific attributes. The following
+ example specifies that the preferred style is the Material style. Furthermore, when the
+ application is run with the Material style, its theme is light and the accent color is
+ brown. However, if the application is run with the Universal style instead, the theme
+ is dark and the accent color is red.
+
+ \code
+ [Controls]
+ Style=Material
+
+ [Universal]
+ Theme=Dark
+ Accent=Red
+
+ [Material]
+ Theme=Light
+ Accent=Brown
+ \endcode
+
+ In order to make it possible for Qt Labs Controls to find the configuration file,
+ it must be built into application's resources using the \l {The Qt Resource System}.
+ Here's an example \c .qrc file:
+
+ \code
+ <!DOCTYPE RCC><RCC version="1.0">
+ <qresource prefix="/">
+ <file>qtlabscontrols.conf</file>
+ </qresource>
+ </RCC>
+ \endcode
+
+ \note Qt Labs Controls uses a file selector to load the configuration file. It
+ is possible to provide a different configuration file for different platforms and
+ locales. See \l QFileSelector documentation for more details.
+
+ Finally, the \c .qrc file must be listed in the application's \c .pro file so that
+ the build system knows about it. For example:
+
+ \code
+ RESOURCES = application.qrc
+ \endcode
+
+ \section1 Related Information
+ \list
+ \li \l {Default Style}
+ \li \l {Material Style}
+ \li \l {Universal Style}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/qtlabscontrols-universal.qdoc b/src/imports/controls/doc/src/qtlabscontrols-universal.qdoc
new file mode 100644
index 00000000..3c616d84
--- /dev/null
+++ b/src/imports/controls/doc/src/qtlabscontrols-universal.qdoc
@@ -0,0 +1,177 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabscontrols-universal.html
+ \title Universal Style
+
+ The Universal Style is based on the Microsoft Universal Design Guidelines.
+ \l {detailed-description}{More...}
+
+ \styleimport {Qt.labs.controls.universal 1.0}
+
+ \section1 Attached Properties
+
+ \list
+ \li \l {accent-attached-prop}{\b accent} : color
+ \li \l {theme-attached-prop}{\b theme} : enumeration
+ \endlist
+
+ \section1 Detailed Description
+
+ The Universal style is a device-agnostic style based on the
+ \l {https://dev.windows.com/design}{Microsoft Universal Design Guidelines}.
+ The Universal style has been designed to look good on all devices, from
+ phones and tablets to PCs.
+
+ \image qtlabscontrols-universal.png
+ \caption The Universal style in light and dark themes
+
+ \note The Universal style is not a native Windows 10 style. The Universal
+ style is a 100% cross-platform Qt Labs Controls style implementation that
+ follows the Microsoft Universal Design Guidelines. The style runs on any
+ platform, and looks more or less identical everywhere. Minor differences
+ may occur due to differences in available system fonts and font rendering
+ engines.
+
+ \section2 Customization
+
+ The Universal style allows customizing two attributes, \l {theme-attached-prop}{theme}
+ and \l {accent-attached-prop}{accent}. The following example illustrates how to create
+ a red \e stop button with light text:
+
+ \table
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+ import Qt.labs.controls 1.0
+ import Qt.labs.controls.universal 1.0
+
+ Button {
+ text: "Stop"
+ highlighted: true
+
+ Universal.accent: Universal.Red
+ Universal.theme: Universal.Dark
+ }
+ \endqml
+ \li
+ \image qtlabscontrols-universal-button.png
+ \endtable
+
+ Both attributes can be specified for any window or item, and they automatically
+ propagate to children in the same manner as \l {Control::font}{fonts}. In the
+ following example, the window and all three radio buttons appear in the dark
+ theme using a violet accent color:
+
+ \table
+ \row
+ \li
+ \qml
+ import QtQuick 2.0
+ import Qt.labs.controls 1.0
+ import Qt.labs.controls.universal 1.0
+
+ ApplicationWindow {
+ visible: true
+
+ Universal.theme: Universal.Dark
+ Universal.accent: Universal.Violet
+
+ Column {
+ anchors.centerIn: parent
+
+ RadioButton { text: qsTr("Small") }
+ RadioButton { text: qsTr("Medium"); checked: true }
+ RadioButton { text: qsTr("Large") }
+ }
+ }
+ \endqml
+ \li
+ \image qtlabscontrols-universal-dark.png
+ \endtable
+
+ \note The Universal style must be separately imported to gain access to
+ these style-specific attributes. It should be noted that regardless of the
+ references to the Universal style, the same application code runs with any
+ other style. The Universal style-specific attributes only have an effect
+ when the application is run with the Universal style. Furthermore, in case
+ of explicit Universal style-specific references, the Universal style must
+ be deployed with the application.
+
+ \section1 Attached Property Documentation
+
+ \styleproperty {Universal.accent} {color} {accent-attached-prop}
+ \target accent-attached-prop
+ This attached property holds the accent color of the theme. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ Even though the accent can be any \l {colorbasictypedocs}{color}, it is
+ recommended to use one of the pre-defined accents that have been designed
+ to work well with the rest of the Universal style palette:
+
+ \value Universal.Lime Lime (#A4C400)
+ \value Universal.Green Green (#60A917)
+ \value Universal.Emerald Emerald (#008A00)
+ \value Universal.Teal Teal (#00ABA9)
+ \value Universal.Cyan Cyan (#1BA1E2)
+ \value Universal.Cobalt Cobalt (#3E65FF, default)
+ \value Universal.Indigo Indigo (#6A00FF)
+ \value Universal.Violet Violet (#AA00FF)
+ \value Universal.Pink Pink (#F472D0)
+ \value Universal.Magenta Magenta (#D80073)
+ \value Universal.Crimson Crimson (#A20025)
+ \value Universal.Red Red (#E51400)
+ \value Universal.Orange Orange (#FA6800)
+ \value Universal.Amber Amber (#F0A30A)
+ \value Universal.Yellow Yellow (#E3C800)
+ \value Universal.Brown Brown (#825A2C)
+ \value Universal.Olive Olive (#6D8764)
+ \value Universal.Steel Steel (#647687)
+ \value Universal.Mauve Mauve (#76608A)
+ \value Universal.Taupe Taupe (#87794E)
+
+ \endstyleproperty
+
+ \styleproperty {Universal.theme} {enumeration} {theme-attached-prop}
+ \target theme-attached-prop
+ This attached property holds whether the theme is light or dark. The property
+ can be attached to any window or item. The value is propagated to children.
+
+ Available themes:
+ \value Universal.Light Light theme (default)
+ \value Universal.Dark Dark theme
+
+ \endstyleproperty
+
+ \section1 Related Information
+
+ \list
+ \li \l{Styling Qt Labs Controls}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc b/src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc
new file mode 100644
index 00000000..fded42cd
--- /dev/null
+++ b/src/imports/controls/doc/src/templates/qtlabstemplates-index.qdoc
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtlabstemplates-index.html
+ \title Qt Labs Templates
+ \brief A set of templates to create user interface controls in Qt Quick
+
+ Qt Labs Templates are the foundations of \l {Qt Labs Controls}. Templates
+ are non-visual implementations of controls' logic and behavior. They offer
+ an interface to visualize the controls in QML using \l {Qt Quick}.
+
+ Even though the templates aim to be as style-agnostic as possible, in some
+ cases they have to make certain assumptions about the visual structure of
+ a control. For example, a spinbox has buttons that increment and decrement
+ the value of the spinbox. In order to implement the behavior of a spinbox,
+ the spinbox template needs to know if the user is interacting with the up
+ or down button. A visual implementation of the spinbox template merely needs
+ to position the up and down buttons and visualize them in normal, pressed,
+ and disabled states. Any input event handling and state processing is taken
+ care of by the underlying template.
+
+ \section1 Related Information
+
+ \list
+ \li \l{Qt Quick}
+ \li \l{Qt Labs Controls}
+ \li \l{Qt Labs Templates QML Types}
+ \endlist
+*/
diff --git a/src/imports/controls/doc/src/templates/qtlabstemplates.qdoc b/src/imports/controls/doc/src/templates/qtlabstemplates.qdoc
new file mode 100644
index 00000000..84eabe44
--- /dev/null
+++ b/src/imports/controls/doc/src/templates/qtlabstemplates.qdoc
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \qmlmodule Qt.labs.templates 1.0
+ \title Qt Labs Templates QML Types
+ \ingroup qmlmodules
+ \brief Provides QML types for templates (Qt Labs Templates).
+
+ The \l {Qt Labs Templates} module provides a set of non-visual templates
+ that can be used to build user interface controls in QML using \l {Qt Quick}.
+
+ The QML types can be imported using the following import statement in your
+ \c .qml file:
+
+ \badcode
+ import Qt.labs.templates 1.0 as T
+ \endcode
+
+ For the sake of clarity, there is a one-to-one mapping between the types
+ provided by the \c Qt.labs.templates and \c Qt.labs.controls imports. For
+ every type available in the \c Qt.labs.controls import, a non-visual template
+ type by the same name exists in the \c Qt.labs.templates import.
+
+ \note It is recommended to use a namespace for the templates import to avoid
+ overlap with the types provided by the \c Qt.labs.controls import.
+
+ \section1 QML Types
+
+ \generatelist {qmltypesbymodule Qt.labs.controls}
+
+ \section1 Related Information
+
+ \list
+ \li \l {Qt Labs Controls QML Types}
+ \endlist
+
+ \noautolist
+*/
diff --git a/src/imports/controls/images/check.png b/src/imports/controls/images/check.png
index 28d86ef2..479a8442 100644
--- a/src/imports/controls/images/check.png
+++ b/src/imports/controls/images/check.png
Binary files differ
diff --git a/src/imports/controls/images/check@2x.png b/src/imports/controls/images/check@2x.png
index 46c3dafa..597aab7f 100644
--- a/src/imports/controls/images/check@2x.png
+++ b/src/imports/controls/images/check@2x.png
Binary files differ
diff --git a/src/imports/controls/images/check@3x.png b/src/imports/controls/images/check@3x.png
index 7ad7818b..1a10289b 100644
--- a/src/imports/controls/images/check@3x.png
+++ b/src/imports/controls/images/check@3x.png
Binary files differ
diff --git a/src/imports/controls/images/check@4x.png b/src/imports/controls/images/check@4x.png
index ce3d9e76..54e885f6 100644
--- a/src/imports/controls/images/check@4x.png
+++ b/src/imports/controls/images/check@4x.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator.png b/src/imports/controls/images/dial-indicator.png
index 53f70c49..92357c51 100644
--- a/src/imports/controls/images/dial-indicator.png
+++ b/src/imports/controls/images/dial-indicator.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator@2x.png b/src/imports/controls/images/dial-indicator@2x.png
index c0d24bd5..f436443b 100644
--- a/src/imports/controls/images/dial-indicator@2x.png
+++ b/src/imports/controls/images/dial-indicator@2x.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator@3x.png b/src/imports/controls/images/dial-indicator@3x.png
index 2161193b..d883045b 100644
--- a/src/imports/controls/images/dial-indicator@3x.png
+++ b/src/imports/controls/images/dial-indicator@3x.png
Binary files differ
diff --git a/src/imports/controls/images/dial-indicator@4x.png b/src/imports/controls/images/dial-indicator@4x.png
index 79bba975..79477712 100644
--- a/src/imports/controls/images/dial-indicator@4x.png
+++ b/src/imports/controls/images/dial-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/images/drop-indicator.png b/src/imports/controls/images/drop-indicator.png
new file mode 100644
index 00000000..80c1d958
--- /dev/null
+++ b/src/imports/controls/images/drop-indicator.png
Binary files differ
diff --git a/src/imports/controls/images/drop-indicator@2x.png b/src/imports/controls/images/drop-indicator@2x.png
new file mode 100644
index 00000000..6e0f228c
--- /dev/null
+++ b/src/imports/controls/images/drop-indicator@2x.png
Binary files differ
diff --git a/src/imports/controls/images/drop-indicator@3x.png b/src/imports/controls/images/drop-indicator@3x.png
new file mode 100644
index 00000000..199752fb
--- /dev/null
+++ b/src/imports/controls/images/drop-indicator@3x.png
Binary files differ
diff --git a/src/imports/controls/images/drop-indicator@4x.png b/src/imports/controls/images/drop-indicator@4x.png
new file mode 100644
index 00000000..58311fbe
--- /dev/null
+++ b/src/imports/controls/images/drop-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/images/spinner_large.png b/src/imports/controls/images/spinner_large.png
deleted file mode 100644
index bfd1b637..00000000
--- a/src/imports/controls/images/spinner_large.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/images/spinner_medium.png b/src/imports/controls/images/spinner_medium.png
deleted file mode 100644
index 41409d45..00000000
--- a/src/imports/controls/images/spinner_medium.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/images/spinner_small.png b/src/imports/controls/images/spinner_small.png
deleted file mode 100644
index 2f6048e4..00000000
--- a/src/imports/controls/images/spinner_small.png
+++ /dev/null
Binary files differ
diff --git a/src/imports/controls/material/ApplicationWindow.qml b/src/imports/controls/material/ApplicationWindow.qml
index bf8b62bc..e69c46da 100644
--- a/src/imports/controls/material/ApplicationWindow.qml
+++ b/src/imports/controls/material/ApplicationWindow.qml
@@ -43,4 +43,9 @@ T.ApplicationWindow {
id: window
color: Material.backgroundColor
+
+ overlay.background: Rectangle {
+ color: window.Material.backgroundDimColor
+ Behavior on opacity { NumberAnimation { duration: 150 } }
+ }
}
diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml
index 6d2ab499..2644a0aa 100644
--- a/src/imports/controls/material/Button.qml
+++ b/src/imports/controls/material/Button.qml
@@ -60,7 +60,9 @@ T.Button {
height: control.availableHeight
text: control.text
- color: control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.primaryTextColor
+ font: control.font
+ color: !control.enabled ? control.Material.hintTextColor :
+ control.highlighted ? control.Material.primaryHighlightedTextColor : control.Material.primaryTextColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
@@ -68,33 +70,36 @@ T.Button {
//! [label]
//! [background]
- background: Rectangle {
+ background: Item {
implicitWidth: 36
implicitHeight: 36
- radius: 2
- color: !control.enabled ? (control.highlighted ? control.Material.raisedHighlightedButtonDisabledColor : control.Material.raisedButtonDisabledColor) :
- (control.pressed ? (control.highlighted ? control.Material.raisedHighlightedButtonPressColor : control.Material.raisedButtonPressColor) :
- (control.activeFocus ? (control.highlighted ? control.Material.raisedHighlightedButtonHoverColor : control.Material.raisedButtonHoverColor) :
- (control.highlighted ? control.Material.raisedHighlightedButtonColor : control.Material.raisedButtonColor)))
+ Rectangle {
+ id: rect
+ width: parent.width
+ height: parent.height
+ radius: 2
+ color: !control.enabled ? (control.highlighted ? control.Material.raisedHighlightedButtonDisabledColor : control.Material.raisedButtonDisabledColor) :
+ (control.pressed ? (control.highlighted ? control.Material.raisedHighlightedButtonPressColor : control.Material.raisedButtonPressColor) :
+ (control.activeFocus ? (control.highlighted ? control.Material.raisedHighlightedButtonHoverColor : control.Material.raisedButtonHoverColor) :
+ (control.highlighted ? control.Material.raisedHighlightedButtonColor : control.Material.raisedButtonColor)))
- Behavior on color {
- ColorAnimation {
- duration: 400
+ Behavior on color {
+ ColorAnimation {
+ duration: 400
+ }
}
}
- layer.enabled: control.enabled
- layer.effect: DropShadow {
+ DropShadow {
+ source: rect
+ visible: control.enabled
+ width: parent.width
+ height: parent.height
verticalOffset: 1
color: control.Material.dropShadowColor
samples: control.pressed ? 15 : 9
spread: 0.5
-
- // TODO: Doesn't work because of QTBUG-49072
- Behavior on radius {
- NumberAnimation { duration: 1000 }
- }
}
}
//! [background]
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
new file mode 100644
index 00000000..93494a60
--- /dev/null
+++ b/src/imports/controls/material/ComboBox.qml
@@ -0,0 +1,173 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.2
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.material 1.0
+import QtGraphicalEffects 1.0
+
+T.ComboBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ spacing: 6
+ padding: 12
+
+ //! [delegate]
+ delegate: ItemDelegate {
+ width: control.width
+ text: control.textRole ? model[control.textRole] : modelData
+ highlighted: control.highlightedIndex === index
+ pressed: highlighted && control.pressed
+ }
+ //! [delegate]
+
+ //! [contentItem]
+ contentItem: Text {
+ text: control.displayText
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ elide: Text.ElideRight
+ rightPadding: 14 + control.spacing
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Item {
+ implicitWidth: 120
+ implicitHeight: 32
+
+ Rectangle {
+ id: rect
+ width: parent.width
+ height: parent.height
+ radius: 2
+ color: control.Material.dialogColor
+
+ Behavior on color {
+ ColorAnimation {
+ duration: 400
+ }
+ }
+ }
+
+ DropShadow {
+ source: rect
+ visible: control.enabled
+ width: parent.width
+ height: parent.height
+ verticalOffset: 1
+ color: control.Material.dropShadowColor
+ samples: control.pressed ? 15 : 9
+ spread: 0.5
+ }
+
+ Image {
+ x: parent.width - width - control.rightPadding
+ y: (parent.height - height) / 2
+ opacity: !control.enabled ? 0.5 : 1.0
+ source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/drop-indicator.png"
+ }
+ }
+ //! [background]
+
+ //! [popup]
+ popup: T.Popup {
+ enter: Transition {
+ // grow_fade_in
+ NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ exit: Transition {
+ // shrink_fade_out
+ NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ contentItem: Item {
+ // TODO: Popup::anchors
+ readonly property var above: popup.visible ? control.mapToItem(null, 0, -height) : Qt.point(0, 0)
+ readonly property var below: popup.visible ? control.mapToItem(null, 0, control.height) : Qt.point(0, 0)
+ readonly property bool showAbove: above.y >= 0 && below.y + height > control.Window.height
+
+ x: below.x
+ y: showAbove ? above.y : below.y
+ width: control.width
+ height: listview.height
+ transformOrigin: showAbove ? Item.Bottom : Item.Top
+
+ Rectangle {
+ id: panel
+ width: parent.width
+ height: parent.height
+ color: control.Material.dialogColor
+ }
+
+ DropShadow {
+ source: panel
+ visible: control.enabled
+ width: parent.width
+ height: parent.height
+ verticalOffset: 1
+ color: control.Material.dropShadowColor
+ samples: 15
+ spread: 0.5
+ }
+
+ ListView {
+ id: listview
+ width: control.width
+ height: Math.min(200, contentHeight) // TODO: 396
+
+ clip: true
+ model: control.delegateModel
+ currentIndex: control.highlightedIndex
+
+// ScrollIndicator.vertical: ScrollIndicator { }
+ }
+ }
+ }
+ //! [popup]
+}
diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml
index d3f6bb65..a05982cc 100644
--- a/src/imports/controls/material/Dial.qml
+++ b/src/imports/controls/material/Dial.qml
@@ -46,6 +46,10 @@ T.Dial {
//! [background]
background: Rectangle {
+ x: control.width / 2 - width / 2
+ y: control.height / 2 - height / 2
+ width: Math.max(64, Math.min(control.width, control.height))
+ height: Math.max(64, Math.min(control.width, control.height))
color: "transparent"
radius: width / 2
@@ -57,11 +61,11 @@ T.Dial {
handle: Rectangle {
id: handleItem
- x: background.width / 2 - handle.width / 2
- y: background.height / 2 - handle.height / 2
+ x: background.x + background.width / 2 - handle.width / 2
+ y: background.y + background.height / 2 - handle.height / 2
transform: [
Translate {
- y: -background.height * 0.35
+ y: -background.height * 0.4 + handle.height / 2
},
Rotation {
angle: control.angle
diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml
index baaa4453..cb00096d 100644
--- a/src/imports/controls/material/Drawer.qml
+++ b/src/imports/controls/material/Drawer.qml
@@ -41,16 +41,10 @@ import Qt.labs.controls.material 1.0
T.Drawer {
id: control
+ parent: T.ApplicationWindow.overlay
width: parent ? parent.width : 0 // TODO: Window.width
height: parent ? parent.height : 0 // TODO: Window.height
- //! [background]
- background: Rectangle {
- color: control.Material.drawerBackgroundColor
- opacity: position * 0.75
- }
- //! [background]
-
// TODO: make this a proper transition
animation: SmoothedAnimation {
velocity: 5
diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml
index de47ff14..cbdc585e 100644
--- a/src/imports/controls/material/GroupBox.qml
+++ b/src/imports/controls/material/GroupBox.qml
@@ -41,7 +41,9 @@ import Qt.labs.controls.material 1.0
T.GroupBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + leftPadding + rightPadding : 0,
+ contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
@@ -49,7 +51,7 @@ T.GroupBox {
spacing: 6
padding: 6
- topPadding: 6 + (label && title ? label.implicitHeight + spacing : 0)
+ topPadding: 6 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
//! [contentItem]
contentItem: Item {}
diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml
index 73a63397..8cd53e88 100644
--- a/src/imports/controls/material/ItemDelegate.qml
+++ b/src/imports/controls/material/ItemDelegate.qml
@@ -48,6 +48,7 @@ T.ItemDelegate {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
Math.max(label ? label.implicitHeight : 0,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: label ? label.y + label.baselineOffset : 0
padding: 16
spacing: 16
@@ -146,6 +147,7 @@ T.ItemDelegate {
//! [background]
background: Rectangle {
+ visible: control.pressed || control.highlighted
color: control.pressed ? control.Material.flatButtonPressColor : control.Material.backgroundColor
}
//! [background]
diff --git a/src/imports/controls/material/Menu.qml b/src/imports/controls/material/Menu.qml
new file mode 100644
index 00000000..4523fc26
--- /dev/null
+++ b/src/imports/controls/material/Menu.qml
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.material 1.0
+import QtGraphicalEffects 1.0
+
+T.Menu {
+ id: control
+
+ enter: Transition {
+ // grow_fade_in
+ NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ exit: Transition {
+ // shrink_fade_out
+ NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ //! [contentItem]
+ contentItem: Item {
+ implicitWidth: 200
+ implicitHeight: Math.min(listview.contentHeight, 200)
+ transformOrigin: Item.Top
+
+ Rectangle {
+ id: panel
+ width: parent.width
+ height: parent.height
+ color: control.Material.dialogColor
+ }
+
+ DropShadow {
+ source: panel
+ width: parent.width
+ height: parent.height
+ verticalOffset: 1
+ color: control.Material.dropShadowColor
+ samples: 15
+ spread: 0.5
+ }
+
+ ListView {
+ id: listview
+ width: parent.width
+ height: parent.height
+ model: control.contentModel
+ // TODO: improve this?
+ interactive: ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false
+ clip: true
+ keyNavigationWraps: false
+ currentIndex: -1
+
+ ScrollIndicator.vertical: ScrollIndicator {}
+ }
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml
new file mode 100644
index 00000000..f9c69291
--- /dev/null
+++ b/src/imports/controls/material/MenuItem.qml
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.material 1.0
+
+T.MenuItem {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ (label ? label.implicitWidth : 0) +
+ (indicator ? indicator.implicitWidth : 0) +
+ (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(label ? label.implicitHeight : 0,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: label ? label.y + label.baselineOffset : 0
+
+ padding: 16
+ spacing: 16
+
+ //! [indicator]
+ indicator: Rectangle {
+ id: indicatorItem
+ x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ implicitWidth: 20
+ implicitHeight: 20
+ color: "transparent"
+ border.color: control.checked ? control.Material.accentColor : control.Material.secondaryTextColor
+ border.width: control.checked ? width / 2 : 2
+ radius: 2
+
+ visible: control.checkable
+
+ Behavior on border.width {
+ NumberAnimation {
+ duration: 100
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ Behavior on border.color {
+ ColorAnimation {
+ duration: 100
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ Ripple {
+ width: parent.width
+ height: width
+ control: control
+ colored: control.checked
+ opacity: control.pressed ? 1 : 0
+ }
+
+ // TODO: This needs to be transparent
+ Image {
+ id: checkImage
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 16
+ height: 16
+ source: "qrc:/qt-project.org/imports/Qt/labs/controls/material/images/check.png"
+ fillMode: Image.PreserveAspectFit
+
+ scale: control.checked ? 1 : 0
+ Behavior on scale { NumberAnimation { duration: 100 } }
+ }
+
+ states: State {
+ name: "checked"
+ when: control.checked
+ }
+
+ transitions: Transition {
+ SequentialAnimation {
+ NumberAnimation {
+ target: indicatorItem
+ property: "scale"
+ // Go down 2 pixels in size.
+ to: 1 - 2 / indicatorItem.width
+ duration: 120
+ }
+ NumberAnimation {
+ target: indicatorItem
+ property: "scale"
+ to: 1
+ duration: 120
+ }
+ }
+ }
+ }
+ //! [indicator]
+
+ //! [label]
+ label: Text {
+ x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
+ y: control.topPadding
+ width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+ //! [label]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 200
+ visible: control.pressed || control.highlighted
+ color: control.pressed ? control.Material.flatButtonPressColor : control.Material.backgroundColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml
new file mode 100644
index 00000000..abb94808
--- /dev/null
+++ b/src/imports/controls/material/Pane.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.material 1.0
+
+T.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 6
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ color: control.Material.backgroundColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml
new file mode 100644
index 00000000..40531c61
--- /dev/null
+++ b/src/imports/controls/material/Popup.qml
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+
+T.Popup {
+ id: control
+
+ enter: Transition {
+ // grow_fade_in
+ NumberAnimation { property: "scale"; from: 0.9; to: 1.0; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+
+ exit: Transition {
+ // shrink_fade_out
+ NumberAnimation { property: "scale"; from: 1.0; to: 0.9; easing.type: Easing.OutQuint; duration: 220 }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; easing.type: Easing.OutCubic; duration: 150 }
+ }
+}
diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml
index 3020efae..be51d06c 100644
--- a/src/imports/controls/material/SpinBox.qml
+++ b/src/imports/controls/material/SpinBox.qml
@@ -50,6 +50,7 @@ T.SpinBox {
background ? background.implicitHeight : 0,
up.indicator ? up.indicator.implicitHeight : 0,
down.indicator ? down.indicator.implicitHeight : 0)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
leftPadding: 6 + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
diff --git a/src/imports/controls/material/StackView.qml b/src/imports/controls/material/StackView.qml
index c4ed33e5..776188e6 100644
--- a/src/imports/controls/material/StackView.qml
+++ b/src/imports/controls/material/StackView.qml
@@ -42,37 +42,49 @@ T.StackView {
//! [popEnter]
popEnter: Transition {
- XAnimator { from: -root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ // slide_in_left
+ NumberAnimation { property: "x"; from: 0.5 * -root.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
//! [popEnter]
//! [popExit]
popExit: Transition {
- XAnimator { from: 0; to: root.width; duration: 400; easing.type: Easing.OutCubic }
+ // slide_out_right
+ NumberAnimation { property: "x"; from: 0; to: 0.5 * root.width; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
//! [popExit]
//! [pushEnter]
pushEnter: Transition {
- XAnimator { from: root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ // slide_in_right
+ NumberAnimation { property: "x"; from: 0.5 * root.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
//! [pushEnter]
//! [pushExit]
pushExit: Transition {
- XAnimator { from: 0; to: -root.width; duration: 400; easing.type: Easing.OutCubic }
+ // slide_out_left
+ NumberAnimation { property: "x"; from: 0; to: 0.5 * -root.width; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
//! [pushExit]
//! [replaceEnter]
replaceEnter: Transition {
- XAnimator { from: root.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
+ // slide_in_right
+ NumberAnimation { property: "x"; from: 0.5 * root.width; to: 0; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 200; easing.type: Easing.OutCubic }
}
//! [replaceEnter]
//! [replaceExit]
replaceExit: Transition {
- XAnimator { from: 0; to: -root.width; duration: 400; easing.type: Easing.OutCubic }
+ // slide_out_left
+ NumberAnimation { property: "x"; from: 0; to: 0.5 * -root.width; duration: 200; easing.type: Easing.OutCubic }
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 200; easing.type: Easing.OutCubic }
}
//! [replaceExit]
}
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index 6e612d40..d2658de6 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -89,12 +89,6 @@ T.Switch {
radius: width / 2
color: control.enabled ? (control.checked ? control.Material.switchCheckedHandleColor : control.Material.switchUncheckedHandleColor)
: control.Material.switchDisabledHandleColor
- layer.enabled: true
- layer.effect: DropShadow {
- verticalOffset: 1
- color: control.Material.dropShadowColor
- spread: 0.3
- }
Behavior on x {
enabled: !control.pressed
@@ -103,6 +97,18 @@ T.Switch {
}
}
}
+
+ DropShadow {
+ x: handle.x
+ y: handle.y
+ width: handle.width
+ height: handle.height
+ source: handle
+ verticalOffset: 1
+ color: control.Material.dropShadowColor
+ spread: 0.3
+ }
+
}
//! [indicator]
diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml
index 67473744..22dcd7a0 100644
--- a/src/imports/controls/material/TabButton.qml
+++ b/src/imports/controls/material/TabButton.qml
@@ -42,9 +42,9 @@ T.TabButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- label ? label.implicitWidth + leftPadding + rightPadding : 0)
+ label ? label.contentWidth + leftPadding + rightPadding : 0)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- label ? label.implicitHeight + topPadding + bottomPadding : 0)
+ label ? label.contentHeight + topPadding + bottomPadding : 0)
baselineOffset: label ? label.y + label.baselineOffset : 0
padding: 6
diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml
index 59a0e599..50a4ac67 100644
--- a/src/imports/controls/material/ToolBar.qml
+++ b/src/imports/controls/material/ToolBar.qml
@@ -36,12 +36,13 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.material 1.0
T.ToolBar {
id: control
- implicitWidth: contentWidth + leftPadding + rightPadding
- implicitHeight: Math.max(26, contentHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
@@ -49,4 +50,11 @@ T.ToolBar {
//! [contentItem]
contentItem: Item { }
//! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ implicitHeight: 40
+ color: control.Material.accentColor
+ }
+ //! [background]
}
diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml
index 4f72f4ef..e097f8e0 100644
--- a/src/imports/controls/material/ToolButton.qml
+++ b/src/imports/controls/material/ToolButton.qml
@@ -67,12 +67,11 @@ T.ToolButton {
//! [background]
background: Rectangle {
- implicitWidth: 26
- implicitHeight: 26
+ implicitWidth: 40
+ implicitHeight: 40
- color: control.activeFocus || (control.checkable && control.checked)
- ? control.Material.flatButtonFocusColor : control.Material.flatButtonPressColor
- visible: control.pressed || control.activeFocus || (control.checkable && control.checked)
+ color: control.pressed ? control.Material.flatButtonPressColor : control.Material.flatButtonFocusColor
+ visible: control.enabled && (control.pressed || control.activeFocus || control.checked || control.highlighted)
}
//! [background]
}
diff --git a/src/imports/controls/material/images/drop-indicator.png b/src/imports/controls/material/images/drop-indicator.png
new file mode 100644
index 00000000..b4396ec6
--- /dev/null
+++ b/src/imports/controls/material/images/drop-indicator.png
Binary files differ
diff --git a/src/imports/controls/material/images/drop-indicator@2x.png b/src/imports/controls/material/images/drop-indicator@2x.png
new file mode 100644
index 00000000..1c711bc2
--- /dev/null
+++ 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
new file mode 100644
index 00000000..06dd8bd2
--- /dev/null
+++ 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
new file mode 100644
index 00000000..b2157c30
--- /dev/null
+++ b/src/imports/controls/material/images/drop-indicator@4x.png
Binary files differ
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index a238dcfe..bc5f85d1 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -13,13 +13,18 @@ QML_FILES += \
$$PWD/BusyIndicator.qml \
$$PWD/Button.qml \
$$PWD/CheckBox.qml \
+ $$PWD/ComboBox.qml \
$$PWD/Dial.qml \
$$PWD/Drawer.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
+ $$PWD/Menu.qml \
+ $$PWD/MenuItem.qml \
+ $$PWD/Pane.qml \
$$PWD/PageIndicator.qml \
+ $$PWD/Popup.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
$$PWD/RangeSlider.qml \
diff --git a/src/imports/controls/material/qquickmaterialprogressring.cpp b/src/imports/controls/material/qquickmaterialprogressring.cpp
index 9953266d..7f7ed114 100644
--- a/src/imports/controls/material/qquickmaterialprogressring.cpp
+++ b/src/imports/controls/material/qquickmaterialprogressring.cpp
@@ -274,7 +274,4 @@ void QQuickMaterialRingTexture::setColor(QColor color)
m_color = color;
}
-Q_DECLARE_TYPEINFO(QQuickMaterialRingAnimatorJob, Q_COMPLEX_TYPE);
-Q_DECLARE_TYPEINFO(QQuickMaterialRingTexture, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialprogressring_p.h b/src/imports/controls/material/qquickmaterialprogressring_p.h
index 17845a66..6f4ebc6b 100644
--- a/src/imports/controls/material/qquickmaterialprogressring_p.h
+++ b/src/imports/controls/material/qquickmaterialprogressring_p.h
@@ -86,9 +86,8 @@ protected:
QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
};
-Q_DECLARE_TYPEINFO(QQuickMaterialProgressRing, Q_COMPLEX_TYPE);
-Q_DECLARE_TYPEINFO(QQuickMaterialRingAnimator, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickMaterialProgressRing)
+
#endif // QQUICKMATERIALPROGRESSRING_P_H
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index a3d2329a..67519008 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -36,6 +36,7 @@
#include "qquickmaterialstyle_p.h"
+#include <QtCore/qsettings.h>
#include <QtLabsControls/private/qquickstyle_p.h>
QT_BEGIN_NAMESPACE
@@ -55,375 +56,372 @@ QT_BEGIN_NAMESPACE
\qmlattachedproperty color QtQuickControls2::Material::textColorPrimaray
*/
-static const QColor colors[][14] = {
+static const QRgb colors[][14] = {
// Red
{
- "#FFEBEE", // Shade50
- "#FFCDD2", // Shade100
- "#EF9A9A", // Shade200
- "#E57373", // Shade300
- "#EF5350", // Shade400
- "#F44336", // Shade500
- "#E53935", // Shade600
- "#D32F2F", // Shade700
- "#C62828", // Shade800
- "#B71C1C", // Shade900
- "#FF8A80", // ShadeA100
- "#FF5252", // ShadeA200
- "#FF1744", // ShadeA400
- "#D50000" // ShadeA700
+ 0xFFEBEE, // Shade50
+ 0xFFCDD2, // Shade100
+ 0xEF9A9A, // Shade200
+ 0xE57373, // Shade300
+ 0xEF5350, // Shade400
+ 0xF44336, // Shade500
+ 0xE53935, // Shade600
+ 0xD32F2F, // Shade700
+ 0xC62828, // Shade800
+ 0xB71C1C, // Shade900
+ 0xFF8A80, // ShadeA100
+ 0xFF5252, // ShadeA200
+ 0xFF1744, // ShadeA400
+ 0xD50000 // ShadeA700
},
// Pink
{
- "#FCE4EC", // Shade50
- "#F8BBD0", // Shade100
- "#F48FB1", // Shade200
- "#F06292", // Shade300
- "#EC407A", // Shade400
- "#E91E63", // Shade500
- "#D81B60", // Shade600
- "#C2185B", // Shade700
- "#AD1457", // Shade800
- "#880E4F", // Shade900
- "#FF80AB", // ShadeA100
- "#FF4081", // ShadeA200
- "#F50057", // ShadeA400
- "#C51162" // ShadeA700
+ 0xFCE4EC, // Shade50
+ 0xF8BBD0, // Shade100
+ 0xF48FB1, // Shade200
+ 0xF06292, // Shade300
+ 0xEC407A, // Shade400
+ 0xE91E63, // Shade500
+ 0xD81B60, // Shade600
+ 0xC2185B, // Shade700
+ 0xAD1457, // Shade800
+ 0x880E4F, // Shade900
+ 0xFF80AB, // ShadeA100
+ 0xFF4081, // ShadeA200
+ 0xF50057, // ShadeA400
+ 0xC51162 // ShadeA700
},
// Purple
{
- "#F3E5F5", // Shade50
- "#E1BEE7", // Shade100
- "#CE93D8", // Shade200
- "#BA68C8", // Shade300
- "#AB47BC", // Shade400
- "#9C27B0", // Shade500
- "#8E24AA", // Shade600
- "#7B1FA2", // Shade700
- "#6A1B9A", // Shade800
- "#4A148C", // Shade900
- "#EA80FC", // ShadeA100
- "#E040FB", // ShadeA200
- "#D500F9", // ShadeA400
- "#AA00FF" // ShadeA700
+ 0xF3E5F5, // Shade50
+ 0xE1BEE7, // Shade100
+ 0xCE93D8, // Shade200
+ 0xBA68C8, // Shade300
+ 0xAB47BC, // Shade400
+ 0x9C27B0, // Shade500
+ 0x8E24AA, // Shade600
+ 0x7B1FA2, // Shade700
+ 0x6A1B9A, // Shade800
+ 0x4A148C, // Shade900
+ 0xEA80FC, // ShadeA100
+ 0xE040FB, // ShadeA200
+ 0xD500F9, // ShadeA400
+ 0xAA00FF // ShadeA700
},
// DeepPurple
{
- "#EDE7F6", // Shade50
- "#D1C4E9", // Shade100
- "#B39DDB", // Shade200
- "#9575CD", // Shade300
- "#7E57C2", // Shade400
- "#673AB7", // Shade500
- "#5E35B1", // Shade600
- "#512DA8", // Shade700
- "#4527A0", // Shade800
- "#311B92", // Shade900
- "#B388FF", // ShadeA100
- "#7C4DFF", // ShadeA200
- "#651FFF", // ShadeA400
- "#6200EA" // ShadeA700
+ 0xEDE7F6, // Shade50
+ 0xD1C4E9, // Shade100
+ 0xB39DDB, // Shade200
+ 0x9575CD, // Shade300
+ 0x7E57C2, // Shade400
+ 0x673AB7, // Shade500
+ 0x5E35B1, // Shade600
+ 0x512DA8, // Shade700
+ 0x4527A0, // Shade800
+ 0x311B92, // Shade900
+ 0xB388FF, // ShadeA100
+ 0x7C4DFF, // ShadeA200
+ 0x651FFF, // ShadeA400
+ 0x6200EA // ShadeA700
},
// Indigo
{
- "#E8EAF6", // Shade50
- "#C5CAE9", // Shade100
- "#9FA8DA", // Shade200
- "#7986CB", // Shade300
- "#5C6BC0", // Shade400
- "#3F51B5", // Shade500
- "#3949AB", // Shade600
- "#303F9F", // Shade700
- "#283593", // Shade800
- "#1A237E", // Shade900
- "#8C9EFF", // ShadeA100
- "#536DFE", // ShadeA200
- "#3D5AFE", // ShadeA400
- "#304FFE" // ShadeA700
+ 0xE8EAF6, // Shade50
+ 0xC5CAE9, // Shade100
+ 0x9FA8DA, // Shade200
+ 0x7986CB, // Shade300
+ 0x5C6BC0, // Shade400
+ 0x3F51B5, // Shade500
+ 0x3949AB, // Shade600
+ 0x303F9F, // Shade700
+ 0x283593, // Shade800
+ 0x1A237E, // Shade900
+ 0x8C9EFF, // ShadeA100
+ 0x536DFE, // ShadeA200
+ 0x3D5AFE, // ShadeA400
+ 0x304FFE // ShadeA700
},
// Blue
{
- "#E3F2FD", // Shade50
- "#BBDEFB", // Shade100
- "#90CAF9", // Shade200
- "#64B5F6", // Shade300
- "#42A5F5", // Shade400
- "#2196F3", // Shade500
- "#1E88E5", // Shade600
- "#1976D2", // Shade700
- "#1565C0", // Shade800
- "#0D47A1", // Shade900
- "#82B1FF", // ShadeA100
- "#448AFF", // ShadeA200
- "#2979FF", // ShadeA400
- "#2962FF" // ShadeA700
+ 0xE3F2FD, // Shade50
+ 0xBBDEFB, // Shade100
+ 0x90CAF9, // Shade200
+ 0x64B5F6, // Shade300
+ 0x42A5F5, // Shade400
+ 0x2196F3, // Shade500
+ 0x1E88E5, // Shade600
+ 0x1976D2, // Shade700
+ 0x1565C0, // Shade800
+ 0x0D47A1, // Shade900
+ 0x82B1FF, // ShadeA100
+ 0x448AFF, // ShadeA200
+ 0x2979FF, // ShadeA400
+ 0x2962FF // ShadeA700
},
// LightBlue
{
- "#E1F5FE", // Shade50
- "#B3E5FC", // Shade100
- "#81D4FA", // Shade200
- "#4FC3F7", // Shade300
- "#29B6F6", // Shade400
- "#03A9F4", // Shade500
- "#039BE5", // Shade600
- "#0288D1", // Shade700
- "#0277BD", // Shade800
- "#01579B", // Shade900
- "#80D8FF", // ShadeA100
- "#40C4FF", // ShadeA200
- "#00B0FF", // ShadeA400
- "#0091EA" // ShadeA700
+ 0xE1F5FE, // Shade50
+ 0xB3E5FC, // Shade100
+ 0x81D4FA, // Shade200
+ 0x4FC3F7, // Shade300
+ 0x29B6F6, // Shade400
+ 0x03A9F4, // Shade500
+ 0x039BE5, // Shade600
+ 0x0288D1, // Shade700
+ 0x0277BD, // Shade800
+ 0x01579B, // Shade900
+ 0x80D8FF, // ShadeA100
+ 0x40C4FF, // ShadeA200
+ 0x00B0FF, // ShadeA400
+ 0x0091EA // ShadeA700
},
// Cyan
{
- "#E0F7FA", // Shade50
- "#B2EBF2", // Shade100
- "#80DEEA", // Shade200
- "#4DD0E1", // Shade300
- "#26C6DA", // Shade400
- "#00BCD4", // Shade500
- "#00ACC1", // Shade600
- "#0097A7", // Shade700
- "#00838F", // Shade800
- "#006064", // Shade900
- "#84FFFF", // ShadeA100
- "#18FFFF", // ShadeA200
- "#00E5FF", // ShadeA400
- "#00B8D4" // ShadeA700
+ 0xE0F7FA, // Shade50
+ 0xB2EBF2, // Shade100
+ 0x80DEEA, // Shade200
+ 0x4DD0E1, // Shade300
+ 0x26C6DA, // Shade400
+ 0x00BCD4, // Shade500
+ 0x00ACC1, // Shade600
+ 0x0097A7, // Shade700
+ 0x00838F, // Shade800
+ 0x006064, // Shade900
+ 0x84FFFF, // ShadeA100
+ 0x18FFFF, // ShadeA200
+ 0x00E5FF, // ShadeA400
+ 0x00B8D4 // ShadeA700
},
// Teal
{
- "#E0F2F1", // Shade50
- "#B2DFDB", // Shade100
- "#80CBC4", // Shade200
- "#4DB6AC", // Shade300
- "#26A69A", // Shade400
- "#009688", // Shade500
- "#00897B", // Shade600
- "#00796B", // Shade700
- "#00695C", // Shade800
- "#004D40", // Shade900
- "#A7FFEB", // ShadeA100
- "#64FFDA", // ShadeA200
- "#1DE9B6", // ShadeA400
- "#00BFA5" // ShadeA700
+ 0xE0F2F1, // Shade50
+ 0xB2DFDB, // Shade100
+ 0x80CBC4, // Shade200
+ 0x4DB6AC, // Shade300
+ 0x26A69A, // Shade400
+ 0x009688, // Shade500
+ 0x00897B, // Shade600
+ 0x00796B, // Shade700
+ 0x00695C, // Shade800
+ 0x004D40, // Shade900
+ 0xA7FFEB, // ShadeA100
+ 0x64FFDA, // ShadeA200
+ 0x1DE9B6, // ShadeA400
+ 0x00BFA5 // ShadeA700
},
// Green
{
- "#E8F5E9", // Shade50
- "#C8E6C9", // Shade100
- "#A5D6A7", // Shade200
- "#81C784", // Shade300
- "#66BB6A", // Shade400
- "#4CAF50", // Shade500
- "#43A047", // Shade600
- "#388E3C", // Shade700
- "#2E7D32", // Shade800
- "#1B5E20", // Shade900
- "#B9F6CA", // ShadeA100
- "#69F0AE", // ShadeA200
- "#00E676", // ShadeA400
- "#00C853" // ShadeA700
+ 0xE8F5E9, // Shade50
+ 0xC8E6C9, // Shade100
+ 0xA5D6A7, // Shade200
+ 0x81C784, // Shade300
+ 0x66BB6A, // Shade400
+ 0x4CAF50, // Shade500
+ 0x43A047, // Shade600
+ 0x388E3C, // Shade700
+ 0x2E7D32, // Shade800
+ 0x1B5E20, // Shade900
+ 0xB9F6CA, // ShadeA100
+ 0x69F0AE, // ShadeA200
+ 0x00E676, // ShadeA400
+ 0x00C853 // ShadeA700
},
// LightGreen
{
- "#F1F8E9", // Shade50
- "#DCEDC8", // Shade100
- "#C5E1A5", // Shade200
- "#AED581", // Shade300
- "#9CCC65", // Shade400
- "#8BC34A", // Shade500
- "#7CB342", // Shade600
- "#689F38", // Shade700
- "#558B2F", // Shade800
- "#33691E", // Shade900
- "#CCFF90", // ShadeA100
- "#B2FF59", // ShadeA200
- "#76FF03", // ShadeA400
- "#64DD17" // ShadeA700
+ 0xF1F8E9, // Shade50
+ 0xDCEDC8, // Shade100
+ 0xC5E1A5, // Shade200
+ 0xAED581, // Shade300
+ 0x9CCC65, // Shade400
+ 0x8BC34A, // Shade500
+ 0x7CB342, // Shade600
+ 0x689F38, // Shade700
+ 0x558B2F, // Shade800
+ 0x33691E, // Shade900
+ 0xCCFF90, // ShadeA100
+ 0xB2FF59, // ShadeA200
+ 0x76FF03, // ShadeA400
+ 0x64DD17 // ShadeA700
},
// Lime
{
- "#F9FBE7", // Shade50
- "#F0F4C3", // Shade100
- "#E6EE9C", // Shade200
- "#DCE775", // Shade300
- "#D4E157", // Shade400
- "#CDDC39", // Shade500
- "#C0CA33", // Shade600
- "#AFB42B", // Shade700
- "#9E9D24", // Shade800
- "#827717", // Shade900
- "#F4FF81", // ShadeA100
- "#EEFF41", // ShadeA200
- "#C6FF00", // ShadeA400
- "#AEEA00" // ShadeA700
+ 0xF9FBE7, // Shade50
+ 0xF0F4C3, // Shade100
+ 0xE6EE9C, // Shade200
+ 0xDCE775, // Shade300
+ 0xD4E157, // Shade400
+ 0xCDDC39, // Shade500
+ 0xC0CA33, // Shade600
+ 0xAFB42B, // Shade700
+ 0x9E9D24, // Shade800
+ 0x827717, // Shade900
+ 0xF4FF81, // ShadeA100
+ 0xEEFF41, // ShadeA200
+ 0xC6FF00, // ShadeA400
+ 0xAEEA00 // ShadeA700
},
// Yellow
{
- "#FFFDE7", // Shade50
- "#FFF9C4", // Shade100
- "#FFF59D", // Shade200
- "#FFF176", // Shade300
- "#FFEE58", // Shade400
- "#FFEB3B", // Shade500
- "#FDD835", // Shade600
- "#FBC02D", // Shade700
- "#F9A825", // Shade800
- "#F57F17", // Shade900
- "#FFFF8D", // ShadeA100
- "#FFFF00", // ShadeA200
- "#FFEA00", // ShadeA400
- "#FFD600" // ShadeA700
+ 0xFFFDE7, // Shade50
+ 0xFFF9C4, // Shade100
+ 0xFFF59D, // Shade200
+ 0xFFF176, // Shade300
+ 0xFFEE58, // Shade400
+ 0xFFEB3B, // Shade500
+ 0xFDD835, // Shade600
+ 0xFBC02D, // Shade700
+ 0xF9A825, // Shade800
+ 0xF57F17, // Shade900
+ 0xFFFF8D, // ShadeA100
+ 0xFFFF00, // ShadeA200
+ 0xFFEA00, // ShadeA400
+ 0xFFD600 // ShadeA700
},
// Amber
{
- "#FFF8E1", // Shade50
- "#FFECB3", // Shade100
- "#FFE082", // Shade200
- "#FFD54F", // Shade300
- "#FFCA28", // Shade400
- "#FFC107", // Shade500
- "#FFB300", // Shade600
- "#FFA000", // Shade700
- "#FF8F00", // Shade800
- "#FF6F00", // Shade900
- "#FFE57F", // ShadeA100
- "#FFD740", // ShadeA200
- "#FFC400", // ShadeA400
- "#FFAB00" // ShadeA700
+ 0xFFF8E1, // Shade50
+ 0xFFECB3, // Shade100
+ 0xFFE082, // Shade200
+ 0xFFD54F, // Shade300
+ 0xFFCA28, // Shade400
+ 0xFFC107, // Shade500
+ 0xFFB300, // Shade600
+ 0xFFA000, // Shade700
+ 0xFF8F00, // Shade800
+ 0xFF6F00, // Shade900
+ 0xFFE57F, // ShadeA100
+ 0xFFD740, // ShadeA200
+ 0xFFC400, // ShadeA400
+ 0xFFAB00 // ShadeA700
},
// Orange
{
- "#FFF3E0", // Shade50
- "#FFE0B2", // Shade100
- "#FFCC80", // Shade200
- "#FFB74D", // Shade300
- "#FFA726", // Shade400
- "#FF9800", // Shade500
- "#FB8C00", // Shade600
- "#F57C00", // Shade700
- "#EF6C00", // Shade800
- "#E65100", // Shade900
- "#FFD180", // ShadeA100
- "#FFAB40", // ShadeA200
- "#FF9100", // ShadeA400
- "#FF6D00" // ShadeA700
+ 0xFFF3E0, // Shade50
+ 0xFFE0B2, // Shade100
+ 0xFFCC80, // Shade200
+ 0xFFB74D, // Shade300
+ 0xFFA726, // Shade400
+ 0xFF9800, // Shade500
+ 0xFB8C00, // Shade600
+ 0xF57C00, // Shade700
+ 0xEF6C00, // Shade800
+ 0xE65100, // Shade900
+ 0xFFD180, // ShadeA100
+ 0xFFAB40, // ShadeA200
+ 0xFF9100, // ShadeA400
+ 0xFF6D00 // ShadeA700
},
// DeepOrange
{
- "#FBE9E7", // Shade50
- "#FFCCBC", // Shade100
- "#FFAB91", // Shade200
- "#FF8A65", // Shade300
- "#FF7043", // Shade400
- "#FF5722", // Shade500
- "#F4511E", // Shade600
- "#E64A19", // Shade700
- "#D84315", // Shade800
- "#BF360C", // Shade900
- "#FF9E80", // ShadeA100
- "#FF6E40", // ShadeA200
- "#FF3D00", // ShadeA400
- "#DD2C00" // ShadeA700
+ 0xFBE9E7, // Shade50
+ 0xFFCCBC, // Shade100
+ 0xFFAB91, // Shade200
+ 0xFF8A65, // Shade300
+ 0xFF7043, // Shade400
+ 0xFF5722, // Shade500
+ 0xF4511E, // Shade600
+ 0xE64A19, // Shade700
+ 0xD84315, // Shade800
+ 0xBF360C, // Shade900
+ 0xFF9E80, // ShadeA100
+ 0xFF6E40, // ShadeA200
+ 0xFF3D00, // ShadeA400
+ 0xDD2C00 // ShadeA700
},
// Brown
{
- "#EFEBE9", // Shade50
- "#D7CCC8", // Shade100
- "#BCAAA4", // Shade200
- "#A1887F", // Shade300
- "#8D6E63", // Shade400
- "#795548", // Shade500
- "#6D4C41", // Shade600
- "#5D4037", // Shade700
- "#4E342E", // Shade800
- "#3E2723", // Shade900
- "#000000", // ShadeA100
- "#000000", // ShadeA200
- "#000000", // ShadeA400
- "#000000" // ShadeA700
+ 0xEFEBE9, // Shade50
+ 0xD7CCC8, // Shade100
+ 0xBCAAA4, // Shade200
+ 0xA1887F, // Shade300
+ 0x8D6E63, // Shade400
+ 0x795548, // Shade500
+ 0x6D4C41, // Shade600
+ 0x5D4037, // Shade700
+ 0x4E342E, // Shade800
+ 0x3E2723, // Shade900
+ 0x000000, // ShadeA100
+ 0x000000, // ShadeA200
+ 0x000000, // ShadeA400
+ 0x000000 // ShadeA700
},
// Grey
{
- "#FAFAFA", // Shade50
- "#F5F5F5", // Shade100
- "#EEEEEE", // Shade200
- "#E0E0E0", // Shade300
- "#BDBDBD", // Shade400
- "#9E9E9E", // Shade500
- "#757575", // Shade600
- "#616161", // Shade700
- "#424242", // Shade800
- "#212121", // Shade900
- "#000000", // ShadeA100
- "#000000", // ShadeA200
- "#000000", // ShadeA400
- "#000000" // ShadeA700
+ 0xFAFAFA, // Shade50
+ 0xF5F5F5, // Shade100
+ 0xEEEEEE, // Shade200
+ 0xE0E0E0, // Shade300
+ 0xBDBDBD, // Shade400
+ 0x9E9E9E, // Shade500
+ 0x757575, // Shade600
+ 0x616161, // Shade700
+ 0x424242, // Shade800
+ 0x212121, // Shade900
+ 0x000000, // ShadeA100
+ 0x000000, // ShadeA200
+ 0x000000, // ShadeA400
+ 0x000000 // ShadeA700
},
// BlueGrey
{
- "#ECEFF1", // Shade50
- "#CFD8DC", // Shade100
- "#B0BEC5", // Shade200
- "#90A4AE", // Shade300
- "#78909C", // Shade400
- "#607D8B", // Shade500
- "#546E7A", // Shade600
- "#455A64", // Shade700
- "#37474F", // Shade800
- "#263238", // Shade900
- "#000000", // ShadeA100
- "#000000", // ShadeA200
- "#000000", // ShadeA400
- "#000000" // ShadeA700
+ 0xECEFF1, // Shade50
+ 0xCFD8DC, // Shade100
+ 0xB0BEC5, // Shade200
+ 0x90A4AE, // Shade300
+ 0x78909C, // Shade400
+ 0x607D8B, // Shade500
+ 0x546E7A, // Shade600
+ 0x455A64, // Shade700
+ 0x37474F, // Shade800
+ 0x263238, // Shade900
+ 0x000000, // ShadeA100
+ 0x000000, // ShadeA200
+ 0x000000, // ShadeA400
+ 0x000000 // ShadeA700
}
};
-static const QQuickMaterialStyle::Theme defaultTheme = QQuickMaterialStyle::Light;
-static const QQuickMaterialStyle::Color defaultPrimary = QQuickMaterialStyle::BlueGrey;
-static const QQuickMaterialStyle::Color defaultAccent = QQuickMaterialStyle::Teal;
-static const QColor backgroundColorLight = "#FFFAFAFA";
-static const QColor backgroundColorDark = "#FF303030";
-static const QColor dialogColorLight = "#FFFFFFFF";
-static const QColor dialogColorDark = "#FF303030";
-static const QColor primaryTextColorLight = "#DD000000";
-static const QColor primaryTextColorDark = "#FFFFFFFF";
-static const QColor secondaryTextColorLight = "#89000000";
-static const QColor secondaryTextColorDark = "#B2FFFFFF";
-static const QColor hintTextColorLight = "#60000000";
-static const QColor hintTextColorDark = "#4CFFFFFF";
-static const QColor dividerTextColorLight = "#1E000000";
-static const QColor dividerTextColorDark = "#1EFFFFFF";
-static const QColor raisedButtonColorLight = "#FFD6D7D7";
+static QQuickMaterialStyle::Theme defaultTheme = QQuickMaterialStyle::Light;
+static QQuickMaterialStyle::Color defaultAccent = QQuickMaterialStyle::Teal;
+static const QRgb backgroundColorLight = 0xFFFAFAFA;
+static const QRgb backgroundColorDark = 0xFF303030;
+static const QRgb dialogColorLight = 0xFFFFFFFF;
+static const QRgb dialogColorDark = 0xFF303030;
+static const QRgb primaryTextColorLight = 0xDD000000;
+static const QRgb primaryTextColorDark = 0xFFFFFFFF;
+static const QRgb secondaryTextColorLight = 0x89000000;
+static const QRgb secondaryTextColorDark = 0xB2FFFFFF;
+static const QRgb hintTextColorLight = 0x60000000;
+static const QRgb hintTextColorDark = 0x4CFFFFFF;
+static const QRgb dividerTextColorLight = 0x1E000000;
+static const QRgb dividerTextColorDark = 0x1EFFFFFF;
+static const QRgb raisedButtonColorLight = 0xFFD6D7D7;
// TODO: find out actual value
-static const QColor raisedButtonPressColorLight = "#FFCCCDCD";
-static const QColor raisedButtonDisabledColorLight = dividerTextColorLight;
-static const QColor raisedButtonDisabledColorDark = dividerTextColorDark;
-static const QColor flatButtonPressColorLight = "#66999999";
-static const QColor flatButtonPressColorDark = "#3FCCCCCC";
-static const QColor flatButtonFocusColorLight = "#33CCCCCC";
-static const QColor flatButtonFocusColorDark = "#26CCCCCC";
-static const QColor frameColorLight = hintTextColorLight;
-static const QColor frameColorDark = hintTextColorDark;
-static const QColor switchUncheckedTrackColorLight = "#42000000";
-static const QColor switchUncheckedTrackColorDark = "#4CFFFFFF";
-static const QColor switchDisabledTrackColorLight = "#1E000000";
-static const QColor switchDisabledTrackColorDark = "#19FFFFFF";
+static const QRgb raisedButtonPressColorLight = 0xFFCCCDCD;
+static const QRgb raisedButtonDisabledColorLight = dividerTextColorLight;
+static const QRgb raisedButtonDisabledColorDark = dividerTextColorDark;
+static const QRgb flatButtonPressColorLight = 0x66999999;
+static const QRgb flatButtonPressColorDark = 0x3FCCCCCC;
+static const QRgb flatButtonFocusColorLight = 0x33CCCCCC;
+static const QRgb flatButtonFocusColorDark = 0x26CCCCCC;
+static const QRgb frameColorLight = hintTextColorLight;
+static const QRgb frameColorDark = hintTextColorDark;
+static const QRgb switchUncheckedTrackColorLight = 0x42000000;
+static const QRgb switchUncheckedTrackColorDark = 0x4CFFFFFF;
+static const QRgb switchDisabledTrackColorLight = 0x1E000000;
+static const QRgb switchDisabledTrackColorDark = 0x19FFFFFF;
// TODO: find out actual values
-static const QColor checkBoxUncheckedRippleColorLight = "#10000000";
-static const QColor checkBoxUncheckedRippleColorDark = "#20FFFFFF";
+static const QRgb checkBoxUncheckedRippleColorLight = 0x10000000;
+static const QRgb checkBoxUncheckedRippleColorDark = 0x20FFFFFF;
QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickStyle(parent),
m_explicitTheme(false),
- m_explicitPrimary(false),
m_explicitAccent(false),
m_theme(defaultTheme),
- m_primary(defaultPrimary),
m_accent(defaultAccent)
{
- init(); // TODO: lazy init?
+ init();
}
QQuickMaterialStyle *QQuickMaterialStyle::qmlAttachedProperties(QObject *object)
@@ -475,49 +473,6 @@ void QQuickMaterialStyle::resetTheme()
}
}
-QQuickMaterialStyle::Color QQuickMaterialStyle::primary() const
-{
- return m_primary;
-}
-
-void QQuickMaterialStyle::setPrimary(QQuickMaterialStyle::Color color)
-{
- m_explicitPrimary = true;
- if (m_primary != color) {
- m_primary = color;
- propagatePrimary();
- emit primaryChanged();
- emit paletteChanged();
- }
-}
-
-void QQuickMaterialStyle::inheritPrimary(QQuickMaterialStyle::Color color)
-{
- if (!m_explicitPrimary && m_primary != color) {
- m_primary = color;
- propagatePrimary();
- emit primaryChanged();
- }
-}
-
-void QQuickMaterialStyle::propagatePrimary()
-{
- foreach (QQuickStyle *child, childStyles()) {
- QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(child);
- if (material)
- material->inheritPrimary(m_primary);
- }
-}
-
-void QQuickMaterialStyle::resetPrimary()
-{
- if (m_explicitPrimary) {
- m_explicitPrimary = false;
- QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(parentStyle());
- inheritPrimary(material ? material->primary() : defaultPrimary);
- }
-}
-
QQuickMaterialStyle::Color QQuickMaterialStyle::accent() const
{
return m_accent;
@@ -568,27 +523,27 @@ QColor QQuickMaterialStyle::accentColor() const
QColor QQuickMaterialStyle::backgroundColor() const
{
- return m_theme == Light ? backgroundColorLight : backgroundColorDark;
+ return QColor::fromRgba(m_theme == Light ? backgroundColorLight : backgroundColorDark);
}
QColor QQuickMaterialStyle::primaryTextColor() const
{
- return m_theme == Light ? primaryTextColorLight : primaryTextColorDark;
+ return QColor::fromRgba(m_theme == Light ? primaryTextColorLight : primaryTextColorDark);
}
QColor QQuickMaterialStyle::primaryHighlightedTextColor() const
{
- return primaryTextColorDark;
+ return QColor::fromRgba(primaryTextColorDark);
}
QColor QQuickMaterialStyle::secondaryTextColor() const
{
- return m_theme == Light ? secondaryTextColorLight : secondaryTextColorDark;
+ return QColor::fromRgba(m_theme == Light ? secondaryTextColorLight : secondaryTextColorDark);
}
QColor QQuickMaterialStyle::hintTextColor() const
{
- return m_theme == Light ? hintTextColorLight : hintTextColorDark;
+ return QColor::fromRgba(m_theme == Light ? hintTextColorLight : hintTextColorDark);
}
QColor QQuickMaterialStyle::textSelectionColor() const
@@ -600,33 +555,33 @@ QColor QQuickMaterialStyle::textSelectionColor() const
QColor QQuickMaterialStyle::dropShadowColor() const
{
- return QColor("#40000000");
+ return QColor::fromRgba(0x40000000);
}
QColor QQuickMaterialStyle::dividerColor() const
{
- return m_theme == Light ? dividerTextColorLight : dividerTextColorDark;
+ return QColor::fromRgba(m_theme == Light ? dividerTextColorLight : dividerTextColorDark);
}
QColor QQuickMaterialStyle::raisedButtonColor() const
{
- return m_theme == Light ? raisedButtonColorLight : flatButtonFocusColorDark;
+ return QColor::fromRgba(m_theme == Light ? raisedButtonColorLight : flatButtonFocusColorDark);
}
QColor QQuickMaterialStyle::raisedButtonHoverColor() const
{
// The specs don't specify different colors here for the light theme.
- return m_theme == Light ? raisedButtonColorLight : flatButtonPressColorDark;
+ return QColor::fromRgba(m_theme == Light ? raisedButtonColorLight : flatButtonPressColorDark);
}
QColor QQuickMaterialStyle::raisedButtonPressColor() const
{
- return m_theme == Light ? raisedButtonPressColorLight : flatButtonPressColorDark;
+ return QColor::fromRgba(m_theme == Light ? raisedButtonPressColorLight : flatButtonPressColorDark);
}
QColor QQuickMaterialStyle::raisedButtonDisabledColor() const
{
- return m_theme == Light ? raisedButtonDisabledColorLight : raisedButtonDisabledColorDark;
+ return QColor::fromRgba(m_theme == Light ? raisedButtonDisabledColorLight : raisedButtonDisabledColorDark);
}
QColor QQuickMaterialStyle::raisedHighlightedButtonColor() const
@@ -646,27 +601,27 @@ QColor QQuickMaterialStyle::raisedHighlightedButtonPressColor() const
QColor QQuickMaterialStyle::raisedHighlightedButtonDisabledColor() const
{
- return m_theme == Light ? raisedButtonDisabledColorLight : raisedButtonDisabledColorDark;
+ return QColor::fromRgba(m_theme == Light ? raisedButtonDisabledColorLight : raisedButtonDisabledColorDark);
}
QColor QQuickMaterialStyle::flatButtonPressColor() const
{
- return m_theme == Light ? flatButtonPressColorLight : flatButtonPressColorDark;
+ return QColor::fromRgba(m_theme == Light ? flatButtonPressColorLight : flatButtonPressColorDark);
}
QColor QQuickMaterialStyle::flatButtonFocusColor() const
{
- return m_theme == Light ? flatButtonFocusColorLight : flatButtonFocusColorDark;
+ return QColor::fromRgba(m_theme == Light ? flatButtonFocusColorLight : flatButtonFocusColorDark);
}
QColor QQuickMaterialStyle::frameColor() const
{
- return m_theme == Light ? frameColorLight : frameColorDark;
+ return QColor::fromRgba(m_theme == Light ? frameColorLight : frameColorDark);
}
QColor QQuickMaterialStyle::checkBoxUncheckedRippleColor() const
{
- return m_theme == Light ? checkBoxUncheckedRippleColorLight : checkBoxUncheckedRippleColorDark;
+ return QColor::fromRgba(m_theme == Light ? checkBoxUncheckedRippleColorLight : checkBoxUncheckedRippleColorDark);
}
QColor QQuickMaterialStyle::checkBoxCheckedRippleColor() const
@@ -679,7 +634,7 @@ QColor QQuickMaterialStyle::checkBoxCheckedRippleColor() const
QColor QQuickMaterialStyle::switchUncheckedTrackColor() const
{
- return m_theme == Light ? switchUncheckedTrackColorLight : switchUncheckedTrackColorDark;
+ return QColor::fromRgba(m_theme == Light ? switchUncheckedTrackColorLight : switchUncheckedTrackColorDark);
}
QColor QQuickMaterialStyle::switchCheckedTrackColor() const
@@ -701,7 +656,7 @@ QColor QQuickMaterialStyle::switchCheckedHandleColor() const
QColor QQuickMaterialStyle::switchDisabledTrackColor() const
{
- return m_theme == Light ? switchDisabledTrackColorLight : switchDisabledTrackColorDark;
+ return QColor::fromRgba(m_theme == Light ? switchDisabledTrackColorLight : switchDisabledTrackColorDark);
}
QColor QQuickMaterialStyle::switchDisabledHandleColor() const
@@ -711,17 +666,27 @@ QColor QQuickMaterialStyle::switchDisabledHandleColor() const
QColor QQuickMaterialStyle::scrollBarColor() const
{
- return m_theme == Light ? "#40000000" : "#40FFFFFF";
+ return QColor::fromRgba(m_theme == Light ? 0x40000000 : 0x40FFFFFF);
}
QColor QQuickMaterialStyle::scrollBarPressedColor() const
{
- return m_theme == Light ? "#80000000" : "#80FFFFFF";
+ return QColor::fromRgba(m_theme == Light ? 0x80000000 : 0x80FFFFFF);
}
QColor QQuickMaterialStyle::drawerBackgroundColor() const
{
- return dividerTextColorLight;
+ return QColor::fromRgba(dividerTextColorLight);
+}
+
+QColor QQuickMaterialStyle::dialogColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? dialogColorLight : dialogColorDark);
+}
+
+QColor QQuickMaterialStyle::backgroundDimColor() const
+{
+ return QColor::fromRgba(m_theme == Light ? 0x99303030 : 0x99fafafa);
}
QColor QQuickMaterialStyle::color(QQuickMaterialStyle::Color color, QQuickMaterialStyle::Shade shade) const
@@ -742,10 +707,38 @@ void QQuickMaterialStyle::parentStyleChange(QQuickStyle *newParent, QQuickStyle
Q_UNUSED(oldParent);
QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(newParent);
if (material) {
- inheritPrimary(material->primary());
inheritAccent(material->accent());
inheritTheme(material->theme());
}
}
+template <typename Enum>
+static Enum readEnumValue(QSettings *settings, const QString &name, Enum fallback)
+{
+ Enum result = fallback;
+ if (settings->contains(name)) {
+ QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
+ bool ok = false;
+ int value = enumeration.keyToValue(settings->value(name).toByteArray(), &ok);
+ if (ok)
+ result = static_cast<Enum>(value);
+ }
+ return result;
+}
+
+void QQuickMaterialStyle::init()
+{
+ static bool defaultsInitialized = false;
+ if (!defaultsInitialized) {
+ QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Material"));
+ if (!settings.isNull()) {
+ defaultTheme = m_theme = readEnumValue<Theme>(settings.data(), QStringLiteral("Theme"), m_theme);
+ defaultAccent = m_accent = readEnumValue<Color>(settings.data(), QStringLiteral("Accent"), m_accent);
+ }
+ defaultsInitialized = true;
+ }
+
+ QQuickStyle::init(); // TODO: lazy init?
+}
+
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 69891b9c..87255383 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -59,7 +59,6 @@ class QQuickMaterialStyle : public QQuickStyle
{
Q_OBJECT
Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL)
- Q_PROPERTY(Color primary READ primary WRITE setPrimary RESET resetPrimary NOTIFY primaryChanged FINAL)
Q_PROPERTY(Color accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL)
Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL)
Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY paletteChanged FINAL)
@@ -92,6 +91,8 @@ class QQuickMaterialStyle : public QQuickStyle
Q_PROPERTY(QColor scrollBarColor READ scrollBarColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor scrollBarPressedColor READ scrollBarPressedColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor drawerBackgroundColor READ drawerBackgroundColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor dialogColor READ dialogColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(QColor backgroundDimColor READ backgroundDimColor NOTIFY paletteChanged FINAL)
public:
enum Theme {
@@ -152,16 +153,6 @@ public:
void propagateTheme();
void resetTheme();
- QColor primaryColorLight() const;
-
- Color primary() const;
- void setPrimary(Color color);
- void inheritPrimary(Color color);
- void propagatePrimary();
- void resetPrimary();
-
- QColor primaryColorDark() const;
-
Color accent() const;
void setAccent(Color color);
void inheritAccent(Color color);
@@ -199,12 +190,13 @@ public:
QColor scrollBarColor() const;
QColor scrollBarPressedColor() const;
QColor drawerBackgroundColor() const;
+ QColor dialogColor() const;
+ QColor backgroundDimColor() const;
Q_INVOKABLE QColor color(Color color, Shade shade) const;
Q_SIGNALS:
void themeChanged();
- void primaryChanged();
void accentChanged();
void paletteChanged();
@@ -212,11 +204,11 @@ protected:
void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) Q_DECL_OVERRIDE;
private:
+ void init();
+
bool m_explicitTheme;
- bool m_explicitPrimary;
bool m_explicitAccent;
Theme m_theme;
- Color m_primary;
Color m_accent;
};
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index ee98c35c..75ca1b8f 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -43,8 +43,8 @@ QT_BEGIN_NAMESPACE
QQuickMaterialTheme::QQuickMaterialTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
- systemFont = QFont(QLatin1Literal("Roboto"));
- dockWidgetTitleFont = QFont(QLatin1Literal("Roboto"), 10);
+ systemFont = QFont(QStringLiteral("Roboto"));
+ tabButtonFont = QFont(QStringLiteral("Roboto"), 10);
}
QQuickMaterialTheme::~QQuickMaterialTheme()
@@ -54,8 +54,8 @@ QQuickMaterialTheme::~QQuickMaterialTheme()
const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
{
switch (type) {
- case QPlatformTheme::DockWidgetTitleFont:
- return &dockWidgetTitleFont;
+ case QPlatformTheme::TabButtonFont:
+ return &tabButtonFont;
default:
return &systemFont;
}
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index e3d6ce9b..28fb30e9 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -65,7 +65,7 @@ public:
private:
QFont systemFont;
- QFont dockWidgetTitleFont; // QQuickTabButton
+ QFont tabButtonFont;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
index ab98991a..db8b47ee 100644
--- a/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
+++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.cpp
@@ -85,8 +85,8 @@ void QtLabsMaterialStylePlugin::initializeEngine(QQmlEngine *engine, const char
Q_UNUSED(engine);
Q_UNUSED(uri);
- QQuickStyleSelector *selector = QQuickStyleSelector::instance();
- if (selector && selector->style() == QStringLiteral("material")) {
+ QQuickStyleSelector selector;
+ if (selector.style() == QStringLiteral("material")) {
if (QFont(QStringLiteral("Roboto")).family() == QStringLiteral("Roboto")) {
QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
if (old) {
diff --git a/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc b/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc
index 6c7b65f1..8398d505 100644
--- a/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc
+++ b/src/imports/controls/material/qtlabsmaterialstyleplugin.qrc
@@ -4,5 +4,9 @@
<file>images/check@2x.png</file>
<file>images/check@3x.png</file>
<file>images/check@4x.png</file>
+ <file>images/drop-indicator.png</file>
+ <file>images/drop-indicator@2x.png</file>
+ <file>images/drop-indicator@3x.png</file>
+ <file>images/drop-indicator@4x.png</file>
</qresource>
</RCC>
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes
index 57ae4cd0..518a9b6c 100644
--- a/src/imports/controls/plugins.qmltypes
+++ b/src/imports/controls/plugins.qmltypes
@@ -8,9 +8,6 @@ import QtQuick.tooling 1.2
Module {
dependencies: [
- "Qt.labs.controls.material 1.0",
- "Qt.labs.controls.universal 1.0",
- "Qt.labs.controls.universal.impl 1.0",
"Qt.labs.templates 1.0",
"QtGraphicalEffects 1.0",
"QtGraphicalEffects.private 1.0",
@@ -18,6 +15,1549 @@ Module {
"QtQuick.Window 2.2"
]
Component {
+ name: "QQuickAbstractButton"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/AbstractButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "text"; type: "string" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "checked"; type: "bool" }
+ Property { name: "checkable"; type: "bool" }
+ Property { name: "highlighted"; type: "bool" }
+ Property { name: "autoExclusive"; type: "bool" }
+ Property { name: "autoRepeat"; type: "bool" }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ Property { name: "label"; type: "QQuickItem"; isPointer: true }
+ Signal {
+ name: "pressed"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "released"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal { name: "canceled" }
+ Signal {
+ name: "clicked"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Signal {
+ name: "doubleClicked"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ Method { name: "toggle" }
+ }
+ Component {
+ name: "QQuickApplicationWindow"
+ defaultProperty: "data"
+ prototype: "QQuickWindowQmlImpl"
+ exports: ["Qt.labs.templates/ApplicationWindow 1.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickApplicationWindowAttached"
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "activeFocusControl"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "header"; type: "QQuickItem"; isPointer: true }
+ Property { name: "footer"; type: "QQuickItem"; isPointer: true }
+ Property { name: "overlay"; type: "QQuickOverlay"; isReadonly: true; isPointer: true }
+ Property { name: "font"; type: "QFont" }
+ }
+ Component {
+ name: "QQuickApplicationWindowAttached"
+ prototype: "QObject"
+ Property { name: "window"; type: "QQuickApplicationWindow"; isReadonly: true; isPointer: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "activeFocusControl"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "header"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "footer"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "overlay"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickBusyIndicator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/BusyIndicator 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "running"; type: "bool" }
+ }
+ Component {
+ name: "QQuickButton"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/Button 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickCheckBox"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/CheckBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "tristate"; type: "bool" }
+ Property { name: "checkState"; type: "Qt::CheckState" }
+ }
+ Component {
+ name: "QQuickComboBox"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/ComboBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "highlightedIndex"; type: "int"; isReadonly: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentText"; type: "string"; isReadonly: true }
+ Property { name: "displayText"; type: "string" }
+ Property { name: "textRole"; type: "string" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
+ Signal {
+ name: "activated"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "highlighted"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "textAt"
+ type: "string"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "find"
+ type: "int"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "flags"; type: "Qt::MatchFlags" }
+ }
+ Method {
+ name: "find"
+ type: "int"
+ Parameter { name: "text"; type: "string" }
+ }
+ }
+ Component {
+ name: "QQuickContainer"
+ defaultProperty: "contentData"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Container 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
+ Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Method {
+ name: "setCurrentIndex"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "addItem"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "moveItem"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickControl"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["Qt.labs.templates/Control 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "font"; type: "QFont" }
+ Property { name: "availableWidth"; type: "double"; isReadonly: true }
+ Property { name: "availableHeight"; type: "double"; isReadonly: true }
+ Property { name: "padding"; type: "double" }
+ Property { name: "topPadding"; type: "double" }
+ Property { name: "leftPadding"; type: "double" }
+ Property { name: "rightPadding"; type: "double" }
+ Property { name: "bottomPadding"; type: "double" }
+ Property { name: "spacing"; type: "double" }
+ Property { name: "locale"; type: "QLocale" }
+ Property { name: "mirrored"; type: "bool"; isReadonly: true }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickDial"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Dial 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapAlways": 1,
+ "SnapOnRelease": 2
+ }
+ }
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ Property { name: "value"; type: "double" }
+ Property { name: "position"; type: "double"; isReadonly: true }
+ Property { name: "angle"; type: "double"; isReadonly: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "pressed"; type: "bool"; isReadonly: true }
+ Property { name: "handle"; type: "QQuickItem"; isPointer: true }
+ Method { name: "increase" }
+ Method { name: "decrease" }
+ }
+ Component {
+ name: "QQuickDrawer"
+ defaultProperty: "contentItem"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Drawer 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "edge"; type: "Qt::Edge" }
+ Property { name: "position"; type: "double" }
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "animation"; type: "QQuickPropertyAnimation"; isPointer: true }
+ Signal { name: "clicked" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
+ name: "QQuickFrame"
+ defaultProperty: "contentData"
+ prototype: "QQuickPane"
+ exports: ["Qt.labs.templates/Frame 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "frame"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickGroupBox"
+ defaultProperty: "contentData"
+ prototype: "QQuickFrame"
+ exports: ["Qt.labs.templates/GroupBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "title"; type: "string" }
+ Property { name: "label"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickImplicitSizeItem"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Property { name: "implicitWidth"; type: "double"; isReadonly: true }
+ Property { name: "implicitHeight"; type: "double"; isReadonly: true }
+ Signal { name: "implicitWidthChanged2"; revision: 1 }
+ Signal { name: "implicitHeightChanged2"; revision: 1 }
+ }
+ Component {
+ name: "QQuickItem"
+ defaultProperty: "data"
+ prototype: "QObject"
+ Enum {
+ name: "TransformOrigin"
+ values: {
+ "TopLeft": 0,
+ "Top": 1,
+ "TopRight": 2,
+ "Left": 3,
+ "Center": 4,
+ "Right": 5,
+ "BottomLeft": 6,
+ "Bottom": 7,
+ "BottomRight": 8
+ }
+ }
+ Property { name: "parent"; type: "QQuickItem"; isPointer: true }
+ Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "resources"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "children"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "x"; type: "double" }
+ Property { name: "y"; type: "double" }
+ Property { name: "z"; type: "double" }
+ Property { name: "width"; type: "double" }
+ Property { name: "height"; type: "double" }
+ Property { name: "opacity"; type: "double" }
+ Property { name: "enabled"; type: "bool" }
+ Property { name: "visible"; type: "bool" }
+ Property { name: "visibleChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ Property { name: "states"; type: "QQuickState"; isList: true; isReadonly: true }
+ Property { name: "transitions"; type: "QQuickTransition"; isList: true; isReadonly: true }
+ Property { name: "state"; type: "string" }
+ Property { name: "childrenRect"; type: "QRectF"; isReadonly: true }
+ Property { name: "anchors"; type: "QQuickAnchors"; isReadonly: true; isPointer: true }
+ Property { name: "left"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "right"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "horizontalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "top"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "bottom"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "verticalCenter"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baseline"; type: "QQuickAnchorLine"; isReadonly: true }
+ Property { name: "baselineOffset"; type: "double" }
+ Property { name: "clip"; type: "bool" }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "activeFocus"; type: "bool"; isReadonly: true }
+ Property { name: "activeFocusOnTab"; revision: 1; type: "bool" }
+ Property { name: "rotation"; type: "double" }
+ Property { name: "scale"; type: "double" }
+ Property { name: "transformOrigin"; type: "TransformOrigin" }
+ Property { name: "transformOriginPoint"; type: "QPointF"; isReadonly: true }
+ Property { name: "transform"; type: "QQuickTransform"; isList: true; isReadonly: true }
+ Property { name: "smooth"; type: "bool" }
+ Property { name: "antialiasing"; type: "bool" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "layer"; type: "QQuickItemLayer"; isReadonly: true; isPointer: true }
+ Signal {
+ name: "childrenRectChanged"
+ Parameter { type: "QRectF" }
+ }
+ Signal {
+ name: "baselineOffsetChanged"
+ Parameter { type: "double" }
+ }
+ Signal {
+ name: "stateChanged"
+ Parameter { type: "string" }
+ }
+ Signal {
+ name: "focusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnTabChanged"
+ revision: 1
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "parentChanged"
+ Parameter { type: "QQuickItem"; isPointer: true }
+ }
+ Signal {
+ name: "transformOriginChanged"
+ Parameter { type: "TransformOrigin" }
+ }
+ Signal {
+ name: "smoothChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "antialiasingChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "clipChanged"
+ Parameter { type: "bool" }
+ }
+ Signal {
+ name: "windowChanged"
+ revision: 1
+ Parameter { name: "window"; type: "QQuickWindow"; isPointer: true }
+ }
+ Method { name: "update" }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "targetSize"; type: "QSize" }
+ }
+ Method {
+ name: "grabToImage"
+ revision: 2
+ type: "bool"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "contains"
+ type: "bool"
+ Parameter { name: "point"; type: "QPointF" }
+ }
+ Method {
+ name: "mapFromItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "mapToItem"
+ Parameter { type: "QQmlV4Function"; isPointer: true }
+ }
+ Method { name: "forceActiveFocus" }
+ Method {
+ name: "forceActiveFocus"
+ Parameter { name: "reason"; type: "Qt::FocusReason" }
+ }
+ Method {
+ name: "nextItemInFocusChain"
+ revision: 1
+ type: "QQuickItem*"
+ Parameter { name: "forward"; type: "bool" }
+ }
+ Method { name: "nextItemInFocusChain"; revision: 1; type: "QQuickItem*" }
+ Method {
+ name: "childAt"
+ type: "QQuickItem*"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickItemDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/ItemDelegate 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickLabel"
+ defaultProperty: "data"
+ prototype: "QQuickText"
+ exports: ["Qt.labs.templates/Label 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "font"; type: "QFont" }
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickMenu"
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["Qt.labs.templates/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
+ Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "addItem"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "moveItem"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickMenuItem"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Signal { name: "triggered" }
+ }
+ Component {
+ name: "QQuickOverlay"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Signal { name: "pressed" }
+ Signal { name: "released" }
+ }
+ Component {
+ name: "QQuickPageIndicator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/PageIndicator 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int" }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "interactive"; type: "bool" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ }
+ Component {
+ name: "QQuickPane"
+ defaultProperty: "contentData"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Pane 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "contentWidth"; type: "double" }
+ Property { name: "contentHeight"; type: "double" }
+ Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPopup"
+ prototype: "QObject"
+ exports: ["Qt.labs.templates/Popup 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "modal"; type: "bool" }
+ Property { name: "visible"; type: "bool"; isReadonly: true }
+ Property { name: "enter"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "exit"; type: "QQuickTransition"; isPointer: true }
+ Signal { name: "pressedOutside" }
+ Signal { name: "releasedOutside" }
+ Signal { name: "clickedOutside" }
+ Signal { name: "aboutToShow" }
+ Signal { name: "aboutToHide" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
+ name: "QQuickProgressBar"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/ProgressBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ Property { name: "value"; type: "double" }
+ Property { name: "position"; type: "double"; isReadonly: true }
+ Property { name: "visualPosition"; type: "double"; isReadonly: true }
+ Property { name: "indeterminate"; type: "bool" }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickRadioButton"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/RadioButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickRangeSlider"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/RangeSlider 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapAlways": 1,
+ "SnapOnRelease": 2
+ }
+ }
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ Property { name: "first"; type: "QQuickRangeSliderNode"; isReadonly: true; isPointer: true }
+ Property { name: "second"; type: "QQuickRangeSliderNode"; isReadonly: true; isPointer: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "orientation"; type: "Qt::Orientation" }
+ Property { name: "track"; type: "QQuickItem"; isPointer: true }
+ Method {
+ name: "setValues"
+ Parameter { name: "firstValue"; type: "double" }
+ Parameter { name: "secondValue"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickRangeSliderNode"
+ prototype: "QObject"
+ Property { name: "value"; type: "double" }
+ Property { name: "position"; type: "double"; isReadonly: true }
+ Property { name: "visualPosition"; type: "double"; isReadonly: true }
+ Property { name: "handle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "pressed"; type: "bool" }
+ Method { name: "increase" }
+ Method { name: "decrease" }
+ }
+ Component {
+ name: "QQuickScrollBar"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/ScrollBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickScrollBarAttached"
+ Property { name: "size"; type: "double" }
+ Property { name: "position"; type: "double" }
+ Property { name: "active"; type: "bool" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "orientation"; type: "Qt::Orientation" }
+ Property { name: "handle"; type: "QQuickItem"; isPointer: true }
+ Method {
+ name: "setSize"
+ Parameter { name: "size"; type: "double" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickScrollBarAttached"
+ prototype: "QObject"
+ Property { name: "horizontal"; type: "QQuickScrollBar"; isPointer: true }
+ Property { name: "vertical"; type: "QQuickScrollBar"; isPointer: true }
+ }
+ Component {
+ name: "QQuickScrollIndicator"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/ScrollIndicator 1.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickScrollIndicatorAttached"
+ Property { name: "size"; type: "double" }
+ Property { name: "position"; type: "double" }
+ Property { name: "active"; type: "bool" }
+ Property { name: "orientation"; type: "Qt::Orientation" }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ Method {
+ name: "setSize"
+ Parameter { name: "size"; type: "double" }
+ }
+ Method {
+ name: "setPosition"
+ Parameter { name: "position"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickScrollIndicatorAttached"
+ prototype: "QObject"
+ Property { name: "horizontal"; type: "QQuickScrollIndicator"; isPointer: true }
+ Property { name: "vertical"; type: "QQuickScrollIndicator"; isPointer: true }
+ }
+ Component {
+ name: "QQuickSlider"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Slider 1.0"]
+ exportMetaObjectRevisions: [0]
+ Enum {
+ name: "SnapMode"
+ values: {
+ "NoSnap": 0,
+ "SnapAlways": 1,
+ "SnapOnRelease": 2
+ }
+ }
+ Property { name: "from"; type: "double" }
+ Property { name: "to"; type: "double" }
+ Property { name: "value"; type: "double" }
+ Property { name: "position"; type: "double"; isReadonly: true }
+ Property { name: "visualPosition"; type: "double"; isReadonly: true }
+ Property { name: "stepSize"; type: "double" }
+ Property { name: "snapMode"; type: "SnapMode" }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "orientation"; type: "Qt::Orientation" }
+ Property { name: "handle"; type: "QQuickItem"; isPointer: true }
+ Property { name: "track"; type: "QQuickItem"; isPointer: true }
+ Method { name: "increase" }
+ Method { name: "decrease" }
+ }
+ Component {
+ name: "QQuickSpinBox"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/SpinBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "from"; type: "int" }
+ Property { name: "to"; type: "int" }
+ Property { name: "value"; type: "int" }
+ Property { name: "stepSize"; type: "int" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "textFromValue"; type: "QJSValue" }
+ Property { name: "valueFromText"; type: "QJSValue" }
+ Property { name: "up"; type: "QQuickSpinButton"; isReadonly: true; isPointer: true }
+ Property { name: "down"; type: "QQuickSpinButton"; isReadonly: true; isPointer: true }
+ Method { name: "increase" }
+ Method { name: "decrease" }
+ }
+ Component {
+ name: "QQuickSpinButton"
+ prototype: "QObject"
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
+ }
+ Component {
+ name: "QQuickStackAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "view"; type: "QQuickStackView"; isReadonly: true; isPointer: true }
+ Property { name: "status"; type: "QQuickStackView::Status"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickStackView"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/StackView 1.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickStackAttached"
+ Enum {
+ name: "Status"
+ values: {
+ "Inactive": 0,
+ "Deactivating": 1,
+ "Activating": 2,
+ "Active": 3
+ }
+ }
+ Enum {
+ name: "LoadBehavior"
+ values: {
+ "DontLoad": 0,
+ "ForceLoad": 1
+ }
+ }
+ Enum {
+ name: "Operation"
+ values: {
+ "Transition": 0,
+ "Immediate": 1
+ }
+ }
+ Property { name: "busy"; type: "bool"; isReadonly: true }
+ Property { name: "depth"; type: "int"; isReadonly: true }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "initialItem"; type: "QVariant" }
+ Property { name: "popEnter"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "popExit"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "pushEnter"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "pushExit"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "replaceEnter"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "replaceExit"; type: "QQuickTransition"; isPointer: true }
+ Method { name: "clear" }
+ Method {
+ name: "get"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "behavior"; type: "LoadBehavior" }
+ }
+ Method {
+ name: "get"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "find"
+ type: "QQuickItem*"
+ Parameter { name: "callback"; type: "QJSValue" }
+ Parameter { name: "behavior"; type: "LoadBehavior" }
+ }
+ Method {
+ name: "find"
+ type: "QQuickItem*"
+ Parameter { name: "callback"; type: "QJSValue" }
+ }
+ Method {
+ name: "push"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "pop"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "replace"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickSwipeView"
+ defaultProperty: "contentData"
+ prototype: "QQuickContainer"
+ exports: ["Qt.labs.templates/SwipeView 1.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickSwipeViewAttached"
+ }
+ Component {
+ name: "QQuickSwipeViewAttached"
+ prototype: "QObject"
+ Property { name: "index"; type: "int"; isReadonly: true }
+ Property { name: "isCurrentItem"; type: "bool"; isReadonly: true }
+ Property { name: "view"; type: "QQuickSwipeView"; isReadonly: true; isPointer: true }
+ }
+ Component {
+ name: "QQuickSwitch"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/Switch 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "position"; type: "double" }
+ Property { name: "visualPosition"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickTabBar"
+ defaultProperty: "contentData"
+ prototype: "QQuickContainer"
+ exports: ["Qt.labs.templates/TabBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickTabButton"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/TabButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickText"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextStyle"
+ values: {
+ "Normal": 0,
+ "Outline": 1,
+ "Raised": 2,
+ "Sunken": 3
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2,
+ "StyledText": 4
+ }
+ }
+ Enum {
+ name: "TextElideMode"
+ values: {
+ "ElideLeft": 0,
+ "ElideRight": 1,
+ "ElideMiddle": 2,
+ "ElideNone": 3
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Enum {
+ name: "LineHeightMode"
+ values: {
+ "ProportionalHeight": 0,
+ "FixedHeight": 1
+ }
+ }
+ Enum {
+ name: "FontSizeMode"
+ values: {
+ "FixedSize": 0,
+ "HorizontalFit": 1,
+ "VerticalFit": 2,
+ "Fit": 3
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "linkColor"; type: "QColor" }
+ Property { name: "style"; type: "TextStyle" }
+ Property { name: "styleColor"; type: "QColor" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "truncated"; type: "bool"; isReadonly: true }
+ Property { name: "maximumLineCount"; type: "int" }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "elide"; type: "TextElideMode" }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "lineHeight"; type: "double" }
+ Property { name: "lineHeightMode"; type: "LineHeightMode" }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "minimumPixelSize"; type: "int" }
+ Property { name: "minimumPointSize"; type: "int" }
+ Property { name: "fontSizeMode"; type: "FontSizeMode" }
+ Property { name: "renderType"; type: "RenderType" }
+ Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
+ Property { name: "padding"; revision: 6; type: "double" }
+ Property { name: "topPadding"; revision: 6; type: "double" }
+ Property { name: "leftPadding"; revision: 6; type: "double" }
+ Property { name: "rightPadding"; revision: 6; type: "double" }
+ Property { name: "bottomPadding"; revision: 6; type: "double" }
+ Signal {
+ name: "textChanged"
+ Parameter { name: "text"; type: "string" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ revision: 2
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "styleChanged"
+ Parameter { name: "style"; type: "TextStyle" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "elideModeChanged"
+ Parameter { name: "mode"; type: "TextElideMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "lineHeightChanged"
+ Parameter { name: "lineHeight"; type: "double" }
+ }
+ Signal {
+ name: "lineHeightModeChanged"
+ Parameter { name: "mode"; type: "LineHeightMode" }
+ }
+ Signal {
+ name: "lineLaidOut"
+ Parameter { name: "line"; type: "QQuickTextLine"; isPointer: true }
+ }
+ Signal { name: "paddingChanged"; revision: 6 }
+ Signal { name: "topPaddingChanged"; revision: 6 }
+ Signal { name: "leftPaddingChanged"; revision: 6 }
+ Signal { name: "rightPaddingChanged"; revision: 6 }
+ Signal { name: "bottomPaddingChanged"; revision: 6 }
+ Method { name: "doLayout" }
+ Method {
+ name: "linkAt"
+ revision: 3
+ type: "string"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickTextArea"
+ defaultProperty: "data"
+ prototype: "QQuickTextEdit"
+ exports: ["Qt.labs.templates/TextArea 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "font"; type: "QFont" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Property { name: "placeholderText"; type: "string" }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Signal {
+ name: "pressAndHold"
+ Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickTextEdit"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4,
+ "AlignJustify": 8
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "TextFormat"
+ values: {
+ "PlainText": 0,
+ "RichText": 1,
+ "AutoText": 2
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "SelectionMode"
+ values: {
+ "SelectCharacters": 0,
+ "SelectWords": 1
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "selectionColor"; type: "QColor" }
+ Property { name: "selectedTextColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "lineCount"; type: "int"; isReadonly: true }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "paintedWidth"; type: "double"; isReadonly: true }
+ Property { name: "paintedHeight"; type: "double"; isReadonly: true }
+ Property { name: "textFormat"; type: "TextFormat" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "cursorVisible"; type: "bool" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "persistentSelection"; type: "bool" }
+ Property { name: "textMargin"; type: "double" }
+ Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "selectByKeyboard"; revision: 1; type: "bool" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "mouseSelectionMode"; type: "SelectionMode" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
+ Property { name: "baseUrl"; type: "QUrl" }
+ Property { name: "renderType"; type: "RenderType" }
+ Property {
+ name: "textDocument"
+ revision: 1
+ type: "QQuickTextDocument"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "hoveredLink"; revision: 2; type: "string"; isReadonly: true }
+ Property { name: "padding"; revision: 6; type: "double" }
+ Property { name: "topPadding"; revision: 6; type: "double" }
+ Property { name: "leftPadding"; revision: 6; type: "double" }
+ Property { name: "rightPadding"; revision: 6; type: "double" }
+ Property { name: "bottomPadding"; revision: 6; type: "double" }
+ Signal { name: "contentSizeChanged" }
+ Signal {
+ name: "colorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "selectionColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "selectedTextColorChanged"
+ Parameter { name: "color"; type: "QColor" }
+ }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "textFormatChanged"
+ Parameter { name: "textFormat"; type: "TextFormat" }
+ }
+ Signal {
+ name: "readOnlyChanged"
+ Parameter { name: "isReadOnly"; type: "bool" }
+ }
+ Signal {
+ name: "cursorVisibleChanged"
+ Parameter { name: "isCursorVisible"; type: "bool" }
+ }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ Parameter { name: "activeFocusOnPressed"; type: "bool" }
+ }
+ Signal {
+ name: "persistentSelectionChanged"
+ Parameter { name: "isPersistentSelection"; type: "bool" }
+ }
+ Signal {
+ name: "textMarginChanged"
+ Parameter { name: "textMargin"; type: "double" }
+ }
+ Signal {
+ name: "selectByKeyboardChanged"
+ revision: 1
+ Parameter { name: "selectByKeyboard"; type: "bool" }
+ }
+ Signal {
+ name: "selectByMouseChanged"
+ Parameter { name: "selectByMouse"; type: "bool" }
+ }
+ Signal {
+ name: "mouseSelectionModeChanged"
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Signal {
+ name: "linkActivated"
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal {
+ name: "linkHovered"
+ revision: 2
+ Parameter { name: "link"; type: "string" }
+ }
+ Signal { name: "editingFinished"; revision: 6 }
+ Signal { name: "paddingChanged"; revision: 6 }
+ Signal { name: "topPaddingChanged"; revision: 6 }
+ Signal { name: "leftPaddingChanged"; revision: 6 }
+ Signal { name: "rightPaddingChanged"; revision: 6 }
+ Signal { name: "bottomPaddingChanged"; revision: 6 }
+ Method { name: "selectAll" }
+ Method { name: "selectWord" }
+ Method {
+ name: "select"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "deselect" }
+ Method {
+ name: "isRightToLeft"
+ type: "bool"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "cut" }
+ Method { name: "copy" }
+ Method { name: "paste" }
+ Method { name: "undo" }
+ Method { name: "redo" }
+ Method {
+ name: "insert"
+ Parameter { name: "position"; type: "int" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "append"
+ revision: 2
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "inputMethodQuery"
+ revision: 4
+ type: "QVariant"
+ Parameter { name: "query"; type: "Qt::InputMethodQuery" }
+ Parameter { name: "argument"; type: "QVariant" }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QRectF"
+ Parameter { type: "int" }
+ }
+ Method {
+ name: "positionAt"
+ type: "int"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Method {
+ name: "getText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "getFormattedText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "linkAt"
+ revision: 3
+ type: "string"
+ Parameter { name: "x"; type: "double" }
+ Parameter { name: "y"; type: "double" }
+ }
+ }
+ Component {
+ name: "QQuickTextField"
+ defaultProperty: "data"
+ prototype: "QQuickTextInput"
+ exports: ["Qt.labs.templates/TextField 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "font"; type: "QFont" }
+ Property { name: "implicitWidth"; type: "double" }
+ Property { name: "implicitHeight"; type: "double" }
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Property { name: "placeholderText"; type: "string" }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
+ Signal {
+ name: "pressAndHold"
+ Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
+ }
+ }
+ Component {
+ name: "QQuickTextInput"
+ defaultProperty: "data"
+ prototype: "QQuickImplicitSizeItem"
+ Enum {
+ name: "EchoMode"
+ values: {
+ "Normal": 0,
+ "NoEcho": 1,
+ "Password": 2,
+ "PasswordEchoOnEdit": 3
+ }
+ }
+ Enum {
+ name: "HAlignment"
+ values: {
+ "AlignLeft": 1,
+ "AlignRight": 2,
+ "AlignHCenter": 4
+ }
+ }
+ Enum {
+ name: "VAlignment"
+ values: {
+ "AlignTop": 32,
+ "AlignBottom": 64,
+ "AlignVCenter": 128
+ }
+ }
+ Enum {
+ name: "WrapMode"
+ values: {
+ "NoWrap": 0,
+ "WordWrap": 1,
+ "WrapAnywhere": 3,
+ "WrapAtWordBoundaryOrAnywhere": 4,
+ "Wrap": 4
+ }
+ }
+ Enum {
+ name: "SelectionMode"
+ values: {
+ "SelectCharacters": 0,
+ "SelectWords": 1
+ }
+ }
+ Enum {
+ name: "CursorPosition"
+ values: {
+ "CursorBetweenCharacters": 0,
+ "CursorOnCharacter": 1
+ }
+ }
+ Enum {
+ name: "RenderType"
+ values: {
+ "QtRendering": 0,
+ "NativeRendering": 1
+ }
+ }
+ Property { name: "text"; type: "string" }
+ Property { name: "length"; type: "int"; isReadonly: true }
+ Property { name: "color"; type: "QColor" }
+ Property { name: "selectionColor"; type: "QColor" }
+ Property { name: "selectedTextColor"; type: "QColor" }
+ Property { name: "font"; type: "QFont" }
+ Property { name: "horizontalAlignment"; type: "HAlignment" }
+ Property { name: "effectiveHorizontalAlignment"; type: "HAlignment"; isReadonly: true }
+ Property { name: "verticalAlignment"; type: "VAlignment" }
+ Property { name: "wrapMode"; type: "WrapMode" }
+ Property { name: "readOnly"; type: "bool" }
+ Property { name: "cursorVisible"; type: "bool" }
+ Property { name: "cursorPosition"; type: "int" }
+ Property { name: "cursorRectangle"; type: "QRectF"; isReadonly: true }
+ Property { name: "cursorDelegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "selectionStart"; type: "int"; isReadonly: true }
+ Property { name: "selectionEnd"; type: "int"; isReadonly: true }
+ Property { name: "selectedText"; type: "string"; isReadonly: true }
+ Property { name: "maximumLength"; type: "int" }
+ Property { name: "validator"; type: "QValidator"; isPointer: true }
+ Property { name: "inputMask"; type: "string" }
+ Property { name: "inputMethodHints"; type: "Qt::InputMethodHints" }
+ Property { name: "acceptableInput"; type: "bool"; isReadonly: true }
+ Property { name: "echoMode"; type: "EchoMode" }
+ Property { name: "activeFocusOnPress"; type: "bool" }
+ Property { name: "passwordCharacter"; type: "string" }
+ Property { name: "passwordMaskDelay"; revision: 3; type: "int" }
+ Property { name: "displayText"; type: "string"; isReadonly: true }
+ Property { name: "autoScroll"; type: "bool" }
+ Property { name: "selectByMouse"; type: "bool" }
+ Property { name: "mouseSelectionMode"; type: "SelectionMode" }
+ Property { name: "persistentSelection"; type: "bool" }
+ Property { name: "canPaste"; type: "bool"; isReadonly: true }
+ Property { name: "canUndo"; type: "bool"; isReadonly: true }
+ Property { name: "canRedo"; type: "bool"; isReadonly: true }
+ Property { name: "inputMethodComposing"; type: "bool"; isReadonly: true }
+ Property { name: "contentWidth"; type: "double"; isReadonly: true }
+ Property { name: "contentHeight"; type: "double"; isReadonly: true }
+ Property { name: "renderType"; type: "RenderType" }
+ Property { name: "padding"; revision: 6; type: "double" }
+ Property { name: "topPadding"; revision: 6; type: "double" }
+ Property { name: "leftPadding"; revision: 6; type: "double" }
+ Property { name: "rightPadding"; revision: 6; type: "double" }
+ Property { name: "bottomPadding"; revision: 6; type: "double" }
+ Signal { name: "accepted" }
+ Signal { name: "editingFinished"; revision: 2 }
+ Signal {
+ name: "fontChanged"
+ Parameter { name: "font"; type: "QFont" }
+ }
+ Signal {
+ name: "horizontalAlignmentChanged"
+ Parameter { name: "alignment"; type: "HAlignment" }
+ }
+ Signal {
+ name: "verticalAlignmentChanged"
+ Parameter { name: "alignment"; type: "VAlignment" }
+ }
+ Signal {
+ name: "readOnlyChanged"
+ Parameter { name: "isReadOnly"; type: "bool" }
+ }
+ Signal {
+ name: "cursorVisibleChanged"
+ Parameter { name: "isCursorVisible"; type: "bool" }
+ }
+ Signal {
+ name: "maximumLengthChanged"
+ Parameter { name: "maximumLength"; type: "int" }
+ }
+ Signal {
+ name: "inputMaskChanged"
+ Parameter { name: "inputMask"; type: "string" }
+ }
+ Signal {
+ name: "echoModeChanged"
+ Parameter { name: "echoMode"; type: "EchoMode" }
+ }
+ Signal {
+ name: "passwordMaskDelayChanged"
+ revision: 3
+ Parameter { name: "delay"; type: "int" }
+ }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ Parameter { name: "activeFocusOnPress"; type: "bool" }
+ }
+ Signal {
+ name: "autoScrollChanged"
+ Parameter { name: "autoScroll"; type: "bool" }
+ }
+ Signal {
+ name: "selectByMouseChanged"
+ Parameter { name: "selectByMouse"; type: "bool" }
+ }
+ Signal {
+ name: "mouseSelectionModeChanged"
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Signal { name: "contentSizeChanged" }
+ Signal { name: "paddingChanged"; revision: 6 }
+ Signal { name: "topPaddingChanged"; revision: 6 }
+ Signal { name: "leftPaddingChanged"; revision: 6 }
+ Signal { name: "rightPaddingChanged"; revision: 6 }
+ Signal { name: "bottomPaddingChanged"; revision: 6 }
+ Method { name: "selectAll" }
+ Method { name: "selectWord" }
+ Method {
+ name: "select"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "deselect" }
+ Method {
+ name: "isRightToLeft"
+ type: "bool"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method { name: "cut" }
+ Method { name: "copy" }
+ Method { name: "paste" }
+ Method { name: "undo" }
+ Method { name: "redo" }
+ Method {
+ name: "insert"
+ Parameter { name: "position"; type: "int" }
+ Parameter { name: "text"; type: "string" }
+ }
+ Method {
+ name: "remove"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ Method {
+ name: "ensureVisible"
+ revision: 3
+ Parameter { name: "position"; type: "int" }
+ }
+ Method {
+ name: "positionAt"
+ Parameter { name: "args"; type: "QQmlV4Function"; isPointer: true }
+ }
+ Method {
+ name: "positionToRectangle"
+ type: "QRectF"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ }
+ Method {
+ name: "moveCursorSelection"
+ Parameter { name: "pos"; type: "int" }
+ Parameter { name: "mode"; type: "SelectionMode" }
+ }
+ Method {
+ name: "inputMethodQuery"
+ revision: 3
+ type: "QVariant"
+ Parameter { name: "query"; type: "Qt::InputMethodQuery" }
+ Parameter { name: "argument"; type: "QVariant" }
+ }
+ Method {
+ name: "getText"
+ type: "string"
+ Parameter { name: "start"; type: "int" }
+ Parameter { name: "end"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickToolBar"
+ defaultProperty: "contentData"
+ prototype: "QQuickFrame"
+ exports: ["Qt.labs.templates/ToolBar 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickToolButton"
+ defaultProperty: "data"
+ prototype: "QQuickButton"
+ exports: ["Qt.labs.templates/ToolButton 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
+ name: "QQuickTumbler"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Tumbler 1.0"]
+ exportMetaObjectRevisions: [0]
+ attachedType: "QQuickTumblerAttached"
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "visibleItemCount"; type: "int" }
+ }
+ Component {
+ name: "QQuickTumblerAttached"
+ prototype: "QObject"
+ Property { name: "tumbler"; type: "QQuickTumbler"; isReadonly: true; isPointer: true }
+ Property { name: "displacement"; type: "double"; isReadonly: true }
+ }
+ Component {
+ name: "QQuickBusyIndicatorRing"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ exports: ["Qt.labs.controls.impl/BusyRing 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickButtonGroup"
prototype: "QObject"
exports: ["Qt.labs.controls/ButtonGroup 1.0"]
@@ -72,6 +1612,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickComboBox"
+ name: "Qt.labs.controls/ComboBox 1.0"
+ exports: ["Qt.labs.controls/ComboBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickDial"
name: "Qt.labs.controls/Dial 1.0"
exports: ["Qt.labs.controls/Dial 1.0"]
@@ -120,6 +1668,22 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickMenu"
+ name: "Qt.labs.controls/Menu 1.0"
+ exports: ["Qt.labs.controls/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
+ prototype: "QQuickMenuItem"
+ name: "Qt.labs.controls/MenuItem 1.0"
+ exports: ["Qt.labs.controls/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "data"
+ }
+ Component {
prototype: "QQuickPageIndicator"
name: "Qt.labs.controls/PageIndicator 1.0"
exports: ["Qt.labs.controls/PageIndicator 1.0"]
@@ -128,6 +1692,14 @@ Module {
defaultProperty: "data"
}
Component {
+ prototype: "QQuickFrame"
+ name: "Qt.labs.controls/Pane 1.0"
+ exports: ["Qt.labs.controls/Pane 1.0"]
+ exportMetaObjectRevisions: [0]
+ isComposite: true
+ defaultProperty: "contentData"
+ }
+ Component {
prototype: "QQuickProgressBar"
name: "Qt.labs.controls/ProgressBar 1.0"
exports: ["Qt.labs.controls/ProgressBar 1.0"]
diff --git a/src/imports/controls/qquickbusyindicatorring.cpp b/src/imports/controls/qquickbusyindicatorring.cpp
new file mode 100644
index 00000000..4711ae1b
--- /dev/null
+++ b/src/imports/controls/qquickbusyindicatorring.cpp
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickbusyindicatorring_p.h"
+
+#include <QtCore/qset.h>
+#include <QtGui/qpainter.h>
+#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/qsgsimplerectnode.h>
+#include <QtQuick/qquickwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickBusyIndicatorAnimatorJob : public QQuickAnimatorJob
+{
+public:
+ QQuickBusyIndicatorAnimatorJob();
+ ~QQuickBusyIndicatorAnimatorJob();
+
+ void updateCurrentTime(int time) Q_DECL_OVERRIDE;
+ void writeBack() Q_DECL_OVERRIDE;
+ void nodeWasDestroyed() Q_DECL_OVERRIDE;
+};
+
+static const int circles = 10;
+static const int animationDuration = 100 * circles * 2;
+
+QQuickBusyIndicatorRing::QQuickBusyIndicatorRing(QQuickItem *parent) :
+ QQuickItem(parent)
+{
+ setFlag(QQuickItem::ItemHasContents);
+ setImplicitWidth(116);
+ setImplicitHeight(116);
+}
+
+QQuickBusyIndicatorRing::~QQuickBusyIndicatorRing()
+{
+}
+
+static QPointF moveBy(const QPointF &pos, qreal rotation, qreal distance)
+{
+ return pos - QTransform().rotate(rotation).map(QPointF(0, distance));
+}
+
+QSGNode *QQuickBusyIndicatorRing::updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *)
+{
+ QQuickItemPrivate *d = QQuickItemPrivate::get(this);
+
+ if (!oldNode)
+ oldNode = new QSGSimpleRectNode(boundingRect(), Qt::transparent);
+ static_cast<QSGSimpleRectNode *>(oldNode)->setRect(boundingRect());
+
+ QSGTransformNode *rootTransformNode = static_cast<QSGTransformNode *>(oldNode->firstChild());
+ if (!rootTransformNode) {
+ rootTransformNode = new QSGTransformNode;
+ oldNode->appendChildNode(rootTransformNode);
+ }
+ Q_ASSERT(rootTransformNode->type() == QSGNode::TransformNodeType);
+
+ const qreal w = width();
+ const qreal h = height();
+ const qreal sz = qMin(w, h);
+ const qreal dx = (w - sz) / 2;
+ const qreal dy = (h - sz) / 2;
+ const int circleRadius = sz / 12;
+
+ QSGTransformNode *transformNode = static_cast<QSGTransformNode *>(rootTransformNode->firstChild());
+ for (int i = 0; i < circles; ++i) {
+ if (!transformNode) {
+ transformNode = new QSGTransformNode;
+ rootTransformNode->appendChildNode(transformNode);
+
+ QSGOpacityNode *opacityNode = new QSGOpacityNode;
+ transformNode->appendChildNode(opacityNode);
+
+ QSGRectangleNode *rectNode = d->sceneGraphContext()->createRectangleNode();
+ rectNode->setAntialiasing(true);
+ rectNode->setColor(QColor("#353637"));
+ rectNode->setPenColor(QColor("#353637"));
+ opacityNode->appendChildNode(rectNode);
+ }
+
+ QSGNode *opacityNode = transformNode->firstChild();
+ Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
+
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode *>(opacityNode->firstChild());
+ Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
+
+ QPointF pos = QPointF(sz / 2 - circleRadius, sz / 2 - circleRadius);
+ pos = moveBy(pos, 360 / circles * i, sz / 2 - circleRadius);
+
+ QMatrix4x4 m;
+ m.translate(dx + pos.x(), dy + pos.y());
+ transformNode->setMatrix(m);
+
+ rectNode->setRect(QRectF(QPointF(), QSizeF(circleRadius * 2, circleRadius * 2)));
+ rectNode->setRadius(circleRadius);
+ rectNode->update();
+
+ transformNode = static_cast<QSGTransformNode *>(transformNode->nextSibling());
+ }
+
+ return oldNode;
+}
+
+QQuickBusyIndicatorAnimator::QQuickBusyIndicatorAnimator(QObject *parent) :
+ QQuickAnimator(parent)
+{
+ setDuration(animationDuration);
+ setLoops(QQuickAnimator::Infinite);
+}
+
+QString QQuickBusyIndicatorAnimator::propertyName() const
+{
+ return QString();
+}
+
+QQuickAnimatorJob *QQuickBusyIndicatorAnimator::createJob() const
+{
+ return new QQuickBusyIndicatorAnimatorJob;
+}
+
+QQuickBusyIndicatorAnimatorJob::QQuickBusyIndicatorAnimatorJob()
+{
+}
+
+QQuickBusyIndicatorAnimatorJob::~QQuickBusyIndicatorAnimatorJob()
+{
+}
+
+void QQuickBusyIndicatorAnimatorJob::updateCurrentTime(int time)
+{
+ if (!m_target)
+ return;
+
+ QSGNode *childContainerNode = QQuickItemPrivate::get(m_target)->childContainerNode();
+ QSGSimpleRectNode *rootRectNode = static_cast<QSGSimpleRectNode*>(childContainerNode->firstChild());
+ if (!rootRectNode)
+ return;
+
+ Q_ASSERT(rootRectNode->type() == QSGNode::GeometryNodeType);
+
+ QSGTransformNode *rootTransformNode = static_cast<QSGTransformNode*>(rootRectNode->firstChild());
+ Q_ASSERT(rootTransformNode->type() == QSGNode::TransformNodeType);
+
+ const qreal percentageComplete = time / qreal(animationDuration);
+ const qreal firstPhaseProgress = percentageComplete <= 0.5 ? percentageComplete * 2 : 0;
+ const qreal secondPhaseProgress = percentageComplete > 0.5 ? (percentageComplete - 0.5) * 2 : 0;
+
+ QSGTransformNode *transformNode = static_cast<QSGTransformNode*>(rootTransformNode->firstChild());
+ Q_ASSERT(transformNode->type() == QSGNode::TransformNodeType);
+ for (int i = 0; i < circles; ++i) {
+ QSGOpacityNode *opacityNode = static_cast<QSGOpacityNode*>(transformNode->firstChild());
+ Q_ASSERT(opacityNode->type() == QSGNode::OpacityNodeType);
+
+ QSGRectangleNode *rectNode = static_cast<QSGRectangleNode*>(opacityNode->firstChild());
+ Q_ASSERT(rectNode->type() == QSGNode::GeometryNodeType);
+
+ const bool fill = (firstPhaseProgress > qreal(i) / circles) || (secondPhaseProgress > 0 && secondPhaseProgress < qreal(i) / circles);
+ rectNode->setPenWidth(fill ? 0 : 1);
+ rectNode->setColor(fill ? QColor("#353637") : QColor("transparent"));
+ rectNode->update();
+
+ transformNode = static_cast<QSGTransformNode*>(transformNode->nextSibling());
+ }
+}
+
+void QQuickBusyIndicatorAnimatorJob::writeBack()
+{
+}
+
+void QQuickBusyIndicatorAnimatorJob::nodeWasDestroyed()
+{
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/qquickbusyindicatorring_p.h b/src/imports/controls/qquickbusyindicatorring_p.h
new file mode 100644
index 00000000..4697628d
--- /dev/null
+++ b/src/imports/controls/qquickbusyindicatorring_p.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKBUSYINDICATOR_P_H
+#define QQUICKBUSYINDICATOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickanimatorjob_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickBusyIndicatorRing : public QQuickItem
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickBusyIndicatorRing(QQuickItem *parent = Q_NULLPTR);
+ ~QQuickBusyIndicatorRing();
+
+protected:
+ QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) Q_DECL_OVERRIDE;
+};
+
+class QQuickBusyIndicatorAnimator : public QQuickAnimator
+{
+public:
+ QQuickBusyIndicatorAnimator(QObject *parent = Q_NULLPTR);
+
+protected:
+ QString propertyName() const Q_DECL_OVERRIDE;
+ QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickBusyIndicatorRing)
+
+#endif // QQUICKBUSYINDICATOR_P_H
diff --git a/src/imports/controls/qtlabscontrolsplugin.cpp b/src/imports/controls/qtlabscontrolsplugin.cpp
index 079d843d..c822d9be 100644
--- a/src/imports/controls/qtlabscontrolsplugin.cpp
+++ b/src/imports/controls/qtlabscontrolsplugin.cpp
@@ -38,9 +38,15 @@
#include <QtCore/qurl.h>
#include <QtCore/qcoreapplication.h>
+#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
#include <QtLabsTemplates/private/qquickbuttongroup_p.h>
+#include <QtLabsTemplates/private/qquickcontainer_p.h>
+#include <QtLabsTemplates/private/qquickcontrol_p.h>
+#include <QtLabsTemplates/private/qquickpopup_p.h>
#include <QtLabsControls/private/qquickstyleselector_p.h>
+#include "qquickbusyindicatorring_p.h"
+
static inline void initResources()
{
Q_INIT_RESOURCE(qtlabscontrolsplugin);
@@ -60,43 +66,48 @@ public:
void QtLabsControlsPlugin::registerTypes(const char *uri)
{
+ qmlRegisterType<QQuickAbstractButton>(uri, 1, 0, "AbstractButton");
qmlRegisterType<QQuickButtonGroup>(uri, 1, 0, "ButtonGroup");
qmlRegisterType<QQuickButtonGroupAttached>();
+ qmlRegisterType<QQuickContainer>(uri, 1, 0, "Container");
+ qmlRegisterType<QQuickControl>(uri, 1, 0, "Control");
- // TODO: read the style from application manifest file
- QQuickStyleSelector *selector = QQuickStyleSelector::instance();
- selector->setBaseUrl(baseUrl());
+ QQuickStyleSelector selector;
+ selector.setBaseUrl(baseUrl());
- qmlRegisterType(selector->select(QStringLiteral("/ApplicationWindow.qml")), uri, 1, 0, "ApplicationWindow");
- qmlRegisterType(selector->select(QStringLiteral("/BusyIndicator.qml")), uri, 1, 0, "BusyIndicator");
- qmlRegisterType(selector->select(QStringLiteral("/Button.qml")), uri, 1, 0, "Button");
- qmlRegisterType(selector->select(QStringLiteral("/CheckBox.qml")), uri, 1, 0, "CheckBox");
- qmlRegisterType(selector->select(QStringLiteral("/Dial.qml")), uri, 1, 0, "Dial");
- qmlRegisterType(selector->select(QStringLiteral("/Drawer.qml")), uri, 1, 0, "Drawer");
- qmlRegisterType(selector->select(QStringLiteral("/Frame.qml")), uri, 1, 0, "Frame");
- qmlRegisterType(selector->select(QStringLiteral("/GroupBox.qml")), uri, 1, 0, "GroupBox");
- qmlRegisterType(selector->select(QStringLiteral("/ItemDelegate.qml")), uri, 1, 0, "ItemDelegate");
- qmlRegisterType(selector->select(QStringLiteral("/Label.qml")), uri, 1, 0, "Label");
- qmlRegisterType(selector->select(QStringLiteral("/Menu.qml")), uri, 1, 0, "Menu");
- qmlRegisterType(selector->select(QStringLiteral("/MenuItem.qml")), uri, 1, 0, "MenuItem");
- qmlRegisterType(selector->select(QStringLiteral("/PageIndicator.qml")), uri, 1, 0, "PageIndicator");
- qmlRegisterType(selector->select(QStringLiteral("/ProgressBar.qml")), uri, 1, 0, "ProgressBar");
- qmlRegisterType(selector->select(QStringLiteral("/RadioButton.qml")), uri, 1, 0, "RadioButton");
- qmlRegisterType(selector->select(QStringLiteral("/RangeSlider.qml")), uri, 1, 0, "RangeSlider");
- qmlRegisterType(selector->select(QStringLiteral("/ScrollBar.qml")), uri, 1, 0, "ScrollBar");
- qmlRegisterType(selector->select(QStringLiteral("/ScrollIndicator.qml")), uri, 1, 0, "ScrollIndicator");
- qmlRegisterType(selector->select(QStringLiteral("/Slider.qml")), uri, 1, 0, "Slider");
- qmlRegisterType(selector->select(QStringLiteral("/SpinBox.qml")), uri, 1, 0, "SpinBox");
- qmlRegisterType(selector->select(QStringLiteral("/StackView.qml")), uri, 1, 0, "StackView");
- qmlRegisterType(selector->select(QStringLiteral("/SwipeView.qml")), uri, 1, 0, "SwipeView");
- qmlRegisterType(selector->select(QStringLiteral("/Switch.qml")), uri, 1, 0, "Switch");
- qmlRegisterType(selector->select(QStringLiteral("/TabBar.qml")), uri, 1, 0, "TabBar");
- qmlRegisterType(selector->select(QStringLiteral("/TabButton.qml")), uri, 1, 0, "TabButton");
- qmlRegisterType(selector->select(QStringLiteral("/TextArea.qml")), uri, 1, 0, "TextArea");
- qmlRegisterType(selector->select(QStringLiteral("/TextField.qml")), uri, 1, 0, "TextField");
- qmlRegisterType(selector->select(QStringLiteral("/ToolBar.qml")), uri, 1, 0, "ToolBar");
- qmlRegisterType(selector->select(QStringLiteral("/ToolButton.qml")), uri, 1, 0, "ToolButton");
- qmlRegisterType(selector->select(QStringLiteral("/Tumbler.qml")), uri, 1, 0, "Tumbler");
+ qmlRegisterType(selector.select(QStringLiteral("/ApplicationWindow.qml")), uri, 1, 0, "ApplicationWindow");
+ qmlRegisterType(selector.select(QStringLiteral("/BusyIndicator.qml")), uri, 1, 0, "BusyIndicator");
+ qmlRegisterType(selector.select(QStringLiteral("/Button.qml")), uri, 1, 0, "Button");
+ qmlRegisterType(selector.select(QStringLiteral("/CheckBox.qml")), uri, 1, 0, "CheckBox");
+ qmlRegisterType(selector.select(QStringLiteral("/ComboBox.qml")), uri, 1, 0, "ComboBox");
+ qmlRegisterType(selector.select(QStringLiteral("/Dial.qml")), uri, 1, 0, "Dial");
+ qmlRegisterType(selector.select(QStringLiteral("/Drawer.qml")), uri, 1, 0, "Drawer");
+ qmlRegisterType(selector.select(QStringLiteral("/Frame.qml")), uri, 1, 0, "Frame");
+ qmlRegisterType(selector.select(QStringLiteral("/GroupBox.qml")), uri, 1, 0, "GroupBox");
+ qmlRegisterType(selector.select(QStringLiteral("/ItemDelegate.qml")), uri, 1, 0, "ItemDelegate");
+ qmlRegisterType(selector.select(QStringLiteral("/Label.qml")), uri, 1, 0, "Label");
+ qmlRegisterType(selector.select(QStringLiteral("/Menu.qml")), uri, 1, 0, "Menu");
+ qmlRegisterType(selector.select(QStringLiteral("/MenuItem.qml")), uri, 1, 0, "MenuItem");
+ qmlRegisterType(selector.select(QStringLiteral("/Pane.qml")), uri, 1, 0, "Pane");
+ qmlRegisterType(selector.select(QStringLiteral("/PageIndicator.qml")), uri, 1, 0, "PageIndicator");
+ qmlRegisterType(selector.select(QStringLiteral("/Popup.qml")), uri, 1, 0, "Popup");
+ qmlRegisterType(selector.select(QStringLiteral("/ProgressBar.qml")), uri, 1, 0, "ProgressBar");
+ qmlRegisterType(selector.select(QStringLiteral("/RadioButton.qml")), uri, 1, 0, "RadioButton");
+ qmlRegisterType(selector.select(QStringLiteral("/RangeSlider.qml")), uri, 1, 0, "RangeSlider");
+ qmlRegisterType(selector.select(QStringLiteral("/ScrollBar.qml")), uri, 1, 0, "ScrollBar");
+ qmlRegisterType(selector.select(QStringLiteral("/ScrollIndicator.qml")), uri, 1, 0, "ScrollIndicator");
+ qmlRegisterType(selector.select(QStringLiteral("/Slider.qml")), uri, 1, 0, "Slider");
+ qmlRegisterType(selector.select(QStringLiteral("/SpinBox.qml")), uri, 1, 0, "SpinBox");
+ qmlRegisterType(selector.select(QStringLiteral("/StackView.qml")), uri, 1, 0, "StackView");
+ qmlRegisterType(selector.select(QStringLiteral("/SwipeView.qml")), uri, 1, 0, "SwipeView");
+ qmlRegisterType(selector.select(QStringLiteral("/Switch.qml")), uri, 1, 0, "Switch");
+ qmlRegisterType(selector.select(QStringLiteral("/TabBar.qml")), uri, 1, 0, "TabBar");
+ qmlRegisterType(selector.select(QStringLiteral("/TabButton.qml")), uri, 1, 0, "TabButton");
+ qmlRegisterType(selector.select(QStringLiteral("/TextArea.qml")), uri, 1, 0, "TextArea");
+ qmlRegisterType(selector.select(QStringLiteral("/TextField.qml")), uri, 1, 0, "TextField");
+ qmlRegisterType(selector.select(QStringLiteral("/ToolBar.qml")), uri, 1, 0, "ToolBar");
+ qmlRegisterType(selector.select(QStringLiteral("/ToolButton.qml")), uri, 1, 0, "ToolButton");
+ qmlRegisterType(selector.select(QStringLiteral("/Tumbler.qml")), uri, 1, 0, "Tumbler");
}
void QtLabsControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
@@ -104,6 +115,10 @@ void QtLabsControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
Q_UNUSED(engine);
Q_UNUSED(uri);
initResources();
+
+ const QByteArray import = QByteArray(uri) + ".impl";
+ qmlRegisterType<QQuickBusyIndicatorRing>(import, 1, 0, "BusyRing");
+ qmlRegisterType<QQuickBusyIndicatorAnimator>(import, 1, 0, "BusyRingAnimator");
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/qtlabscontrolsplugin.qrc b/src/imports/controls/qtlabscontrolsplugin.qrc
index c54083ed..1147ae3d 100644
--- a/src/imports/controls/qtlabscontrolsplugin.qrc
+++ b/src/imports/controls/qtlabscontrolsplugin.qrc
@@ -1,8 +1,5 @@
<RCC>
- <qresource prefix="/">
- <file>images/spinner_small.png</file>
- <file>images/spinner_medium.png</file>
- <file>images/spinner_large.png</file>
+ <qresource prefix="/qt-project.org/imports/Qt/labs/controls">
<file>images/check.png</file>
<file>images/check@2x.png</file>
<file>images/check@3x.png</file>
@@ -11,5 +8,9 @@
<file>images/dial-indicator@2x.png</file>
<file>images/dial-indicator@3x.png</file>
<file>images/dial-indicator@4x.png</file>
+ <file>images/drop-indicator.png</file>
+ <file>images/drop-indicator@2x.png</file>
+ <file>images/drop-indicator@3x.png</file>
+ <file>images/drop-indicator@4x.png</file>
</qresource>
</RCC>
diff --git a/src/imports/controls/universal/ApplicationWindow.qml b/src/imports/controls/universal/ApplicationWindow.qml
index 46b8e740..3113e748 100644
--- a/src/imports/controls/universal/ApplicationWindow.qml
+++ b/src/imports/controls/universal/ApplicationWindow.qml
@@ -37,9 +37,22 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.universal 1.0
+import Qt.labs.controls.universal.impl 1.0
T.ApplicationWindow {
id: window
color: Universal.altHighColor
+
+ overlay.background: Rectangle {
+ color: window.Universal.baseLowColor
+ }
+
+ FocusRectangle {
+ parent: window.activeFocusControl
+ width: parent ? parent.width : 0
+ height: parent ? parent.height : 0
+ visible: parent && !!parent.useSystemFocusVisuals
+ && (parent.focusReason === Qt.TabFocusReason || parent.focusReason === Qt.BacktabFocusReason)
+ }
}
diff --git a/src/imports/controls/universal/BusyIndicator.qml b/src/imports/controls/universal/BusyIndicator.qml
index 3e0e1f89..4a62b800 100644
--- a/src/imports/controls/universal/BusyIndicator.qml
+++ b/src/imports/controls/universal/BusyIndicator.qml
@@ -55,7 +55,7 @@ T.BusyIndicator {
readonly property real size: Math.min(control.availableWidth, control.availableHeight)
count: size < 60 ? 5 : 6 // "Small" vs. "Large"
- color: control.Universal.accentColor
+ color: control.Universal.accent
ProgressRingAnimator {
target: ring
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml
index 41198f89..c18f0a25 100644
--- a/src/imports/controls/universal/Button.qml
+++ b/src/imports/controls/universal/Button.qml
@@ -52,6 +52,8 @@ T.Button {
rightPadding: 8
bottomPadding: 4
+ property bool useSystemFocusVisuals: true
+
//! [label]
label: Text {
x: control.leftPadding
@@ -76,7 +78,7 @@ T.Button {
implicitHeight: 32
color: control.pressed ? control.Universal.baseMediumLowColor :
- control.enabled && (control.highlighted || control.checked) ? control.Universal.accentColor :
+ control.enabled && (control.highlighted || control.checked) ? control.Universal.accent :
control.Universal.baseLowColor
}
//! [background]
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index 52523ffd..07321a9c 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -53,6 +53,8 @@ T.CheckBox {
padding: 6
spacing: 8
+ property bool useSystemFocusVisuals: true
+
//! [indicator]
indicator: Rectangle {
id: normalRectangle
@@ -63,10 +65,10 @@ T.CheckBox {
color: !control.enabled ? "transparent" :
control.pressed && control.checkState !== Qt.PartiallyChecked ? control.Universal.baseMediumColor :
- control.checkState === Qt.Checked ? control.Universal.accentColor : "transparent"
+ control.checkState === Qt.Checked ? control.Universal.accent : "transparent"
border.color: !control.enabled ? control.Universal.baseLowColor :
control.pressed ? control.Universal.baseMediumColor :
- control.checked ? control.Universal.accentColor : control.Universal.baseMediumHighColor
+ control.checked ? control.Universal.accent : control.Universal.baseMediumHighColor
border.width: 2 // CheckBoxBorderThemeThickness
Image {
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
new file mode 100644
index 00000000..4e73321e
--- /dev/null
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Window 2.2
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.ComboBox {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ contentItem.implicitHeight + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ spacing: 10
+ topPadding: 5
+ leftPadding: 12
+ rightPadding: 10
+ bottomPadding: 7
+
+ font.pixelSize: Universal.fontSize
+ font.family: Universal.fontFamily
+
+ //! [delegate]
+ delegate: ItemDelegate {
+ width: control.width
+ text: control.textRole ? model[control.textRole] : modelData
+ highlighted: control.highlightedIndex === index
+ pressed: highlighted && control.pressed
+ }
+ //! [delegate]
+
+ //! [contentItem]
+ contentItem: Text {
+ text: control.displayText
+ font: control.font
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ renderType: Text.NativeRendering
+ elide: Text.ElideRight
+ rightPadding: 12 + control.spacing
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 120
+ implicitHeight: 32
+
+ border.width: 2 // ComboBoxBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed || popup.visible ? control.Universal.baseMediumLowColor : control.Universal.baseMediumLowColor
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed || popup.visible ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+
+ Rectangle {
+ x: 2
+ y: 2
+ width: parent.width - 4
+ height: parent.height - 4
+
+ visible: control.activeFocus && (control.focusReason === Qt.TabFocusReason || control.focusReason === Qt.BacktabFocusReason)
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+
+ Image {
+ id: checkmark
+ x: parent.width - width - control.rightPadding
+ y: (parent.height - height) / 2
+ source: "image://universal/downarrow/" + (!control.enabled ? control.Universal.baseLowColor : control.Universal.baseMediumHighColor)
+ }
+ }
+ //! [background]
+
+ //! [popup]
+ popup: T.Popup {
+ contentItem: Rectangle {
+ // TODO: Popup::anchors
+ readonly property var above: popup.visible ? control.mapToItem(null, 0, control.height - height) : Qt.point(0, 0)
+ readonly property var below: popup.visible ? control.mapToItem(null, 0, 0) : Qt.point(0, 0)
+
+ x: below.x
+ y: above.y >= 0 && below.y + height > control.Window.height ? above.y : below.y
+ width: control.width
+ height: listview.height
+
+ color: control.Universal.chromeMediumLowColor
+
+ ListView {
+ id: listview
+ width: control.width
+ height: Math.min(200, contentHeight) // TODO: 396
+
+ clip: true
+ model: control.delegateModel
+ currentIndex: control.highlightedIndex
+
+// ScrollIndicator.vertical: ScrollIndicator { }
+ }
+ }
+ }
+ //! [popup]
+}
diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml
index f80ff18b..9db1f8a5 100644
--- a/src/imports/controls/universal/Dial.qml
+++ b/src/imports/controls/universal/Dial.qml
@@ -46,6 +46,10 @@ T.Dial {
//! [background]
background: Rectangle {
+ x: control.width / 2 - width / 2
+ y: control.height / 2 - height / 2
+ width: Math.max(64, Math.min(control.width, control.height))
+ height: Math.max(64, Math.min(control.width, control.height))
radius: width / 2
color: "transparent"
border.color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseMediumColor
@@ -58,8 +62,8 @@ T.Dial {
implicitWidth: 20
implicitHeight: 20
- x: background.width / 2 - handle.width / 2
- y: background.height / 2 - handle.height / 2
+ x: background.x + background.width / 2 - handle.width / 2
+ y: background.y + background.height / 2 - handle.height / 2
radius: width / 2
color: !control.enabled ? control.Universal.baseLowColor :
@@ -67,7 +71,7 @@ T.Dial {
transform: [
Translate {
- y: -control.height * 0.35
+ y: -background.height * 0.4 + handle.height / 2
},
Rotation {
angle: control.angle
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
index cf7b7405..524203db 100644
--- a/src/imports/controls/universal/GroupBox.qml
+++ b/src/imports/controls/universal/GroupBox.qml
@@ -41,7 +41,9 @@ import Qt.labs.controls.universal 1.0
T.GroupBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ label ? label.implicitWidth + leftPadding + rightPadding : 0,
+ contentWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
@@ -49,7 +51,7 @@ T.GroupBox {
spacing: 12
padding: 12
- topPadding: 12 + (label && title ? label.implicitHeight + spacing : 0)
+ topPadding: 12 + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
//! [contentItem]
contentItem: Item { }
diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml
index d9156177..d2c9a4f3 100644
--- a/src/imports/controls/universal/ItemDelegate.qml
+++ b/src/imports/controls/universal/ItemDelegate.qml
@@ -48,6 +48,7 @@ T.ItemDelegate {
implicitHeight: Math.max(background ? background.implicitHeight : 0,
Math.max(label ? label.implicitHeight : 0,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: label ? label.y + label.baselineOffset : 0
spacing: 12
@@ -87,8 +88,16 @@ T.ItemDelegate {
//! [background]
background: Rectangle {
- visible: control.pressed
- color: control.Universal.listMediumColor
+ visible: control.pressed || control.highlighted || control.activeFocus
+ color: control.pressed ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.activeFocus || control.highlighted
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+
}
//! [background]
}
diff --git a/src/imports/controls/universal/Label.qml b/src/imports/controls/universal/Label.qml
index ee51c8cd..0484959e 100644
--- a/src/imports/controls/universal/Label.qml
+++ b/src/imports/controls/universal/Label.qml
@@ -42,6 +42,6 @@ T.Label {
id: control
color: !control.enabled ? Universal.baseLowColor : Universal.baseHighColor
- linkColor: Universal.accentColor
+ linkColor: Universal.accent
renderType: Text.NativeRendering
}
diff --git a/src/imports/controls/universal/Menu.qml b/src/imports/controls/universal/Menu.qml
new file mode 100644
index 00000000..fec16c16
--- /dev/null
+++ b/src/imports/controls/universal/Menu.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.controls 1.0
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Menu {
+ id: control
+
+ //! [contentItem]
+ contentItem: ListView {
+ implicitWidth: 200
+ implicitHeight: Math.min(contentHeight, 200)
+ model: control.contentModel
+ // TODO: improve this?
+ interactive: ApplicationWindow.window ? contentHeight > ApplicationWindow.window.height : false
+ clip: true
+ keyNavigationWraps: false
+ currentIndex: -1
+
+ ScrollIndicator.vertical: ScrollIndicator {}
+
+ Rectangle {
+ z: -1
+ width: parent.width
+ height: parent.height
+ color: control.Universal.chromeMediumLowColor
+ border.color: control.Universal.chromeHighColor
+ border.width: 1 // FlyoutBorderThemeThickness
+ }
+ }
+ //! [contentItem]
+}
diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml
new file mode 100644
index 00000000..fee5d886
--- /dev/null
+++ b/src/imports/controls/universal/MenuItem.qml
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.MenuItem {
+ id: control
+
+ implicitWidth: background ? background.implicitWidth
+ : (label ? label.implicitWidth : 0) + (indicator ? indicator.implicitWidth : 0)
+ + (label && indicator ? spacing : 0) + leftPadding + rightPadding
+ implicitHeight: background ? background.implicitHeight
+ : (label ? label.implicitHeight : 0) + (indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding
+ baselineOffset: label ? label.y + label.baselineOffset : 0
+
+ topPadding: 11
+ leftPadding: 12
+ rightPadding: 12
+ bottomPadding: 13
+ spacing: 12
+
+ //! [label]
+ label: Text {
+ x: control.mirrored || !control.checkable ? control.leftPadding : (indicator.x + indicator.width + control.spacing)
+ y: control.topPadding
+ width: control.availableWidth - (control.checkable ? indicator.width + control.spacing : 0)
+ height: control.availableHeight
+
+ text: control.text
+ font: control.font
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+ //! [label]
+
+ //! [indicator]
+ indicator: Image {
+ x: control.text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ visible: control.checked
+ source: !control.checkable ? "" : "image://universal/checkmark/" + (!control.enabled ? control.Universal.baseLowColor : control.pressed ? control.Universal.baseHighColor : control.Universal.baseMediumHighColor)
+ }
+ //! [indicator]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 200
+ implicitHeight: 40
+
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+
+ Rectangle {
+ x: 1; y: 1
+ width: parent.width - 2
+ height: parent.height - 2
+
+ visible: control.activeFocus
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/Pane.qml b/src/imports/controls/universal/Pane.qml
new file mode 100644
index 00000000..58c5214a
--- /dev/null
+++ b/src/imports/controls/universal/Pane.qml
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.Frame {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+
+ contentWidth: contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0
+ contentHeight: contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0
+
+ padding: 12
+
+ //! [contentItem]
+ contentItem: Item { }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ color: control.Universal.altHighColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml
index 14fd9bd7..df837fef 100644
--- a/src/imports/controls/universal/ProgressBar.qml
+++ b/src/imports/controls/universal/ProgressBar.qml
@@ -55,7 +55,7 @@ T.ProgressBar {
height: control.availableHeight
scale: control.mirrored ? -1 : 1
- color: control.Universal.accentColor
+ color: control.Universal.accent
ProgressStrip {
id: strip
@@ -65,7 +65,7 @@ T.ProgressBar {
clip: control.indeterminate
visible: control.indeterminate
- color: control.Universal.accentColor
+ color: control.Universal.accent
ProgressStripAnimator {
target: strip
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 02212c4f..04cd3dcc 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -53,6 +53,8 @@ T.RadioButton {
padding: 6
spacing: 8
+ property bool useSystemFocusVisuals: true
+
//! [indicator]
indicator: Rectangle {
id: outerEllipse
@@ -78,7 +80,7 @@ T.RadioButton {
color: "transparent"
border.width: 2 // RadioButtonBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.accentColor
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.accent
}
Rectangle {
diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml
index 285a04a7..f01c06ed 100644
--- a/src/imports/controls/universal/RangeSlider.qml
+++ b/src/imports/controls/universal/RangeSlider.qml
@@ -63,7 +63,7 @@ T.RangeSlider {
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
radius: 4
- color: control.first.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ color: control.first.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
//! [firstHandle]
@@ -78,7 +78,7 @@ T.RangeSlider {
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.second.visualPosition * (control.availableHeight - height))
radius: 4
- color: control.second.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ color: control.second.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
//! [secondHandle]
@@ -111,7 +111,7 @@ T.RangeSlider {
width: parent.horizontal ? control.second.position * parent.width - control.first.position * parent.width : 2 // SliderTrackThemeHeight
height: !parent.horizontal ? control.second.position * parent.height - control.first.position * parent.height : 2 // SliderTrackThemeHeight
- color: control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ color: control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
}
//! [track]
diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml
index 6a4107e6..66357c6e 100644
--- a/src/imports/controls/universal/Slider.qml
+++ b/src/imports/controls/universal/Slider.qml
@@ -50,6 +50,8 @@ T.Slider {
padding: 6
+ property bool useSystemFocusVisuals: true
+
//! [handle]
handle: Rectangle {
implicitWidth: horizontal ? 8 : 24
@@ -61,7 +63,7 @@ T.Slider {
y: control.topPadding + (horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height))
radius: 4
- color: control.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ color: control.pressed ? control.Universal.chromeHighColor : control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
//! [handle]
@@ -94,7 +96,7 @@ T.Slider {
width: parent.horizontal ? control.position * parent.width : 2 // SliderTrackThemeHeight
height: !parent.horizontal ? control.position * parent.height : 2 // SliderTrackThemeHeight
- color: control.enabled ? control.Universal.accentColor : control.Universal.chromeDisabledHighColor
+ color: control.enabled ? control.Universal.accent : control.Universal.chromeDisabledHighColor
}
}
//! [track]
diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml
index 97ea6c57..ac027d75 100644
--- a/src/imports/controls/universal/SpinBox.qml
+++ b/src/imports/controls/universal/SpinBox.qml
@@ -49,6 +49,7 @@ T.SpinBox {
background ? background.implicitHeight : 0,
up.indicator ? up.indicator.implicitHeight : 0,
down.indicator ? down.indicator.implicitHeight : 0)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
// TextControlThemePadding + 2 (border)
topPadding: 5
@@ -73,7 +74,7 @@ T.SpinBox {
font: control.font
color: !enabled ? control.Universal.chromeDisabledLowColor :
activeFocus ? control.Universal.chromeBlackHighColor : control.Universal.baseHighColor
- selectionColor: control.Universal.accentColor
+ selectionColor: control.Universal.accent
selectedTextColor: control.Universal.chromeWhiteColor
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: TextInput.AlignVCenter
@@ -86,16 +87,17 @@ T.SpinBox {
//! [up.indicator]
up.indicator: Item {
- implicitWidth: 26
- height: parent.height
+ implicitWidth: 28
+ height: parent.height + 4
+ y: -2
x: control.mirrored ? 0 : parent.width - width
Rectangle {
- x: 2; y: 2
+ x: 2; y: 4
width: parent.width - 4
- height: parent.height - 4
+ height: parent.height - 8
color: !control.up.pressed ? "transparent" :
- control.activeFocus ? control.Universal.accentColor
+ control.activeFocus ? control.Universal.accent
: control.Universal.chromeDisabledLowColor
}
@@ -110,16 +112,17 @@ T.SpinBox {
//! [down.indicator]
down.indicator: Item {
- implicitWidth: 26
- height: parent.height
+ implicitWidth: 28
+ height: parent.height + 4
+ y: -2
x: control.mirrored ? parent.width - width : 0
Rectangle {
- x: 2; y: 2
+ x: 2; y: 4
width: parent.width - 4
- height: parent.height - 4
+ height: parent.height - 8
color: !control.down.pressed ? "transparent" :
- control.activeFocus ? control.Universal.accentColor
+ control.activeFocus ? control.Universal.accent
: control.Universal.chromeDisabledLowColor
}
@@ -134,12 +137,12 @@ T.SpinBox {
//! [background]
background: Rectangle {
- implicitWidth: 60 + 26 // TextControlThemeMinWidth - 4 (border)
+ implicitWidth: 60 + 28 // TextControlThemeMinWidth - 4 (border)
implicitHeight: 28 // TextControlThemeMinHeight - 4 (border)
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.activeFocus ? control.Universal.accentColor : control.Universal.chromeDisabledLowColor
+ control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
}
//! [background]
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index 8b7c73f3..ca33e121 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -53,6 +53,8 @@ T.Switch {
padding: 5
spacing: 8
+ property bool useSystemFocusVisuals: true
+
//! [indicator]
indicator: Rectangle {
implicitWidth: 44
@@ -63,9 +65,9 @@ T.Switch {
radius: 10
color: !control.enabled ? "transparent" :
control.pressed ? control.Universal.baseMediumColor :
- control.checked ? control.Universal.accentColor : "transparent"
+ control.checked ? control.Universal.accent : "transparent"
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.checked && !control.pressed ? control.Universal.accentColor : control.Universal.baseMediumColor
+ control.checked && !control.pressed ? control.Universal.accent : control.Universal.baseMediumColor
border.width: 2
Rectangle {
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
index ec319b86..72b69cb9 100644
--- a/src/imports/controls/universal/TextArea.qml
+++ b/src/imports/controls/universal/TextArea.qml
@@ -58,7 +58,7 @@ T.TextArea {
color: !enabled ? Universal.chromeDisabledLowColor :
activeFocus ? Universal.chromeBlackHighColor : Universal.baseHighColor
- selectionColor: Universal.accentColor
+ selectionColor: Universal.accent
selectedTextColor: Universal.chromeWhiteColor
renderType: Text.NativeRendering
@@ -87,7 +87,7 @@ T.TextArea {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.activeFocus ? control.Universal.accentColor : control.Universal.chromeDisabledLowColor
+ control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
}
//! [background]
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index b4e217d2..1f066220 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -58,7 +58,7 @@ T.TextField {
color: !enabled ? Universal.chromeDisabledLowColor :
activeFocus ? Universal.chromeBlackHighColor : Universal.baseHighColor
- selectionColor: Universal.accentColor
+ selectionColor: Universal.accent
selectedTextColor: Universal.chromeWhiteColor
verticalAlignment: TextInput.AlignVCenter
renderType: Text.NativeRendering
@@ -88,7 +88,7 @@ T.TextField {
border.width: 2 // TextControlBorderThemeThickness
border.color: !control.enabled ? control.Universal.baseLowColor :
- control.activeFocus ? control.Universal.accentColor : control.Universal.chromeDisabledLowColor
+ control.activeFocus ? control.Universal.accent : control.Universal.chromeDisabledLowColor
color: control.enabled ? control.Universal.altHighColor : control.Universal.baseLowColor
}
//! [background]
diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml
index 6488044b..451e07c4 100644
--- a/src/imports/controls/universal/ToolButton.qml
+++ b/src/imports/controls/universal/ToolButton.qml
@@ -72,7 +72,7 @@ T.ToolButton {
implicitHeight: 48 // AppBarThemeCompactHeight
color: control.pressed ? control.Universal.listMediumColor :
- control.checkable && control.checked ? control.Universal.accentColor : "transparent"
+ control.enabled && (control.highlighted || control.checked) ? control.Universal.accent : "transparent"
}
//! [background]
}
diff --git a/src/imports/controls/universal/images/downarrow.png b/src/imports/controls/universal/images/downarrow.png
new file mode 100644
index 00000000..fef7b0f2
--- /dev/null
+++ b/src/imports/controls/universal/images/downarrow.png
Binary files differ
diff --git a/src/imports/controls/universal/images/downarrow@2x.png b/src/imports/controls/universal/images/downarrow@2x.png
new file mode 100644
index 00000000..eabf658a
--- /dev/null
+++ b/src/imports/controls/universal/images/downarrow@2x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/downarrow@3x.png b/src/imports/controls/universal/images/downarrow@3x.png
new file mode 100644
index 00000000..f9d39a2c
--- /dev/null
+++ b/src/imports/controls/universal/images/downarrow@3x.png
Binary files differ
diff --git a/src/imports/controls/universal/images/downarrow@4x.png b/src/imports/controls/universal/images/downarrow@4x.png
new file mode 100644
index 00000000..b252b588
--- /dev/null
+++ b/src/imports/controls/universal/images/downarrow@4x.png
Binary files differ
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
new file mode 100644
index 00000000..5153f96b
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalfocusrectangle.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickuniversalfocusrectangle_p.h"
+
+#include <QtGui/qpainter.h>
+
+QT_BEGIN_NAMESPACE
+
+QQuickUniversalFocusRectangle::QQuickUniversalFocusRectangle(QQuickItem *parent)
+ : QQuickPaintedItem(parent)
+{
+}
+
+void QQuickUniversalFocusRectangle::paint(QPainter *painter)
+{
+ const QRect bounds = boundingRect().toAlignedRect().adjusted(0, 0, -1, -1);
+
+ QPen pen;
+ pen.setWidth(1);
+ pen.setDashPattern(QVector<qreal>() << 1 << 1);
+
+ pen.setColor(Qt::white);
+ painter->setPen(pen);
+ painter->drawRect(bounds);
+
+ pen.setColor(Qt::black);
+ pen.setDashOffset(1);
+ painter->setPen(pen);
+ painter->drawRect(bounds);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h b/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
new file mode 100644
index 00000000..6b15bc8d
--- /dev/null
+++ b/src/imports/controls/universal/qquickuniversalfocusrectangle_p.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKUNIVERSALFOCUSRECTANGLE_P_H
+#define QQUICKUNIVERSALFOCUSRECTANGLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickpainteditem.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickUniversalFocusRectangle : public QQuickPaintedItem
+{
+ Q_OBJECT
+
+public:
+ QQuickUniversalFocusRectangle(QQuickItem *parent = Q_NULLPTR);
+
+ void paint(QPainter *painter) Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKUNIVERSALFOCUSRECTANGLE_P_H
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider.cpp b/src/imports/controls/universal/qquickuniversalimageprovider.cpp
index 8e63e6d8..7cb7b926 100644
--- a/src/imports/controls/universal/qquickuniversalimageprovider.cpp
+++ b/src/imports/controls/universal/qquickuniversalimageprovider.cpp
@@ -56,7 +56,7 @@ QImage QQuickUniversalImageProvider::requestImage(const QString &id, QSize *size
QString name = id.left(sep);
QString color = id.mid(sep + 1);
qreal dpr = qApp->primaryScreen()->devicePixelRatio();
- QString file = qt_findAtNxFile(QStringLiteral(":/org.qt-project/imports/Qt/labs/controls/universal/images/") + name + QStringLiteral(".png"), dpr);
+ QString file = qt_findAtNxFile(QStringLiteral(":/qt-project.org/imports/Qt/labs/controls/universal/images/") + name + QStringLiteral(".png"), dpr);
QImage image(file);
if (image.isNull()) {
diff --git a/src/imports/controls/universal/qquickuniversalimageprovider_p.h b/src/imports/controls/universal/qquickuniversalimageprovider_p.h
index 374d842d..15648157 100644
--- a/src/imports/controls/universal/qquickuniversalimageprovider_p.h
+++ b/src/imports/controls/universal/qquickuniversalimageprovider_p.h
@@ -60,8 +60,6 @@ public:
QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) Q_DECL_OVERRIDE;
};
-Q_DECLARE_TYPEINFO(QQuickUniversalImageProvider, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKUNIVERSALIMAGEPROVIDER_P_H
diff --git a/src/imports/controls/universal/qquickuniversalprogressring_p.h b/src/imports/controls/universal/qquickuniversalprogressring_p.h
index f8ed212c..1d484e3a 100644
--- a/src/imports/controls/universal/qquickuniversalprogressring_p.h
+++ b/src/imports/controls/universal/qquickuniversalprogressring_p.h
@@ -92,9 +92,8 @@ protected:
QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
};
-Q_DECLARE_TYPEINFO(QQuickUniversalProgressRing, Q_COMPLEX_TYPE);
-Q_DECLARE_TYPEINFO(QQuickUniversalProgressRingAnimator, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickUniversalProgressRing)
+
#endif // QQUICKUNIVERSALPROGRESSRING_P_H
diff --git a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
index f7c063b6..b61e73c6 100644
--- a/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
+++ b/src/imports/controls/universal/qquickuniversalprogressstrip_p.h
@@ -86,9 +86,9 @@ protected:
QQuickAnimatorJob *createJob() const Q_DECL_OVERRIDE;
};
-Q_DECLARE_TYPEINFO(QQuickUniversalProgressStrip, Q_COMPLEX_TYPE);
-Q_DECLARE_TYPEINFO(QQuickUniversalProgressStripAnimator, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickUniversalProgressStrip)
+QML_DECLARE_TYPE(QQuickUniversalProgressStripAnimator)
+
#endif // QQUICKUNIVERSALPROGRESSSTRIP_P_H
diff --git a/src/imports/controls/universal/qquickuniversalstyle.cpp b/src/imports/controls/universal/qquickuniversalstyle.cpp
index f2bfd70d..6634763c 100644
--- a/src/imports/controls/universal/qquickuniversalstyle.cpp
+++ b/src/imports/controls/universal/qquickuniversalstyle.cpp
@@ -37,13 +37,11 @@
#include "qquickuniversalstyle_p.h"
#include <QtCore/qdebug.h>
+#include <QtCore/qsettings.h>
#include <QtLabsControls/private/qquickstyle_p.h>
QT_BEGIN_NAMESPACE
-static const QQuickUniversalStyle::Theme DefaultTheme = QQuickUniversalStyle::Light;
-static const QQuickUniversalStyle::Accent DefaultAccent = QQuickUniversalStyle::Cobalt;
-
static QColor qquickuniversal_light_color(QQuickUniversalStyle::SystemColor role)
{
static const QRgb colors[] = {
@@ -106,37 +104,40 @@ static QColor qquickuniversal_dark_color(QQuickUniversalStyle::SystemColor role)
return QColor::fromRgba(colors[role]);
}
-static QColor qquickuniversal_accent_color(QQuickUniversalStyle::Accent accent)
+static QRgb qquickuniversal_accent_color(QQuickUniversalStyle::Accent accent)
{
static const QRgb colors[] = {
- 0xA4C400, // Lime
- 0x60A917, // Green
- 0x008A00, // Emerald
- 0x00ABA9, // Teal
- 0x1BA1E2, // Cyan
- 0x3E65FF, // Cobalt
- 0x6A00FF, // Indigo
- 0xAA00FF, // Violet
- 0xF472D0, // Pink
- 0xD80073, // Magenta
- 0xA20025, // Crimson
- 0xE51400, // Red
- 0xFA6800, // Orange
- 0xF0A30A, // Amber
- 0xE3C800, // Yellow
- 0x825A2C, // Brown
- 0x6D8764, // Olive
- 0x647687, // Steel
- 0x76608A, // Mauve
- 0x87794E // Taupe
+ 0xFFA4C400, // Lime
+ 0xFF60A917, // Green
+ 0xFF008A00, // Emerald
+ 0xFF00ABA9, // Teal
+ 0xFF1BA1E2, // Cyan
+ 0xFF3E65FF, // Cobalt
+ 0xFF6A00FF, // Indigo
+ 0xFFAA00FF, // Violet
+ 0xFFF472D0, // Pink
+ 0xFFD80073, // Magenta
+ 0xFFA20025, // Crimson
+ 0xFFE51400, // Red
+ 0xFFFA6800, // Orange
+ 0xFFF0A30A, // Amber
+ 0xFFE3C800, // Yellow
+ 0xFF825A2C, // Brown
+ 0xFF6D8764, // Olive
+ 0xFF647687, // Steel
+ 0xFF76608A, // Mauve
+ 0xFF87794E // Taupe
};
return colors[accent];
}
+static QQuickUniversalStyle::Theme DefaultTheme = QQuickUniversalStyle::Light;
+static QRgb DefaultAccent = qquickuniversal_accent_color(QQuickUniversalStyle::Cobalt);
+
QQuickUniversalStyle::QQuickUniversalStyle(QObject *parent) : QQuickStyle(parent),
m_hasTheme(false), m_hasAccent(false), m_theme(DefaultTheme), m_accent(DefaultAccent)
{
- init(); // TODO: lazy init?
+ init();
}
QQuickUniversalStyle *QQuickUniversalStyle::qmlAttachedProperties(QObject *object)
@@ -188,17 +189,35 @@ void QQuickUniversalStyle::resetTheme()
}
}
-QQuickUniversalStyle::Accent QQuickUniversalStyle::accent() const
-{
- return m_accent;
-}
-
-void QQuickUniversalStyle::setAccent(Accent accent)
-{
- if (accent < Lime || accent > Taupe) {
- qWarning() << "QQuickUniversalStyle: unknown accent" << accent;
- return;
+QVariant QQuickUniversalStyle::accent() const
+{
+ return QColor::fromRgba(m_accent);
+}
+
+void QQuickUniversalStyle::setAccent(const QVariant &var)
+{
+ QRgb accent = 0;
+ if (var.type() == QVariant::Int) {
+ int val = var.toInt();
+ if (val < Lime || val > Taupe) {
+ qWarning() << "QQuickUniversalStyle: unknown accent" << val;
+ return;
+ }
+ accent = qquickuniversal_accent_color(static_cast<Accent>(val));
+ } else {
+ int val = QMetaEnum::fromType<Accent>().keyToValue(var.toByteArray());
+ if (val != -1) {
+ accent = qquickuniversal_accent_color(static_cast<Accent>(val));
+ } else {
+ QColor color(var.toString());
+ if (!color.isValid()) {
+ qWarning() << "QQuickUniversalStyle: unknown accent" << var.toString();
+ return;
+ }
+ accent = color.rgba();
+ }
}
+
m_hasAccent = true;
if (m_accent != accent) {
m_accent = accent;
@@ -207,7 +226,7 @@ void QQuickUniversalStyle::setAccent(Accent accent)
}
}
-void QQuickUniversalStyle::inheritAccent(Accent accent)
+void QQuickUniversalStyle::inheritAccent(QRgb accent)
{
if (!m_hasAccent && m_accent != accent) {
m_accent = accent;
@@ -230,15 +249,10 @@ void QQuickUniversalStyle::resetAccent()
if (m_hasAccent) {
m_hasAccent = false;
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(parentStyle());
- inheritAccent(universal ? universal->accent() : DefaultAccent);
+ inheritAccent(universal ? universal->m_accent : DefaultAccent);
}
}
-QColor QQuickUniversalStyle::accentColor() const
-{
- return qquickuniversal_accent_color(m_accent);
-}
-
QColor QQuickUniversalStyle::altHighColor() const
{
return getColor(AltHigh);
@@ -370,8 +384,46 @@ void QQuickUniversalStyle::parentStyleChange(QQuickStyle *newParent, QQuickStyle
QQuickUniversalStyle *universal = qobject_cast<QQuickUniversalStyle *>(newParent);
if (universal) {
inheritTheme(universal->theme());
- inheritAccent(universal->accent());
+ inheritAccent(universal->m_accent);
+ }
+}
+
+template <typename Enum>
+static Enum readEnumValue(QSettings *settings, const QString &name, bool *ok)
+{
+ int value = -1;
+ *ok = settings->contains(name);
+ if (*ok) {
+ QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
+ value = enumeration.keyToValue(settings->value(name).toByteArray(), ok);
}
+ return static_cast<Enum>(value);
+}
+
+void QQuickUniversalStyle::init()
+{
+ static bool defaultsInitialized = false;
+ if (!defaultsInitialized) {
+ QSharedPointer<QSettings> settings = QQuickStyle::settings(QStringLiteral("Universal"));
+ if (!settings.isNull()) {
+ bool ok = false;
+ Theme theme = readEnumValue<Theme>(settings.data(), QStringLiteral("Theme"), &ok);
+ if (ok)
+ DefaultTheme = m_theme = theme;
+
+ Accent accent = readEnumValue<Accent>(settings.data(), QStringLiteral("Accent"), &ok);
+ if (ok) {
+ DefaultAccent = m_accent = qquickuniversal_accent_color(accent);
+ } else {
+ QColor color(settings->value(QStringLiteral("Accent")).toString());
+ if (color.isValid())
+ DefaultAccent = m_accent = color.rgba();
+ }
+ }
+ defaultsInitialized = true;
+ }
+
+ QQuickStyle::init(); // TODO: lazy init?
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversalstyle_p.h b/src/imports/controls/universal/qquickuniversalstyle_p.h
index 3bf0bb5d..00a04c65 100644
--- a/src/imports/controls/universal/qquickuniversalstyle_p.h
+++ b/src/imports/controls/universal/qquickuniversalstyle_p.h
@@ -59,9 +59,8 @@ class QQuickUniversalStyle : public QQuickStyle
{
Q_OBJECT
Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL)
- Q_PROPERTY(Accent accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL)
+ Q_PROPERTY(QVariant accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL)
- Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL)
Q_PROPERTY(QColor altHighColor READ altHighColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor altLowColor READ altLowColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor altMediumColor READ altMediumColor NOTIFY paletteChanged FINAL)
@@ -125,13 +124,12 @@ public:
};
Q_ENUM(Accent)
- Accent accent() const;
- void setAccent(Accent accent);
- void inheritAccent(Accent accent);
+ QVariant accent() const;
+ void setAccent(const QVariant &accent);
+ void inheritAccent(QRgb accent);
void propagateAccent();
void resetAccent();
- QColor accentColor() const;
QColor altHighColor() const;
QColor altLowColor() const;
QColor altMediumColor() const;
@@ -195,10 +193,12 @@ protected:
void parentStyleChange(QQuickStyle *newParent, QQuickStyle *oldParent) Q_DECL_OVERRIDE;
private:
+ void init();
+
bool m_hasTheme;
bool m_hasAccent;
QQuickUniversalStyle::Theme m_theme;
- QQuickUniversalStyle::Accent m_accent;
+ QRgb m_accent;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp
index fd470ba6..e3899d53 100644
--- a/src/imports/controls/universal/qquickuniversaltheme.cpp
+++ b/src/imports/controls/universal/qquickuniversaltheme.cpp
@@ -43,13 +43,13 @@ QT_BEGIN_NAMESPACE
QQuickUniversalTheme::QQuickUniversalTheme(QPlatformTheme *theme)
: QQuickProxyTheme(theme)
{
- systemFont = QFont(QLatin1Literal("Sege UI"));
+ systemFont = QFont(QStringLiteral("Segoe UI"));
systemFont.setPixelSize(15);
- mdiSubWindowTitleFont = systemFont;
- mdiSubWindowTitleFont.setWeight(QFont::DemiBold);
- dockWidgetTitleFont = QFont(QLatin1Literal("Sege UI"));
- dockWidgetTitleFont.setPixelSize(24);
- dockWidgetTitleFont.setWeight(QFont::Light);
+ groupBoxTitleFont = systemFont;
+ groupBoxTitleFont.setWeight(QFont::DemiBold);
+ tabButtonFont = QFont(QStringLiteral("Segoe UI"));
+ tabButtonFont.setPixelSize(24);
+ tabButtonFont.setWeight(QFont::Light);
}
QQuickUniversalTheme::~QQuickUniversalTheme()
@@ -59,10 +59,10 @@ QQuickUniversalTheme::~QQuickUniversalTheme()
const QFont *QQuickUniversalTheme::font(QPlatformTheme::Font type) const
{
switch (type) {
- case QPlatformTheme::MdiSubWindowTitleFont:
- return &mdiSubWindowTitleFont;
- case QPlatformTheme::DockWidgetTitleFont:
- return &dockWidgetTitleFont;
+ case QPlatformTheme::GroupBoxTitleFont:
+ return &groupBoxTitleFont;
+ case QPlatformTheme::TabButtonFont:
+ return &tabButtonFont;
default:
return &systemFont;
}
diff --git a/src/imports/controls/universal/qquickuniversaltheme_p.h b/src/imports/controls/universal/qquickuniversaltheme_p.h
index c014ead2..20243917 100644
--- a/src/imports/controls/universal/qquickuniversaltheme_p.h
+++ b/src/imports/controls/universal/qquickuniversaltheme_p.h
@@ -65,8 +65,8 @@ public:
private:
QFont systemFont;
- QFont mdiSubWindowTitleFont; // QQuickGroupBox
- QFont dockWidgetTitleFont; // QQuickTabButton
+ QFont groupBoxTitleFont;
+ QFont tabButtonFont;
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
index 2cf6fb67..703da011 100644
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include <QtQml/qqmlextensionplugin.h>
+#include "qquickuniversalfocusrectangle_p.h"
#include "qquickuniversalimageprovider_p.h"
#include "qquickuniversalprogressring_p.h"
#include "qquickuniversalprogressstrip_p.h"
@@ -81,8 +82,8 @@ void QtLabsUniversalStylePlugin::registerTypes(const char *uri)
void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
{
- QQuickStyleSelector *selector = QQuickStyleSelector::instance();
- if (selector && selector->style() == QStringLiteral("universal")) {
+ QQuickStyleSelector selector;
+ if (selector.style() == QStringLiteral("universal")) {
if (QFont(QStringLiteral("Segoe UI")).family() == QStringLiteral("Segoe UI")) {
QPlatformTheme *old = QGuiApplicationPrivate::platform_theme;
if (old) {
@@ -96,6 +97,7 @@ void QtLabsUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const char
engine->addImageProvider(QStringLiteral("universal"), new QQuickUniversalImageProvider);
QByteArray import = QByteArray(uri) + ".impl";
+ qmlRegisterType<QQuickUniversalFocusRectangle>(import, 1, 0, "FocusRectangle");
qmlRegisterType<QQuickUniversalProgressRing>(import, 1, 0, "ProgressRing");
qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 1, 0, "ProgressRingAnimator");
qmlRegisterType<QQuickUniversalProgressStrip>(import, 1, 0, "ProgressStrip");
diff --git a/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc b/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
index 6cd57f89..5a0249d7 100644
--- a/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
+++ b/src/imports/controls/universal/qtlabsuniversalstyleplugin.qrc
@@ -1,9 +1,13 @@
<!DOCTYPE RCC><RCC version="1.0">
-<qresource prefix="org.qt-project/imports/Qt/labs/controls/universal">
+<qresource prefix="qt-project.org/imports/Qt/labs/controls/universal">
<file>images/checkmark.png</file>
<file>images/checkmark@2x.png</file>
<file>images/checkmark@3x.png</file>
<file>images/checkmark@4x.png</file>
+ <file>images/downarrow.png</file>
+ <file>images/downarrow@2x.png</file>
+ <file>images/downarrow@3x.png</file>
+ <file>images/downarrow@4x.png</file>
<file>images/leftarrow.png</file>
<file>images/leftarrow@2x.png</file>
<file>images/leftarrow@3x.png</file>
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index 4865e499..8736d352 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -3,11 +3,15 @@ QML_FILES += \
$$PWD/BusyIndicator.qml \
$$PWD/Button.qml \
$$PWD/CheckBox.qml \
+ $$PWD/ComboBox.qml \
$$PWD/Dial.qml \
$$PWD/Frame.qml \
$$PWD/GroupBox.qml \
$$PWD/ItemDelegate.qml \
$$PWD/Label.qml \
+ $$PWD/Menu.qml \
+ $$PWD/MenuItem.qml \
+ $$PWD/Pane.qml \
$$PWD/PageIndicator.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
@@ -27,6 +31,7 @@ QML_FILES += \
$$PWD/Tumbler.qml
HEADERS += \
+ $$PWD/qquickuniversalfocusrectangle_p.h \
$$PWD/qquickuniversalimageprovider_p.h \
$$PWD/qquickuniversalprogressring_p.h \
$$PWD/qquickuniversalprogressstrip_p.h \
@@ -34,6 +39,7 @@ HEADERS += \
$$PWD/qquickuniversaltheme_p.h
SOURCES += \
+ $$PWD/qquickuniversalfocusrectangle.cpp \
$$PWD/qquickuniversalimageprovider.cpp \
$$PWD/qquickuniversalprogressring.cpp \
$$PWD/qquickuniversalprogressstrip.cpp \
diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes
index 5d71559c..e96c09d9 100644
--- a/src/imports/templates/plugins.qmltypes
+++ b/src/imports/templates/plugins.qmltypes
@@ -12,10 +12,13 @@ Module {
name: "QQuickAbstractButton"
defaultProperty: "data"
prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/AbstractButton 1.0"]
+ exportMetaObjectRevisions: [0]
Property { name: "text"; type: "string" }
Property { name: "pressed"; type: "bool" }
Property { name: "checked"; type: "bool" }
Property { name: "checkable"; type: "bool" }
+ Property { name: "highlighted"; type: "bool" }
Property { name: "autoExclusive"; type: "bool" }
Property { name: "autoRepeat"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
@@ -45,10 +48,24 @@ Module {
prototype: "QQuickWindowQmlImpl"
exports: ["Qt.labs.templates/ApplicationWindow 1.0"]
exportMetaObjectRevisions: [0]
+ attachedType: "QQuickApplicationWindowAttached"
Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "data"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "activeFocusControl"; type: "QQuickItem"; isReadonly: true; isPointer: true }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
+ Property { name: "overlay"; type: "QQuickOverlay"; isReadonly: true; isPointer: true }
+ Property { name: "font"; type: "QFont" }
+ }
+ Component {
+ name: "QQuickApplicationWindowAttached"
+ prototype: "QObject"
+ Property { name: "window"; type: "QQuickApplicationWindow"; isReadonly: true; isPointer: true }
+ Property { name: "contentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "activeFocusControl"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "header"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "footer"; type: "QQuickItem"; isReadonly: true; isPointer: true }
+ Property { name: "overlay"; type: "QQuickItem"; isReadonly: true; isPointer: true }
}
Component {
name: "QQuickBusyIndicator"
@@ -57,7 +74,6 @@ Module {
exports: ["Qt.labs.templates/BusyIndicator 1.0"]
exportMetaObjectRevisions: [0]
Property { name: "running"; type: "bool" }
- Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
}
Component {
name: "QQuickButton"
@@ -76,6 +92,48 @@ Module {
Property { name: "checkState"; type: "Qt::CheckState" }
}
Component {
+ name: "QQuickComboBox"
+ defaultProperty: "data"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/ComboBox 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "count"; type: "int"; isReadonly: true }
+ Property { name: "model"; type: "QVariant" }
+ Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
+ Property { name: "pressed"; type: "bool" }
+ Property { name: "highlightedIndex"; type: "int"; isReadonly: true }
+ Property { name: "currentIndex"; type: "int" }
+ Property { name: "currentText"; type: "string"; isReadonly: true }
+ Property { name: "displayText"; type: "string" }
+ Property { name: "textRole"; type: "string" }
+ Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "popup"; type: "QQuickPopup"; isPointer: true }
+ Signal {
+ name: "activated"
+ Parameter { name: "index"; type: "int" }
+ }
+ Signal {
+ name: "highlighted"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "textAt"
+ type: "string"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "find"
+ type: "int"
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "flags"; type: "Qt::MatchFlags" }
+ }
+ Method {
+ name: "find"
+ type: "int"
+ Parameter { name: "text"; type: "string" }
+ }
+ }
+ Component {
name: "QQuickContainer"
defaultProperty: "contentData"
prototype: "QQuickControl"
@@ -87,7 +145,6 @@ Module {
Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
Property { name: "currentIndex"; type: "int" }
Property { name: "currentItem"; type: "QQuickItem"; isReadonly: true; isPointer: true }
- Property { name: "exclusive"; type: "bool" }
Method {
name: "setCurrentIndex"
Parameter { name: "index"; type: "int" }
@@ -131,9 +188,9 @@ Module {
Property { name: "rightPadding"; type: "double" }
Property { name: "bottomPadding"; type: "double" }
Property { name: "spacing"; type: "double" }
- Property { name: "layoutDirection"; type: "Qt::LayoutDirection" }
- Property { name: "effectiveLayoutDirection"; type: "Qt::LayoutDirection"; isReadonly: true }
+ Property { name: "locale"; type: "QLocale" }
Property { name: "mirrored"; type: "bool"; isReadonly: true }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
}
@@ -180,14 +237,10 @@ Module {
Component {
name: "QQuickFrame"
defaultProperty: "contentData"
- prototype: "QQuickControl"
+ prototype: "QQuickPane"
exports: ["Qt.labs.templates/Frame 1.0"]
exportMetaObjectRevisions: [0]
- Property { name: "contentWidth"; type: "double" }
- Property { name: "contentHeight"; type: "double" }
Property { name: "frame"; type: "QQuickItem"; isPointer: true }
- Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
}
Component {
name: "QQuickGroupBox"
@@ -362,6 +415,13 @@ Module {
}
}
Component {
+ name: "QQuickItemDelegate"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/ItemDelegate 1.0"]
+ exportMetaObjectRevisions: [0]
+ }
+ Component {
name: "QQuickLabel"
defaultProperty: "data"
prototype: "QQuickText"
@@ -371,6 +431,54 @@ Module {
Property { name: "background"; type: "QQuickItem"; isPointer: true }
}
Component {
+ name: "QQuickMenu"
+ defaultProperty: "contentData"
+ prototype: "QQuickPopup"
+ exports: ["Qt.labs.templates/Menu 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "contentModel"; type: "QVariant"; isReadonly: true }
+ Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
+ Method {
+ name: "itemAt"
+ type: "QQuickItem*"
+ Parameter { name: "index"; type: "int" }
+ }
+ Method {
+ name: "addItem"
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "insertItem"
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "item"; type: "QQuickItem"; isPointer: true }
+ }
+ Method {
+ name: "moveItem"
+ Parameter { name: "from"; type: "int" }
+ Parameter { name: "to"; type: "int" }
+ }
+ Method {
+ name: "removeItem"
+ Parameter { name: "index"; type: "int" }
+ }
+ }
+ Component {
+ name: "QQuickMenuItem"
+ defaultProperty: "data"
+ prototype: "QQuickAbstractButton"
+ exports: ["Qt.labs.templates/MenuItem 1.0"]
+ exportMetaObjectRevisions: [0]
+ Signal { name: "triggered" }
+ }
+ Component {
+ name: "QQuickOverlay"
+ defaultProperty: "data"
+ prototype: "QQuickItem"
+ Property { name: "background"; type: "QQuickItem"; isPointer: true }
+ Signal { name: "pressed" }
+ Signal { name: "released" }
+ }
+ Component {
name: "QQuickPageIndicator"
defaultProperty: "data"
prototype: "QQuickControl"
@@ -382,6 +490,36 @@ Module {
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
}
Component {
+ name: "QQuickPane"
+ defaultProperty: "contentData"
+ prototype: "QQuickControl"
+ exports: ["Qt.labs.templates/Pane 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "contentWidth"; type: "double" }
+ Property { name: "contentHeight"; type: "double" }
+ Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
+ Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
+ }
+ Component {
+ name: "QQuickPopup"
+ prototype: "QObject"
+ exports: ["Qt.labs.templates/Popup 1.0"]
+ exportMetaObjectRevisions: [0]
+ Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "focus"; type: "bool" }
+ Property { name: "modal"; type: "bool" }
+ Property { name: "visible"; type: "bool"; isReadonly: true }
+ Property { name: "enter"; type: "QQuickTransition"; isPointer: true }
+ Property { name: "exit"; type: "QQuickTransition"; isPointer: true }
+ Signal { name: "pressedOutside" }
+ Signal { name: "releasedOutside" }
+ Signal { name: "clickedOutside" }
+ Signal { name: "aboutToShow" }
+ Signal { name: "aboutToHide" }
+ Method { name: "open" }
+ Method { name: "close" }
+ }
+ Component {
name: "QQuickProgressBar"
defaultProperty: "data"
prototype: "QQuickControl"
@@ -534,7 +672,6 @@ Module {
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
Property { name: "stepSize"; type: "int" }
- Property { name: "locale"; type: "QLocale" }
Property { name: "validator"; type: "QValidator"; isPointer: true }
Property { name: "textFromValue"; type: "QJSValue" }
Property { name: "valueFromText"; type: "QJSValue" }
@@ -858,6 +995,7 @@ Module {
Property { name: "implicitHeight"; type: "double" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
Signal {
name: "pressAndHold"
Parameter { name: "event"; type: "QQuickMouseEvent"; isPointer: true }
@@ -1135,6 +1273,7 @@ Module {
Property { name: "implicitHeight"; type: "double" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "placeholderText"; type: "string" }
+ Property { name: "focusReason"; type: "Qt::FocusReason" }
Signal {
name: "pressAndHold"
Parameter { name: "mouse"; type: "QQuickMouseEvent"; isPointer: true }
diff --git a/src/imports/templates/qtlabstemplatesplugin.cpp b/src/imports/templates/qtlabstemplatesplugin.cpp
index 721e4cab..76698b90 100644
--- a/src/imports/templates/qtlabstemplatesplugin.cpp
+++ b/src/imports/templates/qtlabstemplatesplugin.cpp
@@ -41,6 +41,7 @@
#include <QtLabsTemplates/private/qquickbusyindicator_p.h>
#include <QtLabsTemplates/private/qquickbutton_p.h>
#include <QtLabsTemplates/private/qquickcheckbox_p.h>
+#include <QtLabsTemplates/private/qquickcombobox_p.h>
#include <QtLabsTemplates/private/qquickcontrol_p.h>
#include <QtLabsTemplates/private/qquickcontainer_p.h>
#include <QtLabsTemplates/private/qquickdial_p.h>
@@ -51,8 +52,10 @@
#include <QtLabsTemplates/private/qquicklabel_p.h>
#include <QtLabsTemplates/private/qquickmenu_p.h>
#include <QtLabsTemplates/private/qquickmenuitem_p.h>
+#include <QtLabsTemplates/private/qquickoverlay_p.h>
#include <QtLabsTemplates/private/qquickpageindicator_p.h>
-#include <QtLabsTemplates/private/qquickpanel_p.h>
+#include <QtLabsTemplates/private/qquickpane_p.h>
+#include <QtLabsTemplates/private/qquickpopup_p.h>
#include <QtLabsTemplates/private/qquickprogressbar_p.h>
#include <QtLabsTemplates/private/qquickradiobutton_p.h>
#include <QtLabsTemplates/private/qquickrangeslider_p.h>
@@ -90,6 +93,7 @@ void QtLabsTemplatesPlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickBusyIndicator>(uri, 1, 0, "BusyIndicator");
qmlRegisterType<QQuickButton>(uri, 1, 0, "Button");
qmlRegisterType<QQuickCheckBox>(uri, 1, 0, "CheckBox");
+ qmlRegisterType<QQuickComboBox>(uri, 1, 0, "ComboBox");
qmlRegisterType<QQuickContainer>(uri, 1, 0, "Container");
qmlRegisterType<QQuickControl>(uri, 1, 0, "Control");
qmlRegisterType<QQuickDial>(uri, 1, 0, "Dial");
@@ -100,8 +104,10 @@ void QtLabsTemplatesPlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickLabel>(uri, 1, 0, "Label");
qmlRegisterType<QQuickMenu>(uri, 1, 0, "Menu");
qmlRegisterType<QQuickMenuItem>(uri, 1, 0, "MenuItem");
+ qmlRegisterType<QQuickOverlay>();
qmlRegisterType<QQuickPageIndicator>(uri, 1, 0, "PageIndicator");
- qmlRegisterType<QQuickPanel>(uri, 1, 0, "Panel");
+ qmlRegisterType<QQuickPane>(uri, 1, 0, "Pane");
+ qmlRegisterType<QQuickPopup>(uri, 1, 0, "Popup");
qmlRegisterType<QQuickProgressBar>(uri, 1, 0, "ProgressBar");
qmlRegisterType<QQuickRadioButton>(uri, 1, 0, "RadioButton");
qmlRegisterType<QQuickRangeSlider>(uri, 1, 0, "RangeSlider");
diff --git a/src/src.pro b/src/src.pro
index 7223eec9..1492f15e 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -1,7 +1,7 @@
TEMPLATE = subdirs
SUBDIRS += \
+ templates \
controls \
- imports \
- templates
+ imports
imports.depends = controls templates
diff --git a/src/templates/qquickabstractbutton.cpp b/src/templates/qquickabstractbutton.cpp
index 74058daf..d2f1c7ec 100644
--- a/src/templates/qquickabstractbutton.cpp
+++ b/src/templates/qquickabstractbutton.cpp
@@ -109,7 +109,7 @@ static const int AUTO_REPEAT_INTERVAL = 100;
*/
QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate() :
- pressed(false), checked(false), checkable(false), autoExclusive(false), autoRepeat(false),
+ pressed(false), checked(false), checkable(false), highlighted(false), autoExclusive(false), autoRepeat(false),
delayTimer(0), repeatTimer(0), repeatButton(Qt::NoButton), label(Q_NULLPTR), indicator(Q_NULLPTR), group(Q_NULLPTR)
{
}
@@ -297,6 +297,31 @@ void QQuickAbstractButton::setCheckable(bool checkable)
}
/*!
+ \qmlproperty bool Qt.labs.controls::AbstractButton::highlighted
+
+ This property holds whether the button is highlighted.
+
+ A button can be highlighted in order to draw the user's attention towards
+ it. It has no effect on keyboard interaction.
+
+ The default value is \c false.
+*/
+bool QQuickAbstractButton::isHighlighted() const
+{
+ Q_D(const QQuickAbstractButton);
+ return d->highlighted;
+}
+
+void QQuickAbstractButton::setHighlighted(bool highlighted)
+{
+ Q_D(QQuickAbstractButton);
+ if (highlighted != d->highlighted) {
+ d->highlighted = highlighted;
+ emit highlightedChanged();
+ }
+}
+
+/*!
\qmlproperty bool Qt.labs.controls::AbstractButton::autoExclusive
This property holds whether auto-exclusivity is enabled.
diff --git a/src/templates/qquickabstractbutton_p.h b/src/templates/qquickabstractbutton_p.h
index 24998520..e0296dc0 100644
--- a/src/templates/qquickabstractbutton_p.h
+++ b/src/templates/qquickabstractbutton_p.h
@@ -62,6 +62,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickAbstractButton : public QQuickControl
Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
+ Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive NOTIFY autoExclusiveChanged FINAL)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY autoRepeatChanged FINAL)
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
@@ -83,6 +84,9 @@ public:
bool isCheckable() const;
void setCheckable(bool checkable);
+ bool isHighlighted() const;
+ void setHighlighted(bool highlighted);
+
bool autoExclusive() const;
void setAutoExclusive(bool exclusive);
@@ -108,6 +112,7 @@ Q_SIGNALS:
void pressedChanged();
void checkedChanged();
void checkableChanged();
+ void highlightedChanged();
void autoExclusiveChanged();
void autoRepeatChanged();
void indicatorChanged();
@@ -139,8 +144,8 @@ private:
Q_DECLARE_PRIVATE(QQuickAbstractButton)
};
-Q_DECLARE_TYPEINFO(QQuickAbstractButton, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickAbstractButton)
+
#endif // QQUICKABSTRACTBUTTON_P_H
diff --git a/src/templates/qquickabstractbutton_p_p.h b/src/templates/qquickabstractbutton_p_p.h
index ed0a8d9d..601c6dc7 100644
--- a/src/templates/qquickabstractbutton_p_p.h
+++ b/src/templates/qquickabstractbutton_p_p.h
@@ -78,6 +78,7 @@ public:
bool pressed;
bool checked;
bool checkable;
+ bool highlighted;
bool autoExclusive;
bool autoRepeat;
int delayTimer;
@@ -89,8 +90,6 @@ public:
QQuickButtonGroup *group;
};
-Q_DECLARE_TYPEINFO(QQuickAbstractButtonPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKABSTRACTBUTTON_P_P_H
diff --git a/src/templates/qquickapplicationwindow.cpp b/src/templates/qquickapplicationwindow.cpp
index 2c4cd7c9..46f07d3e 100644
--- a/src/templates/qquickapplicationwindow.cpp
+++ b/src/templates/qquickapplicationwindow.cpp
@@ -36,6 +36,9 @@
#include "qquickapplicationwindow_p.h"
#include "qquickoverlay_p.h"
+#include "qquickcontrol_p_p.h"
+#include "qquicktextarea_p.h"
+#include "qquicktextfield_p.h"
#include <QtCore/private/qobject_p.h>
#include <QtQuick/private/qquickitem_p.h>
@@ -56,6 +59,26 @@ QT_BEGIN_NAMESPACE
\image qtlabscontrols-applicationwindow-wireframe.png
+ \qml
+ import Qt.labs.controls 1.0
+
+ ApplicationWindow {
+ visible: true
+
+ header: ToolBar {
+ // ...
+ }
+
+ footer: TabBar {
+ // ...
+ }
+
+ StackView {
+ anchors.fill: parent
+ }
+ }
+ \endqml
+
\note By default, an ApplicationWindow is not visible.
\sa {Container Controls}
@@ -72,6 +95,7 @@ public:
, header(Q_NULLPTR)
, footer(Q_NULLPTR)
, overlay(Q_NULLPTR)
+ , activeFocusControl(Q_NULLPTR)
{ }
void relayout();
@@ -79,11 +103,25 @@ public:
void itemImplicitWidthChanged(QQuickItem *item) Q_DECL_OVERRIDE;
void itemImplicitHeightChanged(QQuickItem *item) Q_DECL_OVERRIDE;
+ void updateFont(const QFont &);
+ inline void setFont_helper(const QFont &f) {
+ if (font.resolve() == f.resolve() && font == f)
+ return;
+ updateFont(f);
+ }
+ void resolveFont();
+
+ void _q_updateActiveFocus();
+ void setActiveFocusControl(QQuickItem *item);
+
bool complete;
QQuickItem *contentItem;
QQuickItem *header;
QQuickItem *footer;
QQuickOverlay *overlay;
+ QFont font;
+ QLocale locale;
+ QQuickItem *activeFocusControl;
QQuickApplicationWindow *q_ptr;
};
@@ -135,10 +173,44 @@ void QQuickApplicationWindowPrivate::itemImplicitHeightChanged(QQuickItem *item)
relayout();
}
+void QQuickApplicationWindowPrivate::_q_updateActiveFocus()
+{
+ Q_Q(QQuickApplicationWindow);
+ QQuickItem *item = q->activeFocusItem();
+ while (item) {
+ QQuickControl *control = qobject_cast<QQuickControl *>(item);
+ if (control) {
+ setActiveFocusControl(control);
+ break;
+ }
+ QQuickTextField *textField = qobject_cast<QQuickTextField *>(item);
+ if (textField) {
+ setActiveFocusControl(textField);
+ break;
+ }
+ QQuickTextArea *textArea = qobject_cast<QQuickTextArea *>(item);
+ if (textArea) {
+ setActiveFocusControl(textArea);
+ break;
+ }
+ item = item->parentItem();
+ }
+}
+
+void QQuickApplicationWindowPrivate::setActiveFocusControl(QQuickItem *control)
+{
+ Q_Q(QQuickApplicationWindow);
+ if (activeFocusControl != control) {
+ activeFocusControl = control;
+ emit q->activeFocusControlChanged();
+ }
+}
+
QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent) :
QQuickWindowQmlImpl(parent), d_ptr(new QQuickApplicationWindowPrivate)
{
d_ptr->q_ptr = this;
+ connect(this, SIGNAL(activeFocusItemChanged()), this, SLOT(_q_updateActiveFocus()));
}
QQuickApplicationWindow::~QQuickApplicationWindow()
@@ -153,8 +225,8 @@ QQuickApplicationWindow::~QQuickApplicationWindow()
/*!
\qmlproperty Item Qt.labs.controls::ApplicationWindow::header
- A header item for the window, for example a title bar, menu or tool-bar.
- By default this property is empty, no header will be shown.
+ This property holds the window header item. The header item is positioned to
+ the top, and resized to the width of the window. The default value is \c null.
\sa footer
*/
@@ -186,8 +258,8 @@ void QQuickApplicationWindow::setHeader(QQuickItem *header)
/*!
\qmlproperty Item Qt.labs.controls::ApplicationWindow::footer
- A footer item for the window, for example a status bar or menu.
- By default this property is empty, no footer will be shown.
+ This property holds the window footer item. The footer item is positioned to
+ the bottom, and resized to the width of the window. The default value is \c null.
\sa header
*/
@@ -216,11 +288,26 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer)
}
}
+/*!
+ \qmlproperty list<Object> Qt.labs.controls::ApplicationWindow::contentData
+ \default
+
+ This default property holds the list of all objects declared as children of
+ the window.
+
+ \sa contentItem
+*/
QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
{
return QQuickItemPrivate::get(contentItem())->data();
}
+/*!
+ \qmlproperty Item Qt.labs.controls::ApplicationWindow::contentItem
+ \readonly
+
+ This property holds the window content item.
+*/
QQuickItem *QQuickApplicationWindow::contentItem() const
{
QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
@@ -231,7 +318,37 @@ QQuickItem *QQuickApplicationWindow::contentItem() const
return d->contentItem;
}
-QQuickItem *QQuickApplicationWindow::overlay() const
+/*!
+ \qmlproperty Control Qt.labs.controls::ApplicationWindow::activeFocusControl
+
+ This property holds the control that currently has active focus, or \c null if there is
+ no control with active focus.
+
+ The difference between \l Window::activeFocusItem and ApplicationWindow::activeFocusControl
+ is that the former may point to a building block of a control, whereas the latter points
+ to the enclosing control. For example, when SpinBox has focus, activeFocusItem points to
+ the editor and acticeFocusControl to the SpinBox itself.
+
+ \sa Window::activeFocusItem
+*/
+QQuickItem *QQuickApplicationWindow::activeFocusControl() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->activeFocusControl;
+}
+
+/*!
+ \qmlpropertygroup Qt.labs.controls::ApplicationWindow::overlay
+ \qmlproperty Item Qt.labs.controls::ApplicationWindow::overlay
+ \qmlproperty Item Qt.labs.controls::ApplicationWindow::overlay.background
+
+ This property holds the window overlay item and its background that implements the
+ background dimming when any modal popups are open. Popups are automatically
+ reparented to the overlay.
+
+ \sa Popup
+*/
+QQuickOverlay *QQuickApplicationWindow::overlay() const
{
QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
if (!d->overlay) {
@@ -241,6 +358,81 @@ QQuickItem *QQuickApplicationWindow::overlay() const
return d->overlay;
}
+/*!
+ \qmlproperty font Qt.labs.controls::ApplicationWindow::font
+
+ This property holds the font currently set for the window.
+
+ The default font depends on the system environment. QGuiApplication maintains a system/theme
+ font which serves as a default for all application windows. You can also set the default font
+ for windows by passing a custom font to QGuiApplication::setFont(), before loading any QML.
+ Finally, the font is matched against Qt's font database to find the best match.
+
+ ApplicationWindow propagates explicit font properties to child controls. If you change a specific
+ property on the window's font, that property propagates to all child controls in the window,
+ overriding any system defaults for that property.
+
+ \sa Control::font
+*/
+QFont QQuickApplicationWindow::font() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->font;
+}
+
+void QQuickApplicationWindow::setFont(const QFont &f)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->font == f)
+ return;
+
+ QFont resolvedFont = f.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
+ d->setFont_helper(resolvedFont);
+}
+
+void QQuickApplicationWindow::resetFont()
+{
+ setFont(QFont());
+}
+
+void QQuickApplicationWindowPrivate::resolveFont()
+{
+ QFont resolvedFont = font.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
+ setFont_helper(resolvedFont);
+}
+
+void QQuickApplicationWindowPrivate::updateFont(const QFont &f)
+{
+ Q_Q(QQuickApplicationWindow);
+ font = f;
+
+ QQuickControlPrivate::updateFontRecur(q->contentItem(), f);
+
+ emit q->fontChanged();
+}
+
+QLocale QQuickApplicationWindow::locale() const
+{
+ Q_D(const QQuickApplicationWindow);
+ return d->locale;
+}
+
+void QQuickApplicationWindow::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickApplicationWindow);
+ if (d->locale == locale)
+ return;
+
+ d->locale = locale;
+ QQuickControlPrivate::updateLocaleRecur(contentItem(), locale);
+ emit localeChanged();
+}
+
+void QQuickApplicationWindow::resetLocale()
+{
+ setLocale(QLocale());
+}
+
QQuickApplicationWindowAttached *QQuickApplicationWindow::qmlAttachedProperties(QObject *object)
{
return new QQuickApplicationWindowAttached(object);
@@ -285,16 +477,16 @@ void QQuickApplicationWindowAttachedPrivate::windowChange(QQuickWindow *wnd)
if (window != newWindow) {
QQuickApplicationWindow *oldWindow = window;
if (oldWindow) {
- QObject::disconnect(oldWindow, &QQuickApplicationWindow::activeFocusItemChanged,
- q, &QQuickApplicationWindowAttached::activeFocusItemChanged);
+ QObject::disconnect(oldWindow, &QQuickApplicationWindow::activeFocusControlChanged,
+ q, &QQuickApplicationWindowAttached::activeFocusControlChanged);
QObject::disconnect(oldWindow, &QQuickApplicationWindow::headerChanged,
q, &QQuickApplicationWindowAttached::headerChanged);
QObject::disconnect(oldWindow, &QQuickApplicationWindow::footerChanged,
q, &QQuickApplicationWindowAttached::footerChanged);
}
if (newWindow) {
- QObject::connect(newWindow, &QQuickApplicationWindow::activeFocusItemChanged,
- q, &QQuickApplicationWindowAttached::activeFocusItemChanged);
+ QObject::connect(newWindow, &QQuickApplicationWindow::activeFocusControlChanged,
+ q, &QQuickApplicationWindowAttached::activeFocusControlChanged);
QObject::connect(newWindow, &QQuickApplicationWindow::headerChanged,
q, &QQuickApplicationWindowAttached::headerChanged);
QObject::connect(newWindow, &QQuickApplicationWindow::footerChanged,
@@ -306,8 +498,8 @@ void QQuickApplicationWindowAttachedPrivate::windowChange(QQuickWindow *wnd)
emit q->contentItemChanged();
emit q->overlayChanged();
- if ((oldWindow && oldWindow->activeFocusItem()) || (newWindow && newWindow->activeFocusItem()))
- emit q->activeFocusItemChanged();
+ if ((oldWindow && oldWindow->activeFocusControl()) || (newWindow && newWindow->activeFocusControl()))
+ emit q->activeFocusControlChanged();
if ((oldWindow && oldWindow->header()) || (newWindow && newWindow->header()))
emit q->headerChanged();
if ((oldWindow && oldWindow->footer()) || (newWindow && newWindow->footer()))
@@ -351,18 +543,19 @@ QQuickItem *QQuickApplicationWindowAttached::contentItem() const
}
/*!
- \qmlattachedproperty Item Qt.labs.controls::ApplicationWindow::activeFocusItem
+ \qmlattachedproperty Control Qt.labs.controls::ApplicationWindow::activeFocusControl
- This attached property holds the active focus 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 active focus.
+ This attached property holds the control that currently has active focus, or \c null
+ if there is no control with active focus. The property can be attached to any item.
+ The value is \c null if the item is not in an ApplicationWindow, or the window has
+ no active focus.
\sa Window::activeFocusItem
*/
-QQuickItem *QQuickApplicationWindowAttached::activeFocusItem() const
+QQuickItem *QQuickApplicationWindowAttached::activeFocusControl() const
{
Q_D(const QQuickApplicationWindowAttached);
- return d->window ? d->window->activeFocusItem() : Q_NULLPTR;
+ return d->window ? d->window->activeFocusControl() : Q_NULLPTR;
}
/*!
@@ -397,10 +590,12 @@ 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.
*/
-QQuickItem *QQuickApplicationWindowAttached::overlay() const
+QQuickOverlay *QQuickApplicationWindowAttached::overlay() const
{
Q_D(const QQuickApplicationWindowAttached);
return d->window ? d->window->overlay() : Q_NULLPTR;
}
QT_END_NAMESPACE
+
+#include "moc_qquickapplicationwindow_p.cpp"
diff --git a/src/templates/qquickapplicationwindow_p.h b/src/templates/qquickapplicationwindow_p.h
index c5b0dc42..c9e619be 100644
--- a/src/templates/qquickapplicationwindow_p.h
+++ b/src/templates/qquickapplicationwindow_p.h
@@ -50,9 +50,12 @@
#include <QtQuick/private/qquickwindowmodule_p.h>
#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
+#include <QtGui/qfont.h>
+#include <QtCore/qlocale.h>
QT_BEGIN_NAMESPACE
+class QQuickOverlay;
class QQuickApplicationWindowPrivate;
class QQuickApplicationWindowAttached;
class QQuickApplicationWindowAttachedPrivate;
@@ -62,9 +65,12 @@ class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindow : public QQuickWindowQmlImp
Q_OBJECT
Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL)
Q_PROPERTY(QQmlListProperty<QObject> data READ contentData FINAL)
+ Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQuickItem *overlay READ overlay CONSTANT FINAL)
+ Q_PROPERTY(QQuickOverlay *overlay READ overlay CONSTANT FINAL)
+ Q_PROPERTY(QFont font READ font WRITE setFont RESET resetFont NOTIFY fontChanged)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
Q_CLASSINFO("DefaultProperty", "data")
public:
@@ -74,19 +80,32 @@ public:
QQuickItem *contentItem() const;
QQmlListProperty<QObject> contentData();
+ QQuickItem *activeFocusControl() const;
+
QQuickItem *header() const;
void setHeader(QQuickItem *header);
QQuickItem *footer() const;
void setFooter(QQuickItem *footer);
- QQuickItem *overlay() const;
+ QQuickOverlay *overlay() const;
+
+ QFont font() const;
+ void setFont(const QFont &);
+ void resetFont();
+
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+ void resetLocale();
static QQuickApplicationWindowAttached *qmlAttachedProperties(QObject *object);
Q_SIGNALS:
+ void activeFocusControlChanged();
void headerChanged();
void footerChanged();
+ void fontChanged();
+ void localeChanged();
protected:
bool isComponentComplete() const;
@@ -96,6 +115,7 @@ protected:
private:
Q_DISABLE_COPY(QQuickApplicationWindow)
Q_DECLARE_PRIVATE(QQuickApplicationWindow)
+ Q_PRIVATE_SLOT(d_func(), void _q_updateActiveFocus())
QScopedPointer<QQuickApplicationWindowPrivate> d_ptr;
};
@@ -104,25 +124,25 @@ class Q_LABSTEMPLATES_EXPORT QQuickApplicationWindowAttached : public QObject
Q_OBJECT
Q_PROPERTY(QQuickApplicationWindow *window READ window NOTIFY windowChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem NOTIFY contentItemChanged FINAL)
- Q_PROPERTY(QQuickItem *activeFocusItem READ activeFocusItem NOTIFY activeFocusItemChanged FINAL)
+ Q_PROPERTY(QQuickItem *activeFocusControl READ activeFocusControl NOTIFY activeFocusControlChanged FINAL)
Q_PROPERTY(QQuickItem *header READ header NOTIFY headerChanged FINAL)
Q_PROPERTY(QQuickItem *footer READ footer NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQuickItem *overlay READ overlay NOTIFY overlayChanged FINAL)
+ Q_PROPERTY(QQuickOverlay *overlay READ overlay NOTIFY overlayChanged FINAL)
public:
explicit QQuickApplicationWindowAttached(QObject *parent = Q_NULLPTR);
QQuickApplicationWindow *window() const;
QQuickItem *contentItem() const;
- QQuickItem *activeFocusItem() const;
+ QQuickItem *activeFocusControl() const;
QQuickItem *header() const;
QQuickItem *footer() const;
- QQuickItem *overlay() const;
+ QQuickOverlay *overlay() const;
Q_SIGNALS:
void windowChanged();
void contentItemChanged();
- void activeFocusItemChanged();
+ void activeFocusControlChanged();
void headerChanged();
void footerChanged();
void overlayChanged();
@@ -132,11 +152,9 @@ private:
Q_DECLARE_PRIVATE(QQuickApplicationWindowAttached)
};
-Q_DECLARE_TYPEINFO(QQuickApplicationWindow, Q_COMPLEX_TYPE);
-Q_DECLARE_TYPEINFO(QQuickApplicationWindowAttached, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickApplicationWindow)
QML_DECLARE_TYPEINFO(QQuickApplicationWindow, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKAPPLICATIONWINDOW_P_H
diff --git a/src/templates/qquickbusyindicator_p.h b/src/templates/qquickbusyindicator_p.h
index 0a5defbc..8be19d5c 100644
--- a/src/templates/qquickbusyindicator_p.h
+++ b/src/templates/qquickbusyindicator_p.h
@@ -78,8 +78,8 @@ private:
Q_DECLARE_PRIVATE(QQuickBusyIndicator)
};
-Q_DECLARE_TYPEINFO(QQuickBusyIndicator, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickBusyIndicator)
+
#endif // QQUICKBUSYINDICATOR_P_H
diff --git a/src/templates/qquickbutton.cpp b/src/templates/qquickbutton.cpp
index 4f5df5fa..b323cb0b 100644
--- a/src/templates/qquickbutton.cpp
+++ b/src/templates/qquickbutton.cpp
@@ -83,47 +83,8 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Button}, {Button Controls}
*/
-class QQuickButtonPrivate : public QQuickAbstractButtonPrivate
+QQuickButton::QQuickButton(QQuickItem *parent) : QQuickAbstractButton(parent)
{
-public:
- QQuickButtonPrivate();
-
- bool highlighted;
-};
-
-QQuickButtonPrivate::QQuickButtonPrivate() :
- highlighted(false)
-{
-}
-
-QQuickButton::QQuickButton(QQuickItem *parent) :
- QQuickAbstractButton(*(new QQuickButtonPrivate), parent)
-{
-}
-
-/*!
- \qmlproperty bool Qt.labs.controls::Button::highlighted
-
- This property holds whether the button is highlighted.
-
- A button can be highlighted in order to draw the user's attention towards
- it. It has no effect on keyboard interaction.
-
- The default value is \c false.
-*/
-bool QQuickButton::isHighlighted() const
-{
- Q_D(const QQuickButton);
- return d->highlighted;
-}
-
-void QQuickButton::setHighlighted(bool highlighted)
-{
- Q_D(QQuickButton);
- if (highlighted != d->highlighted) {
- d->highlighted = highlighted;
- emit highlightedChanged();
- }
}
QFont QQuickButton::defaultFont() const
diff --git a/src/templates/qquickbutton_p.h b/src/templates/qquickbutton_p.h
index 5b9c7df5..83d22fb8 100644
--- a/src/templates/qquickbutton_p.h
+++ b/src/templates/qquickbutton_p.h
@@ -52,32 +52,19 @@
QT_BEGIN_NAMESPACE
-class QQuickButtonPrivate;
-
class Q_LABSTEMPLATES_EXPORT QQuickButton : public QQuickAbstractButton
{
Q_OBJECT
- Q_PROPERTY(bool highlighted READ isHighlighted WRITE setHighlighted NOTIFY highlightedChanged FINAL)
public:
explicit QQuickButton(QQuickItem *parent = Q_NULLPTR);
- bool isHighlighted() const;
- void setHighlighted(bool highlighted);
-
-Q_SIGNALS:
- void highlightedChanged();
-
protected:
QFont defaultFont() const Q_DECL_OVERRIDE;
-
-private:
- Q_DISABLE_COPY(QQuickButton)
- Q_DECLARE_PRIVATE(QQuickButton)
};
-Q_DECLARE_TYPEINFO(QQuickButton, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickButton)
+
#endif // QQUICKBUTTON_P_H
diff --git a/src/templates/qquickbuttongroup_p.h b/src/templates/qquickbuttongroup_p.h
index 366d2b2a..6210079d 100644
--- a/src/templates/qquickbuttongroup_p.h
+++ b/src/templates/qquickbuttongroup_p.h
@@ -108,10 +108,9 @@ private:
Q_DECLARE_PRIVATE(QQuickButtonGroupAttached)
};
-Q_DECLARE_TYPEINFO(QQuickButtonGroup, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickButtonGroup)
QML_DECLARE_TYPEINFO(QQuickButtonGroup, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQuickButtonGroup_H
diff --git a/src/templates/qquickcheckbox_p.h b/src/templates/qquickcheckbox_p.h
index 5cf97476..4c0d505f 100644
--- a/src/templates/qquickcheckbox_p.h
+++ b/src/templates/qquickcheckbox_p.h
@@ -88,8 +88,8 @@ private:
Q_DECLARE_PRIVATE(QQuickCheckBox)
};
-Q_DECLARE_TYPEINFO(QQuickCheckBox, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickCheckBox)
+
#endif // QQUICKCHECKBOX_P_H
diff --git a/src/templates/qquickcombobox.cpp b/src/templates/qquickcombobox.cpp
new file mode 100644
index 00000000..a2c0bf89
--- /dev/null
+++ b/src/templates/qquickcombobox.cpp
@@ -0,0 +1,795 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Templates module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcombobox_p.h"
+#include "qquickcontrol_p_p.h"
+#include "qquickabstractbutton_p.h"
+#include "qquickpopup_p.h"
+
+#include <QtCore/qregexp.h>
+#include <QtQml/qjsvalue.h>
+#include <QtQml/qqmlcontext.h>
+#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQuick/private/qquickevents_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype ComboBox
+ \inherits Control
+ \instantiates QQuickComboBox
+ \inqmlmodule Qt.labs.controls
+ \ingroup qtlabscontrols-input
+ \brief A combo box control.
+
+ \image qtlabscontrols-combobox.png
+
+ ComboBox is a combined button and popup list. It provides a means of
+ presenting a list of options to the user in a way that takes up the
+ minimum amount of screen space.
+
+ ComboBox is populated with a data model. The data model is commonly
+ a JavaScript array, a \l ListModel or an integer, but also other types
+ of \l {qml-data-models}{data models} are supported.
+
+ \code
+ ComboBox {
+ model: ["First", "Second", "Third"]
+ }
+ \endcode
+
+ ComboBox is able to visualize standard \l {qml-data-models}{data models}
+ that provide the \c modelData role:
+ \list
+ \li models that have only one role
+ \li models that do not have named roles (JavaScript array, integer)
+ \endlist
+
+ When using models that have multiple named roles, ComboBox must be configured
+ to use a specific \l {textRole}{text role} for its \l {displayText}{display text}
+ and \l delegate instances.
+
+ \code
+ ComboBox {
+ textRole: "key"
+ model: ListModel {
+ ListElement { key: "First"; value: 123 }
+ ListElement { key: "Second"; value: 456 }
+ ListElement { key: "Third"; value: 789 }
+ }
+ }
+ \endcode
+
+ \note If ComboBox is assigned a data model that has multiple named roles, but
+ \l textRole is not defined, ComboBox is unable to visualize it and throws a
+ \c {ReferenceError: modelData is not defined}.
+
+ \sa {Customizing ComboBox}, {Input Controls}
+*/
+
+/*!
+ \qmlsignal void Qt.labs.controls::ComboBox::activated(int index)
+
+ This signal is emitted when the item at \a index is activated by the user.
+
+ \sa currentIndex
+*/
+
+/*!
+ \qmlsignal void Qt.labs.controls::ComboBox::highlighted(int index)
+
+ This signal is emitted when the item at \a index in the popup list is highlighted by the user.
+
+ \sa highlightedIndex
+*/
+
+class QQuickComboBoxPrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickComboBox)
+
+public:
+ QQuickComboBoxPrivate() : pressed(false), ownModel(false), hasDisplayText(false),
+ hideTimer(0), highlightedIndex(-1), currentIndex(-1), delegateModel(Q_NULLPTR),
+ delegate(Q_NULLPTR), popup(Q_NULLPTR) { }
+
+ bool isPopupVisible() const;
+ void showPopup();
+ void hidePopup(bool accept);
+ void togglePopup(bool accept);
+
+ void pressedOutside();
+ void itemClicked();
+
+ void initItem(int index, QObject *object);
+ void countChanged();
+ void updateCurrentText();
+ void increase();
+ void decrease();
+ void setHighlightedIndex(int index);
+
+ void createDelegateModel();
+
+ bool pressed;
+ bool ownModel;
+ bool hasDisplayText;
+ int hideTimer;
+ int highlightedIndex;
+ int currentIndex;
+ QVariant model;
+ QString textRole;
+ QString currentText;
+ QString displayText;
+ QQuickItem *pressedItem;
+ QQmlInstanceModel *delegateModel;
+ QQmlComponent *delegate;
+ QQuickPopup *popup;
+};
+
+bool QQuickComboBoxPrivate::isPopupVisible() const
+{
+ return popup && popup->isVisible();
+}
+
+void QQuickComboBoxPrivate::showPopup()
+{
+ if (popup && !popup->isVisible())
+ popup->open();
+ setHighlightedIndex(currentIndex);
+}
+
+void QQuickComboBoxPrivate::hidePopup(bool accept)
+{
+ Q_Q(QQuickComboBox);
+ if (popup && popup->isVisible())
+ popup->close();
+ if (accept) {
+ q->setCurrentIndex(highlightedIndex);
+ emit q->activated(currentIndex);
+ }
+ setHighlightedIndex(-1);
+}
+
+void QQuickComboBoxPrivate::togglePopup(bool accept)
+{
+ if (!popup)
+ return;
+
+ if (popup->isVisible())
+ hidePopup(accept);
+ else
+ showPopup();
+}
+
+void QQuickComboBoxPrivate::pressedOutside()
+{
+ Q_Q(QQuickComboBox);
+ if (hideTimer <= 0)
+ hideTimer = q->startTimer(0);
+}
+
+void QQuickComboBoxPrivate::itemClicked()
+{
+ Q_Q(QQuickComboBox);
+ int index = delegateModel->indexOf(q->sender(), Q_NULLPTR);
+ if (index != -1) {
+ setHighlightedIndex(index);
+ emit q->highlighted(index);
+ hidePopup(true);
+ }
+}
+
+void QQuickComboBoxPrivate::initItem(int index, QObject *object)
+{
+ QQuickAbstractButton *button = qobject_cast<QQuickAbstractButton *>(object);
+ if (button)
+ connect(button, &QQuickAbstractButton::clicked, this, &QQuickComboBoxPrivate::itemClicked);
+
+ if (index == currentIndex)
+ updateCurrentText();
+}
+
+void QQuickComboBoxPrivate::countChanged()
+{
+ Q_Q(QQuickComboBox);
+ if (q->count() == 0)
+ q->setCurrentIndex(-1);
+ emit q->countChanged();
+}
+
+void QQuickComboBoxPrivate::updateCurrentText()
+{
+ Q_Q(QQuickComboBox);
+ QString text = q->textAt(currentIndex);
+ if (currentText != text) {
+ currentText = text;
+ emit q->currentTextChanged();
+ }
+ if (!hasDisplayText && displayText != text) {
+ displayText = text;
+ emit q->displayTextChanged();
+ }
+}
+
+void QQuickComboBoxPrivate::increase()
+{
+ Q_Q(QQuickComboBox);
+ if (isPopupVisible()) {
+ if (highlightedIndex < q->count() - 1) {
+ setHighlightedIndex(highlightedIndex + 1);
+ emit q->highlighted(highlightedIndex);
+ }
+ } else {
+ if (currentIndex < q->count() - 1) {
+ q->setCurrentIndex(currentIndex + 1);
+ emit q->activated(currentIndex);
+ }
+ }
+}
+
+void QQuickComboBoxPrivate::decrease()
+{
+ Q_Q(QQuickComboBox);
+ if (isPopupVisible()) {
+ if (highlightedIndex > 0) {
+ setHighlightedIndex(highlightedIndex - 1);
+ emit q->highlighted(highlightedIndex);
+ }
+ } else {
+ if (currentIndex > 0) {
+ q->setCurrentIndex(currentIndex - 1);
+ emit q->activated(currentIndex);
+ }
+ }
+}
+
+void QQuickComboBoxPrivate::setHighlightedIndex(int index)
+{
+ Q_Q(QQuickComboBox);
+ if (highlightedIndex != index) {
+ highlightedIndex = index;
+ emit q->highlightedIndexChanged();
+ }
+}
+
+void QQuickComboBoxPrivate::createDelegateModel()
+{
+ Q_Q(QQuickComboBox);
+ if (delegateModel) {
+ if (ownModel) {
+ delete delegateModel;
+ } else {
+ disconnect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
+ disconnect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
+ disconnect(delegateModel, &QQmlInstanceModel::initItem, this, &QQuickComboBoxPrivate::initItem);
+ }
+ }
+
+ ownModel = false;
+ delegateModel = model.value<QQmlInstanceModel *>();
+
+ if (!delegateModel && model.isValid()) {
+ QQmlDelegateModel *dataModel = new QQmlDelegateModel(qmlContext(q), q);
+ dataModel->setModel(model);
+ dataModel->setDelegate(delegate);
+ if (q->isComponentComplete())
+ dataModel->componentComplete();
+
+ ownModel = true;
+ delegateModel = dataModel;
+ }
+
+ if (delegateModel) {
+ connect(delegateModel, &QQmlInstanceModel::countChanged, this, &QQuickComboBoxPrivate::countChanged);
+ connect(delegateModel, &QQmlInstanceModel::modelUpdated, this, &QQuickComboBoxPrivate::updateCurrentText);
+ connect(delegateModel, &QQmlInstanceModel::initItem, this, &QQuickComboBoxPrivate::initItem);
+ }
+
+ emit q->delegateModelChanged();
+}
+
+QQuickComboBox::QQuickComboBox(QQuickItem *parent) :
+ QQuickControl(*(new QQuickComboBoxPrivate), parent)
+{
+ setActiveFocusOnTab(true);
+ setFlag(QQuickItem::ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::LeftButton);
+}
+
+/*!
+ \readonly
+ \qmlproperty int Qt.labs.controls::ComboBox::count
+
+ This property holds the number of items in the combo box.
+*/
+int QQuickComboBox::count() const
+{
+ Q_D(const QQuickComboBox);
+ return d->delegateModel ? d->delegateModel->count() : 0;
+}
+
+/*!
+ \qmlproperty model Qt.labs.controls::ComboBox::model
+
+ This property holds the model providing data for the combo box.
+
+ \code
+ ComboBox {
+ textRole: "key"
+ model: ListModel {
+ ListElement { key: "First"; value: 123 }
+ ListElement { key: "Second"; value: 456 }
+ ListElement { key: "Third"; value: 789 }
+ }
+ }
+ \endcode
+
+ \sa textRole, {qml-data-models}{Data Models}
+*/
+QVariant QQuickComboBox::model() const
+{
+ Q_D(const QQuickComboBox);
+ return d->model;
+}
+
+void QQuickComboBox::setModel(const QVariant& m)
+{
+ Q_D(QQuickComboBox);
+ QVariant model = m;
+ if (model.userType() == qMetaTypeId<QJSValue>())
+ model = model.value<QJSValue>().toVariant();
+
+ if (d->model != model) {
+ d->model = model;
+ d->createDelegateModel();
+ if (isComponentComplete()) {
+ setCurrentIndex(count() > 0 ? 0 : -1);
+ d->updateCurrentText();
+ }
+ emit modelChanged();
+ }
+}
+
+/*!
+ \internal
+ \qmlproperty model Qt.labs.controls::ComboBox::delegateModel
+
+ This property holds the model providing delegate instances for the combo box.
+*/
+QQmlInstanceModel *QQuickComboBox::delegateModel() const
+{
+ Q_D(const QQuickComboBox);
+ return d->delegateModel;
+}
+
+/*!
+ \qmlproperty bool Qt.labs.controls::ComboBox::pressed
+
+ This property holds whether the combo box button is pressed.
+*/
+bool QQuickComboBox::isPressed() const
+{
+ Q_D(const QQuickComboBox);
+ return d->pressed;
+}
+
+void QQuickComboBox::setPressed(bool pressed)
+{
+ Q_D(QQuickComboBox);
+ if (d->pressed != pressed) {
+ d->pressed = pressed;
+ emit pressedChanged();
+ }
+}
+
+/*!
+ \qmlproperty int Qt.labs.controls::ComboBox::highlightedIndex
+
+ This property holds the index of the highlighted item in the combo box popup list.
+
+ \sa highlighted(), currentIndex
+*/
+int QQuickComboBox::highlightedIndex() const
+{
+ Q_D(const QQuickComboBox);
+ return d->highlightedIndex;
+}
+
+/*!
+ \qmlproperty int Qt.labs.controls::ComboBox::currentIndex
+
+ This property holds the index of the current item in the combo box.
+
+ \sa activated(), currentText
+*/
+int QQuickComboBox::currentIndex() const
+{
+ Q_D(const QQuickComboBox);
+ return d->currentIndex;
+}
+
+void QQuickComboBox::setCurrentIndex(int index)
+{
+ Q_D(QQuickComboBox);
+ if (d->currentIndex != index) {
+ d->currentIndex = index;
+ emit currentIndexChanged();
+ if (isComponentComplete())
+ d->updateCurrentText();
+ }
+}
+
+/*!
+ \readonly
+ \qmlproperty string Qt.labs.controls::ComboBox::currentText
+
+ This property holds the text of the current item in the combo box.
+
+ \sa currentIndex, displayText, textRole
+*/
+QString QQuickComboBox::currentText() const
+{
+ Q_D(const QQuickComboBox);
+ return d->currentText;
+}
+
+/*!
+ \qmlproperty string Qt.labs.controls::ComboBox::displayText
+
+ This property holds the text that is displayed on the combo box button.
+
+ By default, the display text presents the current selection. That is,
+ it follows the text of the current item. However, the default display
+ text can be overridden with a custom value.
+
+ \code
+ ComboBox {
+ currentIndex: 1
+ displayText: "Size: " + currentText
+ model: ["S", "M", "L"]
+ }
+ \endcode
+
+ \sa currentText, textRole
+*/
+QString QQuickComboBox::displayText() const
+{
+ Q_D(const QQuickComboBox);
+ return d->displayText;
+}
+
+void QQuickComboBox::setDisplayText(const QString &text)
+{
+ Q_D(QQuickComboBox);
+ d->hasDisplayText = true;
+ if (d->displayText != text) {
+ d->displayText = text;
+ emit displayTextChanged();
+ }
+}
+
+void QQuickComboBox::resetDisplayText()
+{
+ Q_D(QQuickComboBox);
+ if (d->hasDisplayText) {
+ d->hasDisplayText = false;
+ d->updateCurrentText();
+ }
+}
+
+/*!
+ \qmlproperty string Qt.labs.controls::ComboBox::textRole
+
+ This property holds the model role used for populating the combo box.
+
+ \sa model, currentText, displayText
+*/
+QString QQuickComboBox::textRole() const
+{
+ Q_D(const QQuickComboBox);
+ return d->textRole;
+}
+
+void QQuickComboBox::setTextRole(const QString &role)
+{
+ Q_D(QQuickComboBox);
+ if (d->textRole != role) {
+ d->textRole = role;
+ if (isComponentComplete())
+ d->updateCurrentText();
+ emit textRoleChanged();
+ }
+}
+
+/*!
+ \qmlproperty Component Qt.labs.controls::ComboBox::delegate
+
+ This property holds a delegate that presents an item in the combo box popup.
+
+ \sa ItemDelegate, {Customizing ComboBox}
+*/
+QQmlComponent *QQuickComboBox::delegate() const
+{
+ Q_D(const QQuickComboBox);
+ return d->delegate;
+}
+
+void QQuickComboBox::setDelegate(QQmlComponent* delegate)
+{
+ Q_D(QQuickComboBox);
+ if (d->delegate != delegate) {
+ delete d->delegate;
+ d->delegate = delegate;
+ QQmlDelegateModel *delegateModel = qobject_cast<QQmlDelegateModel*>(d->delegateModel);
+ if (delegateModel)
+ delegateModel->setDelegate(d->delegate);
+ emit delegateChanged();
+ }
+}
+
+/*!
+ \qmlproperty Popup Qt.labs.controls::ComboBox::popup
+
+ This property holds the popup.
+
+ \sa {Customizing ComboBox}
+*/
+QQuickPopup *QQuickComboBox::popup() const
+{
+ Q_D(const QQuickComboBox);
+ return d->popup;
+}
+
+void QQuickComboBox::setPopup(QQuickPopup *popup)
+{
+ Q_D(QQuickComboBox);
+ if (d->popup != popup) {
+ delete d->popup;
+ if (popup)
+ QObjectPrivate::connect(popup, &QQuickPopup::pressedOutside, d, &QQuickComboBoxPrivate::pressedOutside);
+ d->popup = popup;
+ emit popupChanged();
+ }
+}
+
+/*!
+ \qmlmethod string Qt.labs.controls::ComboBox::textAt(int index)
+
+ Returns the text for the specified \a index, or an empty string
+ if the index is out of bounds.
+
+ \sa textRole
+*/
+QString QQuickComboBox::textAt(int index) const
+{
+ Q_D(const QQuickComboBox);
+ if (!d->delegateModel || index < 0 || index >= d->delegateModel->count() || !d->delegateModel->object(index))
+ return QString();
+ return d->delegateModel->stringValue(index, d->textRole.isEmpty() ? QStringLiteral("modelData") : d->textRole);
+}
+
+/*!
+ \qmlmethod int Qt.labs.controls::ComboBox::find(string text, flags = Qt.MatchExactly)
+
+ Returns the index of the specified \a text, or \c -1 if no match is found.
+
+ The way the search is performed is defined by the specified match \a flags. By default,
+ combo box performs case sensitive exact matching (\c Qt.MatchExactly). All other match
+ types are case-insensitive unless the \c Qt.MatchCaseSensitive flag is also specified.
+
+ \value Qt.MatchExactly The search term matches exactly (default).
+ \value Qt.MatchRegExp The search term matches as a regular expression.
+ \value Qt.MatchWildcard The search term matches using wildcards.
+ \value Qt.MatchFixedString The search term matches as a fixed string.
+ \value Qt.MatchStartsWith The search term matches the start of the item.
+ \value Qt.MatchEndsWidth The search term matches the end of the item.
+ \value Qt.MatchContains The search term is contained in the item.
+ \value Qt.MatchCaseSensitive The search is case sensitive.
+
+ \sa textRole
+*/
+int QQuickComboBox::find(const QString &text, Qt::MatchFlags flags) const
+{
+ int itemCount = count();
+ uint matchType = flags & 0x0F;
+ Qt::CaseSensitivity cs = flags & Qt::MatchCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive;
+
+ for (int idx = 0; idx < itemCount; ++idx) {
+ QString t = textAt(idx);
+ switch (matchType) {
+ case Qt::MatchExactly:
+ if (t == text)
+ return idx;
+ break;
+ case Qt::MatchRegExp:
+ if (QRegExp(text, cs).exactMatch(t))
+ return idx;
+ break;
+ case Qt::MatchWildcard:
+ if (QRegExp(text, cs, QRegExp::Wildcard).exactMatch(t))
+ return idx;
+ break;
+ case Qt::MatchStartsWith:
+ if (t.startsWith(text, cs))
+ return idx;
+ break;
+ case Qt::MatchEndsWith:
+ if (t.endsWith(text, cs))
+ return idx;
+ break;
+ case Qt::MatchFixedString:
+ if (t.compare(text, cs) == 0)
+ return idx;
+ break;
+ case Qt::MatchContains:
+ default:
+ if (t.contains(text, cs))
+ return idx;
+ break;
+ }
+ }
+ return -1;
+}
+
+void QQuickComboBox::focusOutEvent(QFocusEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::focusOutEvent(event);
+ d->hidePopup(false);
+ setPressed(false);
+}
+
+void QQuickComboBox::keyPressEvent(QKeyEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::keyPressEvent(event);
+ if (!d->popup)
+ return;
+
+ switch (event->key()) {
+ case Qt::Key_Space:
+ if (!event->isAutoRepeat())
+ setPressed(true);
+ event->accept();
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ if (d->isPopupVisible())
+ setPressed(true);
+ event->accept();
+ break;
+ case Qt::Key_Up:
+ d->decrease();
+ event->accept();
+ break;
+ case Qt::Key_Down:
+ d->increase();
+ event->accept();
+ break;
+ case Qt::Key_Escape:
+ event->accept();
+ default:
+ break;
+ }
+}
+
+void QQuickComboBox::keyReleaseEvent(QKeyEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::keyReleaseEvent(event);
+ if (!d->popup || event->isAutoRepeat())
+ return;
+
+ switch (event->key()) {
+ case Qt::Key_Space:
+ d->togglePopup(true);
+ setPressed(false);
+ event->accept();
+ break;
+ case Qt::Key_Enter:
+ case Qt::Key_Return:
+ d->hidePopup(true);
+ setPressed(false);
+ event->accept();
+ break;
+ case Qt::Key_Escape:
+ d->hidePopup(false);
+ setPressed(false);
+ event->accept();
+ break;
+ default:
+ break;
+ }
+}
+
+void QQuickComboBox::mousePressEvent(QMouseEvent *event)
+{
+ QQuickControl::mousePressEvent(event);
+ setPressed(true);
+}
+
+void QQuickComboBox::mouseMoveEvent(QMouseEvent* event)
+{
+ QQuickControl::mouseMoveEvent(event);
+ setPressed(contains(event->pos()));
+}
+
+void QQuickComboBox::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::mouseReleaseEvent(event);
+ if (d->pressed) {
+ setPressed(false);
+ if (!d->isPopupVisible())
+ forceActiveFocus(Qt::MouseFocusReason);
+ d->togglePopup(false);
+ }
+}
+
+void QQuickComboBox::mouseUngrabEvent()
+{
+ QQuickControl::mouseUngrabEvent();
+ setPressed(false);
+}
+
+void QQuickComboBox::timerEvent(QTimerEvent *event)
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::timerEvent(event);
+ if (event->timerId() == d->hideTimer) {
+ killTimer(d->hideTimer);
+ d->hideTimer = 0;
+ if (!d->pressed)
+ d->hidePopup(false);
+ }
+}
+
+void QQuickComboBox::componentComplete()
+{
+ Q_D(QQuickComboBox);
+ QQuickControl::componentComplete();
+
+ if (d->delegateModel && d->ownModel)
+ static_cast<QQmlDelegateModel *>(d->delegateModel)->componentComplete();
+
+ if (count() > 0) {
+ if (d->currentIndex == -1)
+ setCurrentIndex(0);
+ else
+ d->updateCurrentText();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/templates/qquickcombobox_p.h b/src/templates/qquickcombobox_p.h
new file mode 100644
index 00000000..da237c8e
--- /dev/null
+++ b/src/templates/qquickcombobox_p.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Templates module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCOMBOBOX_P_H
+#define QQUICKCOMBOBOX_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLabsTemplates/private/qquickcontrol_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPopup;
+class QQmlInstanceModel;
+class QQuickComboBoxPrivate;
+
+class Q_LABSTEMPLATES_EXPORT QQuickComboBox : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
+ Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged FINAL)
+ Q_PROPERTY(QQmlInstanceModel *delegateModel READ delegateModel NOTIFY delegateModelChanged FINAL)
+ Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
+ Q_PROPERTY(int highlightedIndex READ highlightedIndex NOTIFY highlightedIndexChanged FINAL)
+ Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
+ Q_PROPERTY(QString currentText READ currentText NOTIFY currentTextChanged FINAL)
+ Q_PROPERTY(QString displayText READ displayText WRITE setDisplayText RESET resetDisplayText NOTIFY displayTextChanged FINAL)
+ Q_PROPERTY(QString textRole READ textRole WRITE setTextRole NOTIFY textRoleChanged FINAL)
+ Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
+ Q_PROPERTY(QQuickPopup *popup READ popup WRITE setPopup NOTIFY popupChanged FINAL)
+
+public:
+ explicit QQuickComboBox(QQuickItem *parent = Q_NULLPTR);
+
+ int count() const;
+
+ QVariant model() const;
+ void setModel(const QVariant &model);
+ QQmlInstanceModel *delegateModel() const;
+
+ bool isPressed() const;
+ void setPressed(bool pressed);
+
+ int highlightedIndex() const;
+
+ int currentIndex() const;
+ void setCurrentIndex(int index);
+
+ QString currentText() const;
+
+ QString displayText() const;
+ void setDisplayText(const QString &text);
+ void resetDisplayText();
+
+ QString textRole() const;
+ void setTextRole(const QString &role);
+
+ QQmlComponent *delegate() const;
+ void setDelegate(QQmlComponent *delegate);
+
+ QQuickPopup *popup() const;
+ void setPopup(QQuickPopup *popup);
+
+ Q_INVOKABLE QString textAt(int index) const;
+ Q_INVOKABLE int find(const QString &text, Qt::MatchFlags flags = Qt::MatchExactly) const;
+
+Q_SIGNALS:
+ void countChanged();
+ void modelChanged();
+ void delegateModelChanged();
+ void pressedChanged();
+ void highlightedIndexChanged();
+ void currentIndexChanged();
+ void currentTextChanged();
+ void displayTextChanged();
+ void textRoleChanged();
+ void delegateChanged();
+ void popupChanged();
+
+ void activated(int index);
+ void highlighted(int index);
+
+protected:
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
+
+ void componentComplete() Q_DECL_OVERRIDE;
+
+private:
+ Q_DISABLE_COPY(QQuickComboBox)
+ Q_DECLARE_PRIVATE(QQuickComboBox)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickComboBox)
+
+#endif // QQUICKCOMBOBOX_P_H
diff --git a/src/templates/qquickcontainer_p.h b/src/templates/qquickcontainer_p.h
index a77b285c..83476f66 100644
--- a/src/templates/qquickcontainer_p.h
+++ b/src/templates/qquickcontainer_p.h
@@ -109,8 +109,8 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_currentIndexChanged())
};
-Q_DECLARE_TYPEINFO(QQuickContainer, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickContainer)
+
#endif // QQUICKCONTAINER_P_H
diff --git a/src/templates/qquickcontainer_p_p.h b/src/templates/qquickcontainer_p_p.h
index 2e5a36a1..6eb79c88 100644
--- a/src/templates/qquickcontainer_p_p.h
+++ b/src/templates/qquickcontainer_p_p.h
@@ -92,8 +92,6 @@ public:
bool updatingCurrent;
};
-Q_DECLARE_TYPEINFO(QQuickContainerPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKCONTAINER_P_P_H
diff --git a/src/templates/qquickcontrol.cpp b/src/templates/qquickcontrol.cpp
index 908abeda..d1abafe2 100644
--- a/src/templates/qquickcontrol.cpp
+++ b/src/templates/qquickcontrol.cpp
@@ -44,6 +44,7 @@
#include "qquicktextarea_p_p.h"
#include "qquicktextfield_p.h"
#include "qquicktextfield_p_p.h"
+#include "qquickapplicationwindow_p.h"
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformtheme.h>
@@ -65,10 +66,9 @@ QT_BEGIN_NAMESPACE
*/
QQuickControlPrivate::QQuickControlPrivate() :
- hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false),
- padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0), spacing(0),
- layoutDirection(Qt::LeftToRight), background(Q_NULLPTR), contentItem(Q_NULLPTR),
- accessibleAttached(Q_NULLPTR)
+ hasTopPadding(false), hasLeftPadding(false), hasRightPadding(false), hasBottomPadding(false), hasLocale(false),
+ padding(0), topPadding(0), leftPadding(0), rightPadding(0), bottomPadding(0), spacing(0), focusReason(Qt::OtherFocusReason),
+ background(Q_NULLPTR), contentItem(Q_NULLPTR), accessibleAttached(Q_NULLPTR)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -85,7 +85,8 @@ QQuickControlPrivate::~QQuickControlPrivate()
void QQuickControlPrivate::mirrorChange()
{
Q_Q(QQuickControl);
- q->mirrorChange();
+ if (locale.textDirection() == Qt::LeftToRight)
+ q->mirrorChange();
}
void QQuickControlPrivate::setTopPadding(qreal value, bool reset)
@@ -218,15 +219,22 @@ QFont QQuickControlPrivate::naturalControlFont(const QQuickItem *q)
}
QQuickItem *p = q->parentItem();
+ bool found = false;
while (p) {
if (QQuickControl *qc = qobject_cast<QQuickControl *>(p)) {
naturalFont = qc->font();
+ found = true;
break;
}
p = p->parentItem();
}
+ if (!found) {
+ if (QQuickApplicationWindow *w = qobject_cast<QQuickApplicationWindow *>(q->window()))
+ naturalFont = w->font();
+ }
+
naturalFont.resolve(0);
return naturalFont;
}
@@ -353,8 +361,11 @@ void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::
{
Q_D(QQuickControl);
QQuickItem::itemChange(change, value);
- if (change == ItemParentHasChanged && isComponentComplete())
+ if (change == ItemParentHasChanged && isComponentComplete()) {
d->resolveFont();
+ if (!d->hasLocale)
+ d->locale = d->calcLocale();
+ }
}
/*!
@@ -367,7 +378,7 @@ void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::
controls can maintain consistency with the native platform's native look and feel. It's common
that different platforms, or different styles, define different fonts for an application.
- The default font depends on the system environment. QGuiApplication maintains a system/theme
+ The default font depends on the system environment. ApplicationWindow maintains a system/theme
font which serves as a default for all controls. There may also be special font defaults for
certain types of controls. You can also set the default font for controls by passing a custom
font to QGuiApplication::setFont(), before loading the QML. Finally, the font is matched
@@ -412,7 +423,7 @@ void QQuickControl::resetFont()
*/
qreal QQuickControl::availableWidth() const
{
- return qMax(0.0, width() - leftPadding() - rightPadding());
+ return qMax<qreal>(0.0, width() - leftPadding() - rightPadding());
}
/*!
@@ -424,7 +435,7 @@ qreal QQuickControl::availableWidth() const
*/
qreal QQuickControl::availableHeight() const
{
- return qMax(0.0, height() - topPadding() - bottomPadding());
+ return qMax<qreal>(0.0, height() - topPadding() - bottomPadding());
}
/*!
@@ -603,51 +614,83 @@ void QQuickControl::resetSpacing()
}
/*!
- \qmlproperty enumeration Qt.labs.controls::Control::layoutDirection
-
- This property holds the layout direction of the control.
+ \qmlproperty Locale Qt.labs.calendar::Control::locale
- Possible values:
- \value Qt.LeftToRight Items are laid out from left to right. If the width of the row is explicitly set,
- the left anchor remains to the left of the row (default).
- \value Qt.RightToLeft Items are laid out from right to left. If the width of the row is explicitly set,
- the right anchor remains to the right of the row.
+ This property holds the locale of the control.
- \sa effectiveLayoutDirection
+ \sa mirrored, {LayoutMirroring}{LayoutMirroring}
*/
-Qt::LayoutDirection QQuickControl::layoutDirection() const
+QLocale QQuickControl::locale() const
{
Q_D(const QQuickControl);
- return d->layoutDirection;
+ return d->locale;
}
-/*!
- \qmlproperty enumeration Qt.labs.controls::Control::effectiveLayoutDirection
- \readonly
+void QQuickControl::setLocale(const QLocale &locale)
+{
+ Q_D(QQuickControl);
+ if (d->hasLocale && d->locale == locale)
+ return;
+
+ d->updateLocale(locale, true); // explicit=true
+}
- This property holds the effective layout direction of the control.
+void QQuickControl::resetLocale()
+{
+ Q_D(QQuickControl);
+ if (!d->hasLocale)
+ return;
- When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled}
- for locale layouts, the visual layout direction of the control will be mirrored. However,
- the \l layoutDirection property will remain unchanged.
+ d->updateLocale(d->calcLocale(), false); // explicit=false
+}
- \sa layoutDirection, {LayoutMirroring}{LayoutMirroring}
-*/
-Qt::LayoutDirection QQuickControl::effectiveLayoutDirection() const
+QLocale QQuickControlPrivate::calcLocale() const
{
- Q_D(const QQuickControl);
- if (d->isMirrored())
- return d->layoutDirection == Qt::RightToLeft ? Qt::LeftToRight : Qt::RightToLeft;
- return d->layoutDirection;
+ Q_Q(const QQuickControl);
+ QQuickItem *p = q->parentItem();
+ while (p) {
+ if (QQuickControl *qc = qobject_cast<QQuickControl *>(p))
+ return qc->locale();
+
+ QVariant v = p->property("locale");
+ if (v.isValid() && v.userType() == QMetaType::QLocale)
+ return v.toLocale();
+
+ p = p->parentItem();
+ }
+
+ if (QQuickApplicationWindow *w = qobject_cast<QQuickApplicationWindow *>(q->window()))
+ return w->locale();
+
+ return QLocale();
}
-void QQuickControl::setLayoutDirection(Qt::LayoutDirection direction)
+void QQuickControlPrivate::updateLocale(const QLocale &l, bool e)
{
- Q_D(QQuickControl);
- if (d->layoutDirection != direction) {
- d->layoutDirection = direction;
- emit layoutDirectionChanged();
- mirrorChange();
+ Q_Q(QQuickControl);
+ if (!e && hasLocale)
+ return;
+
+ QLocale old = q->locale();
+ hasLocale = e;
+ if (old != l) {
+ bool wasMirrored = q->isMirrored();
+ q->localeChange(l, old);
+ locale = l;
+ QQuickControlPrivate::updateLocaleRecur(q, l);
+ emit q->localeChanged();
+ if (wasMirrored != q->isMirrored())
+ q->mirrorChange();
+ }
+}
+
+void QQuickControlPrivate::updateLocaleRecur(QQuickItem *item, const QLocale &l)
+{
+ foreach (QQuickItem *child, item->childItems()) {
+ if (QQuickControl *control = qobject_cast<QQuickControl *>(child))
+ QQuickControlPrivate::get(control)->updateLocale(l, false);
+ else
+ updateLocaleRecur(child, l);
}
}
@@ -660,11 +703,46 @@ void QQuickControl::setLayoutDirection(Qt::LayoutDirection direction)
This property is provided for convenience. A control is considered mirrored
when its visual layout direction is right-to-left.
- \sa effectiveLayoutDirection, {LayoutMirroring}{LayoutMirroring}
+ \sa locale, {LayoutMirroring}{LayoutMirroring}
*/
bool QQuickControl::isMirrored() const
{
- return effectiveLayoutDirection() == Qt::RightToLeft;
+ Q_D(const QQuickControl);
+ return d->isMirrored() || d->locale.textDirection() == Qt::RightToLeft;
+}
+
+/*!
+ \qmlproperty enumeration Qt.labs.controls::Control::focusReason
+
+ This property holds the reason of the last focus change.
+
+ \note This property does not indicate whether the control has \l {Item::activeFocus}
+ {active focus}, but the reason why the control either gained or lost focus.
+
+ \value Qt.MouseFocusReason A mouse action occurred.
+ \value Qt.TabFocusReason The Tab key was pressed.
+ \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
+ \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
+ \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
+ \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
+ \value Qt.MenuBarFocusReason The menu bar took focus.
+ \value Qt.OtherFocusReason Another reason, usually application-specific.
+
+ \sa Item::activeFocus
+*/
+Qt::FocusReason QQuickControl::focusReason() const
+{
+ Q_D(const QQuickControl);
+ return d->focusReason;
+}
+
+void QQuickControl::setFocusReason(Qt::FocusReason reason)
+{
+ Q_D(QQuickControl);
+ if (d->focusReason != reason) {
+ d->focusReason = reason;
+ emit focusReasonChanged();
+ }
}
/*!
@@ -742,6 +820,18 @@ QFont QQuickControl::defaultFont() const
return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
}
+void QQuickControl::focusInEvent(QFocusEvent *event)
+{
+ QQuickItem::focusInEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickControl::focusOutEvent(QFocusEvent *event)
+{
+ QQuickItem::focusOutEvent(event);
+ setFocusReason(event->reason());
+}
+
void QQuickControl::mousePressEvent(QMouseEvent *event)
{
event->accept();
@@ -771,7 +861,6 @@ void QQuickControl::geometryChanged(const QRectF &newGeometry, const QRectF &old
void QQuickControl::mirrorChange()
{
- emit effectiveLayoutDirectionChanged();
emit mirroredChanged();
}
@@ -789,4 +878,10 @@ void QQuickControl::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
Q_UNUSED(oldItem);
}
+void QQuickControl::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
+{
+ Q_UNUSED(newLocale);
+ Q_UNUSED(oldLocale);
+}
+
QT_END_NAMESPACE
diff --git a/src/templates/qquickcontrol_p.h b/src/templates/qquickcontrol_p.h
index 346b45b3..8d4055e5 100644
--- a/src/templates/qquickcontrol_p.h
+++ b/src/templates/qquickcontrol_p.h
@@ -48,6 +48,7 @@
// We mean it.
//
+#include <QtCore/qlocale.h>
#include <QtQuick/qquickitem.h>
#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
@@ -67,9 +68,9 @@ class Q_LABSTEMPLATES_EXPORT QQuickControl : public QQuickItem
Q_PROPERTY(qreal rightPadding READ rightPadding WRITE setRightPadding RESET resetRightPadding NOTIFY rightPaddingChanged FINAL)
Q_PROPERTY(qreal bottomPadding READ bottomPadding WRITE setBottomPadding RESET resetBottomPadding NOTIFY bottomPaddingChanged FINAL)
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing RESET resetSpacing NOTIFY spacingChanged FINAL)
- Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged FINAL)
- Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged FINAL)
+ Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET resetLocale NOTIFY localeChanged FINAL)
Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL)
+ Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
@@ -107,12 +108,15 @@ public:
void setSpacing(qreal spacing);
void resetSpacing();
- Qt::LayoutDirection layoutDirection() const;
- Qt::LayoutDirection effectiveLayoutDirection() const;
- void setLayoutDirection(Qt::LayoutDirection direction);
+ QLocale locale() const;
+ void setLocale(const QLocale &locale);
+ void resetLocale();
bool isMirrored() const;
+ Qt::FocusReason focusReason() const;
+ void setFocusReason(Qt::FocusReason reason);
+
QQuickItem *background() const;
void setBackground(QQuickItem *background);
@@ -129,9 +133,9 @@ Q_SIGNALS:
void rightPaddingChanged();
void bottomPaddingChanged();
void spacingChanged();
- void layoutDirectionChanged();
- void effectiveLayoutDirectionChanged();
+ void localeChanged();
void mirroredChanged();
+ void focusReasonChanged();
void backgroundChanged();
void contentItemChanged();
@@ -145,6 +149,9 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
@@ -153,6 +160,7 @@ protected:
virtual void mirrorChange();
virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
+ virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
#ifndef QT_NO_ACCESSIBILITY
virtual void accessibilityActiveChanged(bool active);
@@ -171,8 +179,8 @@ private:
Q_DECLARE_PRIVATE(QQuickControl)
};
-Q_DECLARE_TYPEINFO(QQuickControl, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickControl)
+
#endif // QQUICKCONTROL_P_H
diff --git a/src/templates/qquickcontrol_p_p.h b/src/templates/qquickcontrol_p_p.h
index ab185952..21f6c1b1 100644
--- a/src/templates/qquickcontrol_p_p.h
+++ b/src/templates/qquickcontrol_p_p.h
@@ -102,26 +102,30 @@ public:
void resolveFont();
static QFont naturalControlFont(const QQuickItem *);
static QFont themeFont(QPlatformTheme::Font type);
+ void updateLocale(const QLocale &l, bool e);
+ static void updateLocaleRecur(QQuickItem *item, const QLocale &l);
+
+ QLocale calcLocale() const;
QFont font;
bool hasTopPadding;
bool hasLeftPadding;
bool hasRightPadding;
bool hasBottomPadding;
+ bool hasLocale;
qreal padding;
qreal topPadding;
qreal leftPadding;
qreal rightPadding;
qreal bottomPadding;
qreal spacing;
- Qt::LayoutDirection layoutDirection;
+ QLocale locale;
+ Qt::FocusReason focusReason;
QQuickItem *background;
QQuickItem *contentItem;
QQuickAccessibleAttached *accessibleAttached;
};
-Q_DECLARE_TYPEINFO(QQuickControlPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKCONTROL_P_P_H
diff --git a/src/templates/qquickdial.cpp b/src/templates/qquickdial.cpp
index bb3b5250..dcc2b293 100644
--- a/src/templates/qquickdial.cpp
+++ b/src/templates/qquickdial.cpp
@@ -140,7 +140,7 @@ qreal QQuickDialPrivate::positionAt(const QPoint &point) const
void QQuickDialPrivate::setPosition(qreal pos)
{
Q_Q(QQuickDial);
- pos = qBound(0.0, pos, 1.0);
+ pos = qBound<qreal>(0.0, pos, 1.0);
if (!qFuzzyCompare(position, pos)) {
position = pos;
diff --git a/src/templates/qquickdial_p.h b/src/templates/qquickdial_p.h
index c4e7c276..19d37547 100644
--- a/src/templates/qquickdial_p.h
+++ b/src/templates/qquickdial_p.h
@@ -140,8 +140,8 @@ private:
Q_DECLARE_PRIVATE(QQuickDial)
};
-Q_DECLARE_TYPEINFO(QQuickDial, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickDial)
+
#endif // QQUICKDIAL_H
diff --git a/src/templates/qquickdrawer.cpp b/src/templates/qquickdrawer.cpp
index a1fdf8f8..ca6c8c13 100644
--- a/src/templates/qquickdrawer.cpp
+++ b/src/templates/qquickdrawer.cpp
@@ -40,6 +40,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquickanimation_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
QT_BEGIN_NAMESPACE
@@ -88,7 +89,7 @@ QT_BEGIN_NAMESPACE
This signal is emitted when the drawer is clicked.
*/
-class QQuickDrawerPrivate : public QQuickControlPrivate
+class QQuickDrawerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
{
Q_DECLARE_PUBLIC(QQuickDrawer)
@@ -101,6 +102,8 @@ public:
bool handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event);
bool handleMouseReleaseEvent(QQuickItem *item, QMouseEvent *event);
+ void itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &) Q_DECL_OVERRIDE;
+
Qt::Edge edge;
qreal offset;
qreal position;
@@ -131,31 +134,35 @@ void QQuickDrawerPrivate::updateContent()
}
}
+static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event, int threshold = -1)
+{
+ return QQuickWindowPrivate::dragOverThreshold(d, axis, event, threshold);
+}
+
bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *event)
{
Q_Q(QQuickDrawer);
- pressPoint = q->mapFromItem(item, event->pos());
+ pressPoint = event->windowPos();
+ offset = 0;
if (qFuzzyIsNull(position)) {
// only accept pressing at drag margins when fully closed
switch (edge) {
case Qt::LeftEdge:
- event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(event->x(), Qt::XAxis, event));
+ event->setAccepted(!dragOverThreshold(event->windowPos().x(), Qt::XAxis, event));
break;
case Qt::RightEdge:
- event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(q->width() - event->x(), Qt::XAxis, event));
+ event->setAccepted(!dragOverThreshold(q->width() - event->windowPos().x(), Qt::XAxis, event));
break;
case Qt::TopEdge:
- event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(event->y(), Qt::YAxis, event));
+ event->setAccepted(!dragOverThreshold(event->windowPos().y(), Qt::YAxis, event));
break;
case Qt::BottomEdge:
- event->setAccepted(!QQuickWindowPrivate::dragOverThreshold(q->height() - event->y(), Qt::YAxis, event));
+ event->setAccepted(!dragOverThreshold(q->height() - event->windowPos().y(), Qt::YAxis, event));
break;
}
- offset = 0;
} else {
event->accept();
- offset = q->positionAt(pressPoint) - position;
}
return item == q;
@@ -164,26 +171,32 @@ bool QQuickDrawerPrivate::handleMousePressEvent(QQuickItem *item, QMouseEvent *e
bool QQuickDrawerPrivate::handleMouseMoveEvent(QQuickItem *item, QMouseEvent *event)
{
Q_Q(QQuickDrawer);
- QPointF movePoint = q->mapFromItem(item, event->pos());
+ Q_UNUSED(item);
+ QPointF movePoint = event->windowPos();
if (!q->keepMouseGrab()) {
+ // Flickable uses a hard-coded threshold of 15 for flicking, and
+ // QStyleHints::startDragDistance for dragging. Drawer uses a bit
+ // larger threshold to avoid being too eager to steal touch (QTBUG-50045)
+ int threshold = qMax(20, QGuiApplication::styleHints()->startDragDistance() + 5);
bool overThreshold = false;
if (edge == Qt::LeftEdge || edge == Qt::RightEdge)
- overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event);
+ overThreshold = dragOverThreshold(movePoint.x() - pressPoint.x(), Qt::XAxis, event, threshold);
else
- overThreshold = QQuickWindowPrivate::dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event);
+ overThreshold = dragOverThreshold(movePoint.y() - pressPoint.y(), Qt::YAxis, event, threshold);
if (window && overThreshold) {
QQuickItem *grabber = q->window()->mouseGrabberItem();
if (!grabber || !grabber->keepMouseGrab()) {
q->grabMouse();
q->setKeepMouseGrab(overThreshold);
+ offset = qMin<qreal>(0.0, q->positionAt(movePoint) - position);
}
}
}
if (q->keepMouseGrab())
- q->setPosition(q->positionAt(event->pos()) - offset);
+ q->setPosition(q->positionAt(movePoint) - offset);
event->accept();
return q->keepMouseGrab();
@@ -242,6 +255,11 @@ bool QQuickDrawerPrivate::handleMouseReleaseEvent(QQuickItem *item, QMouseEvent
return wasGrabbed;
}
+void QQuickDrawerPrivate::itemGeometryChanged(QQuickItem *, const QRectF &, const QRectF &)
+{
+ updateContent();
+}
+
QQuickDrawer::QQuickDrawer(QQuickItem *parent) :
QQuickControl(*(new QQuickDrawerPrivate), parent)
{
@@ -294,7 +312,7 @@ qreal QQuickDrawer::position() const
void QQuickDrawer::setPosition(qreal position)
{
Q_D(QQuickDrawer);
- position = qBound(0.0, position, 1.0);
+ position = qBound<qreal>(0.0, position, 1.0);
if (!qFuzzyCompare(d->position, position)) {
d->position = position;
if (isComponentComplete())
@@ -319,12 +337,17 @@ void QQuickDrawer::setContentItem(QQuickItem *item)
{
Q_D(QQuickDrawer);
if (d->content != item) {
- delete d->content;
+ if (d->content) {
+ QQuickItemPrivate::get(d->content)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ delete d->content;
+ }
d->content = item;
- if (item)
+ if (item) {
item->setParentItem(this);
- if (isComponentComplete())
- d->updateContent();
+ QQuickItemPrivate::get(item)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+ if (isComponentComplete())
+ d->updateContent();
+ }
emit contentItemChanged();
}
}
diff --git a/src/templates/qquickdrawer_p.h b/src/templates/qquickdrawer_p.h
index c05ad036..f953b0fd 100644
--- a/src/templates/qquickdrawer_p.h
+++ b/src/templates/qquickdrawer_p.h
@@ -107,8 +107,8 @@ private:
Q_DECLARE_PRIVATE(QQuickDrawer)
};
-Q_DECLARE_TYPEINFO(QQuickDrawer, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickDrawer)
+
#endif // QQUICKDRAWER_P_H
diff --git a/src/templates/qquickframe.cpp b/src/templates/qquickframe.cpp
index 69a7abb0..386aa5fb 100644
--- a/src/templates/qquickframe.cpp
+++ b/src/templates/qquickframe.cpp
@@ -41,7 +41,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Frame
- \inherits Control
+ \inherits Pane
\instantiates QQuickFrame
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-containers
@@ -63,76 +63,18 @@ QT_BEGIN_NAMESPACE
\sa {Customizing Frame}, {Container Controls}
*/
-QQuickFramePrivate::QQuickFramePrivate() : contentWidth(0), contentHeight(0), frame(Q_NULLPTR)
+QQuickFramePrivate::QQuickFramePrivate() : frame(Q_NULLPTR)
{
}
-void QQuickFramePrivate::init()
-{
- Q_Q(QQuickFrame);
- q->setFlag(QQuickItem::ItemIsFocusScope);
- q->setAcceptedMouseButtons(Qt::AllButtons);
-
-}
-
QQuickFrame::QQuickFrame(QQuickItem *parent) :
- QQuickControl(*(new QQuickFramePrivate), parent)
+ QQuickPane(*(new QQuickFramePrivate), parent)
{
- d_func()->init();
}
QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
- QQuickControl(dd, parent)
+ QQuickPane(dd, parent)
{
- d_func()->init();
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Frame::contentWidth
-
- This property holds the content width. It is used for calculating the
- total implicit width of the frame.
-
- \note If only a single item is used within the frame, the implicit width
- of its contained item is used as the content width.
-*/
-qreal QQuickFrame::contentWidth() const
-{
- Q_D(const QQuickFrame);
- return d->contentWidth;
-}
-
-void QQuickFrame::setContentWidth(qreal width)
-{
- Q_D(QQuickFrame);
- if (d->contentWidth != width) {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
-}
-
-/*!
- \qmlproperty real Qt.labs.controls::Frame::contentHeight
-
- This property holds the content height. It is used for calculating the
- total implicit height of the frame.
-
- \note If only a single item is used within the frame, the implicit height
- of its contained item is used as the content height.
-*/
-qreal QQuickFrame::contentHeight() const
-{
- Q_D(const QQuickFrame);
- return d->contentHeight;
-}
-
-void QQuickFrame::setContentHeight(qreal height)
-{
- Q_D(QQuickFrame);
- if (d->contentHeight != height) {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
}
/*!
@@ -160,49 +102,4 @@ void QQuickFrame::setFrame(QQuickItem *frame)
}
}
-/*!
- \qmlproperty list<Object> Qt.labs.controls::Frame::contentData
- \default
-
- This property holds the list of content data.
-
- \sa Item::data
-*/
-QQmlListProperty<QObject> QQuickFrame::contentData()
-{
- Q_D(QQuickFrame);
- return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::data_append,
- QQuickItemPrivate::data_count,
- QQuickItemPrivate::data_at,
- QQuickItemPrivate::data_clear);
-}
-
-/*!
- \qmlproperty list<Item> Qt.labs.controls::Frame::contentChildren
-
- This property holds the list of content children.
-
- \sa Item::children
-*/
-QQmlListProperty<QQuickItem> QQuickFrame::contentChildren()
-{
- Q_D(QQuickFrame);
- return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
- QQuickItemPrivate::children_append,
- QQuickItemPrivate::children_count,
- QQuickItemPrivate::children_at,
- QQuickItemPrivate::children_clear);
-}
-
-void QQuickFrame::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickFrame::contentChildrenChanged);
- if (newItem)
- connect(newItem, &QQuickItem::childrenChanged, this, &QQuickFrame::contentChildrenChanged);
- emit contentChildrenChanged();
-}
-
QT_END_NAMESPACE
diff --git a/src/templates/qquickframe_p.h b/src/templates/qquickframe_p.h
index 7d4db523..0bfd63e8 100644
--- a/src/templates/qquickframe_p.h
+++ b/src/templates/qquickframe_p.h
@@ -48,56 +48,36 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p.h>
-#include <QtQml/qqmllist.h>
+#include <QtLabsTemplates/private/qquickpane_p.h>
QT_BEGIN_NAMESPACE
class QQuickFramePrivate;
-class Q_LABSTEMPLATES_EXPORT QQuickFrame : public QQuickControl
+class Q_LABSTEMPLATES_EXPORT QQuickFrame : public QQuickPane
{
Q_OBJECT
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
Q_PROPERTY(QQuickItem *frame READ frame WRITE setFrame NOTIFY frameChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentData")
public:
explicit QQuickFrame(QQuickItem *parent = Q_NULLPTR);
- qreal contentWidth() const;
- void setContentWidth(qreal width);
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
-
QQuickItem *frame() const;
void setFrame(QQuickItem *frame);
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
Q_SIGNALS:
- void contentWidthChanged();
- void contentHeightChanged();
- void contentChildrenChanged();
void frameChanged();
protected:
QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
-
private:
Q_DISABLE_COPY(QQuickFrame)
Q_DECLARE_PRIVATE(QQuickFrame)
};
-Q_DECLARE_TYPEINFO(QQuickFrame, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickFrame)
+
#endif // QQUICKFRAME_P_H
diff --git a/src/templates/qquickframe_p_p.h b/src/templates/qquickframe_p_p.h
index 73a8cd85..3d570572 100644
--- a/src/templates/qquickframe_p_p.h
+++ b/src/templates/qquickframe_p_p.h
@@ -48,28 +48,22 @@
// We mean it.
//
-#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+#include <QtLabsTemplates/private/qquickpane_p_p.h>
QT_BEGIN_NAMESPACE
class QQuickFrame;
-class Q_LABSTEMPLATES_EXPORT QQuickFramePrivate : public QQuickControlPrivate
+class Q_LABSTEMPLATES_EXPORT QQuickFramePrivate : public QQuickPanePrivate
{
Q_DECLARE_PUBLIC(QQuickFrame)
public:
QQuickFramePrivate();
- void init();
-
- qreal contentWidth;
- qreal contentHeight;
QQuickItem *frame;
};
-Q_DECLARE_TYPEINFO(QQuickFramePrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKFRAME_P_P_H
diff --git a/src/templates/qquickgroupbox.cpp b/src/templates/qquickgroupbox.cpp
index 2f120879..ef8789a5 100644
--- a/src/templates/qquickgroupbox.cpp
+++ b/src/templates/qquickgroupbox.cpp
@@ -62,7 +62,20 @@ QT_BEGIN_NAMESPACE
\snippet qtlabscontrols-groupbox.qml 1
- \sa {Customizing GroupBox}, {Container Controls}
+ \section2 Checkable GroupBox
+
+ Even though GroupBox has no built-in check box, it is straightforward
+ to create a checkable GroupBox by pairing it with a CheckBox.
+
+ \image qtlabscontrols-groupbox-checkable.png
+
+ It is a common pattern to enable or disable the groupbox's children when
+ its check box is toggled on/off, respectively, but the semantics of the
+ check box is left to the application to decide.
+
+ \snippet qtlabscontrols-groupbox-checkable.qml 1
+
+ \sa CheckBox, {Customizing GroupBox}, {Container Controls}
*/
class QQuickGroupBoxPrivate : public QQuickFramePrivate
@@ -126,7 +139,7 @@ void QQuickGroupBox::setLabel(QQuickItem *label)
QFont QQuickGroupBox::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::MdiSubWindowTitleFont); // tmp
+ return QQuickControlPrivate::themeFont(QPlatformTheme::GroupBoxTitleFont);
}
QT_END_NAMESPACE
diff --git a/src/templates/qquickgroupbox_p.h b/src/templates/qquickgroupbox_p.h
index 5dcfe971..b81d6534 100644
--- a/src/templates/qquickgroupbox_p.h
+++ b/src/templates/qquickgroupbox_p.h
@@ -81,8 +81,8 @@ private:
Q_DECLARE_PRIVATE(QQuickGroupBox)
};
-Q_DECLARE_TYPEINFO(QQuickGroupBox, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickGroupBox)
+
#endif // QQUICKGROUPBOX_P_H
diff --git a/src/templates/qquickitemdelegate_p.h b/src/templates/qquickitemdelegate_p.h
index e3f415a6..01e7b39c 100644
--- a/src/templates/qquickitemdelegate_p.h
+++ b/src/templates/qquickitemdelegate_p.h
@@ -71,8 +71,8 @@ private:
Q_DECLARE_PRIVATE(QQuickItemDelegate)
};
-Q_DECLARE_TYPEINFO(QQuickItemDelegate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickItemDelegate)
+
#endif // QQUICKITEMDELEGATE_P_H
diff --git a/src/templates/qquicklabel_p.h b/src/templates/qquicklabel_p.h
index d753320d..26f72840 100644
--- a/src/templates/qquicklabel_p.h
+++ b/src/templates/qquicklabel_p.h
@@ -86,8 +86,8 @@ private:
Q_DECLARE_PRIVATE(QQuickLabel)
};
-Q_DECLARE_TYPEINFO(QQuickLabel, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickLabel)
+
#endif // QQUICKLABEL_P_H
diff --git a/src/templates/qquicklabel_p_p.h b/src/templates/qquicklabel_p_p.h
index 1cd831b1..a4e9f4e5 100644
--- a/src/templates/qquicklabel_p_p.h
+++ b/src/templates/qquicklabel_p_p.h
@@ -86,8 +86,6 @@ public:
QQuickAccessibleAttached *accessibleAttached;
};
-Q_DECLARE_TYPEINFO(QQuickLabelPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKLABEL_P_P_H
diff --git a/src/templates/qquickmenu.cpp b/src/templates/qquickmenu.cpp
index b21a7a3e..d6c6e1cb 100644
--- a/src/templates/qquickmenu.cpp
+++ b/src/templates/qquickmenu.cpp
@@ -36,7 +36,6 @@
#include "qquickmenu_p.h"
#include "qquickmenu_p_p.h"
-#include "qquickpanel_p_p.h"
#include "qquickmenuitem_p.h"
#include <QtGui/qevent.h>
@@ -50,7 +49,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Menu
- \inherits Panel
+ \inherits Popup
\instantiates QQuickMenu
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-menus
@@ -68,7 +67,7 @@ QT_BEGIN_NAMESPACE
Button {
id: fileButton
text: "File"
- onClicked: menu.show()
+ onClicked: menu.open()
}
Menu {
id: menu
@@ -268,7 +267,7 @@ void QQuickMenuPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObj
QQuickMenuItem *menuItem = qobject_cast<QQuickMenuItem *>(item);
if (menuItem) {
QObjectPrivate::connect(menuItem, &QQuickMenuItem::pressed, p, &QQuickMenuPrivate::onItemPressed);
- QObject::connect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPanel::hide);
+ QObject::connect(menuItem, &QQuickMenuItem::triggered, q, &QQuickPopup::close);
QObjectPrivate::connect(menuItem, &QQuickItem::activeFocusChanged, p, &QQuickMenuPrivate::onItemActiveFocusChanged);
}
}
@@ -296,11 +295,11 @@ void QQuickMenuPrivate::contentData_clear(QQmlListProperty<QObject> *prop)
}
QQuickMenu::QQuickMenu(QObject *parent) :
- QQuickPanel(*(new QQuickMenuPrivate), parent)
+ QQuickPopup(*(new QQuickMenuPrivate), parent)
{
Q_D(QQuickMenu);
- connect(this, &QQuickMenu::pressedOutside, this, &QQuickMenu::hide);
- connect(this, &QQuickMenu::releasedOutside, this, &QQuickMenu::hide);
+ connect(this, &QQuickMenu::pressedOutside, this, &QQuickMenu::close);
+ connect(this, &QQuickMenu::releasedOutside, this, &QQuickMenu::close);
QObjectPrivate::connect(this, &QQuickMenu::contentItemChanged, d, &QQuickMenuPrivate::onContentItemChanged);
}
@@ -445,6 +444,9 @@ bool QQuickMenu::eventFilter(QObject *object, QEvent *event)
if (d->contentItem->metaObject()->indexOfMethod("incrementCurrentIndex()") != -1)
QMetaObject::invokeMethod(d->contentItem, "incrementCurrentIndex");
return true;
+ } else if (keyEvent->key() == Qt::Key_Escape) {
+ close();
+ return true;
}
return false;
diff --git a/src/templates/qquickmenu_p.h b/src/templates/qquickmenu_p.h
index cd079d4e..d4bb27b9 100644
--- a/src/templates/qquickmenu_p.h
+++ b/src/templates/qquickmenu_p.h
@@ -49,15 +49,16 @@
//
#include <QtQml/qqmllist.h>
+#include <QtQml/qqml.h>
-#include "qquickpanel_p.h"
+#include "qquickpopup_p.h"
QT_BEGIN_NAMESPACE
class QQuickMenuItem;
class QQuickMenuPrivate;
-class Q_LABSTEMPLATES_EXPORT QQuickMenu : public QQuickPanel
+class Q_LABSTEMPLATES_EXPORT QQuickMenu : public QQuickPopup
{
Q_OBJECT
Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
@@ -84,8 +85,8 @@ private:
Q_DECLARE_PRIVATE(QQuickMenu)
};
-Q_DECLARE_TYPEINFO(QQuickMenu, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickMenu)
+
#endif // QQUICKMENU_P_H
diff --git a/src/templates/qquickmenu_p_p.h b/src/templates/qquickmenu_p_p.h
index 166d184b..154ba968 100644
--- a/src/templates/qquickmenu_p_p.h
+++ b/src/templates/qquickmenu_p_p.h
@@ -51,13 +51,13 @@
#include <QtCore/qvector.h>
#include <QtQuick/private/qquickitemchangelistener_p.h>
-#include <QtLabsTemplates/private/qquickpanel_p_p.h>
+#include <QtLabsTemplates/private/qquickpopup_p_p.h>
QT_BEGIN_NAMESPACE
class QQmlObjectModel;
-class Q_LABSTEMPLATES_EXPORT QQuickMenuPrivate : public QQuickPanelPrivate, public QQuickItemChangeListener
+class Q_LABSTEMPLATES_EXPORT QQuickMenuPrivate : public QQuickPopupPrivate, public QQuickItemChangeListener
{
Q_DECLARE_PUBLIC(QQuickMenu)
@@ -91,8 +91,6 @@ public:
bool ignoreActiveFocusChanges;
};
-Q_DECLARE_TYPEINFO(QQuickMenuPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKMENU_P_P_H
diff --git a/src/templates/qquickmenuitem.cpp b/src/templates/qquickmenuitem.cpp
index 83696535..f6cfda4c 100644
--- a/src/templates/qquickmenuitem.cpp
+++ b/src/templates/qquickmenuitem.cpp
@@ -37,6 +37,7 @@
#include "qquickmenuitem_p.h"
#include "qquickabstractbutton_p_p.h"
+#include <QtGui/qpa/qplatformtheme.h>
#include <QtQuick/private/qquickevents_p_p.h>
QT_BEGIN_NAMESPACE
@@ -56,7 +57,7 @@ QT_BEGIN_NAMESPACE
Button {
id: fileButton
text: "File"
- onClicked: menu.show()
+ onClicked: menu.open()
}
Menu {
id: menu
@@ -89,6 +90,11 @@ QQuickMenuItem::QQuickMenuItem(QQuickItem *parent) :
connect(this, &QQuickAbstractButton::clicked, this, &QQuickMenuItem::triggered);
}
+QFont QQuickMenuItem::defaultFont() const
+{
+ return QQuickControlPrivate::themeFont(QPlatformTheme::MenuItemFont);
+}
+
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role QQuickMenuItem::accessibleRole() const
{
diff --git a/src/templates/qquickmenuitem_p.h b/src/templates/qquickmenuitem_p.h
index 3f86fe2e..91d1e91e 100644
--- a/src/templates/qquickmenuitem_p.h
+++ b/src/templates/qquickmenuitem_p.h
@@ -65,6 +65,8 @@ Q_SIGNALS:
void triggered();
protected:
+ QFont defaultFont() const Q_DECL_OVERRIDE;
+
#ifndef QT_NO_ACCESSIBILITY
QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
#endif
@@ -74,8 +76,8 @@ private:
Q_DECLARE_PRIVATE(QQuickMenuItem)
};
-Q_DECLARE_TYPEINFO(QQuickMenuItem, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickMenuItem)
+
#endif // QQUICKMENUITEM_P_H
diff --git a/src/templates/qquickoverlay.cpp b/src/templates/qquickoverlay.cpp
index 4a00387a..e06d28ea 100644
--- a/src/templates/qquickoverlay.cpp
+++ b/src/templates/qquickoverlay.cpp
@@ -35,88 +35,215 @@
****************************************************************************/
#include "qquickoverlay_p.h"
-#include "qquickpanel_p.h"
+#include "qquickpopup_p.h"
+#include "qquickdrawer_p.h"
#include <QtQml/qqmlinfo.h>
+#include <QtQml/qqmlproperty.h>
#include <QtQuick/private/qquickitem_p.h>
QT_BEGIN_NAMESPACE
+class QQuickOverlayPrivate : public QQuickItemPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickOverlay)
+
+public:
+ QQuickOverlayPrivate();
+
+ void popupAboutToShow();
+ void popupAboutToHide();
+ void drawerPositionChange();
+ void resizeBackground();
+
+ QQuickItem *background;
+ QVector<QQuickDrawer *> drawers;
+ QHash<QQuickItem *, QQuickPopup *> popups;
+ int modalPopups;
+};
+
+void QQuickOverlayPrivate::popupAboutToShow()
+{
+ Q_Q(QQuickOverlay);
+ if (!background || modalPopups > 1)
+ return;
+
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
+ if (!popup || !popup->isModal())
+ return;
+
+ // use QQmlProperty instead of QQuickItem::setOpacity() to trigger QML Behaviors
+ QQmlProperty::write(background, QStringLiteral("opacity"), 1.0);
+}
+
+void QQuickOverlayPrivate::popupAboutToHide()
+{
+ Q_Q(QQuickOverlay);
+ if (!background || modalPopups > 1)
+ return;
+
+ QQuickPopup *popup = qobject_cast<QQuickPopup *>(q->sender());
+ if (!popup || !popup->isModal())
+ return;
+
+ // use QQmlProperty instead of QQuickItem::setOpacity() to trigger QML Behaviors
+ QQmlProperty::write(background, QStringLiteral("opacity"), 0.0);
+}
+
+void QQuickOverlayPrivate::drawerPositionChange()
+{
+ Q_Q(QQuickOverlay);
+ QQuickDrawer *drawer = qobject_cast<QQuickDrawer *>(q->sender());
+ if (!background || !drawer || modalPopups > 0)
+ return;
+
+ // call QQuickItem::setOpacity() directly to avoid triggering QML Behaviors
+ // which would make the fading feel laggy compared to the drawer movement
+ background->setOpacity(drawer->position());
+}
+
+void QQuickOverlayPrivate::resizeBackground()
+{
+ Q_Q(QQuickOverlay);
+ background->setWidth(q->width());
+ background->setHeight(q->height());
+}
+
+QQuickOverlayPrivate::QQuickOverlayPrivate() :
+ background(Q_NULLPTR),
+ modalPopups(0)
+{
+}
+
QQuickOverlay::QQuickOverlay(QQuickItem *parent)
- : QQuickItem(parent), m_modalPanels(0)
+ : QQuickItem(*(new QQuickOverlayPrivate), parent)
{
setAcceptedMouseButtons(Qt::AllButtons);
setFiltersChildMouseEvents(true);
setVisible(false);
}
+
+QQuickItem *QQuickOverlay::background() const
+{
+ Q_D(const QQuickOverlay);
+ return d->background;
+}
+
+void QQuickOverlay::setBackground(QQuickItem *background)
+{
+ Q_D(QQuickOverlay);
+ if (d->background != background) {
+ delete d->background;
+ d->background = background;
+ if (background) {
+ background->setOpacity(0.0);
+ background->setParentItem(this);
+ if (qFuzzyIsNull(background->z()))
+ background->setZ(-1);
+ if (isComponentComplete())
+ d->resizeBackground();
+ }
+ emit backgroundChanged();
+ }
+}
+
void QQuickOverlay::itemChange(ItemChange change, const ItemChangeData &data)
{
+ Q_D(QQuickOverlay);
QQuickItem::itemChange(change, data);
- QQuickItem *panelItem = const_cast<QQuickItem *>(data.item);
- QQuickPanel *panel = Q_NULLPTR;
+ QQuickPopup *popup = Q_NULLPTR;
if (change == ItemChildAddedChange || change == ItemChildRemovedChange) {
- panel = qobject_cast<QQuickPanel *>(panelItem->parent());
+ QQuickDrawer *drawer = qobject_cast<QQuickDrawer *>(data.item);
+ if (drawer) {
+ if (change == ItemChildAddedChange) {
+ QObjectPrivate::connect(drawer, &QQuickDrawer::positionChanged, d, &QQuickOverlayPrivate::drawerPositionChange);
+ d->drawers.append(drawer);
+ } else {
+ QObjectPrivate::disconnect(drawer, &QQuickDrawer::positionChanged, d, &QQuickOverlayPrivate::drawerPositionChange);
+ d->drawers.removeOne(drawer);
+ }
+ } else {
+ popup = qobject_cast<QQuickPopup *>(data.item->parent());
+ }
setVisible(!childItems().isEmpty());
}
- if (!panel)
+ if (!popup)
return;
if (change == ItemChildAddedChange) {
- if (QQuickPanel *prevPanel = m_panels.value(panelItem)) {
- qmlInfo(panel).nospace() << "Panel is sharing item " << panelItem << " with " << prevPanel
+ if (QQuickPopup *prevPopup = d->popups.value(data.item)) {
+ qmlInfo(popup).nospace() << "Popup is sharing item " << data.item << " with " << prevPopup
<< ". This is not supported and strange things are about to happen.";
return;
}
- m_panels.insert(panelItem, panel);
- if (panel->isModal())
- ++m_modalPanels;
+ d->popups.insert(data.item, popup);
+ if (popup->isModal())
+ ++d->modalPopups;
- connect(this, &QQuickOverlay::pressed, panel, &QQuickPanel::pressedOutside);
- connect(this, &QQuickOverlay::released, panel, &QQuickPanel::releasedOutside);
+ connect(this, &QQuickOverlay::pressed, popup, &QQuickPopup::pressedOutside);
+ connect(this, &QQuickOverlay::released, popup, &QQuickPopup::releasedOutside);
+ QObjectPrivate::connect(popup, &QQuickPopup::aboutToShow, d, &QQuickOverlayPrivate::popupAboutToShow);
+ QObjectPrivate::connect(popup, &QQuickPopup::aboutToHide, d, &QQuickOverlayPrivate::popupAboutToHide);
} else if (change == ItemChildRemovedChange) {
- Q_ASSERT(panel == m_panels.value(panelItem));
+ Q_ASSERT(popup == d->popups.value(data.item));
- disconnect(this, &QQuickOverlay::pressed, panel, &QQuickPanel::pressedOutside);
- disconnect(this, &QQuickOverlay::released, panel, &QQuickPanel::releasedOutside);
+ disconnect(this, &QQuickOverlay::pressed, popup, &QQuickPopup::pressedOutside);
+ disconnect(this, &QQuickOverlay::released, popup, &QQuickPopup::releasedOutside);
+ QObjectPrivate::disconnect(popup, &QQuickPopup::aboutToShow, d, &QQuickOverlayPrivate::popupAboutToShow);
+ QObjectPrivate::disconnect(popup, &QQuickPopup::aboutToHide, d, &QQuickOverlayPrivate::popupAboutToHide);
- if (panel->isModal())
- --m_modalPanels;
- m_panels.remove(panelItem);
+ if (popup->isModal())
+ --d->modalPopups;
+ d->popups.remove(data.item);
}
}
+void QQuickOverlay::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
+{
+ Q_D(QQuickOverlay);
+ QQuickItem::geometryChanged(newGeometry, oldGeometry);
+ if (d->background)
+ d->resizeBackground();
+}
+
void QQuickOverlay::keyPressEvent(QKeyEvent *event)
{
- event->setAccepted(m_modalPanels > 0);
+ Q_D(QQuickOverlay);
+ event->setAccepted(d->modalPopups > 0);
}
void QQuickOverlay::keyReleaseEvent(QKeyEvent *event)
{
- event->setAccepted(m_modalPanels > 0);
+ Q_D(QQuickOverlay);
+ event->setAccepted(d->modalPopups > 0);
}
void QQuickOverlay::mousePressEvent(QMouseEvent *event)
{
- event->setAccepted(m_modalPanels > 0);
+ Q_D(QQuickOverlay);
+ event->setAccepted(d->modalPopups > 0);
emit pressed();
}
void QQuickOverlay::mouseMoveEvent(QMouseEvent *event)
{
- event->setAccepted(m_modalPanels > 0);
+ Q_D(QQuickOverlay);
+ event->setAccepted(d->modalPopups > 0);
}
void QQuickOverlay::mouseReleaseEvent(QMouseEvent *event)
{
- event->setAccepted(m_modalPanels > 0);
+ Q_D(QQuickOverlay);
+ event->setAccepted(d->modalPopups > 0);
emit released();
}
bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event)
{
- if (m_modalPanels == 0)
+ Q_D(QQuickOverlay);
+ if (d->modalPopups == 0)
return false;
// TODO Filter touch events
if (event->type() != QEvent::MouseButtonPress)
@@ -128,15 +255,15 @@ bool QQuickOverlay::childMouseEventFilter(QQuickItem *item, QEvent *event)
const QQuickItemPrivate *priv = QQuickItemPrivate::get(this);
const QList<QQuickItem *> &sortedChildren = priv->paintOrderChildItems();
for (int i = sortedChildren.count() - 1; i >= 0; --i) {
- QQuickItem *panelItem = sortedChildren[i];
- if (panelItem == item)
+ QQuickItem *contentItem = sortedChildren[i];
+ if (contentItem == item)
break;
- QQuickPanel *panel = m_panels.value(panelItem);
- if (panel) {
- emit panel->pressedOutside();
+ QQuickPopup *popup = d->popups.value(contentItem);
+ if (popup) {
+ emit popup->pressedOutside();
- if (!modalBlocked && panel->isModal())
+ if (!modalBlocked && popup->isModal())
modalBlocked = true;
}
}
diff --git a/src/templates/qquickoverlay_p.h b/src/templates/qquickoverlay_p.h
index c5f9b719..a48b54ed 100644
--- a/src/templates/qquickoverlay_p.h
+++ b/src/templates/qquickoverlay_p.h
@@ -49,24 +49,31 @@
//
#include <QtQuick/qquickitem.h>
+#include <QtLabsTemplates/private/qquickabstractbutton_p.h>
QT_BEGIN_NAMESPACE
-class QQuickPanel;
+class QQuickOverlayPrivate;
-class QQuickOverlay : public QQuickItem
+class Q_LABSTEMPLATES_EXPORT QQuickOverlay : public QQuickItem
{
Q_OBJECT
+ Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
public:
explicit QQuickOverlay(QQuickItem *parent = Q_NULLPTR);
+ QQuickItem *background() const;
+ void setBackground(QQuickItem *background);
+
Q_SIGNALS:
+ void backgroundChanged();
void pressed();
void released();
protected:
void itemChange(ItemChange change, const ItemChangeData &data) Q_DECL_OVERRIDE;
+ void geometryChanged(const QRectF &oldGeometry, const QRectF &newGeometry) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
@@ -77,10 +84,11 @@ protected:
private:
Q_DISABLE_COPY(QQuickOverlay)
- QHash<QQuickItem *, QQuickPanel *> m_panels;
- int m_modalPanels;
+ Q_DECLARE_PRIVATE(QQuickOverlay)
};
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickOverlay)
+
#endif // QQUICKOVERLAY_P_H
diff --git a/src/templates/qquickpageindicator_p.h b/src/templates/qquickpageindicator_p.h
index 46eb2cb2..487b4d6e 100644
--- a/src/templates/qquickpageindicator_p.h
+++ b/src/templates/qquickpageindicator_p.h
@@ -101,8 +101,8 @@ private:
Q_DECLARE_PRIVATE(QQuickPageIndicator)
};
-Q_DECLARE_TYPEINFO(QQuickPageIndicator, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickPageIndicator)
+
#endif // QQUICKPAGEINDICATOR_P_H
diff --git a/src/templates/qquickpane.cpp b/src/templates/qquickpane.cpp
new file mode 100644
index 00000000..27e76ea3
--- /dev/null
+++ b/src/templates/qquickpane.cpp
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Templates module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpane_p.h"
+#include "qquickpane_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \qmltype Pane
+ \inherits Control
+ \instantiates QQuickPane
+ \inqmlmodule Qt.labs.controls
+ \ingroup qtlabscontrols-containers
+ \brief A pane control.
+
+ Pane provides a background color that matches with the application style
+ and theme. Pane does not provide a layout of its own, but requires you to
+ position its contents, for instance by creating a \l RowLayout or a
+ \l ColumnLayout.
+
+ If only a single item is used within a Pane, it will resize to fit the
+ implicit size of its contained item. This makes it particularly suitable
+ for use together with layouts.
+
+ \image qtlabscontrols-pane.png
+
+ \snippet qtlabscontrols-pane.qml 1
+
+ \sa {Customizing Pane}, {Container Controls}
+*/
+
+QQuickPanePrivate::QQuickPanePrivate() : contentWidth(0), contentHeight(0)
+{
+}
+
+QQuickPane::QQuickPane(QQuickItem *parent) :
+ QQuickControl(*(new QQuickPanePrivate), parent)
+{
+ setFlag(QQuickItem::ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::AllButtons);
+}
+
+QQuickPane::QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent) :
+ QQuickControl(dd, parent)
+{
+ setFlag(QQuickItem::ItemIsFocusScope);
+ setAcceptedMouseButtons(Qt::AllButtons);
+}
+
+/*!
+ \qmlproperty real Qt.labs.controls::Pane::contentWidth
+
+ This property holds the content width. It is used for calculating the
+ total implicit width of the pane.
+
+ \note If only a single item is used within the pane, the implicit width
+ of its contained item is used as the content width.
+*/
+qreal QQuickPane::contentWidth() const
+{
+ Q_D(const QQuickPane);
+ return d->contentWidth;
+}
+
+void QQuickPane::setContentWidth(qreal width)
+{
+ Q_D(QQuickPane);
+ if (d->contentWidth != width) {
+ d->contentWidth = width;
+ emit contentWidthChanged();
+ }
+}
+
+/*!
+ \qmlproperty real Qt.labs.controls::Pane::contentHeight
+
+ This property holds the content height. It is used for calculating the
+ total implicit height of the pane.
+
+ \note If only a single item is used within the pane, the implicit height
+ of its contained item is used as the content height.
+*/
+qreal QQuickPane::contentHeight() const
+{
+ Q_D(const QQuickPane);
+ return d->contentHeight;
+}
+
+void QQuickPane::setContentHeight(qreal height)
+{
+ Q_D(QQuickPane);
+ if (d->contentHeight != height) {
+ d->contentHeight = height;
+ emit contentHeightChanged();
+ }
+}
+
+/*!
+ \qmlproperty list<Object> Qt.labs.controls::Pane::contentData
+ \default
+
+ This property holds the list of content data.
+
+ \sa Item::data
+*/
+QQmlListProperty<QObject> QQuickPane::contentData()
+{
+ Q_D(QQuickPane);
+ return QQmlListProperty<QObject>(d->contentItem, Q_NULLPTR,
+ QQuickItemPrivate::data_append,
+ QQuickItemPrivate::data_count,
+ QQuickItemPrivate::data_at,
+ QQuickItemPrivate::data_clear);
+}
+
+/*!
+ \qmlproperty list<Item> Qt.labs.controls::Pane::contentChildren
+
+ This property holds the list of content children.
+
+ \sa Item::children
+*/
+QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
+{
+ Q_D(QQuickPane);
+ return QQmlListProperty<QQuickItem>(d->contentItem, Q_NULLPTR,
+ QQuickItemPrivate::children_append,
+ QQuickItemPrivate::children_count,
+ QQuickItemPrivate::children_at,
+ QQuickItemPrivate::children_clear);
+}
+
+void QQuickPane::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
+{
+ QQuickControl::contentItemChange(newItem, oldItem);
+ if (oldItem)
+ disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
+ if (newItem)
+ connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
+ emit contentChildrenChanged();
+}
+
+#ifndef QT_NO_ACCESSIBILITY
+QAccessible::Role QQuickPane::accessibleRole() const
+{
+ return QAccessible::Pane;
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/templates/qquickpane_p.h b/src/templates/qquickpane_p.h
new file mode 100644
index 00000000..e599f55f
--- /dev/null
+++ b/src/templates/qquickpane_p.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Templates module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPANE_P_H
+#define QQUICKPANE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLabsTemplates/private/qquickcontrol_p.h>
+#include <QtQml/qqmllist.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPanePrivate;
+
+class Q_LABSTEMPLATES_EXPORT QQuickPane : public QQuickControl
+{
+ Q_OBJECT
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
+ Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_CLASSINFO("DefaultProperty", "contentData")
+
+public:
+ explicit QQuickPane(QQuickItem *parent = Q_NULLPTR);
+
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
+Q_SIGNALS:
+ void contentWidthChanged();
+ void contentHeightChanged();
+ void contentChildrenChanged();
+
+protected:
+ QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent);
+
+ void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) Q_DECL_OVERRIDE;
+
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::Role accessibleRole() const Q_DECL_OVERRIDE;
+#endif
+
+private:
+ Q_DISABLE_COPY(QQuickPane)
+ Q_DECLARE_PRIVATE(QQuickPane)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPane)
+
+#endif // QQUICKPANE_P_H
diff --git a/src/templates/qquickpane_p_p.h b/src/templates/qquickpane_p_p.h
new file mode 100644
index 00000000..477dc0bc
--- /dev/null
+++ b/src/templates/qquickpane_p_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Templates module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPANE_P_P_H
+#define QQUICKPANE_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtLabsTemplates/private/qquickcontrol_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickPane;
+
+class Q_LABSTEMPLATES_EXPORT QQuickPanePrivate : public QQuickControlPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPane)
+
+public:
+ QQuickPanePrivate();
+
+ qreal contentWidth;
+ qreal contentHeight;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPANE_P_P_H
diff --git a/src/templates/qquickpanel.cpp b/src/templates/qquickpopup.cpp
index 38f1a73c..2e826591 100644
--- a/src/templates/qquickpanel.cpp
+++ b/src/templates/qquickpopup.cpp
@@ -34,10 +34,11 @@
**
****************************************************************************/
-#include "qquickpanel_p.h"
-#include "qquickpanel_p_p.h"
+#include "qquickpopup_p.h"
+#include "qquickpopup_p_p.h"
#include "qquickapplicationwindow_p.h"
#include "qquickoverlay_p.h"
+
#include <QtQml/qqmlinfo.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/private/qquicktransition_p.h>
@@ -46,183 +47,178 @@
QT_BEGIN_NAMESPACE
/*!
- \qmltype Panel
+ \qmltype Popup
\inherits QtObject
- \instantiates QQuickPanel
+ \instantiates QQuickPopup
\inqmlmodule Qt.labs.controls
\ingroup qtlabscontrols-popups
- \brief A popup panel.
+ \brief A popup control.
- Panel is the base type of popup-like user interface controls.
+ Popup is the base type of popup-like user interface controls.
*/
-QQuickPanelPrivate::QQuickPanelPrivate()
+QQuickPopupPrivate::QQuickPopupPrivate()
: QObjectPrivate()
- , contentItem(Q_NULLPTR)
- , overlay(Q_NULLPTR)
, focus(false)
, modal(false)
- , showTransition(Q_NULLPTR)
- , hideTransition(Q_NULLPTR)
+ , contentItem(Q_NULLPTR)
+ , overlay(Q_NULLPTR)
+ , enter(Q_NULLPTR)
+ , exit(Q_NULLPTR)
, transitionManager(this)
-{ }
-
-QQuickPanelPrivate::~QQuickPanelPrivate()
-{ }
+{
+}
-void QQuickPanelPrivate::finalizeShowTransition()
+void QQuickPopupPrivate::finalizeEnterTransition()
{
if (focus)
contentItem->setFocus(true);
}
-void QQuickPanelPrivate::finalizeHideTransition()
+void QQuickPopupPrivate::finalizeExitTransition()
{
+ Q_Q(QQuickPopup);
overlay = Q_NULLPTR;
contentItem->setParentItem(Q_NULLPTR);
- emit q_func()->visibleChanged();
+ emit q->visibleChanged();
}
-QQuickPanelTransitionManager::QQuickPanelTransitionManager(QQuickPanelPrivate *priv)
+QQuickPopupTransitionManager::QQuickPopupTransitionManager(QQuickPopupPrivate *popup)
: QQuickTransitionManager()
, state(Off)
- , pp(priv)
-{ }
+ , popup(popup)
+{
+}
-void QQuickPanelTransitionManager::transitionShow()
+void QQuickPopupTransitionManager::transitionEnter()
{
- if (isRunning())
+ if (state == Enter && isRunning())
return;
QList<QQuickStateAction> actions;
- state = Show;
- transition(actions, pp->showTransition, pp->contentItem);
+ state = Enter;
+ transition(actions, popup->enter, popup->contentItem);
}
-void QQuickPanelTransitionManager::transitionHide()
+void QQuickPopupTransitionManager::transitionExit()
{
- if (isRunning())
+ if (state == Exit && isRunning())
return;
QList<QQuickStateAction> actions;
- state = Hide;
- transition(actions, pp->hideTransition, pp->contentItem);
+ state = Exit;
+ transition(actions, popup->exit, popup->contentItem);
}
-void QQuickPanelTransitionManager::finished()
+void QQuickPopupTransitionManager::finished()
{
- if (state == Show)
- pp->finalizeShowTransition();
- else if (state == Hide)
- pp->finalizeHideTransition();
+ if (state == Enter)
+ popup->finalizeEnterTransition();
+ else if (state == Exit)
+ popup->finalizeExitTransition();
state = Off;
}
-QQuickPanel::QQuickPanel(QObject *parent)
- : QObject(*(new QQuickPanelPrivate), parent)
+QQuickPopup::QQuickPopup(QObject *parent)
+ : QObject(*(new QQuickPopupPrivate), parent)
{
}
-QQuickPanel::QQuickPanel(QQuickPanelPrivate &dd, QObject *parent)
+QQuickPopup::QQuickPopup(QQuickPopupPrivate &dd, QObject *parent)
: QObject(dd, parent)
{
}
-QQuickPanel::~QQuickPanel()
-{
-}
-
/*!
- \qmlmethod void Qt.labs.controls::Panel::show()
+ \qmlmethod void Qt.labs.controls::Popup::open()
- Shows the panel.
+ Opens the popup.
*/
-void QQuickPanel::show()
+void QQuickPopup::open()
{
- Q_D(QQuickPanel);
+ Q_D(QQuickPopup);
if (!d->contentItem) {
- qmlInfo(this) << "no panel content to show.";
+ qmlInfo(this) << "no popup content to show.";
return;
}
if (d->overlay) {
// FIXME qmlInfo needs to know about QQuickWindow and/or QObject
- static_cast<QDebug>(qmlInfo(this) << "panel already showing in window") << d->overlay->window();
+ static_cast<QDebug>(qmlInfo(this) << "popup already open in window") << d->overlay->window();
return;
}
- QQuickWindow *win = Q_NULLPTR;
+ QQuickWindow *window = Q_NULLPTR;
QObject *p = parent();
- while (p && !win) {
+ while (p && !window) {
if (QQuickItem *item = qobject_cast<QQuickItem *>(p)) {
- win = item->window();
- if (!win)
+ window = item->window();
+ if (!window)
p = item->parentItem();
} else {
- win = qobject_cast<QQuickWindow *>(p);
- if (!win)
+ window = qobject_cast<QQuickWindow *>(p);
+ if (!window)
p = p->parent();
}
}
- if (!win) {
- qmlInfo(this) << "cannot find any window to show panel.";
+ if (!window) {
+ qmlInfo(this) << "cannot find any window to open popup in.";
return;
}
- if (QQuickApplicationWindow *appWin = qobject_cast<QQuickApplicationWindow*>(win)) {
- d->overlay = static_cast<QQuickOverlay *>(appWin->overlay());
- d->contentItem->setParentItem(d->overlay);
- } else {
- // FIXME Maybe try to show it somehow on that window
+ QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
+ if (!applicationWindow) {
+ // FIXME Maybe try to open it in that window somehow
qmlInfo(this) << "is not in an ApplicationWindow.";
return;
}
+ d->overlay = static_cast<QQuickOverlay *>(applicationWindow->overlay());
+ d->contentItem->setParentItem(d->overlay);
emit aboutToShow();
- d->transitionManager.transitionShow();
+ d->transitionManager.transitionEnter();
emit visibleChanged();
}
/*!
- \qmlmethod void Qt.labs.controls::Panel::hide()
+ \qmlmethod void Qt.labs.controls::Popup::close()
- Hides the panel.
+ Closes the popup.
*/
-void QQuickPanel::hide()
+void QQuickPopup::close()
{
- Q_D(QQuickPanel);
-
+ Q_D(QQuickPopup);
if (!d->overlay) {
- // TODO This could mean we showed the panel item on a plain QQuickWindow
- qmlInfo(this) << "trying to hide non-visible Panel.";
+ // TODO This could mean we opened the popup item in a plain QQuickWindow
+ qmlInfo(this) << "trying to close non-visible Popup.";
return;
}
d->contentItem->setFocus(false);
emit aboutToHide();
- d->transitionManager.transitionHide();
+ d->transitionManager.transitionExit();
}
/*!
- \qmlproperty Item Qt.labs.controls::Panel::contentItem
+ \qmlproperty Item Qt.labs.controls::Popup::contentItem
- This property holds the content item of the panel.
+ This property holds the content item of the popup.
- The content item is the visual implementation of the panel. When the
- panel is made visible, the content item is automatically reparented to
+ The content item is the visual implementation of the popup. When the
+ popup is made visible, the content item is automatically reparented to
the \l {ApplicationWindow::overlay}{overlay item} of its application
window.
*/
-QQuickItem *QQuickPanel::contentItem() const
+QQuickItem *QQuickPopup::contentItem() const
{
- Q_D(const QQuickPanel);
+ Q_D(const QQuickPopup);
return d->contentItem;
}
-void QQuickPanel::setContentItem(QQuickItem *item)
+void QQuickPopup::setContentItem(QQuickItem *item)
{
- Q_D(QQuickPanel);
+ Q_D(QQuickPopup);
if (d->overlay) {
// FIXME qmlInfo needs to know about QQuickItem and/or QObject
- static_cast<QDebug>(qmlInfo(this) << "cannot set content item") << item << "while Panel is visible.";
+ static_cast<QDebug>(qmlInfo(this) << "cannot set content item") << item << "while Popup is visible.";
return;
}
if (d->contentItem != item) {
@@ -235,19 +231,19 @@ void QQuickPanel::setContentItem(QQuickItem *item)
}
/*!
- \qmlproperty bool Qt.labs.controls::Panel::focus
+ \qmlproperty bool Qt.labs.controls::Popup::focus
- This property holds whether the panel has focus.
+ This property holds whether the popup has focus.
*/
-bool QQuickPanel::hasFocus() const
+bool QQuickPopup::hasFocus() const
{
- Q_D(const QQuickPanel);
+ Q_D(const QQuickPopup);
return d->focus;
}
-void QQuickPanel::setFocus(bool focus)
+void QQuickPopup::setFocus(bool focus)
{
- Q_D(QQuickPanel);
+ Q_D(QQuickPopup);
if (d->focus == focus)
return;
d->focus = focus;
@@ -255,19 +251,19 @@ void QQuickPanel::setFocus(bool focus)
}
/*!
- \qmlproperty bool Qt.labs.controls::Panel::modal
+ \qmlproperty bool Qt.labs.controls::Popup::modal
- This property holds whether the panel is modal.
+ This property holds whether the popup is modal.
*/
-bool QQuickPanel::isModal() const
+bool QQuickPopup::isModal() const
{
- Q_D(const QQuickPanel);
+ Q_D(const QQuickPopup);
return d->modal;
}
-void QQuickPanel::setModal(bool modal)
+void QQuickPopup::setModal(bool modal)
{
- Q_D(QQuickPanel);
+ Q_D(QQuickPopup);
if (d->modal == modal)
return;
d->modal = modal;
@@ -275,56 +271,58 @@ void QQuickPanel::setModal(bool modal)
}
/*!
- \qmlproperty bool Qt.labs.controls::Panel::visible
+ \qmlproperty bool Qt.labs.controls::Popup::visible
- This property holds whether the panel is visible.
+ This property holds whether the popup is visible.
*/
-bool QQuickPanel::isVisible() const
+bool QQuickPopup::isVisible() const
{
- Q_D(const QQuickPanel);
+ Q_D(const QQuickPopup);
return d->overlay != Q_NULLPTR /*&& !d->transitionManager.isRunning()*/;
}
/*!
- \qmlproperty Transition Qt.labs.controls::Panel::showTransition
+ \qmlproperty Transition Qt.labs.controls::Popup::enter
This property holds the transition that is applied to the content item
- when the panel is shown.
+ when the popup is opened and enters the screen.
*/
-QQuickTransition *QQuickPanel::showTransition() const
+QQuickTransition *QQuickPopup::enter() const
{
- return d_func()->showTransition;
+ Q_D(const QQuickPopup);
+ return d->enter;
}
-void QQuickPanel::setShowTransition(QQuickTransition *t)
+void QQuickPopup::setEnter(QQuickTransition *transition)
{
- Q_D(QQuickPanel);
- if (d->showTransition == t)
+ Q_D(QQuickPopup);
+ if (d->enter == transition)
return;
- d->showTransition = t;
- emit showTransitionChanged();
+ d->enter = transition;
+ emit enterChanged();
}
/*!
- \qmlproperty Transition Qt.labs.controls::Panel::hideTransition
+ \qmlproperty Transition Qt.labs.controls::Popup::exit
This property holds the transition that is applied to the content item
- when the panel is hidden.
+ when the popup is closed and exits the screen.
*/
-QQuickTransition *QQuickPanel::hideTransition() const
+QQuickTransition *QQuickPopup::exit() const
{
- return d_func()->hideTransition;
+ Q_D(const QQuickPopup);
+ return d->exit;
}
-void QQuickPanel::setHideTransition(QQuickTransition *t)
+void QQuickPopup::setExit(QQuickTransition *transition)
{
- Q_D(QQuickPanel);
- if (d->hideTransition == t)
+ Q_D(QQuickPopup);
+ if (d->exit == transition)
return;
- d->hideTransition = t;
- emit hideTransitionChanged();
+ d->exit = transition;
+ emit exitChanged();
}
QT_END_NAMESPACE
-#include "moc_qquickpanel_p.cpp"
+#include "moc_qquickpopup_p.cpp"
diff --git a/src/templates/qquickpanel_p.h b/src/templates/qquickpopup_p.h
index 6d6f4df9..630b7a4a 100644
--- a/src/templates/qquickpanel_p.h
+++ b/src/templates/qquickpopup_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKPANEL_P_H
-#define QQUICKPANEL_P_H
+#ifndef QQUICKPOPUP_P_H
+#define QQUICKPOPUP_P_H
//
// W A R N I N G
@@ -50,26 +50,26 @@
#include <QtCore/qobject.h>
#include <QtLabsTemplates/private/qtlabstemplatesglobal_p.h>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
class QQuickItem;
-class QQuickPanelPrivate;
+class QQuickPopupPrivate;
class QQuickTransition;
-class Q_LABSTEMPLATES_EXPORT QQuickPanel : public QObject
+class Q_LABSTEMPLATES_EXPORT QQuickPopup : public QObject
{
Q_OBJECT
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged)
Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged)
Q_PROPERTY(bool visible READ isVisible NOTIFY visibleChanged)
- Q_PROPERTY(QQuickTransition *showTransition READ showTransition WRITE setShowTransition NOTIFY showTransitionChanged FINAL)
- Q_PROPERTY(QQuickTransition *hideTransition READ showTransition WRITE setHideTransition NOTIFY hideTransitionChanged FINAL)
+ Q_PROPERTY(QQuickTransition *enter READ enter WRITE setEnter NOTIFY enterChanged FINAL)
+ Q_PROPERTY(QQuickTransition *exit READ exit WRITE setExit NOTIFY exitChanged FINAL)
public:
- explicit QQuickPanel(QObject *parent = Q_NULLPTR);
- ~QQuickPanel();
+ explicit QQuickPopup(QObject *parent = Q_NULLPTR);
QQuickItem *contentItem() const;
void setContentItem(QQuickItem *item);
@@ -82,19 +82,23 @@ public:
bool isVisible() const;
- QQuickTransition *showTransition() const;
- void setShowTransition(QQuickTransition *);
+ QQuickTransition *enter() const;
+ void setEnter(QQuickTransition *transition);
- QQuickTransition *hideTransition() const;
- void setHideTransition(QQuickTransition *);
+ QQuickTransition *exit() const;
+ void setExit(QQuickTransition *transition);
+
+public Q_SLOTS:
+ void open();
+ void close();
Q_SIGNALS:
void contentItemChanged();
void focusChanged();
void modalChanged();
void visibleChanged();
- void showTransitionChanged();
- void hideTransitionChanged();
+ void enterChanged();
+ void exitChanged();
void pressedOutside();
void releasedOutside();
@@ -103,19 +107,16 @@ Q_SIGNALS:
void aboutToShow();
void aboutToHide();
-
-public Q_SLOTS:
- void show();
- void hide();
-
protected:
- QQuickPanel(QQuickPanelPrivate &dd, QObject *parent);
+ QQuickPopup(QQuickPopupPrivate &dd, QObject *parent);
private:
- Q_DISABLE_COPY(QQuickPanel)
- Q_DECLARE_PRIVATE(QQuickPanel)
+ Q_DISABLE_COPY(QQuickPopup)
+ Q_DECLARE_PRIVATE(QQuickPopup)
};
QT_END_NAMESPACE
-#endif // QQUICKPANEL_P_H
+QML_DECLARE_TYPE(QQuickPopup)
+
+#endif // QQUICKPOPUP_P_H
diff --git a/src/templates/qquickpanel_p_p.h b/src/templates/qquickpopup_p_p.h
index 42c06cd9..b0c6d709 100644
--- a/src/templates/qquickpanel_p_p.h
+++ b/src/templates/qquickpopup_p_p.h
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKPANEL_P_P_H
-#define QQUICKPANEL_P_P_H
+#ifndef QQUICKPOPUP_P_P_H
+#define QQUICKPOPUP_P_P_H
//
// W A R N I N G
@@ -56,50 +56,50 @@ QT_BEGIN_NAMESPACE
class QQuickItem;
class QQuickTransition;
class QQuickTransitionManager;
-class QQuickPanel;
-class QQuickPanelPrivate;
+class QQuickPopup;
+class QQuickPopupPrivate;
class QQuickOverlay;
-class QQuickPanelTransitionManager : public QQuickTransitionManager
+class QQuickPopupTransitionManager : public QQuickTransitionManager
{
public:
- QQuickPanelTransitionManager(QQuickPanelPrivate *);
- void transitionShow();
- void transitionHide();
+ QQuickPopupTransitionManager(QQuickPopupPrivate *popup);
+
+ void transitionEnter();
+ void transitionExit();
protected:
void finished() Q_DECL_OVERRIDE;
private:
enum TransitionState {
- Off, Show, Hide
+ Off, Enter, Exit
};
TransitionState state;
- QQuickPanelPrivate *pp;
+ QQuickPopupPrivate *popup;
};
-class QQuickPanelPrivate : public QObjectPrivate
+class QQuickPopupPrivate : public QObjectPrivate
{
- Q_DECLARE_PUBLIC(QQuickPanel)
+ Q_DECLARE_PUBLIC(QQuickPopup)
public:
- QQuickPanelPrivate();
- ~QQuickPanelPrivate();
+ QQuickPopupPrivate();
- void finalizeShowTransition();
- void finalizeHideTransition();
+ void finalizeEnterTransition();
+ void finalizeExitTransition();
- QQuickItem *contentItem;
- QQuickOverlay *overlay;
bool focus;
bool modal;
- QQuickTransition *showTransition;
- QQuickTransition *hideTransition;
- QQuickPanelTransitionManager transitionManager;
+ QQuickItem *contentItem;
+ QQuickOverlay *overlay;
+ QQuickTransition *enter;
+ QQuickTransition *exit;
+ QQuickPopupTransitionManager transitionManager;
};
QT_END_NAMESPACE
-#endif // QQUICKPANEL_P_P_H
+#endif // QQUICKPOPUP_P_P_H
diff --git a/src/templates/qquickprogressbar.cpp b/src/templates/qquickprogressbar.cpp
index f1a4c00f..aa0789bc 100644
--- a/src/templates/qquickprogressbar.cpp
+++ b/src/templates/qquickprogressbar.cpp
@@ -251,7 +251,7 @@ void QQuickProgressBar::setIndicator(QQuickItem *indicator)
void QQuickProgressBar::mirrorChange()
{
QQuickControl::mirrorChange();
- if (!qFuzzyCompare(position(), 0.5))
+ if (!qFuzzyCompare(position(), qreal(0.5)))
emit visualPositionChanged();
}
diff --git a/src/templates/qquickprogressbar_p.h b/src/templates/qquickprogressbar_p.h
index f311e1c6..f94c718e 100644
--- a/src/templates/qquickprogressbar_p.h
+++ b/src/templates/qquickprogressbar_p.h
@@ -108,8 +108,8 @@ private:
Q_DECLARE_PRIVATE(QQuickProgressBar)
};
-Q_DECLARE_TYPEINFO(QQuickProgressBar, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickProgressBar)
+
#endif // QQUICKPROGRESSBAR_P_H
diff --git a/src/templates/qquickradiobutton_p.h b/src/templates/qquickradiobutton_p.h
index 1667de22..7d664864 100644
--- a/src/templates/qquickradiobutton_p.h
+++ b/src/templates/qquickradiobutton_p.h
@@ -67,8 +67,8 @@ protected:
#endif
};
-Q_DECLARE_TYPEINFO(QQuickRadioButton, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickRadioButton)
+
#endif // QQUICKRADIOBUTTON_P_H
diff --git a/src/templates/qquickrangeslider.cpp b/src/templates/qquickrangeslider.cpp
index 2d0806e2..70d5a03d 100644
--- a/src/templates/qquickrangeslider.cpp
+++ b/src/templates/qquickrangeslider.cpp
@@ -119,8 +119,8 @@ void QQuickRangeSliderNodePrivate::setPosition(qreal position, bool ignoreOtherP
{
Q_Q(QQuickRangeSliderNode);
- const qreal min = isFirst() || ignoreOtherPosition ? 0.0 : qMax(0.0, slider->first()->position());
- const qreal max = !isFirst() || ignoreOtherPosition ? 1.0 : qMin(1.0, slider->second()->position());
+ const qreal min = isFirst() || ignoreOtherPosition ? 0.0 : qMax<qreal>(0.0, slider->first()->position());
+ const qreal max = !isFirst() || ignoreOtherPosition ? 1.0 : qMin<qreal>(1.0, slider->second()->position());
position = qBound(min, position, max);
if (!qFuzzyCompare(this->position, position)) {
this->position = position;
diff --git a/src/templates/qquickrangeslider_p.h b/src/templates/qquickrangeslider_p.h
index 3bd46624..604666c8 100644
--- a/src/templates/qquickrangeslider_p.h
+++ b/src/templates/qquickrangeslider_p.h
@@ -129,8 +129,6 @@ private:
Q_DECLARE_PRIVATE(QQuickRangeSlider)
};
-Q_DECLARE_TYPEINFO(QQuickRangeSlider, Q_COMPLEX_TYPE);
-
class QQuickRangeSliderNodePrivate;
class Q_LABSTEMPLATES_EXPORT QQuickRangeSliderNode : public QObject
@@ -174,8 +172,8 @@ private:
Q_DECLARE_PRIVATE(QQuickRangeSliderNode)
};
-Q_DECLARE_TYPEINFO(QQuickRangeSliderNode, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickRangeSlider)
+
#endif // QQUICKRANGESLIDER_H
diff --git a/src/templates/qquickscrollbar.cpp b/src/templates/qquickscrollbar.cpp
index f6499004..23db7fcf 100644
--- a/src/templates/qquickscrollbar.cpp
+++ b/src/templates/qquickscrollbar.cpp
@@ -267,14 +267,14 @@ void QQuickScrollBar::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QQuickScrollBar);
QQuickControl::mouseMoveEvent(event);
- setPosition(qBound(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
+ setPosition(qBound<qreal>(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
}
void QQuickScrollBar::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QQuickScrollBar);
QQuickControl::mouseReleaseEvent(event);
- setPosition(qBound(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
+ setPosition(qBound<qreal>(0.0, positionAt(event->pos()) - d->offset, 1.0 - d->size));
d->offset = 0.0;
setPressed(false);
}
@@ -386,12 +386,11 @@ void QQuickScrollBarAttachedPrivate::itemGeometryChanged(QQuickItem *item, const
{
Q_UNUSED(item);
Q_UNUSED(newGeometry);
- Q_ASSERT(item == flickable);
- if (horizontal) {
+ if (horizontal && horizontal->height() > 0) {
bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
layoutHorizontal(move);
}
- if (vertical) {
+ if (vertical && vertical->width() > 0) {
bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
layoutVertical(move);
}
@@ -402,7 +401,16 @@ QQuickScrollBarAttached::QQuickScrollBarAttached(QQuickFlickable *flickable) :
{
Q_D(QQuickScrollBarAttached);
QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
- p->addItemChangeListener(d, QQuickItemPrivate::Geometry);
+ p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+}
+
+QQuickScrollBarAttached::~QQuickScrollBarAttached()
+{
+ Q_D(QQuickScrollBarAttached);
+ if (d->horizontal)
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ if (d->vertical)
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
}
/*!
@@ -428,6 +436,7 @@ void QQuickScrollBarAttached::setHorizontal(QQuickScrollBar *horizontal)
Q_D(QQuickScrollBarAttached);
if (d->horizontal != horizontal) {
if (d->horizontal) {
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
QObjectPrivate::disconnect(d->horizontal, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
@@ -444,6 +453,7 @@ void QQuickScrollBarAttached::setHorizontal(QQuickScrollBar *horizontal)
horizontal->setParentItem(d->flickable);
horizontal->setOrientation(Qt::Horizontal);
+ QQuickItemPrivate::get(horizontal)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
QObjectPrivate::connect(horizontal, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollHorizontal);
QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollBarAttachedPrivate::activateHorizontal);
@@ -483,6 +493,7 @@ void QQuickScrollBarAttached::setVertical(QQuickScrollBar *vertical)
Q_D(QQuickScrollBarAttached);
if (d->vertical != vertical) {
if (d->vertical) {
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
QObjectPrivate::disconnect(d->vertical, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
@@ -499,6 +510,7 @@ void QQuickScrollBarAttached::setVertical(QQuickScrollBar *vertical)
vertical->setParentItem(d->flickable);
vertical->setOrientation(Qt::Vertical);
+ QQuickItemPrivate::get(vertical)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
QObjectPrivate::connect(vertical, &QQuickScrollBar::positionChanged, d, &QQuickScrollBarAttachedPrivate::scrollVertical);
QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollBarAttachedPrivate::activateVertical);
diff --git a/src/templates/qquickscrollbar_p.h b/src/templates/qquickscrollbar_p.h
index 6171d26e..b944f92a 100644
--- a/src/templates/qquickscrollbar_p.h
+++ b/src/templates/qquickscrollbar_p.h
@@ -115,8 +115,6 @@ private:
Q_DECLARE_PRIVATE(QQuickScrollBar)
};
-Q_DECLARE_TYPEINFO(QQuickScrollBar, Q_COMPLEX_TYPE);
-
class QQuickScrollBarAttachedPrivate;
class Q_LABSTEMPLATES_EXPORT QQuickScrollBarAttached : public QObject
@@ -127,6 +125,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickScrollBarAttached : public QObject
public:
explicit QQuickScrollBarAttached(QQuickFlickable *flickable);
+ ~QQuickScrollBarAttached();
QQuickScrollBar *horizontal() const;
void setHorizontal(QQuickScrollBar *horizontal);
@@ -143,10 +142,9 @@ private:
Q_DECLARE_PRIVATE(QQuickScrollBarAttached)
};
-Q_DECLARE_TYPEINFO(QQuickScrollBarAttached, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickScrollBar)
QML_DECLARE_TYPEINFO(QQuickScrollBar, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKSCROLLBAR_P_H
diff --git a/src/templates/qquickscrollindicator.cpp b/src/templates/qquickscrollindicator.cpp
index 94b47e4d..b041e2ab 100644
--- a/src/templates/qquickscrollindicator.cpp
+++ b/src/templates/qquickscrollindicator.cpp
@@ -268,12 +268,11 @@ void QQuickScrollIndicatorAttachedPrivate::itemGeometryChanged(QQuickItem *item,
{
Q_UNUSED(item);
Q_UNUSED(newGeometry);
- Q_ASSERT(item == flickable);
- if (horizontal) {
+ if (horizontal && horizontal->height() > 0) {
bool move = qFuzzyIsNull(horizontal->y()) || qFuzzyCompare(horizontal->y(), oldGeometry.height() - horizontal->height());
layoutHorizontal(move);
}
- if (vertical) {
+ if (vertical && vertical->width() > 0) {
bool move = qFuzzyIsNull(vertical->x()) || qFuzzyCompare(vertical->x(), oldGeometry.width() - vertical->width());
layoutVertical(move);
}
@@ -284,7 +283,16 @@ QQuickScrollIndicatorAttached::QQuickScrollIndicatorAttached(QQuickFlickable *fl
{
Q_D(QQuickScrollIndicatorAttached);
QQuickItemPrivate *p = QQuickItemPrivate::get(flickable);
- p->addItemChangeListener(d, QQuickItemPrivate::Geometry);
+ p->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
+}
+
+QQuickScrollIndicatorAttached::~QQuickScrollIndicatorAttached()
+{
+ Q_D(QQuickScrollIndicatorAttached);
+ if (d->horizontal)
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
+ if (d->vertical)
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
}
/*!
@@ -310,6 +318,7 @@ void QQuickScrollIndicatorAttached::setHorizontal(QQuickScrollIndicator *horizon
Q_D(QQuickScrollIndicatorAttached);
if (d->horizontal != horizontal) {
if (d->horizontal) {
+ QQuickItemPrivate::get(d->horizontal)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
// TODO: export QQuickFlickableVisibleArea
@@ -325,6 +334,7 @@ void QQuickScrollIndicatorAttached::setHorizontal(QQuickScrollIndicator *horizon
horizontal->setParentItem(d->flickable);
horizontal->setOrientation(Qt::Horizontal);
+ QQuickItemPrivate::get(horizontal)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingHorizontallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateHorizontal);
// TODO: export QQuickFlickableVisibleArea
@@ -363,6 +373,7 @@ void QQuickScrollIndicatorAttached::setVertical(QQuickScrollIndicator *vertical)
Q_D(QQuickScrollIndicatorAttached);
if (d->vertical != vertical) {
if (d->vertical) {
+ QQuickItemPrivate::get(d->vertical)->removeItemChangeListener(d, QQuickItemPrivate::Geometry);
QObjectPrivate::disconnect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
// TODO: export QQuickFlickableVisibleArea
@@ -378,6 +389,7 @@ void QQuickScrollIndicatorAttached::setVertical(QQuickScrollIndicator *vertical)
vertical->setParentItem(d->flickable);
vertical->setOrientation(Qt::Vertical);
+ QQuickItemPrivate::get(vertical)->updateOrAddGeometryChangeListener(d, QQuickItemPrivate::SizeChange);
QObjectPrivate::connect(d->flickable, &QQuickFlickable::movingVerticallyChanged, d, &QQuickScrollIndicatorAttachedPrivate::activateVertical);
// TODO: export QQuickFlickableVisibleArea
diff --git a/src/templates/qquickscrollindicator_p.h b/src/templates/qquickscrollindicator_p.h
index e67118b4..1f5f07b7 100644
--- a/src/templates/qquickscrollindicator_p.h
+++ b/src/templates/qquickscrollindicator_p.h
@@ -103,8 +103,6 @@ private:
Q_DECLARE_PRIVATE(QQuickScrollIndicator)
};
-Q_DECLARE_TYPEINFO(QQuickScrollIndicator, Q_COMPLEX_TYPE);
-
class QQuickScrollIndicatorAttachedPrivate;
class Q_LABSTEMPLATES_EXPORT QQuickScrollIndicatorAttached : public QObject
@@ -115,6 +113,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickScrollIndicatorAttached : public QObject
public:
explicit QQuickScrollIndicatorAttached(QQuickFlickable *flickable);
+ ~QQuickScrollIndicatorAttached();
QQuickScrollIndicator *horizontal() const;
void setHorizontal(QQuickScrollIndicator *horizontal);
@@ -131,10 +130,9 @@ private:
Q_DECLARE_PRIVATE(QQuickScrollIndicatorAttached)
};
-Q_DECLARE_TYPEINFO(QQuickScrollIndicatorAttached, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickScrollIndicator)
QML_DECLARE_TYPEINFO(QQuickScrollIndicator, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKSCROLLINDICATOR_P_H
diff --git a/src/templates/qquickslider.cpp b/src/templates/qquickslider.cpp
index b77de9d3..bdb18ad9 100644
--- a/src/templates/qquickslider.cpp
+++ b/src/templates/qquickslider.cpp
@@ -138,7 +138,7 @@ qreal QQuickSliderPrivate::positionAt(const QPoint &point) const
void QQuickSliderPrivate::setPosition(qreal pos)
{
Q_Q(QQuickSlider);
- pos = qBound(0.0, pos, 1.0);
+ pos = qBound<qreal>(0.0, pos, 1.0);
if (!qFuzzyCompare(position, pos)) {
position = pos;
emit q->positionChanged();
diff --git a/src/templates/qquickslider_p.h b/src/templates/qquickslider_p.h
index 02d26538..663ad684 100644
--- a/src/templates/qquickslider_p.h
+++ b/src/templates/qquickslider_p.h
@@ -146,8 +146,8 @@ private:
Q_DECLARE_PRIVATE(QQuickSlider)
};
-Q_DECLARE_TYPEINFO(QQuickSlider, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickSlider)
+
#endif // QQUICKSLIDER_P_H
diff --git a/src/templates/qquickspinbox.cpp b/src/templates/qquickspinbox.cpp
index 9e0bd723..13770e46 100644
--- a/src/templates/qquickspinbox.cpp
+++ b/src/templates/qquickspinbox.cpp
@@ -113,7 +113,6 @@ public:
int repeatTimer;
QQuickSpinButton *up;
QQuickSpinButton *down;
- QLocale locale;
QValidator *validator;
QJSValue textFromValue;
QJSValue valueFromText;
@@ -170,19 +169,19 @@ void QQuickSpinBoxPrivate::stopPressRepeat()
}
}
-bool QQuickSpinBoxPrivate::handleMousePressEvent(QQuickItem *child, QMouseEvent *)
+bool QQuickSpinBoxPrivate::handleMousePressEvent(QQuickItem *child, QMouseEvent *event)
{
Q_Q(QQuickSpinBox);
QQuickItem *ui = up->indicator();
QQuickItem *di = down->indicator();
- up->setPressed(child == ui);
- down->setPressed(child == di);
+ up->setPressed(ui && ui->contains(ui->mapFromItem(child, event->pos())));
+ down->setPressed(di && di->contains(di->mapFromItem(child, event->pos())));
bool pressed = up->isPressed() || down->isPressed();
q->setAccessibleProperty("pressed", pressed);
if (pressed)
startRepeatDelay();
- return child == ui || child == di;
+ return up->isPressed() || down->isPressed();
}
bool QQuickSpinBoxPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *event)
@@ -190,13 +189,13 @@ bool QQuickSpinBoxPrivate::handleMouseMoveEvent(QQuickItem *child, QMouseEvent *
Q_Q(QQuickSpinBox);
QQuickItem *ui = up->indicator();
QQuickItem *di = down->indicator();
- up->setPressed(child == ui && ui->contains(event->pos()));
- down->setPressed(child == di && di->contains(event->pos()));
+ up->setPressed(ui && ui->contains(ui->mapFromItem(child, event->pos())));
+ down->setPressed(di && di->contains(di->mapFromItem(child, event->pos())));
bool pressed = up->isPressed() || down->isPressed();
q->setAccessibleProperty("pressed", pressed);
stopPressRepeat();
- return child == ui || child == di;
+ return up->isPressed() || down->isPressed();
}
bool QQuickSpinBoxPrivate::handleMouseReleaseEvent(QQuickItem *child, QMouseEvent *event)
@@ -204,32 +203,31 @@ bool QQuickSpinBoxPrivate::handleMouseReleaseEvent(QQuickItem *child, QMouseEven
Q_Q(QQuickSpinBox);
QQuickItem *ui = up->indicator();
QQuickItem *di = down->indicator();
- if (child == ui) {
+ bool wasPressed = up->isPressed() || down->isPressed();
+ if (up->isPressed()) {
up->setPressed(false);
- if (repeatTimer <= 0 && ui->contains(event->pos()))
+ if (repeatTimer <= 0 && ui && ui->contains(ui->mapFromItem(child, event->pos())))
q->increase();
- } else if (child == di) {
+ } else if (down->isPressed()) {
down->setPressed(false);
- if (repeatTimer <= 0 && di->contains(event->pos()))
+ if (repeatTimer <= 0 && di && di->contains(di->mapFromItem(child, event->pos())))
q->decrease();
}
q->setAccessibleProperty("pressed", false);
stopPressRepeat();
- return child == ui || child == di;
+ return wasPressed;
}
-bool QQuickSpinBoxPrivate::handleMouseUngrabEvent(QQuickItem *child)
+bool QQuickSpinBoxPrivate::handleMouseUngrabEvent(QQuickItem *)
{
Q_Q(QQuickSpinBox);
- QQuickItem *ui = up->indicator();
- QQuickItem *di = down->indicator();
up->setPressed(false);
down->setPressed(false);
q->setAccessibleProperty("pressed", false);
stopPressRepeat();
- return child == ui || child == di;
+ return false;
}
QQuickSpinBox::QQuickSpinBox(QQuickItem *parent) :
@@ -241,6 +239,7 @@ QQuickSpinBox::QQuickSpinBox(QQuickItem *parent) :
setFlag(ItemIsFocusScope);
setFiltersChildMouseEvents(true);
+ setAcceptedMouseButtons(Qt::LeftButton);
}
/*!
@@ -337,26 +336,6 @@ void QQuickSpinBox::setStepSize(int step)
}
/*!
- \qmlproperty Locale Qt.labs.controls::SpinBox::locale
-
- This property holds the locale that is used to format the value.
-*/
-QLocale QQuickSpinBox::locale() const
-{
- Q_D(const QQuickSpinBox);
- return d->locale;
-}
-
-void QQuickSpinBox::setLocale(const QLocale &locale)
-{
- Q_D(QQuickSpinBox);
- if (d->locale != locale) {
- d->locale = locale;
- emit localeChanged();
- }
-}
-
-/*!
\qmlproperty Validator Qt.labs.controls::SpinBox::validator
This property holds the input text validator. By default, SpinBox uses
@@ -364,7 +343,7 @@ void QQuickSpinBox::setLocale(const QLocale &locale)
\snippet SpinBox.qml validator
- \sa textFromValue, valueFromText, locale
+ \sa textFromValue, valueFromText, {Control::locale}{locale}
*/
QValidator *QQuickSpinBox::validator() const
{
@@ -398,7 +377,7 @@ void QQuickSpinBox::setValidator(QValidator *validator)
textFromValue: function(value, locale) { return Number(value).toLocaleString(locale, 'f', 0); }
\endcode
- \sa valueFromText, validator, locale
+ \sa valueFromText, validator, {Control::locale}{locale}
*/
QJSValue QQuickSpinBox::textFromValue() const
{
@@ -434,7 +413,7 @@ void QQuickSpinBox::setTextFromValue(const QJSValue &callback)
valueFromText: function(text, locale) { return Number.fromLocaleString(locale, text); }
\endcode
- \sa textFromValue, validator, locale
+ \sa textFromValue, validator, {Control::locale}{locale}
*/
QJSValue QQuickSpinBox::valueFromText() const
{
@@ -564,6 +543,34 @@ bool QQuickSpinBox::childMouseEventFilter(QQuickItem *child, QEvent *event)
}
}
+void QQuickSpinBox::mousePressEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mousePressEvent(event);
+ d->handleMousePressEvent(this, event);
+}
+
+void QQuickSpinBox::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mouseMoveEvent(event);
+ d->handleMouseMoveEvent(this, event);
+}
+
+void QQuickSpinBox::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mouseReleaseEvent(event);
+ d->handleMouseReleaseEvent(this, event);
+}
+
+void QQuickSpinBox::mouseUngrabEvent()
+{
+ Q_D(QQuickSpinBox);
+ QQuickControl::mouseUngrabEvent();
+ d->handleMouseUngrabEvent(this);
+}
+
void QQuickSpinBox::timerEvent(QTimerEvent *event)
{
Q_D(QQuickSpinBox);
diff --git a/src/templates/qquickspinbox_p.h b/src/templates/qquickspinbox_p.h
index 1ea7130d..0ad5e70d 100644
--- a/src/templates/qquickspinbox_p.h
+++ b/src/templates/qquickspinbox_p.h
@@ -65,7 +65,6 @@ class Q_LABSTEMPLATES_EXPORT QQuickSpinBox : public QQuickControl
Q_PROPERTY(int to READ to WRITE setTo NOTIFY toChanged FINAL)
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged FINAL)
Q_PROPERTY(int stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged FINAL)
- Q_PROPERTY(QLocale locale READ locale WRITE setLocale NOTIFY localeChanged FINAL)
Q_PROPERTY(QValidator *validator READ validator WRITE setValidator NOTIFY validatorChanged FINAL)
Q_PROPERTY(QJSValue textFromValue READ textFromValue WRITE setTextFromValue NOTIFY textFromValueChanged FINAL)
Q_PROPERTY(QJSValue valueFromText READ valueFromText WRITE setValueFromText NOTIFY valueFromTextChanged FINAL)
@@ -87,9 +86,6 @@ public:
int stepSize() const;
void setStepSize(int step);
- QLocale locale() const;
- void setLocale(const QLocale &locale);
-
QValidator *validator() const;
void setValidator(QValidator *validator);
@@ -111,7 +107,6 @@ Q_SIGNALS:
void toChanged();
void valueChanged();
void stepSizeChanged();
- void localeChanged();
void validatorChanged();
void textFromValueChanged();
void valueFromTextChanged();
@@ -120,6 +115,10 @@ protected:
bool childMouseEventFilter(QQuickItem *child, QEvent *event) Q_DECL_OVERRIDE;
void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
+ void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseUngrabEvent() Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE;
void componentComplete() Q_DECL_OVERRIDE;
@@ -159,9 +158,8 @@ private:
Q_DECLARE_PRIVATE(QQuickSpinButton)
};
-Q_DECLARE_TYPEINFO(QQuickSpinBox, Q_COMPLEX_TYPE);
-Q_DECLARE_TYPEINFO(QQuickSpinButton, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickSpinBox)
+
#endif // QQUICKSPINBOX_P_H
diff --git a/src/templates/qquickstackview.cpp b/src/templates/qquickstackview.cpp
index 2dcae1a1..e127d79f 100644
--- a/src/templates/qquickstackview.cpp
+++ b/src/templates/qquickstackview.cpp
@@ -198,7 +198,7 @@ QT_BEGIN_NAMESPACE
You can also get to an item in the stack using \l {get()}{get(index)}.
\badcode
- previousItem = stackView.get(myItem.Stack.index - 1));
+ previousItem = stackView.get(myItem.StackView.index - 1));
\endcode
\section1 Transitions
@@ -636,7 +636,7 @@ void QQuickStackView::replace(QQmlV4Function *args)
if (!d->elements.isEmpty())
exit = d->elements.pop();
- if (d->replaceElements(target, elements)) {
+ if (exit != target ? d->replaceElements(target, elements) : d->pushElements(elements)) {
if (depth != d->elements.count())
emit depthChanged();
QQuickStackElement *enter = d->elements.top();
@@ -870,15 +870,10 @@ void QQuickStackView::geometryChanged(const QRectF &newGeometry, const QRectF &o
Q_D(QQuickStackView);
foreach (QQuickStackElement *element, d->elements) {
if (element->item) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(element->item);
- if (!p->widthValid) {
+ if (!element->widthValid)
element->item->setWidth(newGeometry.width());
- p->widthValid = false;
- }
- if (!p->heightValid) {
+ if (!element->heightValid)
element->item->setHeight(newGeometry.height());
- p->heightValid = false;
- }
}
}
}
diff --git a/src/templates/qquickstackview_p.cpp b/src/templates/qquickstackview_p.cpp
index 1a08d349..06c605d2 100644
--- a/src/templates/qquickstackview_p.cpp
+++ b/src/templates/qquickstackview_p.cpp
@@ -69,7 +69,7 @@ private:
};
QQuickStackElement::QQuickStackElement() : QQuickItemViewTransitionableItem(Q_NULLPTR),
- index(-1), init(false), removal(false), ownItem(false), ownComponent(false),
+ index(-1), init(false), removal(false), ownItem(false), ownComponent(false), widthValid(false), heightValid(false),
context(Q_NULLPTR), component(Q_NULLPTR), incubator(Q_NULLPTR), view(Q_NULLPTR),
status(QQuickStackView::Inactive)
{
@@ -139,16 +139,21 @@ bool QQuickStackElement::load(QQuickStackView *parent)
delete incubator;
incubator = new QQuickStackIncubator(this);
component->create(*incubator, context);
+ if (component->isError())
+ qWarning() << qPrintable(component->errorString().trimmed());
+ } else {
+ initialize();
}
- initialize();
return item;
}
void QQuickStackElement::incubate(QObject *object)
{
item = qmlobject_cast<QQuickItem *>(object);
- if (item)
+ if (item) {
QQmlEngine::setObjectOwnership(item, QQmlEngine::CppOwnership);
+ initialize();
+ }
}
void QQuickStackElement::initialize()
@@ -157,14 +162,10 @@ void QQuickStackElement::initialize()
return;
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
+ if (!(widthValid = p->widthValid))
item->setWidth(view->width());
- p->widthValid = false;
- }
- if (!p->heightValid) {
+ if (!(heightValid = p->heightValid))
item->setHeight(view->height());
- p->heightValid = false;
- }
item->setParentItem(view);
p->addItemChangeListener(this, QQuickItemPrivate::Destroyed);
@@ -405,13 +406,13 @@ void QQuickStackViewPrivate::popTransition(QQuickStackElement *enter, QQuickStac
}
if (exit) {
- if (immediate || !exit->prepareTransition(transitioner, viewBounds))
+ if (immediate || !exit->item || !exit->prepareTransition(transitioner, viewBounds))
completeTransition(exit, transitioner->removeTransition);
else
exit->startTransition(transitioner);
}
if (enter) {
- if (immediate || !enter->prepareTransition(transitioner, QRectF()))
+ if (immediate || !enter->item || !enter->prepareTransition(transitioner, QRectF()))
completeTransition(enter, transitioner->removeDisplacedTransition);
else
enter->startTransition(transitioner);
@@ -437,13 +438,13 @@ void QQuickStackViewPrivate::pushTransition(QQuickStackElement *enter, QQuickSta
}
if (enter) {
- if (immediate || !enter->prepareTransition(transitioner, viewBounds))
+ if (immediate || !enter->item || !enter->prepareTransition(transitioner, viewBounds))
completeTransition(enter, transitioner->addTransition);
else
enter->startTransition(transitioner);
}
if (exit) {
- if (immediate || !exit->prepareTransition(transitioner, QRectF()))
+ if (immediate || !exit->item || !exit->prepareTransition(transitioner, QRectF()))
completeTransition(exit, transitioner->addDisplacedTransition);
else
exit->startTransition(transitioner);
@@ -470,13 +471,13 @@ void QQuickStackViewPrivate::replaceTransition(QQuickStackElement *enter, QQuick
}
if (exit) {
- if (immediate || !exit->prepareTransition(transitioner, QRectF()))
+ if (immediate || !exit->item || !exit->prepareTransition(transitioner, QRectF()))
completeTransition(exit, transitioner->moveDisplacedTransition);
else
exit->startTransition(transitioner);
}
if (enter) {
- if (immediate || !enter->prepareTransition(transitioner, viewBounds))
+ if (immediate || !enter->item || !enter->prepareTransition(transitioner, viewBounds))
completeTransition(enter, transitioner->moveTransition);
else
enter->startTransition(transitioner);
diff --git a/src/templates/qquickstackview_p.h b/src/templates/qquickstackview_p.h
index be73ea85..6b78b50a 100644
--- a/src/templates/qquickstackview_p.h
+++ b/src/templates/qquickstackview_p.h
@@ -154,8 +154,6 @@ private:
Q_DECLARE_PRIVATE(QQuickStackView)
};
-Q_DECLARE_TYPEINFO(QQuickStackView, Q_COMPLEX_TYPE);
-
class QQuickStackAttachedPrivate;
class Q_LABSTEMPLATES_EXPORT QQuickStackAttached : public QObject
@@ -183,11 +181,9 @@ private:
Q_DECLARE_PRIVATE(QQuickStackAttached)
};
-Q_DECLARE_TYPEINFO(QQuickStackAttached, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
-QML_DECLARE_TYPEINFO(QQuickStackView, QML_HAS_ATTACHED_PROPERTIES)
QML_DECLARE_TYPE(QQuickStackView)
+QML_DECLARE_TYPEINFO(QQuickStackView, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKSTACKVIEW_P_H
diff --git a/src/templates/qquickstackview_p_p.h b/src/templates/qquickstackview_p_p.h
index 94919939..d14c6326 100644
--- a/src/templates/qquickstackview_p_p.h
+++ b/src/templates/qquickstackview_p_p.h
@@ -89,6 +89,8 @@ public:
bool removal;
bool ownItem;
bool ownComponent;
+ bool widthValid;
+ bool heightValid;
QQmlContext *context;
QQmlComponent *component;
QQmlIncubator *incubator;
@@ -98,8 +100,6 @@ public:
QV4::PersistentValue properties;
};
-Q_DECLARE_TYPEINFO(QQuickStackElement, Q_COMPLEX_TYPE);
-
class QQuickStackViewPrivate : public QQuickControlPrivate, public QQuickItemViewTransitionChangeListener
{
Q_DECLARE_PUBLIC(QQuickStackView)
@@ -157,8 +157,6 @@ public:
QQuickStackElement *element;
};
-Q_DECLARE_TYPEINFO(QQuickStackViewPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKSTACKVIEW_P_P_H
diff --git a/src/templates/qquickswipeview_p.h b/src/templates/qquickswipeview_p.h
index a40c831e..bf733c7b 100644
--- a/src/templates/qquickswipeview_p.h
+++ b/src/templates/qquickswipeview_p.h
@@ -100,10 +100,9 @@ private:
Q_DECLARE_PRIVATE(QQuickSwipeViewAttached)
};
-Q_DECLARE_TYPEINFO(QQuickSwipeView, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickSwipeView)
QML_DECLARE_TYPEINFO(QQuickSwipeView, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKSWIPEVIEW_P_H
diff --git a/src/templates/qquickswitch.cpp b/src/templates/qquickswitch.cpp
index 241deed9..a867ec70 100644
--- a/src/templates/qquickswitch.cpp
+++ b/src/templates/qquickswitch.cpp
@@ -185,7 +185,7 @@ qreal QQuickSwitch::position() const
void QQuickSwitch::setPosition(qreal position)
{
Q_D(QQuickSwitch);
- position = qBound(0.0, position, 1.0);
+ position = qBound<qreal>(0.0, position, 1.0);
if (d->position != position) {
d->position = position;
emit positionChanged();
diff --git a/src/templates/qquickswitch_p.h b/src/templates/qquickswitch_p.h
index 2670c863..94d0d601 100644
--- a/src/templates/qquickswitch_p.h
+++ b/src/templates/qquickswitch_p.h
@@ -83,8 +83,8 @@ private:
Q_DECLARE_PRIVATE(QQuickSwitch)
};
-Q_DECLARE_TYPEINFO(QQuickSwitch, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickSwitch)
+
#endif // QQUICKSWITCH_P_H
diff --git a/src/templates/qquicktabbar_p.h b/src/templates/qquicktabbar_p.h
index a1f4ff54..7d6f674c 100644
--- a/src/templates/qquicktabbar_p.h
+++ b/src/templates/qquicktabbar_p.h
@@ -78,8 +78,8 @@ private:
Q_DECLARE_PRIVATE(QQuickTabBar)
};
-Q_DECLARE_TYPEINFO(QQuickTabBar, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickTabBar)
+
#endif // QQUICKTABBAR_P_H
diff --git a/src/templates/qquicktabbutton.cpp b/src/templates/qquicktabbutton.cpp
index 07dc533c..00d4d8b4 100644
--- a/src/templates/qquicktabbutton.cpp
+++ b/src/templates/qquicktabbutton.cpp
@@ -67,7 +67,7 @@ QQuickTabButton::QQuickTabButton(QQuickItem *parent) :
QFont QQuickTabButton::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::DockWidgetTitleFont); // tmp
+ return QQuickControlPrivate::themeFont(QPlatformTheme::TabButtonFont);
}
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/templates/qquicktabbutton_p.h b/src/templates/qquicktabbutton_p.h
index 0170a2b0..c02a206f 100644
--- a/src/templates/qquicktabbutton_p.h
+++ b/src/templates/qquicktabbutton_p.h
@@ -67,8 +67,8 @@ protected:
#endif
};
-Q_DECLARE_TYPEINFO(QQuickTabButton, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickTabButton)
+
#endif // QQUICKTABBUTTON_P_H
diff --git a/src/templates/qquicktextarea.cpp b/src/templates/qquicktextarea.cpp
index c78da815..fbc14573 100644
--- a/src/templates/qquicktextarea.cpp
+++ b/src/templates/qquicktextarea.cpp
@@ -70,8 +70,16 @@ QT_BEGIN_NAMESPACE
\sa TextField, {Customizing TextArea}, {Input Controls}
*/
+/*!
+ \qmlsignal Qt.labs.controls::TextArea::pressAndHold(MouseEvent mouse)
+
+ This signal is emitted when there is a long press (the delay depends on the platform plugin).
+ The \l {MouseEvent}{mouse} parameter provides information about the press, including the x and y
+ position of the press, and which button is pressed.
+*/
+
QQuickTextAreaPrivate::QQuickTextAreaPrivate()
- : background(Q_NULLPTR), accessibleAttached(Q_NULLPTR)
+ : background(Q_NULLPTR), focusReason(Qt::OtherFocusReason), accessibleAttached(Q_NULLPTR)
{
#ifndef QT_NO_ACCESSIBILITY
QAccessible::installActivationObserver(this);
@@ -277,6 +285,40 @@ void QQuickTextArea::setPlaceholderText(const QString &text)
}
}
+/*!
+ \qmlproperty enumeration Qt.labs.controls::TextArea::focusReason
+
+ This property holds the reason of the last focus change.
+
+ \note This property does not indicate whether the control has \l {Item::activeFocus}
+ {active focus}, but the reason why the control either gained or lost focus.
+
+ \value Qt.MouseFocusReason A mouse action occurred.
+ \value Qt.TabFocusReason The Tab key was pressed.
+ \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
+ \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
+ \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
+ \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
+ \value Qt.MenuBarFocusReason The menu bar took focus.
+ \value Qt.OtherFocusReason Another reason, usually application-specific.
+
+ \sa Item::activeFocus
+*/
+Qt::FocusReason QQuickTextArea::focusReason() const
+{
+ Q_D(const QQuickTextArea);
+ return d->focusReason;
+}
+
+void QQuickTextArea::setFocusReason(Qt::FocusReason reason)
+{
+ Q_D(QQuickTextArea);
+ if (d->focusReason != reason) {
+ d->focusReason = reason;
+ emit focusReasonChanged();
+ }
+}
+
void QQuickTextArea::classBegin()
{
Q_D(QQuickTextArea);
@@ -315,6 +357,18 @@ QSGNode *QQuickTextArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
return clipNode;
}
+void QQuickTextArea::focusInEvent(QFocusEvent *event)
+{
+ QQuickTextEdit::focusInEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickTextArea::focusOutEvent(QFocusEvent *event)
+{
+ QQuickTextEdit::focusOutEvent(event);
+ setFocusReason(event->reason());
+}
+
void QQuickTextArea::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickTextArea);
diff --git a/src/templates/qquicktextarea_p.h b/src/templates/qquicktextarea_p.h
index d8326f66..acf67359 100644
--- a/src/templates/qquicktextarea_p.h
+++ b/src/templates/qquicktextarea_p.h
@@ -65,6 +65,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickTextArea : public QQuickTextEdit
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
+ Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
public:
explicit QQuickTextArea(QQuickItem *parent = Q_NULLPTR);
@@ -79,12 +80,16 @@ public:
QString placeholderText() const;
void setPlaceholderText(const QString &text);
+ Qt::FocusReason focusReason() const;
+ void setFocusReason(Qt::FocusReason reason);
+
Q_SIGNALS:
void fontChanged();
void implicitWidthChanged();
void implicitHeightChanged();
void backgroundChanged();
void placeholderTextChanged();
+ void focusReasonChanged();
void pressAndHold(QQuickMouseEvent *event);
protected:
@@ -93,6 +98,9 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
+
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
@@ -103,8 +111,8 @@ private:
Q_DECLARE_PRIVATE(QQuickTextArea)
};
-Q_DECLARE_TYPEINFO(QQuickTextArea, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickTextArea)
+
#endif // QQUICKTEXTAREA_P_H
diff --git a/src/templates/qquicktextarea_p_p.h b/src/templates/qquicktextarea_p_p.h
index 2960f7bf..2a16e5cc 100644
--- a/src/templates/qquicktextarea_p_p.h
+++ b/src/templates/qquicktextarea_p_p.h
@@ -93,12 +93,11 @@ public:
QQuickItem *background;
QString placeholder;
+ Qt::FocusReason focusReason;
QQuickPressAndHoldHelper pressAndHoldHelper;
QQuickAccessibleAttached *accessibleAttached;
};
-Q_DECLARE_TYPEINFO(QQuickTextAreaPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKTEXTAREA_P_P_H
diff --git a/src/templates/qquicktextfield.cpp b/src/templates/qquicktextfield.cpp
index 50d49c11..ec8c24ab 100644
--- a/src/templates/qquicktextfield.cpp
+++ b/src/templates/qquicktextfield.cpp
@@ -90,6 +90,7 @@ QT_BEGIN_NAMESPACE
QQuickTextFieldPrivate::QQuickTextFieldPrivate()
: background(Q_NULLPTR)
+ , focusReason(Qt::OtherFocusReason)
, accessibleAttached(Q_NULLPTR)
{
#ifndef QT_NO_ACCESSIBILITY
@@ -309,6 +310,40 @@ void QQuickTextField::setPlaceholderText(const QString &text)
}
}
+/*!
+ \qmlproperty enumeration Qt.labs.controls::TextField::focusReason
+
+ This property holds the reason of the last focus change.
+
+ \note This property does not indicate whether the control has \l {Item::activeFocus}
+ {active focus}, but the reason why the control either gained or lost focus.
+
+ \value Qt.MouseFocusReason A mouse action occurred.
+ \value Qt.TabFocusReason The Tab key was pressed.
+ \value Qt.BacktabFocusReason A Backtab occurred. The input for this may include the Shift or Control keys; e.g. Shift+Tab.
+ \value Qt.ActiveWindowFocusReason The window system made this window either active or inactive.
+ \value Qt.PopupFocusReason The application opened/closed a pop-up that grabbed/released the keyboard focus.
+ \value Qt.ShortcutFocusReason The user typed a label's buddy shortcut
+ \value Qt.MenuBarFocusReason The menu bar took focus.
+ \value Qt.OtherFocusReason Another reason, usually application-specific.
+
+ \sa Item::activeFocus
+*/
+Qt::FocusReason QQuickTextField::focusReason() const
+{
+ Q_D(const QQuickTextField);
+ return d->focusReason;
+}
+
+void QQuickTextField::setFocusReason(Qt::FocusReason reason)
+{
+ Q_D(QQuickTextField);
+ if (d->focusReason != reason) {
+ d->focusReason = reason;
+ emit focusReasonChanged();
+ }
+}
+
void QQuickTextField::classBegin()
{
Q_D(QQuickTextField);
@@ -347,6 +382,18 @@ QSGNode *QQuickTextField::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
return clipNode;
}
+void QQuickTextField::focusInEvent(QFocusEvent *event)
+{
+ QQuickTextInput::focusInEvent(event);
+ setFocusReason(event->reason());
+}
+
+void QQuickTextField::focusOutEvent(QFocusEvent *event)
+{
+ QQuickTextInput::focusOutEvent(event);
+ setFocusReason(event->reason());
+}
+
void QQuickTextField::mousePressEvent(QMouseEvent *event)
{
Q_D(QQuickTextField);
diff --git a/src/templates/qquicktextfield_p.h b/src/templates/qquicktextfield_p.h
index d8b20225..23658cc6 100644
--- a/src/templates/qquicktextfield_p.h
+++ b/src/templates/qquicktextfield_p.h
@@ -65,6 +65,7 @@ class Q_LABSTEMPLATES_EXPORT QQuickTextField : public QQuickTextInput
Q_PROPERTY(qreal implicitHeight READ implicitHeight WRITE setImplicitHeight NOTIFY implicitHeightChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText NOTIFY placeholderTextChanged FINAL)
+ Q_PROPERTY(Qt::FocusReason focusReason READ focusReason WRITE setFocusReason NOTIFY focusReasonChanged FINAL)
public:
explicit QQuickTextField(QQuickItem *parent = Q_NULLPTR);
@@ -79,12 +80,16 @@ public:
QString placeholderText() const;
void setPlaceholderText(const QString &text);
+ Qt::FocusReason focusReason() const;
+ void setFocusReason(Qt::FocusReason reason);
+
Q_SIGNALS:
void fontChanged();
void implicitWidthChanged();
void implicitHeightChanged();
void backgroundChanged();
void placeholderTextChanged();
+ void focusReasonChanged();
void pressAndHold(QQuickMouseEvent *mouse);
protected:
@@ -93,6 +98,9 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) Q_DECL_OVERRIDE;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE;
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) Q_DECL_OVERRIDE;
+
+ void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
+ void focusOutEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
@@ -103,8 +111,8 @@ private:
Q_DECLARE_PRIVATE(QQuickTextField)
};
-Q_DECLARE_TYPEINFO(QQuickTextField, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickTextField)
+
#endif // QQUICKTEXTFIELD_P_H
diff --git a/src/templates/qquicktextfield_p_p.h b/src/templates/qquicktextfield_p_p.h
index 459e0847..29b01f15 100644
--- a/src/templates/qquicktextfield_p_p.h
+++ b/src/templates/qquicktextfield_p_p.h
@@ -94,12 +94,11 @@ public:
QQuickItem *background;
QString placeholder;
+ Qt::FocusReason focusReason;
QQuickPressAndHoldHelper pressAndHoldHelper;
QQuickAccessibleAttached *accessibleAttached;
};
-Q_DECLARE_TYPEINFO(QQuickTextFieldPrivate, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
#endif // QQUICKTEXTFIELD_P_P_H
diff --git a/src/templates/qquicktoolbar_p.h b/src/templates/qquicktoolbar_p.h
index 065f1f71..501f74c7 100644
--- a/src/templates/qquicktoolbar_p.h
+++ b/src/templates/qquicktoolbar_p.h
@@ -65,8 +65,8 @@ protected:
#endif
};
-Q_DECLARE_TYPEINFO(QQuickToolBar, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickToolBar)
+
#endif // QQUICKTOOLBAR_P_H
diff --git a/src/templates/qquicktoolbutton_p.h b/src/templates/qquicktoolbutton_p.h
index d3bb4fe7..25f2134d 100644
--- a/src/templates/qquicktoolbutton_p.h
+++ b/src/templates/qquicktoolbutton_p.h
@@ -63,8 +63,8 @@ protected:
QFont defaultFont() const Q_DECL_OVERRIDE;
};
-Q_DECLARE_TYPEINFO(QQuickToolButton, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickToolButton)
+
#endif // QQUICKTOOLBUTTON_P_H
diff --git a/src/templates/qquicktumbler_p.h b/src/templates/qquicktumbler_p.h
index 079cdbb3..ad57acbb 100644
--- a/src/templates/qquicktumbler_p.h
+++ b/src/templates/qquicktumbler_p.h
@@ -110,8 +110,6 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_updateItemHeights())
};
-Q_DECLARE_TYPEINFO(QQuickTumbler, Q_COMPLEX_TYPE);
-
class QQuickTumblerAttachedPrivate;
class Q_LABSTEMPLATES_EXPORT QQuickTumblerAttached : public QObject
@@ -137,10 +135,9 @@ private:
Q_PRIVATE_SLOT(d_func(), void _q_calculateDisplacement())
};
-Q_DECLARE_TYPEINFO(QQuickTumblerAttached, Q_COMPLEX_TYPE);
-
QT_END_NAMESPACE
+QML_DECLARE_TYPE(QQuickTumbler)
QML_DECLARE_TYPEINFO(QQuickTumbler, QML_HAS_ATTACHED_PROPERTIES)
#endif // QQUICKTUMBLER_H
diff --git a/src/templates/templates.pri b/src/templates/templates.pri
index 22fad255..1ae46e85 100644
--- a/src/templates/templates.pri
+++ b/src/templates/templates.pri
@@ -8,6 +8,7 @@ HEADERS += \
$$PWD/qquickbutton_p.h \
$$PWD/qquickbuttongroup_p.h \
$$PWD/qquickcheckbox_p.h \
+ $$PWD/qquickcombobox_p.h \
$$PWD/qquickcontainer_p.h \
$$PWD/qquickcontainer_p_p.h \
$$PWD/qquickcontrol_p.h \
@@ -25,8 +26,10 @@ HEADERS += \
$$PWD/qquickmenuitem_p.h \
$$PWD/qquickoverlay_p.h \
$$PWD/qquickpageindicator_p.h \
- $$PWD/qquickpanel_p.h \
- $$PWD/qquickpanel_p_p.h \
+ $$PWD/qquickpane_p.h \
+ $$PWD/qquickpane_p_p.h \
+ $$PWD/qquickpopup_p.h \
+ $$PWD/qquickpopup_p_p.h \
$$PWD/qquickpressandholdhelper_p.h \
$$PWD/qquickprogressbar_p.h \
$$PWD/qquickradiobutton_p.h \
@@ -56,6 +59,7 @@ SOURCES += \
$$PWD/qquickbutton.cpp \
$$PWD/qquickbuttongroup.cpp \
$$PWD/qquickcheckbox.cpp \
+ $$PWD/qquickcombobox.cpp \
$$PWD/qquickcontainer.cpp \
$$PWD/qquickcontrol.cpp \
$$PWD/qquickdial.cpp \
@@ -68,7 +72,8 @@ SOURCES += \
$$PWD/qquickmenuitem.cpp \
$$PWD/qquickoverlay.cpp \
$$PWD/qquickpageindicator.cpp \
- $$PWD/qquickpanel.cpp \
+ $$PWD/qquickpane.cpp \
+ $$PWD/qquickpopup.cpp \
$$PWD/qquickpressandholdhelper.cpp \
$$PWD/qquickprogressbar.cpp \
$$PWD/qquickradiobutton.cpp \
diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp
index 866d3b13..16a138b5 100644
--- a/tests/auto/accessibility/tst_accessibility.cpp
+++ b/tests/auto/accessibility/tst_accessibility.cpp
@@ -118,7 +118,7 @@ void tst_accessibility::a11y()
#endif
component.loadUrl(testFileUrl(fn + ".qml"));
QObject* created = component.create();
- QVERIFY(created);
+ QVERIFY2(created, qPrintable(component.errorString()));
QScopedPointer<QObject> cleanup(created);
QVERIFY(!cleanup.isNull());
diff --git a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml
index cf107373..08ecdda2 100644
--- a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml
+++ b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml
@@ -39,7 +39,6 @@
****************************************************************************/
import QtQuick 2.5
-import QtQuick.Layouts 1.2
import Qt.labs.controls 1.0
Item {
@@ -76,7 +75,7 @@ Item {
id: groupbox1
objectName: "groupbox1"
title: "grouppox1"
- ColumnLayout {
+ Column {
anchors.fill: parent
CheckBox {
id: checkbox1
@@ -113,7 +112,7 @@ Item {
id: groupbox2
objectName: "groupbox2"
title: "groupbox2"
- ColumnLayout {
+ Column {
anchors.fill: parent
RadioButton {
id: radiobutton1
diff --git a/tests/auto/applicationwindow/data/activeFocusControl.qml b/tests/auto/applicationwindow/data/activeFocusControl.qml
new file mode 100644
index 00000000..51b3241f
--- /dev/null
+++ b/tests/auto/applicationwindow/data/activeFocusControl.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 Qt.labs.controls 1.0
+
+ApplicationWindow {
+ width: 400
+ height: 400
+
+ property alias container_column: column
+ property alias textInput_column: ti_column
+ property alias textEdit_column: te_column
+ property alias textField_column: tf_column
+ property alias textArea_column: ta_column
+ property alias spinBox_column: sp_column
+ property alias spinContent_column: sp_column.contentItem
+
+ property alias container_frame: frame
+ property alias textInput_frame: ti_frame
+ property alias textEdit_frame: te_frame
+ property alias textField_frame: tf_frame
+ property alias textArea_frame: ta_frame
+ property alias spinBox_frame: sp_frame
+ property alias spinContent_frame: sp_frame.contentItem
+
+ Column {
+ id: column
+
+ TextInput {
+ id: ti_column
+ }
+ TextEdit {
+ id: te_column
+ }
+ TextField {
+ id: tf_column
+ }
+ TextArea {
+ id: ta_column
+ }
+ SpinBox {
+ id: sp_column
+ }
+ }
+
+ Frame {
+ id: frame
+
+ Column {
+ TextInput {
+ id: ti_frame
+ }
+ TextEdit {
+ id: te_frame
+ }
+ TextField {
+ id: tf_frame
+ }
+ TextArea {
+ id: ta_frame
+ }
+ SpinBox {
+ id: sp_frame
+ }
+ }
+ }
+}
diff --git a/tests/auto/applicationwindow/data/attachedProperties.qml b/tests/auto/applicationwindow/data/attachedProperties.qml
index 060a3093..72707537 100644
--- a/tests/auto/applicationwindow/data/attachedProperties.qml
+++ b/tests/auto/applicationwindow/data/attachedProperties.qml
@@ -43,15 +43,27 @@ import QtQuick.Window 2.2
import Qt.labs.controls 1.0
ApplicationWindow {
+ property alias childControl: childControl
property alias childItem: childItem
property alias childObject: childObject
- Item {
+ Control {
+ id: childControl
+
+ property ApplicationWindow attached_window: ApplicationWindow.window
+ property Item attached_contentItem: ApplicationWindow.contentItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
+ property Item attached_header: ApplicationWindow.header
+ property Item attached_footer: ApplicationWindow.footer
+ property Item attached_overlay: ApplicationWindow.overlay
+ }
+
+ Control {
id: childItem
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
@@ -62,13 +74,14 @@ ApplicationWindow {
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
}
property alias childWindow: childWindow
+ property alias childWindowControl: childWindowControl
property alias childWindowItem: childWindowItem
property alias childWindowObject: childWindowObject
@@ -77,17 +90,28 @@ ApplicationWindow {
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
- Item {
+ Control {
+ id: childWindowControl
+
+ property ApplicationWindow attached_window: ApplicationWindow.window
+ property Item attached_contentItem: ApplicationWindow.contentItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
+ property Item attached_header: ApplicationWindow.header
+ property Item attached_footer: ApplicationWindow.footer
+ property Item attached_overlay: ApplicationWindow.overlay
+ }
+
+ Control {
id: childWindowItem
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
@@ -98,7 +122,7 @@ ApplicationWindow {
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
@@ -106,6 +130,7 @@ ApplicationWindow {
}
property alias childAppWindow: childAppWindow
+ property alias childAppWindowControl: childAppWindowControl
property alias childAppWindowItem: childAppWindowItem
property alias childAppWindowObject: childAppWindowObject
@@ -114,17 +139,28 @@ ApplicationWindow {
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
- Item {
+ Control {
+ id: childAppWindowControl
+
+ property ApplicationWindow attached_window: ApplicationWindow.window
+ property Item attached_contentItem: ApplicationWindow.contentItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
+ property Item attached_header: ApplicationWindow.header
+ property Item attached_footer: ApplicationWindow.footer
+ property Item attached_overlay: ApplicationWindow.overlay
+ }
+
+ Control {
id: childAppWindowItem
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
@@ -135,7 +171,7 @@ ApplicationWindow {
property ApplicationWindow attached_window: ApplicationWindow.window
property Item attached_contentItem: ApplicationWindow.contentItem
- property Item attached_activeFocusItem: ApplicationWindow.activeFocusItem
+ property Item attached_activeFocusControl: ApplicationWindow.activeFocusControl
property Item attached_header: ApplicationWindow.header
property Item attached_footer: ApplicationWindow.footer
property Item attached_overlay: ApplicationWindow.overlay
diff --git a/tests/auto/applicationwindow/data/font.qml b/tests/auto/applicationwindow/data/font.qml
new file mode 100644
index 00000000..277ee1f2
--- /dev/null
+++ b/tests/auto/applicationwindow/data/font.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 Qt.labs.controls 1.0
+import Qt.labs.templates 1.0 as T
+
+ApplicationWindow {
+ objectName: "appWin"
+ width: 400
+ height: 400
+
+ property alias mainItem: mainItem
+
+ font.family: "Arial"
+
+ T.Control {
+ id: mainItem
+ objectName: "mainItem"
+ anchors.fill: parent
+ property alias item_2: _item_2;
+ property alias item_3: _item_3;
+ property alias item_4: _item_4;
+ property alias item_5: _item_5;
+ property alias item_6: _item_6;
+ T.Control {
+ id: _item_2
+ objectName: "_item_2"
+ T.Control {
+ id: _item_3
+ objectName: "_item_3"
+ }
+ }
+ T.TextArea {
+ id: _item_4
+ objectName: "_item_4"
+ text: "Text Area"
+ }
+ T.TextField {
+ id: _item_5
+ objectName: "_item_5"
+ text: "Text Field"
+ }
+ T.Label {
+ id: _item_6
+ objectName: "_item_6"
+ text: "Label"
+ }
+ }
+}
diff --git a/tests/auto/applicationwindow/data/locale.qml b/tests/auto/applicationwindow/data/locale.qml
new file mode 100644
index 00000000..59c42f85
--- /dev/null
+++ b/tests/auto/applicationwindow/data/locale.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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 Qt.labs.controls 1.0
+import Qt.labs.templates 1.0 as T
+
+ApplicationWindow {
+ objectName: "appWin"
+ width: 400
+ height: 400
+
+ property alias mainItem: mainItem
+
+ T.Control {
+ id: mainItem
+ objectName: "mainItem"
+ anchors.fill: parent
+ property alias item_2: _item_2;
+ property alias item_3: _item_3;
+ T.Control {
+ id: _item_2
+ objectName: "_item_2"
+ T.Control {
+ id: _item_3
+ objectName: "_item_3"
+ }
+ }
+ }
+}
diff --git a/tests/auto/applicationwindow/tst_applicationwindow.cpp b/tests/auto/applicationwindow/tst_applicationwindow.cpp
index 0f91d634..8256f16b 100644
--- a/tests/auto/applicationwindow/tst_applicationwindow.cpp
+++ b/tests/auto/applicationwindow/tst_applicationwindow.cpp
@@ -42,6 +42,11 @@
#include <QtQuick/qquickview.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtLabsTemplates/private/qquickapplicationwindow_p.h>
+#include <QtLabsTemplates/private/qquickoverlay_p.h>
+#include <QtLabsTemplates/private/qquickcontrol_p.h>
+#include <QtLabsTemplates/private/qquicklabel_p.h>
+#include <QtLabsTemplates/private/qquicktextarea_p.h>
+#include <QtLabsTemplates/private/qquicktextfield_p.h>
#include "../shared/util.h"
#include "../shared/visualtestutil.h"
@@ -59,6 +64,10 @@ private slots:
void defaultFocus();
void implicitFill();
void attachedProperties();
+ void font();
+ void locale();
+ void activeFocusControl_data();
+ void activeFocusControl();
};
void tst_applicationwindow::qmlCreation()
@@ -261,11 +270,20 @@ void tst_applicationwindow::attachedProperties()
QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(object.data());
QVERIFY(window);
+ QQuickItem *childControl = object->property("childControl").value<QQuickItem *>();
+ QVERIFY(childControl);
+ QCOMPARE(childControl->property("attached_window").value<QQuickApplicationWindow *>(), window);
+ QCOMPARE(childControl->property("attached_contentItem").value<QQuickItem *>(), window->contentItem());
+ QCOMPARE(childControl->property("attached_activeFocusControl").value<QQuickItem *>(), window->activeFocusControl());
+ QCOMPARE(childControl->property("attached_header").value<QQuickItem *>(), window->header());
+ QCOMPARE(childControl->property("attached_footer").value<QQuickItem *>(), window->footer());
+ QCOMPARE(childControl->property("attached_overlay").value<QQuickItem *>(), window->overlay());
+
QQuickItem *childItem = object->property("childItem").value<QQuickItem *>();
QVERIFY(childItem);
QCOMPARE(childItem->property("attached_window").value<QQuickApplicationWindow *>(), window);
QCOMPARE(childItem->property("attached_contentItem").value<QQuickItem *>(), window->contentItem());
- QCOMPARE(childItem->property("attached_activeFocusItem").value<QQuickItem *>(), window->activeFocusItem());
+ QCOMPARE(childItem->property("attached_activeFocusControl").value<QQuickItem *>(), window->activeFocusControl());
QCOMPARE(childItem->property("attached_header").value<QQuickItem *>(), window->header());
QCOMPARE(childItem->property("attached_footer").value<QQuickItem *>(), window->footer());
QCOMPARE(childItem->property("attached_overlay").value<QQuickItem *>(), window->overlay());
@@ -274,7 +292,7 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(childObject);
QVERIFY(!childObject->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childObject->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childObject->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childObject->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childObject->property("attached_header").value<QQuickItem *>());
QVERIFY(!childObject->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childObject->property("attached_overlay").value<QQuickItem *>());
@@ -283,16 +301,25 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(childWindow);
QVERIFY(!childWindow->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childWindow->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childWindow->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childWindow->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childWindow->property("attached_header").value<QQuickItem *>());
QVERIFY(!childWindow->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childWindow->property("attached_overlay").value<QQuickItem *>());
+ QQuickItem *childWindowControl = object->property("childWindowControl").value<QQuickItem *>();
+ QVERIFY(childWindowControl);
+ QVERIFY(!childWindowControl->property("attached_window").value<QQuickApplicationWindow *>());
+ QVERIFY(!childWindowControl->property("attached_contentItem").value<QQuickItem *>());
+ QVERIFY(!childWindowControl->property("attached_activeFocusControl").value<QQuickItem *>());
+ QVERIFY(!childWindowControl->property("attached_header").value<QQuickItem *>());
+ QVERIFY(!childWindowControl->property("attached_footer").value<QQuickItem *>());
+ QVERIFY(!childWindowControl->property("attached_overlay").value<QQuickItem *>());
+
QQuickItem *childWindowItem = object->property("childWindowItem").value<QQuickItem *>();
QVERIFY(childWindowItem);
QVERIFY(!childWindowItem->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childWindowItem->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childWindowItem->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childWindowItem->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childWindowItem->property("attached_header").value<QQuickItem *>());
QVERIFY(!childWindowItem->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childWindowItem->property("attached_overlay").value<QQuickItem *>());
@@ -301,7 +328,7 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(childWindowObject);
QVERIFY(!childWindowObject->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childWindowObject->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childWindowObject->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childWindowObject->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childWindowObject->property("attached_header").value<QQuickItem *>());
QVERIFY(!childWindowObject->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childWindowObject->property("attached_overlay").value<QQuickItem *>());
@@ -310,16 +337,25 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(childAppWindow);
QVERIFY(!childAppWindow->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childAppWindow->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childAppWindow->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childAppWindow->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childAppWindow->property("attached_header").value<QQuickItem *>());
QVERIFY(!childAppWindow->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childAppWindow->property("attached_overlay").value<QQuickItem *>());
+ QQuickItem *childAppWindowControl = object->property("childAppWindowControl").value<QQuickItem *>();
+ QVERIFY(childAppWindowControl);
+ QCOMPARE(childAppWindowControl->property("attached_window").value<QQuickApplicationWindow *>(), childAppWindow);
+ QCOMPARE(childAppWindowControl->property("attached_contentItem").value<QQuickItem *>(), childAppWindow->contentItem());
+ QCOMPARE(childAppWindowControl->property("attached_activeFocusControl").value<QQuickItem *>(), childAppWindow->activeFocusControl());
+ QCOMPARE(childAppWindowControl->property("attached_header").value<QQuickItem *>(), childAppWindow->header());
+ QCOMPARE(childAppWindowControl->property("attached_footer").value<QQuickItem *>(), childAppWindow->footer());
+ QCOMPARE(childAppWindowControl->property("attached_overlay").value<QQuickItem *>(), childAppWindow->overlay());
+
QQuickItem *childAppWindowItem = object->property("childAppWindowItem").value<QQuickItem *>();
QVERIFY(childAppWindowItem);
QCOMPARE(childAppWindowItem->property("attached_window").value<QQuickApplicationWindow *>(), childAppWindow);
QCOMPARE(childAppWindowItem->property("attached_contentItem").value<QQuickItem *>(), childAppWindow->contentItem());
- QCOMPARE(childAppWindowItem->property("attached_activeFocusItem").value<QQuickItem *>(), childAppWindow->activeFocusItem());
+ QCOMPARE(childAppWindowItem->property("attached_activeFocusControl").value<QQuickItem *>(), childAppWindow->activeFocusControl());
QCOMPARE(childAppWindowItem->property("attached_header").value<QQuickItem *>(), childAppWindow->header());
QCOMPARE(childAppWindowItem->property("attached_footer").value<QQuickItem *>(), childAppWindow->footer());
QCOMPARE(childAppWindowItem->property("attached_overlay").value<QQuickItem *>(), childAppWindow->overlay());
@@ -328,7 +364,7 @@ void tst_applicationwindow::attachedProperties()
QVERIFY(childAppWindowObject);
QVERIFY(!childAppWindowObject->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childAppWindowObject->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childAppWindowObject->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childAppWindowObject->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childAppWindowObject->property("attached_header").value<QQuickItem *>());
QVERIFY(!childAppWindowObject->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childAppWindowObject->property("attached_overlay").value<QQuickItem *>());
@@ -337,51 +373,235 @@ void tst_applicationwindow::attachedProperties()
window->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(window));
- QVERIFY(!childItem->hasActiveFocus());
- childItem->forceActiveFocus();
- QTRY_VERIFY(childItem->hasActiveFocus());
- QCOMPARE(window->activeFocusItem(), childItem);
- QCOMPARE(childItem->property("attached_activeFocusItem").value<QQuickItem *>(), childItem);
+ QVERIFY(!childControl->hasActiveFocus());
+ childControl->forceActiveFocus();
+ QTRY_VERIFY(childControl->hasActiveFocus());
+ QCOMPARE(window->activeFocusItem(), childControl);
+ QCOMPARE(childControl->property("attached_activeFocusControl").value<QQuickItem *>(), childControl);
QQuickItem *header = new QQuickItem;
window->setHeader(header);
QCOMPARE(window->header(), header);
- QCOMPARE(childItem->property("attached_header").value<QQuickItem *>(), header);
+ QCOMPARE(childControl->property("attached_header").value<QQuickItem *>(), header);
QQuickItem *footer = new QQuickItem;
window->setFooter(footer);
QCOMPARE(window->footer(), footer);
- QCOMPARE(childItem->property("attached_footer").value<QQuickItem *>(), footer);
+ QCOMPARE(childControl->property("attached_footer").value<QQuickItem *>(), footer);
childAppWindow->show();
childAppWindow->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(childAppWindow));
- QVERIFY(!childAppWindowItem->hasActiveFocus());
- childAppWindowItem->forceActiveFocus();
- QTRY_VERIFY(childAppWindowItem->hasActiveFocus());
- QCOMPARE(childAppWindow->activeFocusItem(), childAppWindowItem);
- QCOMPARE(childAppWindowItem->property("attached_activeFocusItem").value<QQuickItem *>(), childAppWindowItem);
+ QVERIFY(!childAppWindowControl->hasActiveFocus());
+ childAppWindowControl->forceActiveFocus();
+ QTRY_VERIFY(childAppWindowControl->hasActiveFocus());
+ QCOMPARE(childAppWindow->activeFocusItem(), childAppWindowControl);
+ QCOMPARE(childAppWindowControl->property("attached_activeFocusControl").value<QQuickItem *>(), childAppWindowControl);
+
+ childControl->setParentItem(childAppWindow->contentItem());
+ QCOMPARE(childControl->window(), childAppWindow);
+ QCOMPARE(childControl->property("attached_window").value<QQuickApplicationWindow *>(), childAppWindow);
+ QCOMPARE(childControl->property("attached_contentItem").value<QQuickItem *>(), childAppWindow->contentItem());
+ QCOMPARE(childControl->property("attached_activeFocusControl").value<QQuickItem *>(), childAppWindow->activeFocusControl());
+ QCOMPARE(childControl->property("attached_header").value<QQuickItem *>(), childAppWindow->header());
+ QCOMPARE(childControl->property("attached_footer").value<QQuickItem *>(), childAppWindow->footer());
+ QCOMPARE(childControl->property("attached_overlay").value<QQuickItem *>(), childAppWindow->overlay());
childItem->setParentItem(childAppWindow->contentItem());
QCOMPARE(childItem->window(), childAppWindow);
QCOMPARE(childItem->property("attached_window").value<QQuickApplicationWindow *>(), childAppWindow);
QCOMPARE(childItem->property("attached_contentItem").value<QQuickItem *>(), childAppWindow->contentItem());
- QCOMPARE(childItem->property("attached_activeFocusItem").value<QQuickItem *>(), childAppWindow->activeFocusItem());
+ QCOMPARE(childItem->property("attached_activeFocusControl").value<QQuickItem *>(), childAppWindow->activeFocusControl());
QCOMPARE(childItem->property("attached_header").value<QQuickItem *>(), childAppWindow->header());
QCOMPARE(childItem->property("attached_footer").value<QQuickItem *>(), childAppWindow->footer());
QCOMPARE(childItem->property("attached_overlay").value<QQuickItem *>(), childAppWindow->overlay());
+ childControl->setParentItem(Q_NULLPTR);
+ QVERIFY(!childControl->window());
+ QVERIFY(!childControl->property("attached_window").value<QQuickApplicationWindow *>());
+ QVERIFY(!childControl->property("attached_contentItem").value<QQuickItem *>());
+ QVERIFY(!childControl->property("attached_activeFocusControl").value<QQuickItem *>());
+ QVERIFY(!childControl->property("attached_header").value<QQuickItem *>());
+ QVERIFY(!childControl->property("attached_footer").value<QQuickItem *>());
+ QVERIFY(!childControl->property("attached_overlay").value<QQuickItem *>());
+
childItem->setParentItem(Q_NULLPTR);
QVERIFY(!childItem->window());
QVERIFY(!childItem->property("attached_window").value<QQuickApplicationWindow *>());
QVERIFY(!childItem->property("attached_contentItem").value<QQuickItem *>());
- QVERIFY(!childItem->property("attached_activeFocusItem").value<QQuickItem *>());
+ QVERIFY(!childItem->property("attached_activeFocusControl").value<QQuickItem *>());
QVERIFY(!childItem->property("attached_header").value<QQuickItem *>());
QVERIFY(!childItem->property("attached_footer").value<QQuickItem *>());
QVERIFY(!childItem->property("attached_overlay").value<QQuickItem *>());
}
+void tst_applicationwindow::font()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("font.qml"));
+ QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+ QVERIFY(created);
+
+ QQuickApplicationWindow* window = qobject_cast<QQuickApplicationWindow*>(created);
+ QVERIFY(window);
+ QVERIFY(!window->isVisible());
+ QCOMPARE(window->width(), 400);
+ QCOMPARE(window->height(), 400);
+
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QFont font = window->font();
+
+ QQuickControl *mainItem = window->property("mainItem").value<QQuickControl*>();
+ QVERIFY(mainItem);
+ QCOMPARE(mainItem->width(), 400.0);
+ QCOMPARE(mainItem->height(), 400.0);
+ QCOMPARE(mainItem->font(), font);
+
+ QQuickControl *item2 = mainItem->property("item_2").value<QQuickControl*>();
+ QVERIFY(item2);
+ QQuickControl *item3 = mainItem->property("item_3").value<QQuickControl*>();
+ QVERIFY(item3);
+ QQuickTextArea *item4 = mainItem->property("item_4").value<QQuickTextArea*>();
+ QVERIFY(item4);
+ QQuickTextField *item5 = mainItem->property("item_5").value<QQuickTextField*>();
+ QVERIFY(item5);
+ QQuickLabel *item6 = mainItem->property("item_6").value<QQuickLabel*>();
+ QVERIFY(item6);
+
+ QCOMPARE(item2->font(), font);
+ QCOMPARE(item3->font(), font);
+ QCOMPARE(item4->font(), font);
+ QCOMPARE(item5->font(), font);
+ QCOMPARE(item6->font(), font);
+
+ int pointSize = font.pointSize();
+ font.setPixelSize(pointSize + 5);
+ window->setFont(font);
+
+ QCOMPARE(window->font(), font);
+ QCOMPARE(mainItem->font(), font);
+ QCOMPARE(item2->font(), font);
+ QCOMPARE(item3->font(), font);
+ QCOMPARE(item4->font(), font);
+ QCOMPARE(item5->font(), font);
+ QCOMPARE(item6->font(), font);
+}
+
+void tst_applicationwindow::locale()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("locale.qml"));
+ QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+ QVERIFY(created);
+
+ QQuickApplicationWindow* window = qobject_cast<QQuickApplicationWindow*>(created);
+ QVERIFY(window);
+ QVERIFY(!window->isVisible());
+ QCOMPARE(window->width(), 400);
+ QCOMPARE(window->height(), 400);
+
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QLocale l = window->locale();
+
+ QQuickControl *mainItem = window->property("mainItem").value<QQuickControl*>();
+ QVERIFY(mainItem);
+ QCOMPARE(mainItem->width(), 400.0);
+ QCOMPARE(mainItem->height(), 400.0);
+ QCOMPARE(mainItem->locale(), l);
+
+ QQuickControl *item2 = mainItem->property("item_2").value<QQuickControl*>();
+ QVERIFY(item2);
+ QQuickControl *item3 = mainItem->property("item_3").value<QQuickControl*>();
+ QVERIFY(item3);
+
+ QCOMPARE(item2->locale(), l);
+ QCOMPARE(item3->locale(), l);
+
+ l = QLocale("en_US");
+ window->setLocale(l);
+
+ QCOMPARE(window->locale(), l);
+ QCOMPARE(mainItem->locale(), l);
+ QCOMPARE(item2->locale(), l);
+ QCOMPARE(item3->locale(), l);
+
+ l = QLocale("ar_EG");
+ window->setLocale(l);
+
+ QCOMPARE(window->locale(), l);
+ QCOMPARE(mainItem->locale(), l);
+ QCOMPARE(item2->locale(), l);
+ QCOMPARE(item3->locale(), l);
+}
+
+void tst_applicationwindow::activeFocusControl_data()
+{
+ QTest::addColumn<QByteArray>("containerName");
+ QTest::addColumn<QByteArray>("activeFocusItemName");
+ QTest::addColumn<QByteArray>("activeFocusControlName");
+
+ QTest::newRow("Column:TextInput") << QByteArray("container_column") << QByteArray("textInput_column") << QByteArray();
+ QTest::newRow("Column:TextEdit") << QByteArray("container_column") << QByteArray("textEdit_column") << QByteArray();
+ QTest::newRow("Column:TextField") << QByteArray("container_column") << QByteArray("textField_column") << QByteArray("textField_column");
+ QTest::newRow("Column:TextArea") << QByteArray("container_column") << QByteArray("textArea_column") << QByteArray("textArea_column");
+ QTest::newRow("Column:SpinBox") << QByteArray("container_column") << QByteArray("spinContent_column") << QByteArray("spinBox_column");
+
+ QTest::newRow("Frame:TextInput") << QByteArray("container_frame") << QByteArray("textInput_frame") << QByteArray("container_frame");
+ QTest::newRow("Frame:TextEdit") << QByteArray("container_frame") << QByteArray("textEdit_frame") << QByteArray("container_frame");
+ QTest::newRow("Frame:TextField") << QByteArray("container_frame") << QByteArray("textField_frame") << QByteArray("textField_frame");
+ QTest::newRow("Frame:TextArea") << QByteArray("container_frame") << QByteArray("textArea_frame") << QByteArray("textArea_frame");
+ QTest::newRow("Frame:SpinBox") << QByteArray("container_frame") << QByteArray("spinContent_frame") << QByteArray("spinBox_frame");
+}
+
+void tst_applicationwindow::activeFocusControl()
+{
+ QFETCH(QByteArray, containerName);
+ QFETCH(QByteArray, activeFocusItemName);
+ QFETCH(QByteArray, activeFocusControlName);
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("activeFocusControl.qml"));
+ QScopedPointer<QObject> object(component.create());
+ QVERIFY(!object.isNull());
+
+ QQuickApplicationWindow* window = qobject_cast<QQuickApplicationWindow*>(object.data());
+ QVERIFY(window);
+ QVERIFY(!window->isVisible());
+ QCOMPARE(window->width(), 400);
+ QCOMPARE(window->height(), 400);
+
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+
+ QQuickItem *container = window->property(containerName).value<QQuickItem*>();
+ QVERIFY(container);
+
+ QQuickItem *activeFocusItem = window->property(activeFocusItemName).value<QQuickItem*>();
+ QVERIFY(activeFocusItem);
+ activeFocusItem->forceActiveFocus();
+ QVERIFY(activeFocusItem->hasActiveFocus());
+ QCOMPARE(window->activeFocusItem(), activeFocusItem);
+
+ QQuickItem *activeFocusControl = window->property(activeFocusControlName).value<QQuickItem*>();
+ if (activeFocusControlName.isEmpty()) {
+ QVERIFY(!activeFocusControl);
+ } else {
+ QVERIFY(activeFocusControl);
+ QVERIFY(activeFocusControl->hasActiveFocus());
+ }
+ QCOMPARE(window->activeFocusControl(), activeFocusControl);
+}
+
QTEST_MAIN(tst_applicationwindow)
#include "tst_applicationwindow.moc"
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index 11537d68..4e635d63 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -67,4 +67,13 @@ TestCase {
control.destroy();
}
+
+ function test_highlighted() {
+ var control = button.createObject(testCase)
+ verify(control)
+ compare(control.highlighted, false)
+
+ control.highlighted = true
+ compare(control.highlighted, true)
+ }
}
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index 873009e8..1faf1956 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -185,6 +185,10 @@ TestCase {
}
}
+ function eventErrorMessage(actual, expected) {
+ return "actual event:" + JSON.stringify(actual) + ", expected event:" + JSON.stringify(expected)
+ }
+
function test_events() {
var control = eventButton.createObject(testCase)
verify(control)
@@ -193,7 +197,8 @@ TestCase {
verify(control.activeFocus)
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton)
- compare(control.lastPress, { x: control.width / 2, y: control.height / 2, button: Qt.LeftButton, buttons: Qt.LeftButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false })
+ var expected = { x: Math.round(control.width / 2), y: Math.round(control.height / 2), button: Qt.LeftButton, buttons: Qt.LeftButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false }
+ compare(control.lastPress, expected, eventErrorMessage(control.lastPress, expected))
compare(control.lastRelease, undefined)
compare(control.lastClick, undefined)
compare(control.lastDoubleClick, undefined)
@@ -210,14 +215,17 @@ TestCase {
mouseRelease(control, control.width / 4, control.height / 4, Qt.LeftButton)
compare(control.lastPress, undefined)
- compare(control.lastRelease, { x: control.width / 4, y: control.height / 4, button: Qt.LeftButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false })
- compare(control.lastClick, { x: control.width / 4, y: control.height / 4, button: Qt.LeftButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: true })
+ expected = { x: Math.round(control.width / 4), y: Math.round(control.height / 4), button: Qt.LeftButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false }
+ compare(control.lastRelease, expected, eventErrorMessage(control.lastRelease, expected))
+ expected = { x: Math.round(control.width / 4), y: Math.round(control.height / 4), button: Qt.LeftButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: true }
+ compare(control.lastClick, expected, eventErrorMessage(control.lastClick, expected))
compare(control.lastDoubleClick, undefined)
control.reset()
keyPress(Qt.Key_Space)
- compare(control.lastPress, { x: control.width / 2, y: control.height / 2, button: Qt.NoButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false })
+ expected = { x: Math.round(control.width / 2), y: Math.round(control.height / 2), button: Qt.NoButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false }
+ compare(control.lastPress, expected, eventErrorMessage(control.lastPress, expected))
compare(control.lastRelease, undefined)
compare(control.lastClick, undefined)
compare(control.lastDoubleClick, undefined)
@@ -226,8 +234,10 @@ TestCase {
keyRelease(Qt.Key_Space)
compare(control.lastPress, undefined)
- compare(control.lastRelease, { x: control.width / 2, y: control.height / 2, button: Qt.NoButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false })
- compare(control.lastClick, { x: control.width / 2, y: control.height / 2, button: Qt.NoButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: true })
+ expected = { x: Math.round(control.width / 2), y: Math.round(control.height / 2), button: Qt.NoButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: false }
+ compare(control.lastRelease, expected, eventErrorMessage(control.lastRelease, expected))
+ expected = { x: Math.round(control.width / 2), y: Math.round(control.height / 2), button: Qt.NoButton, buttons: Qt.NoButton, modifiers: Qt.NoModifier, wasHeld: false, isClick: true }
+ compare(control.lastClick, expected, eventErrorMessage(control.lastClick, expected))
compare(control.lastDoubleClick, undefined)
control.destroy()
@@ -291,15 +301,6 @@ TestCase {
control.destroy()
}
- function test_highlighted() {
- var control = button.createObject(testCase)
- verify(control)
- compare(control.highlighted, false)
-
- control.highlighted = true
- compare(control.highlighted, true)
- }
-
function test_baseline() {
var control = button.createObject(testCase)
verify(control)
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
new file mode 100644
index 00000000..11390bb8
--- /dev/null
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -0,0 +1,584 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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.2
+import QtTest 1.0
+import Qt.labs.controls 1.0
+
+TestCase {
+ id: testCase
+ name: "ComboBox"
+
+ ApplicationWindow {
+ id: window
+ visible: true
+ width: 400
+ height: 400
+ }
+
+ SignalSpy {
+ id: activatedSpy
+ signalName: "activated"
+ }
+
+ SignalSpy {
+ id: highlightedSpy
+ signalName: "highlighted"
+ }
+
+ Component {
+ id: comboBox
+ ComboBox {
+ delegate: ItemDelegate {
+ width: parent.width
+ }
+ }
+ }
+
+ function initTestCase() {
+ window.requestActivate()
+ tryCompare(window, "active", true)
+ }
+
+ 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(window.contentItem)
+ verify(control)
+
+ compare(control.count, 0)
+ compare(control.model, undefined)
+ compare(control.pressed, false)
+ compare(control.currentIndex, -1)
+ compare(control.highlightedIndex, -1)
+ compare(control.currentText, "")
+ verify(control.delegate)
+ verify(control.popup)
+
+ control.destroy()
+ }
+
+ function test_array() {
+ var control = comboBox.createObject(window.contentItem)
+ verify(control)
+
+ var items = [ "Banana", "Apple", "Coconut" ]
+
+ control.model = items
+ compare(control.model, items)
+
+ compare(control.count, 3)
+ compare(control.currentIndex, 0)
+ compare(control.currentText, "Banana")
+
+ control.currentIndex = 2
+ compare(control.currentIndex, 2)
+ compare(control.currentText, "Coconut")
+
+ control.model = null
+ compare(control.model, null)
+ compare(control.count, 0)
+ compare(control.currentIndex, -1)
+ compare(control.currentText, "")
+
+ control.destroy()
+ }
+
+ function test_number() {
+ var control = comboBox.createObject(window.contentItem)
+ verify(control)
+
+ control.model = 10
+ compare(control.model, 10)
+
+ compare(control.count, 10)
+ compare(control.currentIndex, 0)
+ compare(control.currentText, "0")
+
+ control.currentIndex = 9
+ compare(control.currentIndex, 9)
+ compare(control.currentText, "9")
+
+ control.model = 0
+ compare(control.model, 0)
+ compare(control.count, 0)
+ compare(control.currentIndex, -1)
+ compare(control.currentText, "")
+
+ control.destroy()
+ }
+
+ ListModel {
+ id: listmodel
+ ListElement { text: "First" }
+ ListElement { text: "Second" }
+ ListElement { text: "Third" }
+ ListElement { text: "Fourth" }
+ ListElement { text: "Fifth" }
+ }
+
+ function test_listModel() {
+ var control = comboBox.createObject(window.contentItem)
+ verify(control)
+
+ control.model = listmodel
+ compare(control.model, listmodel)
+
+ compare(control.count, 5)
+ compare(control.currentIndex, 0)
+ compare(control.currentText, "First")
+
+ control.currentIndex = 2
+ compare(control.currentIndex, 2)
+ compare(control.currentText, "Third")
+
+ control.model = undefined
+ compare(control.model, undefined)
+ compare(control.count, 0)
+ compare(control.currentIndex, -1)
+ compare(control.currentText, "")
+
+ control.destroy()
+ }
+
+ ListModel {
+ id: fruitmodel
+ ListElement { name: "Apple"; color: "red" }
+ ListElement { name: "Orange"; color: "orange" }
+ ListElement { name: "Banana"; color: "yellow" }
+ }
+
+ function test_textRole() {
+ var control = comboBox.createObject(window.contentItem)
+ verify(control)
+
+ control.model = fruitmodel
+ compare(control.count, 3)
+ compare(control.currentIndex, 0)
+ compare(control.currentText, "")
+
+ control.textRole = "name"
+ compare(control.currentText, "Apple")
+
+ control.textRole = "color"
+ compare(control.currentText, "red")
+
+ control.currentIndex = 1
+ compare(control.currentIndex, 1)
+ compare(control.currentText, "orange")
+
+ control.textRole = "name"
+ compare(control.currentText, "Orange")
+
+ control.textRole = ""
+ compare(control.currentText, "")
+
+ control.destroy()
+ }
+
+ function test_textAt() {
+ var control = comboBox.createObject(window.contentItem)
+ verify(control)
+
+ control.model = ["Apple", "Orange", "Banana"]
+ compare(control.textAt(0), "Apple")
+ compare(control.textAt(1), "Orange")
+ compare(control.textAt(2), "Banana")
+ compare(control.textAt(-1), "") // TODO: null?
+ compare(control.textAt(5), "") // TODO: null?
+
+ control.destroy()
+ }
+
+ function test_find_data() {
+ return [
+ { tag: "Banana (MatchExactly)", term: "Banana", flags: Qt.MatchExactly, index: 0 },
+ { tag: "banana (MatchExactly)", term: "banana", flags: Qt.MatchExactly, index: 1 },
+ { tag: "bananas (MatchExactly)", term: "bananas", flags: Qt.MatchExactly, index: -1 },
+ { tag: "Cocomuffin (MatchExactly)", term: "Cocomuffin", flags: Qt.MatchExactly, index: 4 },
+
+ { tag: "b(an)+a (MatchRegExp)", term: "B(an)+a", flags: Qt.MatchRegExp, index: 0 },
+ { tag: "b(an)+a (MatchRegExp|MatchCaseSensitive)", term: "b(an)+a", flags: Qt.MatchRegExp | Qt.MatchCaseSensitive, index: 1 },
+ { tag: "[coc]+\\w+ (MatchRegExp)", term: "[coc]+\\w+", flags: Qt.MatchRegExp, index: 2 },
+
+ { tag: "?pp* (MatchWildcard)", term: "?pp*", flags: Qt.MatchWildcard, index: 3 },
+ { tag: "app* (MatchWildcard|MatchCaseSensitive)", term: "app*", flags: Qt.MatchWildcard | Qt.MatchCaseSensitive, index: -1 },
+
+ { tag: "Banana (MatchFixedString)", term: "Banana", flags: Qt.MatchFixedString, index: 0 },
+ { tag: "banana (MatchFixedString|MatchCaseSensitive)", term: "banana", flags: Qt.MatchFixedString | Qt.MatchCaseSensitive, index: 1 },
+
+ { tag: "coco (MatchStartsWith)", term: "coco", flags: Qt.MatchStartsWith, index: 2 },
+ { tag: "coco (MatchStartsWith|MatchCaseSensitive)", term: "coco", flags: Qt.StartsWith | Qt.MatchCaseSensitive, index: -1 },
+
+ { tag: "MUFFIN (MatchEndsWith)", term: "MUFFIN", flags: Qt.MatchEndsWith, index: 4 },
+ { tag: "MUFFIN (MatchEndsWith|MatchCaseSensitive)", term: "MUFFIN", flags: Qt.MatchEndsWith | Qt.MatchCaseSensitive, index: -1 },
+
+ { tag: "Con (MatchContains)", term: "Con", flags: Qt.MatchContains, index: 2 },
+ { tag: "Con (MatchContains|MatchCaseSensitive)", term: "Con", flags: Qt.MatchContains | Qt.MatchCaseSensitive, index: -1 },
+ ]
+ }
+
+ function test_find(data) {
+ var control = comboBox.createObject(window.contentItem)
+ verify(control)
+
+ control.model = ["Banana", "banana", "Coconut", "Apple", "Cocomuffin"]
+
+ compare(control.find(data.term, data.flags), data.index)
+
+ control.destroy()
+ }
+
+ function test_arrowKeys() {
+ var control = comboBox.createObject(window.contentItem, {model: 3})
+ verify(control)
+
+ activatedSpy.target = control
+ verify(activatedSpy.valid)
+
+ highlightedSpy.target = control
+ verify(highlightedSpy.valid)
+
+ waitForRendering(control)
+
+ control.forceActiveFocus()
+ verify(control.activeFocus)
+
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, -1)
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 1)
+ compare(control.highlightedIndex, -1)
+ compare(highlightedSpy.count, 0)
+ compare(activatedSpy.count, 1)
+ compare(activatedSpy.signalArguments[0][0], 1)
+ activatedSpy.clear()
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 2)
+ compare(control.highlightedIndex, -1)
+ compare(highlightedSpy.count, 0)
+ compare(activatedSpy.count, 1)
+ compare(activatedSpy.signalArguments[0][0], 2)
+ activatedSpy.clear()
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 2)
+ compare(control.highlightedIndex, -1)
+ compare(highlightedSpy.count, 0)
+ compare(activatedSpy.count, 0)
+
+ keyClick(Qt.Key_Up)
+ compare(control.currentIndex, 1)
+ compare(control.highlightedIndex, -1)
+ compare(highlightedSpy.count, 0)
+ compare(activatedSpy.count, 1)
+ compare(activatedSpy.signalArguments[0][0], 1)
+ activatedSpy.clear()
+
+ keyClick(Qt.Key_Up)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, -1)
+ compare(highlightedSpy.count, 0)
+ compare(activatedSpy.count, 1)
+ compare(activatedSpy.signalArguments[0][0], 0)
+ activatedSpy.clear()
+
+ keyClick(Qt.Key_Up)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, -1)
+ compare(highlightedSpy.count, 0)
+ compare(activatedSpy.count, 0)
+
+ // show popup
+ keyClick(Qt.Key_Space)
+
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 0)
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 1)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 1)
+ compare(highlightedSpy.signalArguments[0][0], 1)
+ highlightedSpy.clear()
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 2)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 1)
+ compare(highlightedSpy.signalArguments[0][0], 2)
+ highlightedSpy.clear()
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 2)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+
+ keyClick(Qt.Key_Up)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 1)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 1)
+ compare(highlightedSpy.signalArguments[0][0], 1)
+ highlightedSpy.clear()
+
+ keyClick(Qt.Key_Up)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 0)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 1)
+ compare(highlightedSpy.signalArguments[0][0], 0)
+ highlightedSpy.clear()
+
+ keyClick(Qt.Key_Up)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 0)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+
+ keyClick(Qt.Key_Down)
+ compare(control.currentIndex, 0)
+ compare(control.highlightedIndex, 1)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 1)
+ compare(highlightedSpy.signalArguments[0][0], 1)
+ highlightedSpy.clear()
+
+ // hide popup
+ keyClick(Qt.Key_Space)
+
+ compare(control.currentIndex, 1)
+ compare(control.highlightedIndex, -1)
+
+ control.destroy()
+ }
+
+ function test_keys_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 },
+ { tag: "space-return", key1: Qt.Key_Space, key2: Qt.Key_Return, showPopup: true, showPress: true, hidePopup: true, hidePress: true },
+ { tag: "space-escape", key1: Qt.Key_Space, key2: Qt.Key_Escape, showPopup: true, showPress: true, hidePopup: true, hidePress: false },
+ { tag: "space-0", key1: Qt.Key_Space, key2: Qt.Key_0, showPopup: true, showPress: true, hidePopup: false, hidePress: false },
+
+ { tag: "enter-enter", key1: Qt.Key_Enter, key2: Qt.Key_Enter, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+ { tag: "return-return", key1: Qt.Key_Return, key2: Qt.Key_Return, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+ { tag: "escape-escape", key1: Qt.Key_Escape, key2: Qt.Key_Escape, showPopup: false, showPress: false, hidePopup: true, hidePress: false },
+ ]
+ }
+
+ function test_keys(data) {
+ var control = comboBox.createObject(window.contentItem, {model: 3})
+ verify(control)
+
+ control.forceActiveFocus()
+ verify(control.activeFocus)
+
+ compare(control.pressed, false)
+ compare(control.popup.visible, false)
+
+ // show popup
+ keyPress(data.key1)
+ compare(control.pressed, data.showPress)
+ compare(control.popup.visible, false)
+ keyRelease(data.key1)
+ compare(control.pressed, false)
+ compare(control.popup.visible, data.showPopup)
+
+ // 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)
+
+ control.destroy()
+ }
+
+ function test_popup() {
+ var control = comboBox.createObject(window.contentItem, {model: 3})
+ verify(control)
+
+ // show below
+ mousePress(control)
+ compare(control.pressed, true)
+ compare(control.popup.visible, false)
+ mouseRelease(control)
+ compare(control.pressed, false)
+ compare(control.popup.visible, true)
+ verify(control.popup.contentItem.y >= control.y)
+
+ // hide
+ mouseClick(control)
+ compare(control.pressed, false)
+ tryCompare(control.popup, "visible", false)
+
+ // show above
+ control.y = window.height - control.height
+ mousePress(control)
+ compare(control.pressed, true)
+ compare(control.popup.visible, false)
+ mouseRelease(control)
+ compare(control.pressed, false)
+ compare(control.popup.visible, true)
+ verify(control.popup.contentItem.y < control.y)
+
+ control.destroy()
+ }
+
+ function test_mouse() {
+ var control = comboBox.createObject(window.contentItem, {model: 3})
+ verify(control)
+
+ activatedSpy.target = control
+ verify(activatedSpy.valid)
+
+ highlightedSpy.target = control
+ verify(highlightedSpy.valid)
+
+ mouseClick(control)
+ compare(control.popup.visible, true)
+
+ var content = control.popup.contentItem
+ waitForRendering(content)
+
+ // press - move - release outside - not activated - not closed
+ mousePress(content)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+ mouseMove(content, content.width * 2)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+ mouseRelease(content, content.width * 2)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+ compare(control.popup.visible, true)
+
+ // press - move - release inside - activated - closed
+ mousePress(content)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+ mouseMove(content, content.width / 2 + 1, content.height / 2 + 1)
+ compare(activatedSpy.count, 0)
+ compare(highlightedSpy.count, 0)
+ mouseRelease(content)
+ compare(activatedSpy.count, 1)
+ compare(highlightedSpy.count, 1)
+ tryCompare(control.popup, "visible", false)
+
+ control.destroy()
+ }
+
+ function test_focus() {
+ var control = comboBox.createObject(window.contentItem, {model: 3})
+ verify(control)
+
+ // click - gain focus - show popup
+ mouseClick(control)
+ verify(control.activeFocus)
+ compare(control.popup.visible, true)
+
+ // lose focus - hide popup
+ window.contentItem.forceActiveFocus()
+ verify(window.contentItem.activeFocus)
+ verify(!control.activeFocus)
+ tryCompare(control.popup, "visible", false)
+
+ control.destroy()
+ }
+
+ function test_baseline() {
+ var control = comboBox.createObject(testCase)
+ verify(control)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
+ control.destroy()
+ }
+
+ Component {
+ id: displayBox
+ ComboBox {
+ textRole: "key"
+ model: ListModel {
+ ListElement { key: "First"; value: 123 }
+ ListElement { key: "Second"; value: 456 }
+ ListElement { key: "Third"; value: 789 }
+ }
+ }
+ }
+
+ function test_displayText() {
+ var control = displayBox.createObject(testCase)
+ verify(control)
+
+ compare(control.displayText, "First")
+ control.currentIndex = 1
+ compare(control.displayText, "Second")
+ control.textRole = "value"
+ compare(control.displayText, "456")
+ control.displayText = "Display"
+ compare(control.displayText, "Display")
+ control.currentIndex = 2
+ compare(control.displayText, "Display")
+ control.displayText = undefined
+ compare(control.displayText, "789")
+
+ control.destroy()
+ }
+}
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml
index 15b25112..7fe61064 100644
--- a/tests/auto/controls/data/tst_control.qml
+++ b/tests/auto/controls/data/tst_control.qml
@@ -57,16 +57,6 @@ TestCase {
}
SignalSpy {
- id: layoutDirectionSpy
- signalName: "layoutDirectionChanged"
- }
-
- SignalSpy {
- id: effectiveLayoutDirectionSpy
- signalName: "effectiveLayoutDirectionChanged"
- }
-
- SignalSpy {
id: mirroredSpy
signalName: "mirroredChanged"
}
@@ -213,54 +203,33 @@ TestCase {
control.destroy()
}
- function test_layoutDirection() {
+ function test_mirrored() {
var control = component.createObject(testCase)
verify(control)
- layoutDirectionSpy.target = control
- effectiveLayoutDirectionSpy.target = control
mirroredSpy.target = control
-
- verify(layoutDirectionSpy.valid)
- verify(effectiveLayoutDirectionSpy.valid)
verify(mirroredSpy.valid)
+ control.locale = Qt.locale("en_US")
+ compare(control.locale.name, "en_US")
verify(!control.LayoutMirroring.enabled)
- compare(control.layoutDirection, Qt.LeftToRight)
- compare(control.effectiveLayoutDirection, Qt.LeftToRight)
compare(control.mirrored, false)
- control.layoutDirection = Qt.RightToLeft
- compare(control.layoutDirection, Qt.RightToLeft)
- compare(control.effectiveLayoutDirection, Qt.RightToLeft)
+ control.locale = Qt.locale("ar_EG")
compare(control.mirrored, true)
- compare(layoutDirectionSpy.count, 1)
- compare(effectiveLayoutDirectionSpy.count, 1)
compare(mirroredSpy.count, 1)
control.LayoutMirroring.enabled = true
- compare(control.layoutDirection, Qt.RightToLeft)
- compare(control.effectiveLayoutDirection, Qt.LeftToRight)
- compare(control.mirrored, false)
- compare(layoutDirectionSpy.count, 1)
- compare(effectiveLayoutDirectionSpy.count, 2)
- compare(mirroredSpy.count, 2)
+ compare(control.mirrored, true)
+ compare(mirroredSpy.count, 1)
- control.layoutDirection = Qt.LeftToRight
- compare(control.layoutDirection, Qt.LeftToRight)
- compare(control.effectiveLayoutDirection, Qt.RightToLeft)
+ control.locale = Qt.locale("en_US")
compare(control.mirrored, true)
- compare(layoutDirectionSpy.count, 2)
- compare(effectiveLayoutDirectionSpy.count, 3)
- compare(mirroredSpy.count, 3)
+ compare(mirroredSpy.count, 1)
control.LayoutMirroring.enabled = false
- compare(control.layoutDirection, Qt.LeftToRight)
- compare(control.effectiveLayoutDirection, Qt.LeftToRight)
compare(control.mirrored, false)
- compare(layoutDirectionSpy.count, 2)
- compare(effectiveLayoutDirectionSpy.count, 4)
- compare(mirroredSpy.count, 4)
+ compare(mirroredSpy.count, 2)
control.destroy()
}
@@ -656,4 +625,228 @@ TestCase {
control4.destroy()
}
+
+ function test_locale() {
+ var control = component.createObject(testCase)
+ verify(control)
+
+ control.locale = Qt.locale("en_US")
+ compare(control.locale.name, "en_US")
+
+ control.locale = Qt.locale("nb_NO")
+ compare(control.locale.name, "nb_NO")
+
+ control.destroy()
+ }
+
+ Component {
+ id: component5
+ T.Control {
+ id: item2
+ objectName: "item2"
+ property alias localespy: _lspy;
+ property alias mirroredspy: _mspy;
+ property alias localespy_2: _lspy_2;
+ property alias mirroredspy_2: _mspy_2;
+ property alias localespy_3: _lspy_3;
+ property alias mirroredspy_3: _mspy_3;
+ property alias item2_2: _item2_2;
+ property alias item2_3: _item2_3;
+ T.Control {
+ id: _item2_2
+ objectName: "_item2_2"
+ T.Control {
+ id: _item2_3
+ objectName: "_item2_3"
+
+ SignalSpy {
+ id: _lspy_3
+ target: item2_3
+ signalName: "localeChanged"
+ }
+
+ SignalSpy {
+ id: _mspy_3
+ target: item2_3
+ signalName: "mirroredChanged"
+ }
+ }
+
+ SignalSpy {
+ id: _lspy_2
+ target: item2_2
+ signalName: "localeChanged"
+ }
+
+ SignalSpy {
+ id: _mspy_2
+ target: item2_2
+ signalName: "mirroredChanged"
+ }
+ }
+
+ SignalSpy {
+ id: _lspy
+ target: item2
+ signalName: "localeChanged"
+ }
+
+ SignalSpy {
+ id: _mspy
+ target: item2
+ signalName: "mirroredChanged"
+ }
+ }
+ }
+
+ function test_locale_2() {
+ var control = component5.createObject(testCase)
+ verify(control)
+ verify(control.item2_2)
+ verify(control.item2_3)
+
+ var defaultLocale = Qt.locale()
+
+ compare(control.locale.name, defaultLocale.name)
+ compare(control.item2_2.locale.name, defaultLocale.name)
+ compare(control.item2_3.locale.name, defaultLocale.name)
+
+ control.locale = Qt.locale("nb_NO")
+ control.localespy.wait()
+ compare(control.localespy.count, 1)
+ compare(control.mirroredspy.count, 0)
+ compare(control.locale.name, "nb_NO")
+ compare(control.item2_2.locale.name, "nb_NO")
+ compare(control.item2_3.locale.name, "nb_NO")
+ compare(control.localespy_2.count, 1)
+ compare(control.mirroredspy_2.count, 0)
+ compare(control.localespy_3.count, 1)
+ compare(control.mirroredspy_3.count, 0)
+
+ control.locale = Qt.locale("ar_EG")
+ control.localespy.wait()
+ compare(control.localespy.count, 2)
+ compare(control.mirroredspy.count, 1)
+ compare(control.locale.name, "ar_EG")
+ compare(control.item2_2.locale.name, "ar_EG")
+ compare(control.item2_3.locale.name, "ar_EG")
+ compare(control.localespy_2.count, 2)
+ compare(control.mirroredspy_2.count, 1)
+ compare(control.localespy_3.count, 2)
+ compare(control.mirroredspy_3.count, 1)
+ }
+
+ Component {
+ id: component6
+ T.Control {
+ id: item6
+ objectName: "item6"
+ property alias localespy: _lspy;
+ property alias mirroredspy: _mspy;
+ property alias localespy_5: _lspy_5;
+ property alias mirroredspy_5: _mspy_5;
+ property alias item6_2: _item6_2;
+ property alias item6_3: _item6_3;
+ property alias item6_4: _item6_4;
+ property alias item6_5: _item6_5;
+ Item {
+ id: _item6_2
+ objectName: "_item6_2"
+ T.Control {
+ id: _item6_3
+ objectName: "_item6_3"
+ Item {
+ id: _item6_4
+ objectName: "_item6_4"
+ T.Control {
+ id: _item6_5
+ objectName: "_item6_5"
+
+ SignalSpy {
+ id: _lspy_5
+ target: _item6_5
+ signalName: "localeChanged"
+ }
+
+ SignalSpy {
+ id: _mspy_5
+ target: _item6_5
+ signalName: "mirroredChanged"
+ }
+ }
+ }
+ }
+ }
+
+ SignalSpy {
+ id: _lspy
+ target: item6
+ signalName: "localeChanged"
+ }
+
+ SignalSpy {
+ id: _mspy
+ target: item6
+ signalName: "mirroredChanged"
+ }
+ }
+ }
+
+ function test_locale_3() {
+ var control = component6.createObject(testCase)
+ verify(control)
+ verify(control.item6_2)
+ verify(control.item6_3)
+ verify(control.item6_4)
+ verify(control.item6_5)
+
+ var defaultLocale = Qt.locale()
+
+ compare(control.locale.name, defaultLocale.name)
+ compare(control.item6_5.locale.name, defaultLocale.name)
+
+ control.locale = Qt.locale("nb_NO")
+ control.localespy.wait()
+ compare(control.localespy.count, 1)
+ compare(control.mirroredspy.count, 0)
+ compare(control.locale.name, "nb_NO")
+ compare(control.item6_5.locale.name, "nb_NO")
+ compare(control.localespy_5.count, 1)
+ compare(control.mirroredspy_5.count, 0)
+
+ control.locale = Qt.locale("ar_EG")
+ control.localespy.wait()
+ compare(control.localespy.count, 2)
+ compare(control.mirroredspy.count, 1)
+ compare(control.locale.name, "ar_EG")
+ compare(control.item6_5.locale.name, "ar_EG")
+ compare(control.localespy_5.count, 2)
+ compare(control.mirroredspy_5.count, 1)
+ }
+
+ function test_focusReason_data() {
+ return [
+ { tag: "Control", qml: "import Qt.labs.controls 1.0; Control { }" },
+ { tag: "TextField", qml: "import Qt.labs.controls 1.0; TextField { }" },
+ { tag: "TextArea", qml: "import Qt.labs.controls 1.0; TextArea { }" },
+ { tag: "SpinBox", qml: "import Qt.labs.controls 1.0; SpinBox { }" },
+ { tag: "ComboBox", qml: "import Qt.labs.controls 1.0; ComboBox { }" }
+ ]
+ }
+
+ function test_focusReason(data) {
+ var control = Qt.createQmlObject(data.qml, testCase)
+ verify(control)
+
+ compare(control.focusReason, Qt.OtherFocusReason)
+ control.forceActiveFocus(Qt.MouseFocusReason)
+ compare(control.activeFocus, true)
+ compare(control.focusReason, Qt.MouseFocusReason)
+
+ testCase.forceActiveFocus(Qt.TabFocusReason)
+ compare(control.activeFocus, false)
+ compare(control.focusReason, Qt.TabFocusReason)
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_itemdelegate.qml b/tests/auto/controls/data/tst_itemdelegate.qml
new file mode 100644
index 00000000..e2f78ac5
--- /dev/null
+++ b/tests/auto/controls/data/tst_itemdelegate.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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.2
+import QtTest 1.0
+import Qt.labs.controls 1.0
+
+TestCase {
+ id: testCase
+ width: 200
+ height: 200
+ visible: true
+ when: windowShown
+ name: "ItemDelegate"
+
+ Component {
+ id: itemDelegate
+ ItemDelegate { }
+ }
+
+ function test_baseline() {
+ var control = itemDelegate.createObject(testCase)
+ verify(control)
+ compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ control.destroy()
+ }
+}
diff --git a/tests/auto/controls/data/tst_menuitem.qml b/tests/auto/controls/data/tst_menuitem.qml
new file mode 100644
index 00000000..8581a43f
--- /dev/null
+++ b/tests/auto/controls/data/tst_menuitem.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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.2
+import QtTest 1.0
+import Qt.labs.controls 1.0
+
+TestCase {
+ id: testCase
+ width: 200
+ height: 200
+ visible: true
+ when: windowShown
+ name: "MenuItem"
+
+ Component {
+ id: menuItem
+ MenuItem { }
+ }
+
+ function test_baseline() {
+ var control = menuItem.createObject(testCase)
+ verify(control)
+ compare(control.baselineOffset, control.label.y + control.label.baselineOffset)
+ control.destroy()
+ }
+}
diff --git a/tests/auto/controls/data/tst_pane.qml b/tests/auto/controls/data/tst_pane.qml
new file mode 100644
index 00000000..18fd1cf0
--- /dev/null
+++ b/tests/auto/controls/data/tst_pane.qml
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 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.2
+import QtTest 1.0
+import Qt.labs.controls 1.0
+
+TestCase {
+ id: testCase
+ width: 400
+ height: 400
+ visible: true
+ when: windowShown
+ name: "Pane"
+
+ Component {
+ id: pane
+ Pane { }
+ }
+
+ Component {
+ id: oneChildPane
+ GroupBox {
+ Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ }
+ }
+
+ Component {
+ id: twoChildrenPane
+ GroupBox {
+ Item {
+ implicitWidth: 100
+ implicitHeight: 30
+ }
+ Item {
+ implicitWidth: 200
+ implicitHeight: 60
+ }
+ }
+ }
+
+ Component {
+ id: pressPane
+ MouseArea {
+ width: 200
+ height: 200
+ property int pressCount
+ onPressed: ++pressCount
+ Pane {
+ anchors.fill: parent
+ }
+ }
+ }
+
+ function test_empty() {
+ var control = pane.createObject(testCase)
+ verify(control)
+
+ verify(control.contentItem)
+ compare(control.contentWidth, 0)
+ compare(control.contentHeight, 0)
+
+ control.destroy()
+ }
+
+ function test_oneChild() {
+ var control = oneChildPane.createObject(testCase)
+ verify(control)
+
+ compare(control.contentWidth, 100)
+ compare(control.contentHeight, 30)
+ verify(control.implicitWidth > 100)
+ verify(control.implicitHeight > 30)
+
+ control.destroy()
+ }
+
+ function test_twoChildren() {
+ var control = twoChildrenPane.createObject(testCase)
+ verify(control)
+
+ compare(control.contentWidth, 0)
+ compare(control.contentHeight, 0)
+ verify(control.implicitWidth > 0)
+ verify(control.implicitHeight > 0)
+
+ control.destroy()
+ }
+
+ function test_press() {
+ var control = pressPane.createObject(testCase)
+ verify(control)
+
+ compare(control.pressCount, 0)
+ mouseClick(control)
+ compare(control.pressCount, 0)
+
+ control.children[0].enabled = false
+ mouseClick(control)
+ compare(control.pressCount, 1)
+
+ control.destroy()
+ }
+}
diff --git a/tests/auto/controls/data/tst_progressbar.qml b/tests/auto/controls/data/tst_progressbar.qml
index ed09f5e9..d5ee3e52 100644
--- a/tests/auto/controls/data/tst_progressbar.qml
+++ b/tests/auto/controls/data/tst_progressbar.qml
@@ -159,18 +159,26 @@ TestCase {
compare(control.value, 0.25)
compare(control.visualPosition, 0.25)
- control.layoutDirection = Qt.RightToLeft
+ // RTL locale
+ control.locale = Qt.locale("ar_EG")
compare(control.visualPosition, 0.75)
+ // RTL locale + LayoutMirroring
control.LayoutMirroring.enabled = true
- compare(control.visualPosition, 0.25)
+ compare(control.visualPosition, 0.75)
- control.layoutDirection = Qt.LeftToRight
+ // LTR locale + LayoutMirroring
+ control.locale = Qt.locale("en_US")
compare(control.visualPosition, 0.75)
+ // LTR locale
control.LayoutMirroring.enabled = false
compare(control.visualPosition, 0.25)
+ // LayoutMirroring
+ control.LayoutMirroring.enabled = true
+ compare(control.visualPosition, 0.75)
+
control.destroy()
}
}
diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml
index 345013f2..2a77d205 100644
--- a/tests/auto/controls/data/tst_rangeslider.qml
+++ b/tests/auto/controls/data/tst_rangeslider.qml
@@ -251,22 +251,31 @@ TestCase {
compare(control.second.position, 1.0)
compare(control.second.visualPosition, 1.0)
- control.layoutDirection = Qt.RightToLeft
+ // RTL locale
+ control.locale = Qt.locale("ar_EG")
compare(control.first.visualPosition, 0.75)
compare(control.second.visualPosition, 0.0)
+ // RTL locale + LayoutMirroring
control.LayoutMirroring.enabled = true
- compare(control.first.visualPosition, 0.25)
- compare(control.second.visualPosition, 1.0)
+ compare(control.first.visualPosition, 0.75)
+ compare(control.second.visualPosition, 0.0)
- control.layoutDirection = Qt.LeftToRight
+ // LTR locale + LayoutMirroring
+ control.locale = Qt.locale("en_US")
compare(control.first.visualPosition, 0.75)
compare(control.second.visualPosition, 0.0)
+ // LTR locale
control.LayoutMirroring.enabled = false
compare(control.first.visualPosition, 0.25)
compare(control.second.visualPosition, 1.0)
+ // LayoutMirroring
+ control.LayoutMirroring.enabled = true
+ compare(control.first.visualPosition, 0.75)
+ compare(control.second.visualPosition, 0.0)
+
control.destroy()
}
@@ -545,7 +554,7 @@ TestCase {
// RTL
control.first.value = 0
- control.layoutDirection = Qt.RightToLeft
+ control.locale = Qt.locale("ar_EG")
mousePress(control, control.first.handle.x, control.first.handle.y, Qt.LeftButton)
compare(firstPressedSpy.count, 3)
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index e497636c..5957442f 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -185,18 +185,26 @@ TestCase {
compare(control.value, 0.25)
compare(control.visualPosition, 0.25)
- control.layoutDirection = Qt.RightToLeft
+ // RTL locale
+ control.locale = Qt.locale("ar_EG")
compare(control.visualPosition, 0.75)
+ // RTL locale + LayoutMirroring
control.LayoutMirroring.enabled = true
- compare(control.visualPosition, 0.25)
+ compare(control.visualPosition, 0.75)
- control.layoutDirection = Qt.LeftToRight
+ // LTR locale + LayoutMirroring
+ control.locale = Qt.locale("en_US")
compare(control.visualPosition, 0.75)
+ // LTR locale
control.LayoutMirroring.enabled = false
compare(control.visualPosition, 0.25)
+ // LayoutMirroring
+ control.LayoutMirroring.enabled = true
+ compare(control.visualPosition, 0.75)
+
control.destroy()
}
@@ -399,7 +407,7 @@ TestCase {
// RTL
control.value = 0
- control.layoutDirection = Qt.RightToLeft
+ control.locale = Qt.locale("ar_EG")
mousePress(control, 0, 0, Qt.LeftButton)
compare(pressedSpy.count, 3)
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index b5d85dbd..a2ab5a4a 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -298,4 +298,11 @@ TestCase {
control.destroy()
}
+
+ function test_baseline() {
+ var control = spinBox.createObject(testCase)
+ verify(control)
+ compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset)
+ control.destroy()
+ }
}
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index 23eaf317..2eb802bf 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -459,6 +459,22 @@ TestCase {
compare(control.depth, 1)
compare(control.currentItem, item6)
+ // replace the topmost item
+ control.push(component)
+ compare(control.depth, 2)
+ var item7 = control.replace(control.get(1), component, StackView.Immediate)
+ compare(control.depth, 2)
+ compare(control.currentItem, item7)
+
+ // replace the item in the middle
+ control.push(component)
+ control.push(component)
+ control.push(component)
+ compare(control.depth, 5)
+ var item8 = control.replace(control.get(2), component, StackView.Immediate)
+ compare(control.depth, 3)
+ compare(control.currentItem, item8)
+
control.destroy()
}
@@ -744,4 +760,40 @@ TestCase {
control.destroy()
}
+
+ function test_failures() {
+ var control = stackView.createObject(testCase, {initialItem: component})
+ verify(control)
+
+ ignoreWarning("QQmlComponent: Component is not ready")
+ ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 File not found")
+ control.push(Qt.resolvedUrl("non-existent.qml"))
+
+ ignoreWarning("QQmlComponent: Component is not ready")
+ ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 File not found")
+ control.replace(Qt.resolvedUrl("non-existent.qml"))
+
+ control.pop()
+
+ control.destroy()
+ }
+
+ Component {
+ id: rectangle
+ Rectangle {
+ property color initialColor
+ Component.onCompleted: initialColor = color
+ }
+ }
+
+ function test_properties() {
+ var control = stackView.createObject(testCase)
+ verify(control)
+
+ var rect = control.push(rectangle, {color: "#ff0000"})
+ compare(rect.color, "#ff0000")
+ compare(rect.initialColor, "#ff0000")
+
+ control.destroy()
+ }
}
diff --git a/tests/auto/menu/data/applicationwindow.qml b/tests/auto/menu/data/applicationwindow.qml
index 6855d66e..cb55e3f6 100644
--- a/tests/auto/menu/data/applicationwindow.qml
+++ b/tests/auto/menu/data/applicationwindow.qml
@@ -76,6 +76,6 @@ ApplicationWindow {
x: 250
visible: false
text: "Open Menu"
- onClicked: menu.show()
+ onClicked: menu.open()
}
}
diff --git a/tests/auto/menu/tst_menu.cpp b/tests/auto/menu/tst_menu.cpp
index 226a8588..3a2d9c61 100644
--- a/tests/auto/menu/tst_menu.cpp
+++ b/tests/auto/menu/tst_menu.cpp
@@ -46,34 +46,13 @@
#include "../shared/visualtestutil.h"
#include <QtLabsTemplates/private/qquickapplicationwindow_p.h>
+#include <QtLabsTemplates/private/qquickoverlay_p.h>
#include <QtLabsTemplates/private/qquickbutton_p.h>
#include <QtLabsTemplates/private/qquickmenu_p.h>
#include <QtLabsTemplates/private/qquickmenuitem_p.h>
using namespace QQuickVisualTestUtil;
-class ApplicationHelper
-{
-public:
- ApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath = QLatin1String("applicationwindow.qml")) :
- component(&engine)
- {
- component.loadUrl(testCase->testFileUrl(testFilePath));
- QObject *rootObject = component.create();
- cleanup.reset(rootObject);
- QVERIFY2(rootObject, qPrintable(QString::fromLatin1("Failed to create ApplicationWindow: %1").arg(component.errorString())));
-
- window = qobject_cast<QQuickApplicationWindow*>(rootObject);
- QVERIFY(window);
- QVERIFY(!window->isVisible());
- }
-
- QQmlEngine engine;
- QQmlComponent component;
- QScopedPointer<QObject> cleanup;
- QQuickApplicationWindow *window;
-};
-
class tst_menu : public QQmlDataTest
{
Q_OBJECT
@@ -89,7 +68,7 @@ private slots:
void tst_menu::defaults()
{
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickMenu *emptyMenu = helper.window->property("emptyMenu").value<QQuickMenu*>();
QCOMPARE(emptyMenu->isVisible(), false);
@@ -98,14 +77,14 @@ void tst_menu::defaults()
void tst_menu::mouse()
{
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickApplicationWindow *window = helper.window;
window->show();
QVERIFY(QTest::qWaitForWindowActive(window));
QQuickMenu *menu = window->property("menu").value<QQuickMenu*>();
- menu->show();
+ menu->open();
QVERIFY(menu->isVisible());
QVERIFY(window->overlay()->childItems().contains(menu->contentItem()));
@@ -129,7 +108,7 @@ void tst_menu::mouse()
QVERIFY(!window->overlay()->childItems().contains(menu->contentItem()));
QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1));
- menu->show();
+ menu->open();
QCOMPARE(visibleSpy.count(), 2);
QVERIFY(menu->isVisible());
QVERIFY(window->overlay()->childItems().contains(menu->contentItem()));
@@ -143,13 +122,13 @@ void tst_menu::mouse()
QVERIFY(!menu->isVisible());
QVERIFY(!window->overlay()->childItems().contains(menu->contentItem()));
- menu->show();
+ menu->open();
QCOMPARE(visibleSpy.count(), 4);
QVERIFY(menu->isVisible());
QVERIFY(window->overlay()->childItems().contains(menu->contentItem()));
// Try pressing within the menu and releasing outside of it; it should close.
- // TODO: won't work until QQuickPanel::releasedOutside() actually gets emitted
+ // TODO: won't work until QQuickPopup::releasedOutside() actually gets emitted
// QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(firstItem->width() / 2, firstItem->height() / 2));
// QVERIFY(firstItem->hasActiveFocus());
// QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(0));
@@ -170,7 +149,7 @@ void tst_menu::contextMenuKeyboard()
if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls)
QSKIP("This platform only allows tab focus for text controls");
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickApplicationWindow *window = helper.window;
window->show();
@@ -185,7 +164,7 @@ void tst_menu::contextMenuKeyboard()
QSignalSpy visibleSpy(menu, SIGNAL(visibleChanged()));
menu->setFocus(true);
- menu->show();
+ menu->open();
QCOMPARE(visibleSpy.count(), 1);
QVERIFY(menu->isVisible());
QVERIFY(window->overlay()->childItems().contains(menu->contentItem()));
@@ -212,7 +191,7 @@ void tst_menu::contextMenuKeyboard()
QVERIFY(!secondItem->hasActiveFocus());
QCOMPARE(menu->contentItem()->property("currentIndex"), QVariant(-1));
- menu->show();
+ menu->open();
QCOMPARE(visibleSpy.count(), 3);
QVERIFY(menu->isVisible());
QVERIFY(window->overlay()->childItems().contains(menu->contentItem()));
@@ -237,6 +216,10 @@ void tst_menu::contextMenuKeyboard()
QVERIFY(!firstItem->hasActiveFocus());
QVERIFY(!secondItem->hasActiveFocus());
QVERIFY(thirdItem->hasActiveFocus());
+
+ QTest::keyClick(window, Qt::Key_Escape);
+ QCOMPARE(visibleSpy.count(), 4);
+ QVERIFY(!menu->isVisible());
}
void tst_menu::menuButton()
@@ -244,7 +227,7 @@ void tst_menu::menuButton()
if (QGuiApplication::styleHints()->tabFocusBehavior() != Qt::TabFocusAllControls)
QSKIP("This platform only allows tab focus for text controls");
- ApplicationHelper helper(this);
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
QQuickApplicationWindow *window = helper.window;
window->show();
diff --git a/tests/auto/sanity/BLACKLIST b/tests/auto/sanity/BLACKLIST
index 02e9a5f9..5a000c5c 100644
--- a/tests/auto/sanity/BLACKLIST
+++ b/tests/auto/sanity/BLACKLIST
@@ -2,3 +2,9 @@
*
[signalHandlers:material/TextField.qml]
*
+[attachedObjects:controls/ComboBox.qml]
+*
+[attachedObjects:material/ComboBox.qml]
+*
+[attachedObjects:universal/ComboBox.qml]
+*
diff --git a/tests/auto/shared/util.pri b/tests/auto/shared/util.pri
index 747bdf64..5e6b06b6 100644
--- a/tests/auto/shared/util.pri
+++ b/tests/auto/shared/util.pri
@@ -1,4 +1,4 @@
-QT += core-private gui-private qml-private quick-private
+QT += core-private gui-private qml-private quick-private labstemplates-private
HEADERS += $$PWD/visualtestutil.h \
$$PWD/util.h
diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h
index 7a35ac76..b3fecf8e 100644
--- a/tests/auto/shared/visualtestutil.h
+++ b/tests/auto/shared/visualtestutil.h
@@ -42,6 +42,10 @@
#include <QtQuick/private/qquickitem_p.h>
+#include <QtLabsTemplates/private/qquickapplicationwindow_p.h>
+
+#include "util.h"
+
namespace QQuickVisualTestUtil
{
QQuickItem *findVisibleChild(QQuickItem *parent, const QString &objectName);
@@ -104,6 +108,28 @@ namespace QQuickVisualTestUtil
items << qobject_cast<QQuickItem*>(findItem<T>(parent, objectName, indexes[i]));
return items;
}
+
+ class QQuickApplicationHelper
+ {
+ public:
+ QQuickApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath) :
+ component(&engine)
+ {
+ component.loadUrl(testCase->testFileUrl(testFilePath));
+ QObject *rootObject = component.create();
+ cleanup.reset(rootObject);
+ QVERIFY2(rootObject, qPrintable(QString::fromLatin1("Failed to create ApplicationWindow: %1").arg(component.errorString())));
+
+ window = qobject_cast<QQuickApplicationWindow*>(rootObject);
+ QVERIFY(window);
+ QVERIFY(!window->isVisible());
+ }
+
+ QQmlEngine engine;
+ QQmlComponent component;
+ QScopedPointer<QObject> cleanup;
+ QQuickApplicationWindow *window;
+ };
}
#define QQUICK_VERIFY_POLISH(item) \
diff --git a/tests/auto/universal/data/tst_universal.qml b/tests/auto/universal/data/tst_universal.qml
index 912b2117..5c29f33c 100644
--- a/tests/auto/universal/data/tst_universal.qml
+++ b/tests/auto/universal/data/tst_universal.qml
@@ -98,7 +98,7 @@ TestCase {
var control = button.createObject(testCase)
verify(control)
verify(control.Universal)
- compare(control.Universal.accent, Universal.Cobalt)
+ compare(control.Universal.accent, "#3e65ff") // Universal.Cobalt
compare(control.Universal.theme, Universal.Light)
control.destroy()
}
@@ -108,7 +108,7 @@ TestCase {
verify(control)
control.Universal.accent = Universal.Steel
control.Universal.theme = Universal.Dark
- compare(control.Universal.accent, Universal.Steel)
+ compare(control.Universal.accent, "#647687") // Universal.Steel
compare(control.Universal.theme, Universal.Dark)
control.destroy()
}
@@ -116,7 +116,7 @@ TestCase {
function test_reset() {
var control = styledButton.createObject(testCase)
verify(control)
- compare(control.Universal.accent, Universal.Violet)
+ compare(control.Universal.accent, "#aa00ff") // Universal.Violet
compare(control.Universal.theme, Universal.Dark)
control.Universal.accent = undefined
control.Universal.theme = undefined
@@ -127,7 +127,7 @@ TestCase {
function test_inheritance_data() {
return [
- { tag: "accent", value1: Universal.Crimson, value2: Universal.Indigo },
+ { tag: "accent", value1: "#a20025" /*Universal.Crimson*/, value2: "#6a00ff" /*Universal.Indigo*/ },
{ tag: "theme", value1: Universal.Dark, value2: Universal.Light },
]
}
@@ -192,7 +192,7 @@ TestCase {
compare(unstyledChild.Universal.theme, parent.Universal.theme)
parent.Universal.accent = Universal.Cyan
- compare(control.Universal.accent, Universal.Cyan)
+ compare(control.Universal.accent, "#1ba1e2") // Universal.Cyan
verify(styledChild.Universal.accent !== Universal.Cyan)
// ### TODO: compare(unstyledChild.Universal.accent, Universal.Cyan)
@@ -203,13 +203,13 @@ TestCase {
var control = loader.createObject(testCase)
control.Universal.accent = Universal.Lime
control.active = true
- compare(control.item.Universal.accent, Universal.Lime)
+ compare(control.item.Universal.accent, "#a4c400") // Universal.Lime
control.Universal.accent = Universal.Pink
- compare(control.item.Universal.accent, Universal.Pink)
+ compare(control.item.Universal.accent, "#f472d0") // Universal.Pink
control.active = false
control.Universal.accent = Universal.Brown
control.active = true
- compare(control.item.Universal.accent, Universal.Brown)
+ compare(control.item.Universal.accent, "#825a2c") // Universal.Brown
control.destroy()
}
@@ -222,4 +222,47 @@ TestCase {
compare(child.Universal.theme, Universal.Dark)
control.destroy()
}
+
+ function test_colors() {
+ var control = button.createObject(testCase)
+ verify(control)
+
+ // Universal.Accent - enum
+ control.Universal.accent = Universal.Red
+ compare(control.Universal.accent, "#e51400")
+
+ // Universal.Accent - string
+ control.Universal.accent = "Emerald"
+ compare(control.Universal.accent, "#008a00")
+
+ // SVG named color
+ control.Universal.accent = "tomato"
+ compare(control.Universal.accent, "#ff6347")
+
+ // #rrggbb
+ control.Universal.accent = "#123456"
+ compare(control.Universal.accent, "#123456")
+
+ // #aarrggbb
+ control.Universal.accent = "#12345678"
+ compare(control.Universal.accent, "#12345678")
+
+ // Qt.rgba() - no alpha
+ control.Universal.accent = Qt.rgba(0.5, 0.5, 0.5)
+ compare(control.Universal.accent, "#808080")
+
+ // Qt.rgba() - with alpha
+ control.Universal.accent = Qt.rgba(0.5, 0.5, 0.5, 0.5)
+ compare(control.Universal.accent, "#80808080")
+
+ // unknown
+ ignoreWarning("QQuickUniversalStyle: unknown accent 123")
+ control.Universal.accent = 123
+ ignoreWarning("QQuickUniversalStyle: unknown accent \"foo\"")
+ control.Universal.accent = "foo"
+ ignoreWarning("QQuickUniversalStyle: unknown accent \"#1\"")
+ control.Universal.accent = "#1"
+
+ control.destroy()
+ }
}
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index 2d14e9eb..b479b0e2 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -64,9 +64,6 @@ private slots:
void calendar();
void calendar_data();
- void legacy();
- void legacy_data();
-
void controls();
void controls_data();
@@ -167,73 +164,6 @@ void tst_ObjectCount::calendar_data()
addTestRows(&engine, "/calendar");
}
-void tst_ObjectCount::legacy()
-{
- QFETCH(QByteArray, data);
-
- QQmlComponent component(&engine);
-
- qt_qobjects->clear();
-
- component.setData(data, QUrl());
- QScopedPointer<QObject> object(component.create());
- QVERIFY2(object.data(), qPrintable(component.errorString()));
-
- QList<QQuickItem *> items;
- foreach (QObject *object, *qt_qobjects()) {
- QQuickItem *item = qobject_cast<QQuickItem *>(object);
- if (item)
- items += item;
- }
- printItems(items);
-}
-
-void tst_ObjectCount::legacy_data()
-{
- QTest::addColumn<QByteArray>("data");
-
- QTest::newRow("ApplicationWindow")
- << QByteArray("import QtQuick.Controls 1.3; ApplicationWindow { }");
- QTest::newRow("BusyIndicator")
- << QByteArray("import QtQuick.Controls 1.3; BusyIndicator { }");
- QTest::newRow("Button")
- << QByteArray("import QtQuick.Controls 1.3; Button { }");
- QTest::newRow("CheckBox")
- << QByteArray("import QtQuick.Controls 1.3; CheckBox { }");
- QTest::newRow("Dial")
- << QByteArray("import QtQuick.Extras 1.3; Dial { }");
- QTest::newRow("GroupBox")
- << QByteArray("import QtQuick.Controls 1.3; GroupBox { }");
- QTest::newRow("Label")
- << QByteArray("import QtQuick.Controls 1.3; Label { }");
- QTest::newRow("ProgressBar")
- << QByteArray("import QtQuick.Controls 1.3; ProgressBar { }");
- QTest::newRow("RadioButton")
- << QByteArray("import QtQuick.Controls 1.3; RadioButton { }");
- QTest::newRow("ScrollView")
- << QByteArray("import QtQuick.Controls 1.3; ScrollView { }");
- QTest::newRow("Slider")
- << QByteArray("import QtQuick.Controls 1.3; Slider { }");
- QTest::newRow("SpinBox")
- << QByteArray("import QtQuick.Controls 1.3; SpinBox { }");
- QTest::newRow("StackView")
- << QByteArray("import QtQuick.Controls 1.3; StackView { }");
- QTest::newRow("Switch")
- << QByteArray("import QtQuick.Controls 1.3; Switch { }");
- QTest::newRow("TabView")
- << QByteArray("import QtQuick.Controls 1.3; TabView { }");
- QTest::newRow("TextArea")
- << QByteArray("import QtQuick.Controls 1.3; TextArea { }");
- QTest::newRow("TextField")
- << QByteArray("import QtQuick.Controls 1.3; TextField { }");
- QTest::newRow("ToolBar")
- << QByteArray("import QtQuick.Controls 1.3; ToolBar { }");
- QTest::newRow("ToolButton")
- << QByteArray("import QtQuick.Controls 1.3; ToolButton { }");
- QTest::newRow("Tumbler")
- << QByteArray("import QtQuick.Extras 1.3; Tumbler { }");
-}
-
void tst_ObjectCount::controls()
{
QFETCH(QUrl, url);
diff --git a/tests/manual/gifs/data/qtlabscontrols-switch.qml b/tests/manual/gifs/data/qtlabscontrols-switch.qml
index 3968b60f..f6067c1b 100644
--- a/tests/manual/gifs/data/qtlabscontrols-switch.qml
+++ b/tests/manual/gifs/data/qtlabscontrols-switch.qml
@@ -43,8 +43,8 @@ import QtQuick.Window 2.0
import Qt.labs.controls 1.0
Window {
- width: theSwitch.width
- height: theSwitch.height
+ width: 100
+ height: 50
visible: true
Switch {
diff --git a/tests/manual/gifs/gifrecorder.cpp b/tests/manual/gifs/gifrecorder.cpp
index 617ce506..3ba33552 100644
--- a/tests/manual/gifs/gifrecorder.cpp
+++ b/tests/manual/gifs/gifrecorder.cpp
@@ -183,6 +183,10 @@ void GifRecorder::start()
mWindow->show();
mWindow->requestActivate();
QVERIFY(QTest::qWaitForWindowActive(mWindow, 500));
+ QVERIFY(QTest::qWaitForWindowExposed(mWindow, 500));
+ // For some reason, whatever is behind the window is sometimes
+ // in the recording, so add this delay to be extra sure that it isn't.
+ QTest::qWait(200);
if (mOutputFileBaseName.isEmpty()) {
mOutputFileBaseName = mOutputDir.absoluteFilePath(mQmlInputFileName);
@@ -198,11 +202,12 @@ void GifRecorder::start()
mByzanzOutputFileName.append(QLatin1String(".gif"));
}
+ const QPoint globalWindowPos = mWindow->mapToGlobal(QPoint(0, 0));
QString args = QLatin1String("-d %1 -v %2 -x %3 -y %4 -w %5 -h %6 %7");
args = args.arg(QString::number(mRecordingDuration))
.arg(mRecordCursor ? QStringLiteral("-c") : QString())
- .arg(QString::number(mWindow->x()))
- .arg(QString::number(mWindow->y()))
+ .arg(QString::number(globalWindowPos.x()))
+ .arg(QString::number(globalWindowPos.y()))
.arg(QString::number(mWindow->width()))
.arg(QString::number(mWindow->height()))
.arg(mByzanzOutputFileName);
diff --git a/tests/manual/gifs/tst_gifs.cpp b/tests/manual/gifs/tst_gifs.cpp
index bd0cc61f..7f2a985c 100644
--- a/tests/manual/gifs/tst_gifs.cpp
+++ b/tests/manual/gifs/tst_gifs.cpp
@@ -165,7 +165,7 @@ void tst_Gifs::slider()
GifRecorder gifRecorder;
gifRecorder.setDataDirPath(dataDirPath);
gifRecorder.setOutputDir(outputDir);
- gifRecorder.setRecordingDuration(4);
+ gifRecorder.setRecordingDuration(5);
gifRecorder.setHighQuality(true);
gifRecorder.setQmlFileName("qtlabscontrols-slider.qml");
@@ -202,7 +202,7 @@ void tst_Gifs::rangeSlider()
GifRecorder gifRecorder;
gifRecorder.setDataDirPath(dataDirPath);
gifRecorder.setOutputDir(outputDir);
- gifRecorder.setRecordingDuration(6);
+ gifRecorder.setRecordingDuration(7);
gifRecorder.setHighQuality(true);
gifRecorder.setQmlFileName("qtlabscontrols-rangeslider.qml");
diff --git a/tests/manual/testbench/main.cpp b/tests/manual/testbench/main.cpp
index b6eec8d8..e0f975fe 100644
--- a/tests/manual/testbench/main.cpp
+++ b/tests/manual/testbench/main.cpp
@@ -52,8 +52,7 @@ int main(int argc, char *argv[])
// These must be set before running.
// TODO: move style selection into app UI and use settings to save choices.
- // qsetenv("QT_QUICK_FILE_SELECTORS", "material");
- // qsetenv("QT_LABS_CONTROLS_STYLE", "material");
+ // qputenv("QT_LABS_CONTROLS_STYLE", "material");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/main.qml
index b375a098..edf0aa49 100644
--- a/tests/manual/testbench/main.qml
+++ b/tests/manual/testbench/main.qml
@@ -38,7 +38,7 @@
**
****************************************************************************/
-import QtQuick 2.3
+import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Layouts 1.0
import Qt.labs.controls 1.0
@@ -56,19 +56,35 @@ ApplicationWindow {
property int controlSpacing: 10
+ Shortcut {
+ sequence: "Ctrl+Q"
+ onActivated: Qt.quit()
+ }
+
header: ToolBar {
+ Material.theme: Material.Dark
+
RowLayout {
anchors.fill: parent
ToolButton {
text: "Normal"
- onClicked: menu.visible ? menu.hide() : menu.show()
+ onClicked: menu.visible ? menu.close() : menu.open()
}
ToolButton {
text: "Pressed"
pressed: true
}
ToolButton {
+ text: "Checked"
+ checkable: true
+ checked: true
+ }
+ ToolButton {
+ text: "Highlighted"
+ highlighted: true
+ }
+ ToolButton {
text: "Disabled"
enabled: false
}
@@ -105,407 +121,460 @@ ApplicationWindow {
MenuItem {
text: "Option 1"
+ checkable: true
}
MenuItem {
text: "Option 2"
+ checkable: true
}
MenuItem {
text: "Option 3"
+ checkable: true
}
}
- Flickable {
+ Pane {
anchors.fill: parent
- topMargin: 30
- leftMargin: 30
- rightMargin: 30
- bottomMargin: 30
- contentHeight: flow.height
-
- Flow {
- id: flow
- width: parent.width
- spacing: 30
-
- RowLayout {
- spacing: window.controlSpacing
-
- Button {
- text: "Normal"
- }
- Button {
- text: "Pressed"
- pressed: true
- }
- Button {
- text: "Checked"
- checked: true
- }
- Button {
- text: "CH + PR"
- checked: true
- pressed: true
- }
- Button {
- text: "Disabled"
- enabled: false
- }
- Button {
- text: "CH + DIS"
- enabled: false
- checked: true
- }
- }
-
- RowLayout {
- spacing: window.controlSpacing
- Button {
- text: "HI"
- highlighted: true
- }
- Button {
- text: "HI + PR"
- highlighted: true
- pressed: true
- }
- Button {
- text: "HI + CH"
- highlighted: true
- checked: true
- }
- Button {
- text: "HI+CH+PR"
- highlighted: true
- pressed: true
- checked: true
- }
- Button {
- text: "HI + DIS"
- highlighted: true
- enabled: false
- }
- Button {
- text: "HI+CH+DIS"
- highlighted: true
- enabled: false
- checked: true
- }
- }
-
- RowLayout {
- CheckBox {
- text: "Normal"
- }
- CheckBox {
- text: "Pressed"
- pressed: true
- }
- CheckBox {
- text: "Checked"
- checked: true
- }
- CheckBox {
- text: "CH + PR"
- checked: true
- pressed: true
- }
- CheckBox {
- text: "Disabled"
- enabled: false
- }
- CheckBox {
- text: "CH + DIS"
- checked: true
- enabled: false
- }
- }
+ Flickable {
+ anchors.fill: parent
+ contentHeight: flow.height
- RowLayout {
- RadioButton {
- text: "Normal"
- }
- RadioButton {
- text: "Pressed"
- pressed: true
- }
- RadioButton {
- text: "Checked"
- checked: true
- }
- RadioButton {
- text: "CH + PR"
- checked: true
- pressed: true
- }
- RadioButton {
- text: "Disabled"
- enabled: false
- }
- RadioButton {
- text: "CH + DIS"
- checked: true
- enabled: false
- }
- }
+ Flow {
+ id: flow
+ width: parent.width
+ spacing: 30
- RowLayout {
- Switch {
- text: "Normal"
- }
- Switch {
- text: "Pressed"
- pressed: true
- }
- Switch {
- text: "Checked"
- checked: true
- }
- Switch {
- text: "CH + PR"
- checked: true
- pressed: true
- }
- Switch {
- text: "Disabled"
- enabled: false
- }
- }
+ RowLayout {
+ spacing: window.controlSpacing
- RowLayout {
- ProgressBar {
- value: 0.5
- }
- ProgressBar {
- value: 0.5
- indeterminate: true
- }
- ProgressBar {
- value: 0.5
- enabled: false
+ Button {
+ text: "Normal"
+ }
+ Button {
+ text: "Pressed"
+ pressed: true
+ }
+ Button {
+ text: "Checked"
+ checked: true
+ }
+ Button {
+ text: "CH + PR"
+ checked: true
+ pressed: true
+ }
+ Button {
+ text: "Disabled"
+ enabled: false
+ }
+ Button {
+ text: "CH + DIS"
+ enabled: false
+ checked: true
+ }
}
- }
- RowLayout {
- Slider {
- value: 0.5
- }
- Slider {
- value: 0.5
- pressed: true
- }
- Slider {
- value: 0.5
- enabled: false
- }
- }
+ RowLayout {
+ spacing: window.controlSpacing
- RowLayout {
- RangeSlider {
- first.value: 0.25
- second.value: 0.75
- }
- RangeSlider {
- first.value: 0.25
- first.pressed: true
- second.value: 0.75
- }
- RangeSlider {
- first.value: 0.25
- second.value: 0.75
- enabled: false
+ Button {
+ text: "HI"
+ highlighted: true
+ }
+ Button {
+ text: "HI + PR"
+ highlighted: true
+ pressed: true
+ }
+ Button {
+ text: "HI + CH"
+ highlighted: true
+ checked: true
+ }
+ Button {
+ text: "HI+CH+PR"
+ highlighted: true
+ pressed: true
+ checked: true
+ }
+ Button {
+ text: "HI + DIS"
+ highlighted: true
+ enabled: false
+ }
+ Button {
+ text: "HI+CH+DIS"
+ highlighted: true
+ enabled: false
+ checked: true
+ }
}
- }
-
- RowLayout {
- Item {
- implicitWidth: normalGroupBox.width
- implicitHeight: normalTextArea.implicitHeight
- TextArea {
- id: normalTextArea
+ RowLayout {
+ CheckBox {
text: "Normal"
}
- }
- Item {
- implicitWidth: normalGroupBox.width
- implicitHeight: normalTextArea.implicitHeight
-
- TextArea {
- text: "Placeholder"
+ CheckBox {
+ text: "Pressed"
+ pressed: true
}
- }
- Item {
- implicitWidth: normalGroupBox.width
- implicitHeight: normalTextArea.implicitHeight
-
- TextArea {
+ CheckBox {
+ text: "Checked"
+ checked: true
+ }
+ CheckBox {
+ text: "CH + PR"
+ checked: true
+ pressed: true
+ }
+ CheckBox {
text: "Disabled"
enabled: false
}
+ CheckBox {
+ text: "CH + DIS"
+ checked: true
+ enabled: false
+ }
}
- }
-
- RowLayout {
- Item {
- implicitWidth: normalGroupBox.implicitWidth
- implicitHeight: normalTextField.implicitHeight
- TextField {
- id: normalTextField
+ RowLayout {
+ RadioButton {
text: "Normal"
}
- }
- Item {
- implicitWidth: normalGroupBox.implicitWidth
- implicitHeight: normalTextField.implicitHeight
-
- TextField {
- placeholderText: "Placeholder"
+ RadioButton {
+ text: "Pressed"
+ pressed: true
+ }
+ RadioButton {
+ text: "Checked"
+ checked: true
+ }
+ RadioButton {
+ text: "CH + PR"
+ checked: true
+ pressed: true
+ }
+ RadioButton {
+ text: "Disabled"
+ enabled: false
+ }
+ RadioButton {
+ text: "CH + DIS"
+ checked: true
+ enabled: false
}
}
- Item {
- implicitWidth: normalGroupBox.implicitWidth
- implicitHeight: normalTextField.implicitHeight
- TextField {
+ RowLayout {
+ Switch {
+ text: "Normal"
+ }
+ Switch {
+ text: "Pressed"
+ pressed: true
+ }
+ Switch {
+ text: "Checked"
+ checked: true
+ }
+ Switch {
+ text: "CH + PR"
+ checked: true
+ pressed: true
+ }
+ Switch {
text: "Disabled"
enabled: false
}
}
- }
- RowLayout {
- Item {
- implicitWidth: normalGroupBox.implicitWidth
- implicitHeight: normalSpinBox.implicitHeight
-
- SpinBox {
- id: normalSpinBox
+ RowLayout {
+ ProgressBar {
+ value: 0.5
+ }
+ ProgressBar {
+ value: 0.5
+ indeterminate: true
+ }
+ ProgressBar {
+ value: 0.5
+ enabled: false
}
}
- Item {
- implicitWidth: normalGroupBox.implicitWidth
- implicitHeight: normalSpinBox.implicitHeight
- SpinBox {
- up.pressed: true
+ RowLayout {
+ Slider {
+ value: 0.5
+ }
+ Slider {
+ value: 0.5
+ pressed: true
+ }
+ Slider {
+ value: 0.5
+ enabled: false
}
}
- Item {
- implicitWidth: normalGroupBox.implicitWidth
- implicitHeight: normalSpinBox.implicitHeight
- SpinBox {
+ RowLayout {
+ RangeSlider {
+ first.value: 0.25
+ second.value: 0.75
+ }
+ RangeSlider {
+ first.value: 0.25
+ first.pressed: true
+ second.value: 0.75
+ }
+ RangeSlider {
+ first.value: 0.25
+ second.value: 0.75
enabled: false
}
}
- }
- RowLayout {
- GroupBox {
- id: normalGroupBox
- title: "Normal"
+ RowLayout {
+ Item {
+ implicitWidth: normalGroupBox.width
+ implicitHeight: normalTextArea.implicitHeight
+
+ TextArea {
+ id: normalTextArea
+ text: "Normal"
+ }
+ }
+ Item {
+ implicitWidth: normalGroupBox.width
+ implicitHeight: normalTextArea.implicitHeight
+ TextArea {
+ placeholderText: "Placeholder"
+ }
+ }
Item {
- implicitWidth: 200
- implicitHeight: 100
+ implicitWidth: normalGroupBox.width
+ implicitHeight: normalTextArea.implicitHeight
- BusyIndicator {
- anchors.centerIn: parent
+ TextArea {
+ text: "Disabled"
+ enabled: false
}
}
}
- GroupBox {
- enabled: false
- title: "Disabled"
+ RowLayout {
Item {
- implicitWidth: 200
- implicitHeight: 100
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalTextField.implicitHeight
- BusyIndicator {
- anchors.centerIn: parent
+ TextField {
+ id: normalTextField
+ text: "Normal"
}
}
- }
- GroupBox {
- enabled: false
- title: "."
- label.visible: false
+ Item {
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalTextField.implicitHeight
+ TextField {
+ placeholderText: "Placeholder"
+ }
+ }
Item {
- implicitWidth: 200
- implicitHeight: 100
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalTextField.implicitHeight
- PageIndicator {
- count: 5
+ TextField {
+ text: "Disabled"
enabled: false
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
}
}
}
- }
- RowLayout {
- Frame {
- id: scrollBarFrame
+ RowLayout {
+ Item {
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalSpinBox.implicitHeight
+ SpinBox {
+ id: normalSpinBox
+ }
+ }
Item {
- implicitWidth: 200
- implicitHeight: 100
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalSpinBox.implicitHeight
- Label {
- text: "Normal"
- anchors.centerIn: parent
+ SpinBox {
+ up.pressed: true
}
+ }
+ Item {
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalSpinBox.implicitHeight
- ScrollBar {
- size: 0.3
- position: 0.2
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
+ SpinBox {
+ enabled: false
}
}
}
- Frame {
+ RowLayout {
Item {
- implicitWidth: 200
- implicitHeight: 100
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalComboBox.implicitHeight
- Label {
- text: "Pressed"
- anchors.centerIn: parent
+ ComboBox {
+ id: normalComboBox
+ model: 5
}
+ }
- ScrollBar {
- size: 0.3
- position: 0.2
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
+ Item {
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalComboBox.implicitHeight
+
+ ComboBox {
pressed: true
+ model: ListModel {
+ ListElement { text: "Pressed" }
+ }
}
}
- }
- Frame {
Item {
- implicitWidth: 200
- implicitHeight: 100
+ implicitWidth: normalGroupBox.implicitWidth
+ implicitHeight: normalComboBox.implicitHeight
+
+ ComboBox {
+ enabled: false
+ model: ["Disabled"]
+ }
+ }
+ }
+
+ RowLayout {
+ GroupBox {
+ id: normalGroupBox
+ title: "Normal"
+
+ Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ BusyIndicator {
+ anchors.centerIn: parent
+ }
+ }
+ }
+ GroupBox {
enabled: false
+ title: "Disabled"
- Label {
- text: "Disabled"
- anchors.centerIn: parent
+ Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ BusyIndicator {
+ anchors.centerIn: parent
+ }
+ }
+ }
+ GroupBox {
+ enabled: false
+ title: "."
+ label.visible: false
+
+ Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ PageIndicator {
+ count: 5
+ enabled: false
+ anchors.bottom: parent.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ }
+ }
+ }
+
+ RowLayout {
+ Frame {
+ id: scrollBarFrame
+
+ Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ Label {
+ text: "Normal"
+ anchors.centerIn: parent
+ }
+
+ ScrollBar {
+ size: 0.3
+ position: 0.2
+ active: true
+ orientation: Qt.Vertical
+ height: parent.height
+ anchors.right: parent.right
+ }
+ }
+ }
+
+ Frame {
+ Item {
+ implicitWidth: 200
+ implicitHeight: 100
+
+ Label {
+ text: "Pressed"
+ anchors.centerIn: parent
+ }
+
+ ScrollBar {
+ size: 0.3
+ position: 0.2
+ active: true
+ orientation: Qt.Vertical
+ height: parent.height
+ anchors.right: parent.right
+ pressed: true
+ }
+ }
+ }
+
+ Frame {
+ Item {
+ implicitWidth: 200
+ implicitHeight: 100
+ enabled: false
+
+ Label {
+ text: "Disabled"
+ anchors.centerIn: parent
+ }
+
+ ScrollBar {
+ size: 0.3
+ position: 0.2
+ active: true
+ orientation: Qt.Vertical
+ height: parent.height
+ anchors.right: parent.right
+ }
}
+ }
+ }
+
+ RowLayout {
+ Frame {
+ Layout.preferredWidth: 100
+ Layout.preferredHeight: 100
- ScrollBar {
+ ScrollIndicator {
size: 0.3
position: 0.2
active: true
@@ -514,65 +583,49 @@ ApplicationWindow {
anchors.right: parent.right
}
}
- }
- }
- RowLayout {
- Frame {
- Layout.preferredWidth: 100
- Layout.preferredHeight: 100
+ Frame {
+ Layout.preferredWidth: 100
+ Layout.preferredHeight: 100
- ScrollIndicator {
- size: 0.3
- position: 0.2
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
+ ScrollIndicator {
+ size: 0.3
+ position: 0.2
+ active: true
+ orientation: Qt.Vertical
+ height: parent.height
+ anchors.right: parent.right
+ enabled: false
+ }
}
}
- Frame {
- Layout.preferredWidth: 100
- Layout.preferredHeight: 100
-
- ScrollIndicator {
- size: 0.3
- position: 0.2
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- enabled: false
+ RowLayout {
+ Frame {
+ Tumbler {
+ model: 5
+ implicitWidth: 100
+ implicitHeight: 100
+ }
+ }
+ Frame {
+ Tumbler {
+ model: 5
+ implicitWidth: 100
+ implicitHeight: 100
+ enabled: false
+ }
}
}
- }
- RowLayout {
- Frame {
- Tumbler {
- model: 5
- implicitWidth: 100
- implicitHeight: 100
+ RowLayout {
+ Dial {
}
- }
- Frame {
- Tumbler {
- model: 5
- implicitWidth: 100
- implicitHeight: 100
+ Dial {
enabled: false
}
}
}
-
- RowLayout {
- Dial {
- }
- Dial {
- enabled: false
- }
- }
}
}
}