aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.qmake.conf2
-rw-r--r--examples/quickcontrols2/wearable/images/background-dark.pngbin0 -> 44625 bytes
-rw-r--r--examples/quickcontrols2/wearable/images/background-light.png (renamed from examples/quickcontrols2/wearable/images/background.png)bin400411 -> 400411 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml10
-rw-r--r--examples/quickcontrols2/wearable/qml/DemoMode.qml258
-rw-r--r--examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml94
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml20
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark.pngbin0 -> 1693 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark@2x.pngbin0 -> 2694 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-running-light.png (renamed from examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png)bin16047 -> 16047 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-running-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Fitness/images/man-running@2x.png)bin2795 -> 2795 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark.pngbin0 -> 1631 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark@2x.pngbin0 -> 2483 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-light.png (renamed from examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png)bin16062 -> 16062 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Fitness/images/man-walking@2x.png)bin2668 -> 2668 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/LauncherPage.qml8
-rw-r--r--examples/quickcontrols2/wearable/qml/NaviButton.qml4
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml22
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml10
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark.pngbin0 -> 1940 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark@2x.pngbin0 -> 1583 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-light.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png)bin16111 -> 16111 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/leftturn@2x.png)bin2148 -> 2148 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark.pngbin0 -> 704 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark@2x.pngbin0 -> 1068 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/navigation-light.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/navigation.png)bin581 -> 581 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/navigation-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/navigation@2x.png)bin1063 -> 1063 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark.pngbin0 -> 1947 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark@2x.pngbin0 -> 1532 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-light.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png)bin16077 -> 16077 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/rightturn@2x.png)bin1613 -> 1613 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark.pngbin0 -> 1330 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark@2x.pngbin0 -> 911 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/straight-light.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/straight.png)bin15727 -> 15727 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Navigation/images/straight-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Navigation/images/straight@2x.png)bin790 -> 790 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml12
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark.pngbin0 -> 2130 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark@2x.pngbin0 -> 1928 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-light.png (renamed from examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png)bin16396 -> 16396 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Notifications/images/avatarf@2x.png)bin2183 -> 2183 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark.pngbin0 -> 1909 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark@2x.pngbin0 -> 1739 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-light.png (renamed from examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png)bin16198 -> 16198 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Notifications/images/avatarm@2x.png)bin2011 -> 2011 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark.pngbin0 -> 2273 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark@2x.pngbin0 -> 1727 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-light.png (renamed from examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png)bin2833 -> 2833 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Notifications/images/missedcall@2x.png)bin2685 -> 2685 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml67
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark.pngbin0 -> 1033 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark@2x.pngbin0 -> 3001 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-light.png (renamed from examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png)bin2770 -> 2770 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Settings/images/bluetooth@2x.png)bin4123 -> 4123 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark.pngbin0 -> 1522 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark@2x.pngbin0 -> 1443 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/brightness-light.png (renamed from examples/quickcontrols2/wearable/qml/Settings/images/brightness.png)bin2692 -> 2692 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/brightness-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Settings/images/brightness@2x.png)bin2320 -> 2320 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/contrast.pngbin2347 -> 0 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/contrast@2x.pngbin1930 -> 0 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.pngbin0 -> 1053 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.pngbin0 -> 1418 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.pngbin0 -> 1057 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.pngbin0 -> 1737 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.pngbin0 -> 825 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.pngbin0 -> 1318 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg93
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/theme-dark.pngbin0 -> 1433 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/theme-dark@2x.pngbin0 -> 2431 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/theme-light.pngbin0 -> 1628 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/theme-light@2x.pngbin0 -> 3340 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/theme.svg84
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark.pngbin0 -> 1749 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark@2x.pngbin0 -> 1388 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/wifi-light.png (renamed from examples/quickcontrols2/wearable/qml/Settings/images/wifi.png)bin16308 -> 16308 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Settings/images/wifi-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Settings/images/wifi@2x.png)bin2151 -> 2151 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml6
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/Slider.qml8
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/Switch.qml10
-rw-r--r--examples/quickcontrols2/wearable/qml/Style/UIStyle.qml25
-rw-r--r--examples/quickcontrols2/wearable/qml/SwipeViewPage.qml4
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml36
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark.pngbin0 -> 1907 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark@2x.pngbin0 -> 1749 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/humidity-light.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/humidity.png)bin16450 -> 16450 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/humidity-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/humidity@2x.png)bin3076 -> 3076 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark.pngbin0 -> 1735 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark@2x.pngbin0 -> 1938 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/pressure-light.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/pressure.png)bin16902 -> 16902 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/pressure-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/pressure@2x.png)bin3256 -> 3256 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark.pngbin0 -> 2036 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark@2x.pngbin0 -> 1575 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunrise-light.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png)bin16534 -> 16534 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunrise-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/sunrise@2x.png)bin2427 -> 2427 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark.pngbin0 -> 2055 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark@2x.pngbin0 -> 1603 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunset-light.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/sunset.png)bin16586 -> 16586 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/sunset-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/sunset@2x.png)bin2489 -> 2489 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark.pngbin0 -> 1471 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark@2x.pngbin0 -> 1255 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/temperature-light.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/temperature.png)bin2004 -> 2004 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/temperature-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/temperature@2x.png)bin1977 -> 1977 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/wind-dark.pngbin0 -> 1993 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/wind-dark@2x.pngbin0 -> 1464 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/wind-light.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/wind.png)bin16440 -> 16440 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/Weather/images/wind-light@2x.png (renamed from examples/quickcontrols2/wearable/qml/Weather/images/wind@2x.png)bin2309 -> 2309 bytes
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml6
-rw-r--r--examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml4
-rw-r--r--examples/quickcontrols2/wearable/wearable.cpp3
-rw-r--r--examples/quickcontrols2/wearable/wearable.qml52
-rw-r--r--examples/quickcontrols2/wearable/wearable.qrc125
-rw-r--r--src/imports/calendar/qtlabscalendarplugin.cpp8
-rw-r--r--src/imports/controls/AbstractButton.qml13
-rw-r--r--src/imports/controls/Action.qml4
-rw-r--r--src/imports/controls/ActionGroup.qml4
-rw-r--r--src/imports/controls/ApplicationWindow.qml8
-rw-r--r--src/imports/controls/BusyIndicator.qml14
-rw-r--r--src/imports/controls/Button.qml20
-rw-r--r--src/imports/controls/ButtonGroup.qml4
-rw-r--r--src/imports/controls/CheckBox.qml19
-rw-r--r--src/imports/controls/CheckDelegate.qml19
-rw-r--r--src/imports/controls/ComboBox.qml19
-rw-r--r--src/imports/controls/Container.qml12
-rw-r--r--src/imports/controls/Control.qml12
-rw-r--r--src/imports/controls/DelayButton.qml20
-rw-r--r--src/imports/controls/Dial.qml18
-rw-r--r--src/imports/controls/Dialog.qml27
-rw-r--r--src/imports/controls/DialogButtonBox.qml15
-rw-r--r--src/imports/controls/Drawer.qml17
-rw-r--r--src/imports/controls/Frame.qml17
-rw-r--r--src/imports/controls/GroupBox.qml22
-rw-r--r--src/imports/controls/ItemDelegate.qml19
-rw-r--r--src/imports/controls/Label.qml8
-rw-r--r--src/imports/controls/Menu.qml18
-rw-r--r--src/imports/controls/MenuBar.qml12
-rw-r--r--src/imports/controls/MenuBarItem.qml19
-rw-r--r--src/imports/controls/MenuItem.qml19
-rw-r--r--src/imports/controls/MenuSeparator.qml17
-rw-r--r--src/imports/controls/Page.qml23
-rw-r--r--src/imports/controls/PageIndicator.qml16
-rw-r--r--src/imports/controls/Pane.qml17
-rw-r--r--src/imports/controls/Popup.qml19
-rw-r--r--src/imports/controls/ProgressBar.qml16
-rw-r--r--src/imports/controls/RadioButton.qml19
-rw-r--r--src/imports/controls/RadioDelegate.qml19
-rw-r--r--src/imports/controls/RangeSlider.qml20
-rw-r--r--src/imports/controls/RoundButton.qml17
-rw-r--r--src/imports/controls/ScrollBar.qml16
-rw-r--r--src/imports/controls/ScrollIndicator.qml16
-rw-r--r--src/imports/controls/ScrollView.qml17
-rw-r--r--src/imports/controls/Slider.qml16
-rw-r--r--src/imports/controls/SpinBox.qml23
-rw-r--r--src/imports/controls/StackView.qml6
-rw-r--r--src/imports/controls/SwipeDelegate.qml19
-rw-r--r--src/imports/controls/SwipeView.qml14
-rw-r--r--src/imports/controls/Switch.qml19
-rw-r--r--src/imports/controls/SwitchDelegate.qml19
-rw-r--r--src/imports/controls/TabBar.qml8
-rw-r--r--src/imports/controls/TabButton.qml17
-rw-r--r--src/imports/controls/TextArea.qml16
-rw-r--r--src/imports/controls/TextField.qml21
-rw-r--r--src/imports/controls/ToolBar.qml17
-rw-r--r--src/imports/controls/ToolButton.qml17
-rw-r--r--src/imports/controls/ToolSeparator.qml17
-rw-r--r--src/imports/controls/ToolTip.qml16
-rw-r--r--src/imports/controls/Tumbler.qml17
-rw-r--r--src/imports/controls/controls.pri4
-rw-r--r--src/imports/controls/controls.pro14
-rw-r--r--src/imports/controls/dependencies.json2
-rw-r--r--src/imports/controls/designer/designer.pri6
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-control.pngbin22234 -> 53439 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-control.svg818
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial-inputMode.svgzbin0 -> 2753 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-dial-inputmode.pngbin0 -> 12922 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-variant-dense.pngbin0 -> 21059 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-material-variant-normal.pngbin0 -> 22897 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup.pngbin30328 -> 67730 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols2-popup.svg609
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-material-variant.qml212
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml46
-rw-r--r--src/imports/controls/doc/src/includes/qquickdial.qdocinc13
-rw-r--r--src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc16
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc2
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-index.qdoc7
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-input.qdoc10
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-material.qdoc29
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc4
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc2
-rw-r--r--src/imports/controls/fusion/ApplicationWindow.qml8
-rw-r--r--src/imports/controls/fusion/BusyIndicator.qml18
-rw-r--r--src/imports/controls/fusion/Button.qml21
-rw-r--r--src/imports/controls/fusion/ButtonPanel.qml10
-rw-r--r--src/imports/controls/fusion/CheckBox.qml23
-rw-r--r--src/imports/controls/fusion/CheckDelegate.qml23
-rw-r--r--src/imports/controls/fusion/CheckIndicator.qml10
-rw-r--r--src/imports/controls/fusion/ComboBox.qml23
-rw-r--r--src/imports/controls/fusion/DelayButton.qml21
-rw-r--r--src/imports/controls/fusion/Dial.qml20
-rw-r--r--src/imports/controls/fusion/Dialog.qml31
-rw-r--r--src/imports/controls/fusion/DialogButtonBox.qml23
-rw-r--r--src/imports/controls/fusion/Drawer.qml21
-rw-r--r--src/imports/controls/fusion/Frame.qml21
-rw-r--r--src/imports/controls/fusion/GroupBox.qml26
-rw-r--r--src/imports/controls/fusion/ItemDelegate.qml23
-rw-r--r--src/imports/controls/fusion/Label.qml12
-rw-r--r--src/imports/controls/fusion/Menu.qml22
-rw-r--r--src/imports/controls/fusion/MenuBar.qml16
-rw-r--r--src/imports/controls/fusion/MenuBarItem.qml23
-rw-r--r--src/imports/controls/fusion/MenuItem.qml23
-rw-r--r--src/imports/controls/fusion/MenuSeparator.qml21
-rw-r--r--src/imports/controls/fusion/Page.qml27
-rw-r--r--src/imports/controls/fusion/PageIndicator.qml20
-rw-r--r--src/imports/controls/fusion/Pane.qml21
-rw-r--r--src/imports/controls/fusion/Popup.qml23
-rw-r--r--src/imports/controls/fusion/ProgressBar.qml20
-rw-r--r--src/imports/controls/fusion/RadioButton.qml23
-rw-r--r--src/imports/controls/fusion/RadioDelegate.qml23
-rw-r--r--src/imports/controls/fusion/RadioIndicator.qml10
-rw-r--r--src/imports/controls/fusion/RangeSlider.qml24
-rw-r--r--src/imports/controls/fusion/RoundButton.qml21
-rw-r--r--src/imports/controls/fusion/ScrollBar.qml20
-rw-r--r--src/imports/controls/fusion/ScrollIndicator.qml20
-rw-r--r--src/imports/controls/fusion/Slider.qml20
-rw-r--r--src/imports/controls/fusion/SliderGroove.qml10
-rw-r--r--src/imports/controls/fusion/SliderHandle.qml10
-rw-r--r--src/imports/controls/fusion/SpinBox.qml27
-rw-r--r--src/imports/controls/fusion/SwipeDelegate.qml23
-rw-r--r--src/imports/controls/fusion/Switch.qml23
-rw-r--r--src/imports/controls/fusion/SwitchDelegate.qml23
-rw-r--r--src/imports/controls/fusion/SwitchIndicator.qml10
-rw-r--r--src/imports/controls/fusion/TabBar.qml16
-rw-r--r--src/imports/controls/fusion/TabButton.qml24
-rw-r--r--src/imports/controls/fusion/TextArea.qml20
-rw-r--r--src/imports/controls/fusion/TextField.qml25
-rw-r--r--src/imports/controls/fusion/ToolBar.qml24
-rw-r--r--src/imports/controls/fusion/ToolButton.qml21
-rw-r--r--src/imports/controls/fusion/ToolSeparator.qml21
-rw-r--r--src/imports/controls/fusion/ToolTip.qml20
-rw-r--r--src/imports/controls/fusion/Tumbler.qml21
-rw-r--r--src/imports/controls/fusion/fusion.pri1
-rw-r--r--src/imports/controls/fusion/fusion.pro4
-rw-r--r--src/imports/controls/fusion/qmldir2
-rw-r--r--src/imports/controls/fusion/qquickfusiontheme.cpp6
-rw-r--r--src/imports/controls/fusion/qquickfusiontheme_p.h10
-rw-r--r--src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp29
-rw-r--r--src/imports/controls/imagine/ApplicationWindow.qml8
-rw-r--r--src/imports/controls/imagine/BusyIndicator.qml25
-rw-r--r--src/imports/controls/imagine/Button.qml30
-rw-r--r--src/imports/controls/imagine/CheckBox.qml28
-rw-r--r--src/imports/controls/imagine/CheckDelegate.qml32
-rw-r--r--src/imports/controls/imagine/ComboBox.qml37
-rw-r--r--src/imports/controls/imagine/DelayButton.qml26
-rw-r--r--src/imports/controls/imagine/Dial.qml17
-rw-r--r--src/imports/controls/imagine/Dialog.qml38
-rw-r--r--src/imports/controls/imagine/DialogButtonBox.qml31
-rw-r--r--src/imports/controls/imagine/Drawer.qml26
-rw-r--r--src/imports/controls/imagine/Frame.qml26
-rw-r--r--src/imports/controls/imagine/GroupBox.qml24
-rw-r--r--src/imports/controls/imagine/ItemDelegate.qml32
-rw-r--r--src/imports/controls/imagine/Label.qml17
-rw-r--r--src/imports/controls/imagine/Menu.qml29
-rw-r--r--src/imports/controls/imagine/MenuItem.qml32
-rw-r--r--src/imports/controls/imagine/MenuSeparator.qml25
-rw-r--r--src/imports/controls/imagine/Page.qml32
-rw-r--r--src/imports/controls/imagine/PageIndicator.qml25
-rw-r--r--src/imports/controls/imagine/Pane.qml26
-rw-r--r--src/imports/controls/imagine/Popup.qml28
-rw-r--r--src/imports/controls/imagine/ProgressBar.qml25
-rw-r--r--src/imports/controls/imagine/RadioButton.qml28
-rw-r--r--src/imports/controls/imagine/RadioDelegate.qml32
-rw-r--r--src/imports/controls/imagine/RangeSlider.qml28
-rw-r--r--src/imports/controls/imagine/RoundButton.qml30
-rw-r--r--src/imports/controls/imagine/ScrollBar.qml25
-rw-r--r--src/imports/controls/imagine/ScrollIndicator.qml25
-rw-r--r--src/imports/controls/imagine/ScrollView.qml28
-rw-r--r--src/imports/controls/imagine/Slider.qml24
-rw-r--r--src/imports/controls/imagine/SpinBox.qml32
-rw-r--r--src/imports/controls/imagine/StackView.qml21
-rw-r--r--src/imports/controls/imagine/SwipeDelegate.qml32
-rw-r--r--src/imports/controls/imagine/SwipeView.qml25
-rw-r--r--src/imports/controls/imagine/Switch.qml28
-rw-r--r--src/imports/controls/imagine/SwitchDelegate.qml32
-rw-r--r--src/imports/controls/imagine/TabBar.qml21
-rw-r--r--src/imports/controls/imagine/TabButton.qml30
-rw-r--r--src/imports/controls/imagine/TextArea.qml29
-rw-r--r--src/imports/controls/imagine/TextField.qml34
-rw-r--r--src/imports/controls/imagine/ToolBar.qml26
-rw-r--r--src/imports/controls/imagine/ToolButton.qml30
-rw-r--r--src/imports/controls/imagine/ToolSeparator.qml25
-rw-r--r--src/imports/controls/imagine/ToolTip.qml25
-rw-r--r--src/imports/controls/imagine/Tumbler.qml30
-rw-r--r--src/imports/controls/imagine/imagine.pro4
-rw-r--r--src/imports/controls/imagine/qmldir2
-rw-r--r--src/imports/controls/imagine/qquickimaginetheme.cpp23
-rw-r--r--src/imports/controls/imagine/qquickimaginetheme_p.h15
-rw-r--r--src/imports/controls/imagine/qquickninepatchimage.cpp15
-rw-r--r--src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp17
-rw-r--r--src/imports/controls/material/ApplicationWindow.qml6
-rw-r--r--src/imports/controls/material/BoxShadow.qml6
-rw-r--r--src/imports/controls/material/BusyIndicator.qml18
-rw-r--r--src/imports/controls/material/Button.qml33
-rw-r--r--src/imports/controls/material/CheckBox.qml22
-rw-r--r--src/imports/controls/material/CheckDelegate.qml28
-rw-r--r--src/imports/controls/material/CheckIndicator.qml6
-rw-r--r--src/imports/controls/material/ComboBox.qml31
-rw-r--r--src/imports/controls/material/CursorDelegate.qml4
-rw-r--r--src/imports/controls/material/DelayButton.qml33
-rw-r--r--src/imports/controls/material/Dial.qml17
-rw-r--r--src/imports/controls/material/Dialog.qml31
-rw-r--r--src/imports/controls/material/DialogButtonBox.qml29
-rw-r--r--src/imports/controls/material/Drawer.qml17
-rw-r--r--src/imports/controls/material/ElevationEffect.qml6
-rw-r--r--src/imports/controls/material/Frame.qml18
-rw-r--r--src/imports/controls/material/GroupBox.qml23
-rw-r--r--src/imports/controls/material/ItemDelegate.qml28
-rw-r--r--src/imports/controls/material/Label.qml6
-rw-r--r--src/imports/controls/material/Menu.qml25
-rw-r--r--src/imports/controls/material/MenuBar.qml16
-rw-r--r--src/imports/controls/material/MenuBarItem.qml25
-rw-r--r--src/imports/controls/material/MenuItem.qml28
-rw-r--r--src/imports/controls/material/MenuSeparator.qml15
-rw-r--r--src/imports/controls/material/Page.qml21
-rw-r--r--src/imports/controls/material/PageIndicator.qml14
-rw-r--r--src/imports/controls/material/Pane.qml17
-rw-r--r--src/imports/controls/material/Popup.qml19
-rw-r--r--src/imports/controls/material/ProgressBar.qml16
-rw-r--r--src/imports/controls/material/RadioButton.qml22
-rw-r--r--src/imports/controls/material/RadioDelegate.qml28
-rw-r--r--src/imports/controls/material/RadioIndicator.qml6
-rw-r--r--src/imports/controls/material/RangeSlider.qml20
-rw-r--r--src/imports/controls/material/RectangularGlow.qml2
-rw-r--r--src/imports/controls/material/RoundButton.qml35
-rw-r--r--src/imports/controls/material/ScrollBar.qml14
-rw-r--r--src/imports/controls/material/ScrollIndicator.qml14
-rw-r--r--src/imports/controls/material/Slider.qml16
-rw-r--r--src/imports/controls/material/SliderHandle.qml6
-rw-r--r--src/imports/controls/material/SpinBox.qml33
-rw-r--r--src/imports/controls/material/StackView.qml6
-rw-r--r--src/imports/controls/material/SwipeDelegate.qml28
-rw-r--r--src/imports/controls/material/SwipeView.qml14
-rw-r--r--src/imports/controls/material/Switch.qml19
-rw-r--r--src/imports/controls/material/SwitchDelegate.qml28
-rw-r--r--src/imports/controls/material/SwitchIndicator.qml6
-rw-r--r--src/imports/controls/material/TabBar.qml12
-rw-r--r--src/imports/controls/material/TabButton.qml23
-rw-r--r--src/imports/controls/material/TextArea.qml22
-rw-r--r--src/imports/controls/material/TextField.qml24
-rw-r--r--src/imports/controls/material/ToolBar.qml17
-rw-r--r--src/imports/controls/material/ToolButton.qml25
-rw-r--r--src/imports/controls/material/ToolSeparator.qml18
-rw-r--r--src/imports/controls/material/ToolTip.qml19
-rw-r--r--src/imports/controls/material/Tumbler.qml19
-rw-r--r--src/imports/controls/material/material.pro5
-rw-r--r--src/imports/controls/material/qmldir2
-rw-r--r--src/imports/controls/material/qquickmaterialstyle.cpp223
-rw-r--r--src/imports/controls/material/qquickmaterialstyle_p.h30
-rw-r--r--src/imports/controls/material/qquickmaterialtheme.cpp85
-rw-r--r--src/imports/controls/material/qquickmaterialtheme_p.h23
-rw-r--r--src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp34
-rw-r--r--src/imports/controls/plugins.qmltypes249
-rw-r--r--src/imports/controls/qmldir2
-rw-r--r--src/imports/controls/qquickdefaulttheme.cpp15
-rw-r--r--src/imports/controls/qquickdefaulttheme_p.h13
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp215
-rw-r--r--src/imports/controls/universal/ApplicationWindow.qml8
-rw-r--r--src/imports/controls/universal/BusyIndicator.qml14
-rw-r--r--src/imports/controls/universal/Button.qml22
-rw-r--r--src/imports/controls/universal/CheckBox.qml19
-rw-r--r--src/imports/controls/universal/CheckDelegate.qml23
-rw-r--r--src/imports/controls/universal/CheckIndicator.qml10
-rw-r--r--src/imports/controls/universal/ComboBox.qml21
-rw-r--r--src/imports/controls/universal/DelayButton.qml18
-rw-r--r--src/imports/controls/universal/Dial.qml15
-rw-r--r--src/imports/controls/universal/Dialog.qml30
-rw-r--r--src/imports/controls/universal/DialogButtonBox.qml19
-rw-r--r--src/imports/controls/universal/Drawer.qml15
-rw-r--r--src/imports/controls/universal/Frame.qml15
-rw-r--r--src/imports/controls/universal/GroupBox.qml20
-rw-r--r--src/imports/controls/universal/ItemDelegate.qml21
-rw-r--r--src/imports/controls/universal/Label.qml6
-rw-r--r--src/imports/controls/universal/Menu.qml18
-rw-r--r--src/imports/controls/universal/MenuBar.qml14
-rw-r--r--src/imports/controls/universal/MenuBarItem.qml21
-rw-r--r--src/imports/controls/universal/MenuItem.qml21
-rw-r--r--src/imports/controls/universal/MenuSeparator.qml12
-rw-r--r--src/imports/controls/universal/Page.qml21
-rw-r--r--src/imports/controls/universal/PageIndicator.qml14
-rw-r--r--src/imports/controls/universal/Pane.qml15
-rw-r--r--src/imports/controls/universal/Popup.qml17
-rw-r--r--src/imports/controls/universal/ProgressBar.qml16
-rw-r--r--src/imports/controls/universal/RadioButton.qml19
-rw-r--r--src/imports/controls/universal/RadioDelegate.qml23
-rw-r--r--src/imports/controls/universal/RadioIndicator.qml4
-rw-r--r--src/imports/controls/universal/RangeSlider.qml18
-rw-r--r--src/imports/controls/universal/RoundButton.qml19
-rw-r--r--src/imports/controls/universal/ScrollBar.qml14
-rw-r--r--src/imports/controls/universal/ScrollIndicator.qml14
-rw-r--r--src/imports/controls/universal/Slider.qml14
-rw-r--r--src/imports/controls/universal/SpinBox.qml25
-rw-r--r--src/imports/controls/universal/StackView.qml6
-rw-r--r--src/imports/controls/universal/SwipeDelegate.qml21
-rw-r--r--src/imports/controls/universal/Switch.qml19
-rw-r--r--src/imports/controls/universal/SwitchDelegate.qml23
-rw-r--r--src/imports/controls/universal/SwitchIndicator.qml6
-rw-r--r--src/imports/controls/universal/TabBar.qml10
-rw-r--r--src/imports/controls/universal/TabButton.qml19
-rw-r--r--src/imports/controls/universal/TextArea.qml20
-rw-r--r--src/imports/controls/universal/TextField.qml25
-rw-r--r--src/imports/controls/universal/ToolBar.qml15
-rw-r--r--src/imports/controls/universal/ToolButton.qml19
-rw-r--r--src/imports/controls/universal/ToolSeparator.qml12
-rw-r--r--src/imports/controls/universal/ToolTip.qml14
-rw-r--r--src/imports/controls/universal/Tumbler.qml18
-rw-r--r--src/imports/controls/universal/qmldir2
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme.cpp27
-rw-r--r--src/imports/controls/universal/qquickuniversaltheme_p.h16
-rw-r--r--src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp23
-rw-r--r--src/imports/controls/universal/universal.pro5
-rw-r--r--src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc4
-rw-r--r--src/imports/platform/platform.pri2
-rw-r--r--src/imports/platform/qquickplatformicon.cpp81
-rw-r--r--src/imports/platform/qquickplatformicon_p.h86
-rw-r--r--src/imports/platform/qquickplatformiconloader.cpp30
-rw-r--r--src/imports/platform/qquickplatformiconloader_p.h15
-rw-r--r--src/imports/platform/qquickplatformmenu.cpp66
-rw-r--r--src/imports/platform/qquickplatformmenu_p.h7
-rw-r--r--src/imports/platform/qquickplatformmenuitem.cpp84
-rw-r--r--src/imports/platform/qquickplatformmenuitem_p.h7
-rw-r--r--src/imports/platform/qquickplatformmessagedialog.cpp2
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon.cpp91
-rw-r--r--src/imports/platform/qquickplatformsystemtrayicon_p.h12
-rw-r--r--src/imports/platform/qtlabsplatformplugin.cpp12
-rw-r--r--src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp2
-rw-r--r--src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc4
-rw-r--r--src/imports/templates/plugins.qmltypes245
-rw-r--r--src/imports/templates/qtquicktemplates2plugin.cpp30
-rw-r--r--src/imports/templates/templates.pro2
-rw-r--r--src/quickcontrols2/qquickattachedobject.cpp129
-rw-r--r--src/quickcontrols2/qquickattachedobject_p.h19
-rw-r--r--src/quickcontrols2/qquickproxytheme.cpp170
-rw-r--r--src/quickcontrols2/qquickstyle.cpp177
-rw-r--r--src/quickcontrols2/qquickstyle.h2
-rw-r--r--src/quickcontrols2/qquickstyle_p.h4
-rw-r--r--src/quickcontrols2/qquickstyleplugin.cpp80
-rw-r--r--src/quickcontrols2/qquickstyleplugin_p.h16
-rw-r--r--src/quickcontrols2/qquickstyleselector.cpp126
-rw-r--r--src/quickcontrols2/qquickstyleselector_p.h9
-rw-r--r--src/quickcontrols2/qquickstyleselector_p_p.h9
-rw-r--r--src/quickcontrols2/qquicktheme.cpp165
-rw-r--r--src/quickcontrols2/quickcontrols2.pri8
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp72
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p.h10
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h3
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp18
-rw-r--r--src/quicktemplates2/qquickapplicationwindow_p.h3
-rw-r--r--src/quicktemplates2/qquickbutton.cpp4
-rw-r--r--src/quicktemplates2/qquickcheckbox.cpp4
-rw-r--r--src/quicktemplates2/qquickcheckdelegate.cpp7
-rw-r--r--src/quicktemplates2/qquickcheckdelegate_p.h1
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp78
-rw-r--r--src/quicktemplates2/qquickcombobox_p.h10
-rw-r--r--src/quicktemplates2/qquickcontainer.cpp108
-rw-r--r--src/quicktemplates2/qquickcontainer_p.h15
-rw-r--r--src/quicktemplates2/qquickcontainer_p_p.h10
-rw-r--r--src/quicktemplates2/qquickcontentitem.cpp61
-rw-r--r--src/quicktemplates2/qquickcontentitem_p.h70
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp776
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h61
-rw-r--r--src/quicktemplates2/qquickcontrol_p_p.h86
-rw-r--r--src/quicktemplates2/qquickdelaybutton.cpp4
-rw-r--r--src/quicktemplates2/qquickdial.cpp76
-rw-r--r--src/quicktemplates2/qquickdial_p.h15
-rw-r--r--src/quicktemplates2/qquickdialog.cpp128
-rw-r--r--src/quicktemplates2/qquickdialog_p.h21
-rw-r--r--src/quicktemplates2/qquickdialog_p_p.h2
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox.cpp124
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p.h11
-rw-r--r--src/quicktemplates2/qquickdialogbuttonbox_p_p.h6
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp27
-rw-r--r--src/quicktemplates2/qquickdrawer_p_p.h2
-rw-r--r--src/quicktemplates2/qquickgroupbox.cpp84
-rw-r--r--src/quicktemplates2/qquickgroupbox_p.h11
-rw-r--r--src/quicktemplates2/qquickitemdelegate.cpp4
-rw-r--r--src/quicktemplates2/qquicklabel.cpp293
-rw-r--r--src/quicktemplates2/qquicklabel_p.h36
-rw-r--r--src/quicktemplates2/qquicklabel_p_p.h30
-rw-r--r--src/quicktemplates2/qquickmenu.cpp42
-rw-r--r--src/quicktemplates2/qquickmenu_p_p.h2
-rw-r--r--src/quicktemplates2/qquickmenubar.cpp160
-rw-r--r--src/quicktemplates2/qquickmenubar_p.h23
-rw-r--r--src/quicktemplates2/qquickmenubar_p_p.h14
-rw-r--r--src/quicktemplates2/qquickmenubaritem.cpp4
-rw-r--r--src/quicktemplates2/qquickmenuitem.cpp4
-rw-r--r--src/quicktemplates2/qquickmenuseparator.cpp7
-rw-r--r--src/quicktemplates2/qquickmenuseparator_p.h1
-rw-r--r--src/quicktemplates2/qquickpage.cpp332
-rw-r--r--src/quicktemplates2/qquickpage_p.h40
-rw-r--r--src/quicktemplates2/qquickpage_p_p.h (renamed from src/quicktemplates2/qquickpagelayout_p_p.h)38
-rw-r--r--src/quicktemplates2/qquickpageindicator.cpp3
-rw-r--r--src/quicktemplates2/qquickpagelayout.cpp193
-rw-r--r--src/quicktemplates2/qquickpane.cpp199
-rw-r--r--src/quicktemplates2/qquickpane_p.h17
-rw-r--r--src/quicktemplates2/qquickpane_p_p.h20
-rw-r--r--src/quicktemplates2/qquickpopup.cpp419
-rw-r--r--src/quicktemplates2/qquickpopup_p.h64
-rw-r--r--src/quicktemplates2/qquickpopup_p_p.h12
-rw-r--r--src/quicktemplates2/qquickpopupanchors.cpp72
-rw-r--r--src/quicktemplates2/qquickpopupanchors_p.h85
-rw-r--r--src/quicktemplates2/qquickpopupanchors_p_p.h (renamed from src/imports/controls/fusion/ScrollView.qml)63
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp43
-rw-r--r--src/quicktemplates2/qquickpopupitem_p_p.h6
-rw-r--r--src/quicktemplates2/qquickpopuppositioner.cpp39
-rw-r--r--src/quicktemplates2/qquickpopuppositioner_p_p.h2
-rw-r--r--src/quicktemplates2/qquickradiobutton.cpp4
-rw-r--r--src/quicktemplates2/qquickradiodelegate.cpp7
-rw-r--r--src/quicktemplates2/qquickradiodelegate_p.h1
-rw-r--r--src/quicktemplates2/qquickrangeslider.cpp156
-rw-r--r--src/quicktemplates2/qquickrangeslider_p.h22
-rw-r--r--src/quicktemplates2/qquickscrollview.cpp155
-rw-r--r--src/quicktemplates2/qquickscrollview_p.h24
-rw-r--r--src/quicktemplates2/qquickslider.cpp122
-rw-r--r--src/quicktemplates2/qquickslider_p.h17
-rw-r--r--src/quicktemplates2/qquickspinbox.cpp73
-rw-r--r--src/quicktemplates2/qquickspinbox_p.h11
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp8
-rw-r--r--src/quicktemplates2/qquickswipedelegate.cpp16
-rw-r--r--src/quicktemplates2/qquickswipedelegate_p.h2
-rw-r--r--src/quicktemplates2/qquickswipeview.cpp39
-rw-r--r--src/quicktemplates2/qquickswitch.cpp8
-rw-r--r--src/quicktemplates2/qquickswitch_p.h1
-rw-r--r--src/quicktemplates2/qquickswitchdelegate.cpp7
-rw-r--r--src/quicktemplates2/qquickswitchdelegate_p.h2
-rw-r--r--src/quicktemplates2/qquicktabbar.cpp161
-rw-r--r--src/quicktemplates2/qquicktabbar_p.h17
-rw-r--r--src/quicktemplates2/qquicktabbutton.cpp4
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp306
-rw-r--r--src/quicktemplates2/qquicktextarea_p.h41
-rw-r--r--src/quicktemplates2/qquicktextarea_p_p.h27
-rw-r--r--src/quicktemplates2/qquicktextfield.cpp316
-rw-r--r--src/quicktemplates2/qquicktextfield_p.h42
-rw-r--r--src/quicktemplates2/qquicktextfield_p_p.h31
-rw-r--r--src/quicktemplates2/qquicktheme.cpp166
-rw-r--r--src/quicktemplates2/qquicktheme_p.h (renamed from src/quickcontrols2/qquickproxytheme_p.h)87
-rw-r--r--src/quicktemplates2/qquicktheme_p_p.h (renamed from src/quickcontrols2/qquicktheme_p.h)37
-rw-r--r--src/quicktemplates2/qquicktoolbar.cpp7
-rw-r--r--src/quicktemplates2/qquicktoolbar_p.h1
-rw-r--r--src/quicktemplates2/qquicktoolbutton.cpp4
-rw-r--r--src/quicktemplates2/qquicktoolseparator.cpp7
-rw-r--r--src/quicktemplates2/qquicktoolseparator_p.h1
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp33
-rw-r--r--src/quicktemplates2/qquicktooltip_p.h4
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp57
-rw-r--r--src/quicktemplates2/qquicktumbler_p.h13
-rw-r--r--src/quicktemplates2/qquicktumbler_p_p.h4
-rw-r--r--src/quicktemplates2/quicktemplates2.pri11
-rw-r--r--tests/auto/controls/data/tst_abstractbutton.qml2
-rw-r--r--tests/auto/controls/data/tst_control.qml484
-rw-r--r--tests/auto/controls/data/tst_dial.qml99
-rw-r--r--tests/auto/controls/data/tst_dialogbuttonbox.qml52
-rw-r--r--tests/auto/controls/data/tst_frame.qml8
-rw-r--r--tests/auto/controls/data/tst_groupbox.qml8
-rw-r--r--tests/auto/controls/data/tst_label.qml152
-rw-r--r--tests/auto/controls/data/tst_page.qml8
-rw-r--r--tests/auto/controls/data/tst_pane.qml19
-rw-r--r--tests/auto/controls/data/tst_popup.qml77
-rw-r--r--tests/auto/controls/data/tst_rangeslider.qml153
-rw-r--r--tests/auto/controls/data/tst_slider.qml62
-rw-r--r--tests/auto/controls/data/tst_swipeview.qml31
-rw-r--r--tests/auto/controls/data/tst_tabbar.qml24
-rw-r--r--tests/auto/controls/data/tst_textarea.qml228
-rw-r--r--tests/auto/controls/data/tst_textfield.qml218
-rw-r--r--tests/auto/controls/data/tst_toolbar.qml8
-rw-r--r--tests/auto/controls/data/tst_tooltip.qml18
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml68
-rw-r--r--tests/auto/controls/default/BLACKLIST3
-rw-r--r--tests/auto/font/tst_font.cpp135
-rw-r--r--tests/auto/palette/tst_palette.cpp179
-rw-r--r--tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp18
-rw-r--r--tests/auto/qquickmaterialstyleconf/data/applicationwindow.qml5
-rw-r--r--tests/auto/qquickmaterialstyleconf/qquickmaterialstyleconf.qrc10
-rw-r--r--tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp42
-rw-r--r--tests/auto/qquickmaterialstyleconf/variant-dense.conf6
-rw-r--r--tests/auto/qquickmaterialstyleconf/variant-normal.conf6
-rw-r--r--tests/auto/qquickmenu/tst_qquickmenu.cpp2
-rw-r--r--tests/auto/qquickmenubar/tst_qquickmenubar.cpp8
-rw-r--r--tests/auto/qquickninepatchimage/tst_qquickninepatchimage.cpp17
-rw-r--r--tests/auto/qquickstyle/data/dummyStyles/DummyStyle/Button.qml (renamed from tests/auto/qquickstyle/data/DummyStyle/Button.qml)0
-rw-r--r--tests/auto/qquickstyle/qquickstyle.pro8
-rw-r--r--tests/auto/qquickstyle/qrcStyles3/QrcStyle3/Button.qml2
-rw-r--r--tests/auto/qquickstyle/qrcStyles4/QrcStyle4/Button.qml2
-rw-r--r--tests/auto/qquickstyle/tst_qquickstyle.cpp83
-rw-r--r--tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp11
-rw-r--r--tests/auto/sanity/sanity.pro2
-rw-r--r--tests/auto/sanity/tst_sanity.cpp49
-rw-r--r--tests/auto/shared/util.pri1
-rw-r--r--tests/auto/shared/visualtestutil.cpp41
-rw-r--r--tests/auto/shared/visualtestutil.h2
-rw-r--r--tests/benchmarks/creationtime/creationtime.pro2
-rw-r--r--tests/benchmarks/creationtime/tst_creationtime.cpp52
-rw-r--r--tests/benchmarks/objectcount/objectcount.pro2
-rw-r--r--tests/benchmarks/objectcount/tst_objectcount.cpp49
-rw-r--r--tests/manual/screenshots/qtquickcontrols2.conf3
-rw-r--r--tests/manual/screenshots/screenshots.qml2
603 files changed, 13282 insertions, 5982 deletions
diff --git a/.gitignore b/.gitignore
index 7cd0eafe..fdee2d39 100644
--- a/.gitignore
+++ b/.gitignore
@@ -154,4 +154,5 @@ qt.conf
*.version
*.version.in
*.qmlc
+.qmlcache
codeattributions.qdoc
diff --git a/.qmake.conf b/.qmake.conf
index 67928d02..54e0cdc8 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -4,4 +4,4 @@ DEFINES += QT_NO_FOREACH
QQC2_SOURCE_TREE = $$PWD
-MODULE_VERSION = 5.11.2
+MODULE_VERSION = 5.12.0
diff --git a/examples/quickcontrols2/wearable/images/background-dark.png b/examples/quickcontrols2/wearable/images/background-dark.png
new file mode 100644
index 00000000..e8eb169d
--- /dev/null
+++ b/examples/quickcontrols2/wearable/images/background-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/images/background.png b/examples/quickcontrols2/wearable/images/background-light.png
index 1c6920e6..1c6920e6 100644
--- a/examples/quickcontrols2/wearable/images/background.png
+++ b/examples/quickcontrols2/wearable/images/background-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
index 82a7716f..99343d24 100644
--- a/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Alarms/AlarmsPage.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import ".."
import "../Style"
@@ -66,6 +66,8 @@ Item {
}
SwipeViewPage {
+ property alias stateSwitch: stateSwitch
+
Column {
spacing: 30
anchors.centerIn: parent
@@ -84,7 +86,7 @@ Item {
font.bold: stateSwitch.checked
font.pixelSize: stateSwitch.checked ? UIStyle.fontSizeXL : UIStyle.fontSizeL
font.letterSpacing: 4
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -95,7 +97,7 @@ Item {
font.italic: true
font.bold: true
font.letterSpacing: 1
- color: UIStyle.colorQtGray2
+ color: UIStyle.themeColorQtGray2
}
}
}
diff --git a/examples/quickcontrols2/wearable/qml/DemoMode.qml b/examples/quickcontrols2/wearable/qml/DemoMode.qml
new file mode 100644
index 00000000..c67a56e6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/DemoMode.qml
@@ -0,0 +1,258 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.10
+import QtQuick.Controls 2.3
+
+import "Style"
+
+Item {
+ property StackView stackView
+
+ SequentialAnimation {
+ id: demoModeAnimation
+ running: settings.demoMode
+
+ // Set brightness back to normal.
+ ScriptAction { script: settings.brightness = 0 }
+
+ // Go back to the launcher page.
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the world clock page.
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("WorldClock/WorldClockPage.qml")) }
+ PauseAnimation { duration: 2000 }
+
+ // Swipe across a few times.
+ SequentialAnimation {
+ loops: 6
+
+ ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() }
+ PauseAnimation { duration: 2500 }
+ }
+
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the navigation page.
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Navigation/NavigationPage.qml")) }
+ PauseAnimation { duration: 2000 }
+
+ // Flick down a few times.
+ SequentialAnimation {
+ loops: 6
+
+ ScriptAction { script: stackView.currentItem.routeListView.incrementCurrentIndex() }
+ PauseAnimation { duration: 2000 }
+ }
+
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the weather page.
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Weather/WeatherPage.qml")) }
+ PauseAnimation { duration: 2000 }
+
+ // Swipe across a few times.
+ SequentialAnimation {
+ loops: 4
+
+ ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() }
+ PauseAnimation { duration: 2000 }
+ }
+
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the fitness page.
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Fitness/FitnessPage.qml")) }
+ PauseAnimation { duration: 2000 }
+
+ // Swipe across a few times.
+ SequentialAnimation {
+ loops: 2
+
+ ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() }
+ PauseAnimation { duration: 2000 }
+ }
+
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the notifications page.
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Notifications/NotificationsPage.qml")) }
+
+ // Flick down a few times.
+ SequentialAnimation {
+ loops: 3
+
+ PauseAnimation { duration: 2000 }
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ }
+
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the alarms page.
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Alarms/AlarmsPage.qml")) }
+ PauseAnimation { duration: 2000 }
+
+ // Toggle the switch.
+ ScriptAction { script: stackView.currentItem.children[0].currentItem.stateSwitch.toggle() }
+ PauseAnimation { duration: 2000 }
+
+ // Go to the next alarm.
+ ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() }
+ PauseAnimation { duration: 2000 }
+
+ // Toggle the switch there too.
+ ScriptAction { script: stackView.currentItem.children[0].currentItem.stateSwitch.toggle() }
+ PauseAnimation { duration: 2000 }
+
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ PauseAnimation { duration: 2000 }
+
+ // Open the settings page.
+ ScriptAction { script: stackView.currentItem.incrementCurrentIndex() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.launched(Qt.resolvedUrl("Settings/SettingsPage.qml")) }
+ PauseAnimation { duration: 3000 }
+
+ // Toggle the switches.
+ ScriptAction { script: stackView.currentItem.children[0].currentItem.bluetoothSwitch.toggle() }
+ PauseAnimation { duration: 1000 }
+ ScriptAction { script: stackView.currentItem.children[0].currentItem.wirelessSwitch.toggle() }
+ PauseAnimation { duration: 3000 }
+
+ // Go to the next page.
+ ScriptAction { script: stackView.currentItem.children[0].incrementCurrentIndex() }
+
+ // Play with the brightness slider.
+ // First, set it to full brightness so we start in the correct state.
+ ScriptAction {
+ script: {
+ var brightnessSlider = stackView.currentItem.children[0].currentItem.brightnessSlider
+ brightnessSlider.value = 0
+ // increase()/decrease() are not a result of user interaction and
+ // hence moved() will not be emitted, so we do it ourselves.
+ brightnessSlider.moved()
+ }
+ }
+
+ // Decrease the brightness.
+ SequentialAnimation {
+ loops: 3
+
+ PauseAnimation { duration: 1000 }
+ ScriptAction {
+ script: {
+ var brightnessSlider = stackView.currentItem.children[0].currentItem.brightnessSlider
+ brightnessSlider.decrease()
+ brightnessSlider.moved()
+ }
+ }
+ }
+
+ // Increase the brightness back to full.
+ PauseAnimation { duration: 3000 }
+ SequentialAnimation {
+ loops: 3
+
+ PauseAnimation { duration: 1000 }
+ ScriptAction {
+ script: {
+ var brightnessSlider = stackView.currentItem.children[0].currentItem.brightnessSlider
+ brightnessSlider.increase()
+ brightnessSlider.moved()
+ }
+ }
+ }
+
+ // Toggle the dark theme switch.
+ PauseAnimation { duration: 2000 }
+ ScriptAction {
+ script: {
+ var darkThemeSwitch = stackView.currentItem.children[0].currentItem.darkThemeSwitch
+ darkThemeSwitch.toggle()
+ // As above, only proper user interaction results in toggled() being emitted,
+ // so we do it ourselves.
+ darkThemeSwitch.toggled()
+ }
+ }
+ PauseAnimation { duration: 4000 }
+
+ // Go back to the launcher page.
+ ScriptAction { script: stackView.pop(null) }
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml b/examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml
new file mode 100644
index 00000000..66ced325
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/DemoModeIndicator.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, 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.10
+import QtQuick.Controls 2.3 as QQC2
+import "Style"
+
+Item {
+ id: root
+ width: row.implicitWidth + margins * 2
+
+ readonly property int topMargin: 24
+ readonly property int margins: 12
+
+ Behavior on y {
+ NumberAnimation {}
+ }
+
+ Rectangle {
+ id: demoModeIndicatorBg
+ anchors.fill: parent
+ anchors.topMargin: -topMargin
+ radius: 20
+ color: UIStyle.colorRed
+ }
+
+ Row {
+ id: row
+ spacing: 8
+ anchors.fill: parent
+ anchors.leftMargin: margins
+ anchors.rightMargin: margins
+
+ Image {
+ source: "Settings/images/demo-mode-white.png"
+ width: height
+ height: instructionLabel.height * 2
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ QQC2.Label {
+ id: instructionLabel
+ text: "Tap screen to use"
+ color: UIStyle.colorQtGray10
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ }
+}
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
index a9a1cb98..1f018e2e 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Fitness/FitnessPage.qml
@@ -48,14 +48,14 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQ2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import ".."
import "../Style"
import "fitness.js" as FitnessData
Item {
- QQ2.SwipeView {
+ QQC2.SwipeView {
id: svFitnessContainer
anchors.fill: parent
@@ -72,18 +72,18 @@ Item {
text: qsTr("Steps: ") + FitnessData.getSteps()
font.italic: true
font.pixelSize: UIStyle.fontSizeM
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "images/man-walking.png"
+ source: UIStyle.themeImagePath("images/man-walking")
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: qsTr("Calories: ") + FitnessData.getCalories()
font.pixelSize: UIStyle.fontSizeS
font.italic: true
- color: UIStyle.colorQtGray3
+ color: UIStyle.themeColorQtGray3
}
}
}
@@ -102,11 +102,11 @@ Item {
+ qsTr(" miles")
font.italic: true
font.pixelSize: UIStyle.fontSizeM
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "images/man-running.png"
+ source: UIStyle.themeImagePath("images/man-running")
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
@@ -115,13 +115,13 @@ Item {
+ qsTr(" mins")
font.pixelSize: UIStyle.fontSizeS
font.italic: true
- color: UIStyle.colorQtGray3
+ color: UIStyle.themeColorQtGray3
}
}
}
}
- QQ2.PageIndicator {
+ QQC2.PageIndicator {
count: svFitnessContainer.count
currentIndex: svFitnessContainer.currentIndex
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark.png
new file mode 100644
index 00000000..709c4b0f
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark@2x.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark@2x.png
new file mode 100644
index 00000000..1497ba4a
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-light.png
index 5efab6e2..5efab6e2 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running.png
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running@2x.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-light@2x.png
index 2073d97f..2073d97f 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/images/man-running@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-running-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark.png
new file mode 100644
index 00000000..6de13144
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark@2x.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark@2x.png
new file mode 100644
index 00000000..e094e071
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-light.png
index 01add534..01add534 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking.png
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking@2x.png b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-light@2x.png
index 037a8f03..037a8f03 100644
--- a/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Fitness/images/man-walking-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/LauncherPage.qml b/examples/quickcontrols2/wearable/qml/LauncherPage.qml
index 9d6d9ae9..53c9e5a4 100644
--- a/examples/quickcontrols2/wearable/qml/LauncherPage.qml
+++ b/examples/quickcontrols2/wearable/qml/LauncherPage.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.1 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import "Style"
PathView {
@@ -118,7 +118,7 @@ PathView {
background: Rectangle {
radius: width / 2
border.width: 3
- border.color: parent.PathView.isCurrentItem ? UIStyle.colorQtPrimGreen : UIStyle.colorQtGray4
+ border.color: parent.PathView.isCurrentItem ? UIStyle.colorQtPrimGreen : UIStyle.themeColorQtGray4
}
onClicked: {
@@ -184,6 +184,6 @@ PathView {
font.bold: true
font.pixelSize: circularView.itemSize / 3
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
diff --git a/examples/quickcontrols2/wearable/qml/NaviButton.qml b/examples/quickcontrols2/wearable/qml/NaviButton.qml
index 7a8f7c14..5058bd62 100644
--- a/examples/quickcontrols2/wearable/qml/NaviButton.qml
+++ b/examples/quickcontrols2/wearable/qml/NaviButton.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import "Style"
QQC2.AbstractButton {
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
index 185f7986..8ab82bac 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Navigation/NavigationPage.qml
@@ -48,11 +48,13 @@
**
****************************************************************************/
-import QtQuick 2.7
+import QtQuick 2.10
import "../Style"
import "navigation.js" as NavigationData
Item {
+ property alias routeListView: routeView
+
Column {
anchors.fill: parent
anchors.margins: 2
@@ -63,7 +65,7 @@ Item {
width: parent.width
height: titleRow.height
- color: UIStyle.colorQtGray9
+ color: UIStyle.themeColorQtGray9
Row {
id: titleRow
@@ -72,7 +74,7 @@ Item {
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/navigation.png"
+ source: UIStyle.themeImagePath("images/navigation")
fillMode: Image.PreserveAspectCrop
}
Text {
@@ -80,7 +82,7 @@ Item {
text: qsTr("Walking")
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 2
- color: UIStyle.colorQtGray2
+ color: UIStyle.themeColorQtGray2
}
}
}
@@ -94,12 +96,12 @@ Item {
width: parent.width
height: parent.height - titleRow.height - parent.spacing
- property var imageList: ["straight.png",
- "leftturn.png",
- "rightturn.png",
- "uturn.png",
- "start.png",
- "end.png"]
+ property var imageList: [UIStyle.themeImagePath("images/straight"),
+ UIStyle.themeImagePath("images/leftturn"),
+ UIStyle.themeImagePath("images/rightturn"),
+ "images/uturn.png",
+ "images/start.png",
+ "images/end.png"]
clip: true
focus: true
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml b/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml
index 79928012..937b84a8 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml
+++ b/examples/quickcontrols2/wearable/qml/Navigation/RouteElement.qml
@@ -48,11 +48,11 @@
**
****************************************************************************/
-import QtQuick 2.7
+import QtQuick 2.10
import "../Style"
Rectangle {
- color: UIStyle.colorQtGray8
+ color: UIStyle.themeColorQtGray8
Row {
spacing: 5
@@ -62,7 +62,7 @@ Rectangle {
Image {
id: img
anchors.verticalCenter: parent.verticalCenter
- source: "images/" + navImage
+ source: navImage
fillMode: Image.PreserveAspectFit
}
@@ -78,7 +78,7 @@ Rectangle {
font.pixelSize: UIStyle.fontSizeS
verticalAlignment: Text.AlignVCenter
padding: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -88,7 +88,7 @@ Rectangle {
font.pixelSize: UIStyle.fontSizeXS
verticalAlignment: Text.AlignVCenter
padding: 1
- color: UIStyle.colorQtGray2
+ color: UIStyle.themeColorQtGray2
}
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark.png b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark.png
new file mode 100644
index 00000000..b318b954
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark@2x.png
new file mode 100644
index 00000000..ec782ebd
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-light.png
index 3c416304..3c416304 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-light@2x.png
index 39e9be84..39e9be84 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/leftturn-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark.png b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark.png
new file mode 100644
index 00000000..7dce6aa5
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark@2x.png
new file mode 100644
index 00000000..5061e52b
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation.png b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-light.png
index 9b8cb8e6..9b8cb8e6 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-light@2x.png
index 8d133abc..8d133abc 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/navigation@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/navigation-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark.png b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark.png
new file mode 100644
index 00000000..634ab593
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark@2x.png
new file mode 100644
index 00000000..9a388440
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-light.png
index a29ec694..a29ec694 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-light@2x.png
index 258c4144..258c4144 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/rightturn-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark.png b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark.png
new file mode 100644
index 00000000..014ed7c8
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark@2x.png
new file mode 100644
index 00000000..be51d2ac
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-light.png
index e3c5bb5c..e3c5bb5c 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/straight.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Navigation/images/straight@2x.png b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-light@2x.png
index ef71ab1b..ef71ab1b 100644
--- a/examples/quickcontrols2/wearable/qml/Navigation/images/straight@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Navigation/images/straight-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
index d5bec2f8..eeddf6dc 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Notifications/NotificationsPage.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import "../Style"
import "notifications.js" as NotificationData
@@ -70,7 +70,7 @@ ListView {
width: parent.width / 2
anchors.right: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
- source: "images/missedcall.png"
+ source: UIStyle.themeImagePath("images/missedcall")
fillMode: Image.Pad
}
@@ -85,7 +85,7 @@ ListView {
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: qsTr("images/avatar%1.png").arg(model.gender)
+ source: qsTr("images/avatar%1-%2.png").arg(model.gender).arg(UIStyle.darkTheme ? "dark" : "light")
}
Text {
@@ -93,7 +93,7 @@ ListView {
anchors.horizontalCenter: parent.horizontalCenter
font.bold: true
font.pixelSize: UIStyle.fontSizeS
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -101,7 +101,7 @@ ListView {
text: date + " " + time
font.pixelSize: UIStyle.fontSizeXS
font.italic: true
- color: UIStyle.colorQtGray2
+ color: UIStyle.themeColorQtGray2
}
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark.png
new file mode 100644
index 00000000..2a553aed
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark@2x.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark@2x.png
new file mode 100644
index 00000000..a91031f3
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-light.png
index c88edc60..c88edc60 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf@2x.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-light@2x.png
index 2c916b2c..2c916b2c 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarf-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark.png
new file mode 100644
index 00000000..5810312c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark@2x.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark@2x.png
new file mode 100644
index 00000000..64ddd8ea
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-light.png
index f7abb4c9..f7abb4c9 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm@2x.png b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-light@2x.png
index d30eb2d2..d30eb2d2 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/avatarm-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark.png b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark.png
new file mode 100644
index 00000000..4080e3e4
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark@2x.png b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark@2x.png
new file mode 100644
index 00000000..6002e456
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-light.png
index d05f17b3..d05f17b3 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall@2x.png b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-light@2x.png
index d28e62c5..d28e62c5 100644
--- a/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Notifications/images/missedcall-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
index 3ed59eb8..bb347e7d 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Settings/SettingsPage.qml
@@ -48,22 +48,13 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
-import Qt.labs.settings 1.0
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import ".."
import "../Style"
Item {
- Settings {
- id: settings
- property alias wireless: wirelessSwitch.checked
- property alias bluetooth: bluetoothSwitch.checked
- property alias contrast: contrastSlider.value
- property alias brightness: brightnessSlider.value
- }
-
QQC2.SwipeView {
id: svSettingsContainer
@@ -72,6 +63,9 @@ Item {
SwipeViewPage {
id: settingsPage1
+ property alias bluetoothSwitch: bluetoothSwitch
+ property alias wirelessSwitch: wirelessSwitch
+
Column {
anchors.centerIn: parent
spacing: 25
@@ -80,24 +74,26 @@ Item {
spacing: 50
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/bluetooth.png"
+ source: UIStyle.themeImagePath("images/bluetooth")
}
QQC2.Switch {
id: bluetoothSwitch
anchors.verticalCenter: parent.verticalCenter
checked: settings.bluetooth
+ onToggled: settings.bluetooth = checked
}
}
Row {
spacing: 50
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/wifi.png"
+ source: UIStyle.themeImagePath("images/wifi")
}
QQC2.Switch {
id: wirelessSwitch
anchors.verticalCenter: parent.verticalCenter
checked: settings.wireless
+ onToggled: settings.wireless = checked
}
}
}
@@ -106,6 +102,9 @@ Item {
SwipeViewPage {
id: settingsPage2
+ property alias brightnessSlider: brightnessSlider
+ property alias darkThemeSwitch: darkThemeSwitch
+
Column {
anchors.centerIn: parent
spacing: 2
@@ -113,7 +112,7 @@ Item {
Column {
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "images/brightness.png"
+ source: UIStyle.themeImagePath("images/brightness")
}
QQC2.Slider {
id: brightnessSlider
@@ -122,21 +121,45 @@ Item {
to: 5
stepSize: 1
value: settings.brightness
+ onMoved: settings.brightness = value
}
}
Column {
- spacing: 2
+ anchors.horizontalCenter: parent.horizontalCenter
+
Image {
anchors.horizontalCenter: parent.horizontalCenter
- source: "images/contrast.png"
+ source: UIStyle.themeImagePath("images/theme")
}
- QQC2.Slider {
- id: contrastSlider
+ QQC2.Switch {
+ id: darkThemeSwitch
anchors.horizontalCenter: parent.horizontalCenter
- from: 0
- to: 10
- stepSize: 1
- value: settings.contrast
+ checked: settings.darkTheme
+ onToggled: settings.darkTheme = checked
+ }
+ }
+ }
+ }
+
+ SwipeViewPage {
+ id: settingsPage3
+
+ Column {
+ anchors.centerIn: parent
+
+ Column {
+ anchors.horizontalCenter: parent.horizontalCenter
+ spacing: 6
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter
+ source: UIStyle.themeImagePath("images/demo-mode")
+ }
+ QQC2.Switch {
+ id: demoModeSwitch
+ anchors.horizontalCenter: parent.horizontalCenter
+ checked: settings.demoMode
+ onToggled: settings.demoMode = checked
}
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark.png
new file mode 100644
index 00000000..32040b18
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark@2x.png
new file mode 100644
index 00000000..d29c6d3a
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-light.png
index 2b2d0e7e..2b2d0e7e 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-light@2x.png
index 276d7337..276d7337 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/bluetooth-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark.png
new file mode 100644
index 00000000..1904a6a4
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark@2x.png
new file mode 100644
index 00000000..7cd287e9
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-light.png
index 846a896c..846a896c 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/brightness.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/brightness@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-light@2x.png
index 94753ea6..94753ea6 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/brightness@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/brightness-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png
deleted file mode 100644
index eb528eb8..00000000
--- a/examples/quickcontrols2/wearable/qml/Settings/images/contrast.png
+++ /dev/null
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/contrast@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/contrast@2x.png
deleted file mode 100644
index 92e112f9..00000000
--- a/examples/quickcontrols2/wearable/qml/Settings/images/contrast@2x.png
+++ /dev/null
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png
new file mode 100644
index 00000000..571a4645
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png
new file mode 100644
index 00000000..a8203b35
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png
new file mode 100644
index 00000000..0f8fcc75
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png
new file mode 100644
index 00000000..57282a5a
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png
new file mode 100644
index 00000000..1f967488
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png
new file mode 100644
index 00000000..fd0611e6
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-white@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg
new file mode 100644
index 00000000..ad1ce448
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode.svg
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ viewBox="0 0 16.933333 16.933333"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.3 (d244b95, 2018-08-02)"
+ sodipodi:docname="demo-mode.svg"
+ inkscape:export-filename="/home/mitch/dev/qt5.12/qtquickcontrols2/examples/quickcontrols2/wearable/qml/Settings/images/demo-mode-light@2x.png"
+ inkscape:export-xdpi="192"
+ inkscape:export-ydpi="192">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.839192"
+ inkscape:cx="26.498574"
+ inkscape:cy="25.685519"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ fit-margin-top="1"
+ fit-margin-left="1"
+ fit-margin-right="1"
+ fit-margin-bottom="1"
+ inkscape:window-width="3706"
+ inkscape:window-height="2031"
+ inkscape:window-x="134"
+ inkscape:window-y="55"
+ inkscape:window-maximized="1"
+ inkscape:snap-global="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3713"
+ originx="-0.0070880335"
+ originy="-280.58354" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-0.00708803,0.51688025)">
+ <path
+ style="fill:#141f3a;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="m 1.6489221,4.3034973 h 0.7205171 v 7.0102767 c 0.01422,0.27678 0.1921164,0.348966 0.392741,0.392741 H 14.169383 c 0.276028,-0.04241 0.382882,-0.208883 0.423747,-0.423747 V 4.3094031 h 0.692464 v 7.0279949 c -0.111554,0.831949 -0.589986,1.000696 -1.104399,1.104399 H 9.3324693 l 2.2589977,2.258998 c -0.0189,0.375139 -0.204956,0.516261 -0.501999,0.502 L 8.8304698,12.943797 v 1.972563 c -0.051861,0.342631 -0.6681357,0.36382 -0.7323291,0 V 12.949702 L 5.8391425,15.208701 C 5.5142667,15.206145 5.3522558,15.056484 5.3725781,14.742136 L 7.7172116,12.397503 H 2.7415096 C 2.1429244,12.357576 1.6879444,12.049089 1.6444927,11.300486 Z"
+ id="path826"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccccccccccccccccccc" />
+ <rect
+ style="fill:#141f3a;fill-opacity:1;stroke:none;stroke-width:0.2619375;stroke-miterlimit:4;stroke-dasharray:0.523875, 0.2619375;stroke-dashoffset:0"
+ id="rect828"
+ width="16.044523"
+ height="1.9126476"
+ x="0.441401"
+ y="2.0340116"
+ rx="1.0583333"
+ ry="1.0583333" />
+ <path
+ style="fill:#141f3a;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 7.8323763,1.681278 V 1.1615701 c 0.1987987,-0.67546179 1.0821701,-0.66495897 1.2992931,0 V 1.681278 Z"
+ id="path830"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccc" />
+ </g>
+</svg>
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/theme-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/theme-dark.png
new file mode 100644
index 00000000..346ffec3
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/theme-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/theme-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/theme-dark@2x.png
new file mode 100644
index 00000000..4207d739
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/theme-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/theme-light.png b/examples/quickcontrols2/wearable/qml/Settings/images/theme-light.png
new file mode 100644
index 00000000..2f02744c
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/theme-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/theme-light@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/theme-light@2x.png
new file mode 100644
index 00000000..07c4b774
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/theme-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/theme.svg b/examples/quickcontrols2/wearable/qml/Settings/images/theme.svg
new file mode 100644
index 00000000..bf3f1e57
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/theme.svg
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ viewBox="0 0 16.933333 16.933333"
+ version="1.1"
+ id="svg8"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
+ sodipodi:docname="theme.svg"
+ inkscape:export-filename="C:\dev\qt5.11\qtquickcontrols2\examples\quickcontrols2\wearable\qml\Settings\images\theme@2x.png"
+ inkscape:export-xdpi="192"
+ inkscape:export-ydpi="192">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="7.9195959"
+ inkscape:cx="-11.371874"
+ inkscape:cy="28.405259"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ units="px"
+ fit-margin-top="1"
+ fit-margin-left="1"
+ fit-margin-right="1"
+ fit-margin-bottom="1"
+ inkscape:window-width="3840"
+ inkscape:window-height="2066"
+ inkscape:window-x="-11"
+ inkscape:window-y="-11"
+ inkscape:window-maximized="1"
+ inkscape:snap-global="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid3713"
+ originx="-0.0070880335"
+ originy="-280.58354" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-0.00708803,0.51688025)">
+ <path
+ style="fill:#141f3a;fill-opacity:1;stroke:none;stroke-width:0.25668776px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 2.7296861,14.56437 H 12.831038 C 13.464556,14.411157 15.01089,14.101758 15.231756,11.825604 15.232242,10.48538 13.96701,8.4813248 11.69084,9.0467292 10.687852,7.3630573 9.1232541,7.2558172 8.2817051,7.654427 6.9050791,4.9744381 2.9222535,5.8560797 2.9703307,8.9435956 1.7108806,9.1004362 0.37826375,9.7182846 0.27167137,11.745388 0.31660717,13.546059 1.5831259,14.350467 2.7296861,14.56437 Z"
+ id="path4535"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccccc" />
+ <path
+ style="fill:#141f3a;fill-opacity:1;stroke:none;stroke-width:0.25668776px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 11.392726,0.92763044 C 8.8246143,2.2754379 7.9809615,4.3443829 8.9780532,7.1830936 10.167295,7.1426991 11.108291,7.6664967 11.822182,8.7064442 12.799984,8.6194307 13.765772,8.6795708 14.658208,9.6382815 15.605885,9.3257847 16.200803,8.852941 16.675838,8.325607 13.735088,9.4033595 8.6151974,5.957728 11.392726,0.92763044 Z"
+ id="path4537"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="cccccc" />
+ </g>
+</svg>
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark.png b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark.png
new file mode 100644
index 00000000..72b84245
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark@2x.png
new file mode 100644
index 00000000..bc49e4f4
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-light.png
index 42c92516..42c92516 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/wifi.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Settings/images/wifi@2x.png b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-light@2x.png
index 8aa4c9a8..8aa4c9a8 100644
--- a/examples/quickcontrols2/wearable/qml/Settings/images/wifi@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Settings/images/wifi-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml b/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml
index 6a92c42f..81d4c9ef 100644
--- a/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml
+++ b/examples/quickcontrols2/wearable/qml/Style/PageIndicator.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.10
+import QtQuick.Templates 2.3 as T
import "."
T.PageIndicator {
@@ -67,7 +67,7 @@ T.PageIndicator {
implicitHeight: 8
radius: width / 2
- color: UIStyle.colorQtGray3
+ color: UIStyle.themeColorQtGray3
opacity: index === control.currentIndex ? 1.0 : 0.35
diff --git a/examples/quickcontrols2/wearable/qml/Style/Slider.qml b/examples/quickcontrols2/wearable/qml/Style/Slider.qml
index 86f28abe..cdff4aec 100644
--- a/examples/quickcontrols2/wearable/qml/Style/Slider.qml
+++ b/examples/quickcontrols2/wearable/qml/Style/Slider.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.10
+import QtQuick.Templates 2.3 as T
import "."
T.Slider {
@@ -66,14 +66,14 @@ T.Slider {
radius: 5
color: control.pressed ? "#f0f0f0" : "#f6f6f6"
- border.color: UIStyle.colorQtGray7
+ border.color: UIStyle.themeColorQtGray7
}
background: Rectangle {
y: (control.height - height) / 2
height: 4
radius: 2
- color: UIStyle.colorQtGray3
+ color: UIStyle.themeColorQtGray3
Rectangle {
width: control.visualPosition * parent.width
diff --git a/examples/quickcontrols2/wearable/qml/Style/Switch.qml b/examples/quickcontrols2/wearable/qml/Style/Switch.qml
index a1dad07a..b1597737 100644
--- a/examples/quickcontrols2/wearable/qml/Style/Switch.qml
+++ b/examples/quickcontrols2/wearable/qml/Style/Switch.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Templates 2.0 as T
+import QtQuick 2.10
+import QtQuick.Templates 2.3 as T
import "."
T.Switch {
@@ -65,7 +65,7 @@ T.Switch {
height: 26
radius: 13
- color: control.down ? UIStyle.colorQtGray6 : UIStyle.colorQtGray10
+ color: control.down ? UIStyle.themeColorQtGray6 : UIStyle.themeColorQtGray10
border.color: !control.checked ? "#999999"
: (control.down ? UIStyle.colorQtAuxGreen2
: UIStyle.colorQtAuxGreen1)
@@ -78,9 +78,9 @@ T.Switch {
background: Rectangle {
radius: 13
- color: control.checked ? UIStyle.colorQtAuxGreen2 : "#E6173D"
+ color: control.checked ? UIStyle.colorQtAuxGreen2 : UIStyle.colorRed
border.color: control.checked ? UIStyle.colorQtAuxGreen2
- : UIStyle.colorQtGray6
+ : UIStyle.themeColorQtGray6
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml
index 98971233..f4a5df69 100644
--- a/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml
+++ b/examples/quickcontrols2/wearable/qml/Style/UIStyle.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.7
+import QtQuick 2.10
pragma Singleton
@@ -70,6 +70,9 @@ QtObject {
readonly property color colorQtAuxGreen1: "#21be2b"
readonly property color colorQtAuxGreen2: "#17a81a"
+ // Red
+ readonly property color colorRed: "#e6173d"
+
// Gray
readonly property color colorQtGray1: "#09102b"
readonly property color colorQtGray2: "#222840"
@@ -81,4 +84,24 @@ QtObject {
readonly property color colorQtGray8: "#b5b7bf"
readonly property color colorQtGray9: "#cecfd5"
readonly property color colorQtGray10: "#f3f3f4"
+
+ // Light/dark versions of the colors above.
+ // Some UI elements always use a specific color regardless of theme,
+ // which is why we have both sets: so that those elements don't need to hard-code the hex string.
+ readonly property color themeColorQtGray1: darkTheme ? colorQtGray10 : colorQtGray1
+ readonly property color themeColorQtGray2: darkTheme ? colorQtGray9 : colorQtGray2
+ readonly property color themeColorQtGray3: darkTheme ? colorQtGray8 : colorQtGray3
+ readonly property color themeColorQtGray4: darkTheme ? colorQtGray7 : colorQtGray4
+ readonly property color themeColorQtGray5: darkTheme ? colorQtGray6 : colorQtGray5
+ readonly property color themeColorQtGray6: darkTheme ? colorQtGray5 : colorQtGray6
+ readonly property color themeColorQtGray7: darkTheme ? colorQtGray4 : colorQtGray7
+ readonly property color themeColorQtGray8: darkTheme ? colorQtGray3 : colorQtGray8
+ readonly property color themeColorQtGray9: darkTheme ? colorQtGray2 : colorQtGray9
+ readonly property color themeColorQtGray10: darkTheme ? colorQtGray1 : colorQtGray10
+
+ property bool darkTheme: false
+
+ function themeImagePath(baseImagePath) {
+ return baseImagePath + (darkTheme ? "-dark" : "-light") + ".png"
+ }
}
diff --git a/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml b/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml
index 0a9ada57..6d4b687f 100644
--- a/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml
+++ b/examples/quickcontrols2/wearable/qml/SwipeViewPage.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.1
+import QtQuick 2.10
+import QtQuick.Controls 2.2
Item {
// Don't show the item when the StackView that contains us
diff --git a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
index a02b44ee..256e60a4 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
+++ b/examples/quickcontrols2/wearable/qml/Weather/WeatherPage.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import ".."
import "../Style"
import "weather.js" as WeatherData
@@ -69,7 +69,7 @@ Item {
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/temperature.png"
+ source: UIStyle.themeImagePath("images/temperature")
}
Column {
@@ -85,7 +85,7 @@ Item {
+ " °F" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -97,7 +97,7 @@ Item {
+ " °F" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -109,7 +109,7 @@ Item {
+ " °F " : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
}
@@ -129,7 +129,7 @@ Item {
Image {
id: wImg
anchors.verticalCenter: parent.verticalCenter
- source: "images/wind.png"
+ source: UIStyle.themeImagePath("images/wind")
}
Text {
@@ -141,7 +141,7 @@ Item {
+ " mph" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
@@ -152,7 +152,7 @@ Item {
Image {
id: hImg
anchors.verticalCenter: parent.verticalCenter
- source: "images/humidity.png"
+ source: UIStyle.themeImagePath("images/humidity")
}
Text {
@@ -164,7 +164,7 @@ Item {
+ " %" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
}
@@ -179,7 +179,7 @@ Item {
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/pressure.png"
+ source: UIStyle.themeImagePath("images/pressure")
}
Column {
@@ -195,7 +195,7 @@ Item {
+ " hPa" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -207,7 +207,7 @@ Item {
+ " hPa" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
Text {
@@ -219,7 +219,7 @@ Item {
+ " hPa" : "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
}
@@ -238,7 +238,7 @@ Item {
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/sunrise.png"
+ source: UIStyle.themeImagePath("images/sunrise")
}
Text {
@@ -250,7 +250,7 @@ Item {
: "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
@@ -260,7 +260,7 @@ Item {
Image {
anchors.verticalCenter: parent.verticalCenter
- source: "images/sunset.png"
+ source: UIStyle.themeImagePath("images/sunset")
}
Text {
@@ -272,7 +272,7 @@ Item {
: "N/A"
font.pixelSize: UIStyle.fontSizeM
font.letterSpacing: 1
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
}
}
}
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark.png b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark.png
new file mode 100644
index 00000000..6baaefda
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark@2x.png
new file mode 100644
index 00000000..7060c48d
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-light.png
index ef9ed9de..ef9ed9de 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/humidity.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/humidity@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-light@2x.png
index 5c367a3e..5c367a3e 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/humidity@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/humidity-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark.png b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark.png
new file mode 100644
index 00000000..2038c695
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark@2x.png
new file mode 100644
index 00000000..9b5a4abe
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-light.png
index 7850609e..7850609e 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/pressure.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/pressure@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-light@2x.png
index 14c1cab3..14c1cab3 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/pressure@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/pressure-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark.png
new file mode 100644
index 00000000..5a70f984
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark@2x.png
new file mode 100644
index 00000000..2baa7135
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-light.png
index 70a9a969..70a9a969 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-light@2x.png
index 3a7892eb..3a7892eb 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/sunrise@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunrise-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark.png
new file mode 100644
index 00000000..5dde7c0f
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark@2x.png
new file mode 100644
index 00000000..3892c2ea
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-light.png
index 01bb9ec8..01bb9ec8 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/sunset.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/sunset@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-light@2x.png
index 39aeebe5..39aeebe5 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/sunset@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/sunset-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark.png b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark.png
new file mode 100644
index 00000000..1c86bae2
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark@2x.png
new file mode 100644
index 00000000..c1ac7d66
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-light.png
index 5d7faa99..5d7faa99 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/temperature.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/temperature@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-light@2x.png
index 0b4340ce..0b4340ce 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/temperature@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/temperature-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/wind-dark.png b/examples/quickcontrols2/wearable/qml/Weather/images/wind-dark.png
new file mode 100644
index 00000000..4e5264a3
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/wind-dark.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/wind-dark@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/wind-dark@2x.png
new file mode 100644
index 00000000..0a893d50
--- /dev/null
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/wind-dark@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/wind.png b/examples/quickcontrols2/wearable/qml/Weather/images/wind-light.png
index c728fcc0..c728fcc0 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/wind.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/wind-light.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/Weather/images/wind@2x.png b/examples/quickcontrols2/wearable/qml/Weather/images/wind-light@2x.png
index bab49c04..bab49c04 100644
--- a/examples/quickcontrols2/wearable/qml/Weather/images/wind@2x.png
+++ b/examples/quickcontrols2/wearable/qml/Weather/images/wind-light@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
index e3da38c7..158f3d70 100644
--- a/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/Clock.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import ".."
import "../Style"
@@ -180,7 +180,7 @@ SwipeViewPage {
anchors.horizontalCenter: parent.horizontalCenter
text: cityName
- color: UIStyle.colorQtGray1
+ color: UIStyle.themeColorQtGray1
font.pixelSize: UIStyle.fontSizeXS
font.letterSpacing: 2
}
diff --git a/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml
index cdf96bf2..1456072f 100644
--- a/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml
+++ b/examples/quickcontrols2/wearable/qml/WorldClock/WorldClockPage.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
import "../Style"
Item {
diff --git a/examples/quickcontrols2/wearable/wearable.cpp b/examples/quickcontrols2/wearable/wearable.cpp
index e90ec413..68dee7c0 100644
--- a/examples/quickcontrols2/wearable/wearable.cpp
+++ b/examples/quickcontrols2/wearable/wearable.cpp
@@ -56,6 +56,9 @@
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+ QCoreApplication::setApplicationName("Wearable");
+ QCoreApplication::setOrganizationName("QtProject");
+
QGuiApplication app(argc, argv);
//! [style]
diff --git a/examples/quickcontrols2/wearable/wearable.qml b/examples/quickcontrols2/wearable/wearable.qml
index 01d52b12..ea84adca 100644
--- a/examples/quickcontrols2/wearable/wearable.qml
+++ b/examples/quickcontrols2/wearable/wearable.qml
@@ -48,23 +48,41 @@
**
****************************************************************************/
-import QtQuick 2.7
-import QtQuick.Controls 2.0 as QQC2
+import QtQuick 2.10
+import QtQuick.Controls 2.3 as QQC2
+import Qt.labs.settings 1.0
import "qml"
import "qml/Style"
QQC2.ApplicationWindow {
id: window
-
visible: true
-
width: 320
height: 320
-
title: qsTr("Wearable")
+ Settings {
+ id: settings
+ property bool wireless
+ property bool bluetooth
+ property int brightness
+ property bool darkTheme
+ property bool demoMode
+ }
+
+ Binding {
+ target: UIStyle
+ property: "darkTheme"
+ value: settings.darkTheme
+ }
+
+ // We need the settings object both here and in SettingsPage,
+ // so for convenience, we declare it as a property of the root object so that
+ // it will be available to all of the QML files that we load.
+ property alias settings: settings
+
background: Image {
- source: "images/background.png"
+ source: "images/background-" + (settings.darkTheme ? "dark" : "light") + ".png"
}
header: NaviButton {
@@ -97,4 +115,26 @@ QQC2.ApplicationWindow {
onLaunched: stackView.push(page)
}
}
+
+ DemoMode {
+ stackView: stackView
+ }
+
+ DemoModeIndicator {
+ id: demoModeIndicator
+ y: settings.demoMode ? -height : -height * 2
+ anchors.horizontalCenter: parent.horizontalCenter
+ height: header.height
+ z: window.header.z + 1
+ }
+
+ MouseArea {
+ enabled: settings.demoMode
+ anchors.fill: parent
+ onClicked: {
+ // Stop demo mode and return to the launcher page.
+ settings.demoMode = false
+ stackView.pop(null)
+ }
+ }
}
diff --git a/examples/quickcontrols2/wearable/wearable.qrc b/examples/quickcontrols2/wearable/wearable.qrc
index d71b5bab..db59d038 100644
--- a/examples/quickcontrols2/wearable/wearable.qrc
+++ b/examples/quickcontrols2/wearable/wearable.qrc
@@ -18,7 +18,8 @@
<file>icons/wearable/36x36@2/settings.png</file>
<file>icons/wearable/36x36@2/weather.png</file>
<file>icons/wearable/36x36@2/worldclock.png</file>
- <file>images/background.png</file>
+ <file>images/background-light.png</file>
+ <file>images/background-dark.png</file>
<file>images/back.png</file>
<file>images/back@2x.png</file>
<file>images/home.png</file>
@@ -26,45 +27,77 @@
<file>qml/Alarms/AlarmsPage.qml</file>
<file>qml/Fitness/fitness.js</file>
<file>qml/Fitness/FitnessPage.qml</file>
- <file>qml/Fitness/images/man-running.png</file>
- <file>qml/Fitness/images/man-running@2x.png</file>
- <file>qml/Fitness/images/man-walking.png</file>
- <file>qml/Fitness/images/man-walking@2x.png</file>
+ <file>qml/Fitness/images/man-running-light.png</file>
+ <file>qml/Fitness/images/man-running-light@2x.png</file>
+ <file>qml/Fitness/images/man-walking-light.png</file>
+ <file>qml/Fitness/images/man-walking-light@2x.png</file>
+ <file>qml/Fitness/images/man-running-dark.png</file>
+ <file>qml/Fitness/images/man-running-dark@2x.png</file>
+ <file>qml/Fitness/images/man-walking-dark.png</file>
+ <file>qml/Fitness/images/man-walking-dark@2x.png</file>
<file>qml/Navigation/navigation.js</file>
<file>qml/Navigation/NavigationPage.qml</file>
<file>qml/Navigation/RouteElement.qml</file>
<file>qml/Navigation/walk_route.json</file>
<file>qml/Navigation/images/end.png</file>
<file>qml/Navigation/images/end@2x.png</file>
- <file>qml/Navigation/images/leftturn.png</file>
- <file>qml/Navigation/images/leftturn@2x.png</file>
- <file>qml/Navigation/images/navigation.png</file>
- <file>qml/Navigation/images/navigation@2x.png</file>
- <file>qml/Navigation/images/rightturn.png</file>
- <file>qml/Navigation/images/rightturn@2x.png</file>
+ <file>qml/Navigation/images/leftturn-light.png</file>
+ <file>qml/Navigation/images/leftturn-light@2x.png</file>
+ <file>qml/Navigation/images/leftturn-dark.png</file>
+ <file>qml/Navigation/images/leftturn-dark@2x.png</file>
+ <file>qml/Navigation/images/navigation-light.png</file>
+ <file>qml/Navigation/images/navigation-light@2x.png</file>
+ <file>qml/Navigation/images/navigation-dark.png</file>
+ <file>qml/Navigation/images/navigation-dark@2x.png</file>
+ <file>qml/Navigation/images/rightturn-light.png</file>
+ <file>qml/Navigation/images/rightturn-light@2x.png</file>
+ <file>qml/Navigation/images/rightturn-dark.png</file>
+ <file>qml/Navigation/images/rightturn-dark@2x.png</file>
<file>qml/Navigation/images/start.png</file>
<file>qml/Navigation/images/start@2x.png</file>
- <file>qml/Navigation/images/straight.png</file>
- <file>qml/Navigation/images/straight@2x.png</file>
+ <file>qml/Navigation/images/straight-light.png</file>
+ <file>qml/Navigation/images/straight-light@2x.png</file>
+ <file>qml/Navigation/images/straight-dark.png</file>
+ <file>qml/Navigation/images/straight-dark@2x.png</file>
<file>qml/Navigation/images/uturn.png</file>
<file>qml/Navigation/images/uturn@2x.png</file>
<file>qml/Notifications/notifications.js</file>
<file>qml/Notifications/NotificationsPage.qml</file>
- <file>qml/Notifications/images/avatarf.png</file>
- <file>qml/Notifications/images/avatarf@2x.png</file>
- <file>qml/Notifications/images/avatarm.png</file>
- <file>qml/Notifications/images/avatarm@2x.png</file>
- <file>qml/Notifications/images/missedcall.png</file>
- <file>qml/Notifications/images/missedcall@2x.png</file>
+ <file>qml/Notifications/images/avatarf-light.png</file>
+ <file>qml/Notifications/images/avatarf-light@2x.png</file>
+ <file>qml/Notifications/images/avatarm-light.png</file>
+ <file>qml/Notifications/images/avatarm-light@2x.png</file>
+ <file>qml/Notifications/images/missedcall-light.png</file>
+ <file>qml/Notifications/images/missedcall-light@2x.png</file>
+ <file>qml/Notifications/images/avatarf-dark.png</file>
+ <file>qml/Notifications/images/avatarf-dark@2x.png</file>
+ <file>qml/Notifications/images/avatarm-dark.png</file>
+ <file>qml/Notifications/images/avatarm-dark@2x.png</file>
+ <file>qml/Notifications/images/missedcall-dark.png</file>
+ <file>qml/Notifications/images/missedcall-dark@2x.png</file>
<file>qml/Settings/SettingsPage.qml</file>
- <file>qml/Settings/images/bluetooth.png</file>
- <file>qml/Settings/images/bluetooth@2x.png</file>
- <file>qml/Settings/images/brightness.png</file>
- <file>qml/Settings/images/brightness@2x.png</file>
- <file>qml/Settings/images/contrast.png</file>
- <file>qml/Settings/images/contrast@2x.png</file>
- <file>qml/Settings/images/wifi.png</file>
- <file>qml/Settings/images/wifi@2x.png</file>
+ <file>qml/Settings/images/bluetooth-light.png</file>
+ <file>qml/Settings/images/bluetooth-light@2x.png</file>
+ <file>qml/Settings/images/brightness-light.png</file>
+ <file>qml/Settings/images/brightness-light@2x.png</file>
+ <file>qml/Settings/images/demo-mode-light.png</file>
+ <file>qml/Settings/images/demo-mode-light@2x.png</file>
+ <file>qml/Settings/images/demo-mode-dark.png</file>
+ <file>qml/Settings/images/demo-mode-dark@2x.png</file>
+ <file>qml/Settings/images/demo-mode-white.png</file>
+ <file>qml/Settings/images/demo-mode-white@2x.png</file>
+ <file>qml/Settings/images/theme-light.png</file>
+ <file>qml/Settings/images/theme-light@2x.png</file>
+ <file>qml/Settings/images/wifi-light.png</file>
+ <file>qml/Settings/images/wifi-light@2x.png</file>
+ <file>qml/Settings/images/bluetooth-dark.png</file>
+ <file>qml/Settings/images/bluetooth-dark@2x.png</file>
+ <file>qml/Settings/images/brightness-dark.png</file>
+ <file>qml/Settings/images/brightness-dark@2x.png</file>
+ <file>qml/Settings/images/theme-dark.png</file>
+ <file>qml/Settings/images/theme-dark@2x.png</file>
+ <file>qml/Settings/images/wifi-dark.png</file>
+ <file>qml/Settings/images/wifi-dark@2x.png</file>
<file>qml/Style/qmldir</file>
<file>qml/Style/PageIndicator.qml</file>
<file>qml/Style/Slider.qml</file>
@@ -73,18 +106,30 @@
<file>qml/Weather/weather.js</file>
<file>qml/Weather/weather.json</file>
<file>qml/Weather/WeatherPage.qml</file>
- <file>qml/Weather/images/humidity.png</file>
- <file>qml/Weather/images/humidity@2x.png</file>
- <file>qml/Weather/images/pressure.png</file>
- <file>qml/Weather/images/pressure@2x.png</file>
- <file>qml/Weather/images/sunrise.png</file>
- <file>qml/Weather/images/sunrise@2x.png</file>
- <file>qml/Weather/images/sunset.png</file>
- <file>qml/Weather/images/sunset@2x.png</file>
- <file>qml/Weather/images/temperature.png</file>
- <file>qml/Weather/images/temperature@2x.png</file>
- <file>qml/Weather/images/wind.png</file>
- <file>qml/Weather/images/wind@2x.png</file>
+ <file>qml/Weather/images/humidity-light.png</file>
+ <file>qml/Weather/images/humidity-light@2x.png</file>
+ <file>qml/Weather/images/pressure-light.png</file>
+ <file>qml/Weather/images/pressure-light@2x.png</file>
+ <file>qml/Weather/images/sunrise-light.png</file>
+ <file>qml/Weather/images/sunrise-light@2x.png</file>
+ <file>qml/Weather/images/sunset-light.png</file>
+ <file>qml/Weather/images/sunset-light@2x.png</file>
+ <file>qml/Weather/images/temperature-light.png</file>
+ <file>qml/Weather/images/temperature-light@2x.png</file>
+ <file>qml/Weather/images/wind-light.png</file>
+ <file>qml/Weather/images/wind-light@2x.png</file>
+ <file>qml/Weather/images/humidity-dark.png</file>
+ <file>qml/Weather/images/humidity-dark@2x.png</file>
+ <file>qml/Weather/images/pressure-dark.png</file>
+ <file>qml/Weather/images/pressure-dark@2x.png</file>
+ <file>qml/Weather/images/sunrise-dark.png</file>
+ <file>qml/Weather/images/sunrise-dark@2x.png</file>
+ <file>qml/Weather/images/sunset-dark.png</file>
+ <file>qml/Weather/images/sunset-dark@2x.png</file>
+ <file>qml/Weather/images/temperature-dark.png</file>
+ <file>qml/Weather/images/temperature-dark@2x.png</file>
+ <file>qml/Weather/images/wind-dark.png</file>
+ <file>qml/Weather/images/wind-dark@2x.png</file>
<file>qml/WorldClock/Clock.qml</file>
<file>qml/WorldClock/WorldClockPage.qml</file>
<file>qml/WorldClock/images/center.png</file>
@@ -104,5 +149,7 @@
<file>qml/WorldClock/images/swissnightminute.png</file>
<file>qml/WorldClock/images/swissnightminute@2x.png</file>
<file>qml/SwipeViewPage.qml</file>
+ <file>qml/DemoMode.qml</file>
+ <file>qml/DemoModeIndicator.qml</file>
</qresource>
</RCC>
diff --git a/src/imports/calendar/qtlabscalendarplugin.cpp b/src/imports/calendar/qtlabscalendarplugin.cpp
index 178118fb..903eb8c0 100644
--- a/src/imports/calendar/qtlabscalendarplugin.cpp
+++ b/src/imports/calendar/qtlabscalendarplugin.cpp
@@ -42,13 +42,6 @@
#include "qquickcalendarmodel_p.h"
#include "qquickcalendar_p.h"
-static inline void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_Qt_labs_calendar);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QtLabsCalendarPlugin: public QQmlExtensionPlugin
@@ -63,7 +56,6 @@ public:
QtLabsCalendarPlugin::QtLabsCalendarPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
{
- initResources();
}
static QObject *calendarSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
diff --git a/src/imports/controls/AbstractButton.qml b/src/imports/controls/AbstractButton.qml
index 2ff1b82c..f3dda0af 100644
--- a/src/imports/controls/AbstractButton.qml
+++ b/src/imports/controls/AbstractButton.qml
@@ -34,15 +34,14 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.AbstractButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem ? contentItem.y + contentItem.baselineOffset : 0
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
}
diff --git a/src/imports/controls/Action.qml b/src/imports/controls/Action.qml
index 0ba5822f..fe86213a 100644
--- a/src/imports/controls/Action.qml
+++ b/src/imports/controls/Action.qml
@@ -34,7 +34,7 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.Action { }
diff --git a/src/imports/controls/ActionGroup.qml b/src/imports/controls/ActionGroup.qml
index a8c49d8b..ae8772d6 100644
--- a/src/imports/controls/ActionGroup.qml
+++ b/src/imports/controls/ActionGroup.qml
@@ -34,7 +34,7 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.ActionGroup { }
diff --git a/src/imports/controls/ApplicationWindow.qml b/src/imports/controls/ApplicationWindow.qml
index 84b618e1..4ad97082 100644
--- a/src/imports/controls/ApplicationWindow.qml
+++ b/src/imports/controls/ApplicationWindow.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/BusyIndicator.qml b/src/imports/controls/BusyIndicator.qml
index bde5fa7c..a79e2620 100644
--- a/src/imports/controls/BusyIndicator.qml
+++ b/src/imports/controls/BusyIndicator.qml
@@ -34,16 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.BusyIndicator {
id: control
- implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
- implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/Button.qml b/src/imports/controls/Button.qml
index 7039dfc9..4132e326 100644
--- a/src/imports/controls/Button.qml
+++ b/src/imports/controls/Button.qml
@@ -34,23 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Button {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
- leftPadding: padding + 2
- rightPadding: padding + 2
+ horizontalPadding: padding + 2
spacing: 6
icon.width: 24
diff --git a/src/imports/controls/ButtonGroup.qml b/src/imports/controls/ButtonGroup.qml
index 4e8ae893..50d3b840 100644
--- a/src/imports/controls/ButtonGroup.qml
+++ b/src/imports/controls/ButtonGroup.qml
@@ -34,7 +34,7 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.ButtonGroup { }
diff --git a/src/imports/controls/CheckBox.qml b/src/imports/controls/CheckBox.qml
index 136c9b36..be4e62a6 100644
--- a/src/imports/controls/CheckBox.qml
+++ b/src/imports/controls/CheckBox.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.CheckBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/CheckDelegate.qml b/src/imports/controls/CheckDelegate.qml
index 087c9d75..3e58ffbb 100644
--- a/src/imports/controls/CheckDelegate.qml
+++ b/src/imports/controls/CheckDelegate.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.CheckDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
spacing: 12
diff --git a/src/imports/controls/ComboBox.qml b/src/imports/controls/ComboBox.qml
index 2bb26967..5cef9e55 100644
--- a/src/imports/controls/ComboBox.qml
+++ b/src/imports/controls/ComboBox.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ComboBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
diff --git a/src/imports/controls/Container.qml b/src/imports/controls/Container.qml
index e7cf8a2a..1f30de42 100644
--- a/src/imports/controls/Container.qml
+++ b/src/imports/controls/Container.qml
@@ -34,14 +34,14 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.Container {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
}
diff --git a/src/imports/controls/Control.qml b/src/imports/controls/Control.qml
index 5728da0a..ff1c0b08 100644
--- a/src/imports/controls/Control.qml
+++ b/src/imports/controls/Control.qml
@@ -34,14 +34,14 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.Control {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (contentItem ? contentItem.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
}
diff --git a/src/imports/controls/DelayButton.qml b/src/imports/controls/DelayButton.qml
index b34caed6..024ebcfe 100644
--- a/src/imports/controls/DelayButton.qml
+++ b/src/imports/controls/DelayButton.qml
@@ -34,23 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.DelayButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
- leftPadding: padding + 2
- rightPadding: padding + 2
+ horizontalPadding: padding + 2
transition: Transition {
NumberAnimation {
diff --git a/src/imports/controls/Dial.qml b/src/imports/controls/Dial.qml
index f4132611..37a9edbe 100644
--- a/src/imports/controls/Dial.qml
+++ b/src/imports/controls/Dial.qml
@@ -34,20 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Dial {
id: control
- implicitWidth: 184
- implicitHeight: 184
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 184 // ### remove 184 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 184 // ### remove 184 in Qt 6
background: DialImpl {
- width: control.availableWidth
- height: control.availableHeight
+ implicitWidth: 184
+ implicitHeight: 184
color: control.visualFocus ? control.palette.highlight : control.palette.dark
progress: control.position
opacity: control.enabled ? 1 : 0.3
diff --git a/src/imports/controls/Dialog.qml b/src/imports/controls/Dialog.qml
index 913e23f1..5f8d74c4 100644
--- a/src/imports/controls/Dialog.qml
+++ b/src/imports/controls/Dialog.qml
@@ -34,25 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.Dialog {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
- + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
padding: 12
diff --git a/src/imports/controls/DialogButtonBox.qml b/src/imports/controls/DialogButtonBox.qml
index 3189967d..aa0353c0 100644
--- a/src/imports/controls/DialogButtonBox.qml
+++ b/src/imports/controls/DialogButtonBox.qml
@@ -34,16 +34,16 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.DialogButtonBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ (control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 1
padding: 12
@@ -54,9 +54,6 @@ T.DialogButtonBox {
}
contentItem: ListView {
- implicitWidth: control.count === 1 ? 200 : contentWidth
- implicitHeight: 40
-
model: control.contentModel
spacing: control.spacing
orientation: ListView.Horizontal
diff --git a/src/imports/controls/Drawer.qml b/src/imports/controls/Drawer.qml
index dbafbd92..0b882f90 100644
--- a/src/imports/controls/Drawer.qml
+++ b/src/imports/controls/Drawer.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Drawer {
id: control
parent: T.Overlay.overlay
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: control.edge === Qt.BottomEdge
leftPadding: control.edge === Qt.RightEdge
diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml
index 7c8a4db7..9ada5273 100644
--- a/src/imports/controls/Frame.qml
+++ b/src/imports/controls/Frame.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/GroupBox.qml b/src/imports/controls/GroupBox.qml
index 2985c02e..e16148bc 100644
--- a/src/imports/controls/GroupBox.qml
+++ b/src/imports/controls/GroupBox.qml
@@ -34,25 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.GroupBox {
id: control
- 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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitLabelWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 6
padding: 12
- topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
label: Text {
x: control.leftPadding
diff --git a/src/imports/controls/ItemDelegate.qml b/src/imports/controls/ItemDelegate.qml
index 6367bc86..a7cc499d 100644
--- a/src/imports/controls/ItemDelegate.qml
+++ b/src/imports/controls/ItemDelegate.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ItemDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
spacing: 8
diff --git a/src/imports/controls/Label.qml b/src/imports/controls/Label.qml
index aa02918f..6c3c05d4 100644
--- a/src/imports/controls/Label.qml
+++ b/src/imports/controls/Label.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Label {
id: control
diff --git a/src/imports/controls/Menu.qml b/src/imports/controls/Menu.qml
index 0545b9a1..cebca827 100644
--- a/src/imports/controls/Menu.qml
+++ b/src/imports/controls/Menu.qml
@@ -34,19 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Window 2.11
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Window 2.12
T.Menu {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 0
overlap: 1
diff --git a/src/imports/controls/MenuBar.qml b/src/imports/controls/MenuBar.qml
index 058c8736..9e145b6a 100644
--- a/src/imports/controls/MenuBar.qml
+++ b/src/imports/controls/MenuBar.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.MenuBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
delegate: MenuBarItem { }
diff --git a/src/imports/controls/MenuBarItem.qml b/src/imports/controls/MenuBarItem.qml
index 02e3ac43..e1ba4a41 100644
--- a/src/imports/controls/MenuBarItem.qml
+++ b/src/imports/controls/MenuBarItem.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.MenuBarItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 6
padding: 6
diff --git a/src/imports/controls/MenuItem.qml b/src/imports/controls/MenuItem.qml
index 90a19f57..7af280a3 100644
--- a/src/imports/controls/MenuItem.qml
+++ b/src/imports/controls/MenuItem.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.MenuItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/MenuSeparator.qml b/src/imports/controls/MenuSeparator.qml
index ac47e32c..43c421a3 100644
--- a/src/imports/controls/MenuSeparator.qml
+++ b/src/imports/controls/MenuSeparator.qml
@@ -34,20 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.MenuSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
- topPadding: padding + 4
- bottomPadding: padding + 4
+ verticalPadding: padding + 4
contentItem: Rectangle {
implicitWidth: 188
diff --git a/src/imports/controls/Page.qml b/src/imports/controls/Page.qml
index 23377368..844f44d1 100644
--- a/src/imports/controls/Page.qml
+++ b/src/imports/controls/Page.qml
@@ -34,25 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Page {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
- + (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
background: Rectangle {
color: control.palette.window
diff --git a/src/imports/controls/PageIndicator.qml b/src/imports/controls/PageIndicator.qml
index 9d048002..6985919b 100644
--- a/src/imports/controls/PageIndicator.qml
+++ b/src/imports/controls/PageIndicator.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.PageIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/Pane.qml b/src/imports/controls/Pane.qml
index 7517e2f2..ee715c86 100644
--- a/src/imports/controls/Pane.qml
+++ b/src/imports/controls/Pane.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Pane {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/Popup.qml b/src/imports/controls/Popup.qml
index 7ea706ed..13de88a3 100644
--- a/src/imports/controls/Popup.qml
+++ b/src/imports/controls/Popup.qml
@@ -34,21 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Popup {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/ProgressBar.qml b/src/imports/controls/ProgressBar.qml
index d91bcd57..c6b773ce 100644
--- a/src/imports/controls/ProgressBar.qml
+++ b/src/imports/controls/ProgressBar.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.ProgressBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
contentItem: ProgressBarImpl {
implicitHeight: 6
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index d95d2a7b..02251239 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.RadioButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml
index 556d678f..3846cd34 100644
--- a/src/imports/controls/RadioDelegate.qml
+++ b/src/imports/controls/RadioDelegate.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.RadioDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
spacing: 12
diff --git a/src/imports/controls/RangeSlider.qml b/src/imports/controls/RangeSlider.qml
index f2c9266e..6de74a9f 100644
--- a/src/imports/controls/RangeSlider.qml
+++ b/src/imports/controls/RangeSlider.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.RangeSlider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ first.implicitHandleWidth + leftPadding + rightPadding,
+ second.implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ first.implicitHandleHeight + topPadding + bottomPadding,
+ second.implicitHandleHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/RoundButton.qml b/src/imports/controls/RoundButton.qml
index 9692b9de..11649094 100644
--- a/src/imports/controls/RoundButton.qml
+++ b/src/imports/controls/RoundButton.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.RoundButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/ScrollBar.qml b/src/imports/controls/ScrollBar.qml
index 2f8826bf..c16b4356 100644
--- a/src/imports/controls/ScrollBar.qml
+++ b/src/imports/controls/ScrollBar.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ScrollBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
visible: control.policy !== T.ScrollBar.AlwaysOff
diff --git a/src/imports/controls/ScrollIndicator.qml b/src/imports/controls/ScrollIndicator.qml
index 6616d6c6..96099bf1 100644
--- a/src/imports/controls/ScrollIndicator.qml
+++ b/src/imports/controls/ScrollIndicator.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ScrollIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
diff --git a/src/imports/controls/ScrollView.qml b/src/imports/controls/ScrollView.qml
index 725a50a9..57299575 100644
--- a/src/imports/controls/ScrollView.qml
+++ b/src/imports/controls/ScrollView.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ScrollView {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : -1)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : -1)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
ScrollBar.vertical: ScrollBar {
parent: control
diff --git a/src/imports/controls/Slider.qml b/src/imports/controls/Slider.qml
index 9d4942c9..3d95cae9 100644
--- a/src/imports/controls/Slider.qml
+++ b/src/imports/controls/Slider.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Slider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHandleHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/SpinBox.qml b/src/imports/controls/SpinBox.qml
index 51d635a6..14a6ea52 100644
--- a/src/imports/controls/SpinBox.qml
+++ b/src/imports/controls/SpinBox.qml
@@ -34,23 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.SpinBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + 2 * padding +
- (up.indicator ? up.indicator.implicitWidth : 0) +
- (down.indicator ? down.indicator.implicitWidth : 0))
- implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
- up.indicator ? up.indicator.implicitHeight : 0,
- down.indicator ? down.indicator.implicitHeight : 0)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ up.implicitIndicatorWidth +
+ down.implicitIndicatorWidth)
+ implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight,
+ up.implicitIndicatorHeight,
+ down.implicitIndicatorHeight)
padding: 6
leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
diff --git a/src/imports/controls/StackView.qml b/src/imports/controls/StackView.qml
index cc4e1472..5da0c541 100644
--- a/src/imports/controls/StackView.qml
+++ b/src/imports/controls/StackView.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Templates 2.5 as T
T.StackView {
id: control
diff --git a/src/imports/controls/SwipeDelegate.qml b/src/imports/controls/SwipeDelegate.qml
index 4f2c9ee1..146c357b 100644
--- a/src/imports/controls/SwipeDelegate.qml
+++ b/src/imports/controls/SwipeDelegate.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.SwipeDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
spacing: 12
diff --git a/src/imports/controls/SwipeView.qml b/src/imports/controls/SwipeView.qml
index 827c9cd6..9665b5ca 100644
--- a/src/imports/controls/SwipeView.qml
+++ b/src/imports/controls/SwipeView.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Templates 2.5 as T
T.SwipeView {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
contentItem: ListView {
model: control.contentModel
diff --git a/src/imports/controls/Switch.qml b/src/imports/controls/Switch.qml
index 30da70f4..e7987385 100644
--- a/src/imports/controls/Switch.qml
+++ b/src/imports/controls/Switch.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.Switch {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/SwitchDelegate.qml b/src/imports/controls/SwitchDelegate.qml
index 21a11491..4d4602e8 100644
--- a/src/imports/controls/SwitchDelegate.qml
+++ b/src/imports/controls/SwitchDelegate.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.SwitchDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
spacing: 12
diff --git a/src/imports/controls/TabBar.qml b/src/imports/controls/TabBar.qml
index d95d7f39..eb4c0ae2 100644
--- a/src/imports/controls/TabBar.qml
+++ b/src/imports/controls/TabBar.qml
@@ -34,15 +34,15 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
T.TabBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
spacing: 1
diff --git a/src/imports/controls/TabButton.qml b/src/imports/controls/TabButton.qml
index 964f4e1f..b6a6317c 100644
--- a/src/imports/controls/TabButton.qml
+++ b/src/imports/controls/TabButton.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.TabButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/TextArea.qml b/src/imports/controls/TextArea.qml
index 86dc7cbf..ff252bba 100644
--- a/src/imports/controls/TextArea.qml
+++ b/src/imports/controls/TextArea.qml
@@ -34,25 +34,26 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
leftPadding: padding + 4
color: control.palette.text
+ placeholderTextColor: Color.transparent(control.color, 0.5)
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
@@ -65,8 +66,7 @@ T.TextArea {
text: control.placeholderText
font: control.font
- opacity: 0.5
- color: control.color
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
diff --git a/src/imports/controls/TextField.qml b/src/imports/controls/TextField.qml
index d9b0046d..aa57da81 100644
--- a/src/imports/controls/TextField.qml
+++ b/src/imports/controls/TextField.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.TextField {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
- || contentWidth + leftPadding + rightPadding
- implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
@@ -55,6 +54,7 @@ T.TextField {
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
+ placeholderTextColor: Color.transparent(control.color, 0.5)
verticalAlignment: TextInput.AlignVCenter
PlaceholderText {
@@ -66,8 +66,7 @@ T.TextField {
text: control.placeholderText
font: control.font
- opacity: 0.5
- color: control.color
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
diff --git a/src/imports/controls/ToolBar.qml b/src/imports/controls/ToolBar.qml
index ba6684b9..1e73c0d6 100644
--- a/src/imports/controls/ToolBar.qml
+++ b/src/imports/controls/ToolBar.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ToolBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
background: Rectangle {
implicitHeight: 40
diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml
index 371d1546..1c5b4662 100644
--- a/src/imports/controls/ToolButton.qml
+++ b/src/imports/controls/ToolButton.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ToolButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/ToolSeparator.qml b/src/imports/controls/ToolSeparator.qml
index 306ca575..f2de5aa9 100644
--- a/src/imports/controls/ToolSeparator.qml
+++ b/src/imports/controls/ToolSeparator.qml
@@ -34,20 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ToolSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: vertical ? 6 : 2
- topPadding: vertical ? 2 : 6
- bottomPadding: vertical ? 2 : 6
+ verticalPadding: vertical ? 2 : 6
contentItem: Rectangle {
implicitWidth: vertical ? 1 : 30
diff --git a/src/imports/controls/ToolTip.qml b/src/imports/controls/ToolTip.qml
index 46f7f577..e3af2ade 100644
--- a/src/imports/controls/ToolTip.qml
+++ b/src/imports/controls/ToolTip.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.ToolTip {
id: control
@@ -45,10 +45,10 @@ T.ToolTip {
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: -implicitHeight - 3
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 6
padding: 6
diff --git a/src/imports/controls/Tumbler.qml b/src/imports/controls/Tumbler.qml
index b9cb51a1..0229dcf3 100644
--- a/src/imports/controls/Tumbler.qml
+++ b/src/imports/controls/Tumbler.qml
@@ -34,15 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Tumbler {
id: control
- implicitWidth: 60
- implicitHeight: 200
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6
delegate: Text {
text: modelData
@@ -54,6 +57,8 @@ T.Tumbler {
}
contentItem: TumblerView {
+ implicitWidth: 60
+ implicitHeight: 200
model: control.model
delegate: control.delegate
path: Path {
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index 7840f6bf..675fcf39 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -12,7 +12,7 @@ SOURCES += \
$$PWD/qquickdefaultstyle.cpp \
$$PWD/qquickdefaulttheme.cpp
-QML_CONTROLS = \
+QML_FILES += \
$$PWD/AbstractButton.qml \
$$PWD/Action.qml \
$$PWD/ActionGroup.qml \
@@ -67,5 +67,3 @@ QML_CONTROLS = \
$$PWD/ToolSeparator.qml \
$$PWD/ToolTip.qml \
$$PWD/Tumbler.qml
-
-!qtquickcompiler: QML_FILES += $$QML_CONTROLS
diff --git a/src/imports/controls/controls.pro b/src/imports/controls/controls.pro
index 6bbbe0d4..db0d14ae 100644
--- a/src/imports/controls/controls.pro
+++ b/src/imports/controls/controls.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2plugin
TARGETPATH = QtQuick/Controls.2
-IMPORT_VERSION = 2.4
+IMPORT_VERSION = 2.5
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
@@ -11,7 +11,7 @@ include(controls.pri)
OTHER_FILES += \
qmldir \
- $$QML_CONTROLS
+ $$QML_FILES
SOURCES += \
$$PWD/qtquickcontrols2plugin.cpp
@@ -22,15 +22,7 @@ RESOURCES += \
!static: qtConfig(quick-designer): include(designer/designer.pri)
include(doc/doc.pri)
-qtquickcompiler {
- qmlfiles.prefix = /qt-project.org/imports/QtQuick/Controls.2
- qmlfiles.files += $$QML_CONTROLS
- RESOURCES += qmlfiles
-} else:!static {
- CONFIG += qmlcache
-}
-
-CONFIG += no_cxx_module
+CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
load(qml_plugin)
requires(qtConfig(quickcontrols2-default))
diff --git a/src/imports/controls/dependencies.json b/src/imports/controls/dependencies.json
index 485db225..78029004 100644
--- a/src/imports/controls/dependencies.json
+++ b/src/imports/controls/dependencies.json
@@ -12,6 +12,6 @@
{
"name": "QtQuick.Templates",
"type": "module",
- "version": "2.4"
+ "version": "2.5"
}
]
diff --git a/src/imports/controls/designer/designer.pri b/src/imports/controls/designer/designer.pri
index 5be660c2..6ae9d5bb 100644
--- a/src/imports/controls/designer/designer.pri
+++ b/src/imports/controls/designer/designer.pri
@@ -1,7 +1,7 @@
-QML_FILES += \
+AUX_QML_FILES += \
$$PWD/qtquickcontrols2.metainfo
-QML_FILES += \
+AUX_QML_FILES += \
$$PWD/AbstractButtonSection.qml \
$$PWD/BusyIndicatorSpecifics.qml \
$$PWD/ButtonSection.qml \
@@ -47,5 +47,5 @@ QML_FILES += \
$$PWD/ToolSeparatorSpecifics.qml \
$$PWD/TumblerSpecifics.qml
-QML_FILES += \
+AUX_QML_FILES += \
$$PWD/images/*.png
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-control.png b/src/imports/controls/doc/images/qtquickcontrols2-control.png
index 26babc9f..71840a49 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-control.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-control.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-control.svg b/src/imports/controls/doc/images/qtquickcontrols2-control.svg
index b0ffae7c..4b2057d1 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-control.svg
+++ b/src/imports/controls/doc/images/qtquickcontrols2-control.svg
@@ -9,16 +9,16 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="679.31317"
- height="357.84125"
- viewBox="0 0 679.31314 357.84124"
+ width="760"
+ height="580"
+ viewBox="0 0 759.99997 579.99999"
id="svg2"
version="1.1"
- inkscape:version="0.91 r13725"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
sodipodi:docname="qtquickcontrols2-control.svg"
- inkscape:export-filename="/home/mitch/Dropbox/qtquickcontrols2-control.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
+ inkscape:export-filename="/home/jpnurmi/Projects/qt-dev/qtquickcontrols2/src/imports/controls/doc/images/qtquickcontrols2-control.png"
+ inkscape:export-xdpi="192"
+ inkscape:export-ydpi="192">
<defs
id="defs4">
<marker
@@ -31,9 +31,9 @@
inkscape:isstock="true">
<path
id="path4327"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(0.8,0.8)"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
inkscape:connector-curvature="0" />
</marker>
<marker
@@ -46,9 +46,9 @@
inkscape:isstock="true">
<path
id="path4318"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(-0.8,-0.8)"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
inkscape:connector-curvature="0" />
</marker>
<marker
@@ -61,8 +61,8 @@
inkscape:isstock="true">
<path
id="path4191"
- d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
+ d="M 0,0 5,-5 -12.5,0 5,5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
transform="matrix(0.4,0,0,0.4,4,0)"
inkscape:connector-curvature="0" />
</marker>
@@ -78,7 +78,7 @@
id="path4212"
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.625;stroke-linejoin:round;stroke-opacity:1"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
- transform="scale(-0.6,-0.6)"
+ transform="scale(-0.6)"
inkscape:connector-curvature="0" />
</marker>
<marker
@@ -92,9 +92,9 @@
<path
inkscape:connector-curvature="0"
id="path4318-4"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(-0.8,-0.8)" />
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
</marker>
<marker
inkscape:stockid="TriangleOutL"
@@ -107,9 +107,9 @@
<path
inkscape:connector-curvature="0"
id="path4327-1"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(0.8,0.8)" />
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
</marker>
<marker
inkscape:stockid="TriangleInL"
@@ -121,9 +121,9 @@
inkscape:isstock="true">
<path
id="path4318-9"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(-0.8,-0.8)"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
inkscape:connector-curvature="0" />
</marker>
<marker
@@ -136,9 +136,9 @@
inkscape:isstock="true">
<path
id="path4327-5"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(0.8,0.8)"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
inkscape:connector-curvature="0" />
</marker>
<marker
@@ -151,9 +151,9 @@
inkscape:isstock="true">
<path
id="path4318-2"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(-0.8,-0.8)"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
inkscape:connector-curvature="0" />
</marker>
<marker
@@ -166,11 +166,371 @@
inkscape:isstock="true">
<path
id="path4327-2"
- d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
- transform="scale(0.8,0.8)"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
inkscape:connector-curvature="0" />
</marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-9-6"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-2-2"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-1-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-2-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2-5"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-8"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-96"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-4"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-9-6-4"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-2-2-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-1-1-6"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-2-7-8"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2-5-6"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4-7-2"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4-8"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1-9"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2-5-6-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4-7-2-6"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4-8-4"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1-9-8"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-1-7"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-8-9"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-96-7"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-4-4"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2-5-6-9-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4-7-2-6-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4-8-4-0"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1-9-8-6"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-1-9"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-8-3"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-96-3"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-4-46"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2-5-6-9-5"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4-7-2-6-6"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4-8-4-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1-9-8-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-1-9-7"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-8-3-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-96-3-2"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-4-46-3"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-2-5-6-9-5-8"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4318-4-7-2-6-6-1"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4-8-4-1-3"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1-9-8-7-6"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
</defs>
<sodipodi:namedview
id="base"
@@ -179,16 +539,16 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="2.8"
- inkscape:cx="370.99138"
- inkscape:cy="234.56612"
+ inkscape:zoom="1.4142136"
+ inkscape:cx="138.75529"
+ inkscape:cy="425.28174"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="3742"
- inkscape:window-height="2124"
- inkscape:window-x="98"
- inkscape:window-y="36"
+ inkscape:window-width="3840"
+ inkscape:window-height="2031"
+ inkscape:window-x="0"
+ inkscape:window-y="55"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
@@ -203,7 +563,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@@ -211,88 +571,63 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(91.482322,-255.11685)">
+ transform="translate(91.482322,-32.9581)">
<rect
- style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.05102265;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4136"
- width="564.41473"
- height="248.82799"
- x="-30.289024"
- y="321.69858" />
+ width="518.94897"
+ height="298.94897"
+ x="29.043194"
+ y="193.48361" />
+ <rect
+ style="fill:#ffd5d5;fill-opacity:1;stroke:none;stroke-width:0.83021182;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4136-3"
+ width="440"
+ height="220"
+ x="68.517685"
+ y="232.9581" />
<flowRoot
xml:space="preserve"
id="flowRoot4138"
- style="font-style:normal;font-weight:normal;font-size:15.41801071px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(1.1690183,0,0,1.1690183,19.800223,-141.31953)"><flowRegion
- id="flowRegion4140"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(1.1690183,0,0,1.1690183,115.80023,-231.31953)"><flowRegion
+ id="flowRegion4140"
+ style="fill:#ff2a2a"><rect
id="rect4142"
width="129.78784"
height="31.668232"
x="-34.519978"
y="400.22751"
- style="font-size:15.41801071px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:15.41801071px;fill:#ff2a2a" /></flowRegion><flowPara
id="flowPara4144"
- style="font-size:20.55734825px;fill:#000000">Background</flowPara><flowPara
- id="flowPara4146" /></flowRoot> <rect
- style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:27.60000038;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
+ style="font-size:20.55734825px;line-height:1.25;fill:#ff2a2a">Background</flowPara><flowPara
+ id="flowPara4146"
+ style="font-size:20.55734825px;line-height:1.25;fill:#ff2a2a"> </flowPara></flowRoot> <rect
+ style="fill:#d7e3f4;fill-opacity:1;stroke:none;stroke-width:22.32431984;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
id="rect4148"
- width="464.22452"
- height="165.94499"
- x="18.895706"
- y="364.74274" />
+ width="360"
+ height="140"
+ x="108.51768"
+ y="272.95813" />
<flowRoot
xml:space="preserve"
id="flowRoot4138-6"
- style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,144.03104,146.23557)"><flowRegion
- id="flowRegion4140-6"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,184.57261,41.294224)"><flowRegion
+ id="flowRegion4140-6"
+ style="fill:#0055d4"><rect
id="rect4142-6"
width="334.36047"
height="80.812172"
x="42.426407"
y="481.62601"
- style="font-size:40px;fill:#000000" /></flowRegion><flowPara
- id="flowPara4146-6">Content item</flowPara></flowRoot> <path
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL);marker-end:url(#TriangleOutL)"
- d="m 27.018805,516.90108 0,-133.62042"
- id="path4179"
- inkscape:connector-curvature="0" />
- <path
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93839902;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2);marker-end:url(#TriangleOutL-9)"
- d="m 26.776662,538.68728 451.028788,0"
- id="path4179-7"
- inkscape:connector-curvature="0" />
- <flowRoot
- xml:space="preserve"
- id="flowRoot4138-6-2"
- style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,10.003309,144.31674)"><flowRegion
- id="flowRegion4140-6-6"><rect
- id="rect4142-6-1"
- width="117.17769"
- height="101.01524"
- x="42.426407"
- y="481.62601"
- style="font-size:20px;fill:#000000" /></flowRegion><flowPara
- id="flowPara9732"
- style="font-size:17.5px;fill:#000000">Available height</flowPara></flowRoot> <flowRoot
- xml:space="preserve"
- id="flowRoot4138-6-2-7"
- style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,10.811464,253.07573)"><flowRegion
- id="flowRegion4140-6-6-4"><rect
- id="rect4142-6-1-4"
- width="252.53812"
- height="61.619293"
- x="42.426407"
- y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;fill:#000000"
- id="flowPara10048">Available width</flowPara></flowRoot> <flowRoot
+ style="font-size:40px;fill:#0055d4" /></flowRegion><flowPara
+ id="flowPara4146-6"
+ style="font-size:40px;line-height:1.25;fill:#0055d4">Content item</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-1"
- style="font-style:normal;font-weight:normal;font-size:25px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,210.99354,300.96896)"><flowRegion
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,247.75903,220.21488)"><flowRegion
id="flowRegion4140-6-9"><rect
id="rect4142-6-0"
width="270.72089"
@@ -301,21 +636,21 @@
y="481.62601"
style="font-size:25px;fill:#000000" /></flowRegion><flowPara
id="flowPara4146-6-2"
- style="font-size:17.5px">Width</flowPara></flowRoot> <path
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.90119678;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)"
- d="m -26.522148,583.27143 557.292688,0"
+ style="font-size:17.5px;line-height:1.25">Width</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.93053311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)"
+ d="M 33.168982,505.52033 H 543.32948"
id="path4179-8"
inkscape:connector-curvature="0" />
<path
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.9011969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)"
- d="m -43.461661,566.30584 0,-239.7552"
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)"
+ d="M 16.517683,487.33858 V 198.57762"
id="path4179-9"
inkscape:connector-curvature="0" />
<flowRoot
xml:space="preserve"
id="flowRoot4138-6-1-7"
- style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,-112.00353,150.83655)"><flowRegion
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-50.003525,47.195824)"><flowRegion
id="flowRegion4140-6-9-7"><rect
id="rect4142-6-0-5"
width="270.72089"
@@ -324,11 +659,11 @@
y="481.62601"
style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
id="flowPara4146-6-2-9"
- style="font-size:17.5px;fill:#000000">Height</flowPara></flowRoot> <flowRoot
+ style="font-size:17.5px;line-height:1.25;fill:#000000">Height</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-3"
- style="font-style:normal;font-weight:normal;font-size:60px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,156.72375,-24.786365)"><flowRegion
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,206.65956,-144.78636)"><flowRegion
id="flowRegion4140-6-67"><rect
id="rect4142-6-5"
width="334.36047"
@@ -336,57 +671,266 @@
x="42.426407"
y="481.62601"
style="font-size:60px;fill:#000000" /></flowRegion><flowPara
- id="flowPara4146-6-3">Control</flowPara></flowRoot> <flowRoot
+ style="font-size:60px;line-height:1.25"
+ id="flowPara14323">Popup</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5"
- style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,186.57489,257.45801)"><flowRegion
- id="flowRegion4140-6-6-4-6"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,41.217752,149.93493)"><flowRegion
+ id="flowRegion4140-6-6-4-6"
+ style="text-align:center;text-anchor:middle;fill:#0055d4"><rect
id="rect4142-6-1-4-2"
width="252.53812"
height="61.619293"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;fill:#000000"
- id="flowPara10048-9">Bottom padding</flowPara></flowRoot> <flowRoot
+ style="font-size:17.5px;text-align:center;text-anchor:middle;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara10048-9">Bottom</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara5290">padding</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5-1"
- style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,193.9747,48.798368)"><flowRegion
- id="flowRegion4140-6-6-4-6-2"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,384.82399,-69.046412)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2"
+ style="fill:#0055d4"><rect
id="rect4142-6-1-4-2-7"
- width="252.53812"
- height="61.619293"
+ width="71.826065"
+ height="43.785866"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;fill:#000000"
- id="flowPara10048-9-0">Top padding</flowPara></flowRoot> <flowRoot
+ style="font-size:17.5px;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara10048-9-0">Top</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara4830">padding</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5-9"
- style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,457.80767,148.11921)"><flowRegion
- id="flowRegion4140-6-6-4-6-3"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,458.14041,-0.80935844)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3"
+ style="fill:#0055d4"><rect
id="rect4142-6-1-4-2-6"
width="81.109558"
height="93.762154"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ style="font-size:17.5px;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#0055d4"
id="flowPara4386">Right padding</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5-9-2"
- style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,-54.735211,151.06168)"><flowRegion
- id="flowRegion4140-6-6-4-6-3-5"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,19.173452,87.133114)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5"
+ style="fill:#0055d4"><rect
id="rect4142-6-1-4-2-6-4"
width="81.109558"
height="93.762154"
x="42.426407"
y="481.62601"
+ style="font-size:17.5px;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#0055d4"
+ id="flowPara4386-0">Left padding</flowPara></flowRoot> <path
+ style="fill:#ff2a2a;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87824047;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9-6);marker-end:url(#TriangleOutL-1-1)"
+ d="M 72.916183,227.96278 V 198.98852"
+ id="path4179-9-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87323481;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5);marker-end:url(#TriangleOutL-9-4)"
+ d="M 34.529058,238.58445 H 63.562954"
+ id="path4179-7-8"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1-5"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,47.895402,-88.000508)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-9"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-7-7"
+ width="66.476036"
+ height="55.080368"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara11237">Top inset</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2-3"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,0.4414194,-43.952242)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5-8"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-6-4-8"
+ width="75.759529"
+ height="93.167732"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara4386-0-3">Left inset</flowPara></flowRoot> <path
+ style="fill:#0055d4;fill-rule:evenodd;stroke:#0055d4;stroke-width:0.97500122;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-1);marker-end:url(#TriangleOutL-96)"
+ d="M 462.28757,267.38769 V 199.50991"
+ id="path4179-3"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ff2a2a;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87794411;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9-6-4);marker-end:url(#TriangleOutL-1-1-6)"
+ d="M 504.22784,486.94146 V 457.98675"
+ id="path4179-9-8-9"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1-5-0"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,424.36985,170.98794)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-9-6"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-7-7-8"
+ width="91.442841"
+ height="44.974762"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara11237-7">Bottom inset</flowPara></flowRoot> <path
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87314719;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6);marker-end:url(#TriangleOutL-9-4-8)"
+ d="M 513.47562,448.6218 H 542.5037"
+ id="path4179-7-8-6"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2-3-0"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,479.24023,126.32002)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5-8-7"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-6-4-8-0"
+ width="75.759529"
+ height="93.167732"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara3807">Right inset</flowPara></flowRoot> <path
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.05938387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6-9);marker-end:url(#TriangleOutL-9-4-8-4)"
+ d="m 474.52523,278.31524 h 66.93934"
+ id="path4179-7-8-6-0"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#0055d4;fill-rule:evenodd;stroke:#0055d4;stroke-width:0.97513783;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-1-7);marker-end:url(#TriangleOutL-96-7)"
+ d="M 114.58911,486.37854 V 418.48175"
+ id="path4179-3-9"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.05900466;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6-9-1);marker-end:url(#TriangleOutL-9-4-8-4-0)"
+ d="M 35.582232,406.88667 H 102.47366"
+ id="path4179-7-8-6-0-0"
+ inkscape:connector-curvature="0" />
+ <rect
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.38;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4136-9"
+ width="638.62036"
+ height="418.6203"
+ x="-30.792475"
+ y="133.64795" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-3-8"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,192.12072,-213.92909)"><flowRegion
+ id="flowRegion4140-6-67-1"><rect
+ id="rect4142-6-5-6"
+ width="334.36047"
+ height="80.812172"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:60px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:60px;line-height:1.25"
+ id="flowPara14323-3">Window</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.83036995;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-1-9);marker-end:url(#TriangleOutL-96-3)"
+ d="M 16.507747,188.209 V 138.97553"
+ id="path4179-3-1"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.90094262;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6-9-5);marker-end:url(#TriangleOutL-9-4-8-4-1)"
+ d="m 553.67227,505.52244 h 48.41379"
+ id="path4179-7-8-6-0-2"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1-2"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-53.285062,-138.90295)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-92"
+ style="fill:#000000"><rect
+ id="rect4142-6-1-4-2-7-8"
+ width="71.826065"
+ height="43.785866"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara10048-9-0-1">Top</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara4830-2">margin</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1-2-4"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,530.78767,225.71855)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-92-7"
+ style="fill:#000000"><rect
+ id="rect4142-6-1-4-2-7-8-8"
+ width="71.826065"
+ height="43.785866"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara10048-9-0-1-6">Right</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara4830-2-3">margin</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.83036995;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-1-9-7);marker-end:url(#TriangleOutL-96-3-2)"
+ d="M 16.459117,546.78218 V 497.54871"
+ id="path4179-3-1-7"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1-2-2"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-0.06072146,225.50386)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-92-5"
+ style="fill:#000000"><rect
+ id="rect4142-6-1-4-2-7-8-3"
+ width="71.826065"
+ height="43.785866"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara10048-9-0-1-7">Bottom</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara4830-2-6">margin</flowPara></flowRoot> <path
+ style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.89733517;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6-9-5-8);marker-end:url(#TriangleOutL-9-4-8-4-1-3)"
+ d="M -25.075855,505.54405 H 22.951007"
+ id="path4179-7-8-6-0-2-4"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-1-2-2-0"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-55.529842,180.17847)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-92-5-3"
+ style="fill:#000000"><rect
+ id="rect4142-6-1-4-2-7-8-3-5"
+ width="71.826065"
+ height="43.785866"
+ x="42.426407"
+ y="481.62601"
style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
- id="flowPara4386-0">Left padding</flowPara></flowRoot> </g>
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara10048-9-0-1-7-8">Left</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#000000"
+ id="flowPara4830-2-6-5">margin</flowPara></flowRoot> </g>
</svg>
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dial-inputMode.svgz b/src/imports/controls/doc/images/qtquickcontrols2-dial-inputMode.svgz
new file mode 100644
index 00000000..005ab7b3
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial-inputMode.svgz
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-dial-inputmode.png b/src/imports/controls/doc/images/qtquickcontrols2-dial-inputmode.png
new file mode 100644
index 00000000..27694ee3
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-dial-inputmode.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-variant-dense.png b/src/imports/controls/doc/images/qtquickcontrols2-material-variant-dense.png
new file mode 100644
index 00000000..02f39b78
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-variant-dense.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-material-variant-normal.png b/src/imports/controls/doc/images/qtquickcontrols2-material-variant-normal.png
new file mode 100644
index 00000000..c1e366c5
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols2-material-variant-normal.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.png b/src/imports/controls/doc/images/qtquickcontrols2-popup.png
index a0bc3d8c..01d65709 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-popup.png
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols2-popup.svg b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
index 91bde0c5..e39f3dce 100644
--- a/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
+++ b/src/imports/controls/doc/images/qtquickcontrols2-popup.svg
@@ -9,15 +9,16 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="817.22076"
- height="605.42444"
- viewBox="0 0 766.14443 567.58541"
+ width="640"
+ height="420"
+ viewBox="0 0 639.99997 419.99999"
id="svg2"
version="1.1"
- inkscape:version="0.92.1 r15371"
- sodipodi:docname="qtquickcontrols2-popup.svg"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
+ inkscape:version="0.92.3 (2405546, 2018-03-11)"
+ sodipodi:docname="qtquickcontrols2-control.svg"
+ inkscape:export-filename="/home/jpnurmi/Projects/qt-dev/qtquickcontrols2/src/imports/controls/doc/images/qtquickcontrols2-control.png"
+ inkscape:export-xdpi="192"
+ inkscape:export-ydpi="192">
<defs
id="defs4">
<marker
@@ -175,13 +176,13 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleInL-7"
+ id="TriangleInL-9-6"
style="overflow:visible"
inkscape:isstock="true">
<path
- id="path4318-5"
+ id="path4318-2-2"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(-0.8)"
inkscape:connector-curvature="0" />
</marker>
@@ -190,13 +191,13 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleOutL-4"
+ id="TriangleOutL-1-1"
style="overflow:visible"
inkscape:isstock="true">
<path
- id="path4327-17"
+ id="path4327-2-7"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(0.8)"
inkscape:connector-curvature="0" />
</marker>
@@ -205,13 +206,43 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleInL-7-1"
+ id="TriangleInL-2-5"
style="overflow:visible"
inkscape:isstock="true">
<path
- id="path4318-5-2"
+ inkscape:connector-curvature="0"
+ id="path4318-4-7"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-1"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-8"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(-0.8)"
inkscape:connector-curvature="0" />
</marker>
@@ -220,13 +251,43 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleOutL-4-3"
+ id="TriangleOutL-96"
style="overflow:visible"
inkscape:isstock="true">
<path
- id="path4327-17-4"
+ id="path4327-4"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-9-6-4"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-2-2-7"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)"
+ inkscape:connector-curvature="0" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-1-1-6"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4327-2-7-8"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(0.8)"
inkscape:connector-curvature="0" />
</marker>
@@ -235,14 +296,14 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleInL-2-4"
+ id="TriangleInL-2-5-6"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
- id="path4318-4-7"
+ id="path4318-4-7-2"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(-0.8)" />
</marker>
<marker
@@ -250,14 +311,14 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleOutL-9-3"
+ id="TriangleOutL-9-4-8"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
- id="path4327-1-1"
+ id="path4327-1-1-9"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(0.8)" />
</marker>
<marker
@@ -265,13 +326,43 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleInL-7-1-4"
+ id="TriangleInL-2-5-6-9"
style="overflow:visible"
inkscape:isstock="true">
<path
- id="path4318-5-2-3"
+ inkscape:connector-curvature="0"
+ id="path4318-4-7-2-6"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(-0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleOutL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleOutL-9-4-8-4"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ inkscape:connector-curvature="0"
+ id="path4327-1-1-9-8"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
+ transform="scale(0.8)" />
+ </marker>
+ <marker
+ inkscape:stockid="TriangleInL"
+ orient="auto"
+ refY="0"
+ refX="0"
+ id="TriangleInL-1-7"
+ style="overflow:visible"
+ inkscape:isstock="true">
+ <path
+ id="path4318-8-9"
+ d="M 5.77,0 -2.88,5 V -5 Z"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(-0.8)"
inkscape:connector-curvature="0" />
</marker>
@@ -280,13 +371,13 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleOutL-4-3-5"
+ id="TriangleOutL-96-7"
style="overflow:visible"
inkscape:isstock="true">
<path
- id="path4327-17-4-6"
+ id="path4327-4-4"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(0.8)"
inkscape:connector-curvature="0" />
</marker>
@@ -295,14 +386,14 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleInL-2-4-7"
+ id="TriangleInL-2-5-6-9-1"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
- id="path4318-4-7-4"
+ id="path4318-4-7-2-6-7"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(-0.8)" />
</marker>
<marker
@@ -310,14 +401,14 @@
orient="auto"
refY="0"
refX="0"
- id="TriangleOutL-9-3-6"
+ id="TriangleOutL-9-4-8-4-0"
style="overflow:visible"
inkscape:isstock="true">
<path
inkscape:connector-curvature="0"
- id="path4327-1-1-5"
+ id="path4327-1-1-9-8-6"
d="M 5.77,0 -2.88,5 V -5 Z"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1.00000003pt;stroke-opacity:1"
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.00000003pt;stroke-opacity:1"
transform="scale(0.8)" />
</marker>
</defs>
@@ -328,21 +419,21 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
- inkscape:zoom="1"
- inkscape:cx="433.56809"
- inkscape:cy="282.4206"
+ inkscape:zoom="2.8284271"
+ inkscape:cx="328.65009"
+ inkscape:cy="205.42326"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1920"
- inkscape:window-height="1137"
- inkscape:window-x="-8"
- inkscape:window-y="-8"
+ inkscape:window-width="3840"
+ inkscape:window-height="2031"
+ inkscape:window-x="0"
+ inkscape:window-y="55"
inkscape:window-maximized="1"
- fit-margin-top="1"
- fit-margin-left="1"
- fit-margin-right="1"
- fit-margin-bottom="1"
+ fit-margin-top="0"
+ fit-margin-left="0"
+ fit-margin-right="0"
+ fit-margin-bottom="0"
units="px" />
<metadata
id="metadata7">
@@ -360,312 +451,262 @@
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(117.89629,-192.1482)">
+ transform="translate(91.482322,-192.9581)">
<rect
- style="fill:#cccccc;fill-opacity:1;stroke:#000000;stroke-width:1.21129668;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.05102265;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect4136"
- width="564.20264"
- height="365.80341"
- x="-21.075951"
- y="321.69159" />
+ width="518.94897"
+ height="298.94897"
+ x="-30.956812"
+ y="253.48361" />
+ <rect
+ style="fill:#ffd5d5;fill-opacity:1;stroke:none;stroke-width:0.83021182;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ id="rect4136-3"
+ width="440"
+ height="220"
+ x="8.5176783"
+ y="292.9581" />
<flowRoot
xml:space="preserve"
id="flowRoot4138"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(1.1690183,0,0,1.1690183,28.907253,-141.43255)"><flowRegion
- id="flowRegion4140"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(1.1690183,0,0,1.1690183,55.80022,-171.31953)"><flowRegion
+ id="flowRegion4140"
+ style="fill:#ff2a2a"><rect
id="rect4142"
width="129.78784"
height="31.668232"
x="-34.519978"
y="400.22751"
- style="font-size:15.41801071px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:15.41801071px;fill:#ff2a2a" /></flowRegion><flowPara
+ id="flowPara4144"
+ style="font-size:20.55734825px;line-height:1.25;fill:#ff2a2a">Background</flowPara><flowPara
id="flowPara4146"
- style="font-size:19.24691807px;line-height:1.25">Background</flowPara></flowRoot> <rect
- style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:32.28859329;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
+ style="font-size:20.55734825px;line-height:1.25;fill:#ff2a2a"> </flowPara></flowRoot> <rect
+ style="fill:#d7e3f4;fill-opacity:1;stroke:none;stroke-width:22.32431984;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.58381503"
id="rect4148"
- width="432.17508"
- height="243.95665"
- x="44.027798"
- y="384.97104" />
+ width="360"
+ height="140"
+ x="48.517677"
+ y="332.95813" />
<flowRoot
xml:space="preserve"
id="flowRoot4138-6"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-size:37.45019655px;"
- transform="matrix(0.6007979,0,0,0.6007979,156.36974,204.3766)"><flowRegion
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,124.5726,101.29422)"><flowRegion
id="flowRegion4140-6"
- style="font-size:37.45019655px;"><rect
+ style="fill:#0055d4"><rect
id="rect4142-6"
width="334.36047"
height="80.812172"
x="42.426407"
y="481.62601"
- style="font-size:37.45019655px;fill:#000000;" /></flowRegion><flowPara
+ style="font-size:40px;fill:#0055d4" /></flowRegion><flowPara
id="flowPara4146-6"
- style="font-size:37.45019655px;line-height:1.25;">Content item</flowPara></flowRoot> <g
- id="g8534"
- transform="translate(3.75)">
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4179"
- d="M 53.000835,594.60056 V 394.41764"
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL);marker-end:url(#TriangleOutL)" />
- <flowRoot
- transform="matrix(0.6007979,0,0,0.6007979,35.985339,191.89348)"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="flowRoot4138-6-2"
- xml:space="preserve"><flowRegion
- id="flowRegion4140-6-6"><rect
- style="font-size:20px;fill:#000000"
- y="481.62601"
- x="42.426407"
- height="101.01524"
- width="117.17769"
- id="rect4142-6-1" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:1.25;fill:#000000"
- id="flowPara9732">Available height</flowPara></flowRoot> </g>
- <g
- id="g8545">
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4179-7"
- d="M 56.564013,608.03247 H 464.47744"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.91225624;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2);marker-end:url(#TriangleOutL-9)" />
- </g>
+ style="font-size:40px;line-height:1.25;fill:#0055d4">Content item</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-1"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,187.75902,280.21488)"><flowRegion
+ id="flowRegion4140-6-9"><rect
+ id="rect4142-6-0"
+ width="270.72089"
+ height="68.690361"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:25px;fill:#000000" /></flowRegion><flowPara
+ id="flowPara4146-6-2"
+ style="font-size:17.5px;line-height:1.25">Width</flowPara></flowRoot> <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.93053311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)"
+ d="M -26.831023,563.52033 H 483.32947"
+ id="path4179-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)"
+ d="M -41.482322,547.33858 V 258.57762"
+ id="path4179-9"
+ inkscape:connector-curvature="0" />
<flowRoot
xml:space="preserve"
- id="flowRoot4138-6-2-7"
+ id="flowRoot4138-6-1-7"
style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.5748758,0,0,0.59339159,197.89365,327.81679)"><flowRegion
- id="flowRegion4140-6-6-4"><rect
- id="rect4142-6-1-4"
- width="252.53812"
- height="61.619293"
+ transform="matrix(0.6007979,0,0,0.6007979,-110.00353,107.19582)"><flowRegion
+ id="flowRegion4140-6-9-7"><rect
+ id="rect4142-6-0-5"
+ width="270.72089"
+ height="68.690361"
x="42.426407"
y="481.62601"
style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:1.25;fill:#000000"
- id="flowPara10048">Available width</flowPara></flowRoot> <g
- id="g7654"
- transform="translate(0,118.125)">
- <flowRoot
- transform="matrix(0.6007979,0,0,0.6007979,220.10057,300.85594)"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="flowRoot4138-6-1"
- xml:space="preserve"><flowRegion
- id="flowRegion4140-6-9"><rect
- style="font-size:25px;fill:#000000"
- y="481.62601"
- x="42.426407"
- height="68.690361"
- width="270.72089"
- id="rect4142-6-0" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:1.25"
- id="flowPara4146-6-2">Width</flowPara></flowRoot> <path
- inkscape:connector-curvature="0"
- id="path4179-8"
- d="M -17.415118,583.15841 H 539.87757"
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.90119678;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-3);marker-end:url(#TriangleOutL-0)" />
- </g>
- <g
- id="g7868">
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4179-9"
- d="M -34.354631,681.50532 V 326.43762"
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:0.9011969;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9);marker-end:url(#TriangleOutL-1)" />
- <flowRoot
- transform="matrix(0.6007979,0,0,0.6007979,-102.8965,207.92708)"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="flowRoot4138-6-1-7"
- xml:space="preserve"><flowRegion
- id="flowRegion4140-6-9-7"><rect
- style="font-size:17.5px;fill:#000000"
- y="481.62601"
- x="42.426407"
- height="68.690361"
- width="270.72089"
- id="rect4142-6-0-5" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:1.25;fill:#000000"
- id="flowPara4146-6-2-9">Height</flowPara></flowRoot> </g>
- <flowRoot
+ id="flowPara4146-6-2-9"
+ style="font-size:17.5px;line-height:1.25;fill:#000000">Height</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-3"
- style="font-style:normal;font-weight:normal;font-size:54.09472656px;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,189.12753,-15.52439)"><flowRegion
- id="flowRegion4140-6-67"
- style="font-size:54.09472656px"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,138.50125,-84.786365)"><flowRegion
+ id="flowRegion4140-6-67"><rect
id="rect4142-6-5"
width="334.36047"
height="80.812172"
x="42.426407"
y="481.62601"
- style="font-size:54.09472656px;fill:#000000" /></flowRegion><flowPara
+ style="font-size:60px;fill:#000000" /></flowRegion><flowPara
id="flowPara4146-6-3"
- style="font-size:54.09472656px;line-height:1.25">Popup</flowPara></flowRoot> <flowRoot
+ style="font-size:60px;line-height:1.25">Control</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,193.38009,362.34499)"><flowRegion
- id="flowRegion4140-6-6-4-6"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-18.782253,209.93493)"><flowRegion
+ id="flowRegion4140-6-6-4-6"
+ style="text-align:center;text-anchor:middle;fill:#0055d4"><rect
id="rect4142-6-1-4-2"
width="252.53812"
height="61.619293"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:1.25;fill:#000000"
- id="flowPara10048-9">Bottom padding</flowPara></flowRoot> <flowRoot
+ style="font-size:17.5px;text-align:center;text-anchor:middle;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara10048-9">Bottom</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara5290">padding</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5-1"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,203.99672,59.935343)"><flowRegion
- id="flowRegion4140-6-6-4-6-2"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,324.82398,-9.0464154)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2"
+ style="fill:#0055d4"><rect
id="rect4142-6-1-4-2-7"
- width="252.53812"
- height="61.619293"
+ width="71.826065"
+ height="43.785866"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:1.25;fill:#000000"
- id="flowPara10048-9-0">Top padding</flowPara></flowRoot> <flowRoot
+ style="font-size:17.5px;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara10048-9-0">Top</flowPara><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#0055d4"
+ id="flowPara4830">padding</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5-9"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,459.4147,204.33375)"><flowRegion
- id="flowRegion4140-6-6-4-6-3"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,398.1404,59.190638)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3"
+ style="fill:#0055d4"><rect
id="rect4142-6-1-4-2-6"
width="81.109558"
height="93.762154"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
+ style="font-size:17.5px;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#0055d4"
id="flowPara4386">Right padding</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot4138-6-2-7-5-9-2"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,-38.128181,202.36202)"><flowRegion
- id="flowRegion4140-6-6-4-6-3-5"><rect
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#0055d4;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-40.826553,147.13311)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5"
+ style="fill:#0055d4"><rect
id="rect4142-6-1-4-2-6-4"
width="81.109558"
height="93.762154"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
- id="flowPara4386-0">Left padding</flowPara></flowRoot> <rect
- style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1.09440184;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
- id="rect4757"
- width="763.17505"
- height="514.7428"
- x="-116.41159"
- y="243.5061" />
+ style="font-size:17.5px;fill:#0055d4" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#0055d4"
+ id="flowPara4386-0">Left padding</flowPara></flowRoot> <path
+ style="fill:#ff2a2a;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87824047;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9-6);marker-end:url(#TriangleOutL-1-1)"
+ d="M 12.916178,287.96278 V 258.98852"
+ id="path4179-9-8"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87323481;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5);marker-end:url(#TriangleOutL-9-4)"
+ d="M -25.470947,298.58445 H 3.5629489"
+ id="path4179-7-8"
+ inkscape:connector-curvature="0" />
<flowRoot
xml:space="preserve"
- id="flowRoot4138-6-3-4"
- style="font-style:normal;font-weight:normal;font-size:59.99999619px;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,175.59116,-90.52439)"><flowRegion
- id="flowRegion4140-6-67-2"
- style="font-size:59.99999619px"><rect
- id="rect4142-6-5-4"
- width="334.36047"
- height="80.812172"
+ id="flowRoot4138-6-2-7-5-1-5"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-12.104603,-28.000512)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-9"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-7-7"
+ width="66.476036"
+ height="55.080368"
x="42.426407"
y="481.62601"
- style="font-size:59.99999619px;fill:#000000" /></flowRegion><flowPara
- id="flowPara4146-6-3-0"
- style="font-size:54.09472656px;line-height:1.25">Window</flowPara></flowRoot> <g
- id="g5624"
- transform="translate(0,116.25)">
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4179-98"
- d="M 562.38606,632.48202 V 575.7366"
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-7);marker-end:url(#TriangleOutL-4)" />
- <flowRoot
- transform="matrix(0.6007979,0,0,0.6007979,549.95467,303.47098)"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="flowRoot4138-6-2-7-5-9-1"
- xml:space="preserve"><flowRegion
- id="flowRegion4140-6-6-4-6-3-2"><rect
- style="font-size:17.5px;fill:#000000"
- y="481.62601"
- x="42.426407"
- height="93.762154"
- width="81.109558"
- id="rect4142-6-1-4-2-6-9" /></flowRegion><flowPara
- id="flowPara5598"
- style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000">Bottom margin</flowPara></flowRoot> </g>
- <g
- id="g5669"
- transform="translate(-9.0164,-96.197039)">
- <path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4179-98-8"
- d="M 571.40246,409.73194 V 352.98652"
- style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.04880464;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-7-1);marker-end:url(#TriangleOutL-4-3)" />
- <flowRoot
- transform="matrix(0.6007979,0,0,0.6007979,558.97106,80.720903)"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="flowRoot4138-6-2-7-5-9-1-8"
- xml:space="preserve"><flowRegion
- id="flowRegion4140-6-6-4-6-3-2-8"><rect
- style="font-size:17.5px;fill:#000000"
- y="481.62601"
- x="42.426407"
- height="93.762154"
- width="81.109558"
- id="rect4142-6-1-4-2-6-9-2" /></flowRegion><flowPara
- id="flowPara5598-6"
- style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000">Top margin</flowPara></flowRoot> </g>
- <g
- id="g7367"
- transform="translate(32.877167,129.04286)">
- <path
- transform="translate(-32.87717,-4.3906312)"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93839908;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-4);marker-end:url(#TriangleOutL-9-3)"
- d="m 558.40434,364.18736 h 70.4038"
- id="path4179-7-5"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="cc" />
- <flowRoot
- transform="matrix(0.6007979,0,0,0.6007979,510.85405,81.658403)"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="flowRoot4138-6-2-7-5-9-1-8-0"
- xml:space="preserve"><flowRegion
- id="flowRegion4140-6-6-4-6-3-2-8-5"><rect
- style="font-size:17.5px;fill:#000000"
- y="481.62601"
- x="42.426407"
- height="93.762154"
- width="81.109558"
- id="rect4142-6-1-4-2-6-9-2-6" /></flowRegion><flowPara
- id="flowPara5598-6-1"
- style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000">Right margin</flowPara></flowRoot> </g>
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara11237">Top inset</flowPara></flowRoot> <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2-3"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,-59.558586,16.047754)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5-8"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-6-4-8"
+ width="75.759529"
+ height="93.167732"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara4386-0-3">Left inset</flowPara></flowRoot> <path
+ style="fill:#0055d4;fill-rule:evenodd;stroke:#0055d4;stroke-width:0.97500122;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-1);marker-end:url(#TriangleOutL-96)"
+ d="M 402.28756,327.38769 V 259.50991"
+ id="path4179-3"
+ inkscape:connector-curvature="0" />
<path
- sodipodi:nodetypes="cc"
- inkscape:connector-curvature="0"
- id="path4179-7-5-2"
- d="m -96.90814,305.30865 h 70.4038"
- style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.93839908;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-4-7);marker-end:url(#TriangleOutL-9-3-6)" />
+ style="fill:#ff2a2a;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87794411;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-9-6-4);marker-end:url(#TriangleOutL-1-1-6)"
+ d="M 444.22783,546.94146 V 517.98675"
+ id="path4179-9-8-9"
+ inkscape:connector-curvature="0" />
<flowRoot
xml:space="preserve"
- id="flowRoot4138-6-2-7-5-9-1-8-0-4"
- style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- transform="matrix(0.6007979,0,0,0.6007979,-111.58126,-21.57968)"><flowRegion
- id="flowRegion4140-6-6-4-6-3-2-8-5-3"><rect
- id="rect4142-6-1-4-2-6-9-2-6-0"
- width="81.109558"
- height="93.762154"
+ id="flowRoot4138-6-2-7-5-1-5-0"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,364.36984,230.98794)"><flowRegion
+ id="flowRegion4140-6-6-4-6-2-9-6"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-7-7-8"
+ width="91.442841"
+ height="44.974762"
x="42.426407"
y="481.62601"
- style="font-size:17.5px;fill:#000000" /></flowRegion><flowPara
- style="font-size:17.5px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#000000"
- id="flowPara5598-6-1-4">Left margin</flowPara></flowRoot> </g>
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.5px;line-height:1.25;text-align:center;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara11237-7">Bottom inset</flowPara></flowRoot> <path
+ style="fill:#ff2a2a;fill-opacity:1;fill-rule:evenodd;stroke:#ff2a2a;stroke-width:0.87314719;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6);marker-end:url(#TriangleOutL-9-4-8)"
+ d="m 453.47561,508.6218 h 29.02808"
+ id="path4179-7-8-6"
+ inkscape:connector-curvature="0" />
+ <flowRoot
+ xml:space="preserve"
+ id="flowRoot4138-6-2-7-5-9-2-3-0"
+ style="font-style:normal;font-weight:normal;line-height:0.01%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#ff2a2a;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ transform="matrix(0.6007979,0,0,0.6007979,419.24022,186.32002)"><flowRegion
+ id="flowRegion4140-6-6-4-6-3-5-8-7"
+ style="fill:#ff2a2a"><rect
+ id="rect4142-6-1-4-2-6-4-8-0"
+ width="75.759529"
+ height="93.167732"
+ x="42.426407"
+ y="481.62601"
+ style="font-size:17.5px;fill:#ff2a2a" /></flowRegion><flowPara
+ style="font-size:17.02554321px;line-height:125%;text-align:center;writing-mode:lr-tb;text-anchor:middle;fill:#ff2a2a"
+ id="flowPara3807">Right inset</flowPara></flowRoot> <path
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.05938387;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6-9);marker-end:url(#TriangleOutL-9-4-8-4)"
+ d="m 414.52522,338.31524 h 66.93934"
+ id="path4179-7-8-6-0"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#0055d4;fill-rule:evenodd;stroke:#0055d4;stroke-width:0.97513783;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-1-7);marker-end:url(#TriangleOutL-96-7)"
+ d="M 54.589106,546.37854 V 478.48175"
+ id="path4179-3-9"
+ inkscape:connector-curvature="0" />
+ <path
+ style="fill:#0055d4;fill-opacity:1;fill-rule:evenodd;stroke:#0055d4;stroke-width:1.05900466;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#TriangleInL-2-5-6-9-1);marker-end:url(#TriangleOutL-9-4-8-4-0)"
+ d="M -24.417773,466.88667 H 42.473651"
+ id="path4179-7-8-6-0-0"
+ inkscape:connector-curvature="0" />
+ </g>
</svg>
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-material-variant.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-material-variant.qml
new file mode 100644
index 00000000..fc2be179
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-material-variant.qml
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.11
+import QtQuick.Controls 2.4
+import QtQuick.Controls.Material 2.4
+import QtQuick.Layouts 1.3
+
+Pane {
+ implicitWidth: 400
+ implicitHeight: 600
+ padding: 10
+
+ readonly property color measurementColor: "darkorange"
+ readonly property int barLeftMargin: 10
+ readonly property int textTopMargin: 12
+
+ Component {
+ id: measurementComponent
+
+ Rectangle {
+ color: measurementColor
+ width: 1
+ height: parent.height
+
+ Rectangle {
+ width: 5
+ height: 1
+ color: measurementColor
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+
+ Rectangle {
+ width: 5
+ height: 1
+ color: measurementColor
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ }
+
+ Text {
+ x: 8
+ text: parent.height
+ height: parent.height
+ color: measurementColor
+ verticalAlignment: Text.AlignVCenter
+ }
+ }
+ }
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 20
+
+ ColumnLayout {
+ spacing: textTopMargin
+
+ Button {
+ id: button
+ text: qsTr("Button")
+
+ Loader {
+ sourceComponent: measurementComponent
+ height: parent.height
+ anchors.left: parent.right
+ anchors.leftMargin: barLeftMargin
+ }
+
+ }
+ Text {
+ text: "Roboto " + button.font.pixelSize
+ color: measurementColor
+ }
+ }
+
+ ColumnLayout {
+ spacing: textTopMargin
+
+ ItemDelegate {
+ id: itemDelegate
+ text: qsTr("ItemDelegate")
+
+ Loader {
+ sourceComponent: measurementComponent
+ height: parent.height
+ anchors.left: parent.right
+ anchors.leftMargin: barLeftMargin
+ }
+
+ }
+ Text {
+ text: "Roboto " + itemDelegate.font.pixelSize
+ color: measurementColor
+ }
+ }
+
+ ColumnLayout {
+ spacing: textTopMargin
+
+ CheckDelegate {
+ id: checkDelegate
+ text: qsTr("CheckDelegate")
+
+ Loader {
+ sourceComponent: measurementComponent
+ height: parent.height
+ anchors.left: parent.right
+ anchors.leftMargin: barLeftMargin
+ }
+
+ }
+ Text {
+ text: "Roboto " + checkDelegate.font.pixelSize
+ color: measurementColor
+ }
+ }
+
+ ColumnLayout {
+ spacing: textTopMargin
+
+ RadioDelegate {
+ id: radioDelegate
+ text: qsTr("RadioDelegate")
+
+ Loader {
+ sourceComponent: measurementComponent
+ height: parent.height
+ anchors.left: parent.right
+ anchors.leftMargin: barLeftMargin
+ }
+
+ }
+ Text {
+ text: "Roboto " + radioDelegate.font.pixelSize
+ color: measurementColor
+ }
+ }
+
+ ColumnLayout {
+ spacing: textTopMargin
+
+ ComboBox {
+ id: comboBox
+ model: [ qsTr("ComboBox") ]
+
+ Loader {
+ sourceComponent: measurementComponent
+ height: parent.height
+ anchors.left: parent.right
+ anchors.leftMargin: barLeftMargin
+ }
+
+ }
+ Text {
+ text: "Roboto " + comboBox.font.pixelSize
+ color: measurementColor
+ }
+ }
+
+ ColumnLayout {
+ spacing: textTopMargin
+
+ Item {
+ implicitWidth: groupBox.implicitWidth
+ implicitHeight: groupBox.implicitHeight
+
+ GroupBox {
+ id: groupBox
+ title: qsTr("GroupBox")
+ }
+ Loader {
+ sourceComponent: measurementComponent
+ height: parent.height
+ anchors.left: parent.right
+ anchors.leftMargin: barLeftMargin
+ }
+ }
+ Text {
+ text: "Roboto " + groupBox.font.pixelSize
+ color: measurementColor
+ }
+ }
+
+ Item {
+ Layout.fillHeight: true
+ }
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml b/src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml
new file mode 100644
index 00000000..593058c6
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols2-popup.qml
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+
+Item {
+//! [centerIn]
+ApplicationWindow {
+ id: window
+ // ...
+
+ Pane {
+ // ...
+
+ Popup {
+ anchors.centerIn: Overlay.overlay
+ }
+ }
+}
+//! [centerIn]
+}
diff --git a/src/imports/controls/doc/src/includes/qquickdial.qdocinc b/src/imports/controls/doc/src/includes/qquickdial.qdocinc
new file mode 100644
index 00000000..3370b3d8
--- /dev/null
+++ b/src/imports/controls/doc/src/includes/qquickdial.qdocinc
@@ -0,0 +1,13 @@
+//! [inputMode]
+Dial supports three \l {inputMode}{input modes}: \c Dial.Circular,
+\c Dial.Horizontal and \c Dial.Vertical. The circular input mode operates on an
+absolute input system, where the position of the cursor within the dial
+directly reflects its value. The horizontal and vertical input modes use a
+relative input system, where changes in the cursor's position are "added" to
+the value of the dial.
+
+The following image illustrates the directions in which the various input modes
+track movement:
+
+\image qtquickcontrols2-dial-inputmode.png
+//! [inputMode]
diff --git a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
index c5d94279..72c97bb6 100644
--- a/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
+++ b/src/imports/controls/doc/src/includes/qquickmaterialstyle.qdocinc
@@ -8,6 +8,14 @@
\li Specifies the default \l {material-theme-attached-prop}{Material theme}.
The value can be one of the available themes, for example \c "Dark".
\row
+ \li \c Variant
+ \li Specifies the Material variant. The Material Design has two
+ variants: a normal variant designed for touch devices, and a dense
+ variant for desktop. The dense variant uses smaller sizes for
+ controls and their fonts.
+
+ The value can be \c "Normal" or \c "Dense".
+ \row
\li \c Accent
\li Specifies the default \l {material-accent-attached-prop}{Material accent color}.
The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
@@ -40,6 +48,14 @@
\li Specifies the default \l {material-theme-attached-prop}{Material theme}.
The value can be one of the available themes, for example \c "Dark".
\row
+ \li \c QT_QUICK_CONTROLS_MATERIAL_VARIANT
+ \li Specifies the Material variant. The Material Design has two
+ variants: a normal variant designed for touch devices, and a dense
+ variant for desktop. The dense variant uses smaller sizes for
+ controls and their fonts.
+
+ The value can be \c "Normal" or \c "Dense".
+ \row
\li \c QT_QUICK_CONTROLS_MATERIAL_ACCENT
\li Specifies the default \l {material-accent-attached-prop}{Material accent color}.
The value can be any \l {colorbasictypedocs}{color}, but it is recommended to use
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
index 7954bf68..f24f82a9 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-imagine.qdoc
@@ -31,7 +31,7 @@
The Imagine Style is based on configurable image assets. \l{detailed-desc-imagine}{More...}
- \styleimport {QtQuick.Controls.Imagine 2.4} {Qt 5.10}
+ \styleimport {QtQuick.Controls.Imagine 2.5} {Qt 5.10}
\section1 Attached Properties
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
index 87b170c2..8e3a12e7 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-index.qdoc
@@ -46,7 +46,7 @@
application using the following import statement in your \c {.qml} file:
\code
- import QtQuick.Controls 2.4
+ import QtQuick.Controls 2.5
\endcode
The \l{Qt Quick Controls 2 C++ Classes}{C++ classes} can be included into
@@ -116,6 +116,11 @@
\li 2.4
\li 1.0
\row
+ \li 5.12
+ \li 2.12
+ \li 2.5
+ \li 1.0
+ \row
\li ...
\li ...
\li ...
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
index 71de6104..60cd586d 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-input.qdoc
@@ -67,6 +67,16 @@
The dial is rotated by clicking and dragging, with the handle indicating the
value of the dial.
+ For applications where fast input is important, the circular
+ \l {Dial::inputMode}{input mode} is useful, as clicking on the dial will
+ move it directly to that position.
+
+ For applications where precise input is important, the horizontal and
+ vertical input modes are recommended, as these allow small adjustments to
+ be made relative to where the dial is clicked. These modes are also better
+ for dials where large jumps in values could be unsafe, such as a dial that
+ controls audio volume.
+
\b {See also} \l {Tumbler Control}.
\section1 TextArea Control
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
index d0bcf63a..fa7874e5 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-material.qdoc
@@ -32,7 +32,7 @@
The Material Style is based on the Google Material Design Guidelines.
\l{detailed-desc-material}{More...}
- \styleimport {QtQuick.Controls.Material 2.4} {Qt 5.7}
+ \styleimport {QtQuick.Controls.Material 2.5} {Qt 5.7}
\section1 Attached Properties
@@ -222,6 +222,33 @@
\b {See also} \l {Default Style}, \l {Universal Style}
+ \section2 Variants
+
+ The Material style also supports a dense variant, where controls like
+ buttons and delegates are smaller in height and use smaller font sizes.
+ It is recommended to use the dense variant on desktop platforms, where
+ a mouse and keyboard allow more precise and flexible user interaction.
+
+ To use the dense variant, either set the
+ \c QT_QUICK_CONTROLS_MATERIAL_VARIANT environment variable to \c Dense,
+ or specify \c Variant=Dense in the
+ \l {Qt Quick Controls 2 Configuration File}{qtquickcontrols2.conf} file.
+ The default value in both cases is \c Normal.
+
+ The following images illustrate the differences between some of the
+ controls when using the normal and dense variants:
+
+ \table
+ \row
+ \li
+ \image qtquickcontrols2-material-variant-normal.png
+ \li
+ \image qtquickcontrols2-material-variant-dense.png
+ \endtable
+
+ Note that the heights shown above may vary based on differences in fonts
+ across platforms.
+
\section1 Attached Property Documentation
\styleproperty {Material.accent} {color} {material-accent-attached-prop}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
index d4576617..6ebe2fe9 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-qmltypes.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \qmlmodule QtQuick.Controls 2.4
+ \qmlmodule QtQuick.Controls 2.5
\title Qt Quick Controls 2 QML Types
\ingroup qmlmodules
\brief Provides QML types for user interfaces (Qt Quick Controls 2).
@@ -39,7 +39,7 @@
using the following import statement in your .qml file:
\badcode
- import QtQuick.Controls 2.4
+ import QtQuick.Controls 2.5
\endcode
\section1 QML Types
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
index abd027e4..80bf9ef7 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-universal.qdoc
@@ -32,7 +32,7 @@
The Universal Style is based on the Microsoft Universal Design Guidelines.
\l {detailed-desc-universal}{More...}
- \styleimport {QtQuick.Controls.Universal 2.4} {Qt 5.7}
+ \styleimport {QtQuick.Controls.Universal 2.5} {Qt 5.7}
\section1 Attached Properties
diff --git a/src/imports/controls/fusion/ApplicationWindow.qml b/src/imports/controls/fusion/ApplicationWindow.qml
index 570d84b4..6abe832f 100644
--- a/src/imports/controls/fusion/ApplicationWindow.qml
+++ b/src/imports/controls/fusion/ApplicationWindow.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.2
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/fusion/BusyIndicator.qml b/src/imports/controls/fusion/BusyIndicator.qml
index cba5fc2e..7afff2df 100644
--- a/src/imports/controls/fusion/BusyIndicator.qml
+++ b/src/imports/controls/fusion/BusyIndicator.qml
@@ -34,18 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.BusyIndicator {
id: control
- implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
- implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/fusion/Button.qml b/src/imports/controls/fusion/Button.qml
index d33544ae..ca6d81a9 100644
--- a/src/imports/controls/fusion/Button.qml
+++ b/src/imports/controls/fusion/Button.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Button {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 4
spacing: 6
diff --git a/src/imports/controls/fusion/ButtonPanel.qml b/src/imports/controls/fusion/ButtonPanel.qml
index b1672bf0..fc1af2de 100644
--- a/src/imports/controls/fusion/ButtonPanel.qml
+++ b/src/imports/controls/fusion/ButtonPanel.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
Rectangle {
id: panel
diff --git a/src/imports/controls/fusion/CheckBox.qml b/src/imports/controls/fusion/CheckBox.qml
index 4a10238d..9b9dba18 100644
--- a/src/imports/controls/fusion/CheckBox.qml
+++ b/src/imports/controls/fusion/CheckBox.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.CheckBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/CheckDelegate.qml b/src/imports/controls/fusion/CheckDelegate.qml
index 9c6b97ff..40f68164 100644
--- a/src/imports/controls/fusion/CheckDelegate.qml
+++ b/src/imports/controls/fusion/CheckDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.CheckDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/CheckIndicator.qml b/src/imports/controls/fusion/CheckIndicator.qml
index 5a5837ae..8c49e6b2 100644
--- a/src/imports/controls/fusion/CheckIndicator.qml
+++ b/src/imports/controls/fusion/CheckIndicator.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
Rectangle {
id: indicator
diff --git a/src/imports/controls/fusion/ComboBox.qml b/src/imports/controls/fusion/ComboBox.qml
index bc232759..cafbdb02 100644
--- a/src/imports/controls/fusion/ComboBox.qml
+++ b/src/imports/controls/fusion/ComboBox.qml
@@ -34,23 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ComboBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
diff --git a/src/imports/controls/fusion/DelayButton.qml b/src/imports/controls/fusion/DelayButton.qml
index 261db320..c150bb2e 100644
--- a/src/imports/controls/fusion/DelayButton.qml
+++ b/src/imports/controls/fusion/DelayButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.DelayButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/fusion/Dial.qml b/src/imports/controls/fusion/Dial.qml
index c9ed0c68..fb248d5e 100644
--- a/src/imports/controls/fusion/Dial.qml
+++ b/src/imports/controls/fusion/Dial.qml
@@ -34,20 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Dial {
id: control
- implicitWidth: 100
- implicitHeight: 100
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 100 // ### remove 100 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 100 // ### remove 100 in Qt 6
background: DialImpl {
+ implicitWidth: 100
+ implicitHeight: 100
palette: control.palette
highlight: control.visualFocus
}
diff --git a/src/imports/controls/fusion/Dialog.qml b/src/imports/controls/fusion/Dialog.qml
index 4e43b038..a079d09f 100644
--- a/src/imports/controls/fusion/Dialog.qml
+++ b/src/imports/controls/fusion/Dialog.qml
@@ -34,27 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Dialog {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
- + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
padding: 6
diff --git a/src/imports/controls/fusion/DialogButtonBox.qml b/src/imports/controls/fusion/DialogButtonBox.qml
index 5d30c329..49446c31 100644
--- a/src/imports/controls/fusion/DialogButtonBox.qml
+++ b/src/imports/controls/fusion/DialogButtonBox.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.DialogButtonBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 6
padding: 6
@@ -56,9 +56,6 @@ T.DialogButtonBox {
delegate: Button { }
contentItem: ListView {
- implicitWidth: contentWidth
- implicitHeight: 24
-
model: control.contentModel
spacing: control.spacing
orientation: ListView.Horizontal
diff --git a/src/imports/controls/fusion/Drawer.qml b/src/imports/controls/fusion/Drawer.qml
index 711040a2..f0ee0200 100644
--- a/src/imports/controls/fusion/Drawer.qml
+++ b/src/imports/controls/fusion/Drawer.qml
@@ -34,23 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Drawer {
id: control
parent: T.Overlay.overlay
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: control.edge === Qt.BottomEdge
leftPadding: control.edge === Qt.RightEdge
diff --git a/src/imports/controls/fusion/Frame.qml b/src/imports/controls/fusion/Frame.qml
index 4acce74a..ffe816b4 100644
--- a/src/imports/controls/fusion/Frame.qml
+++ b/src/imports/controls/fusion/Frame.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 9
diff --git a/src/imports/controls/fusion/GroupBox.qml b/src/imports/controls/fusion/GroupBox.qml
index 439783ac..11372556 100644
--- a/src/imports/controls/fusion/GroupBox.qml
+++ b/src/imports/controls/fusion/GroupBox.qml
@@ -34,27 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.GroupBox {
id: control
- 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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitLabelWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 6
padding: 9
- topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
label: Text {
x: control.leftPadding
diff --git a/src/imports/controls/fusion/ItemDelegate.qml b/src/imports/controls/fusion/ItemDelegate.qml
index 0936c7c2..407078dd 100644
--- a/src/imports/controls/fusion/ItemDelegate.qml
+++ b/src/imports/controls/fusion/ItemDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ItemDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/Label.qml b/src/imports/controls/fusion/Label.qml
index 1c6951c2..23e337e2 100644
--- a/src/imports/controls/fusion/Label.qml
+++ b/src/imports/controls/fusion/Label.qml
@@ -34,12 +34,12 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Label {
id: control
diff --git a/src/imports/controls/fusion/Menu.qml b/src/imports/controls/fusion/Menu.qml
index 3c9d98a2..fd64ed45 100644
--- a/src/imports/controls/fusion/Menu.qml
+++ b/src/imports/controls/fusion/Menu.qml
@@ -34,21 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
-import QtQuick.Window 2.11
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
+import QtQuick.Window 2.12
T.Menu {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 0
padding: 1
diff --git a/src/imports/controls/fusion/MenuBar.qml b/src/imports/controls/fusion/MenuBar.qml
index d1530d75..81aaf9b5 100644
--- a/src/imports/controls/fusion/MenuBar.qml
+++ b/src/imports/controls/fusion/MenuBar.qml
@@ -34,19 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.MenuBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
delegate: MenuBarItem { }
diff --git a/src/imports/controls/fusion/MenuBarItem.qml b/src/imports/controls/fusion/MenuBarItem.qml
index 2b4425a9..85330a73 100644
--- a/src/imports/controls/fusion/MenuBarItem.qml
+++ b/src/imports/controls/fusion/MenuBarItem.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.MenuBarItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/MenuItem.qml b/src/imports/controls/fusion/MenuItem.qml
index 35d7248f..b8ebd5e6 100644
--- a/src/imports/controls/fusion/MenuItem.qml
+++ b/src/imports/controls/fusion/MenuItem.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.MenuItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/MenuSeparator.qml b/src/imports/controls/fusion/MenuSeparator.qml
index a426c0fe..904a15ef 100644
--- a/src/imports/controls/fusion/MenuSeparator.qml
+++ b/src/imports/controls/fusion/MenuSeparator.qml
@@ -34,22 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.MenuSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 5
- topPadding: 1
- bottomPadding: 1
+ verticalPadding: 1
contentItem: Rectangle {
implicitWidth: 188
diff --git a/src/imports/controls/fusion/Page.qml b/src/imports/controls/fusion/Page.qml
index 842db2d0..13f92c7a 100644
--- a/src/imports/controls/fusion/Page.qml
+++ b/src/imports/controls/fusion/Page.qml
@@ -34,27 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Page {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
- + (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
background: Rectangle {
color: palette.window
diff --git a/src/imports/controls/fusion/PageIndicator.qml b/src/imports/controls/fusion/PageIndicator.qml
index 39d28ca2..fb3a5b89 100644
--- a/src/imports/controls/fusion/PageIndicator.qml
+++ b/src/imports/controls/fusion/PageIndicator.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.PageIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 4
spacing: 4
diff --git a/src/imports/controls/fusion/Pane.qml b/src/imports/controls/fusion/Pane.qml
index 59c65cd9..53d51bf7 100644
--- a/src/imports/controls/fusion/Pane.qml
+++ b/src/imports/controls/fusion/Pane.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Pane {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 9
diff --git a/src/imports/controls/fusion/Popup.qml b/src/imports/controls/fusion/Popup.qml
index 319e5b8a..93c7afd3 100644
--- a/src/imports/controls/fusion/Popup.qml
+++ b/src/imports/controls/fusion/Popup.qml
@@ -34,23 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Popup {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/fusion/ProgressBar.qml b/src/imports/controls/fusion/ProgressBar.qml
index 547d5f7c..4e31d611 100644
--- a/src/imports/controls/fusion/ProgressBar.qml
+++ b/src/imports/controls/fusion/ProgressBar.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ProgressBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight + topPadding + bottomPadding : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
contentItem: Item {
implicitWidth: 120
diff --git a/src/imports/controls/fusion/RadioButton.qml b/src/imports/controls/fusion/RadioButton.qml
index 612319b4..ef574201 100644
--- a/src/imports/controls/fusion/RadioButton.qml
+++ b/src/imports/controls/fusion/RadioButton.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.RadioButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/RadioDelegate.qml b/src/imports/controls/fusion/RadioDelegate.qml
index f5f57071..ddcb1217 100644
--- a/src/imports/controls/fusion/RadioDelegate.qml
+++ b/src/imports/controls/fusion/RadioDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.RadioDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/RadioIndicator.qml b/src/imports/controls/fusion/RadioIndicator.qml
index d3d40c11..790a5e24 100644
--- a/src/imports/controls/fusion/RadioIndicator.qml
+++ b/src/imports/controls/fusion/RadioIndicator.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
Rectangle {
id: indicator
diff --git a/src/imports/controls/fusion/RangeSlider.qml b/src/imports/controls/fusion/RangeSlider.qml
index 260c21cf..17f4c62b 100644
--- a/src/imports/controls/fusion/RangeSlider.qml
+++ b/src/imports/controls/fusion/RangeSlider.qml
@@ -34,22 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.RangeSlider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ Math.max(first.implicitHandleWidth,
+ second.implicitHandleWidth) + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ Math.max(first.implicitHandleHeight,
+ second.implicitHandleHeight) + topPadding + bottomPadding)
first.handle: SliderHandle {
x: control.leftPadding + Math.round(control.horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
diff --git a/src/imports/controls/fusion/RoundButton.qml b/src/imports/controls/fusion/RoundButton.qml
index 5d28b52c..a38d123f 100644
--- a/src/imports/controls/fusion/RoundButton.qml
+++ b/src/imports/controls/fusion/RoundButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.RoundButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/ScrollBar.qml b/src/imports/controls/fusion/ScrollBar.qml
index 25881d2d..154f540b 100644
--- a/src/imports/controls/fusion/ScrollBar.qml
+++ b/src/imports/controls/fusion/ScrollBar.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ScrollBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
visible: control.policy !== T.ScrollBar.AlwaysOff
diff --git a/src/imports/controls/fusion/ScrollIndicator.qml b/src/imports/controls/fusion/ScrollIndicator.qml
index 7d6372a3..3f8668c5 100644
--- a/src/imports/controls/fusion/ScrollIndicator.qml
+++ b/src/imports/controls/fusion/ScrollIndicator.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ScrollIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
diff --git a/src/imports/controls/fusion/Slider.qml b/src/imports/controls/fusion/Slider.qml
index a4d28fe5..67ee73cc 100644
--- a/src/imports/controls/fusion/Slider.qml
+++ b/src/imports/controls/fusion/Slider.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Slider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHandleHeight + topPadding + bottomPadding)
handle: SliderHandle {
x: control.leftPadding + Math.round(control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
diff --git a/src/imports/controls/fusion/SliderGroove.qml b/src/imports/controls/fusion/SliderGroove.qml
index cd90bd54..678ac8c2 100644
--- a/src/imports/controls/fusion/SliderGroove.qml
+++ b/src/imports/controls/fusion/SliderGroove.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
Rectangle {
id: groove
diff --git a/src/imports/controls/fusion/SliderHandle.qml b/src/imports/controls/fusion/SliderHandle.qml
index 5ea2dd03..9bfa45a1 100644
--- a/src/imports/controls/fusion/SliderHandle.qml
+++ b/src/imports/controls/fusion/SliderHandle.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
Rectangle {
id: handle
diff --git a/src/imports/controls/fusion/SpinBox.qml b/src/imports/controls/fusion/SpinBox.qml
index 9d975fa8..5ef01d8f 100644
--- a/src/imports/controls/fusion/SpinBox.qml
+++ b/src/imports/controls/fusion/SpinBox.qml
@@ -34,25 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.SpinBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + 2 * padding +
- Math.max(up.indicator ? up.indicator.implicitWidth : 0,
- down.indicator ? down.indicator.implicitWidth : 0))
- implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
- (up.indicator ? up.indicator.implicitHeight : 0 +
- down.indicator ? down.indicator.implicitHeight : 0))
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ Math.max(up.implicitIndicatorWidth,
+ down.implicitIndicatorWidth))
+ implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight,
+ up.implicitIndicatorHeight +
+ down.implicitIndicatorHeight)
padding: 4
leftPadding: padding + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
diff --git a/src/imports/controls/fusion/SwipeDelegate.qml b/src/imports/controls/fusion/SwipeDelegate.qml
index 0704f5b3..c5de54a8 100644
--- a/src/imports/controls/fusion/SwipeDelegate.qml
+++ b/src/imports/controls/fusion/SwipeDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.SwipeDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/Switch.qml b/src/imports/controls/fusion/Switch.qml
index 0f5d484b..6406ba64 100644
--- a/src/imports/controls/fusion/Switch.qml
+++ b/src/imports/controls/fusion/Switch.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Switch {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/SwitchDelegate.qml b/src/imports/controls/fusion/SwitchDelegate.qml
index 4a09ba25..6f07731e 100644
--- a/src/imports/controls/fusion/SwitchDelegate.qml
+++ b/src/imports/controls/fusion/SwitchDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.SwitchDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/SwitchIndicator.qml b/src/imports/controls/fusion/SwitchIndicator.qml
index 22430dc3..7948a794 100644
--- a/src/imports/controls/fusion/SwitchIndicator.qml
+++ b/src/imports/controls/fusion/SwitchIndicator.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
Rectangle {
id: indicator
diff --git a/src/imports/controls/fusion/TabBar.qml b/src/imports/controls/fusion/TabBar.qml
index d6f3194b..3797e573 100644
--- a/src/imports/controls/fusion/TabBar.qml
+++ b/src/imports/controls/fusion/TabBar.qml
@@ -34,19 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.TabBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
spacing: -1
diff --git a/src/imports/controls/fusion/TabButton.qml b/src/imports/controls/fusion/TabButton.qml
index bdcee759..201e7763 100644
--- a/src/imports/controls/fusion/TabButton.qml
+++ b/src/imports/controls/fusion/TabButton.qml
@@ -34,25 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.TabButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
- leftPadding: 4
- rightPadding: 4
+ horizontalPadding: 4
spacing: 6
icon.width: 16
diff --git a/src/imports/controls/fusion/TextArea.qml b/src/imports/controls/fusion/TextArea.qml
index 9165116c..d2469d28 100644
--- a/src/imports/controls/fusion/TextArea.qml
+++ b/src/imports/controls/fusion/TextArea.qml
@@ -34,21 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 6
@@ -57,6 +57,7 @@ T.TextArea {
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
+ placeholderTextColor: Color.transparent(control.color, 0.5)
PlaceholderText {
id: placeholder
@@ -65,10 +66,9 @@ T.TextArea {
width: control.width - (control.leftPadding + control.rightPadding)
height: control.height - (control.topPadding + control.bottomPadding)
- opacity: 0.5
text: control.placeholderText
font: control.font
- color: control.color
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
diff --git a/src/imports/controls/fusion/TextField.qml b/src/imports/controls/fusion/TextField.qml
index 7b8984d2..6f5f49b3 100644
--- a/src/imports/controls/fusion/TextField.qml
+++ b/src/imports/controls/fusion/TextField.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.TextField {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
- || contentWidth + leftPadding + rightPadding
- implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
padding: 4
@@ -56,6 +55,7 @@ T.TextField {
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
+ placeholderTextColor: Color.transparent(control.color, 0.5)
verticalAlignment: TextInput.AlignVCenter
PlaceholderText {
@@ -65,10 +65,9 @@ T.TextField {
width: control.width - (control.leftPadding + control.rightPadding)
height: control.height - (control.topPadding + control.bottomPadding)
- opacity: 0.5
text: control.placeholderText
font: control.font
- color: control.color
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
diff --git a/src/imports/controls/fusion/ToolBar.qml b/src/imports/controls/fusion/ToolBar.qml
index ab272517..d569899d 100644
--- a/src/imports/controls/fusion/ToolBar.qml
+++ b/src/imports/controls/fusion/ToolBar.qml
@@ -34,24 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ToolBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
-
- leftPadding: 6
- rightPadding: 6
+ horizontalPadding: 6
topPadding: control.position === T.ToolBar.Footer ? 1 : 0
bottomPadding: control.position === T.ToolBar.Header ? 1 : 0
diff --git a/src/imports/controls/fusion/ToolButton.qml b/src/imports/controls/fusion/ToolButton.qml
index dc3c9663..f198a18b 100644
--- a/src/imports/controls/fusion/ToolButton.qml
+++ b/src/imports/controls/fusion/ToolButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ToolButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/fusion/ToolSeparator.qml b/src/imports/controls/fusion/ToolSeparator.qml
index fd10dd72..f8047b81 100644
--- a/src/imports/controls/fusion/ToolSeparator.qml
+++ b/src/imports/controls/fusion/ToolSeparator.qml
@@ -34,22 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ToolSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: vertical ? 6 : 2
- topPadding: vertical ? 2 : 6
- bottomPadding: vertical ? 2 : 6
+ verticalPadding: vertical ? 2 : 6
contentItem: Rectangle {
implicitWidth: vertical ? 2 : 8
diff --git a/src/imports/controls/fusion/ToolTip.qml b/src/imports/controls/fusion/ToolTip.qml
index 2b404a5e..922789dd 100644
--- a/src/imports/controls/fusion/ToolTip.qml
+++ b/src/imports/controls/fusion/ToolTip.qml
@@ -34,12 +34,12 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.ToolTip {
id: control
@@ -47,10 +47,10 @@ T.ToolTip {
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: -implicitHeight - 3
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 6
padding: 6
diff --git a/src/imports/controls/fusion/Tumbler.qml b/src/imports/controls/fusion/Tumbler.qml
index b66e4f2d..fd0d7ef3 100644
--- a/src/imports/controls/fusion/Tumbler.qml
+++ b/src/imports/controls/fusion/Tumbler.qml
@@ -34,17 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Fusion 2.5
+import QtQuick.Controls.Fusion.impl 2.5
T.Tumbler {
id: control
- implicitWidth: 60
- implicitHeight: 200
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6
delegate: Text {
text: modelData
@@ -56,6 +59,8 @@ T.Tumbler {
}
contentItem: TumblerView {
+ implicitWidth: 60
+ implicitHeight: 200
model: control.model
delegate: control.delegate
path: Path {
diff --git a/src/imports/controls/fusion/fusion.pri b/src/imports/controls/fusion/fusion.pri
index 4a6e8fb4..c4493c09 100644
--- a/src/imports/controls/fusion/fusion.pri
+++ b/src/imports/controls/fusion/fusion.pri
@@ -47,7 +47,6 @@ QML_FILES += \
$$PWD/RoundButton.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \
- $$PWD/ScrollView.qml \
$$PWD/Slider.qml \
$$PWD/SliderGroove.qml \
$$PWD/SliderHandle.qml \
diff --git a/src/imports/controls/fusion/fusion.pro b/src/imports/controls/fusion/fusion.pro
index 2934778b..4bc9fcc1 100644
--- a/src/imports/controls/fusion/fusion.pro
+++ b/src/imports/controls/fusion/fusion.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2fusionstyleplugin
TARGETPATH = QtQuick/Controls.2/Fusion
-IMPORT_VERSION = 2.4
+IMPORT_VERSION = 2.5
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
@@ -19,7 +19,7 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2fusionstyle.qrc
-CONFIG += no_cxx_module
+CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
load(qml_plugin)
requires(qtConfig(quickcontrols2-fusion))
diff --git a/src/imports/controls/fusion/qmldir b/src/imports/controls/fusion/qmldir
index 6857b398..b584adc8 100644
--- a/src/imports/controls/fusion/qmldir
+++ b/src/imports/controls/fusion/qmldir
@@ -1,4 +1,4 @@
module QtQuick.Controls.Fusion
plugin qtquickcontrols2fusionstyleplugin
classname QtQuickControls2FusionStylePlugin
-depends QtQuick.Controls 2.4
+depends QtQuick.Controls 2.5
diff --git a/src/imports/controls/fusion/qquickfusiontheme.cpp b/src/imports/controls/fusion/qquickfusiontheme.cpp
index 31494efb..ac88563a 100644
--- a/src/imports/controls/fusion/qquickfusiontheme.cpp
+++ b/src/imports/controls/fusion/qquickfusiontheme.cpp
@@ -36,11 +36,13 @@
#include "qquickfusiontheme_p.h"
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
+
QT_BEGIN_NAMESPACE
-QQuickFusionTheme::QQuickFusionTheme()
- : QQuickTheme(QStringLiteral("Fusion"))
+void QQuickFusionTheme::initialize(QQuickTheme *theme)
{
+ Q_UNUSED(theme);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/fusion/qquickfusiontheme_p.h b/src/imports/controls/fusion/qquickfusiontheme_p.h
index 5dcfcf61..814c1919 100644
--- a/src/imports/controls/fusion/qquickfusiontheme_p.h
+++ b/src/imports/controls/fusion/qquickfusiontheme_p.h
@@ -48,16 +48,16 @@
// We mean it.
//
-#include <QtCore/qvariant.h>
-#include <QtGui/qpalette.h>
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QQuickFusionTheme : public QQuickTheme
+class QQuickTheme;
+
+class QQuickFusionTheme
{
public:
- explicit QQuickFusionTheme();
+ static void initialize(QQuickTheme *theme);
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp b/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp
index 542f088c..107b4a2d 100644
--- a/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp
+++ b/src/imports/controls/fusion/qtquickcontrols2fusionstyleplugin.cpp
@@ -43,14 +43,6 @@
#include "qquickfusionstyle_p.h"
#include "qquickfusiontheme_p.h"
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtquickcontrols2fusionstyle);
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Controls_2_Fusion);
-#endif
-}
-
QT_BEGIN_NAMESPACE
static QObject *styleSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
@@ -71,12 +63,11 @@ public:
void registerTypes(const char *uri) override;
QString name() const override;
- QQuickProxyTheme *createTheme() const override;
+ void initializeTheme(QQuickTheme *theme) override;
};
QtQuickControls2FusionStylePlugin::QtQuickControls2FusionStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
{
- initResources();
}
void QtQuickControls2FusionStylePlugin::registerTypes(const char *uri)
@@ -93,22 +84,22 @@ void QtQuickControls2FusionStylePlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickFusionDial>(import, 2, 3, "DialImpl");
qmlRegisterType<QQuickFusionKnob>(import, 2, 3, "KnobImpl");
- qmlRegisterType(typeUrl(QStringLiteral("ButtonPanel.qml")), import, 2, 3, "ButtonPanel");
- qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 3, "CheckIndicator");
- qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 3, "RadioIndicator");
- qmlRegisterType(typeUrl(QStringLiteral("SliderGroove.qml")), import, 2, 3, "SliderGroove");
- qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 3, "SliderHandle");
- qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 3, "SwitchIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ButtonPanel.qml")), import, 2, 3, "ButtonPanel");
+ qmlRegisterType(resolvedUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 3, "CheckIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 3, "RadioIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SliderGroove.qml")), import, 2, 3, "SliderGroove");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SliderHandle.qml")), import, 2, 3, "SliderHandle");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 3, "SwitchIndicator");
}
QString QtQuickControls2FusionStylePlugin::name() const
{
- return QStringLiteral("fusion");
+ return QStringLiteral("Fusion");
}
-QQuickProxyTheme *QtQuickControls2FusionStylePlugin::createTheme() const
+void QtQuickControls2FusionStylePlugin::initializeTheme(QQuickTheme *theme)
{
- return new QQuickFusionTheme;
+ QQuickFusionTheme::initialize(theme);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/imagine/ApplicationWindow.qml b/src/imports/controls/imagine/ApplicationWindow.qml
index 8600e8d6..00922f63 100644
--- a/src/imports/controls/imagine/ApplicationWindow.qml
+++ b/src/imports/controls/imagine/ApplicationWindow.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.2
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/imagine/BusyIndicator.qml b/src/imports/controls/imagine/BusyIndicator.qml
index a9a5ac40..bd90d21a 100644
--- a/src/imports/controls/imagine/BusyIndicator.qml
+++ b/src/imports/controls/imagine/BusyIndicator.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.BusyIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: AnimatedImage {
opacity: control.running ? 1 : 0
playing: control.running || opacity > 0
@@ -70,10 +75,6 @@ T.BusyIndicator {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "busyindicator-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Button.qml b/src/imports/controls/imagine/Button.qml
index 7c8ab584..c8962a6b 100644
--- a/src/imports/controls/imagine/Button.qml
+++ b/src/imports/controls/imagine/Button.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Button {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -57,6 +56,11 @@ T.Button {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.enabled && control.flat && control.highlighted ? control.palette.highlight
@@ -77,10 +81,6 @@ T.Button {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "button-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/CheckBox.qml b/src/imports/controls/imagine/CheckBox.qml
index 8c5cd918..3f0b7684 100644
--- a/src/imports/controls/imagine/CheckBox.qml
+++ b/src/imports/controls/imagine/CheckBox.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.CheckBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -56,6 +55,11 @@ T.CheckBox {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
indicator: Image {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
@@ -86,10 +90,6 @@ T.CheckBox {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "checkbox-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/CheckDelegate.qml b/src/imports/controls/imagine/CheckDelegate.qml
index 76cd89c4..2336131f 100644
--- a/src/imports/controls/imagine/CheckDelegate.qml
+++ b/src/imports/controls/imagine/CheckDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.CheckDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12 // ###
@@ -58,6 +57,11 @@ T.CheckDelegate {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.text
@@ -97,10 +101,6 @@ T.CheckDelegate {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "checkdelegate-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ComboBox.qml b/src/imports/controls/imagine/ComboBox.qml
index fa22ab90..530fa378 100644
--- a/src/imports/controls/imagine/ComboBox.qml
+++ b/src/imports/controls/imagine/ComboBox.qml
@@ -34,26 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ComboBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + background ? (background.leftPadding + background.rightPadding) : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + background ? (background.topPadding + background.bottomPadding) : 0)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ Math.max(implicitContentHeight,
+ implicitIndicatorHeight) + background ? (background.topPadding + background.bottomPadding) : 0)
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
delegate: ItemDelegate {
width: parent.width
text: control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] : model[control.textRole]) : modelData
@@ -102,10 +106,6 @@ T.ComboBox {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "combobox-background"
NinePatchImageSelector on source {
states: [
@@ -133,6 +133,11 @@ T.ComboBox {
rightPadding: background.rightPadding
bottomPadding: background.bottomPadding
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
palette.text: control.palette.text
palette.highlight: control.palette.highlight
palette.highlightedText: control.palette.highlightedText
@@ -150,10 +155,6 @@ T.ComboBox {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.popup.width + leftInset + rightInset
- height: control.popup.height + topInset + bottomInset
-
source: Imagine.url + "combobox-popup"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/DelayButton.qml b/src/imports/controls/imagine/DelayButton.qml
index f0a2c568..ef1f6511 100644
--- a/src/imports/controls/imagine/DelayButton.qml
+++ b/src/imports/controls/imagine/DelayButton.qml
@@ -34,26 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
import QtGraphicalEffects 1.0
T.DelayButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
transition: Transition {
NumberAnimation {
duration: control.delay * (control.pressed ? 1.0 - control.progress : 0.3 * control.progress)
@@ -70,10 +74,6 @@ T.DelayButton {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "delaybutton-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Dial.qml b/src/imports/controls/imagine/Dial.qml
index e9652249..ac7a4645 100644
--- a/src/imports/controls/imagine/Dial.qml
+++ b/src/imports/controls/imagine/Dial.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Dial {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
(handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
(handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
@@ -52,6 +52,11 @@ T.Dial {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
handle: Image {
x: background.x + background.width / 2 - handle.width / 2
y: background.y + background.height / 2 - handle.height / 2
diff --git a/src/imports/controls/imagine/Dialog.qml b/src/imports/controls/imagine/Dialog.qml
index 67215ec5..968f70ab 100644
--- a/src/imports/controls/imagine/Dialog.qml
+++ b/src/imports/controls/imagine/Dialog.qml
@@ -34,37 +34,35 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Dialog {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
- + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
- background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+ background: NinePatchImage {
source: Imagine.url + "dialog-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/DialogButtonBox.qml b/src/imports/controls/imagine/DialogButtonBox.qml
index 69211ed9..ec1cbde8 100644
--- a/src/imports/controls/imagine/DialogButtonBox.qml
+++ b/src/imports/controls/imagine/DialogButtonBox.qml
@@ -34,24 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.DialogButtonBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ (control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
spacing: 6
delegate: Button {
@@ -60,9 +66,6 @@ T.DialogButtonBox {
}
contentItem: ListView {
- implicitWidth: control.count === 1 ? 200 : contentWidth
- implicitHeight: 32
-
model: control.contentModel
spacing: control.spacing
orientation: ListView.Horizontal
@@ -71,10 +74,6 @@ T.DialogButtonBox {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "dialogbuttonbox-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Drawer.qml b/src/imports/controls/imagine/Drawer.qml
index d4bf5a7c..ea4f7337 100644
--- a/src/imports/controls/imagine/Drawer.qml
+++ b/src/imports/controls/imagine/Drawer.qml
@@ -34,35 +34,35 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Drawer {
id: control
parent: T.ApplicationWindow.overlay
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
enter: Transition { SmoothedAnimation { velocity: 5 } }
exit: Transition { SmoothedAnimation { velocity: 5 } }
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "drawer-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Frame.qml b/src/imports/controls/imagine/Frame.qml
index 4c9b87d3..b049715b 100644
--- a/src/imports/controls/imagine/Frame.qml
+++ b/src/imports/controls/imagine/Frame.qml
@@ -34,30 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
- background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+ background: NinePatchImage {
source: Imagine.url + "frame-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/GroupBox.qml b/src/imports/controls/imagine/GroupBox.qml
index b2868cec..816e0c8c 100644
--- a/src/imports/controls/imagine/GroupBox.qml
+++ b/src/imports/controls/imagine/GroupBox.qml
@@ -34,24 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.GroupBox {
id: control
- 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)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitLabelWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
-
- topPadding: (background ? background.topPadding : 0) + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ topPadding: (background ? background.topPadding : 0) + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
diff --git a/src/imports/controls/imagine/ItemDelegate.qml b/src/imports/controls/imagine/ItemDelegate.qml
index 6d1d7bbe..7ec07f55 100644
--- a/src/imports/controls/imagine/ItemDelegate.qml
+++ b/src/imports/controls/imagine/ItemDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ItemDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12 // ###
@@ -58,6 +57,11 @@ T.ItemDelegate {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.text
@@ -75,10 +79,6 @@ T.ItemDelegate {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "itemdelegate-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Label.qml b/src/imports/controls/imagine/Label.qml
index c73954b2..f9a5bdb6 100644
--- a/src/imports/controls/imagine/Label.qml
+++ b/src/imports/controls/imagine/Label.qml
@@ -34,22 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Label {
id: control
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
color: control.palette.windowText
linkColor: control.palette.link
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "label-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Menu.qml b/src/imports/controls/imagine/Menu.qml
index 74dc09de..bf7540fd 100644
--- a/src/imports/controls/imagine/Menu.qml
+++ b/src/imports/controls/imagine/Menu.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
-import QtQuick.Window 2.11
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
+import QtQuick.Window 2.12
T.Menu {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topMargin: background ? background.topInset : 0
leftMargin: background ? background.leftInset : 0
@@ -59,6 +59,11 @@ T.Menu {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
delegate: MenuItem { }
contentItem: ListView {
@@ -72,10 +77,6 @@ T.Menu {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "menu-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/MenuItem.qml b/src/imports/controls/imagine/MenuItem.qml
index 80d6f2cd..58dc344a 100644
--- a/src/imports/controls/imagine/MenuItem.qml
+++ b/src/imports/controls/imagine/MenuItem.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.MenuItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -58,6 +57,11 @@ T.MenuItem {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.windowText
@@ -118,10 +122,6 @@ T.MenuItem {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "menuitem-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/MenuSeparator.qml b/src/imports/controls/imagine/MenuSeparator.qml
index a14fe9a6..3821a15a 100644
--- a/src/imports/controls/imagine/MenuSeparator.qml
+++ b/src/imports/controls/imagine/MenuSeparator.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.MenuSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight + topPadding + bottomPadding : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: NinePatchImage {
source: Imagine.url + "menuseparator-separator"
NinePatchImageSelector on source {
@@ -63,10 +68,6 @@ T.MenuSeparator {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "menuseparator-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Page.qml b/src/imports/controls/imagine/Page.qml
index c3dd355e..2fe6a01d 100644
--- a/src/imports/controls/imagine/Page.qml
+++ b/src/imports/controls/imagine/Page.qml
@@ -34,36 +34,34 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Page {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
- + (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
- background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+ background: NinePatchImage {
source: Imagine.url + "page-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/PageIndicator.qml b/src/imports/controls/imagine/PageIndicator.qml
index 156033e2..7e9f43fe 100644
--- a/src/imports/controls/imagine/PageIndicator.qml
+++ b/src/imports/controls/imagine/PageIndicator.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.PageIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
delegate: Image {
source: Imagine.url + "pageindicator-delegate"
ImageSelector on source {
@@ -75,10 +80,6 @@ T.PageIndicator {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "pageindicator-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Pane.qml b/src/imports/controls/imagine/Pane.qml
index a1899149..f794666e 100644
--- a/src/imports/controls/imagine/Pane.qml
+++ b/src/imports/controls/imagine/Pane.qml
@@ -34,30 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Pane {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
- background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+ background: NinePatchImage {
source: Imagine.url + "pane-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Popup.qml b/src/imports/controls/imagine/Popup.qml
index a111df3a..12b8300b 100644
--- a/src/imports/controls/imagine/Popup.qml
+++ b/src/imports/controls/imagine/Popup.qml
@@ -34,32 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Popup {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : undefined
leftPadding: background ? background.leftPadding : undefined
rightPadding: background ? background.rightPadding : undefined
bottomPadding: background ? background.bottomPadding : undefined
- background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+ background: NinePatchImage {
source: Imagine.url + "popup-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ProgressBar.qml b/src/imports/controls/imagine/ProgressBar.qml
index 7fd0ce1b..c809f308 100644
--- a/src/imports/controls/imagine/ProgressBar.qml
+++ b/src/imports/controls/imagine/ProgressBar.qml
@@ -34,25 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
import QtGraphicalEffects 1.0
T.ProgressBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: Item {
implicitWidth: control.indeterminate ? animation.implicitWidth || progress.implicitWidth : progress.implicitWidth
implicitHeight: control.indeterminate ? animation.implicitHeight || progress.implicitHeight : progress.implicitHeight
@@ -124,10 +129,6 @@ T.ProgressBar {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "progressbar-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/RadioButton.qml b/src/imports/controls/imagine/RadioButton.qml
index 57bdedaa..6ba36d8a 100644
--- a/src/imports/controls/imagine/RadioButton.qml
+++ b/src/imports/controls/imagine/RadioButton.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.RadioButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -56,6 +55,11 @@ T.RadioButton {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
indicator: Image {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
@@ -85,10 +89,6 @@ T.RadioButton {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "radiobutton-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/RadioDelegate.qml b/src/imports/controls/imagine/RadioDelegate.qml
index e7e37b0b..c3febde2 100644
--- a/src/imports/controls/imagine/RadioDelegate.qml
+++ b/src/imports/controls/imagine/RadioDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.RadioDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12 // ###
@@ -58,6 +57,11 @@ T.RadioDelegate {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.text
@@ -96,10 +100,6 @@ T.RadioDelegate {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "radiodelegate-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/RangeSlider.qml b/src/imports/controls/imagine/RangeSlider.qml
index 5c7ee70e..5461cf01 100644
--- a/src/imports/controls/imagine/RangeSlider.qml
+++ b/src/imports/controls/imagine/RangeSlider.qml
@@ -34,26 +34,31 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.RangeSlider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ first.implicitHandleWidth + leftPadding + rightPadding,
+ second.implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ first.implicitHandleHeight + topPadding + bottomPadding,
+ second.implicitHandleHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
first.handle: Image {
x: control.leftPadding + (control.horizontal ? control.first.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2)
y: control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.first.visualPosition * (control.availableHeight - height))
@@ -93,9 +98,6 @@ T.RangeSlider {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
scale: control.horizontal && control.mirrored ? -1 : 1
source: Imagine.url + "rangeslider-background"
diff --git a/src/imports/controls/imagine/RoundButton.qml b/src/imports/controls/imagine/RoundButton.qml
index b9f4ae06..718faad4 100644
--- a/src/imports/controls/imagine/RoundButton.qml
+++ b/src/imports/controls/imagine/RoundButton.qml
@@ -34,27 +34,31 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.RoundButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.enabled && control.flat && control.highlighted ? control.palette.highlight
@@ -75,10 +79,6 @@ T.RoundButton {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
// ### TODO: radius?
source: Imagine.url + "roundbutton-background"
NinePatchImageSelector on source {
diff --git a/src/imports/controls/imagine/ScrollBar.qml b/src/imports/controls/imagine/ScrollBar.qml
index 49c8d1f0..b7acf416 100644
--- a/src/imports/controls/imagine/ScrollBar.qml
+++ b/src/imports/controls/imagine/ScrollBar.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ScrollBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
visible: control.policy !== T.ScrollBar.AlwaysOff
@@ -54,6 +54,11 @@ T.ScrollBar {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: NinePatchImage {
width: control.availableWidth
height: control.availableHeight
@@ -74,10 +79,6 @@ T.ScrollBar {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "scrollbar-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ScrollIndicator.qml b/src/imports/controls/imagine/ScrollIndicator.qml
index a2d0e94f..fd1effa3 100644
--- a/src/imports/controls/imagine/ScrollIndicator.qml
+++ b/src/imports/controls/imagine/ScrollIndicator.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ScrollIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: NinePatchImage {
width: control.availableWidth
height: control.availableHeight
@@ -70,10 +75,6 @@ T.ScrollIndicator {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "scrollindicator-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ScrollView.qml b/src/imports/controls/imagine/ScrollView.qml
index 9ab64881..64fd3ac5 100644
--- a/src/imports/controls/imagine/ScrollView.qml
+++ b/src/imports/controls/imagine/ScrollView.qml
@@ -34,26 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ScrollView {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : -1)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : -1)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
T.ScrollBar.vertical: ScrollBar {
parent: control
x: control.mirrored ? 0 : control.width - width
@@ -71,10 +75,6 @@ T.ScrollView {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.path + "scrollview-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Slider.qml b/src/imports/controls/imagine/Slider.qml
index a206c03b..f39bab70 100644
--- a/src/imports/controls/imagine/Slider.qml
+++ b/src/imports/controls/imagine/Slider.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Slider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHandleHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
handle: Image {
x: Math.round(control.leftPadding + (control.horizontal ? control.visualPosition * (control.availableWidth - width) : (control.availableWidth - width) / 2))
y: Math.round(control.topPadding + (control.horizontal ? (control.availableHeight - height) / 2 : control.visualPosition * (control.availableHeight - height)))
@@ -71,9 +76,6 @@ T.Slider {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
scale: control.horizontal && control.mirrored ? -1 : 1
source: Imagine.url + "slider-background"
diff --git a/src/imports/controls/imagine/SpinBox.qml b/src/imports/controls/imagine/SpinBox.qml
index 1ef862f5..866db7fc 100644
--- a/src/imports/controls/imagine/SpinBox.qml
+++ b/src/imports/controls/imagine/SpinBox.qml
@@ -34,29 +34,33 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.SpinBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + 2 * padding +
- (up.indicator ? up.indicator.implicitWidth : 0) +
- (down.indicator ? down.indicator.implicitWidth : 0))
- implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
- up.indicator ? up.indicator.implicitHeight : 0,
- down.indicator ? down.indicator.implicitHeight : 0)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ up.implicitIndicatorWidth +
+ down.implicitIndicatorWidth)
+ implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight,
+ up.implicitIndicatorHeight,
+ down.implicitIndicatorHeight)
topPadding: background ? background.topPadding : 0
leftPadding: (background ? background.leftPadding : 0) + (control.mirrored ? (up.indicator ? up.indicator.width : 0) : (down.indicator ? down.indicator.width : 0))
rightPadding: (background ? background.rightPadding : 0) + (control.mirrored ? (down.indicator ? down.indicator.width : 0) : (up.indicator ? up.indicator.width : 0))
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
validator: IntValidator {
locale: control.locale.name
bottom: Math.min(control.from, control.to)
@@ -134,10 +138,6 @@ T.SpinBox {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "spinbox-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/StackView.qml b/src/imports/controls/imagine/StackView.qml
index 8d749519..302816d7 100644
--- a/src/imports/controls/imagine/StackView.qml
+++ b/src/imports/controls/imagine/StackView.qml
@@ -34,22 +34,27 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.StackView {
id: control
- implicitWidth: background ? background.implicitWidth : 0
- implicitHeight: background ? background.implicitHeight : 0
+ implicitWidth: implicitBackgroundWidth
+ implicitHeight: implicitBackgroundHeight
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
popEnter: Transition {
XAnimator { from: (control.mirrored ? -1 : 1) * -control.width; to: 0; duration: 400; easing.type: Easing.OutCubic }
}
@@ -75,10 +80,6 @@ T.StackView {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "stackview-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/SwipeDelegate.qml b/src/imports/controls/imagine/SwipeDelegate.qml
index 23edfc58..be1a378e 100644
--- a/src/imports/controls/imagine/SwipeDelegate.qml
+++ b/src/imports/controls/imagine/SwipeDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.SwipeDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12 // ###
@@ -58,6 +57,11 @@ T.SwipeDelegate {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.text
@@ -77,10 +81,6 @@ T.SwipeDelegate {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "swipedelegate-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/SwipeView.qml b/src/imports/controls/imagine/SwipeView.qml
index f997be0d..6c946715 100644
--- a/src/imports/controls/imagine/SwipeView.qml
+++ b/src/imports/controls/imagine/SwipeView.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.SwipeView {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: ListView {
model: control.contentModel
interactive: control.interactive
@@ -69,10 +74,6 @@ T.SwipeView {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "swipeview-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Switch.qml b/src/imports/controls/imagine/Switch.qml
index 085d6879..2a144c85 100644
--- a/src/imports/controls/imagine/Switch.qml
+++ b/src/imports/controls/imagine/Switch.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Switch {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -56,6 +55,11 @@ T.Switch {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
indicator: NinePatchImage {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
@@ -115,10 +119,6 @@ T.Switch {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "switch-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/SwitchDelegate.qml b/src/imports/controls/imagine/SwitchDelegate.qml
index b53cf321..a4f7e93e 100644
--- a/src/imports/controls/imagine/SwitchDelegate.qml
+++ b/src/imports/controls/imagine/SwitchDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.SwitchDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12 // ###
@@ -58,6 +57,11 @@ T.SwitchDelegate {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.text
@@ -127,10 +131,6 @@ T.SwitchDelegate {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "switchdelegate-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/TabBar.qml b/src/imports/controls/imagine/TabBar.qml
index be143bf1..20802da0 100644
--- a/src/imports/controls/imagine/TabBar.qml
+++ b/src/imports/controls/imagine/TabBar.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.TabBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
@@ -52,6 +52,11 @@ T.TabBar {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: ListView {
model: control.contentModel
currentIndex: control.currentIndex
@@ -69,10 +74,6 @@ T.TabBar {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "tabbar-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/TabButton.qml b/src/imports/controls/imagine/TabButton.qml
index d4098c9e..71cd021f 100644
--- a/src/imports/controls/imagine/TabButton.qml
+++ b/src/imports/controls/imagine/TabButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.TabButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -57,6 +56,11 @@ T.TabButton {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.buttonText
@@ -73,10 +77,6 @@ T.TabButton {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "tabbutton-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/TextArea.qml b/src/imports/controls/imagine/TextArea.qml
index 1e351ab8..94fe237c 100644
--- a/src/imports/controls/imagine/TextArea.qml
+++ b/src/imports/controls/imagine/TextArea.qml
@@ -34,21 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
@@ -56,10 +56,16 @@ T.TextArea {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
verticalAlignment: Qt.AlignVCenter
+ placeholderTextColor: Color.transparent(control.color, 0.5)
PlaceholderText {
id: placeholder
@@ -70,19 +76,14 @@ T.TextArea {
text: control.placeholderText
font: control.font
- color: control.color
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
renderType: control.renderType
- opacity: 0.5
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "textarea-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/TextField.qml b/src/imports/controls/imagine/TextField.qml
index 1782c1e2..2943396e 100644
--- a/src/imports/controls/imagine/TextField.qml
+++ b/src/imports/controls/imagine/TextField.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.TextField {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
- || contentWidth + leftPadding + rightPadding
- implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
@@ -56,9 +55,15 @@ T.TextField {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
color: control.palette.text
selectionColor: control.palette.highlight
selectedTextColor: control.palette.highlightedText
+ placeholderTextColor: Color.transparent(control.color, 0.5)
verticalAlignment: Qt.AlignVCenter
PlaceholderText {
@@ -70,19 +75,14 @@ T.TextField {
text: control.placeholderText
font: control.font
- color: control.color
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
elide: Text.ElideRight
renderType: control.renderType
- opacity: 0.5
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "textfield-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ToolBar.qml b/src/imports/controls/imagine/ToolBar.qml
index 289566ec..f1cb3768 100644
--- a/src/imports/controls/imagine/ToolBar.qml
+++ b/src/imports/controls/imagine/ToolBar.qml
@@ -34,30 +34,30 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ToolBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
- background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+ background: NinePatchImage {
source: Imagine.url + "toolbar-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ToolButton.qml b/src/imports/controls/imagine/ToolButton.qml
index 63260ff5..e41c2cf8 100644
--- a/src/imports/controls/imagine/ToolButton.qml
+++ b/src/imports/controls/imagine/ToolButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ToolButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
spacing: 6 // ###
@@ -57,6 +56,11 @@ T.ToolButton {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
icon.width: 24
icon.height: 24
icon.color: control.palette.buttonText
@@ -73,10 +77,6 @@ T.ToolButton {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "toolbutton-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ToolSeparator.qml b/src/imports/controls/imagine/ToolSeparator.qml
index 88b645cb..8961b259 100644
--- a/src/imports/controls/imagine/ToolSeparator.qml
+++ b/src/imports/controls/imagine/ToolSeparator.qml
@@ -34,24 +34,29 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ToolSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight + topPadding + bottomPadding : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
topPadding: background ? background.topPadding : 0
leftPadding: background ? background.leftPadding : 0
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
contentItem: NinePatchImage {
source: Imagine.url + "toolseparator-separator"
NinePatchImageSelector on source {
@@ -65,10 +70,6 @@ T.ToolSeparator {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "toolseparator-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/ToolTip.qml b/src/imports/controls/imagine/ToolTip.qml
index 81a5e8aa..2bcb4fa8 100644
--- a/src/imports/controls/imagine/ToolTip.qml
+++ b/src/imports/controls/imagine/ToolTip.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.ToolTip {
id: control
@@ -45,10 +45,10 @@ T.ToolTip {
x: parent ? (parent.width - implicitWidth) / 2 : 0 - (background ? background.leftInset : 0)
y: -implicitHeight - (background ? background.topInset : 0)
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topMargin: background ? background.topInset : 0
leftMargin: background ? background.leftInset : 0
@@ -60,6 +60,11 @@ T.ToolTip {
rightPadding: background ? background.rightPadding : 0
bottomPadding: background ? background.bottomPadding : 0
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
+
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
contentItem: Text {
@@ -70,10 +75,6 @@ T.ToolTip {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "tooltip-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/Tumbler.qml b/src/imports/controls/imagine/Tumbler.qml
index 7beb39c5..80e8eb1f 100644
--- a/src/imports/controls/imagine/Tumbler.qml
+++ b/src/imports/controls/imagine/Tumbler.qml
@@ -34,17 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Imagine 2.4
-import QtQuick.Controls.Imagine.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Imagine 2.5
+import QtQuick.Controls.Imagine.impl 2.5
T.Tumbler {
id: control
- implicitWidth: 60
- implicitHeight: 200
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6
+
+ topInset: background ? -background.topInset || 0 : 0
+ leftInset: background ? -background.leftInset || 0 : 0
+ rightInset: background ? -background.rightInset || 0 : 0
+ bottomInset: background ? -background.bottomInset || 0 : 0
delegate: Text {
text: modelData
@@ -56,6 +64,8 @@ T.Tumbler {
}
contentItem: TumblerView {
+ implicitWidth: 60
+ implicitHeight: 200
model: control.model
delegate: control.delegate
path: Path {
@@ -71,10 +81,6 @@ T.Tumbler {
}
background: NinePatchImage {
- x: -leftInset; y: -topInset
- width: control.width + leftInset + rightInset
- height: control.height + topInset + bottomInset
-
source: Imagine.url + "tumbler-background"
NinePatchImageSelector on source {
states: [
diff --git a/src/imports/controls/imagine/imagine.pro b/src/imports/controls/imagine/imagine.pro
index 1f63d572..2368c0a4 100644
--- a/src/imports/controls/imagine/imagine.pro
+++ b/src/imports/controls/imagine/imagine.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2imaginestyleplugin
TARGETPATH = QtQuick/Controls.2/Imagine
-IMPORT_VERSION = 2.4
+IMPORT_VERSION = 2.5
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
@@ -22,7 +22,7 @@ qtquickcontrols2imaginestyle.files += \
$$files($$PWD/images/*.webp)
RESOURCES += qtquickcontrols2imaginestyle
-CONFIG += no_cxx_module
+CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
load(qml_plugin)
requires(qtConfig(quickcontrols2-imagine))
diff --git a/src/imports/controls/imagine/qmldir b/src/imports/controls/imagine/qmldir
index 48fd3bdb..7b4b3ea0 100644
--- a/src/imports/controls/imagine/qmldir
+++ b/src/imports/controls/imagine/qmldir
@@ -1,5 +1,5 @@
module QtQuick.Controls.Imagine
plugin qtquickcontrols2imaginestyleplugin
classname QtQuickControls2ImagineStylePlugin
-depends QtQuick.Controls 2.4
+depends QtQuick.Controls 2.5
depends QtGraphicalEffects 1.0
diff --git a/src/imports/controls/imagine/qquickimaginetheme.cpp b/src/imports/controls/imagine/qquickimaginetheme.cpp
index 5505e7ce..a9722fa5 100644
--- a/src/imports/controls/imagine/qquickimaginetheme.cpp
+++ b/src/imports/controls/imagine/qquickimaginetheme.cpp
@@ -36,20 +36,21 @@
#include "qquickimaginetheme_p.h"
-#include <QtGui/qfontinfo.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
-QQuickImagineTheme::QQuickImagineTheme()
- : QQuickTheme(QStringLiteral("Imagine"))
+void QQuickImagineTheme::initialize(QQuickTheme *theme)
{
+ QFont systemFont;
systemFont.setFamily(QLatin1String("Open Sans"));
- systemFont = resolveFont(systemFont);
+ theme->setFont(QQuickTheme::System, systemFont);
const QColor accentColor = QColor::fromRgb(0x4fc1e9);
const QColor windowTextColor = QColor::fromRgb(0x434a54);
const QColor disabledWindowTextColor = QColor::fromRgb(0xccd1d9);
+ QPalette systemPalette;
systemPalette.setColor(QPalette::ButtonText, Qt::white);
systemPalette.setColor(QPalette::BrightText, Qt::white);
systemPalette.setColor(QPalette::Highlight, accentColor);
@@ -59,19 +60,7 @@ QQuickImagineTheme::QQuickImagineTheme()
systemPalette.setColor(QPalette::WindowText, windowTextColor);
systemPalette.setColor(QPalette::Disabled, QPalette::Text, disabledWindowTextColor);
systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, disabledWindowTextColor);
- systemPalette = resolvePalette(systemPalette);
-}
-
-const QFont *QQuickImagineTheme::font(QPlatformTheme::Font type) const
-{
- Q_UNUSED(type);
- return &systemFont;
-}
-
-const QPalette *QQuickImagineTheme::palette(QPlatformTheme::Palette type) const
-{
- Q_UNUSED(type);
- return &systemPalette;
+ theme->setPalette(QQuickTheme::System, systemPalette);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/imagine/qquickimaginetheme_p.h b/src/imports/controls/imagine/qquickimaginetheme_p.h
index ea3a1cbd..d3d43074 100644
--- a/src/imports/controls/imagine/qquickimaginetheme_p.h
+++ b/src/imports/controls/imagine/qquickimaginetheme_p.h
@@ -48,21 +48,16 @@
// We mean it.
//
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QQuickImagineTheme : public QQuickTheme
+class QQuickTheme;
+
+class QQuickImagineTheme
{
public:
- explicit QQuickImagineTheme();
-
- const QFont *font(Font type = SystemFont) const override;
- const QPalette *palette(Palette type = SystemPalette) const override;
-
-private:
- QFont systemFont;
- QPalette systemPalette;
+ static void initialize(QQuickTheme *theme);
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/imagine/qquickninepatchimage.cpp b/src/imports/controls/imagine/qquickninepatchimage.cpp
index 9e1b82bf..c840c6f8 100644
--- a/src/imports/controls/imagine/qquickninepatchimage.cpp
+++ b/src/imports/controls/imagine/qquickninepatchimage.cpp
@@ -192,9 +192,6 @@ public:
void updatePaddings(const QSizeF &size, const QVector<qreal> &horizontal, const QVector<qreal> &vertical);
void updateInsets(const QVector<qreal> &horizontal, const QVector<qreal> &vertical);
- qreal getImplicitWidth() const override;
- qreal getImplicitHeight() const override;
-
bool resetNode = false;
qreal topPadding = 0;
qreal leftPadding = 0;
@@ -332,18 +329,6 @@ void QQuickNinePatchImagePrivate::updateInsets(const QVector<qreal> &horizontal,
emit q->rightInsetChanged();
}
-qreal QQuickNinePatchImagePrivate::getImplicitWidth() const
-{
- Q_Q(const QQuickNinePatchImage);
- return implicitWidth - q->leftInset() - q->rightInset();
-}
-
-qreal QQuickNinePatchImagePrivate::getImplicitHeight() const
-{
- Q_Q(const QQuickNinePatchImage);
- return implicitHeight - q->topInset() - q->bottomInset();
-}
-
QQuickNinePatchImage::QQuickNinePatchImage(QQuickItem *parent)
: QQuickImage(*(new QQuickNinePatchImagePrivate), parent)
{
diff --git a/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp b/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp
index 2a613f1c..490825ff 100644
--- a/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp
+++ b/src/imports/controls/imagine/qtquickcontrols2imaginestyleplugin.cpp
@@ -43,14 +43,6 @@
#include "qquickimaginetheme_p.h"
#include "qquickninepatchimage_p.h"
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qmake_qtquickcontrols2imaginestyle);
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Controls_2_Imagine);
-#endif
-}
-
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQtQuickControlsImagine, "qt.quick.controls.imagine")
@@ -66,12 +58,11 @@ public:
void registerTypes(const char *uri) override;
QString name() const override;
- QQuickProxyTheme *createTheme() const override;
+ void initializeTheme(QQuickTheme *theme) override;
};
QtQuickControls2ImagineStylePlugin::QtQuickControls2ImagineStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
{
- initResources();
}
void QtQuickControls2ImagineStylePlugin::registerTypes(const char *uri)
@@ -90,12 +81,12 @@ void QtQuickControls2ImagineStylePlugin::registerTypes(const char *uri)
QString QtQuickControls2ImagineStylePlugin::name() const
{
- return QStringLiteral("imagine");
+ return QStringLiteral("Imagine");
}
-QQuickProxyTheme *QtQuickControls2ImagineStylePlugin::createTheme() const
+void QtQuickControls2ImagineStylePlugin::initializeTheme(QQuickTheme *theme)
{
- return new QQuickImagineTheme;
+ QQuickImagineTheme::initialize(theme);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/ApplicationWindow.qml b/src/imports/controls/material/ApplicationWindow.qml
index c3d866ce..94aaeff3 100644
--- a/src/imports/controls/material/ApplicationWindow.qml
+++ b/src/imports/controls/material/ApplicationWindow.qml
@@ -34,10 +34,10 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/material/BoxShadow.qml b/src/imports/controls/material/BoxShadow.qml
index 3d352195..5004c7f6 100644
--- a/src/imports/controls/material/BoxShadow.qml
+++ b/src/imports/controls/material/BoxShadow.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
/*
A implementation of CSS's box-shadow, used by ElevationEffect for a Material Design
diff --git a/src/imports/controls/material/BusyIndicator.qml b/src/imports/controls/material/BusyIndicator.qml
index 5e53bdb9..18887669 100644
--- a/src/imports/controls/material/BusyIndicator.qml
+++ b/src/imports/controls/material/BusyIndicator.qml
@@ -34,22 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.BusyIndicator {
id: control
- implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
- implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
contentItem: BusyIndicatorImpl {
- implicitWidth: 48
- implicitHeight: 48
+ implicitWidth: control.Material.touchTarget
+ implicitHeight: control.Material.touchTarget
color: control.Material.accentColor
running: control.running
diff --git a/src/imports/controls/material/Button.qml b/src/imports/controls/material/Button.qml
index 6401b2ad..62afe2cb 100644
--- a/src/imports/controls/material/Button.qml
+++ b/src/imports/controls/material/Button.qml
@@ -34,26 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Button {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
- // external vertical padding is 6 (to increase touch area)
+ topInset: 6
+ bottomInset: 6
padding: 12
- leftPadding: padding - 4
- rightPadding: padding - 4
+ horizontalPadding: padding - 4
spacing: 6
icon.width: 24
@@ -82,12 +81,8 @@ T.Button {
// TODO: Add a proper ripple/ink effect for mouse/touch input and focus state
background: Rectangle {
implicitWidth: 64
- implicitHeight: 48
+ implicitHeight: control.Material.buttonHeight
- // external vertical padding is 6 (to increase touch area)
- y: 6
- width: parent.width
- height: parent.height - 12
radius: 2
color: !control.enabled ? control.Material.buttonDisabledColor :
control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor
diff --git a/src/imports/controls/material/CheckBox.qml b/src/imports/controls/material/CheckBox.qml
index 1f818e6e..3ba8c887 100644
--- a/src/imports/controls/material/CheckBox.qml
+++ b/src/imports/controls/material/CheckBox.qml
@@ -34,25 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.CheckBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 8
padding: 8
- topPadding: padding + 7
- bottomPadding: padding + 7
+ verticalPadding: padding + 7
indicator: CheckIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
diff --git a/src/imports/controls/material/CheckDelegate.qml b/src/imports/controls/material/CheckDelegate.qml
index 1d3ff61d..caf0f8e1 100644
--- a/src/imports/controls/material/CheckDelegate.qml
+++ b/src/imports/controls/material/CheckDelegate.qml
@@ -34,26 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.CheckDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: 8
spacing: 16
icon.width: 24
@@ -82,7 +80,7 @@ T.CheckDelegate {
}
background: Rectangle {
- implicitHeight: 48
+ implicitHeight: control.Material.delegateHeight
color: control.highlighted ? control.Material.listHighlightColor : "transparent"
diff --git a/src/imports/controls/material/CheckIndicator.qml b/src/imports/controls/material/CheckIndicator.qml
index dbba4ca4..67f46551 100644
--- a/src/imports/controls/material/CheckIndicator.qml
+++ b/src/imports/controls/material/CheckIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
Rectangle {
id: indicatorItem
diff --git a/src/imports/controls/material/ComboBox.qml b/src/imports/controls/material/ComboBox.qml
index 3dd3cf30..5db53d1c 100644
--- a/src/imports/controls/material/ComboBox.qml
+++ b/src/imports/controls/material/ComboBox.qml
@@ -34,23 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.ComboBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
+
+ topInset: 6
+ bottomInset: 6
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
@@ -99,11 +101,8 @@ T.ComboBox {
background: Rectangle {
implicitWidth: 120
- implicitHeight: 48
+ implicitHeight: control.Material.buttonHeight
- // external vertical padding is 6 (to increase touch area)
- y: 6
- height: parent.height - 12
radius: control.flat ? 0 : 2
color: !control.editable ? control.Material.dialogColor : "transparent"
diff --git a/src/imports/controls/material/CursorDelegate.qml b/src/imports/controls/material/CursorDelegate.qml
index 5b2140a7..ffb3b3dd 100644
--- a/src/imports/controls/material/CursorDelegate.qml
+++ b/src/imports/controls/material/CursorDelegate.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
Rectangle {
id: cursor
diff --git a/src/imports/controls/material/DelayButton.qml b/src/imports/controls/material/DelayButton.qml
index 4043949c..fddd49e4 100644
--- a/src/imports/controls/material/DelayButton.qml
+++ b/src/imports/controls/material/DelayButton.qml
@@ -34,26 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.DelayButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
- // external vertical padding is 6 (to increase touch area)
+ topInset: 6
+ bottomInset: 6
padding: 12
- leftPadding: padding - 4
- rightPadding: padding - 4
+ horizontalPadding: padding - 4
Material.elevation: control.down ? 8 : 2
@@ -75,12 +74,8 @@ T.DelayButton {
// TODO: Add a proper ripple/ink effect for mouse/touch input and focus state
background: Rectangle {
implicitWidth: 64
- implicitHeight: 48
+ implicitHeight: control.Material.buttonHeight
- // external vertical padding is 6 (to increase touch area)
- y: 6
- width: parent.width
- height: parent.height - 12
radius: 2
color: !control.enabled ? control.Material.buttonDisabledColor : control.Material.buttonColor
diff --git a/src/imports/controls/material/Dial.qml b/src/imports/controls/material/Dial.qml
index 54469c92..ce6bbc4b 100644
--- a/src/imports/controls/material/Dial.qml
+++ b/src/imports/controls/material/Dial.qml
@@ -34,18 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Dial {
id: control
- implicitWidth: 100
- implicitHeight: 100
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 100 // ### remove 100 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 100 // ### remove 100 in Qt 6
background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 100
+
x: control.width / 2 - width / 2
y: control.height / 2 - height / 2
width: Math.max(64, Math.min(control.width, control.height))
diff --git a/src/imports/controls/material/Dialog.qml b/src/imports/controls/material/Dialog.qml
index 5bbafc68..9426096e 100644
--- a/src/imports/controls/material/Dialog.qml
+++ b/src/imports/controls/material/Dialog.qml
@@ -34,27 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Dialog {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
- + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
padding: 24
topPadding: 20
diff --git a/src/imports/controls/material/DialogButtonBox.qml b/src/imports/controls/material/DialogButtonBox.qml
index 35df6362..eee9b88d 100644
--- a/src/imports/controls/material/DialogButtonBox.qml
+++ b/src/imports/controls/material/DialogButtonBox.qml
@@ -34,35 +34,32 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.DialogButtonBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 8
padding: 8
- topPadding: 2
- bottomPadding: 2
+ verticalPadding: 2
alignment: Qt.AlignRight
+ buttonLayout: T.DialogButtonBox.AndroidLayout
Material.foreground: Material.accent
delegate: Button { flat: true }
contentItem: ListView {
- implicitWidth: contentWidth
- implicitHeight: 48
-
model: control.contentModel
spacing: control.spacing
orientation: ListView.Horizontal
@@ -71,7 +68,7 @@ T.DialogButtonBox {
}
background: PaddedRectangle {
- implicitHeight: 52
+ implicitHeight: control.Material.dialogButtonBoxHeight
radius: 2
color: control.Material.dialogColor
// Rounded corners should be only at the top or at the bottom
diff --git a/src/imports/controls/material/Drawer.qml b/src/imports/controls/material/Drawer.qml
index 827e0b21..6721e10f 100644
--- a/src/imports/controls/material/Drawer.qml
+++ b/src/imports/controls/material/Drawer.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Drawer {
id: control
parent: T.Overlay.overlay
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: !dim && edge === Qt.BottomEdge && Material.elevation === 0
leftPadding: !dim && edge === Qt.RightEdge && Material.elevation === 0
diff --git a/src/imports/controls/material/ElevationEffect.qml b/src/imports/controls/material/ElevationEffect.qml
index 71eccf4e..7e5d79aa 100644
--- a/src/imports/controls/material/ElevationEffect.qml
+++ b/src/imports/controls/material/ElevationEffect.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
/*
An effect for standard Material Design elevation shadows. Useful for using as \c layer.effect.
diff --git a/src/imports/controls/material/Frame.qml b/src/imports/controls/material/Frame.qml
index 51721c2c..7af59ca1 100644
--- a/src/imports/controls/material/Frame.qml
+++ b/src/imports/controls/material/Frame.qml
@@ -34,21 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
+ verticalPadding: Material.frameVerticalPadding
background: Rectangle {
radius: 2
diff --git a/src/imports/controls/material/GroupBox.qml b/src/imports/controls/material/GroupBox.qml
index 7ac30ec6..b07bb12d 100644
--- a/src/imports/controls/material/GroupBox.qml
+++ b/src/imports/controls/material/GroupBox.qml
@@ -34,25 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.GroupBox {
id: control
- 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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitLabelWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 6
padding: 12
- topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ topPadding: Material.frameVerticalPadding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
+ bottomPadding: Material.frameVerticalPadding
label: Text {
x: control.leftPadding
diff --git a/src/imports/controls/material/ItemDelegate.qml b/src/imports/controls/material/ItemDelegate.qml
index 3230ff26..b4839dd3 100644
--- a/src/imports/controls/material/ItemDelegate.qml
+++ b/src/imports/controls/material/ItemDelegate.qml
@@ -34,26 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.ItemDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: 8
spacing: 16
icon.width: 24
@@ -73,7 +71,7 @@ T.ItemDelegate {
}
background: Rectangle {
- implicitHeight: 48
+ implicitHeight: control.Material.delegateHeight
color: control.highlighted ? control.Material.listHighlightColor : "transparent"
diff --git a/src/imports/controls/material/Label.qml b/src/imports/controls/material/Label.qml
index 26998a9e..49333e86 100644
--- a/src/imports/controls/material/Label.qml
+++ b/src/imports/controls/material/Label.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.Label {
id: control
diff --git a/src/imports/controls/material/Menu.qml b/src/imports/controls/material/Menu.qml
index 206ebd75..8f7c797c 100644
--- a/src/imports/controls/material/Menu.qml
+++ b/src/imports/controls/material/Menu.qml
@@ -34,26 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
-import QtQuick.Window 2.11
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
+import QtQuick.Window 2.12
T.Menu {
id: control
Material.elevation: 8
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 0
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: 8
transformOrigin: !cascade ? Item.Top : (mirrored ? Item.TopRight : Item.TopLeft)
@@ -84,7 +83,7 @@ T.Menu {
background: Rectangle {
implicitWidth: 200
- implicitHeight: 48
+ implicitHeight: control.Material.menuItemHeight
radius: 3
color: control.Material.dialogColor
diff --git a/src/imports/controls/material/MenuBar.qml b/src/imports/controls/material/MenuBar.qml
index da12c9e9..74c5083d 100644
--- a/src/imports/controls/material/MenuBar.qml
+++ b/src/imports/controls/material/MenuBar.qml
@@ -34,19 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.MenuBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
delegate: MenuBarItem { }
diff --git a/src/imports/controls/material/MenuBarItem.qml b/src/imports/controls/material/MenuBarItem.qml
index 3c99cc15..eeb93fe4 100644
--- a/src/imports/controls/material/MenuBarItem.qml
+++ b/src/imports/controls/material/MenuBarItem.qml
@@ -34,25 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.MenuBarItem {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 12
- bottomPadding: 12
+ verticalPadding: 12
spacing: 16
icon.width: 24
diff --git a/src/imports/controls/material/MenuItem.qml b/src/imports/controls/material/MenuItem.qml
index 54d13f8e..1f9caf8d 100644
--- a/src/imports/controls/material/MenuItem.qml
+++ b/src/imports/controls/material/MenuItem.qml
@@ -34,26 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.MenuItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 12
- bottomPadding: 12
+ verticalPadding: Material.menuItemVerticalPadding
spacing: 16
icon.width: 24
@@ -97,7 +95,7 @@ T.MenuItem {
background: Rectangle {
implicitWidth: 200
- implicitHeight: 48
+ implicitHeight: control.Material.menuItemHeight
color: control.highlighted ? control.Material.listHighlightColor : "transparent"
Ripple {
diff --git a/src/imports/controls/material/MenuSeparator.qml b/src/imports/controls/material/MenuSeparator.qml
index d2059d3a..6eb597c3 100644
--- a/src/imports/controls/material/MenuSeparator.qml
+++ b/src/imports/controls/material/MenuSeparator.qml
@@ -34,18 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.MenuSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: 8
contentItem: Rectangle {
implicitWidth: 200
diff --git a/src/imports/controls/material/Page.qml b/src/imports/controls/material/Page.qml
index 647d8f0f..6e09f44f 100644
--- a/src/imports/controls/material/Page.qml
+++ b/src/imports/controls/material/Page.qml
@@ -34,24 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.Page {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
- + (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
background: Rectangle {
color: control.Material.backgroundColor
diff --git a/src/imports/controls/material/PageIndicator.qml b/src/imports/controls/material/PageIndicator.qml
index 2ab9cd33..5cfcce04 100644
--- a/src/imports/controls/material/PageIndicator.qml
+++ b/src/imports/controls/material/PageIndicator.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.PageIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
diff --git a/src/imports/controls/material/Pane.qml b/src/imports/controls/material/Pane.qml
index 0e232a9d..af2c2642 100644
--- a/src/imports/controls/material/Pane.qml
+++ b/src/imports/controls/material/Pane.qml
@@ -34,19 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Pane {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/material/Popup.qml b/src/imports/controls/material/Popup.qml
index 0d255f7d..3d7039bb 100644
--- a/src/imports/controls/material/Popup.qml
+++ b/src/imports/controls/material/Popup.qml
@@ -34,23 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Popup {
id: control
Material.elevation: 24
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/material/ProgressBar.qml b/src/imports/controls/material/ProgressBar.qml
index 0f08c732..269ac657 100644
--- a/src/imports/controls/material/ProgressBar.qml
+++ b/src/imports/controls/material/ProgressBar.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.ProgressBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
contentItem: ProgressBarImpl {
implicitHeight: 4
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index 2a95f989..108ddbad 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -34,25 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.RadioButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 8
padding: 8
- topPadding: padding + 6
- bottomPadding: padding + 6
+ verticalPadding: padding + 6
indicator: RadioIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml
index d498ee80..5cc23829 100644
--- a/src/imports/controls/material/RadioDelegate.qml
+++ b/src/imports/controls/material/RadioDelegate.qml
@@ -34,26 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.RadioDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: 8
spacing: 16
icon.width: 24
@@ -82,7 +80,7 @@ T.RadioDelegate {
}
background: Rectangle {
- implicitHeight: 48
+ implicitHeight: control.Material.delegateHeight
color: control.highlighted ? control.Material.listHighlightColor : "transparent"
diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml
index 7f27dcdc..f69f31cc 100644
--- a/src/imports/controls/material/RadioIndicator.qml
+++ b/src/imports/controls/material/RadioIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
Rectangle {
implicitWidth: 20
diff --git a/src/imports/controls/material/RangeSlider.qml b/src/imports/controls/material/RangeSlider.qml
index cbe21400..8c8a88b1 100644
--- a/src/imports/controls/material/RangeSlider.qml
+++ b/src/imports/controls/material/RangeSlider.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.RangeSlider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ first.implicitHandleWidth + leftPadding + rightPadding,
+ second.implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ first.implicitHandleHeight + topPadding + bottomPadding,
+ second.implicitHandleHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/material/RectangularGlow.qml b/src/imports/controls/material/RectangularGlow.qml
index 35ca8b46..58e11b9f 100644
--- a/src/imports/controls/material/RectangularGlow.qml
+++ b/src/imports/controls/material/RectangularGlow.qml
@@ -34,7 +34,7 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
/*
A cross-graphics API implementation of QtGraphicalEffects' RectangularGlow.
diff --git a/src/imports/controls/material/RoundButton.qml b/src/imports/controls/material/RoundButton.qml
index 92e6bc84..fafc92c7 100644
--- a/src/imports/controls/material/RoundButton.qml
+++ b/src/imports/controls/material/RoundButton.qml
@@ -34,23 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.RoundButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
- // external vertical padding is 6 (to increase touch area)
+ topInset: 6
+ leftInset: 6
+ rightInset: 6
+ bottomInset: 6
padding: 12
spacing: 6
@@ -79,14 +81,9 @@ T.RoundButton {
// TODO: Add a proper ripple/ink effect for mouse/touch input and focus state
background: Rectangle {
- implicitWidth: 48
- implicitHeight: 48
+ implicitWidth: control.Material.buttonHeight
+ implicitHeight: control.Material.buttonHeight
- // external vertical padding is 6 (to increase touch area)
- x: 6
- y: 6
- width: parent.width - 12
- height: parent.height - 12
radius: control.radius
color: !control.enabled ? control.Material.buttonDisabledColor
: control.checked || control.highlighted ? control.Material.highlightedButtonColor : control.Material.buttonColor
diff --git a/src/imports/controls/material/ScrollBar.qml b/src/imports/controls/material/ScrollBar.qml
index 2ff925af..01a33f9e 100644
--- a/src/imports/controls/material/ScrollBar.qml
+++ b/src/imports/controls/material/ScrollBar.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.ScrollBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: control.interactive ? 1 : 2
visible: control.policy !== T.ScrollBar.AlwaysOff
diff --git a/src/imports/controls/material/ScrollIndicator.qml b/src/imports/controls/material/ScrollIndicator.qml
index 92727822..5578f29e 100644
--- a/src/imports/controls/material/ScrollIndicator.qml
+++ b/src/imports/controls/material/ScrollIndicator.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.ScrollIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 2
diff --git a/src/imports/controls/material/Slider.qml b/src/imports/controls/material/Slider.qml
index 1044354a..33b333fe 100644
--- a/src/imports/controls/material/Slider.qml
+++ b/src/imports/controls/material/Slider.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.Slider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHandleHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/material/SliderHandle.qml b/src/imports/controls/material/SliderHandle.qml
index 64879a46..2ebbcccd 100644
--- a/src/imports/controls/material/SliderHandle.qml
+++ b/src/imports/controls/material/SliderHandle.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
Item {
id: root
diff --git a/src/imports/controls/material/SpinBox.qml b/src/imports/controls/material/SpinBox.qml
index cf9196ac..d0a09a10 100644
--- a/src/imports/controls/material/SpinBox.qml
+++ b/src/imports/controls/material/SpinBox.qml
@@ -34,23 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.SpinBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth +
- (up.indicator ? up.indicator.implicitWidth : 0) +
- (down.indicator ? down.indicator.implicitWidth : 0))
- implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
- up.indicator ? up.indicator.implicitHeight : 0,
- down.indicator ? down.indicator.implicitHeight : 0)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ up.implicitIndicatorWidth +
+ down.implicitIndicatorWidth)
+ implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight,
+ up.implicitIndicatorHeight,
+ down.implicitIndicatorHeight)
spacing: 6
topPadding: 8
@@ -83,8 +82,8 @@ T.SpinBox {
up.indicator: Item {
x: control.mirrored ? 0 : parent.width - width
- implicitWidth: 48
- implicitHeight: 48
+ implicitWidth: control.Material.touchTarget
+ implicitHeight: control.Material.touchTarget
height: parent.height
width: height
@@ -117,8 +116,8 @@ T.SpinBox {
down.indicator: Item {
x: control.mirrored ? parent.width - width : 0
- implicitWidth: 48
- implicitHeight: 48
+ implicitWidth: control.Material.touchTarget
+ implicitHeight: control.Material.touchTarget
height: parent.height
width: height
@@ -144,7 +143,7 @@ T.SpinBox {
background: Item {
implicitWidth: 192
- implicitHeight: 48
+ implicitHeight: control.Material.touchTarget
Rectangle {
x: parent.width / 2 - width / 2
diff --git a/src/imports/controls/material/StackView.qml b/src/imports/controls/material/StackView.qml
index 8b69121b..6f76e2e3 100644
--- a/src/imports/controls/material/StackView.qml
+++ b/src/imports/controls/material/StackView.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.StackView {
id: control
diff --git a/src/imports/controls/material/SwipeDelegate.qml b/src/imports/controls/material/SwipeDelegate.qml
index 1095ac68..fe036486 100644
--- a/src/imports/controls/material/SwipeDelegate.qml
+++ b/src/imports/controls/material/SwipeDelegate.qml
@@ -34,26 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.SwipeDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: 8
spacing: 16
icon.width: 24
@@ -75,7 +73,7 @@ T.SwipeDelegate {
}
background: Rectangle {
- implicitHeight: 48
+ implicitHeight: control.Material.delegateHeight
color: control.Material.backgroundColor
diff --git a/src/imports/controls/material/SwipeView.qml b/src/imports/controls/material/SwipeView.qml
index eb753579..62d8b1a9 100644
--- a/src/imports/controls/material/SwipeView.qml
+++ b/src/imports/controls/material/SwipeView.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.SwipeView {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
contentItem: ListView {
model: control.contentModel
diff --git a/src/imports/controls/material/Switch.qml b/src/imports/controls/material/Switch.qml
index d44a9f2c..677a57e8 100644
--- a/src/imports/controls/material/Switch.qml
+++ b/src/imports/controls/material/Switch.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
-import QtQuick.Templates 2.4 as T
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
+import QtQuick.Templates 2.5 as T
T.Switch {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 8
spacing: 8
diff --git a/src/imports/controls/material/SwitchDelegate.qml b/src/imports/controls/material/SwitchDelegate.qml
index 308e9772..1f1e5ffa 100644
--- a/src/imports/controls/material/SwitchDelegate.qml
+++ b/src/imports/controls/material/SwitchDelegate.qml
@@ -34,26 +34,24 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.SwitchDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 16
- topPadding: 8
- bottomPadding: 8
+ verticalPadding: Material.switchDelegateVerticalPadding
spacing: 16
icon.width: 24
@@ -82,7 +80,7 @@ T.SwitchDelegate {
}
background: Rectangle {
- implicitHeight: 48
+ implicitHeight: control.Material.delegateHeight
color: control.highlighted ? control.Material.listHighlightColor : "transparent"
diff --git a/src/imports/controls/material/SwitchIndicator.qml b/src/imports/controls/material/SwitchIndicator.qml
index 2c5fc33d..f7567059 100644
--- a/src/imports/controls/material/SwitchIndicator.qml
+++ b/src/imports/controls/material/SwitchIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
Item {
id: indicator
diff --git a/src/imports/controls/material/TabBar.qml b/src/imports/controls/material/TabBar.qml
index c9410dfc..1e9444fb 100644
--- a/src/imports/controls/material/TabBar.qml
+++ b/src/imports/controls/material/TabBar.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.TabBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
spacing: 1
diff --git a/src/imports/controls/material/TabButton.qml b/src/imports/controls/material/TabButton.qml
index 3134cca9..c5cd8f9b 100644
--- a/src/imports/controls/material/TabButton.qml
+++ b/src/imports/controls/material/TabButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.TabButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 12
spacing: 6
@@ -69,7 +68,7 @@ T.TabButton {
}
background: Ripple {
- implicitHeight: 48
+ implicitHeight: control.Material.touchTarget
clip: true
pressed: control.pressed
diff --git a/src/imports/controls/material/TextArea.qml b/src/imports/controls/material/TextArea.qml
index 207d12c5..ce49af53 100644
--- a/src/imports/controls/material/TextArea.qml
+++ b/src/imports/controls/material/TextArea.qml
@@ -34,21 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(contentHeight + 1 + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + 1 + topPadding + bottomPadding)
topPadding: 8
@@ -57,7 +57,7 @@ T.TextArea {
color: enabled ? Material.foreground : Material.hintTextColor
selectionColor: Material.accentColor
selectedTextColor: Material.primaryHighlightedTextColor
-
+ placeholderTextColor: Material.hintTextColor
cursorDelegate: CursorDelegate { }
PlaceholderText {
@@ -68,7 +68,7 @@ T.TextArea {
height: control.height - (control.topPadding + control.bottomPadding)
text: control.placeholderText
font: control.font
- color: control.Material.hintTextColor
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
elide: Text.ElideRight
renderType: control.renderType
diff --git a/src/imports/controls/material/TextField.qml b/src/imports/controls/material/TextField.qml
index e8af67d4..7aa612eb 100644
--- a/src/imports/controls/material/TextField.qml
+++ b/src/imports/controls/material/TextField.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.TextField {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
- || contentWidth + leftPadding + rightPadding
- implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
topPadding: 8
@@ -57,6 +56,7 @@ T.TextField {
color: enabled ? Material.foreground : Material.hintTextColor
selectionColor: Material.accentColor
selectedTextColor: Material.primaryHighlightedTextColor
+ placeholderTextColor: Material.hintTextColor
verticalAlignment: TextInput.AlignVCenter
cursorDelegate: CursorDelegate { }
@@ -69,7 +69,7 @@ T.TextField {
height: control.height - (control.topPadding + control.bottomPadding)
text: control.placeholderText
font: control.font
- color: control.Material.hintTextColor
+ color: control.placeholderTextColor
verticalAlignment: control.verticalAlignment
elide: Text.ElideRight
renderType: control.renderType
diff --git a/src/imports/controls/material/ToolBar.qml b/src/imports/controls/material/ToolBar.qml
index 766856d0..9c09778b 100644
--- a/src/imports/controls/material/ToolBar.qml
+++ b/src/imports/controls/material/ToolBar.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.ToolBar {
id: control
Material.elevation: 4
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
Material.foreground: Material.toolTextColor
diff --git a/src/imports/controls/material/ToolButton.qml b/src/imports/controls/material/ToolButton.qml
index 86a9f5c0..55f1bd52 100644
--- a/src/imports/controls/material/ToolButton.qml
+++ b/src/imports/controls/material/ToolButton.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Material 2.4
-import QtQuick.Controls.Material.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Material 2.5
+import QtQuick.Controls.Material.impl 2.5
T.ToolButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 6
@@ -70,8 +69,8 @@ T.ToolButton {
}
background: Ripple {
- implicitWidth: 48
- implicitHeight: 48
+ implicitWidth: control.Material.touchTarget
+ implicitHeight: control.Material.touchTarget
readonly property bool square: control.contentItem.width <= control.contentItem.height
diff --git a/src/imports/controls/material/ToolSeparator.qml b/src/imports/controls/material/ToolSeparator.qml
index d6feeb85..8120ac54 100644
--- a/src/imports/controls/material/ToolSeparator.qml
+++ b/src/imports/controls/material/ToolSeparator.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.ToolSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
- leftPadding: vertical ? 12 : 5
- rightPadding: vertical ? 12 : 5
- topPadding: vertical ? 5 : 12
- bottomPadding: vertical ? 5 : 12
+ horizontalPadding: vertical ? 12 : 5
+ verticalPadding: vertical ? 5 : 12
contentItem: Rectangle {
implicitWidth: vertical ? 1 : 38
diff --git a/src/imports/controls/material/ToolTip.qml b/src/imports/controls/material/ToolTip.qml
index bb7a9d7c..ced62f47 100644
--- a/src/imports/controls/material/ToolTip.qml
+++ b/src/imports/controls/material/ToolTip.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.ToolTip {
id: control
@@ -44,15 +44,14 @@ T.ToolTip {
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: -implicitHeight - 24
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 12
padding: 8
- leftPadding: padding + 8
- rightPadding: padding + 8
+ horizontalPadding: padding + 8
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
@@ -76,7 +75,7 @@ T.ToolTip {
}
background: Rectangle {
- implicitHeight: 32
+ implicitHeight: control.Material.tooltipHeight
color: control.Material.tooltipColor
opacity: 0.9
radius: 2
diff --git a/src/imports/controls/material/Tumbler.qml b/src/imports/controls/material/Tumbler.qml
index d5c42422..c35b771a 100644
--- a/src/imports/controls/material/Tumbler.qml
+++ b/src/imports/controls/material/Tumbler.qml
@@ -34,16 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Material 2.4
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Material 2.5
T.Tumbler {
id: control
- implicitWidth: 60
- implicitHeight: 200
+
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6
delegate: Text {
text: modelData
@@ -55,6 +58,8 @@ T.Tumbler {
}
contentItem: TumblerView {
+ implicitWidth: 60
+ implicitHeight: 200
model: control.model
delegate: control.delegate
path: Path {
diff --git a/src/imports/controls/material/material.pro b/src/imports/controls/material/material.pro
index 9e04a23d..c3cbb355 100644
--- a/src/imports/controls/material/material.pro
+++ b/src/imports/controls/material/material.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2materialstyleplugin
TARGETPATH = QtQuick/Controls.2/Material
-IMPORT_VERSION = 2.4
+IMPORT_VERSION = 2.5
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
@@ -19,8 +19,7 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2materialstyleplugin.qrc
-!static: CONFIG += qmlcache
-CONFIG += no_cxx_module
+CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
load(qml_plugin)
requires(qtConfig(quickcontrols2-material))
diff --git a/src/imports/controls/material/qmldir b/src/imports/controls/material/qmldir
index d6ab0177..870a0382 100644
--- a/src/imports/controls/material/qmldir
+++ b/src/imports/controls/material/qmldir
@@ -1,4 +1,4 @@
module QtQuick.Controls.Material
plugin qtquickcontrols2materialstyleplugin
classname QtQuickControls2MaterialStylePlugin
-depends QtQuick.Controls 2.4
+depends QtQuick.Controls 2.5
diff --git a/src/imports/controls/material/qquickmaterialstyle.cpp b/src/imports/controls/material/qquickmaterialstyle.cpp
index 4dd4e128..77a65927 100644
--- a/src/imports/controls/material/qquickmaterialstyle.cpp
+++ b/src/imports/controls/material/qquickmaterialstyle.cpp
@@ -387,6 +387,10 @@ static bool globalPrimaryCustom = false;
static bool globalAccentCustom = false;
static bool globalForegroundCustom = true;
static bool globalBackgroundCustom = true;
+// This is global because:
+// 1) The theme needs access to it to determine font sizes.
+// 2) There can only be one variant used for the whole application.
+static QQuickMaterialStyle::Variant globalVariant = QQuickMaterialStyle::Normal;
static const QRgb backgroundColorLight = 0xFFFAFAFA;
static const QRgb backgroundColorDark = 0xFF303030;
@@ -439,7 +443,7 @@ QQuickMaterialStyle::QQuickMaterialStyle(QObject *parent) : QQuickAttachedObject
m_foreground(globalForeground),
m_background(globalBackground)
{
- init();
+ QQuickAttachedObject::init();
}
QQuickMaterialStyle *QQuickMaterialStyle::qmlAttachedProperties(QObject *object)
@@ -1129,17 +1133,61 @@ QColor QQuickMaterialStyle::shade(const QColor &color, Shade shade) const
}
}
-void QQuickMaterialStyle::attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent)
+int QQuickMaterialStyle::touchTarget() const
{
- Q_UNUSED(oldParent);
- QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(newParent);
- if (material) {
- inheritPrimary(material->m_primary, material->m_customPrimary);
- inheritAccent(material->m_accent, material->m_customAccent);
- inheritForeground(material->m_foreground, material->m_customForeground, material->m_hasForeground);
- inheritBackground(material->m_background, material->m_customBackground, material->m_hasBackground);
- inheritTheme(material->theme());
- }
+ // https://material.io/guidelines/components/buttons.html#buttons-style
+ return globalVariant == Dense ? 44 : 48;
+}
+
+int QQuickMaterialStyle::buttonHeight() const
+{
+ // https://material.io/guidelines/components/buttons.html#buttons-style
+ return globalVariant == Dense ? 32 : 36;
+}
+
+int QQuickMaterialStyle::delegateHeight() const
+{
+ // https://material.io/guidelines/components/lists.html#lists-specs
+ return globalVariant == Dense ? 40 : 48;
+}
+
+int QQuickMaterialStyle::dialogButtonBoxHeight() const
+{
+ return globalVariant == Dense ? 48 : 52;
+}
+
+int QQuickMaterialStyle::frameVerticalPadding() const
+{
+ return globalVariant == Dense ? 8 : 12;
+}
+
+int QQuickMaterialStyle::menuItemHeight() const
+{
+ // https://material.io/guidelines/components/menus.html#menus-simple-menus
+ return globalVariant == Dense ? 32 : 48;
+}
+
+int QQuickMaterialStyle::menuItemVerticalPadding() const
+{
+ return globalVariant == Dense ? 8 : 12;
+}
+
+int QQuickMaterialStyle::switchDelegateVerticalPadding() const
+{
+ // SwitchDelegate's indicator is much larger than the others due to the shadow,
+ // so we must reduce its padding to ensure its implicitHeight is 40 when dense.
+ return globalVariant == Dense ? 4 : 8;
+}
+
+int QQuickMaterialStyle::tooltipHeight() const
+{
+ // https://material.io/guidelines/components/tooltips.html
+ return globalVariant == Dense ? 22 : 32;
+}
+
+QQuickMaterialStyle::Variant QQuickMaterialStyle::variant()
+{
+ return globalVariant;
}
template <typename Enum>
@@ -1159,88 +1207,101 @@ static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer<QSe
return value;
}
-void QQuickMaterialStyle::init()
+void QQuickMaterialStyle::initGlobals()
{
- static bool globalsInitialized = false;
- if (!globalsInitialized) {
- QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(QStringLiteral("Material"));
+ QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(QStringLiteral("Material"));
- bool ok = false;
- QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme"));
- Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
- if (ok)
- globalTheme = m_theme = effectiveTheme(themeEnum);
- else if (!themeValue.isEmpty())
- qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue;
+ bool ok = false;
+ QByteArray themeValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_THEME", settings, QStringLiteral("Theme"));
+ Theme themeEnum = toEnumValue<Theme>(themeValue, &ok);
+ if (ok)
+ globalTheme = effectiveTheme(themeEnum);
+ else if (!themeValue.isEmpty())
+ qWarning().nospace().noquote() << "Material: unknown theme value: " << themeValue;
- QByteArray primaryValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_PRIMARY", settings, QStringLiteral("Primary"));
- Color primaryEnum = toEnumValue<Color>(primaryValue, &ok);
- if (ok) {
- globalPrimaryCustom = m_customPrimary = false;
- globalPrimary = m_primary = primaryEnum;
- } else {
- QColor color(primaryValue.constData());
- if (color.isValid()) {
- globalPrimaryCustom = m_customPrimary = true;
- globalPrimary = m_primary = color.rgba();
- } else if (!primaryValue.isEmpty()) {
- qWarning().nospace().noquote() << "Material: unknown primary value: " << primaryValue;
- }
- }
+ QByteArray variantValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_VARIANT", settings, QStringLiteral("Variant"));
+ Variant variantEnum = toEnumValue<Variant>(variantValue, &ok);
+ if (ok)
+ globalVariant = variantEnum;
+ else if (!variantValue.isEmpty())
+ qWarning().nospace().noquote() << "Material: unknown variant value: " << variantValue;
- QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_ACCENT", settings, QStringLiteral("Accent"));
- Color accentEnum = toEnumValue<Color>(accentValue, &ok);
- if (ok) {
- globalAccentCustom = m_customAccent = false;
- globalAccent = m_accent = accentEnum;
- } else if (!accentValue.isEmpty()) {
- QColor color(accentValue.constData());
- if (color.isValid()) {
- globalAccentCustom = m_customAccent = true;
- globalAccent = m_accent = color.rgba();
- } else {
- qWarning().nospace().noquote() << "Material: unknown accent value: " << accentValue;
- }
+ QByteArray primaryValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_PRIMARY", settings, QStringLiteral("Primary"));
+ Color primaryEnum = toEnumValue<Color>(primaryValue, &ok);
+ if (ok) {
+ globalPrimaryCustom = false;
+ globalPrimary = primaryEnum;
+ } else {
+ QColor color(primaryValue.constData());
+ if (color.isValid()) {
+ globalPrimaryCustom = true;
+ globalPrimary = color.rgba();
+ } else if (!primaryValue.isEmpty()) {
+ qWarning().nospace().noquote() << "Material: unknown primary value: " << primaryValue;
}
+ }
- QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_FOREGROUND", settings, QStringLiteral("Foreground"));
- Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok);
- if (ok) {
- globalForegroundCustom = m_customForeground = false;
- globalForeground = m_foreground = foregroundEnum;
- hasGlobalForeground = m_hasForeground = true;
- } else if (!foregroundValue.isEmpty()) {
- QColor color(foregroundValue.constData());
- if (color.isValid()) {
- globalForegroundCustom = m_customForeground = true;
- globalForeground = m_foreground = color.rgba();
- hasGlobalForeground = m_hasForeground = true;
- } else {
- qWarning().nospace().noquote() << "Material: unknown foreground value: " << foregroundValue;
- }
+ QByteArray accentValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_ACCENT", settings, QStringLiteral("Accent"));
+ Color accentEnum = toEnumValue<Color>(accentValue, &ok);
+ if (ok) {
+ globalAccentCustom = false;
+ globalAccent = accentEnum;
+ } else if (!accentValue.isEmpty()) {
+ QColor color(accentValue.constData());
+ if (color.isValid()) {
+ globalAccentCustom = true;
+ globalAccent = color.rgba();
+ } else {
+ qWarning().nospace().noquote() << "Material: unknown accent value: " << accentValue;
}
+ }
- QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_BACKGROUND", settings, QStringLiteral("Background"));
- Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok);
- if (ok) {
- globalBackgroundCustom = m_customBackground = false;
- globalBackground = m_background = backgroundEnum;
- hasGlobalBackground = m_hasBackground = true;
- } else if (!backgroundValue.isEmpty()) {
- QColor color(backgroundValue.constData());
- if (color.isValid()) {
- globalBackgroundCustom = m_customBackground = true;
- globalBackground = m_background = color.rgba();
- hasGlobalBackground = m_hasBackground = true;
- } else {
- qWarning().nospace().noquote() << "Material: unknown background value: " << backgroundValue;
- }
+ QByteArray foregroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_FOREGROUND", settings, QStringLiteral("Foreground"));
+ Color foregroundEnum = toEnumValue<Color>(foregroundValue, &ok);
+ if (ok) {
+ globalForegroundCustom = false;
+ globalForeground = foregroundEnum;
+ hasGlobalForeground = true;
+ } else if (!foregroundValue.isEmpty()) {
+ QColor color(foregroundValue.constData());
+ if (color.isValid()) {
+ globalForegroundCustom = true;
+ globalForeground = color.rgba();
+ hasGlobalForeground = true;
+ } else {
+ qWarning().nospace().noquote() << "Material: unknown foreground value: " << foregroundValue;
}
+ }
- globalsInitialized = true;
+ QByteArray backgroundValue = resolveSetting("QT_QUICK_CONTROLS_MATERIAL_BACKGROUND", settings, QStringLiteral("Background"));
+ Color backgroundEnum = toEnumValue<Color>(backgroundValue, &ok);
+ if (ok) {
+ globalBackgroundCustom = false;
+ globalBackground = backgroundEnum;
+ hasGlobalBackground = true;
+ } else if (!backgroundValue.isEmpty()) {
+ QColor color(backgroundValue.constData());
+ if (color.isValid()) {
+ globalBackgroundCustom = true;
+ globalBackground = color.rgba();
+ hasGlobalBackground = true;
+ } else {
+ qWarning().nospace().noquote() << "Material: unknown background value: " << backgroundValue;
+ }
}
+}
- QQuickAttachedObject::init(); // TODO: lazy init?
+void QQuickMaterialStyle::attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent)
+{
+ Q_UNUSED(oldParent);
+ QQuickMaterialStyle *material = qobject_cast<QQuickMaterialStyle *>(newParent);
+ if (material) {
+ inheritPrimary(material->m_primary, material->m_customPrimary);
+ inheritAccent(material->m_accent, material->m_customAccent);
+ inheritForeground(material->m_foreground, material->m_customForeground, material->m_hasForeground);
+ inheritBackground(material->m_background, material->m_customBackground, material->m_hasBackground);
+ inheritTheme(material->theme());
+ }
}
bool QQuickMaterialStyle::variantToRgba(const QVariant &var, const char *name, QRgb *rgba, bool *custom) const
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h
index 6008b1e0..4b0f7b31 100644
--- a/src/imports/controls/material/qquickmaterialstyle_p.h
+++ b/src/imports/controls/material/qquickmaterialstyle_p.h
@@ -98,6 +98,16 @@ class QQuickMaterialStyle : public QQuickAttachedObject
Q_PROPERTY(QColor toolTextColor READ toolTextColor NOTIFY paletteChanged FINAL)
Q_PROPERTY(QColor spinBoxDisabledIconColor READ spinBoxDisabledIconColor NOTIFY paletteChanged FINAL)
+ Q_PROPERTY(int touchTarget READ touchTarget CONSTANT FINAL)
+ Q_PROPERTY(int buttonHeight READ buttonHeight CONSTANT FINAL)
+ Q_PROPERTY(int delegateHeight READ delegateHeight CONSTANT FINAL)
+ Q_PROPERTY(int dialogButtonBoxHeight READ dialogButtonBoxHeight CONSTANT FINAL)
+ Q_PROPERTY(int frameVerticalPadding READ frameVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int menuItemHeight READ menuItemHeight CONSTANT FINAL)
+ Q_PROPERTY(int menuItemVerticalPadding READ menuItemVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int switchDelegateVerticalPadding READ switchDelegateVerticalPadding CONSTANT FINAL)
+ Q_PROPERTY(int tooltipHeight READ tooltipHeight CONSTANT FINAL)
+
public:
enum Theme {
Light,
@@ -105,6 +115,11 @@ public:
System
};
+ enum Variant {
+ Normal,
+ Dense
+ };
+
enum Color {
Red,
Pink,
@@ -145,6 +160,7 @@ public:
};
Q_ENUM(Theme)
+ Q_ENUM(Variant)
Q_ENUM(Color)
Q_ENUM(Shade)
@@ -225,6 +241,20 @@ public:
Q_INVOKABLE QColor color(Color color, Shade shade = Shade500) const;
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const;
+ int touchTarget() const;
+ int buttonHeight() const;
+ int delegateHeight() const;
+ int dialogButtonBoxHeight() const;
+ int frameVerticalPadding() const;
+ int menuItemHeight() const;
+ int menuItemVerticalPadding() const;
+ int switchDelegateVerticalPadding() const;
+ int tooltipHeight() const;
+
+ static void initGlobals();
+
+ static Variant variant();
+
Q_SIGNALS:
void themeChanged();
void primaryChanged();
diff --git a/src/imports/controls/material/qquickmaterialtheme.cpp b/src/imports/controls/material/qquickmaterialtheme.cpp
index c697b2a5..f42c0a03 100644
--- a/src/imports/controls/material/qquickmaterialtheme.cpp
+++ b/src/imports/controls/material/qquickmaterialtheme.cpp
@@ -35,16 +35,25 @@
****************************************************************************/
#include "qquickmaterialtheme_p.h"
+#include "qquickmaterialstyle_p.h"
#include <QtGui/qpa/qplatformdialoghelper.h>
#include <QtGui/qfont.h>
#include <QtGui/qfontinfo.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
-QQuickMaterialTheme::QQuickMaterialTheme()
- : QQuickTheme(QStringLiteral("Material"))
+void QQuickMaterialTheme::initialize(QQuickTheme *theme)
{
+ QFont systemFont;
+ QFont buttonFont;
+ QFont toolTipFont;
+ QFont itemViewFont;
+ QFont listViewFont;
+ QFont menuItemFont;
+ QFont editorFont;
+
QFont font;
font.setFamily(QLatin1String("Roboto"));
QString family = QFontInfo(font).family();
@@ -64,64 +73,40 @@ QQuickMaterialTheme::QQuickMaterialTheme()
editorFont.setFamily(family);
}
- systemFont.setPixelSize(14);
- systemFont = resolveFont(systemFont);
+ const bool dense = QQuickMaterialStyle::variant() == QQuickMaterialStyle::Dense;
+ systemFont.setPixelSize(dense ? 13 : 14);
+ theme->setFont(QQuickTheme::System, systemFont);
- buttonFont.setPixelSize(14);
+ // https://material.io/guidelines/components/buttons.html#buttons-style
+ buttonFont.setPixelSize(dense ? 13 : 14);
buttonFont.setCapitalization(QFont::AllUppercase);
buttonFont.setWeight(QFont::Medium);
- buttonFont = resolveFont(buttonFont);
+ theme->setFont(QQuickTheme::Button, buttonFont);
+ theme->setFont(QQuickTheme::TabBar, buttonFont);
+ theme->setFont(QQuickTheme::ToolBar, buttonFont);
- toolTipFont.setPixelSize(14);
+ // https://material.io/guidelines/components/tooltips.html
+ toolTipFont.setPixelSize(dense ? 10 : 14);
toolTipFont.setWeight(QFont::Medium);
- toolTipFont = resolveFont(toolTipFont);
+ theme->setFont(QQuickTheme::ToolTip, toolTipFont);
- itemViewFont.setPixelSize(14);
+ itemViewFont.setPixelSize(dense ? 13 : 14);
itemViewFont.setWeight(QFont::Medium);
- itemViewFont = resolveFont(itemViewFont);
-
- listViewFont.setPixelSize(16);
- listViewFont = resolveFont(listViewFont);
+ theme->setFont(QQuickTheme::ItemView, itemViewFont);
- menuItemFont.setPixelSize(16);
- menuItemFont = resolveFont(menuItemFont);
+ // https://material.io/guidelines/components/lists.html#lists-specs
+ listViewFont.setPixelSize(dense ? 13 : 16);
+ theme->setFont(QQuickTheme::ListView, listViewFont);
- editorFont.setPixelSize(16);
- editorFont = resolveFont(editorFont);
-}
+ menuItemFont.setPixelSize(dense ? 13 : 16);
+ theme->setFont(QQuickTheme::Menu, menuItemFont);
+ theme->setFont(QQuickTheme::MenuBar, menuItemFont);
+ theme->setFont(QQuickTheme::ComboBox, menuItemFont);
-const QFont *QQuickMaterialTheme::font(QPlatformTheme::Font type) const
-{
- switch (type) {
- case QPlatformTheme::TabButtonFont:
- case QPlatformTheme::PushButtonFont:
- case QPlatformTheme::ToolButtonFont:
- return &buttonFont;
- case QPlatformTheme::TipLabelFont:
- return &toolTipFont;
- case QPlatformTheme::ItemViewFont:
- return &itemViewFont;
- case QPlatformTheme::ListViewFont:
- return &listViewFont;
- case QPlatformTheme::MenuBarFont:
- case QPlatformTheme::MenuItemFont:
- case QPlatformTheme::ComboMenuItemFont:
- return &menuItemFont;
- case QPlatformTheme::EditorFont:
- return &editorFont;
- default:
- return &systemFont;
- }
-}
-
-QVariant QQuickMaterialTheme::themeHint(ThemeHint hint) const
-{
- switch (hint) {
- case QPlatformTheme::DialogButtonBoxLayout:
- return QVariant(QPlatformDialogHelper::AndroidLayout);
- default:
- return QQuickProxyTheme::themeHint(hint);
- }
+ editorFont.setPixelSize(dense ? 13 : 16);
+ theme->setFont(QQuickTheme::TextArea, editorFont);
+ theme->setFont(QQuickTheme::TextField, editorFont);
+ theme->setFont(QQuickTheme::SpinBox, editorFont);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qquickmaterialtheme_p.h b/src/imports/controls/material/qquickmaterialtheme_p.h
index 0e791386..9a1362b8 100644
--- a/src/imports/controls/material/qquickmaterialtheme_p.h
+++ b/src/imports/controls/material/qquickmaterialtheme_p.h
@@ -48,29 +48,16 @@
// We mean it.
//
-#include <QtCore/qvariant.h>
-#include <QtGui/qfont.h>
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QQuickMaterialTheme : public QQuickTheme
+class QQuickTheme;
+
+class QQuickMaterialTheme
{
public:
- explicit QQuickMaterialTheme();
-
- const QFont *font(Font type = SystemFont) const override;
-
- QVariant themeHint(ThemeHint hint) const override;
-
-private:
- QFont systemFont;
- QFont buttonFont;
- QFont toolTipFont;
- QFont itemViewFont;
- QFont listViewFont;
- QFont menuItemFont;
- QFont editorFont;
+ static void initialize(QQuickTheme *theme);
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
index 33c14d04..d407af94 100644
--- a/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
+++ b/src/imports/controls/material/qtquickcontrols2materialstyleplugin.cpp
@@ -45,14 +45,6 @@
#include <QtQuickControls2/private/qquickstyleselector_p.h>
#include <QtQuickControls2/private/qquickpaddedrectangle_p.h>
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtquickcontrols2materialstyleplugin);
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Controls_2_Material);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QtQuickControls2MaterialStylePlugin : public QQuickStylePlugin
@@ -66,12 +58,12 @@ public:
void registerTypes(const char *uri) override;
QString name() const override;
- QQuickProxyTheme *createTheme() const override;
+ void initializeTheme(QQuickTheme *theme) override;
};
QtQuickControls2MaterialStylePlugin::QtQuickControls2MaterialStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
{
- initResources();
+ QQuickMaterialStyle::initGlobals();
}
void QtQuickControls2MaterialStylePlugin::registerTypes(const char *uri)
@@ -85,24 +77,24 @@ void QtQuickControls2MaterialStylePlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickMaterialBusyIndicator>(import, 2, 0, "BusyIndicatorImpl");
qmlRegisterType<QQuickMaterialProgressBar>(import, 2, 0, "ProgressBarImpl");
qmlRegisterType<QQuickMaterialRipple>(import, 2, 0, "Ripple");
- qmlRegisterType(typeUrl(QStringLiteral("BoxShadow.qml")), import, 2, 0, "BoxShadow");
- qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
- qmlRegisterType(typeUrl(QStringLiteral("CursorDelegate.qml")), import, 2, 0, "CursorDelegate");
- qmlRegisterType(typeUrl(QStringLiteral("ElevationEffect.qml")), import, 2, 0, "ElevationEffect");
- qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
- qmlRegisterType(typeUrl(QStringLiteral("RectangularGlow.qml")), import, 2, 0, "RectangularGlow");
- qmlRegisterType(typeUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle");
- qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("BoxShadow.qml")), import, 2, 0, "BoxShadow");
+ qmlRegisterType(resolvedUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("CursorDelegate.qml")), import, 2, 0, "CursorDelegate");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ElevationEffect.qml")), import, 2, 0, "ElevationEffect");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RectangularGlow.qml")), import, 2, 0, "RectangularGlow");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SliderHandle.qml")), import, 2, 0, "SliderHandle");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
}
QString QtQuickControls2MaterialStylePlugin::name() const
{
- return QStringLiteral("material");
+ return QStringLiteral("Material");
}
-QQuickProxyTheme *QtQuickControls2MaterialStylePlugin::createTheme() const
+void QtQuickControls2MaterialStylePlugin::initializeTheme(QQuickTheme *theme)
{
- return new QQuickMaterialTheme;
+ QQuickMaterialTheme::initialize(theme);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/plugins.qmltypes b/src/imports/controls/plugins.qmltypes
index 5011365c..949eea62 100644
--- a/src/imports/controls/plugins.qmltypes
+++ b/src/imports/controls/plugins.qmltypes
@@ -4,12 +4,12 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.4 -merge ../templates/plugins.qmltypes -dependencies dependencies.json'
+// 'qmlplugindump -nonrelocatable QtQuick.Controls 2.5 -merge ../templates/plugins.qmltypes -dependencies dependencies.json'
Module {
dependencies: [
"QtQuick 2.11",
- "QtQuick.Templates 2.4",
+ "QtQuick.Templates 2.5",
"QtQuick.Window 2.2"
]
Component {
@@ -658,9 +658,10 @@ Module {
"QtQuick.Templates/AbstractButton 2.0",
"QtQuick.Templates/AbstractButton 2.2",
"QtQuick.Templates/AbstractButton 2.3",
- "QtQuick.Templates/AbstractButton 2.4"
+ "QtQuick.Templates/AbstractButton 2.4",
+ "QtQuick.Templates/AbstractButton 2.5"
]
- exportMetaObjectRevisions: [0, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 2, 3, 4, 5]
Enum {
name: "Display"
values: {
@@ -685,6 +686,8 @@ Module {
Property { name: "autoRepeatInterval"; revision: 4; type: "int" }
Property { name: "pressX"; revision: 4; type: "double"; isReadonly: true }
Property { name: "pressY"; revision: 4; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "pressed" }
Signal { name: "released" }
Signal { name: "canceled" }
@@ -699,6 +702,8 @@ Module {
Signal { name: "autoRepeatIntervalChanged"; revision: 4 }
Signal { name: "pressXChanged"; revision: 4 }
Signal { name: "pressYChanged"; revision: 4 }
+ Signal { name: "implicitIndicatorWidthChanged"; revision: 5 }
+ Signal { name: "implicitIndicatorHeightChanged"; revision: 5 }
Method { name: "toggle" }
}
Component {
@@ -909,9 +914,10 @@ Module {
exports: [
"QtQuick.Templates/ComboBox 2.0",
"QtQuick.Templates/ComboBox 2.1",
- "QtQuick.Templates/ComboBox 2.2"
+ "QtQuick.Templates/ComboBox 2.2",
+ "QtQuick.Templates/ComboBox 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2]
+ exportMetaObjectRevisions: [0, 1, 2, 5]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
@@ -932,6 +938,8 @@ Module {
Property { name: "inputMethodHints"; revision: 2; type: "Qt::InputMethodHints" }
Property { name: "inputMethodComposing"; revision: 2; type: "bool"; isReadonly: true }
Property { name: "acceptableInput"; revision: 2; type: "bool"; isReadonly: true }
+ Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true }
Signal {
name: "activated"
Parameter { name: "index"; type: "int" }
@@ -949,6 +957,8 @@ Module {
Signal { name: "inputMethodHintsChanged"; revision: 2 }
Signal { name: "inputMethodComposingChanged"; revision: 2 }
Signal { name: "acceptableInputChanged"; revision: 2 }
+ Signal { name: "implicitIndicatorWidthChanged"; revision: 5 }
+ Signal { name: "implicitIndicatorHeightChanged"; revision: 5 }
Method { name: "incrementCurrentIndex" }
Method { name: "decrementCurrentIndex" }
Method { name: "selectAll"; revision: 2 }
@@ -976,15 +986,20 @@ Module {
exports: [
"QtQuick.Templates/Container 2.0",
"QtQuick.Templates/Container 2.1",
- "QtQuick.Templates/Container 2.3"
+ "QtQuick.Templates/Container 2.3",
+ "QtQuick.Templates/Container 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
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 }
+ Property { name: "contentWidth"; revision: 5; type: "double" }
+ Property { name: "contentHeight"; revision: 5; type: "double" }
+ Signal { name: "contentWidthChanged"; revision: 5 }
+ Signal { name: "contentHeightChanged"; revision: 5 }
Method {
name: "setCurrentIndex"
Parameter { name: "index"; type: "int" }
@@ -1021,15 +1036,17 @@ Module {
Parameter { name: "index"; type: "int" }
}
}
+ Component { name: "QQuickContentItem"; defaultProperty: "data"; prototype: "QQuickItem" }
Component {
name: "QQuickControl"
defaultProperty: "data"
prototype: "QQuickItem"
exports: [
"QtQuick.Templates/Control 2.0",
- "QtQuick.Templates/Control 2.3"
+ "QtQuick.Templates/Control 2.3",
+ "QtQuick.Templates/Control 2.5"
]
- exportMetaObjectRevisions: [0, 3]
+ exportMetaObjectRevisions: [0, 3, 5]
Property { name: "font"; type: "QFont" }
Property { name: "availableWidth"; type: "double"; isReadonly: true }
Property { name: "availableHeight"; type: "double"; isReadonly: true }
@@ -1049,8 +1066,29 @@ Module {
Property { name: "wheelEnabled"; type: "bool" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "baselineOffset"; type: "double" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "horizontalPadding"; revision: 5; type: "double" }
+ Property { name: "verticalPadding"; revision: 5; type: "double" }
+ Property { name: "implicitContentWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitContentHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "topInset"; revision: 5; type: "double" }
+ Property { name: "leftInset"; revision: 5; type: "double" }
+ Property { name: "rightInset"; revision: 5; type: "double" }
+ Property { name: "bottomInset"; revision: 5; type: "double" }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "horizontalPaddingChanged"; revision: 5 }
+ Signal { name: "verticalPaddingChanged"; revision: 5 }
+ Signal { name: "implicitContentWidthChanged"; revision: 5 }
+ Signal { name: "implicitContentHeightChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundWidthChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundHeightChanged"; revision: 5 }
+ Signal { name: "topInsetChanged"; revision: 5 }
+ Signal { name: "leftInsetChanged"; revision: 5 }
+ Signal { name: "rightInsetChanged"; revision: 5 }
+ Signal { name: "bottomInsetChanged"; revision: 5 }
}
Component {
name: "QQuickDelayButton"
@@ -1099,9 +1137,10 @@ Module {
prototype: "QQuickPopup"
exports: [
"QtQuick.Templates/Dialog 2.1",
- "QtQuick.Templates/Dialog 2.3"
+ "QtQuick.Templates/Dialog 2.3",
+ "QtQuick.Templates/Dialog 2.5"
]
- exportMetaObjectRevisions: [0, 3]
+ exportMetaObjectRevisions: [0, 3, 5]
Enum {
name: "StandardCode"
values: {
@@ -1114,6 +1153,10 @@ Module {
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
Property { name: "result"; revision: 3; type: "int" }
+ Property { name: "implicitHeaderWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHeaderHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "accepted" }
Signal { name: "rejected" }
Signal { name: "applied"; revision: 3 }
@@ -1140,9 +1183,10 @@ Module {
prototype: "QQuickContainer"
exports: [
"QtQuick.Templates/DialogButtonBox 2.1",
- "QtQuick.Templates/DialogButtonBox 2.3"
+ "QtQuick.Templates/DialogButtonBox 2.3",
+ "QtQuick.Templates/DialogButtonBox 2.5"
]
- exportMetaObjectRevisions: [0, 3]
+ exportMetaObjectRevisions: [0, 3, 5]
attachedType: "QQuickDialogButtonBoxAttached"
Enum {
name: "Position"
@@ -1151,10 +1195,23 @@ Module {
"Footer": 1
}
}
+ Enum {
+ name: "ButtonLayout"
+ values: {
+ "UnknownLayout": -1,
+ "WinLayout": 0,
+ "MacLayout": 1,
+ "KdeLayout": 2,
+ "GnomeLayout": 3,
+ "MacModelessLayout": 4,
+ "AndroidLayout": 5
+ }
+ }
Property { name: "position"; type: "Position" }
Property { name: "alignment"; type: "Qt::Alignment" }
Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "buttonLayout"; revision: 5; type: "ButtonLayout" }
Signal { name: "accepted" }
Signal { name: "rejected" }
Signal { name: "helpRequested" }
@@ -1165,6 +1222,7 @@ Module {
Signal { name: "applied"; revision: 3 }
Signal { name: "reset"; revision: 3 }
Signal { name: "discarded"; revision: 3 }
+ Signal { name: "buttonLayoutChanged"; revision: 5 }
Method {
name: "standardButton"
type: "QQuickAbstractButton*"
@@ -1203,12 +1261,18 @@ Module {
name: "QQuickGroupBox"
defaultProperty: "contentData"
prototype: "QQuickFrame"
- exports: ["QtQuick.Templates/GroupBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/GroupBox 2.0",
+ "QtQuick.Templates/GroupBox 2.5"
+ ]
+ exportMetaObjectRevisions: [0, 5]
Property { name: "title"; type: "string" }
Property { name: "label"; type: "QQuickItem"; isPointer: true }
+ Property { name: "implicitLabelWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitLabelHeight"; revision: 5; type: "double"; isReadonly: true }
+ Signal { name: "implicitLabelWidthChanged"; revision: 5 }
+ Signal { name: "implicitLabelHeightChanged"; revision: 5 }
}
-
Component {
name: "QQuickIcon"
Property { name: "name"; type: "string" }
@@ -1217,7 +1281,6 @@ Module {
Property { name: "height"; type: "int" }
Property { name: "color"; type: "QColor" }
}
-
Component {
name: "QQuickItemDelegate"
defaultProperty: "data"
@@ -1455,18 +1518,22 @@ Module {
Component {
name: "QQuickPage"
defaultProperty: "contentData"
- prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Page 2.0", "QtQuick.Templates/Page 2.1"]
- exportMetaObjectRevisions: [0, 1]
+ prototype: "QQuickPane"
+ exports: [
+ "QtQuick.Templates/Page 2.0",
+ "QtQuick.Templates/Page 2.1",
+ "QtQuick.Templates/Page 2.5"
+ ]
+ exportMetaObjectRevisions: [0, 1, 5]
Property { name: "title"; type: "string" }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
- Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
Property { name: "contentWidth"; revision: 1; type: "double" }
Property { name: "contentHeight"; revision: 1; type: "double" }
- Signal { name: "contentWidthChanged"; revision: 1 }
- Signal { name: "contentHeightChanged"; revision: 1 }
+ Property { name: "implicitHeaderWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHeaderHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterHeight"; revision: 5; type: "double"; isReadonly: true }
}
Component {
name: "QQuickPageIndicator"
@@ -1497,9 +1564,10 @@ Module {
exports: [
"QtQuick.Templates/Popup 2.0",
"QtQuick.Templates/Popup 2.1",
- "QtQuick.Templates/Popup 2.3"
+ "QtQuick.Templates/Popup 2.3",
+ "QtQuick.Templates/Popup 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
Enum {
name: "ClosePolicy"
values: {
@@ -1570,6 +1638,23 @@ Module {
Property { name: "mirrored"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "enabled"; revision: 3; type: "bool" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "horizontalPadding"; type: "double" }
+ Property { name: "verticalPadding"; type: "double" }
+ Property {
+ name: "anchors"
+ revision: 5
+ type: "QQuickPopupAnchors"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "implicitContentWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitContentHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "topInset"; revision: 5; type: "double" }
+ Property { name: "leftInset"; revision: 5; type: "double" }
+ Property { name: "rightInset"; revision: 5; type: "double" }
+ Property { name: "bottomInset"; revision: 5; type: "double" }
Signal { name: "opened" }
Signal { name: "closed" }
Signal { name: "aboutToShow" }
@@ -1583,6 +1668,16 @@ Module {
Signal { name: "mirroredChanged"; revision: 3 }
Signal { name: "enabledChanged"; revision: 3 }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "horizontalPaddingChanged"; revision: 5 }
+ Signal { name: "verticalPaddingChanged"; revision: 5 }
+ Signal { name: "implicitContentWidthChanged"; revision: 5 }
+ Signal { name: "implicitContentHeightChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundWidthChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundHeightChanged"; revision: 5 }
+ Signal { name: "topInsetChanged"; revision: 5 }
+ Signal { name: "leftInsetChanged"; revision: 5 }
+ Signal { name: "rightInsetChanged"; revision: 5 }
+ Signal { name: "bottomInsetChanged"; revision: 5 }
Method { name: "open" }
Method { name: "close" }
Method {
@@ -1592,6 +1687,12 @@ Module {
Method { name: "forceActiveFocus" }
}
Component {
+ name: "QQuickPopupAnchors"
+ prototype: "QObject"
+ Property { name: "centerIn"; type: "QQuickItem"; isPointer: true }
+ }
+ Component { name: "QQuickPopupItem"; defaultProperty: "contentData"; prototype: "QQuickPage" }
+ Component {
name: "QQuickProgressBar"
defaultProperty: "data"
prototype: "QQuickControl"
@@ -1626,9 +1727,10 @@ Module {
"QtQuick.Templates/RangeSlider 2.0",
"QtQuick.Templates/RangeSlider 2.1",
"QtQuick.Templates/RangeSlider 2.2",
- "QtQuick.Templates/RangeSlider 2.3"
+ "QtQuick.Templates/RangeSlider 2.3",
+ "QtQuick.Templates/RangeSlider 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2, 3]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 5]
Enum {
name: "SnapMode"
values: {
@@ -1647,12 +1749,20 @@ Module {
Property { name: "live"; revision: 2; type: "bool" }
Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true }
+ Property { name: "touchDragThreshold"; revision: 5; type: "double" }
Signal { name: "liveChanged"; revision: 2 }
+ Signal { name: "touchDragThresholdChanged"; revision: 5 }
Method {
name: "setValues"
Parameter { name: "firstValue"; type: "double" }
Parameter { name: "secondValue"; type: "double" }
}
+ Method {
+ name: "valueAt"
+ revision: 5
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
}
Component {
name: "QQuickRangeSliderNode"
@@ -1663,7 +1773,10 @@ Module {
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Property { name: "pressed"; type: "bool" }
Property { name: "hovered"; revision: 1; type: "bool" }
+ Property { name: "implicitHandleWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHandleHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "moved" }
Method { name: "increase" }
Method { name: "decrease" }
}
@@ -1781,13 +1894,9 @@ Module {
Component {
name: "QQuickScrollView"
defaultProperty: "contentData"
- prototype: "QQuickControl"
+ prototype: "QQuickPane"
exports: ["QtQuick.Templates/ScrollView 2.2"]
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: "QQuickSlider"
@@ -1797,9 +1906,10 @@ Module {
"QtQuick.Templates/Slider 2.0",
"QtQuick.Templates/Slider 2.1",
"QtQuick.Templates/Slider 2.2",
- "QtQuick.Templates/Slider 2.3"
+ "QtQuick.Templates/Slider 2.3",
+ "QtQuick.Templates/Slider 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2, 3]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 5]
Enum {
name: "SnapMode"
values: {
@@ -1821,8 +1931,14 @@ Module {
Property { name: "live"; revision: 2; type: "bool" }
Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true }
+ Property { name: "touchDragThreshold"; revision: 5; type: "double" }
+ Property { name: "implicitHandleWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHandleHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "moved"; revision: 2 }
Signal { name: "liveChanged"; revision: 2 }
+ Signal { name: "touchDragThresholdChanged"; revision: 5 }
+ Signal { name: "implicitHandleWidthChanged"; revision: 5 }
+ Signal { name: "implicitHandleHeightChanged"; revision: 5 }
Method { name: "increase" }
Method { name: "decrease" }
Method {
@@ -1841,9 +1957,10 @@ Module {
"QtQuick.Templates/SpinBox 2.1",
"QtQuick.Templates/SpinBox 2.2",
"QtQuick.Templates/SpinBox 2.3",
- "QtQuick.Templates/SpinBox 2.4"
+ "QtQuick.Templates/SpinBox 2.4",
+ "QtQuick.Templates/SpinBox 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
Property { name: "from"; type: "int" }
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
@@ -1872,7 +1989,11 @@ Module {
Property { name: "pressed"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "hovered"; revision: 1; type: "bool" }
+ Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "implicitIndicatorWidthChanged"; revision: 5 }
+ Signal { name: "implicitIndicatorHeightChanged"; revision: 5 }
}
Component {
name: "QQuickStackView"
@@ -2089,8 +2210,6 @@ Module {
Property { name: "position"; type: "Position" }
Property { name: "contentWidth"; revision: 2; type: "double" }
Property { name: "contentHeight"; revision: 2; type: "double" }
- Signal { name: "contentWidthChanged"; revision: 2 }
- Signal { name: "contentHeightChanged"; revision: 2 }
}
Component {
name: "QQuickTabBarAttached"
@@ -2113,9 +2232,10 @@ Module {
exports: [
"QtQuick.Templates/TextArea 2.0",
"QtQuick.Templates/TextArea 2.1",
- "QtQuick.Templates/TextArea 2.3"
+ "QtQuick.Templates/TextArea 2.3",
+ "QtQuick.Templates/TextArea 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
attachedType: "QQuickTextAreaAttached"
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
@@ -2126,6 +2246,7 @@ Module {
Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "placeholderTextColor"; revision: 5; type: "QColor" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
Signal {
@@ -2145,6 +2266,7 @@ Module {
Signal { name: "hoveredChanged"; revision: 1 }
Signal { name: "hoverEnabledChanged"; revision: 1 }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "placeholderTextColorChanged"; revision: 5 }
}
Component {
name: "QQuickTextAreaAttached"
@@ -2158,9 +2280,10 @@ Module {
exports: [
"QtQuick.Templates/TextField 2.0",
"QtQuick.Templates/TextField 2.1",
- "QtQuick.Templates/TextField 2.3"
+ "QtQuick.Templates/TextField 2.3",
+ "QtQuick.Templates/TextField 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
Property { name: "implicitHeight"; type: "double" }
@@ -2170,6 +2293,7 @@ Module {
Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "placeholderTextColor"; revision: 5; type: "QColor" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
Signal {
@@ -2189,6 +2313,7 @@ Module {
Signal { name: "hoveredChanged"; revision: 1 }
Signal { name: "hoverEnabledChanged"; revision: 1 }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "placeholderTextColorChanged"; revision: 5 }
}
Component {
name: "QQuickToolBar"
@@ -2226,12 +2351,27 @@ Module {
name: "QQuickToolTip"
defaultProperty: "contentData"
prototype: "QQuickPopup"
- exports: ["QtQuick.Templates/ToolTip 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/ToolTip 2.0",
+ "QtQuick.Templates/ToolTip 2.5"
+ ]
+ exportMetaObjectRevisions: [0, 5]
attachedType: "QQuickToolTipAttached"
Property { name: "delay"; type: "int" }
Property { name: "timeout"; type: "int" }
Property { name: "text"; type: "string" }
+ Method {
+ name: "show"
+ revision: 5
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "ms"; type: "int" }
+ }
+ Method {
+ name: "show"
+ revision: 5
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hide"; revision: 5 }
}
Component {
name: "QQuickToolTipAttached"
@@ -2263,6 +2403,17 @@ Module {
]
exportMetaObjectRevisions: [0, 1, 2]
attachedType: "QQuickTumblerAttached"
+ Enum {
+ name: "PositionMode"
+ values: {
+ "Beginning": 0,
+ "Center": 1,
+ "End": 2,
+ "Visible": 3,
+ "Contain": 4,
+ "SnapPosition": 5
+ }
+ }
Property { name: "model"; type: "QVariant" }
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "currentIndex"; type: "int" }
@@ -2273,6 +2424,12 @@ Module {
Property { name: "moving"; revision: 2; type: "bool"; isReadonly: true }
Signal { name: "wrapChanged"; revision: 1 }
Signal { name: "movingChanged"; revision: 2 }
+ Method {
+ name: "positionViewAtIndex"
+ revision: 5
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "mode"; type: "PositionMode" }
+ }
}
Component {
name: "QQuickTumblerAttached"
diff --git a/src/imports/controls/qmldir b/src/imports/controls/qmldir
index de40013f..c9ccb8f9 100644
--- a/src/imports/controls/qmldir
+++ b/src/imports/controls/qmldir
@@ -1,5 +1,5 @@
module QtQuick.Controls
plugin qtquickcontrols2plugin
classname QtQuickControls2Plugin
-depends QtQuick.Templates 2.4
+depends QtQuick.Templates 2.5
designersupported
diff --git a/src/imports/controls/qquickdefaulttheme.cpp b/src/imports/controls/qquickdefaulttheme.cpp
index f4b6f5d7..bc292c2f 100644
--- a/src/imports/controls/qquickdefaulttheme.cpp
+++ b/src/imports/controls/qquickdefaulttheme.cpp
@@ -36,11 +36,14 @@
#include "qquickdefaulttheme_p.h"
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
+
QT_BEGIN_NAMESPACE
-QQuickDefaultTheme::QQuickDefaultTheme()
- : QQuickTheme(QStringLiteral("Default"))
+void QQuickDefaultTheme::initialize(QQuickTheme *theme)
{
+ QPalette systemPalette;
+
systemPalette.setColor(QPalette::Base, QColor::fromRgba(0xFFFFFFFF));
systemPalette.setColor(QPalette::Disabled, QPalette::Base, QColor::fromRgba(0xFFD6D6D6));
@@ -80,13 +83,7 @@ QQuickDefaultTheme::QQuickDefaultTheme()
systemPalette.setColor(QPalette::WindowText, QColor::fromRgba(0xFF26282A));
systemPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor::fromRgba(0xFFBDBEBF));
- systemPalette = resolvePalette(systemPalette);
-}
-
-const QPalette *QQuickDefaultTheme::palette(QPlatformTheme::Palette type) const
-{
- Q_UNUSED(type);
- return &systemPalette;
+ theme->setPalette(QQuickTheme::System, systemPalette);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/qquickdefaulttheme_p.h b/src/imports/controls/qquickdefaulttheme_p.h
index 16e4d061..3a7311c7 100644
--- a/src/imports/controls/qquickdefaulttheme_p.h
+++ b/src/imports/controls/qquickdefaulttheme_p.h
@@ -48,19 +48,16 @@
// We mean it.
//
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QQuickDefaultTheme : public QQuickTheme
+class QQuickTheme;
+
+class QQuickDefaultTheme
{
public:
- explicit QQuickDefaultTheme();
-
- const QPalette *palette(Palette type) const override;
-
-private:
- QPalette systemPalette;
+ static void initialize(QQuickTheme *theme);
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp
index 76086376..754e76ab 100644
--- a/src/imports/controls/qtquickcontrols2plugin.cpp
+++ b/src/imports/controls/qtquickcontrols2plugin.cpp
@@ -34,7 +34,13 @@
**
****************************************************************************/
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qpluginloader.h>
#include <QtCore/private/qfileselector_p.h>
+#include <QtQml/qqmlfile.h>
+#include <QtQml/private/qqmldirparser_p.h>
#include <QtQuickControls2/qquickstyle.h>
#include <QtQuickControls2/private/qquickchecklabel_p.h>
#include <QtQuickControls2/private/qquickcolor_p.h>
@@ -46,13 +52,13 @@
#include <QtQuickControls2/private/qquickiconlabel_p.h>
#include <QtQuickControls2/private/qquickstyle_p.h>
#include <QtQuickControls2/private/qquickstyleplugin_p.h>
-#include <QtQuickControls2/private/qquickstyleselector_p.h>
#if QT_CONFIG(quick_listview) && QT_CONFIG(quick_pathview)
#include <QtQuickControls2/private/qquicktumblerview_p.h>
#endif
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
#include <QtQuickControls2/private/qquickclippedtext_p.h>
#include <QtQuickControls2/private/qquickitemgroup_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p_p.h>
#include "qquickdefaultbusyindicator_p.h"
#include "qquickdefaultdial_p.h"
@@ -60,14 +66,6 @@
#include "qquickdefaultstyle_p.h"
#include "qquickdefaulttheme_p.h"
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtquickcontrols2plugin);
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Controls_2);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QtQuickControls2Plugin: public QQuickStylePlugin
@@ -82,12 +80,15 @@ public:
void registerTypes(const char *uri) override;
QString name() const override;
- QQuickProxyTheme *createTheme() const override;
+ void initializeTheme(QQuickTheme *theme) override;
+
+private:
+ QList<QQuickStylePlugin *> loadStylePlugins();
+ QQuickTheme *createTheme(const QString &name);
};
QtQuickControls2Plugin::QtQuickControls2Plugin(QObject *parent) : QQuickStylePlugin(parent)
{
- initResources();
}
QtQuickControls2Plugin::~QtQuickControls2Plugin()
@@ -95,81 +96,94 @@ QtQuickControls2Plugin::~QtQuickControls2Plugin()
QQuickStylePrivate::reset();
}
+static bool isDefaultStyle(const QString &style)
+{
+ return style.isEmpty() || style.compare(QStringLiteral("Default"), Qt::CaseInsensitive) == 0;
+}
+
void QtQuickControls2Plugin::registerTypes(const char *uri)
{
- QQuickStylePrivate::init(typeUrl());
+ QQuickStylePrivate::init(baseUrl());
+
const QString style = QQuickStyle::name();
if (!style.isEmpty())
QFileSelectorPrivate::addStatics(QStringList() << style.toLower());
- QQuickStyleSelector selector;
- selector.setBaseUrl(typeUrl());
+ QQuickTheme *theme = createTheme(style.isEmpty() ? name() : style);
+ if (isDefaultStyle(style))
+ initializeTheme(theme);
+
+ // load the style's plugins to get access to its resources and initialize the theme
+ QList<QQuickStylePlugin *> stylePlugins = loadStylePlugins();
+ for (QQuickStylePlugin *stylePlugin : stylePlugins)
+ stylePlugin->initializeTheme(theme);
+ qDeleteAll(stylePlugins);
qmlRegisterModule(uri, 2, QT_VERSION_MINOR - 7); // Qt 5.7->2.0, 5.8->2.1, 5.9->2.2...
// QtQuick.Controls 2.0 (originally introduced in Qt 5.7)
- qmlRegisterType(selector.select(QStringLiteral("AbstractButton.qml")), uri, 2, 0, "AbstractButton");
- qmlRegisterType(selector.select(QStringLiteral("ApplicationWindow.qml")), uri, 2, 0, "ApplicationWindow");
- qmlRegisterType(selector.select(QStringLiteral("BusyIndicator.qml")), uri, 2, 0, "BusyIndicator");
- qmlRegisterType(selector.select(QStringLiteral("Button.qml")), uri, 2, 0, "Button");
- qmlRegisterType(selector.select(QStringLiteral("ButtonGroup.qml")), uri, 2, 0, "ButtonGroup");
- qmlRegisterType(selector.select(QStringLiteral("CheckBox.qml")), uri, 2, 0, "CheckBox");
- qmlRegisterType(selector.select(QStringLiteral("CheckDelegate.qml")), uri, 2, 0, "CheckDelegate");
- qmlRegisterType(selector.select(QStringLiteral("ComboBox.qml")), uri, 2, 0, "ComboBox");
- qmlRegisterType(selector.select(QStringLiteral("Container.qml")), uri, 2, 0, "Container");
- qmlRegisterType(selector.select(QStringLiteral("Control.qml")), uri, 2, 0, "Control");
- qmlRegisterType(selector.select(QStringLiteral("Dial.qml")), uri, 2, 0, "Dial");
- qmlRegisterType(selector.select(QStringLiteral("Drawer.qml")), uri, 2, 0, "Drawer");
- qmlRegisterType(selector.select(QStringLiteral("Frame.qml")), uri, 2, 0, "Frame");
- qmlRegisterType(selector.select(QStringLiteral("GroupBox.qml")), uri, 2, 0, "GroupBox");
- qmlRegisterType(selector.select(QStringLiteral("ItemDelegate.qml")), uri, 2, 0, "ItemDelegate");
- qmlRegisterType(selector.select(QStringLiteral("Label.qml")), uri, 2, 0, "Label");
- qmlRegisterType(selector.select(QStringLiteral("Menu.qml")), uri, 2, 0, "Menu");
- qmlRegisterType(selector.select(QStringLiteral("MenuItem.qml")), uri, 2, 0, "MenuItem");
- qmlRegisterType(selector.select(QStringLiteral("Page.qml")), uri, 2, 0, "Page");
- qmlRegisterType(selector.select(QStringLiteral("PageIndicator.qml")), uri, 2, 0, "PageIndicator");
- qmlRegisterType(selector.select(QStringLiteral("Pane.qml")), uri, 2, 0, "Pane");
- qmlRegisterType(selector.select(QStringLiteral("Popup.qml")), uri, 2, 0, "Popup");
- qmlRegisterType(selector.select(QStringLiteral("ProgressBar.qml")), uri, 2, 0, "ProgressBar");
- qmlRegisterType(selector.select(QStringLiteral("RadioButton.qml")), uri, 2, 0, "RadioButton");
- qmlRegisterType(selector.select(QStringLiteral("RadioDelegate.qml")), uri, 2, 0, "RadioDelegate");
- qmlRegisterType(selector.select(QStringLiteral("RangeSlider.qml")), uri, 2, 0, "RangeSlider");
- qmlRegisterType(selector.select(QStringLiteral("ScrollBar.qml")), uri, 2, 0, "ScrollBar");
- qmlRegisterType(selector.select(QStringLiteral("ScrollIndicator.qml")), uri, 2, 0, "ScrollIndicator");
- qmlRegisterType(selector.select(QStringLiteral("Slider.qml")), uri, 2, 0, "Slider");
- qmlRegisterType(selector.select(QStringLiteral("SpinBox.qml")), uri, 2, 0, "SpinBox");
- qmlRegisterType(selector.select(QStringLiteral("StackView.qml")), uri, 2, 0, "StackView");
- qmlRegisterType(selector.select(QStringLiteral("SwipeDelegate.qml")), uri, 2, 0, "SwipeDelegate");
- qmlRegisterType(selector.select(QStringLiteral("SwipeView.qml")), uri, 2, 0, "SwipeView");
- qmlRegisterType(selector.select(QStringLiteral("Switch.qml")), uri, 2, 0, "Switch");
- qmlRegisterType(selector.select(QStringLiteral("SwitchDelegate.qml")), uri, 2, 0, "SwitchDelegate");
- qmlRegisterType(selector.select(QStringLiteral("TabBar.qml")), uri, 2, 0, "TabBar");
- qmlRegisterType(selector.select(QStringLiteral("TabButton.qml")), uri, 2, 0, "TabButton");
- qmlRegisterType(selector.select(QStringLiteral("TextArea.qml")), uri, 2, 0, "TextArea");
- qmlRegisterType(selector.select(QStringLiteral("TextField.qml")), uri, 2, 0, "TextField");
- qmlRegisterType(selector.select(QStringLiteral("ToolBar.qml")), uri, 2, 0, "ToolBar");
- qmlRegisterType(selector.select(QStringLiteral("ToolButton.qml")), uri, 2, 0, "ToolButton");
- qmlRegisterType(selector.select(QStringLiteral("ToolTip.qml")), uri, 2, 0, "ToolTip");
+ qmlRegisterType(resolvedUrl(QStringLiteral("AbstractButton.qml")), uri, 2, 0, "AbstractButton");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ApplicationWindow.qml")), uri, 2, 0, "ApplicationWindow");
+ qmlRegisterType(resolvedUrl(QStringLiteral("BusyIndicator.qml")), uri, 2, 0, "BusyIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Button.qml")), uri, 2, 0, "Button");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ButtonGroup.qml")), uri, 2, 0, "ButtonGroup");
+ qmlRegisterType(resolvedUrl(QStringLiteral("CheckBox.qml")), uri, 2, 0, "CheckBox");
+ qmlRegisterType(resolvedUrl(QStringLiteral("CheckDelegate.qml")), uri, 2, 0, "CheckDelegate");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ComboBox.qml")), uri, 2, 0, "ComboBox");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Container.qml")), uri, 2, 0, "Container");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Control.qml")), uri, 2, 0, "Control");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Dial.qml")), uri, 2, 0, "Dial");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Drawer.qml")), uri, 2, 0, "Drawer");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Frame.qml")), uri, 2, 0, "Frame");
+ qmlRegisterType(resolvedUrl(QStringLiteral("GroupBox.qml")), uri, 2, 0, "GroupBox");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ItemDelegate.qml")), uri, 2, 0, "ItemDelegate");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Label.qml")), uri, 2, 0, "Label");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Menu.qml")), uri, 2, 0, "Menu");
+ qmlRegisterType(resolvedUrl(QStringLiteral("MenuItem.qml")), uri, 2, 0, "MenuItem");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Page.qml")), uri, 2, 0, "Page");
+ qmlRegisterType(resolvedUrl(QStringLiteral("PageIndicator.qml")), uri, 2, 0, "PageIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Pane.qml")), uri, 2, 0, "Pane");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Popup.qml")), uri, 2, 0, "Popup");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ProgressBar.qml")), uri, 2, 0, "ProgressBar");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RadioButton.qml")), uri, 2, 0, "RadioButton");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RadioDelegate.qml")), uri, 2, 0, "RadioDelegate");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RangeSlider.qml")), uri, 2, 0, "RangeSlider");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ScrollBar.qml")), uri, 2, 0, "ScrollBar");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ScrollIndicator.qml")), uri, 2, 0, "ScrollIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Slider.qml")), uri, 2, 0, "Slider");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SpinBox.qml")), uri, 2, 0, "SpinBox");
+ qmlRegisterType(resolvedUrl(QStringLiteral("StackView.qml")), uri, 2, 0, "StackView");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SwipeDelegate.qml")), uri, 2, 0, "SwipeDelegate");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SwipeView.qml")), uri, 2, 0, "SwipeView");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Switch.qml")), uri, 2, 0, "Switch");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SwitchDelegate.qml")), uri, 2, 0, "SwitchDelegate");
+ qmlRegisterType(resolvedUrl(QStringLiteral("TabBar.qml")), uri, 2, 0, "TabBar");
+ qmlRegisterType(resolvedUrl(QStringLiteral("TabButton.qml")), uri, 2, 0, "TabButton");
+ qmlRegisterType(resolvedUrl(QStringLiteral("TextArea.qml")), uri, 2, 0, "TextArea");
+ qmlRegisterType(resolvedUrl(QStringLiteral("TextField.qml")), uri, 2, 0, "TextField");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ToolBar.qml")), uri, 2, 0, "ToolBar");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ToolButton.qml")), uri, 2, 0, "ToolButton");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ToolTip.qml")), uri, 2, 0, "ToolTip");
#if QT_CONFIG(quick_listview) && QT_CONFIG(quick_pathview)
- qmlRegisterType(selector.select(QStringLiteral("Tumbler.qml")), uri, 2, 0, "Tumbler");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Tumbler.qml")), uri, 2, 0, "Tumbler");
#endif
// QtQuick.Controls 2.1 (new types in Qt 5.8)
- qmlRegisterType(selector.select(QStringLiteral("Dialog.qml")), uri, 2, 1, "Dialog");
- qmlRegisterType(selector.select(QStringLiteral("DialogButtonBox.qml")), uri, 2, 1, "DialogButtonBox");
- qmlRegisterType(selector.select(QStringLiteral("MenuSeparator.qml")), uri, 2, 1, "MenuSeparator");
- qmlRegisterType(selector.select(QStringLiteral("RoundButton.qml")), uri, 2, 1, "RoundButton");
- qmlRegisterType(selector.select(QStringLiteral("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Dialog.qml")), uri, 2, 1, "Dialog");
+ qmlRegisterType(resolvedUrl(QStringLiteral("DialogButtonBox.qml")), uri, 2, 1, "DialogButtonBox");
+ qmlRegisterType(resolvedUrl(QStringLiteral("MenuSeparator.qml")), uri, 2, 1, "MenuSeparator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RoundButton.qml")), uri, 2, 1, "RoundButton");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ToolSeparator.qml")), uri, 2, 1, "ToolSeparator");
// QtQuick.Controls 2.2 (new types in Qt 5.9)
- qmlRegisterType(selector.select(QStringLiteral("DelayButton.qml")), uri, 2, 2, "DelayButton");
- qmlRegisterType(selector.select(QStringLiteral("ScrollView.qml")), uri, 2, 2, "ScrollView");
+ qmlRegisterType(resolvedUrl(QStringLiteral("DelayButton.qml")), uri, 2, 2, "DelayButton");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ScrollView.qml")), uri, 2, 2, "ScrollView");
// QtQuick.Controls 2.3 (new types in Qt 5.10)
- qmlRegisterType(selector.select(QStringLiteral("Action.qml")), uri, 2, 3, "Action");
- qmlRegisterType(selector.select(QStringLiteral("ActionGroup.qml")), uri, 2, 3, "ActionGroup");
- qmlRegisterType(selector.select(QStringLiteral("MenuBar.qml")), uri, 2, 3, "MenuBar");
- qmlRegisterType(selector.select(QStringLiteral("MenuBarItem.qml")), uri, 2, 3, "MenuBarItem");
+ qmlRegisterType(resolvedUrl(QStringLiteral("Action.qml")), uri, 2, 3, "Action");
+ qmlRegisterType(resolvedUrl(QStringLiteral("ActionGroup.qml")), uri, 2, 3, "ActionGroup");
+ qmlRegisterType(resolvedUrl(QStringLiteral("MenuBar.qml")), uri, 2, 3, "MenuBar");
+ qmlRegisterType(resolvedUrl(QStringLiteral("MenuBarItem.qml")), uri, 2, 3, "MenuBarItem");
qmlRegisterUncreatableType<QQuickOverlay>(uri, 2, 3, "Overlay", QStringLiteral("Overlay is only available as an attached property."));
const QByteArray import = QByteArray(uri) + ".impl";
@@ -212,12 +226,71 @@ void QtQuickControls2Plugin::registerTypes(const char *uri)
QString QtQuickControls2Plugin::name() const
{
- return QStringLiteral("default");
+ return QStringLiteral("Default");
}
-QQuickProxyTheme *QtQuickControls2Plugin::createTheme() const
+void QtQuickControls2Plugin::initializeTheme(QQuickTheme *theme)
{
- return new QQuickDefaultTheme;
+ QQuickDefaultTheme::initialize(theme);
+}
+
+QList<QQuickStylePlugin *> QtQuickControls2Plugin::loadStylePlugins()
+{
+ QList<QQuickStylePlugin *> stylePlugins;
+
+ QFileInfo fileInfo = QQmlFile::urlToLocalFileOrQrc(resolvedUrl(QStringLiteral("qmldir")));
+ if (fileInfo.exists() && fileInfo.path() != QQmlFile::urlToLocalFileOrQrc(baseUrl())) {
+ QFile file(fileInfo.filePath());
+ if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
+ QQmlDirParser parser;
+ parser.parse(QString::fromUtf8(file.readAll()));
+ if (!parser.hasError()) {
+#ifdef QT_STATIC
+ const auto plugins = QPluginLoader::staticInstances();
+ for (QObject *instance : plugins) {
+ QQuickStylePlugin *stylePlugin = qobject_cast<QQuickStylePlugin *>(instance);
+ if (!stylePlugin || parser.className() != QLatin1String(instance->metaObject()->className()))
+ continue;
+ stylePlugins += stylePlugin;
+ }
+#elif QT_CONFIG(library)
+ QPluginLoader loader;
+ const auto plugins = parser.plugins();
+ for (const QQmlDirParser::Plugin &plugin : plugins) {
+ QDir dir = fileInfo.dir();
+ if (!plugin.path.isEmpty() && !dir.cd(plugin.path))
+ continue;
+ QString filePath = dir.filePath(plugin.name);
+#if defined(Q_OS_MACOS) && defined(QT_DEBUG)
+ // Avoid mismatching plugins on macOS so that we don't end up loading both debug and
+ // release versions of the same Qt libraries (due to the plugin's dependencies).
+ filePath += QStringLiteral("_debug");
+#endif // Q_OS_MACOS && QT_DEBUG
+ loader.setFileName(filePath);
+ QQuickStylePlugin *stylePlugin = qobject_cast<QQuickStylePlugin *>(loader.instance());
+ if (stylePlugin)
+ stylePlugins += stylePlugin;
+ }
+#endif
+ }
+ }
+ }
+ return stylePlugins;
+}
+
+QQuickTheme *QtQuickControls2Plugin::createTheme(const QString &name)
+{
+ QQuickTheme *theme = new QQuickTheme;
+#if QT_CONFIG(settings)
+ QQuickThemePrivate *p = QQuickThemePrivate::get(theme);
+ QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(name);
+ if (settings) {
+ p->defaultFont.reset(QQuickStylePrivate::readFont(settings));
+ p->defaultPalette.reset(QQuickStylePrivate::readPalette(settings));
+ }
+#endif
+ QQuickThemePrivate::instance.reset(theme);
+ return theme;
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/ApplicationWindow.qml b/src/imports/controls/universal/ApplicationWindow.qml
index 0b119693..313b980e 100644
--- a/src/imports/controls/universal/ApplicationWindow.qml
+++ b/src/imports/controls/universal/ApplicationWindow.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.ApplicationWindow {
id: window
diff --git a/src/imports/controls/universal/BusyIndicator.qml b/src/imports/controls/universal/BusyIndicator.qml
index cc9e6b85..cc6f241d 100644
--- a/src/imports/controls/universal/BusyIndicator.qml
+++ b/src/imports/controls/universal/BusyIndicator.qml
@@ -34,16 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.BusyIndicator {
id: control
- implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding
- implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
contentItem: BusyIndicatorImpl {
implicitWidth: 20
diff --git a/src/imports/controls/universal/Button.qml b/src/imports/controls/universal/Button.qml
index d8b6836d..648b2950 100644
--- a/src/imports/controls/universal/Button.qml
+++ b/src/imports/controls/universal/Button.qml
@@ -34,24 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.Button {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 8
- topPadding: padding - 4
- bottomPadding: padding - 4
+ verticalPadding: padding - 4
spacing: 8
icon.width: 20
diff --git a/src/imports/controls/universal/CheckBox.qml b/src/imports/controls/universal/CheckBox.qml
index 7566c33a..b0632da1 100644
--- a/src/imports/controls/universal/CheckBox.qml
+++ b/src/imports/controls/universal/CheckBox.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.CheckBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 8
diff --git a/src/imports/controls/universal/CheckDelegate.qml b/src/imports/controls/universal/CheckDelegate.qml
index 8419ac1e..98092919 100644
--- a/src/imports/controls/universal/CheckDelegate.qml
+++ b/src/imports/controls/universal/CheckDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.CheckDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12
diff --git a/src/imports/controls/universal/CheckIndicator.qml b/src/imports/controls/universal/CheckIndicator.qml
index 63bbc3d0..cf8ce3c6 100644
--- a/src/imports/controls/universal/CheckIndicator.qml
+++ b/src/imports/controls/universal/CheckIndicator.qml
@@ -34,11 +34,11 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
Rectangle {
implicitWidth: 20
diff --git a/src/imports/controls/universal/ComboBox.qml b/src/imports/controls/universal/ComboBox.qml
index f8ea2874..37b008ba 100644
--- a/src/imports/controls/universal/ComboBox.qml
+++ b/src/imports/controls/universal/ComboBox.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtQuick.Window 2.3
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.ComboBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
leftPadding: padding + (!control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
rightPadding: padding + (control.mirrored || !indicator || !indicator.visible ? 0 : indicator.width + spacing)
diff --git a/src/imports/controls/universal/DelayButton.qml b/src/imports/controls/universal/DelayButton.qml
index be0cccad..2df2e0b4 100644
--- a/src/imports/controls/universal/DelayButton.qml
+++ b/src/imports/controls/universal/DelayButton.qml
@@ -34,22 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.DelayButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 8
- topPadding: padding - 4
- bottomPadding: padding - 4
+ verticalPadding: padding - 4
property bool useSystemFocusVisuals: true
diff --git a/src/imports/controls/universal/Dial.qml b/src/imports/controls/universal/Dial.qml
index d2634713..ae163cab 100644
--- a/src/imports/controls/universal/Dial.qml
+++ b/src/imports/controls/universal/Dial.qml
@@ -34,17 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Dial {
id: control
- implicitWidth: 100
- implicitHeight: 100
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 100 // ### remove 100 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 100 // ### remove 100 in Qt 6
background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 100
+
x: control.width / 2 - width / 2
y: control.height / 2 - height / 2
width: Math.max(64, Math.min(control.width, control.height))
diff --git a/src/imports/controls/universal/Dialog.qml b/src/imports/controls/universal/Dialog.qml
index 08cc441a..bf7b274c 100644
--- a/src/imports/controls/universal/Dialog.qml
+++ b/src/imports/controls/universal/Dialog.qml
@@ -34,29 +34,25 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Universal 2.5
T.Dialog {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0)
- + (contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
padding: 24
- topPadding: 18
- bottomPadding: 18
+ verticalPadding: 18
background: Rectangle {
color: control.Universal.chromeMediumLowColor
diff --git a/src/imports/controls/universal/DialogButtonBox.qml b/src/imports/controls/universal/DialogButtonBox.qml
index 17a9156d..84393a79 100644
--- a/src/imports/controls/universal/DialogButtonBox.qml
+++ b/src/imports/controls/universal/DialogButtonBox.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.Universal 2.5
T.DialogButtonBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ (control.count === 1 ? contentWidth * 2 : contentWidth) + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 4
padding: 24
@@ -58,9 +58,6 @@ T.DialogButtonBox {
}
contentItem: ListView {
- implicitWidth: control.count === 1 ? 200 : contentWidth
- implicitHeight: 32
-
model: control.contentModel
spacing: control.spacing
orientation: ListView.Horizontal
diff --git a/src/imports/controls/universal/Drawer.qml b/src/imports/controls/universal/Drawer.qml
index 8fbd57c6..6c824c8f 100644
--- a/src/imports/controls/universal/Drawer.qml
+++ b/src/imports/controls/universal/Drawer.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Drawer {
id: control
parent: T.Overlay.overlay
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
topPadding: control.edge === Qt.BottomEdge
leftPadding: control.edge === Qt.RightEdge
diff --git a/src/imports/controls/universal/Frame.qml b/src/imports/controls/universal/Frame.qml
index 4f11bc18..e82c0773 100644
--- a/src/imports/controls/universal/Frame.qml
+++ b/src/imports/controls/universal/Frame.qml
@@ -34,18 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/universal/GroupBox.qml b/src/imports/controls/universal/GroupBox.qml
index 8fb68e29..792fcb93 100644
--- a/src/imports/controls/universal/GroupBox.qml
+++ b/src/imports/controls/universal/GroupBox.qml
@@ -34,24 +34,22 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.GroupBox {
id: control
- 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: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding,
+ implicitLabelWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
spacing: 12
padding: 12
- topPadding: padding + (label && label.implicitWidth > 0 ? label.implicitHeight + spacing : 0)
+ topPadding: padding + (implicitLabelWidth > 0 ? implicitLabelHeight + spacing : 0)
label: Text {
x: control.leftPadding
diff --git a/src/imports/controls/universal/ItemDelegate.qml b/src/imports/controls/universal/ItemDelegate.qml
index 65d52729..656aa338 100644
--- a/src/imports/controls/universal/ItemDelegate.qml
+++ b/src/imports/controls/universal/ItemDelegate.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.ItemDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12
diff --git a/src/imports/controls/universal/Label.qml b/src/imports/controls/universal/Label.qml
index bad9ac04..2e6bb1c3 100644
--- a/src/imports/controls/universal/Label.qml
+++ b/src/imports/controls/universal/Label.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Label {
id: control
diff --git a/src/imports/controls/universal/Menu.qml b/src/imports/controls/universal/Menu.qml
index ba998827..567b13af 100644
--- a/src/imports/controls/universal/Menu.qml
+++ b/src/imports/controls/universal/Menu.qml
@@ -34,19 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls 2.4
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Window 2.11
+import QtQuick 2.12
+import QtQuick.Controls 2.5
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Window 2.12
T.Menu {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem ? contentItem.implicitWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem ? contentItem.implicitHeight : 0) + topPadding + bottomPadding
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 0
overlap: 1
diff --git a/src/imports/controls/universal/MenuBar.qml b/src/imports/controls/universal/MenuBar.qml
index a1d7e88a..f2a26a46 100644
--- a/src/imports/controls/universal/MenuBar.qml
+++ b/src/imports/controls/universal/MenuBar.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.MenuBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
delegate: MenuBarItem { }
diff --git a/src/imports/controls/universal/MenuBarItem.qml b/src/imports/controls/universal/MenuBarItem.qml
index e88a3ced..34d9ad29 100644
--- a/src/imports/controls/universal/MenuBarItem.qml
+++ b/src/imports/controls/universal/MenuBarItem.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.MenuBarItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
topPadding: padding - 1
diff --git a/src/imports/controls/universal/MenuItem.qml b/src/imports/controls/universal/MenuItem.qml
index c9c38cb5..7b52300c 100644
--- a/src/imports/controls/universal/MenuItem.qml
+++ b/src/imports/controls/universal/MenuItem.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.MenuItem {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 12
topPadding: padding - 1
diff --git a/src/imports/controls/universal/MenuSeparator.qml b/src/imports/controls/universal/MenuSeparator.qml
index 6d0d9dd5..9e3b1d89 100644
--- a/src/imports/controls/universal/MenuSeparator.qml
+++ b/src/imports/controls/universal/MenuSeparator.qml
@@ -34,15 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.MenuSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 12
topPadding: 9
diff --git a/src/imports/controls/universal/Page.qml b/src/imports/controls/universal/Page.qml
index 734ea245..e09225e4 100644
--- a/src/imports/controls/universal/Page.qml
+++ b/src/imports/controls/universal/Page.qml
@@ -34,24 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Page {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding,
- header && header.visible ? header.implicitWidth : 0,
- footer && footer.visible ? footer.implicitWidth : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeaderWidth,
+ implicitFooterWidth)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding
- + (header && header.visible ? header.implicitHeight + spacing : 0)
- + (footer && footer.visible ? footer.implicitHeight + spacing : 0))
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ + (implicitHeaderHeight > 0 ? implicitHeaderHeight + spacing : 0)
+ + (implicitFooterHeight > 0 ? implicitFooterHeight + spacing : 0))
background: Rectangle {
color: control.Universal.background
diff --git a/src/imports/controls/universal/PageIndicator.qml b/src/imports/controls/universal/PageIndicator.qml
index c14a3365..a89a7d07 100644
--- a/src/imports/controls/universal/PageIndicator.qml
+++ b/src/imports/controls/universal/PageIndicator.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.PageIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 7
diff --git a/src/imports/controls/universal/Pane.qml b/src/imports/controls/universal/Pane.qml
index 340653ea..d643bb7f 100644
--- a/src/imports/controls/universal/Pane.qml
+++ b/src/imports/controls/universal/Pane.qml
@@ -34,18 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Pane {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/universal/Popup.qml b/src/imports/controls/universal/Popup.qml
index 567fa7d2..739fab68 100644
--- a/src/imports/controls/universal/Popup.qml
+++ b/src/imports/controls/universal/Popup.qml
@@ -34,20 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Popup {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentWidth > 0 ? contentWidth + leftPadding + rightPadding : 0)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentHeight > 0 ? contentHeight + topPadding + bottomPadding : 0)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
padding: 12
diff --git a/src/imports/controls/universal/ProgressBar.qml b/src/imports/controls/universal/ProgressBar.qml
index e7aa6bbe..7403f74c 100644
--- a/src/imports/controls/universal/ProgressBar.qml
+++ b/src/imports/controls/universal/ProgressBar.qml
@@ -34,18 +34,18 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.ProgressBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
contentItem: ProgressBarImpl {
implicitHeight: 10
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 763725b6..7c8fdcc9 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.RadioButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 6
spacing: 8
diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml
index 90d023b3..2e068c4b 100644
--- a/src/imports/controls/universal/RadioDelegate.qml
+++ b/src/imports/controls/universal/RadioDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.RadioDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12
diff --git a/src/imports/controls/universal/RadioIndicator.qml b/src/imports/controls/universal/RadioIndicator.qml
index 11f388c2..71cb7098 100644
--- a/src/imports/controls/universal/RadioIndicator.qml
+++ b/src/imports/controls/universal/RadioIndicator.qml
@@ -34,8 +34,8 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Controls.Universal 2.5
Rectangle {
implicitWidth: 20
diff --git a/src/imports/controls/universal/RangeSlider.qml b/src/imports/controls/universal/RangeSlider.qml
index 6ee923e1..57b30ea9 100644
--- a/src/imports/controls/universal/RangeSlider.qml
+++ b/src/imports/controls/universal/RangeSlider.qml
@@ -34,19 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.RangeSlider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- Math.max(first.handle ? first.handle.implicitWidth : 0,
- second.handle ? second.handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(first.handle ? first.handle.implicitHeight : 0,
- second.handle ? second.handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ first.implicitHandleWidth + leftPadding + rightPadding,
+ second.implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ first.implicitHandleHeight + topPadding + bottomPadding,
+ second.implicitHandleHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/universal/RoundButton.qml b/src/imports/controls/universal/RoundButton.qml
index 34983ac9..06455e0c 100644
--- a/src/imports/controls/universal/RoundButton.qml
+++ b/src/imports/controls/universal/RoundButton.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.RoundButton {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 8
spacing: 8
diff --git a/src/imports/controls/universal/ScrollBar.qml b/src/imports/controls/universal/ScrollBar.qml
index 91b77366..6cb77245 100644
--- a/src/imports/controls/universal/ScrollBar.qml
+++ b/src/imports/controls/universal/ScrollBar.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.ScrollBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
visible: control.policy !== T.ScrollBar.AlwaysOff
diff --git a/src/imports/controls/universal/ScrollIndicator.qml b/src/imports/controls/universal/ScrollIndicator.qml
index f09124db..b2dd6bbd 100644
--- a/src/imports/controls/universal/ScrollIndicator.qml
+++ b/src/imports/controls/universal/ScrollIndicator.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.ScrollIndicator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
contentItem: Rectangle {
implicitWidth: 6
diff --git a/src/imports/controls/universal/Slider.qml b/src/imports/controls/universal/Slider.qml
index 49b6d371..5ccf83b6 100644
--- a/src/imports/controls/universal/Slider.qml
+++ b/src/imports/controls/universal/Slider.qml
@@ -34,17 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.Slider {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (handle ? handle.implicitWidth : 0) + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- (handle ? handle.implicitHeight : 0) + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitHandleWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitHandleHeight + topPadding + bottomPadding)
padding: 6
diff --git a/src/imports/controls/universal/SpinBox.qml b/src/imports/controls/universal/SpinBox.qml
index d9ceed78..0ef08538 100644
--- a/src/imports/controls/universal/SpinBox.qml
+++ b/src/imports/controls/universal/SpinBox.qml
@@ -34,24 +34,23 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.SpinBox {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentItem.implicitWidth + 16 +
- (up.indicator ? up.indicator.implicitWidth : 0) +
- (down.indicator ? down.indicator.implicitWidth : 0))
- implicitHeight: Math.max(contentItem.implicitHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
- up.indicator ? up.indicator.implicitHeight : 0,
- down.indicator ? down.indicator.implicitHeight : 0)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ up.implicitIndicatorWidth +
+ down.implicitIndicatorWidth)
+ implicitHeight: Math.max(implicitContentHeight + topPadding + bottomPadding,
+ implicitBackgroundHeight,
+ up.implicitIndicatorHeight,
+ down.implicitIndicatorHeight)
// TextControlThemePadding + 2 (border)
padding: 12
diff --git a/src/imports/controls/universal/StackView.qml b/src/imports/controls/universal/StackView.qml
index 77d70255..c4cf70e7 100644
--- a/src/imports/controls/universal/StackView.qml
+++ b/src/imports/controls/universal/StackView.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.StackView {
id: control
diff --git a/src/imports/controls/universal/SwipeDelegate.qml b/src/imports/controls/universal/SwipeDelegate.qml
index ffcdf0a9..492e2e3a 100644
--- a/src/imports/controls/universal/SwipeDelegate.qml
+++ b/src/imports/controls/universal/SwipeDelegate.qml
@@ -34,21 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.SwipeDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12
diff --git a/src/imports/controls/universal/Switch.qml b/src/imports/controls/universal/Switch.qml
index b0d1923b..538562bc 100644
--- a/src/imports/controls/universal/Switch.qml
+++ b/src/imports/controls/universal/Switch.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.Switch {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
padding: 5
spacing: 8
diff --git a/src/imports/controls/universal/SwitchDelegate.qml b/src/imports/controls/universal/SwitchDelegate.qml
index 48248193..32e63cf5 100644
--- a/src/imports/controls/universal/SwitchDelegate.qml
+++ b/src/imports/controls/universal/SwitchDelegate.qml
@@ -34,22 +34,21 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls.Universal.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls.Universal.impl 2.5
T.SwitchDelegate {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(contentItem.implicitHeight,
- indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: contentItem.y + contentItem.baselineOffset
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding,
+ implicitIndicatorHeight + topPadding + bottomPadding)
spacing: 12
diff --git a/src/imports/controls/universal/SwitchIndicator.qml b/src/imports/controls/universal/SwitchIndicator.qml
index b1072b88..12a71f16 100644
--- a/src/imports/controls/universal/SwitchIndicator.qml
+++ b/src/imports/controls/universal/SwitchIndicator.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
Item {
implicitWidth: 44
diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml
index 81003b48..d2bdcfa1 100644
--- a/src/imports/controls/universal/TabBar.qml
+++ b/src/imports/controls/universal/TabBar.qml
@@ -34,16 +34,16 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.TabBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
contentItem: PathView {
diff --git a/src/imports/controls/universal/TabButton.qml b/src/imports/controls/universal/TabButton.qml
index 3a9e6d45..b512026a 100644
--- a/src/imports/controls/universal/TabButton.qml
+++ b/src/imports/controls/universal/TabButton.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.TabButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 12 // PivotItemMargin
spacing: 8
diff --git a/src/imports/controls/universal/TextArea.qml b/src/imports/controls/universal/TextArea.qml
index 3e407160..2d5934df 100644
--- a/src/imports/controls/universal/TextArea.qml
+++ b/src/imports/controls/universal/TextArea.qml
@@ -34,20 +34,20 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.TextArea {
id: control
implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
- background ? background.implicitWidth : 0,
+ implicitBackgroundWidth + leftInset + rightInset,
placeholder.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitBackgroundHeight + topInset + bottomInset,
placeholder.implicitHeight + topPadding + bottomPadding)
// TextControlThemePadding + 2 (border)
@@ -61,6 +61,9 @@ T.TextArea {
color: !enabled ? Universal.chromeDisabledLowColor : Universal.foreground
selectionColor: Universal.accent
selectedTextColor: Universal.chromeWhiteColor
+ placeholderTextColor: !enabled ? Universal.chromeDisabledLowColor :
+ activeFocus ? Universal.chromeBlackMediumLowColor :
+ Universal.baseMediumColor
PlaceholderText {
id: placeholder
@@ -71,8 +74,7 @@ T.TextArea {
text: control.placeholderText
font: control.font
- color: !control.enabled ? control.Universal.chromeDisabledLowColor :
- control.activeFocus ? control.Universal.chromeBlackMediumLowColor : control.Universal.baseMediumColor
+ color: control.placeholderTextColor
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
verticalAlignment: control.verticalAlignment
elide: Text.ElideRight
diff --git a/src/imports/controls/universal/TextField.qml b/src/imports/controls/universal/TextField.qml
index 0f3084ce..04e40fa5 100644
--- a/src/imports/controls/universal/TextField.qml
+++ b/src/imports/controls/universal/TextField.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.TextField {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0)
- || contentWidth + leftPadding + rightPadding
- implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
- background ? background.implicitHeight : 0,
+ implicitWidth: implicitBackgroundWidth + leftInset + rightInset
+ || Math.max(contentWidth, placeholder.implicitWidth) + leftPadding + rightPadding
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding,
placeholder.implicitHeight + topPadding + bottomPadding)
// TextControlThemePadding + 2 (border)
@@ -61,6 +60,9 @@ T.TextField {
color: !enabled ? Universal.chromeDisabledLowColor : Universal.foreground
selectionColor: Universal.accent
selectedTextColor: Universal.chromeWhiteColor
+ placeholderTextColor: !enabled ? Universal.chromeDisabledLowColor :
+ activeFocus ? Universal.chromeBlackMediumLowColor :
+ Universal.baseMediumColor
verticalAlignment: TextInput.AlignVCenter
PlaceholderText {
@@ -72,8 +74,7 @@ T.TextField {
text: control.placeholderText
font: control.font
- color: !control.enabled ? control.Universal.chromeDisabledLowColor :
- control.activeFocus ? control.Universal.chromeBlackMediumLowColor : control.Universal.baseMediumColor
+ color: control.placeholderTextColor
visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter)
verticalAlignment: control.verticalAlignment
elide: Text.ElideRight
diff --git a/src/imports/controls/universal/ToolBar.qml b/src/imports/controls/universal/ToolBar.qml
index 65dca3bb..539dcd2e 100644
--- a/src/imports/controls/universal/ToolBar.qml
+++ b/src/imports/controls/universal/ToolBar.qml
@@ -34,18 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.ToolBar {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
-
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : 0)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : 0)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
background: Rectangle {
implicitHeight: 48 // AppBarThemeCompactHeight
diff --git a/src/imports/controls/universal/ToolButton.qml b/src/imports/controls/universal/ToolButton.qml
index 118d4baa..62746461 100644
--- a/src/imports/controls/universal/ToolButton.qml
+++ b/src/imports/controls/universal/ToolButton.qml
@@ -34,20 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
+import QtQuick.Controls.Universal 2.5
T.ToolButton {
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
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
padding: 6
spacing: 8
diff --git a/src/imports/controls/universal/ToolSeparator.qml b/src/imports/controls/universal/ToolSeparator.qml
index 2e7b6a01..630fa867 100644
--- a/src/imports/controls/universal/ToolSeparator.qml
+++ b/src/imports/controls/universal/ToolSeparator.qml
@@ -34,15 +34,17 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.ToolSeparator {
id: control
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
leftPadding: vertical ? 16 : 12
rightPadding: vertical ? 15 : 12
diff --git a/src/imports/controls/universal/ToolTip.qml b/src/imports/controls/universal/ToolTip.qml
index 1c7c7b69..528d49b5 100644
--- a/src/imports/controls/universal/ToolTip.qml
+++ b/src/imports/controls/universal/ToolTip.qml
@@ -34,9 +34,9 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
T.ToolTip {
id: control
@@ -44,10 +44,10 @@ T.ToolTip {
x: parent ? (parent.width - implicitWidth) / 2 : 0
y: -implicitHeight - 16
- implicitWidth: Math.max(background ? background.implicitWidth : 0,
- contentItem.implicitWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0,
- contentItem.implicitHeight + topPadding + bottomPadding)
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ contentWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ contentHeight + topPadding + bottomPadding)
margins: 8
padding: 8
diff --git a/src/imports/controls/universal/Tumbler.qml b/src/imports/controls/universal/Tumbler.qml
index f0dbc163..cccd4224 100644
--- a/src/imports/controls/universal/Tumbler.qml
+++ b/src/imports/controls/universal/Tumbler.qml
@@ -34,17 +34,19 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls.Universal 2.4
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
+import QtQuick 2.12
+import QtQuick.Templates 2.5 as T
+import QtQuick.Controls.Universal 2.5
+import QtQuick.Controls 2.5
+import QtQuick.Controls.impl 2.5
T.Tumbler {
id: control
- implicitWidth: 60
- implicitHeight: 200
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding) || 60 // ### remove 60 in Qt 6
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding) || 200 // ### remove 200 in Qt 6
delegate: Text {
text: modelData
@@ -56,6 +58,8 @@ T.Tumbler {
}
contentItem: TumblerView {
+ implicitWidth: 60
+ implicitHeight: 200
model: control.model
delegate: control.delegate
path: Path {
diff --git a/src/imports/controls/universal/qmldir b/src/imports/controls/universal/qmldir
index 6555626f..6870a4e1 100644
--- a/src/imports/controls/universal/qmldir
+++ b/src/imports/controls/universal/qmldir
@@ -1,4 +1,4 @@
module QtQuick.Controls.Universal
plugin qtquickcontrols2universalstyleplugin
classname QtQuickControls2UniversalStylePlugin
-depends QtQuick.Controls 2.4
+depends QtQuick.Controls 2.5
diff --git a/src/imports/controls/universal/qquickuniversaltheme.cpp b/src/imports/controls/universal/qquickuniversaltheme.cpp
index 549840b6..041dce9e 100644
--- a/src/imports/controls/universal/qquickuniversaltheme.cpp
+++ b/src/imports/controls/universal/qquickuniversaltheme.cpp
@@ -36,14 +36,17 @@
#include "qquickuniversaltheme_p.h"
-#include <QtGui/qfont.h>
#include <QtGui/qfontinfo.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
-QQuickUniversalTheme::QQuickUniversalTheme()
- : QQuickTheme(QStringLiteral("Universal"))
+void QQuickUniversalTheme::initialize(QQuickTheme *theme)
{
+ QFont systemFont;
+ QFont groupBoxTitleFont;
+ QFont tabButtonFont;
+
const QFont font(QLatin1String("Segoe UI"));
if (QFontInfo(font).family() == QLatin1String("Segoe UI")) {
const QString family = font.family();
@@ -53,27 +56,15 @@ QQuickUniversalTheme::QQuickUniversalTheme()
}
systemFont.setPixelSize(15);
- systemFont = resolveFont(systemFont);
+ theme->setFont(QQuickTheme::System, systemFont);
groupBoxTitleFont.setPixelSize(15);
groupBoxTitleFont.setWeight(QFont::DemiBold);
- groupBoxTitleFont = resolveFont(groupBoxTitleFont);
+ theme->setFont(QQuickTheme::GroupBox, groupBoxTitleFont);
tabButtonFont.setPixelSize(24);
tabButtonFont.setWeight(QFont::Light);
- tabButtonFont = resolveFont(tabButtonFont);
-}
-
-const QFont *QQuickUniversalTheme::font(QPlatformTheme::Font type) const
-{
- switch (type) {
- case QPlatformTheme::GroupBoxTitleFont:
- return &groupBoxTitleFont;
- case QPlatformTheme::TabButtonFont:
- return &tabButtonFont;
- default:
- return &systemFont;
- }
+ theme->setFont(QQuickTheme::TabBar, tabButtonFont);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qquickuniversaltheme_p.h b/src/imports/controls/universal/qquickuniversaltheme_p.h
index f15dee3e..f762d0e3 100644
--- a/src/imports/controls/universal/qquickuniversaltheme_p.h
+++ b/src/imports/controls/universal/qquickuniversaltheme_p.h
@@ -48,22 +48,16 @@
// We mean it.
//
-#include <QtGui/qfont.h>
-#include <QtQuickControls2/private/qquicktheme_p.h>
+#include <QtCore/qglobal.h>
QT_BEGIN_NAMESPACE
-class QQuickUniversalTheme : public QQuickTheme
+class QQuickTheme;
+
+class QQuickUniversalTheme
{
public:
- explicit QQuickUniversalTheme();
-
- const QFont *font(Font type = SystemFont) const override;
-
-private:
- QFont systemFont;
- QFont groupBoxTitleFont;
- QFont tabButtonFont;
+ static void initialize(QQuickTheme *theme);
};
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
index 139acab9..1265f636 100644
--- a/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtquickcontrols2universalstyleplugin.cpp
@@ -42,14 +42,6 @@
#include "qquickuniversalstyle_p.h"
#include "qquickuniversaltheme_p.h"
-static inline void initResources()
-{
- Q_INIT_RESOURCE(qtquickcontrols2universalstyleplugin);
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Controls_2_Universal);
-#endif
-}
-
QT_BEGIN_NAMESPACE
class QtQuickControls2UniversalStylePlugin: public QQuickStylePlugin
@@ -63,12 +55,11 @@ public:
void registerTypes(const char *uri) override;
QString name() const override;
- QQuickProxyTheme *createTheme() const override;
+ void initializeTheme(QQuickTheme *theme) override;
};
QtQuickControls2UniversalStylePlugin::QtQuickControls2UniversalStylePlugin(QObject *parent) : QQuickStylePlugin(parent)
{
- initResources();
QQuickUniversalStyle::initGlobals();
}
@@ -84,19 +75,19 @@ void QtQuickControls2UniversalStylePlugin::registerTypes(const char *uri)
qmlRegisterType<QQuickUniversalBusyIndicator>(import, 2, 0, "BusyIndicatorImpl");
qmlRegisterType<QQuickUniversalProgressBar>(import, 2, 0, "ProgressBarImpl");
- qmlRegisterType(typeUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
- qmlRegisterType(typeUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
- qmlRegisterType(typeUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("CheckIndicator.qml")), import, 2, 0, "CheckIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("RadioIndicator.qml")), import, 2, 0, "RadioIndicator");
+ qmlRegisterType(resolvedUrl(QStringLiteral("SwitchIndicator.qml")), import, 2, 0, "SwitchIndicator");
}
QString QtQuickControls2UniversalStylePlugin::name() const
{
- return QStringLiteral("universal");
+ return QStringLiteral("Universal");
}
-QQuickProxyTheme *QtQuickControls2UniversalStylePlugin::createTheme() const
+void QtQuickControls2UniversalStylePlugin::initializeTheme(QQuickTheme *theme)
{
- return new QQuickUniversalTheme;
+ QQuickUniversalTheme::initialize(theme);
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/universal.pro b/src/imports/controls/universal/universal.pro
index c437328c..399de032 100644
--- a/src/imports/controls/universal/universal.pro
+++ b/src/imports/controls/universal/universal.pro
@@ -1,6 +1,6 @@
TARGET = qtquickcontrols2universalstyleplugin
TARGETPATH = QtQuick/Controls.2/Universal
-IMPORT_VERSION = 2.4
+IMPORT_VERSION = 2.5
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private quickcontrols2-private
@@ -19,8 +19,7 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2universalstyleplugin.qrc
-!static: CONFIG += qmlcache
-CONFIG += no_cxx_module
+CONFIG += no_cxx_module install_qml_files builtin_resources qtquickcompiler
load(qml_plugin)
requires(qtConfig(quickcontrols2-universal))
diff --git a/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc b/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc
index b0c9c41e..57f011ef 100644
--- a/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc
+++ b/src/imports/platform/doc/src/qtlabsplatform-qmltypes.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \qmlmodule Qt.labs.platform 1.0
+ \qmlmodule Qt.labs.platform 1.1
\title Qt Labs Platform QML Types
\ingroup qmlmodules
\brief Provides QML types for native platform extensions.
@@ -39,7 +39,7 @@
following import statement in your .qml file:
\badcode
- import Qt.labs.platform 1.0
+ import Qt.labs.platform 1.1
\endcode
\section1 QML Types
diff --git a/src/imports/platform/platform.pri b/src/imports/platform/platform.pri
index 2227d89c..ec6e8616 100644
--- a/src/imports/platform/platform.pri
+++ b/src/imports/platform/platform.pri
@@ -4,6 +4,7 @@ HEADERS += \
$$PWD/qquickplatformfiledialog_p.h \
$$PWD/qquickplatformfolderdialog_p.h \
$$PWD/qquickplatformfontdialog_p.h \
+ $$PWD/qquickplatformicon_p.h \
$$PWD/qquickplatformiconloader_p.h \
$$PWD/qquickplatformmenu_p.h \
$$PWD/qquickplatformmenubar_p.h \
@@ -19,6 +20,7 @@ SOURCES += \
$$PWD/qquickplatformfiledialog.cpp \
$$PWD/qquickplatformfolderdialog.cpp \
$$PWD/qquickplatformfontdialog.cpp \
+ $$PWD/qquickplatformicon.cpp \
$$PWD/qquickplatformiconloader.cpp \
$$PWD/qquickplatformmenu.cpp \
$$PWD/qquickplatformmenubar.cpp \
diff --git a/src/imports/platform/qquickplatformicon.cpp b/src/imports/platform/qquickplatformicon.cpp
new file mode 100644
index 00000000..7096ff8a
--- /dev/null
+++ b/src/imports/platform/qquickplatformicon.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickplatformicon_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QUrl QQuickPlatformIcon::source() const
+{
+ return m_source;
+}
+
+void QQuickPlatformIcon::setSource(const QUrl& source)
+{
+ m_source = source;
+}
+
+QString QQuickPlatformIcon::name() const
+{
+ return m_name;
+}
+
+void QQuickPlatformIcon::setName(const QString& name)
+{
+ m_name = name;
+}
+
+bool QQuickPlatformIcon::isMask() const
+{
+ return m_mask;
+}
+
+void QQuickPlatformIcon::setMask(bool mask)
+{
+ m_mask = mask;
+}
+
+bool QQuickPlatformIcon::operator==(const QQuickPlatformIcon &other) const
+{
+ return m_source == other.m_source && m_name == other.m_name && m_mask == other.m_mask;
+}
+
+bool QQuickPlatformIcon::operator!=(const QQuickPlatformIcon &other) const
+{
+ return !(*this == other);
+}
+
+QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformicon_p.h b/src/imports/platform/qquickplatformicon_p.h
new file mode 100644
index 00000000..9add9d6e
--- /dev/null
+++ b/src/imports/platform/qquickplatformicon_p.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs Platform module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPLATFORMICON_P_H
+#define QQUICKPLATFORMICON_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qurl.h>
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+class QObject;
+
+class QQuickPlatformIcon
+{
+ Q_GADGET
+ Q_PROPERTY(QUrl source READ source WRITE setSource)
+ Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(bool mask READ isMask WRITE setMask)
+
+public:
+ QUrl source() const;
+ void setSource(const QUrl &source);
+
+ QString name() const;
+ void setName(const QString &name);
+
+ bool isMask() const;
+ void setMask(bool mask);
+
+ bool operator==(const QQuickPlatformIcon &other) const;
+ bool operator!=(const QQuickPlatformIcon &other) const;
+
+private:
+ bool m_mask = false;
+ QUrl m_source;
+ QString m_name;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPLATFORMICON_P_H
diff --git a/src/imports/platform/qquickplatformiconloader.cpp b/src/imports/platform/qquickplatformiconloader.cpp
index 11ebd476..c7b699b2 100644
--- a/src/imports/platform/qquickplatformiconloader.cpp
+++ b/src/imports/platform/qquickplatformiconloader.cpp
@@ -62,42 +62,32 @@ void QQuickPlatformIconLoader::setEnabled(bool enabled)
loadIcon();
}
-QIcon QQuickPlatformIconLoader::icon() const
+QIcon QQuickPlatformIconLoader::toQIcon() const
{
QIcon fallback = QPixmap::fromImage(image());
- return QIcon::fromTheme(m_iconName, fallback);
+ QIcon icon = QIcon::fromTheme(m_icon.name(), fallback);
+ icon.setIsMask(m_icon.isMask());
+ return icon;
}
-QUrl QQuickPlatformIconLoader::iconSource() const
+QQuickPlatformIcon QQuickPlatformIconLoader::icon() const
{
- return m_iconSource;
+ return m_icon;
}
-void QQuickPlatformIconLoader::setIconSource(const QUrl& source)
+void QQuickPlatformIconLoader::setIcon(const QQuickPlatformIcon& icon)
{
- m_iconSource = source;
- if (m_enabled)
- loadIcon();
-}
-
-QString QQuickPlatformIconLoader::iconName() const
-{
- return m_iconName;
-}
-
-void QQuickPlatformIconLoader::setIconName(const QString& name)
-{
- m_iconName = name;
+ m_icon = icon;
if (m_enabled)
loadIcon();
}
void QQuickPlatformIconLoader::loadIcon()
{
- if (m_iconSource.isEmpty()) {
+ if (m_icon.source().isEmpty()) {
clear(m_parent);
} else {
- load(qmlEngine(m_parent), m_iconSource);
+ load(qmlEngine(m_parent), m_icon.source());
if (m_slot != -1 && isLoading()) {
connectFinished(m_parent, m_slot);
m_slot = -1;
diff --git a/src/imports/platform/qquickplatformiconloader_p.h b/src/imports/platform/qquickplatformiconloader_p.h
index dd26a65b..d284a513 100644
--- a/src/imports/platform/qquickplatformiconloader_p.h
+++ b/src/imports/platform/qquickplatformiconloader_p.h
@@ -53,6 +53,8 @@
#include <QtGui/qicon.h>
#include <QtQuick/private/qquickpixmapcache_p.h>
+#include "qquickplatformicon_p.h"
+
QT_BEGIN_NAMESPACE
class QObject;
@@ -65,13 +67,10 @@ public:
bool isEnabled() const;
void setEnabled(bool enabled);
- QIcon icon() const;
-
- QUrl iconSource() const;
- void setIconSource(const QUrl &source);
+ QIcon toQIcon() const;
- QString iconName() const;
- void setIconName(const QString &name);
+ QQuickPlatformIcon icon() const;
+ void setIcon(const QQuickPlatformIcon &icon);
private:
void loadIcon();
@@ -79,9 +78,7 @@ private:
QObject *m_parent;
int m_slot;
bool m_enabled;
- QIcon m_icon;
- QUrl m_iconSource;
- QString m_iconName;
+ QQuickPlatformIcon m_icon;
};
QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformmenu.cpp b/src/imports/platform/qquickplatformmenu.cpp
index 0a5ce8e4..844fbbd9 100644
--- a/src/imports/platform/qquickplatformmenu.cpp
+++ b/src/imports/platform/qquickplatformmenu.cpp
@@ -543,57 +543,48 @@ void QQuickPlatformMenu::setTitle(const QString &title)
/*!
\qmlproperty url Qt.labs.platform::Menu::iconSource
-
- This property holds the url of the menu's icon.
-
- \sa iconName
+ \deprecated Use icon.source instead
*/
QUrl QQuickPlatformMenu::iconSource() const
{
- if (!m_iconLoader)
- return QUrl();
-
- return m_iconLoader->iconSource();
+ return icon().source();
}
void QQuickPlatformMenu::setIconSource(const QUrl& source)
{
- if (source == iconSource())
+ QQuickPlatformIcon newIcon = icon();
+ if (source == newIcon.source())
return;
if (m_menuItem)
m_menuItem->setIconSource(source);
- iconLoader()->setIconSource(source);
+ newIcon.setSource(source);
+ iconLoader()->setIcon(newIcon);
emit iconSourceChanged();
}
/*!
\qmlproperty string Qt.labs.platform::Menu::iconName
-
- This property holds the theme name of the menu's icon.
-
- \sa iconSource, QIcon::fromTheme()
+ \deprecated Use icon.name instead
*/
QString QQuickPlatformMenu::iconName() const
{
- if (!m_iconLoader)
- return QString();
-
- return m_iconLoader->iconName();
+ return icon().name();
}
void QQuickPlatformMenu::setIconName(const QString& name)
{
- if (name == iconName())
+ QQuickPlatformIcon newIcon = icon();
+ if (name == newIcon.name())
return;
if (m_menuItem)
m_menuItem->setIconName(name);
- iconLoader()->setIconName(name);
- emit iconNameChanged();
-}
+ newIcon.setName(name);
+ iconLoader()->setIcon(newIcon);
+ emit iconNameChanged();}
/*!
\qmlproperty font Qt.labs.platform::Menu::font
@@ -618,6 +609,35 @@ void QQuickPlatformMenu::setFont(const QFont& font)
}
/*!
+ \since Qt.labs.platform 1.1 (Qt 5.12)
+ \qmlpropertygroup Qt.labs.platform::MenuItem::icon
+ \qmlproperty url Qt.labs.platform::MenuItem::icon.source
+ \qmlproperty string Qt.labs.platform::MenuItem::icon.name
+ \qmlproperty bool Qt.labs.platform::MenuItem::icon.mask
+
+ This property holds the menu item's icon.
+*/
+QQuickPlatformIcon QQuickPlatformMenu::icon() const
+{
+ if (!m_iconLoader)
+ return QQuickPlatformIcon();
+
+ return iconLoader()->icon();
+}
+
+void QQuickPlatformMenu::setIcon(const QQuickPlatformIcon &icon)
+{
+ if (iconLoader()->icon() == icon)
+ return;
+
+ if (m_menuItem)
+ m_menuItem->setIcon(icon);
+
+ iconLoader()->setIcon(icon);
+ emit iconChanged();
+}
+
+/*!
\qmlmethod void Qt.labs.platform::Menu::addItem(MenuItem item)
Adds an \a item to the end of the menu.
@@ -913,7 +933,7 @@ void QQuickPlatformMenu::updateIcon()
if (!m_handle || !m_iconLoader)
return;
- m_handle->setIcon(m_iconLoader->icon());
+ m_handle->setIcon(m_iconLoader->toQIcon());
sync();
}
diff --git a/src/imports/platform/qquickplatformmenu_p.h b/src/imports/platform/qquickplatformmenu_p.h
index 14f083dd..eb18f66b 100644
--- a/src/imports/platform/qquickplatformmenu_p.h
+++ b/src/imports/platform/qquickplatformmenu_p.h
@@ -56,6 +56,8 @@
#include <QtQml/qqmllist.h>
#include <QtQml/qqml.h>
+#include "qquickplatformicon_p.h"
+
QT_BEGIN_NAMESPACE
class QIcon;
@@ -86,6 +88,7 @@ class QQuickPlatformMenu : public QObject, public QQmlParserStatus
Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged FINAL)
Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
+ Q_PROPERTY(QQuickPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION 1)
Q_ENUMS(QPlatformMenu::MenuType)
Q_CLASSINFO("DefaultProperty", "data")
@@ -136,6 +139,9 @@ public:
QFont font() const;
void setFont(const QFont &font);
+ QQuickPlatformIcon icon() const;
+ void setIcon(const QQuickPlatformIcon &icon);
+
Q_INVOKABLE void addItem(QQuickPlatformMenuItem *item);
Q_INVOKABLE void insertItem(int index, QQuickPlatformMenuItem *item);
Q_INVOKABLE void removeItem(QQuickPlatformMenuItem *item);
@@ -166,6 +172,7 @@ Q_SIGNALS:
void minimumWidthChanged();
void fontChanged();
void typeChanged();
+ Q_REVISION(1) void iconChanged();
protected:
void classBegin() override;
diff --git a/src/imports/platform/qquickplatformmenuitem.cpp b/src/imports/platform/qquickplatformmenuitem.cpp
index bc6d97e1..d657fd12 100644
--- a/src/imports/platform/qquickplatformmenuitem.cpp
+++ b/src/imports/platform/qquickplatformmenuitem.cpp
@@ -443,63 +443,41 @@ void QQuickPlatformMenuItem::setText(const QString &text)
/*!
\qmlproperty url Qt.labs.platform::MenuItem::iconSource
-
- This property holds the url of the menu item's icon.
-
- \code
- MenuItem {
- iconName: "edit-undo"
- iconSource: "qrc:/images/undo.png"
- }
- \endcode
-
- \sa iconName
+ \deprecated Use icon.source instead
*/
QUrl QQuickPlatformMenuItem::iconSource() const
{
- if (!m_iconLoader)
- return QUrl();
-
- return m_iconLoader->iconSource();
+ return icon().source();
}
void QQuickPlatformMenuItem::setIconSource(const QUrl& source)
{
- if (source == iconSource())
+ QQuickPlatformIcon newIcon = icon();
+ if (source == newIcon.source())
return;
- iconLoader()->setIconSource(source);
+ newIcon.setSource(source);
+ iconLoader()->setIcon(newIcon);
emit iconSourceChanged();
}
/*!
\qmlproperty string Qt.labs.platform::MenuItem::iconName
-
- This property holds the theme name of the menu item's icon.
-
- \code
- MenuItem {
- iconName: "edit-undo"
- iconSource: "qrc:/images/undo.png"
- }
- \endcode
-
- \sa iconSource, QIcon::fromTheme()
+ \deprecated Use icon.name instead
*/
QString QQuickPlatformMenuItem::iconName() const
{
- if (!m_iconLoader)
- return QString();
-
- return m_iconLoader->iconName();
+ return icon().name();
}
void QQuickPlatformMenuItem::setIconName(const QString& name)
{
- if (name == iconName())
+ QQuickPlatformIcon newIcon = icon();
+ if (name == newIcon.name())
return;
- iconLoader()->setIconName(name);
+ newIcon.setName(name);
+ iconLoader()->setIcon(newIcon);
emit iconNameChanged();
}
@@ -560,6 +538,42 @@ void QQuickPlatformMenuItem::setFont(const QFont& font)
}
/*!
+ \since Qt.labs.platform 1.1 (Qt 5.12)
+ \qmlpropertygroup Qt.labs.platform::MenuItem::icon
+ \qmlproperty url Qt.labs.platform::MenuItem::icon.source
+ \qmlproperty string Qt.labs.platform::MenuItem::icon.name
+ \qmlproperty bool Qt.labs.platform::MenuItem::icon.mask
+
+ This property holds the menu item's icon.
+
+ \code
+ MenuItem {
+ icon.mask: true
+ icon.name: "edit-undo"
+ icon.source: "qrc:/images/undo.png"
+ }
+ \endcode
+
+ \sa QIcon::fromTheme()
+*/
+QQuickPlatformIcon QQuickPlatformMenuItem::icon() const
+{
+ if (!m_iconLoader)
+ return QQuickPlatformIcon();
+
+ return m_iconLoader->icon();
+}
+
+void QQuickPlatformMenuItem::setIcon(const QQuickPlatformIcon &icon)
+{
+ if (iconLoader()->icon() == icon)
+ return;
+
+ iconLoader()->setIcon(icon);
+ emit iconChanged();
+}
+
+/*!
\qmlmethod void Qt.labs.platform::MenuItem::toggle()
Toggles the \l checked state to its opposite state.
@@ -604,7 +618,7 @@ void QQuickPlatformMenuItem::updateIcon()
if (!m_handle || !m_iconLoader)
return;
- m_handle->setIcon(m_iconLoader->icon());
+ m_handle->setIcon(m_iconLoader->toQIcon());
sync();
}
diff --git a/src/imports/platform/qquickplatformmenuitem_p.h b/src/imports/platform/qquickplatformmenuitem_p.h
index 6ff3ad81..f1143e64 100644
--- a/src/imports/platform/qquickplatformmenuitem_p.h
+++ b/src/imports/platform/qquickplatformmenuitem_p.h
@@ -55,6 +55,8 @@
#include <QtQml/qqmlparserstatus.h>
#include <QtQml/qqml.h>
+#include "qquickplatformicon_p.h"
+
QT_BEGIN_NAMESPACE
class QPlatformMenuItem;
@@ -80,6 +82,7 @@ class QQuickPlatformMenuItem : public QObject, public QQmlParserStatus
Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
Q_PROPERTY(QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged FINAL)
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged FINAL)
+ Q_PROPERTY(QQuickPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION 1)
Q_ENUMS(QPlatformMenuItem::MenuRole)
public:
@@ -132,6 +135,9 @@ public:
QFont font() const;
void setFont(const QFont &font);
+ QQuickPlatformIcon icon() const;
+ void setIcon(const QQuickPlatformIcon &icon);
+
public Q_SLOTS:
void toggle();
@@ -153,6 +159,7 @@ Q_SIGNALS:
void iconNameChanged();
void shortcutChanged();
void fontChanged();
+ Q_REVISION(1) void iconChanged();
protected:
void classBegin() override;
diff --git a/src/imports/platform/qquickplatformmessagedialog.cpp b/src/imports/platform/qquickplatformmessagedialog.cpp
index 14184447..ffc4b296 100644
--- a/src/imports/platform/qquickplatformmessagedialog.cpp
+++ b/src/imports/platform/qquickplatformmessagedialog.cpp
@@ -376,7 +376,7 @@ void QQuickPlatformMessageDialog::handleClick(QPlatformDialogHelper::StandardBut
case QPlatformDialogHelper::Apply: emit applyClicked(); break;
case QPlatformDialogHelper::Reset: emit resetClicked(); break;
case QPlatformDialogHelper::RestoreDefaults: emit restoreDefaultsClicked(); break;
- default: qmlWarning(this) << "unknown button" << button; break;
+ default: qmlWarning(this) << "unknown button" << int(button); break;
}
}
diff --git a/src/imports/platform/qquickplatformsystemtrayicon.cpp b/src/imports/platform/qquickplatformsystemtrayicon.cpp
index 8b5d5f7b..202bc3bf 100644
--- a/src/imports/platform/qquickplatformsystemtrayicon.cpp
+++ b/src/imports/platform/qquickplatformsystemtrayicon.cpp
@@ -67,7 +67,7 @@ QT_BEGIN_NAMESPACE
\code
SystemTrayIcon {
visible: true
- iconSource: "qrc:/images/tray-icon.png"
+ icon.source: "qrc:/images/tray-icon.png"
onActivated: {
window.show()
@@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE
\code
SystemTrayIcon {
visible: true
- iconSource: "qrc:/images/tray-icon.png"
+ icon.source: "qrc:/images/tray-icon.png"
menu: Menu {
MenuItem {
@@ -111,7 +111,7 @@ QT_BEGIN_NAMESPACE
\code
SystemTrayIcon {
visible: true
- iconSource: "qrc:/images/tray-icon.png"
+ icon.source: "qrc:/images/tray-icon.png"
onMessageClicked: console.log("Message clicked")
Component.onCompleted: showMessage("Message title", "Something important came up. Click this to know more.")
@@ -254,49 +254,43 @@ void QQuickPlatformSystemTrayIcon::setVisible(bool visible)
/*!
\qmlproperty url Qt.labs.platform::SystemTrayIcon::iconSource
-
- This property holds the url of the system tray icon.
-
- \sa iconName
+ \deprecated Use icon.source instead.
+ \sa icon
*/
QUrl QQuickPlatformSystemTrayIcon::iconSource() const
{
- if (!m_iconLoader)
- return QUrl();
-
- return m_iconLoader->iconSource();
+ return icon().source();
}
void QQuickPlatformSystemTrayIcon::setIconSource(const QUrl& source)
{
- if (source == iconSource())
+ QQuickPlatformIcon newIcon = icon();
+ if (source == newIcon.source())
return;
- iconLoader()->setIconSource(source);
+ newIcon.setSource(source);
+ iconLoader()->setIcon(newIcon);
emit iconSourceChanged();
}
/*!
\qmlproperty string Qt.labs.platform::SystemTrayIcon::iconName
-
- This property holds the theme name of the system tray icon.
-
- \sa iconSource, QIcon::fromTheme()
+ \deprecated Use icon.name instead.
+ \sa icon
*/
QString QQuickPlatformSystemTrayIcon::iconName() const
{
- if (!m_iconLoader)
- return QString();
-
- return m_iconLoader->iconName();
+ return icon().name();
}
void QQuickPlatformSystemTrayIcon::setIconName(const QString& name)
{
- if (name == iconName())
+ QQuickPlatformIcon newIcon = icon();
+ if (name == newIcon.name())
return;
- iconLoader()->setIconName(name);
+ newIcon.setName(name);
+ iconLoader()->setIcon(newIcon);
emit iconNameChanged();
}
@@ -350,6 +344,50 @@ void QQuickPlatformSystemTrayIcon::setMenu(QQuickPlatformMenu *menu)
}
/*!
+ \since Qt.labs.platform 1.1 (Qt 5.12)
+ \qmlproperty rect Qt.labs.platform::SystemTrayIcon::geometry
+
+ This property holds the geometry of the system tray icon.
+*/
+QRect QQuickPlatformSystemTrayIcon::geometry() const
+{
+ return m_handle ? m_handle->geometry() : QRect();
+}
+
+/*!
+ \since Qt.labs.platform 1.1 (Qt 5.12)
+ \qmlpropertygroup Qt.labs.platform::SystemTrayIcon::icon
+ \qmlproperty url Qt.labs.platform::SystemTrayIcon::icon.source
+ \qmlproperty string Qt.labs.platform::SystemTrayIcon::icon.name
+ \qmlproperty bool Qt.labs.platform::SystemTrayIcon::icon.mask
+
+ This property holds the system tray icon.
+
+ \code
+ SystemTrayIcon {
+ icon.mask: true
+ icon.source: "qrc:/images/tray-icon.png"
+ }
+ \endcode
+*/
+QQuickPlatformIcon QQuickPlatformSystemTrayIcon::icon() const
+{
+ if (!m_iconLoader)
+ return QQuickPlatformIcon();
+
+ return m_iconLoader->icon();
+}
+
+void QQuickPlatformSystemTrayIcon::setIcon(const QQuickPlatformIcon &icon)
+{
+ if (iconLoader()->icon() == icon)
+ return;
+
+ iconLoader()->setIcon(icon);
+ emit iconChanged();
+}
+
+/*!
\qmlmethod void Qt.labs.platform::SystemTrayIcon::show()
Shows the system tray icon.
@@ -435,7 +473,12 @@ void QQuickPlatformSystemTrayIcon::updateIcon()
if (!m_handle || !m_iconLoader)
return;
- m_handle->updateIcon(m_iconLoader->icon());
+ const QRect oldGeometry = m_handle->geometry();
+
+ m_handle->updateIcon(m_iconLoader->toQIcon());
+
+ if (oldGeometry != m_handle->geometry())
+ emit geometryChanged();
}
QT_END_NAMESPACE
diff --git a/src/imports/platform/qquickplatformsystemtrayicon_p.h b/src/imports/platform/qquickplatformsystemtrayicon_p.h
index 77a78f30..e43366cb 100644
--- a/src/imports/platform/qquickplatformsystemtrayicon_p.h
+++ b/src/imports/platform/qquickplatformsystemtrayicon_p.h
@@ -49,10 +49,13 @@
//
#include <QtCore/qurl.h>
+#include <QtCore/qrect.h>
#include <QtGui/qpa/qplatformsystemtrayicon.h>
#include <QtQml/qqmlparserstatus.h>
#include <QtQml/qqml.h>
+#include "qquickplatformicon_p.h"
+
QT_REQUIRE_CONFIG(systemtrayicon);
QT_BEGIN_NAMESPACE
@@ -71,6 +74,8 @@ class QQuickPlatformSystemTrayIcon : public QObject, public QQmlParserStatus
Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged FINAL)
Q_PROPERTY(QString tooltip READ tooltip WRITE setTooltip NOTIFY tooltipChanged FINAL)
Q_PROPERTY(QQuickPlatformMenu *menu READ menu WRITE setMenu NOTIFY menuChanged FINAL)
+ Q_PROPERTY(QRect geometry READ geometry NOTIFY geometryChanged FINAL REVISION 1)
+ Q_PROPERTY(QQuickPlatformIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL REVISION 1)
Q_ENUMS(QPlatformSystemTrayIcon::ActivationReason QPlatformSystemTrayIcon::MessageIcon)
public:
@@ -97,6 +102,11 @@ public:
QQuickPlatformMenu *menu() const;
void setMenu(QQuickPlatformMenu *menu);
+ QRect geometry() const;
+
+ QQuickPlatformIcon icon() const;
+ void setIcon(const QQuickPlatformIcon &icon);
+
public Q_SLOTS:
void show();
void hide();
@@ -112,6 +122,8 @@ Q_SIGNALS:
void iconNameChanged();
void tooltipChanged();
void menuChanged();
+ Q_REVISION(1) void geometryChanged();
+ Q_REVISION(1) void iconChanged();
protected:
void init();
diff --git a/src/imports/platform/qtlabsplatformplugin.cpp b/src/imports/platform/qtlabsplatformplugin.cpp
index 1eac7d80..b92c1ea0 100644
--- a/src/imports/platform/qtlabsplatformplugin.cpp
+++ b/src/imports/platform/qtlabsplatformplugin.cpp
@@ -56,12 +56,7 @@
# include "qquickplatformsystemtrayicon_p.h"
#endif
-static inline void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_Qt_labs_platform);
-#endif
-}
+#include "qquickplatformicon_p.h"
QT_BEGIN_NAMESPACE
@@ -81,7 +76,6 @@ public:
QtLabsPlatformPlugin::QtLabsPlatformPlugin(QObject *parent) : QQmlExtensionPlugin(parent)
{
- initResources();
}
void QtLabsPlatformPlugin::registerTypes(const char *uri)
@@ -108,9 +102,13 @@ void QtLabsPlatformPlugin::registerTypes(const char *uri)
#if QT_CONFIG(systemtrayicon)
qmlRegisterType<QQuickPlatformSystemTrayIcon>(uri, 1, 0, "SystemTrayIcon");
+ qmlRegisterType<QQuickPlatformSystemTrayIcon, 1>(uri, 1, 1, "SystemTrayIcon");
qRegisterMetaType<QPlatformSystemTrayIcon::ActivationReason>();
qRegisterMetaType<QPlatformSystemTrayIcon::MessageIcon>();
#endif
+
+ qmlRegisterType<QQuickPlatformIcon>();
+ qRegisterMetaType<QQuickPlatformIcon>();
}
QT_END_NAMESPACE
diff --git a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
index 1cdfcfde..e406ff03 100644
--- a/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
+++ b/src/imports/platform/widgets/qwidgetplatformsystemtrayicon.cpp
@@ -84,6 +84,8 @@ void QWidgetPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu)
return;
m_systray->setContextMenu(widgetMenu->menu());
+#else
+ Q_UNUSED(menu);
#endif
}
diff --git a/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc b/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc
index 695156b4..01e70bb2 100644
--- a/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc
+++ b/src/imports/templates/doc/src/qtquicktemplates2-qmltypes.qdoc
@@ -26,7 +26,7 @@
****************************************************************************/
/*!
- \qmlmodule QtQuick.Templates 2.4
+ \qmlmodule QtQuick.Templates 2.5
\title Qt Quick Templates 2 QML Types
\ingroup qmlmodules
\brief Provides QML types for templates (Qt Quick Templates).
@@ -38,7 +38,7 @@
\c .qml file:
\badcode
- import QtQuick.Templates 2.4 as T
+ import QtQuick.Templates 2.5 as T
\endcode
For the sake of clarity, there is a one-to-one mapping between the types
diff --git a/src/imports/templates/plugins.qmltypes b/src/imports/templates/plugins.qmltypes
index 0283f50d..96c1b5c0 100644
--- a/src/imports/templates/plugins.qmltypes
+++ b/src/imports/templates/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.4'
+// 'qmlplugindump -nonrelocatable -dependencies dependencies.json QtQuick.Templates 2.5'
Module {
dependencies: ["QtQuick 2.9", "QtQuick.Window 2.2"]
@@ -16,9 +16,10 @@ Module {
"QtQuick.Templates/AbstractButton 2.0",
"QtQuick.Templates/AbstractButton 2.2",
"QtQuick.Templates/AbstractButton 2.3",
- "QtQuick.Templates/AbstractButton 2.4"
+ "QtQuick.Templates/AbstractButton 2.4",
+ "QtQuick.Templates/AbstractButton 2.5"
]
- exportMetaObjectRevisions: [0, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 2, 3, 4, 5]
Enum {
name: "Display"
values: {
@@ -43,6 +44,8 @@ Module {
Property { name: "autoRepeatInterval"; revision: 4; type: "int" }
Property { name: "pressX"; revision: 4; type: "double"; isReadonly: true }
Property { name: "pressY"; revision: 4; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "pressed" }
Signal { name: "released" }
Signal { name: "canceled" }
@@ -57,6 +60,8 @@ Module {
Signal { name: "autoRepeatIntervalChanged"; revision: 4 }
Signal { name: "pressXChanged"; revision: 4 }
Signal { name: "pressYChanged"; revision: 4 }
+ Signal { name: "implicitIndicatorWidthChanged"; revision: 5 }
+ Signal { name: "implicitIndicatorHeightChanged"; revision: 5 }
Method { name: "toggle" }
}
Component {
@@ -267,9 +272,10 @@ Module {
exports: [
"QtQuick.Templates/ComboBox 2.0",
"QtQuick.Templates/ComboBox 2.1",
- "QtQuick.Templates/ComboBox 2.2"
+ "QtQuick.Templates/ComboBox 2.2",
+ "QtQuick.Templates/ComboBox 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2]
+ exportMetaObjectRevisions: [0, 1, 2, 5]
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "model"; type: "QVariant" }
Property { name: "delegateModel"; type: "QQmlInstanceModel"; isReadonly: true; isPointer: true }
@@ -290,6 +296,8 @@ Module {
Property { name: "inputMethodHints"; revision: 2; type: "Qt::InputMethodHints" }
Property { name: "inputMethodComposing"; revision: 2; type: "bool"; isReadonly: true }
Property { name: "acceptableInput"; revision: 2; type: "bool"; isReadonly: true }
+ Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true }
Signal {
name: "activated"
Parameter { name: "index"; type: "int" }
@@ -307,6 +315,8 @@ Module {
Signal { name: "inputMethodHintsChanged"; revision: 2 }
Signal { name: "inputMethodComposingChanged"; revision: 2 }
Signal { name: "acceptableInputChanged"; revision: 2 }
+ Signal { name: "implicitIndicatorWidthChanged"; revision: 5 }
+ Signal { name: "implicitIndicatorHeightChanged"; revision: 5 }
Method { name: "incrementCurrentIndex" }
Method { name: "decrementCurrentIndex" }
Method { name: "selectAll"; revision: 2 }
@@ -334,15 +344,20 @@ Module {
exports: [
"QtQuick.Templates/Container 2.0",
"QtQuick.Templates/Container 2.1",
- "QtQuick.Templates/Container 2.3"
+ "QtQuick.Templates/Container 2.3",
+ "QtQuick.Templates/Container 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
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 }
+ Property { name: "contentWidth"; revision: 5; type: "double" }
+ Property { name: "contentHeight"; revision: 5; type: "double" }
+ Signal { name: "contentWidthChanged"; revision: 5 }
+ Signal { name: "contentHeightChanged"; revision: 5 }
Method {
name: "setCurrentIndex"
Parameter { name: "index"; type: "int" }
@@ -379,15 +394,17 @@ Module {
Parameter { name: "index"; type: "int" }
}
}
+ Component { name: "QQuickContentItem"; defaultProperty: "data"; prototype: "QQuickItem" }
Component {
name: "QQuickControl"
defaultProperty: "data"
prototype: "QQuickItem"
exports: [
"QtQuick.Templates/Control 2.0",
- "QtQuick.Templates/Control 2.3"
+ "QtQuick.Templates/Control 2.3",
+ "QtQuick.Templates/Control 2.5"
]
- exportMetaObjectRevisions: [0, 3]
+ exportMetaObjectRevisions: [0, 3, 5]
Property { name: "font"; type: "QFont" }
Property { name: "availableWidth"; type: "double"; isReadonly: true }
Property { name: "availableHeight"; type: "double"; isReadonly: true }
@@ -407,8 +424,29 @@ Module {
Property { name: "wheelEnabled"; type: "bool" }
Property { name: "background"; type: "QQuickItem"; isPointer: true }
Property { name: "contentItem"; type: "QQuickItem"; isPointer: true }
+ Property { name: "baselineOffset"; type: "double" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "horizontalPadding"; revision: 5; type: "double" }
+ Property { name: "verticalPadding"; revision: 5; type: "double" }
+ Property { name: "implicitContentWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitContentHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "topInset"; revision: 5; type: "double" }
+ Property { name: "leftInset"; revision: 5; type: "double" }
+ Property { name: "rightInset"; revision: 5; type: "double" }
+ Property { name: "bottomInset"; revision: 5; type: "double" }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "horizontalPaddingChanged"; revision: 5 }
+ Signal { name: "verticalPaddingChanged"; revision: 5 }
+ Signal { name: "implicitContentWidthChanged"; revision: 5 }
+ Signal { name: "implicitContentHeightChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundWidthChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundHeightChanged"; revision: 5 }
+ Signal { name: "topInsetChanged"; revision: 5 }
+ Signal { name: "leftInsetChanged"; revision: 5 }
+ Signal { name: "rightInsetChanged"; revision: 5 }
+ Signal { name: "bottomInsetChanged"; revision: 5 }
}
Component {
name: "QQuickDelayButton"
@@ -457,9 +495,10 @@ Module {
prototype: "QQuickPopup"
exports: [
"QtQuick.Templates/Dialog 2.1",
- "QtQuick.Templates/Dialog 2.3"
+ "QtQuick.Templates/Dialog 2.3",
+ "QtQuick.Templates/Dialog 2.5"
]
- exportMetaObjectRevisions: [0, 3]
+ exportMetaObjectRevisions: [0, 3, 5]
Enum {
name: "StandardCode"
values: {
@@ -472,6 +511,10 @@ Module {
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
Property { name: "result"; revision: 3; type: "int" }
+ Property { name: "implicitHeaderWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHeaderHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "accepted" }
Signal { name: "rejected" }
Signal { name: "applied"; revision: 3 }
@@ -498,9 +541,10 @@ Module {
prototype: "QQuickContainer"
exports: [
"QtQuick.Templates/DialogButtonBox 2.1",
- "QtQuick.Templates/DialogButtonBox 2.3"
+ "QtQuick.Templates/DialogButtonBox 2.3",
+ "QtQuick.Templates/DialogButtonBox 2.5"
]
- exportMetaObjectRevisions: [0, 3]
+ exportMetaObjectRevisions: [0, 3, 5]
attachedType: "QQuickDialogButtonBoxAttached"
Enum {
name: "Position"
@@ -509,10 +553,23 @@ Module {
"Footer": 1
}
}
+ Enum {
+ name: "ButtonLayout"
+ values: {
+ "UnknownLayout": -1,
+ "WinLayout": 0,
+ "MacLayout": 1,
+ "KdeLayout": 2,
+ "GnomeLayout": 3,
+ "MacModelessLayout": 4,
+ "AndroidLayout": 5
+ }
+ }
Property { name: "position"; type: "Position" }
Property { name: "alignment"; type: "Qt::Alignment" }
Property { name: "standardButtons"; type: "QPlatformDialogHelper::StandardButtons" }
Property { name: "delegate"; type: "QQmlComponent"; isPointer: true }
+ Property { name: "buttonLayout"; revision: 5; type: "ButtonLayout" }
Signal { name: "accepted" }
Signal { name: "rejected" }
Signal { name: "helpRequested" }
@@ -523,6 +580,7 @@ Module {
Signal { name: "applied"; revision: 3 }
Signal { name: "reset"; revision: 3 }
Signal { name: "discarded"; revision: 3 }
+ Signal { name: "buttonLayoutChanged"; revision: 5 }
Method {
name: "standardButton"
type: "QQuickAbstractButton*"
@@ -561,10 +619,17 @@ Module {
name: "QQuickGroupBox"
defaultProperty: "contentData"
prototype: "QQuickFrame"
- exports: ["QtQuick.Templates/GroupBox 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/GroupBox 2.0",
+ "QtQuick.Templates/GroupBox 2.5"
+ ]
+ exportMetaObjectRevisions: [0, 5]
Property { name: "title"; type: "string" }
Property { name: "label"; type: "QQuickItem"; isPointer: true }
+ Property { name: "implicitLabelWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitLabelHeight"; revision: 5; type: "double"; isReadonly: true }
+ Signal { name: "implicitLabelWidthChanged"; revision: 5 }
+ Signal { name: "implicitLabelHeightChanged"; revision: 5 }
}
Component {
name: "QQuickIcon"
@@ -811,18 +876,22 @@ Module {
Component {
name: "QQuickPage"
defaultProperty: "contentData"
- prototype: "QQuickControl"
- exports: ["QtQuick.Templates/Page 2.0", "QtQuick.Templates/Page 2.1"]
- exportMetaObjectRevisions: [0, 1]
+ prototype: "QQuickPane"
+ exports: [
+ "QtQuick.Templates/Page 2.0",
+ "QtQuick.Templates/Page 2.1",
+ "QtQuick.Templates/Page 2.5"
+ ]
+ exportMetaObjectRevisions: [0, 1, 5]
Property { name: "title"; type: "string" }
Property { name: "header"; type: "QQuickItem"; isPointer: true }
Property { name: "footer"; type: "QQuickItem"; isPointer: true }
- Property { name: "contentData"; type: "QObject"; isList: true; isReadonly: true }
- Property { name: "contentChildren"; type: "QQuickItem"; isList: true; isReadonly: true }
Property { name: "contentWidth"; revision: 1; type: "double" }
Property { name: "contentHeight"; revision: 1; type: "double" }
- Signal { name: "contentWidthChanged"; revision: 1 }
- Signal { name: "contentHeightChanged"; revision: 1 }
+ Property { name: "implicitHeaderWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHeaderHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitFooterHeight"; revision: 5; type: "double"; isReadonly: true }
}
Component {
name: "QQuickPageIndicator"
@@ -853,9 +922,10 @@ Module {
exports: [
"QtQuick.Templates/Popup 2.0",
"QtQuick.Templates/Popup 2.1",
- "QtQuick.Templates/Popup 2.3"
+ "QtQuick.Templates/Popup 2.3",
+ "QtQuick.Templates/Popup 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
Enum {
name: "ClosePolicy"
values: {
@@ -926,6 +996,23 @@ Module {
Property { name: "mirrored"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "enabled"; revision: 3; type: "bool" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "horizontalPadding"; type: "double" }
+ Property { name: "verticalPadding"; type: "double" }
+ Property {
+ name: "anchors"
+ revision: 5
+ type: "QQuickPopupAnchors"
+ isReadonly: true
+ isPointer: true
+ }
+ Property { name: "implicitContentWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitContentHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitBackgroundHeight"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "topInset"; revision: 5; type: "double" }
+ Property { name: "leftInset"; revision: 5; type: "double" }
+ Property { name: "rightInset"; revision: 5; type: "double" }
+ Property { name: "bottomInset"; revision: 5; type: "double" }
Signal { name: "opened" }
Signal { name: "closed" }
Signal { name: "aboutToShow" }
@@ -939,6 +1026,16 @@ Module {
Signal { name: "mirroredChanged"; revision: 3 }
Signal { name: "enabledChanged"; revision: 3 }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "horizontalPaddingChanged"; revision: 5 }
+ Signal { name: "verticalPaddingChanged"; revision: 5 }
+ Signal { name: "implicitContentWidthChanged"; revision: 5 }
+ Signal { name: "implicitContentHeightChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundWidthChanged"; revision: 5 }
+ Signal { name: "implicitBackgroundHeightChanged"; revision: 5 }
+ Signal { name: "topInsetChanged"; revision: 5 }
+ Signal { name: "leftInsetChanged"; revision: 5 }
+ Signal { name: "rightInsetChanged"; revision: 5 }
+ Signal { name: "bottomInsetChanged"; revision: 5 }
Method { name: "open" }
Method { name: "close" }
Method {
@@ -948,6 +1045,12 @@ Module {
Method { name: "forceActiveFocus" }
}
Component {
+ name: "QQuickPopupAnchors"
+ prototype: "QObject"
+ Property { name: "centerIn"; type: "QQuickItem"; isPointer: true }
+ }
+ Component { name: "QQuickPopupItem"; defaultProperty: "contentData"; prototype: "QQuickPage" }
+ Component {
name: "QQuickProgressBar"
defaultProperty: "data"
prototype: "QQuickControl"
@@ -982,9 +1085,10 @@ Module {
"QtQuick.Templates/RangeSlider 2.0",
"QtQuick.Templates/RangeSlider 2.1",
"QtQuick.Templates/RangeSlider 2.2",
- "QtQuick.Templates/RangeSlider 2.3"
+ "QtQuick.Templates/RangeSlider 2.3",
+ "QtQuick.Templates/RangeSlider 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2, 3]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 5]
Enum {
name: "SnapMode"
values: {
@@ -1003,12 +1107,20 @@ Module {
Property { name: "live"; revision: 2; type: "bool" }
Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true }
+ Property { name: "touchDragThreshold"; revision: 5; type: "double" }
Signal { name: "liveChanged"; revision: 2 }
+ Signal { name: "touchDragThresholdChanged"; revision: 5 }
Method {
name: "setValues"
Parameter { name: "firstValue"; type: "double" }
Parameter { name: "secondValue"; type: "double" }
}
+ Method {
+ name: "valueAt"
+ revision: 5
+ type: "double"
+ Parameter { name: "position"; type: "double" }
+ }
}
Component {
name: "QQuickRangeSliderNode"
@@ -1019,7 +1131,10 @@ Module {
Property { name: "handle"; type: "QQuickItem"; isPointer: true }
Property { name: "pressed"; type: "bool" }
Property { name: "hovered"; revision: 1; type: "bool" }
+ Property { name: "implicitHandleWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHandleHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "moved" }
Method { name: "increase" }
Method { name: "decrease" }
}
@@ -1137,13 +1252,9 @@ Module {
Component {
name: "QQuickScrollView"
defaultProperty: "contentData"
- prototype: "QQuickControl"
+ prototype: "QQuickPane"
exports: ["QtQuick.Templates/ScrollView 2.2"]
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: "QQuickSlider"
@@ -1153,9 +1264,10 @@ Module {
"QtQuick.Templates/Slider 2.0",
"QtQuick.Templates/Slider 2.1",
"QtQuick.Templates/Slider 2.2",
- "QtQuick.Templates/Slider 2.3"
+ "QtQuick.Templates/Slider 2.3",
+ "QtQuick.Templates/Slider 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2, 3]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 5]
Enum {
name: "SnapMode"
values: {
@@ -1177,8 +1289,14 @@ Module {
Property { name: "live"; revision: 2; type: "bool" }
Property { name: "horizontal"; revision: 3; type: "bool"; isReadonly: true }
Property { name: "vertical"; revision: 3; type: "bool"; isReadonly: true }
+ Property { name: "touchDragThreshold"; revision: 5; type: "double" }
+ Property { name: "implicitHandleWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitHandleHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "moved"; revision: 2 }
Signal { name: "liveChanged"; revision: 2 }
+ Signal { name: "touchDragThresholdChanged"; revision: 5 }
+ Signal { name: "implicitHandleWidthChanged"; revision: 5 }
+ Signal { name: "implicitHandleHeightChanged"; revision: 5 }
Method { name: "increase" }
Method { name: "decrease" }
Method {
@@ -1197,9 +1315,10 @@ Module {
"QtQuick.Templates/SpinBox 2.1",
"QtQuick.Templates/SpinBox 2.2",
"QtQuick.Templates/SpinBox 2.3",
- "QtQuick.Templates/SpinBox 2.4"
+ "QtQuick.Templates/SpinBox 2.4",
+ "QtQuick.Templates/SpinBox 2.5"
]
- exportMetaObjectRevisions: [0, 1, 2, 3, 4]
+ exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5]
Property { name: "from"; type: "int" }
Property { name: "to"; type: "int" }
Property { name: "value"; type: "int" }
@@ -1228,7 +1347,11 @@ Module {
Property { name: "pressed"; type: "bool" }
Property { name: "indicator"; type: "QQuickItem"; isPointer: true }
Property { name: "hovered"; revision: 1; type: "bool" }
+ Property { name: "implicitIndicatorWidth"; revision: 5; type: "double"; isReadonly: true }
+ Property { name: "implicitIndicatorHeight"; revision: 5; type: "double"; isReadonly: true }
Signal { name: "hoveredChanged"; revision: 1 }
+ Signal { name: "implicitIndicatorWidthChanged"; revision: 5 }
+ Signal { name: "implicitIndicatorHeightChanged"; revision: 5 }
}
Component {
name: "QQuickStackView"
@@ -1445,8 +1568,6 @@ Module {
Property { name: "position"; type: "Position" }
Property { name: "contentWidth"; revision: 2; type: "double" }
Property { name: "contentHeight"; revision: 2; type: "double" }
- Signal { name: "contentWidthChanged"; revision: 2 }
- Signal { name: "contentHeightChanged"; revision: 2 }
}
Component {
name: "QQuickTabBarAttached"
@@ -1469,9 +1590,10 @@ Module {
exports: [
"QtQuick.Templates/TextArea 2.0",
"QtQuick.Templates/TextArea 2.1",
- "QtQuick.Templates/TextArea 2.3"
+ "QtQuick.Templates/TextArea 2.3",
+ "QtQuick.Templates/TextArea 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
attachedType: "QQuickTextAreaAttached"
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
@@ -1482,6 +1604,7 @@ Module {
Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "placeholderTextColor"; revision: 5; type: "QColor" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
Signal {
@@ -1501,6 +1624,7 @@ Module {
Signal { name: "hoveredChanged"; revision: 1 }
Signal { name: "hoverEnabledChanged"; revision: 1 }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "placeholderTextColorChanged"; revision: 5 }
}
Component {
name: "QQuickTextAreaAttached"
@@ -1514,9 +1638,10 @@ Module {
exports: [
"QtQuick.Templates/TextField 2.0",
"QtQuick.Templates/TextField 2.1",
- "QtQuick.Templates/TextField 2.3"
+ "QtQuick.Templates/TextField 2.3",
+ "QtQuick.Templates/TextField 2.5"
]
- exportMetaObjectRevisions: [0, 1, 3]
+ exportMetaObjectRevisions: [0, 1, 3, 5]
Property { name: "font"; type: "QFont" }
Property { name: "implicitWidth"; type: "double" }
Property { name: "implicitHeight"; type: "double" }
@@ -1526,6 +1651,7 @@ Module {
Property { name: "hovered"; revision: 1; type: "bool"; isReadonly: true }
Property { name: "hoverEnabled"; revision: 1; type: "bool" }
Property { name: "palette"; revision: 3; type: "QPalette" }
+ Property { name: "placeholderTextColor"; revision: 5; type: "QColor" }
Signal { name: "implicitWidthChanged3" }
Signal { name: "implicitHeightChanged3" }
Signal {
@@ -1545,6 +1671,7 @@ Module {
Signal { name: "hoveredChanged"; revision: 1 }
Signal { name: "hoverEnabledChanged"; revision: 1 }
Signal { name: "paletteChanged"; revision: 3 }
+ Signal { name: "placeholderTextColorChanged"; revision: 5 }
}
Component {
name: "QQuickToolBar"
@@ -1582,12 +1709,27 @@ Module {
name: "QQuickToolTip"
defaultProperty: "contentData"
prototype: "QQuickPopup"
- exports: ["QtQuick.Templates/ToolTip 2.0"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtQuick.Templates/ToolTip 2.0",
+ "QtQuick.Templates/ToolTip 2.5"
+ ]
+ exportMetaObjectRevisions: [0, 5]
attachedType: "QQuickToolTipAttached"
Property { name: "delay"; type: "int" }
Property { name: "timeout"; type: "int" }
Property { name: "text"; type: "string" }
+ Method {
+ name: "show"
+ revision: 5
+ Parameter { name: "text"; type: "string" }
+ Parameter { name: "ms"; type: "int" }
+ }
+ Method {
+ name: "show"
+ revision: 5
+ Parameter { name: "text"; type: "string" }
+ }
+ Method { name: "hide"; revision: 5 }
}
Component {
name: "QQuickToolTipAttached"
@@ -1619,6 +1761,17 @@ Module {
]
exportMetaObjectRevisions: [0, 1, 2]
attachedType: "QQuickTumblerAttached"
+ Enum {
+ name: "PositionMode"
+ values: {
+ "Beginning": 0,
+ "Center": 1,
+ "End": 2,
+ "Visible": 3,
+ "Contain": 4,
+ "SnapPosition": 5
+ }
+ }
Property { name: "model"; type: "QVariant" }
Property { name: "count"; type: "int"; isReadonly: true }
Property { name: "currentIndex"; type: "int" }
@@ -1629,6 +1782,12 @@ Module {
Property { name: "moving"; revision: 2; type: "bool"; isReadonly: true }
Signal { name: "wrapChanged"; revision: 1 }
Signal { name: "movingChanged"; revision: 2 }
+ Method {
+ name: "positionViewAtIndex"
+ revision: 5
+ Parameter { name: "index"; type: "int" }
+ Parameter { name: "mode"; type: "PositionMode" }
+ }
}
Component {
name: "QQuickTumblerAttached"
diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp
index ec61b07c..ef7a646b 100644
--- a/src/imports/templates/qtquicktemplates2plugin.cpp
+++ b/src/imports/templates/qtquicktemplates2plugin.cpp
@@ -70,6 +70,7 @@
#include <QtQuickTemplates2/private/qquickpaletteprovider_p.h>
#include <QtQuickTemplates2/private/qquickpane_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
+#include <QtQuickTemplates2/private/qquickpopupanchors_p.h>
#include <QtQuickTemplates2/private/qquickprogressbar_p.h>
#include <QtQuickTemplates2/private/qquickradiobutton_p.h>
#include <QtQuickTemplates2/private/qquickradiodelegate_p.h>
@@ -99,13 +100,6 @@
#include <QtQuickTemplates2/private/qquicktumbler_p.h>
#endif
-static inline void initResources()
-{
-#ifdef QT_STATIC
- Q_INIT_RESOURCE(qmake_QtQuick_Templates_2);
-#endif
-}
-
#if QT_CONFIG(shortcut)
// qtdeclarative/src/quick/util/qquickshortcut.cpp
typedef bool (*ShortcutContextMatcher)(QObject *, Qt::ShortcutContext);
@@ -146,8 +140,6 @@ private:
QtQuickTemplates2Plugin::QtQuickTemplates2Plugin(QObject *parent)
: QQmlExtensionPlugin(parent), registered(false)
{
- initResources();
-
#if QT_CONFIG(shortcut)
originalContextMatcher = qt_quick_shortcut_context_matcher();
qt_quick_set_shortcut_context_matcher(QQuickShortcutContext::matcher);
@@ -329,6 +321,26 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri)
qmlRegisterType<QQuickScrollBar, 4>(uri, 2, 4, "ScrollBar");
qmlRegisterType<QQuickScrollIndicator, 4>(uri, 2, 4, "ScrollIndicator");
qmlRegisterType<QQuickSpinBox, 4>(uri, 2, 4, "SpinBox");
+
+ // QtQuick.Templates 2.5 (new types and revisions in Qt 5.12)
+ qmlRegisterType<QQuickAbstractButton, 5>(uri, 2, 5, "AbstractButton");
+ qmlRegisterType<QQuickDialogButtonBox, 5>(uri, 2, 5, "DialogButtonBox");
+ qmlRegisterType<QQuickComboBox, 5>(uri, 2, 5, "ComboBox");
+ qmlRegisterType<QQuickControl, 5>(uri, 2, 5, "Control");
+ qmlRegisterType<QQuickContainer, 5>(uri, 2, 5, "Container");
+ qmlRegisterType<QQuickDial, 5>(uri, 2, 5, "Dial");
+ qmlRegisterType<QQuickDialog, 5>(uri, 2, 5, "Dialog");
+ qmlRegisterType<QQuickGroupBox, 5>(uri, 2, 5, "GroupBox");
+ qmlRegisterType<QQuickLabel, 5>(uri, 2, 5, "Label");
+ qmlRegisterType<QQuickPage, 5>(uri, 2, 5, "Page");
+ qmlRegisterType<QQuickPopup, 5>(uri, 2, 5, "Popup");
+ qmlRegisterType<QQuickPopupAnchors>();
+ qmlRegisterType<QQuickRangeSlider, 5>(uri, 2, 5, "RangeSlider");
+ qmlRegisterType<QQuickSlider, 5>(uri, 2, 5, "Slider");
+ qmlRegisterType<QQuickSpinBox, 5>(uri, 2, 5, "SpinBox");
+ qmlRegisterType<QQuickTextArea, 5>(uri, 2, 5, "TextArea");
+ qmlRegisterType<QQuickTextField, 5>(uri, 2, 5, "TextField");
+ qmlRegisterType<QQuickToolTip, 5>(uri, 2, 5, "ToolTip");
}
QT_END_NAMESPACE
diff --git a/src/imports/templates/templates.pro b/src/imports/templates/templates.pro
index b505dceb..b132f47d 100644
--- a/src/imports/templates/templates.pro
+++ b/src/imports/templates/templates.pro
@@ -1,6 +1,6 @@
TARGET = qtquicktemplates2plugin
TARGETPATH = QtQuick/Templates.2
-IMPORT_VERSION = 2.4
+IMPORT_VERSION = 2.5
QT += qml quick
QT_PRIVATE += core-private gui-private qml-private quick-private quicktemplates2-private
diff --git a/src/quickcontrols2/qquickattachedobject.cpp b/src/quickcontrols2/qquickattachedobject.cpp
index bada982e..8b75e42a 100644
--- a/src/quickcontrols2/qquickattachedobject.cpp
+++ b/src/quickcontrols2/qquickattachedobject.cpp
@@ -36,8 +36,10 @@
#include "qquickattachedobject_p.h"
+#include <QtCore/qpointer.h>
#include <QtQuick/qquickwindow.h>
#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
QT_BEGIN_NAMESPACE
@@ -154,44 +156,102 @@ static QQuickItem *findAttachedItem(QObject *parent)
return item;
}
-QQuickAttachedObject::QQuickAttachedObject(QObject *parent) : QObject(parent)
+class QQuickAttachedObjectPrivate : public QObjectPrivate, public QQuickItemChangeListener
{
- attachTo(parent);
+ Q_DECLARE_PUBLIC(QQuickAttachedObject)
+
+public:
+ static QQuickAttachedObjectPrivate *get(QQuickAttachedObject *attachedObject)
+ {
+ return attachedObject->d_func();
+ }
+
+ void attachTo(QObject *object);
+ void detachFrom(QObject *object);
+
+ void itemWindowChanged(QQuickWindow *window);
+ void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
+
+ QList<QQuickAttachedObject *> attachedChildren;
+ QPointer<QQuickAttachedObject> attachedParent;
+};
+
+void QQuickAttachedObjectPrivate::attachTo(QObject *object)
+{
+ QQuickItem *item = findAttachedItem(object);
+ if (item) {
+ connect(item, &QQuickItem::windowChanged, this, &QQuickAttachedObjectPrivate::itemWindowChanged);
+ QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
+ }
+}
+
+void QQuickAttachedObjectPrivate::detachFrom(QObject *object)
+{
+ QQuickItem *item = findAttachedItem(object);
+ if (item) {
+ disconnect(item, &QQuickItem::windowChanged, this, &QQuickAttachedObjectPrivate::itemWindowChanged);
+ QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
+ }
+}
+
+void QQuickAttachedObjectPrivate::itemWindowChanged(QQuickWindow *window)
+{
+ Q_Q(QQuickAttachedObject);
+ QQuickAttachedObject *attachedParent = nullptr;
+ QQuickItem *item = qobject_cast<QQuickItem *>(q->sender());
+ if (item)
+ attachedParent = findAttachedParent(q->metaObject(), item);
+ if (!attachedParent)
+ attachedParent = attachedObject(q->metaObject(), window);
+ q->setAttachedParent(attachedParent);
+}
+
+void QQuickAttachedObjectPrivate::itemParentChanged(QQuickItem *item, QQuickItem *parent)
+{
+ Q_Q(QQuickAttachedObject);
+ Q_UNUSED(parent);
+ q->setAttachedParent(findAttachedParent(q->metaObject(), item));
}
-QQuickAttachedObject::QQuickAttachedObject(QObjectPrivate &dd, QObject *parent)
- : QObject(dd, parent)
+QQuickAttachedObject::QQuickAttachedObject(QObject *parent)
+ : QObject(*(new QQuickAttachedObjectPrivate), parent)
{
- attachTo(parent);
+ Q_D(QQuickAttachedObject);
+ d->attachTo(parent);
}
QQuickAttachedObject::~QQuickAttachedObject()
{
- detachFrom(parent());
+ Q_D(QQuickAttachedObject);
+ d->detachFrom(parent());
setAttachedParent(nullptr);
}
QList<QQuickAttachedObject *> QQuickAttachedObject::attachedChildren() const
{
- return m_attachedChildren;
+ Q_D(const QQuickAttachedObject);
+ return d->attachedChildren;
}
QQuickAttachedObject *QQuickAttachedObject::attachedParent() const
{
- return m_attachedParent;
+ Q_D(const QQuickAttachedObject);
+ return d->attachedParent;
}
void QQuickAttachedObject::setAttachedParent(QQuickAttachedObject *parent)
{
- if (m_attachedParent != parent) {
- QQuickAttachedObject *oldParent = m_attachedParent;
- if (m_attachedParent)
- m_attachedParent->m_attachedChildren.removeOne(this);
- m_attachedParent = parent;
- if (parent)
- parent->m_attachedChildren.append(this);
- attachedParentChange(parent, oldParent);
- }
+ Q_D(QQuickAttachedObject);
+ if (d->attachedParent == parent)
+ return;
+
+ QQuickAttachedObject *oldParent = d->attachedParent;
+ if (d->attachedParent)
+ QQuickAttachedObjectPrivate::get(d->attachedParent)->attachedChildren.removeOne(this);
+ d->attachedParent = parent;
+ if (parent)
+ QQuickAttachedObjectPrivate::get(parent)->attachedChildren.append(this);
+ attachedParentChange(parent, oldParent);
}
void QQuickAttachedObject::init()
@@ -211,39 +271,4 @@ void QQuickAttachedObject::attachedParentChange(QQuickAttachedObject *newParent,
Q_UNUSED(oldParent);
}
-void QQuickAttachedObject::itemWindowChanged(QQuickWindow *window)
-{
- QQuickAttachedObject *attachedParent = nullptr;
- QQuickItem *item = qobject_cast<QQuickItem *>(sender());
- if (item)
- attachedParent = findAttachedParent(metaObject(), item);
- if (!attachedParent)
- attachedParent = attachedObject(metaObject(), window);
- setAttachedParent(attachedParent);
-}
-
-void QQuickAttachedObject::itemParentChanged(QQuickItem *item, QQuickItem *parent)
-{
- Q_UNUSED(parent);
- setAttachedParent(findAttachedParent(metaObject(), item));
-}
-
-void QQuickAttachedObject::attachTo(QObject *object)
-{
- QQuickItem *item = findAttachedItem(object);
- if (item) {
- connect(item, &QQuickItem::windowChanged, this, &QQuickAttachedObject::itemWindowChanged);
- QQuickItemPrivate::get(item)->addItemChangeListener(this, QQuickItemPrivate::Parent);
- }
-}
-
-void QQuickAttachedObject::detachFrom(QObject *object)
-{
- QQuickItem *item = findAttachedItem(object);
- if (item) {
- disconnect(item, &QQuickItem::windowChanged, this, &QQuickAttachedObject::itemWindowChanged);
- QQuickItemPrivate::get(item)->removeItemChangeListener(this, QQuickItemPrivate::Parent);
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickattachedobject_p.h b/src/quickcontrols2/qquickattachedobject_p.h
index 5d4194ef..1e90c082 100644
--- a/src/quickcontrols2/qquickattachedobject_p.h
+++ b/src/quickcontrols2/qquickattachedobject_p.h
@@ -49,17 +49,14 @@
//
#include <QtQml/qqml.h>
-#include <QtCore/qlist.h>
#include <QtCore/qobject.h>
-#include <QtCore/qpointer.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
QT_BEGIN_NAMESPACE
-class QQuickWindow;
+class QQuickAttachedObjectPrivate;
-class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickAttachedObject : public QObject, public QQuickItemChangeListener
+class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickAttachedObject : public QObject
{
Q_OBJECT
@@ -73,21 +70,13 @@ public:
void setAttachedParent(QQuickAttachedObject *parent);
protected:
- QQuickAttachedObject(QObjectPrivate &dd, QObject *parent = nullptr);
-
void init();
virtual void attachedParentChange(QQuickAttachedObject *newParent, QQuickAttachedObject *oldParent);
- void itemWindowChanged(QQuickWindow *window);
- void itemParentChanged(QQuickItem *item, QQuickItem *parent) override;
-
private:
- void attachTo(QObject *object);
- void detachFrom(QObject *object);
-
- QList<QQuickAttachedObject *> m_attachedChildren;
- QPointer<QQuickAttachedObject> m_attachedParent;
+ Q_DISABLE_COPY(QQuickAttachedObject)
+ Q_DECLARE_PRIVATE(QQuickAttachedObject)
};
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickproxytheme.cpp b/src/quickcontrols2/qquickproxytheme.cpp
deleted file mode 100644
index 9b395b28..00000000
--- a/src/quickcontrols2/qquickproxytheme.cpp
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickproxytheme_p.h"
-
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/qpixmap.h>
-#include <QtGui/qfont.h>
-
-QT_BEGIN_NAMESPACE
-
-QQuickProxyTheme::QQuickProxyTheme(QPlatformTheme *theme)
- : m_theme(theme ? theme : QGuiApplicationPrivate::platform_theme)
-{
-}
-
-QQuickProxyTheme::~QQuickProxyTheme()
-{
- if (QGuiApplicationPrivate::platform_theme == this)
- QGuiApplicationPrivate::platform_theme = m_theme;
-}
-
-QPlatformTheme *QQuickProxyTheme::theme() const
-{
- return m_theme;
-}
-
-QPlatformMenuItem *QQuickProxyTheme::createPlatformMenuItem() const
-{
- if (m_theme)
- return m_theme->createPlatformMenuItem();
- return QPlatformTheme::createPlatformMenuItem();
-}
-
-QPlatformMenu *QQuickProxyTheme::createPlatformMenu() const
-{
- if (m_theme)
- return m_theme->createPlatformMenu();
- return QPlatformTheme::createPlatformMenu();
-}
-
-QPlatformMenuBar *QQuickProxyTheme::createPlatformMenuBar() const
-{
- if (m_theme)
- return m_theme->createPlatformMenuBar();
- return QPlatformTheme::createPlatformMenuBar();
-}
-
-void QQuickProxyTheme::showPlatformMenuBar()
-{
- if (m_theme)
- m_theme->showPlatformMenuBar();
- QPlatformTheme::showPlatformMenuBar();
-}
-
-bool QQuickProxyTheme::usePlatformNativeDialog(QPlatformTheme::DialogType type) const
-{
- if (m_theme)
- return m_theme->usePlatformNativeDialog(type);
- return QPlatformTheme::usePlatformNativeDialog(type);
-}
-
-QPlatformDialogHelper *QQuickProxyTheme::createPlatformDialogHelper(QPlatformTheme::DialogType type) const
-{
- if (m_theme)
- return m_theme->createPlatformDialogHelper(type);
- return QPlatformTheme::createPlatformDialogHelper(type);
-}
-
-#ifndef QT_NO_SYSTEMTRAYICON
-QPlatformSystemTrayIcon *QQuickProxyTheme::createPlatformSystemTrayIcon() const
-{
- if (m_theme)
- return m_theme->createPlatformSystemTrayIcon();
- return QPlatformTheme::createPlatformSystemTrayIcon();
-}
-#endif
-
-const QPalette *QQuickProxyTheme::palette(QPlatformTheme::Palette type) const
-{
- if (m_theme)
- return m_theme->palette(type);
- return QPlatformTheme::palette(type);
-}
-
-const QFont *QQuickProxyTheme::font(QPlatformTheme::Font type) const
-{
- if (m_theme)
- return m_theme->font(type);
- return QPlatformTheme::font(type);
-}
-
-QVariant QQuickProxyTheme::themeHint(QPlatformTheme::ThemeHint hint) const
-{
- if (m_theme)
- return m_theme->themeHint(hint);
- return QPlatformTheme::themeHint(hint);
-}
-
-QPixmap QQuickProxyTheme::standardPixmap(QPlatformTheme::StandardPixmap sp, const QSizeF &size) const
-{
- if (m_theme)
- return m_theme->standardPixmap(sp, size);
- return QPlatformTheme::standardPixmap(sp, size);
-}
-
-QIcon QQuickProxyTheme::fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions) const
-{
- if (m_theme)
- return m_theme->fileIcon(fileInfo, iconOptions);
- return QPlatformTheme::fileIcon(fileInfo, iconOptions);
-}
-
-QIconEngine *QQuickProxyTheme::createIconEngine(const QString &iconName) const
-{
- if (m_theme)
- return m_theme->createIconEngine(iconName);
- return QPlatformTheme::createIconEngine(iconName);
-}
-
-#if QT_CONFIG(shortcut)
-QList<QKeySequence> QQuickProxyTheme::keyBindings(QKeySequence::StandardKey key) const
-{
- if (m_theme)
- return m_theme->keyBindings(key);
- return QPlatformTheme::keyBindings(key);
-}
-#endif
-
-QString QQuickProxyTheme::standardButtonText(int button) const
-{
- if (m_theme)
- return m_theme->standardButtonText(button);
- return QPlatformTheme::standardButtonText(button);
-}
-
-QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 73c604de..b4901db3 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -43,7 +43,9 @@
#include <QtCore/qsettings.h>
#include <QtCore/qfileselector.h>
#include <QtCore/qlibraryinfo.h>
+#include <QtCore/qmetaobject.h>
#include <QtGui/qcolor.h>
+#include <QtGui/qfont.h>
#include <QtGui/qpalette.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qpa/qplatformtheme.h>
@@ -51,6 +53,8 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlfile.h>
+#include <functional>
+
QT_BEGIN_NAMESPACE
/*!
@@ -101,19 +105,25 @@ QT_BEGIN_NAMESPACE
\sa {Styling Qt Quick Controls 2}
*/
-// TODO: QQmlImportDatabase::defaultImportPathList()
+static QStringList envPathList(const QByteArray &var)
+{
+ QStringList paths;
+ if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty(var))) {
+ const QByteArray value = qgetenv(var);
+ paths += QString::fromLocal8Bit(value).split(QDir::listSeparator(), QString::SkipEmptyParts);
+ }
+ return paths;
+}
+
static QStringList defaultImportPathList()
{
QStringList importPaths;
importPaths.reserve(3);
+#ifndef QT_STATIC
importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
-
- if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
- const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
- importPaths += QString::fromLocal8Bit(envImportPath).split(QDir::listSeparator(), QString::SkipEmptyParts);
- }
-
- importPaths += QStringLiteral("qrc:/qt-project.org/imports");
+#endif
+ importPaths += envPathList("QML2_IMPORT_PATH");
+ importPaths += QStringLiteral(":/qt-project.org/imports");
importPaths += QCoreApplication::applicationDirPath();
return importPaths;
}
@@ -256,6 +266,7 @@ struct QQuickStyleSpec
QString fallbackStyle;
QByteArray fallbackMethod;
QString configFilePath;
+ QStringList customStylePaths;
};
Q_GLOBAL_STATIC(QQuickStyleSpec, styleSpec)
@@ -308,10 +319,18 @@ static QStringList parseStylePathsWithColon(const QString &var)
return paths;
}
-QStringList QQuickStylePrivate::stylePaths()
+QStringList QQuickStylePrivate::stylePaths(bool resolve)
{
- // system/custom style paths
+ // user-requested style path
QStringList paths;
+ if (resolve) {
+ QString path = styleSpec()->path();
+ if (path.endsWith(QLatin1Char('/')))
+ path.chop(1);
+ if (!path.isEmpty())
+ paths += path;
+ }
+
if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE_PATH"))) {
const QString value = QString::fromLocal8Bit(qgetenv("QT_QUICK_CONTROLS_STYLE_PATH"));
const QChar listSeparator = QDir::listSeparator();
@@ -327,6 +346,10 @@ QStringList QQuickStylePrivate::stylePaths()
}
}
+ // system/custom style paths
+ paths += styleSpec()->customStylePaths;
+ paths += envPathList("QT_QUICK_CONTROLS_STYLE_PATH");
+
// built-in import paths
const QString targetPath = QStringLiteral("QtQuick/Controls.2");
const QStringList importPaths = defaultImportPathList();
@@ -336,6 +359,7 @@ QStringList QQuickStylePrivate::stylePaths()
paths += dir.absolutePath();
}
+ paths.removeDuplicates();
return paths;
}
@@ -392,6 +416,81 @@ QSharedPointer<QSettings> QQuickStylePrivate::settings(const QString &group)
return QSharedPointer<QSettings>();
}
+#if QT_CONFIG(settings)
+static void readValue(const QSharedPointer<QSettings> &settings, const QString &name, std::function<void(const QVariant &)> setValue)
+{
+ const QVariant var = settings->value(name);
+ if (var.isValid())
+ setValue(var);
+}
+
+template <typename Enum>
+static Enum toEnumValue(const QVariant &var)
+{
+ // ### TODO: expose QFont enums to the meta object system using Q_ENUM
+ //QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
+ //bool ok = false;
+ //int value = enumeration.keyToValue(var.toByteArray(), &ok);
+ //if (!ok)
+ // value = var.toInt();
+ //return static_cast<Enum>(value);
+
+ return static_cast<Enum>(var.toInt());
+}
+
+const QFont *QQuickStylePrivate::readFont(const QSharedPointer<QSettings> &settings)
+{
+ const QVariant var = settings->value(QStringLiteral("Font"));
+ if (var.isValid())
+ return new QFont(var.value<QFont>());
+
+ QFont f;
+ settings->beginGroup(QStringLiteral("Font"));
+ readValue(settings, QStringLiteral("Family"), [&f](const QVariant &var) { f.setFamily(var.toString()); });
+ readValue(settings, QStringLiteral("PointSize"), [&f](const QVariant &var) { f.setPointSizeF(var.toReal()); });
+ readValue(settings, QStringLiteral("PixelSize"), [&f](const QVariant &var) { f.setPixelSize(var.toInt()); });
+ readValue(settings, QStringLiteral("StyleHint"), [&f](const QVariant &var) { f.setStyleHint(toEnumValue<QFont::StyleHint>(var.toInt())); });
+ readValue(settings, QStringLiteral("Weight"), [&f](const QVariant &var) { f.setWeight(toEnumValue<QFont::Weight>(var)); });
+ readValue(settings, QStringLiteral("Style"), [&f](const QVariant &var) { f.setStyle(toEnumValue<QFont::Style>(var.toInt())); });
+ settings->endGroup();
+ return new QFont(f);
+}
+
+static void readColorGroup(const QSharedPointer<QSettings> &settings, QPalette::ColorGroup group, QPalette *palette)
+{
+ const QStringList keys = settings->childKeys();
+ if (keys.isEmpty())
+ return;
+
+ static const int index = QPalette::staticMetaObject.indexOfEnumerator("ColorRole");
+ Q_ASSERT(index != -1);
+ QMetaEnum metaEnum = QPalette::staticMetaObject.enumerator(index);
+
+ for (const QString &key : keys) {
+ bool ok = false;
+ int role = metaEnum.keyToValue(key.toUtf8(), &ok);
+ if (ok)
+ palette->setColor(group, static_cast<QPalette::ColorRole>(role), settings->value(key).value<QColor>());
+ }
+}
+
+const QPalette *QQuickStylePrivate::readPalette(const QSharedPointer<QSettings> &settings)
+{
+ QPalette p;
+ settings->beginGroup(QStringLiteral("Palette"));
+ readColorGroup(settings, QPalette::All, &p);
+
+ settings->beginGroup(QStringLiteral("Normal"));
+ readColorGroup(settings, QPalette::Normal, &p);
+ settings->endGroup();
+
+ settings->beginGroup(QStringLiteral("Disabled"));
+ readColorGroup(settings, QPalette::Disabled, &p);
+ settings->endGroup();
+ return new QPalette(p);
+}
+#endif // QT_CONFIG(settings)
+
static bool qt_is_dark_system_theme()
{
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
@@ -478,9 +577,11 @@ void QQuickStyle::setFallbackStyle(const QString &style)
/*!
\since 5.9
- Returns the names of the available built-in styles.
+ Returns the names of the available styles.
\note The method must be called \b after creating an instance of QGuiApplication.
+
+ \sa stylePathList(), addStylePath()
*/
QStringList QQuickStyle::availableStyles()
{
@@ -504,4 +605,58 @@ QStringList QQuickStyle::availableStyles()
return styles;
}
+/*!
+ \since 5.12
+
+ Returns the list of directories where Qt Quick Controls 2 searches for available styles.
+
+ By default, the list contains paths specified in the \c QT_QUICK_CONTROLS_STYLE_PATH
+ environment variable, and any existing \c QtQuick/Controls.2 sub-directories in
+ \l QQmlEngine::importPathList().
+
+ \sa addStylePath(), availableStyles()
+*/
+QStringList QQuickStyle::stylePathList()
+{
+ return QQuickStylePrivate::stylePaths();
+}
+
+/*!
+ \since 5.12
+
+ Adds \a path as a directory where Qt Quick Controls 2 searches for available styles.
+
+ The \a path may be any local filesystem directory or \l {The Qt Resource System}{Qt Resource} directory.
+ For example, the following paths are all valid:
+
+ \list
+ \li \c {/path/to/styles/}
+ \li \c {file:///path/to/styles/}
+ \li \c {:/path/to/styles/}
+ \li \c {qrc:/path/to/styles/})
+ \endlist
+
+ The \a path will be converted into \l {QDir::canonicalPath}{canonical form} before it is added to
+ the style path list.
+
+ The newly added \a path will be first in the stylePathList().
+
+ \sa stylePathList(), availableStyles()
+*/
+void QQuickStyle::addStylePath(const QString &path)
+{
+ if (path.isEmpty())
+ return;
+
+ const QUrl url = QUrl(path);
+ if (url.isRelative() || url.scheme() == QLatin1String("file")
+ || (url.scheme().length() == 1 && QFile::exists(path)) ) { // windows path
+ styleSpec()->customStylePaths.prepend(QDir(path).canonicalPath());
+ } else if (url.scheme() == QLatin1String("qrc")) {
+ styleSpec()->customStylePaths.prepend(QLatin1Char(':') + url.path());
+ } else {
+ styleSpec()->customStylePaths.prepend(path);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle.h b/src/quickcontrols2/qquickstyle.h
index ab79c3e0..ce55b76b 100644
--- a/src/quickcontrols2/qquickstyle.h
+++ b/src/quickcontrols2/qquickstyle.h
@@ -51,6 +51,8 @@ public:
static void setStyle(const QString &style);
static void setFallbackStyle(const QString &style);
static QStringList availableStyles();
+ static QStringList stylePathList();
+ static void addStylePath(const QString &path);
};
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyle_p.h b/src/quickcontrols2/qquickstyle_p.h
index b92df3c2..205a4a11 100644
--- a/src/quickcontrols2/qquickstyle_p.h
+++ b/src/quickcontrols2/qquickstyle_p.h
@@ -59,13 +59,15 @@ class QSettings;
class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStylePrivate
{
public:
- static QStringList stylePaths();
+ static QStringList stylePaths(bool resolve = false);
static QString fallbackStyle();
static bool isCustomStyle();
static void init(const QUrl &baseUrl);
static void reset();
static QString configFilePath();
static QSharedPointer<QSettings> settings(const QString &group = QString());
+ static const QFont *readFont(const QSharedPointer<QSettings> &settings);
+ static const QPalette *readPalette(const QSharedPointer<QSettings> &settings);
static bool isDarkSystemTheme();
};
diff --git a/src/quickcontrols2/qquickstyleplugin.cpp b/src/quickcontrols2/qquickstyleplugin.cpp
index fa8e9785..553a6cad 100644
--- a/src/quickcontrols2/qquickstyleplugin.cpp
+++ b/src/quickcontrols2/qquickstyleplugin.cpp
@@ -35,51 +35,25 @@
****************************************************************************/
#include "qquickstyleplugin_p.h"
-#include "qquickproxytheme_p.h"
#include "qquickstyle.h"
-
-#include <QtGui/private/qguiapplication_p.h>
+#include "qquickstyle_p.h"
+#include "qquickstyleselector_p.h"
QT_BEGIN_NAMESPACE
-QQuickStylePlugin::QQuickStylePlugin(QObject *parent) : QQmlExtensionPlugin(parent)
-{
-}
-
-QQuickStylePlugin::~QQuickStylePlugin()
+class QQuickStylePluginPrivate
{
-}
-
-void QQuickStylePlugin::registerTypes(const char *uri)
-{
- Q_UNUSED(uri);
-}
+public:
+ mutable QScopedPointer<QQuickStyleSelector> selector;
+};
-void QQuickStylePlugin::initializeEngine(QQmlEngine *engine, const char *uri)
+QQuickStylePlugin::QQuickStylePlugin(QObject *parent)
+ : QQmlExtensionPlugin(parent), d_ptr(new QQuickStylePluginPrivate)
{
- Q_UNUSED(engine);
- Q_UNUSED(uri);
-
- // make sure not to re-create the proxy theme if initializeEngine()
- // is called multiple times, like in case of qml2puppet (QTBUG-54995)
- if (!m_theme.isNull())
- return;
-
- if (isCurrent()) {
- m_theme.reset(createTheme());
- if (m_theme)
- QGuiApplicationPrivate::platform_theme = m_theme.data();
- }
}
-bool QQuickStylePlugin::isCurrent() const
+QQuickStylePlugin::~QQuickStylePlugin()
{
- QString style = QQuickStyle::name();
- if (style.isEmpty())
- style = QStringLiteral("Default");
-
- const QString theme = name();
- return theme.compare(style, Qt::CaseInsensitive) == 0;
}
QString QQuickStylePlugin::name() const
@@ -87,25 +61,31 @@ QString QQuickStylePlugin::name() const
return QString();
}
-QQuickProxyTheme *QQuickStylePlugin::createTheme() const
+void QQuickStylePlugin::initializeTheme(QQuickTheme *theme)
{
- return nullptr;
+ Q_UNUSED(theme);
}
-/*
- Returns either a file system path if Qt was built as shared libraries,
- or a QRC path if Qt was built statically.
-*/
-QUrl QQuickStylePlugin::typeUrl(const QString &name) const
+QUrl QQuickStylePlugin::resolvedUrl(const QString &fileName) const
{
-#ifdef QT_STATIC
- QString url = QLatin1String("qrc") + baseUrl().path();
-#else
- QString url = baseUrl().toString();
-#endif
- if (!name.isEmpty())
- url += QLatin1Char('/') + name;
- return QUrl(url);
+ Q_D(const QQuickStylePlugin);
+ if (!d->selector) {
+ d->selector.reset(new QQuickStyleSelector);
+ const QString style = QQuickStyle::name();
+ if (!style.isEmpty())
+ d->selector->addSelector(style);
+
+ const QString fallback = QQuickStylePrivate::fallbackStyle();
+ if (!fallback.isEmpty() && fallback != style)
+ d->selector->addSelector(fallback);
+
+ const QString theme = name();
+ if (!theme.isEmpty() && theme != style)
+ d->selector->addSelector(theme);
+
+ d->selector->setPaths(QQuickStylePrivate::stylePaths(true));
+ }
+ return d->selector->select(fileName);
}
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleplugin_p.h b/src/quickcontrols2/qquickstyleplugin_p.h
index 9457b472..6b89926c 100644
--- a/src/quickcontrols2/qquickstyleplugin_p.h
+++ b/src/quickcontrols2/qquickstyleplugin_p.h
@@ -48,13 +48,13 @@
// We mean it.
//
-#include <QtCore/qscopedpointer.h>
#include <QtQml/qqmlextensionplugin.h>
#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
QT_BEGIN_NAMESPACE
-class QQuickProxyTheme;
+class QQuickTheme;
+class QQuickStylePluginPrivate;
class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickStylePlugin : public QQmlExtensionPlugin
{
@@ -64,17 +64,15 @@ public:
explicit QQuickStylePlugin(QObject *parent = nullptr);
~QQuickStylePlugin();
- void registerTypes(const char *uri) override;
- void initializeEngine(QQmlEngine *engine, const char *uri) override;
-
- bool isCurrent() const;
virtual QString name() const;
- virtual QQuickProxyTheme *createTheme() const;
+ virtual void initializeTheme(QQuickTheme *theme);
- QUrl typeUrl(const QString &name = QString()) const;
+ QUrl resolvedUrl(const QString &fileName) const;
private:
- QScopedPointer<QQuickProxyTheme> m_theme;
+ Q_DISABLE_COPY(QQuickStylePlugin)
+ Q_DECLARE_PRIVATE(QQuickStylePlugin)
+ QScopedPointer<QQuickStylePluginPrivate> d_ptr;
};
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleselector.cpp b/src/quickcontrols2/qquickstyleselector.cpp
index d5543c17..d11a95bd 100644
--- a/src/quickcontrols2/qquickstyleselector.cpp
+++ b/src/quickcontrols2/qquickstyleselector.cpp
@@ -40,33 +40,19 @@
#include "qquickstyleselector_p.h"
#include "qquickstyleselector_p_p.h"
-#include "qquickstyle.h"
-#include "qquickstyle_p.h"
-#include <QtCore/qdir.h>
-#include <QtCore/qfile.h>
#include <QtCore/qfileinfo.h>
-#include <QtCore/qsysinfo.h>
#include <QtCore/qlocale.h>
-#include <QtQml/qqmlfile.h>
-
+#include <QtCore/qloggingcategory.h>
#include <QtCore/private/qfileselector_p.h>
-#include <QtGui/private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
-static bool isLocalScheme(const QString &scheme)
-{
- bool local = scheme == QLatin1String("qrc");
-#ifdef Q_OS_ANDROID
- local |= scheme == QLatin1String("assets");
-#endif
- return local;
-}
+Q_LOGGING_CATEGORY(lcQtQuickControlsStyle, "qt.quick.controls.style")
static QString ensureSlash(const QString &path)
{
- if (path.endsWith(QLatin1Char('/')))
+ if (path.isEmpty() || path.endsWith(QLatin1Char('/')))
return path;
return path + QLatin1Char('/');
}
@@ -79,105 +65,93 @@ static QStringList prefixedPlatformSelectors(const QChar &prefix)
return selectors;
}
-static QStringList allSelectors(const QString &style = QString())
+static QStringList allSelectors()
{
static const QStringList platformSelectors = prefixedPlatformSelectors(QLatin1Char('+'));
QStringList selectors = platformSelectors;
const QString locale = QLocale().name();
if (!locale.isEmpty())
selectors += QLatin1Char('+') + locale;
- if (!style.isEmpty())
- selectors.prepend(style);
return selectors;
}
-QString QQuickStyleSelectorPrivate::select(const QString &filePath) const
+QUrl QQuickStyleSelectorPrivate::select(const QString &filePath) const
{
QFileInfo fi(filePath);
// If file doesn't exist, don't select
if (!fi.exists())
- return filePath;
+ return QUrl();
- const QString path = fi.path();
- const QString ret = QFileSelectorPrivate::selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'),
- fi.fileName(), allSelectors(styleName), QChar());
+ const QString selected = QFileSelectorPrivate::selectionHelper(ensureSlash(fi.canonicalPath()),
+ fi.fileName(), allSelectors(), QChar());
- if (!ret.isEmpty())
- return ret;
- return filePath;
-}
+ if (selected.startsWith(QLatin1Char(':')))
+ return QUrl(QLatin1String("qrc") + selected);
-QString QQuickStyleSelectorPrivate::trySelect(const QString &filePath, const QString &fallback) const
-{
- QFileInfo fi(filePath);
- if (!fi.exists())
- return fallback;
-
- // the path contains the name of the custom/fallback style, so exclude it from
- // the selectors. the rest of the selectors (os, locale) are still valid, though.
- const QString path = fi.path();
- const QString selectedPath = QFileSelectorPrivate::selectionHelper(path.isEmpty() ? QString() : path + QLatin1Char('/'),
- fi.fileName(), allSelectors(), QChar());
- if (selectedPath.startsWith(QLatin1Char(':')))
- return QLatin1String("qrc") + selectedPath;
- return QUrl::fromLocalFile(QFileInfo(selectedPath).absoluteFilePath()).toString();
+ return QUrl::fromLocalFile(selected.isEmpty() ? filePath : selected);
}
QQuickStyleSelector::QQuickStyleSelector() : d_ptr(new QQuickStyleSelectorPrivate)
{
- Q_D(QQuickStyleSelector);
- d->styleName = QQuickStyle::name();
- d->stylePath = QQuickStyle::path();
}
QQuickStyleSelector::~QQuickStyleSelector()
{
}
-QUrl QQuickStyleSelector::baseUrl() const
+QStringList QQuickStyleSelector::selectors() const
{
Q_D(const QQuickStyleSelector);
- return d->baseUrl;
+ return d->selectors;
}
-void QQuickStyleSelector::setBaseUrl(const QUrl &url)
+void QQuickStyleSelector::addSelector(const QString &selector)
{
Q_D(QQuickStyleSelector);
- d->baseUrl = url;
- d->basePath = QQmlFile::urlToLocalFileOrQrc(url.toString(QUrl::StripTrailingSlash) + QLatin1Char('/'));
+ if (d->selectors.contains(selector))
+ return;
+
+ d->selectors += selector;
}
-QString QQuickStyleSelector::select(const QString &fileName) const
+QStringList QQuickStyleSelector::paths() const
{
Q_D(const QQuickStyleSelector);
+ return d->paths;
+}
- // 1) try selecting from a custom style path, for example ":/mystyle"
- if (QQuickStylePrivate::isCustomStyle()) {
- // NOTE: this path may contain a subset of controls
- const QString selectedPath = d->trySelect(ensureSlash(d->stylePath) + d->styleName + QLatin1Char('/') + fileName);
- if (!selectedPath.isEmpty())
- return selectedPath;
- }
+void QQuickStyleSelector::setPaths(const QStringList &paths)
+{
+ Q_D(QQuickStyleSelector);
+ d->paths = paths;
+}
- // 2) try selecting from the fallback style path, for example QT_INSTALL_QML/QtQuick/Controls.2/Material
- const QString fallbackStyle = QQuickStylePrivate::fallbackStyle();
- if (!fallbackStyle.isEmpty()) {
- // NOTE: this path may also contain a subset of controls
- const QString selectedPath = d->trySelect(ensureSlash(d->basePath) + fallbackStyle + QLatin1Char('/') + fileName);
- if (!selectedPath.isEmpty())
- return selectedPath;
+QUrl QQuickStyleSelector::select(const QString &fileName) const
+{
+ Q_D(const QQuickStyleSelector);
+ // The lookup order is
+ // 1) requested style (e.g. "MyStyle", included in d->selectors)
+ // 2) fallback style (e.g. "Material", included in d->selectors)
+ // 3) default style (empty selector, not in d->selectors)
+ qCDebug(lcQtQuickControlsStyle) << "selecting" << fileName << "from" << d->paths << "with selectors" << d->selectors;
+
+ int to = d->selectors.count() - 1;
+ if (d->selectors.isEmpty() || !d->selectors.first().isEmpty())
+ ++to; // lookup #3 unless #1 is also empty (redundant)
+
+ // NOTE: last iteration intentionally out of bounds => empty selector
+ for (int i = 0; i <= to; ++i) {
+ const QString selector = d->selectors.value(i);
+ for (const QString &path : d->paths) {
+ const QUrl selectedUrl = d->select(ensureSlash(path) + selector + QLatin1Char('/') + fileName);
+ if (selectedUrl.isValid()) {
+ qCDebug(lcQtQuickControlsStyle) << "==>" << selectedUrl << "from" << path << "with selector" << selector;
+ return selectedUrl;
+ }
+ }
}
- // 3) fallback to the default style that is guaranteed to contain all controls
- QUrl url(ensureSlash(d->baseUrl.toString()) + fileName);
- if (isLocalScheme(url.scheme())) {
- QString equivalentPath = QLatin1Char(':') + url.path();
- QString selectedPath = d->select(equivalentPath);
- url.setPath(selectedPath.remove(0, 1));
- } else if (url.isLocalFile()) {
- url = QUrl::fromLocalFile(d->select(url.toLocalFile()));
- }
- return url.toString(QUrl::NormalizePathSegments);
+ return fileName;
}
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickstyleselector_p.h b/src/quickcontrols2/qquickstyleselector_p.h
index 29dba836..c4c0f540 100644
--- a/src/quickcontrols2/qquickstyleselector_p.h
+++ b/src/quickcontrols2/qquickstyleselector_p.h
@@ -67,10 +67,13 @@ public:
QQuickStyleSelector();
~QQuickStyleSelector();
- QUrl baseUrl() const;
- void setBaseUrl(const QUrl &url);
+ QStringList selectors() const;
+ void addSelector(const QString &selector);
- QString select(const QString &fileName) const;
+ QStringList paths() const;
+ void setPaths(const QStringList &paths);
+
+ QUrl select(const QString &fileName) const;
private:
Q_DISABLE_COPY(QQuickStyleSelector)
diff --git a/src/quickcontrols2/qquickstyleselector_p_p.h b/src/quickcontrols2/qquickstyleselector_p_p.h
index e940cd87..e69e7db2 100644
--- a/src/quickcontrols2/qquickstyleselector_p_p.h
+++ b/src/quickcontrols2/qquickstyleselector_p_p.h
@@ -59,13 +59,10 @@ QT_BEGIN_NAMESPACE
class QQuickStyleSelectorPrivate
{
public:
- QString select(const QString &filePath) const;
- QString trySelect(const QString &filePath, const QString &fallback = QString()) const;
+ QUrl select(const QString &filePath) const;
- QUrl baseUrl;
- QString basePath;
- QString styleName;
- QString stylePath;
+ QStringList paths;
+ QStringList selectors;
};
QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquicktheme.cpp b/src/quickcontrols2/qquicktheme.cpp
deleted file mode 100644
index 3643e975..00000000
--- a/src/quickcontrols2/qquicktheme.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquicktheme_p.h"
-#include "qquickstyle_p.h"
-
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qsettings.h>
-
-#include <functional>
-
-QT_BEGIN_NAMESPACE
-
-#if QT_CONFIG(settings)
-static void readValue(const QSharedPointer<QSettings> &settings, const QString &name, std::function<void(const QVariant &)> setValue)
-{
- const QVariant var = settings->value(name);
- if (var.isValid())
- setValue(var);
-}
-
-template <typename Enum>
-static Enum toEnumValue(const QVariant &var)
-{
- // ### TODO: expose QFont enums to the meta object system using Q_ENUM
- //QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
- //bool ok = false;
- //int value = enumeration.keyToValue(var.toByteArray(), &ok);
- //if (!ok)
- // value = var.toInt();
- //return static_cast<Enum>(value);
-
- return static_cast<Enum>(var.toInt());
-}
-
-QFont *readFont(const QSharedPointer<QSettings> &settings)
-{
- const QVariant var = settings->value(QStringLiteral("Font"));
- if (var.isValid())
- return new QFont(var.value<QFont>());
-
- QFont f;
- settings->beginGroup(QStringLiteral("Font"));
- readValue(settings, QStringLiteral("Family"), [&f](const QVariant &var) { f.setFamily(var.toString()); });
- readValue(settings, QStringLiteral("PointSize"), [&f](const QVariant &var) { f.setPointSizeF(var.toReal()); });
- readValue(settings, QStringLiteral("PixelSize"), [&f](const QVariant &var) { f.setPixelSize(var.toInt()); });
- readValue(settings, QStringLiteral("StyleHint"), [&f](const QVariant &var) { f.setStyleHint(toEnumValue<QFont::StyleHint>(var.toInt())); });
- readValue(settings, QStringLiteral("Weight"), [&f](const QVariant &var) { f.setWeight(toEnumValue<QFont::Weight>(var)); });
- readValue(settings, QStringLiteral("Style"), [&f](const QVariant &var) { f.setStyle(toEnumValue<QFont::Style>(var.toInt())); });
- settings->endGroup();
- return new QFont(f);
-}
-
-static void readColorGroup(const QSharedPointer<QSettings> &settings, QPalette::ColorGroup group, QPalette *palette)
-{
- const QStringList keys = settings->childKeys();
- if (keys.isEmpty())
- return;
-
- static const int index = QPalette::staticMetaObject.indexOfEnumerator("ColorRole");
- Q_ASSERT(index != -1);
- QMetaEnum metaEnum = QPalette::staticMetaObject.enumerator(index);
-
- for (const QString &key : keys) {
- bool ok = false;
- int role = metaEnum.keyToValue(key.toUtf8(), &ok);
- if (ok)
- palette->setColor(group, static_cast<QPalette::ColorRole>(role), settings->value(key).value<QColor>());
- }
-}
-
-static QPalette *readPalette(const QSharedPointer<QSettings> &settings)
-{
- QPalette p;
- settings->beginGroup(QStringLiteral("Palette"));
- readColorGroup(settings, QPalette::All, &p);
-
- settings->beginGroup(QStringLiteral("Normal"));
- readColorGroup(settings, QPalette::Normal, &p);
- settings->endGroup();
-
- settings->beginGroup(QStringLiteral("Disabled"));
- readColorGroup(settings, QPalette::Disabled, &p);
- settings->endGroup();
- return new QPalette(p);
-}
-
-#endif // QT_CONFIG(settings)
-
-QQuickTheme::QQuickTheme(const QString &style)
- : QQuickProxyTheme()
-{
-#if QT_CONFIG(settings)
- QSharedPointer<QSettings> settings = QQuickStylePrivate::settings(style);
- if (settings) {
- m_styleFont.reset(readFont(settings));
- m_stylePalette.reset(readPalette(settings));
- }
-#endif
-}
-
-const QFont *QQuickTheme::font(Font type) const
-{
- if (m_styleFont)
- return m_styleFont.data();
- return QQuickProxyTheme::font(type);
-}
-
-const QPalette *QQuickTheme::palette(Palette type) const
-{
- if (m_stylePalette)
- return m_stylePalette.data();
- return QQuickProxyTheme::palette(type);
-}
-
-QFont QQuickTheme::resolveFont(const QFont &font) const
-{
- if (!m_styleFont)
- return font;
-
- return m_styleFont->resolve(font);
-}
-
-QPalette QQuickTheme::resolvePalette(const QPalette &palette) const
-{
- if (!m_stylePalette)
- return palette;
-
- return m_stylePalette->resolve(palette);
-}
-
-QT_END_NAMESPACE
diff --git a/src/quickcontrols2/quickcontrols2.pri b/src/quickcontrols2/quickcontrols2.pri
index ac20b78d..781658ef 100644
--- a/src/quickcontrols2/quickcontrols2.pri
+++ b/src/quickcontrols2/quickcontrols2.pri
@@ -13,13 +13,11 @@ HEADERS += \
$$PWD/qquickmnemoniclabel_p.h \
$$PWD/qquickpaddedrectangle_p.h \
$$PWD/qquickplaceholdertext_p.h \
- $$PWD/qquickproxytheme_p.h \
$$PWD/qquickstyle.h \
$$PWD/qquickstyle_p.h \
$$PWD/qquickstyleplugin_p.h \
$$PWD/qquickstyleselector_p.h \
- $$PWD/qquickstyleselector_p_p.h \
- $$PWD/qquicktheme_p.h
+ $$PWD/qquickstyleselector_p_p.h
SOURCES += \
$$PWD/qquickanimatednode.cpp \
@@ -34,11 +32,9 @@ SOURCES += \
$$PWD/qquickmnemoniclabel.cpp \
$$PWD/qquickpaddedrectangle.cpp \
$$PWD/qquickplaceholdertext.cpp \
- $$PWD/qquickproxytheme.cpp \
$$PWD/qquickstyle.cpp \
$$PWD/qquickstyleplugin.cpp \
- $$PWD/qquickstyleselector.cpp \
- $$PWD/qquicktheme.cpp
+ $$PWD/qquickstyleselector.cpp
qtConfig(quick-listview):qtConfig(quick-pathview) {
HEADERS += \
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 0d59d073..c0ce6978 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -357,6 +357,22 @@ void QQuickAbstractButtonPrivate::executeIndicator(bool complete)
quickCompleteDeferred(q, indicatorName(), indicator);
}
+void QQuickAbstractButtonPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickAbstractButton);
+ QQuickControlPrivate::itemImplicitWidthChanged(item);
+ if (item == indicator)
+ emit q->implicitIndicatorWidthChanged();
+}
+
+void QQuickAbstractButtonPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickAbstractButton);
+ QQuickControlPrivate::itemImplicitHeightChanged(item);
+ if (item == indicator)
+ emit q->implicitIndicatorHeightChanged();
+}
+
QQuickAbstractButton *QQuickAbstractButtonPrivate::findCheckedButton() const
{
Q_Q(const QQuickAbstractButton);
@@ -427,6 +443,7 @@ QQuickAbstractButton::QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQui
QQuickAbstractButton::~QQuickAbstractButton()
{
Q_D(QQuickAbstractButton);
+ d->removeImplicitSizeListener(d->indicator);
if (d->group)
d->group->removeButton(this);
d->ungrabShortcut();
@@ -675,13 +692,24 @@ void QQuickAbstractButton::setIndicator(QQuickItem *indicator)
if (!d->indicator.isExecuting())
d->cancelIndicator();
+ const qreal oldImplicitIndicatorWidth = implicitIndicatorWidth();
+ const qreal oldImplicitIndicatorHeight = implicitIndicatorHeight();
+
+ d->removeImplicitSizeListener(d->indicator);
delete d->indicator;
d->indicator = indicator;
+
if (indicator) {
if (!indicator->parentItem())
indicator->setParentItem(this);
indicator->setAcceptedMouseButtons(Qt::LeftButton);
+ d->addImplicitSizeListener(indicator);
}
+
+ if (!qFuzzyCompare(oldImplicitIndicatorWidth, implicitIndicatorWidth()))
+ emit implicitIndicatorWidthChanged();
+ if (!qFuzzyCompare(oldImplicitIndicatorHeight, implicitIndicatorHeight()))
+ emit implicitIndicatorHeightChanged();
if (!d->indicator.isExecuting())
emit indicatorChanged();
}
@@ -910,6 +938,50 @@ qreal QQuickAbstractButton::pressY() const
}
/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::AbstractButton::implicitIndicatorWidth
+ \readonly
+
+ This property holds the implicit indicator width.
+
+ The value is equal to \c {indicator ? indicator.implicitWidth : 0}.
+
+ This is typically used, together with \l {Control::}{implicitContentWidth} and
+ \l {Control::}{implicitBackgroundWidth}, to calculate the \l {Item::}{implicitWidth}.
+
+ \sa implicitIndicatorHeight
+*/
+qreal QQuickAbstractButton::implicitIndicatorWidth() const
+{
+ Q_D(const QQuickAbstractButton);
+ if (!d->indicator)
+ return 0;
+ return d->indicator->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::AbstractButton::implicitIndicatorHeight
+ \readonly
+
+ This property holds the implicit indicator height.
+
+ The value is equal to \c {indicator ? indicator.implicitHeight : 0}.
+
+ This is typically used, together with \l {Control::}{implicitContentHeight} and
+ \l {Control::}{implicitBackgroundHeight}, to calculate the \l {Item::}{implicitHeight}.
+
+ \sa implicitIndicatorWidth
+*/
+qreal QQuickAbstractButton::implicitIndicatorHeight() const
+{
+ Q_D(const QQuickAbstractButton);
+ if (!d->indicator)
+ return 0;
+ return d->indicator->implicitHeight();
+}
+
+/*!
\qmlmethod void QtQuick.Controls::AbstractButton::toggle()
Toggles the checked state of the button.
diff --git a/src/quicktemplates2/qquickabstractbutton_p.h b/src/quicktemplates2/qquickabstractbutton_p.h
index de0c26ab..0fa48980 100644
--- a/src/quicktemplates2/qquickabstractbutton_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p.h
@@ -76,6 +76,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickAbstractButton : public QQuickContr
Q_PROPERTY(int autoRepeatInterval READ autoRepeatInterval WRITE setAutoRepeatInterval NOTIFY autoRepeatIntervalChanged FINAL REVISION 4)
Q_PROPERTY(qreal pressX READ pressX NOTIFY pressXChanged FINAL REVISION 4)
Q_PROPERTY(qreal pressY READ pressY NOTIFY pressYChanged FINAL REVISION 4)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitIndicatorWidth READ implicitIndicatorWidth NOTIFY implicitIndicatorWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitIndicatorHeight READ implicitIndicatorHeight NOTIFY implicitIndicatorHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,indicator")
public:
@@ -141,6 +144,10 @@ public:
qreal pressX() const;
qreal pressY() const;
+ // 2.5 (Qt 5.12)
+ qreal implicitIndicatorWidth() const;
+ qreal implicitIndicatorHeight() const;
+
public Q_SLOTS:
void toggle();
@@ -170,6 +177,9 @@ Q_SIGNALS:
Q_REVISION(4) void autoRepeatIntervalChanged();
Q_REVISION(4) void pressXChanged();
Q_REVISION(4) void pressYChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void implicitIndicatorWidthChanged();
+ Q_REVISION(5) void implicitIndicatorHeightChanged();
protected:
QQuickAbstractButton(QQuickAbstractButtonPrivate &dd, QQuickItem *parent);
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index 1b3b59ba..718498a8 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -103,6 +103,9 @@ public:
void cancelIndicator();
void executeIndicator(bool complete = false);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
// copied from qabstractbutton.cpp
static const int AUTO_REPEAT_DELAY = 300;
static const int AUTO_REPEAT_INTERVAL = 100;
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index be28cb2a..f5d80fb9 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qquickapplicationwindow_p.h"
+#include "qquickcontentitem_p.h"
#include "qquickoverlay_p.h"
#include "qquickpopup_p_p.h"
#include "qquickcontrol_p_p.h"
@@ -128,6 +129,8 @@ public:
return window->d_func();
}
+ QQmlListProperty<QObject> contentData();
+
void relayout();
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
@@ -262,7 +265,7 @@ void QQuickApplicationWindowPrivate::updateFont(const QFont &f)
void QQuickApplicationWindowPrivate::resolveFont()
{
- QFont resolvedFont = font.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
+ QFont resolvedFont = font.resolve(QQuickTheme::font(QQuickTheme::System));
setFont_helper(resolvedFont);
}
@@ -284,7 +287,7 @@ void QQuickApplicationWindowPrivate::updatePalette(const QPalette &p)
void QQuickApplicationWindowPrivate::resolvePalette()
{
- QPalette resolvedPalette = palette.resolve(QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette));
+ QPalette resolvedPalette = palette.resolve(QQuickTheme::palette(QQuickTheme::System));
setPalette_helper(resolvedPalette);
}
@@ -548,9 +551,10 @@ void QQuickApplicationWindow::setFooter(QQuickItem *footer)
\sa contentItem
*/
-QQmlListProperty<QObject> QQuickApplicationWindow::contentData()
+QQmlListProperty<QObject> QQuickApplicationWindowPrivate::contentData()
{
- return QQmlListProperty<QObject>(contentItem(), this,
+ Q_Q(QQuickApplicationWindow);
+ return QQmlListProperty<QObject>(q->contentItem(), q,
QQuickApplicationWindowPrivate::contentData_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -572,7 +576,7 @@ QQuickItem *QQuickApplicationWindow::contentItem() const
{
QQuickApplicationWindowPrivate *d = const_cast<QQuickApplicationWindowPrivate *>(d_func());
if (!d->contentItem) {
- d->contentItem = new QQuickItem(QQuickWindow::contentItem());
+ d->contentItem = new QQuickContentItem(this, QQuickWindow::contentItem());
d->contentItem->setFlag(QQuickItem::ItemIsFocusScope);
d->contentItem->setFocus(true);
d->relayout();
@@ -679,7 +683,7 @@ void QQuickApplicationWindow::setFont(const QFont &font)
if (d->font.resolve() == font.resolve() && d->font == font)
return;
- QFont resolvedFont = font.resolve(QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont));
+ QFont resolvedFont = font.resolve(QQuickTheme::font(QQuickTheme::System));
d->setFont_helper(resolvedFont);
}
@@ -758,7 +762,7 @@ void QQuickApplicationWindow::setPalette(const QPalette &palette)
if (d->palette.resolve() == palette.resolve() && d->palette == palette)
return;
- QPalette resolvedPalette = palette.resolve(QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette));
+ QPalette resolvedPalette = palette.resolve(QQuickTheme::palette(QQuickTheme::System));
d->setPalette_helper(resolvedPalette);
}
diff --git a/src/quicktemplates2/qquickapplicationwindow_p.h b/src/quicktemplates2/qquickapplicationwindow_p.h
index d74d3c9d..c004ee3a 100644
--- a/src/quicktemplates2/qquickapplicationwindow_p.h
+++ b/src/quicktemplates2/qquickapplicationwindow_p.h
@@ -66,7 +66,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickApplicationWindow : public QQuickWi
Q_OBJECT
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem CONSTANT FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PRIVATE_PROPERTY(QQuickApplicationWindow::d_func(), QQmlListProperty<QObject> contentData 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)
@@ -89,7 +89,6 @@ public:
void setBackground(QQuickItem *background);
QQuickItem *contentItem() const;
- QQmlListProperty<QObject> contentData();
QQuickItem *activeFocusControl() const;
diff --git a/src/quicktemplates2/qquickbutton.cpp b/src/quicktemplates2/qquickbutton.cpp
index 74b78408..fbce5225 100644
--- a/src/quicktemplates2/qquickbutton.cpp
+++ b/src/quicktemplates2/qquickbutton.cpp
@@ -96,12 +96,12 @@ QQuickButton::QQuickButton(QQuickButtonPrivate &dd, QQuickItem *parent)
QFont QQuickButton::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::PushButtonFont);
+ return QQuickTheme::font(QQuickTheme::Button);
}
QPalette QQuickButton::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ButtonPalette);
+ return QQuickTheme::palette(QQuickTheme::Button);
}
/*!
diff --git a/src/quicktemplates2/qquickcheckbox.cpp b/src/quicktemplates2/qquickcheckbox.cpp
index 1f66966c..461fae30 100644
--- a/src/quicktemplates2/qquickcheckbox.cpp
+++ b/src/quicktemplates2/qquickcheckbox.cpp
@@ -183,12 +183,12 @@ void QQuickCheckBox::setCheckState(Qt::CheckState state)
QFont QQuickCheckBox::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::CheckBoxFont);
+ return QQuickTheme::font(QQuickTheme::CheckBox);
}
QPalette QQuickCheckBox::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::CheckBoxPalette);
+ return QQuickTheme::palette(QQuickTheme::CheckBox);
}
void QQuickCheckBox::buttonChange(ButtonChange change)
diff --git a/src/quicktemplates2/qquickcheckdelegate.cpp b/src/quicktemplates2/qquickcheckdelegate.cpp
index f02c0bfa..17f1f0b2 100644
--- a/src/quicktemplates2/qquickcheckdelegate.cpp
+++ b/src/quicktemplates2/qquickcheckdelegate.cpp
@@ -170,7 +170,12 @@ void QQuickCheckDelegate::setCheckState(Qt::CheckState state)
QFont QQuickCheckDelegate::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+ return QQuickTheme::font(QQuickTheme::ListView);
+}
+
+QPalette QQuickCheckDelegate::defaultPalette() const
+{
+ return QQuickTheme::palette(QQuickTheme::ListView);
}
void QQuickCheckDelegate::buttonChange(ButtonChange change)
diff --git a/src/quicktemplates2/qquickcheckdelegate_p.h b/src/quicktemplates2/qquickcheckdelegate_p.h
index 67dcf706..2d5a5cb2 100644
--- a/src/quicktemplates2/qquickcheckdelegate_p.h
+++ b/src/quicktemplates2/qquickcheckdelegate_p.h
@@ -79,6 +79,7 @@ Q_SIGNALS:
protected:
QFont defaultFont() const override;
+ QPalette defaultPalette() const override;
void buttonChange(ButtonChange change) override;
void nextCheckState() override;
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index f7b5f157..77abee07 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -261,6 +261,9 @@ public:
void cancelPopup();
void executePopup(bool complete = false);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
bool flat = false;
bool down = false;
bool hasDown = false;
@@ -724,6 +727,22 @@ void QQuickComboBoxPrivate::executePopup(bool complete)
quickCompleteDeferred(q, popupName(), popup);
}
+void QQuickComboBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickComboBox);
+ QQuickControlPrivate::itemImplicitWidthChanged(item);
+ if (item == indicator)
+ emit q->implicitIndicatorWidthChanged();
+}
+
+void QQuickComboBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickComboBox);
+ QQuickControlPrivate::itemImplicitHeightChanged(item);
+ if (item == indicator)
+ emit q->implicitIndicatorHeightChanged();
+}
+
QQuickComboBox::QQuickComboBox(QQuickItem *parent)
: QQuickControl(*(new QQuickComboBoxPrivate), parent)
{
@@ -739,6 +758,7 @@ QQuickComboBox::QQuickComboBox(QQuickItem *parent)
QQuickComboBox::~QQuickComboBox()
{
Q_D(QQuickComboBox);
+ d->removeImplicitSizeListener(d->indicator);
if (d->popup) {
// Disconnect visibleChanged() to avoid a spurious highlightedIndexChanged() signal
// emission during the destruction of the (visible) popup. (QTBUG-57650)
@@ -1047,12 +1067,22 @@ void QQuickComboBox::setIndicator(QQuickItem *indicator)
if (!d->indicator.isExecuting())
d->cancelIndicator();
+ const qreal oldImplicitIndicatorWidth = implicitIndicatorWidth();
+ const qreal oldImplicitIndicatorHeight = implicitIndicatorHeight();
+
+ d->removeImplicitSizeListener(d->indicator);
delete d->indicator;
d->indicator = indicator;
if (indicator) {
if (!indicator->parentItem())
indicator->setParentItem(this);
+ d->addImplicitSizeListener(indicator);
}
+
+ if (!qFuzzyCompare(oldImplicitIndicatorWidth, implicitIndicatorWidth()))
+ emit implicitIndicatorWidthChanged();
+ if (!qFuzzyCompare(oldImplicitIndicatorHeight, implicitIndicatorHeight()))
+ emit implicitIndicatorHeightChanged();
if (!d->indicator.isExecuting())
emit indicatorChanged();
}
@@ -1364,6 +1394,50 @@ bool QQuickComboBox::hasAcceptableInput() const
}
/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::ComboBox::implicitIndicatorWidth
+ \readonly
+
+ This property holds the implicit indicator width.
+
+ The value is equal to \c {indicator ? indicator.implicitWidth : 0}.
+
+ This is typically used, together with \l {Control::}{implicitContentWidth} and
+ \l {Control::}{implicitBackgroundWidth}, to calculate the \l {Item::}{implicitWidth}.
+
+ \sa implicitIndicatorHeight
+*/
+qreal QQuickComboBox::implicitIndicatorWidth() const
+{
+ Q_D(const QQuickComboBox);
+ if (!d->indicator)
+ return 0;
+ return d->indicator->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::ComboBox::implicitIndicatorHeight
+ \readonly
+
+ This property holds the implicit indicator height.
+
+ The value is equal to \c {indicator ? indicator.implicitHeight : 0}.
+
+ This is typically used, together with \l {Control::}{implicitContentHeight} and
+ \l {Control::}{implicitBackgroundHeight}, to calculate the \l {Item::}{implicitHeight}.
+
+ \sa implicitIndicatorWidth
+*/
+qreal QQuickComboBox::implicitIndicatorHeight() const
+{
+ Q_D(const QQuickComboBox);
+ if (!d->indicator)
+ return 0;
+ return d->indicator->implicitHeight();
+}
+
+/*!
\qmlmethod string QtQuick.Controls::ComboBox::textAt(int index)
Returns the text for the specified \a index, or an empty string
@@ -1690,12 +1764,12 @@ void QQuickComboBox::localeChange(const QLocale &newLocale, const QLocale &oldLo
QFont QQuickComboBox::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ComboMenuItemFont);
+ return QQuickTheme::font(QQuickTheme::ComboBox);
}
QPalette QQuickComboBox::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ComboBoxPalette);
+ return QQuickTheme::palette(QQuickTheme::ComboBox);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickcombobox_p.h b/src/quicktemplates2/qquickcombobox_p.h
index 2faff745..75e535a9 100644
--- a/src/quicktemplates2/qquickcombobox_p.h
+++ b/src/quicktemplates2/qquickcombobox_p.h
@@ -82,6 +82,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickComboBox : public QQuickControl
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints NOTIFY inputMethodHintsChanged FINAL REVISION 2)
Q_PROPERTY(bool inputMethodComposing READ isInputMethodComposing NOTIFY inputMethodComposingChanged FINAL REVISION 2)
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged FINAL REVISION 2)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitIndicatorWidth READ implicitIndicatorWidth NOTIFY implicitIndicatorWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitIndicatorHeight READ implicitIndicatorHeight NOTIFY implicitIndicatorHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,indicator,popup")
public:
@@ -148,6 +151,10 @@ public:
bool isInputMethodComposing() const;
bool hasAcceptableInput() const;
+ // 2.5 (Qt 5.12)
+ qreal implicitIndicatorWidth() const;
+ qreal implicitIndicatorHeight() const;
+
public Q_SLOTS:
void incrementCurrentIndex();
void decrementCurrentIndex();
@@ -179,6 +186,9 @@ Q_SIGNALS:
Q_REVISION(2) void inputMethodHintsChanged();
Q_REVISION(2) void inputMethodComposingChanged();
Q_REVISION(2) void acceptableInputChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void implicitIndicatorWidthChanged();
+ Q_REVISION(5) void implicitIndicatorHeightChanged();
protected:
bool eventFilter(QObject *object, QEvent *event) override;
diff --git a/src/quicktemplates2/qquickcontainer.cpp b/src/quicktemplates2/qquickcontainer.cpp
index b3e7454b..8217a3ff 100644
--- a/src/quicktemplates2/qquickcontainer.cpp
+++ b/src/quicktemplates2/qquickcontainer.cpp
@@ -198,6 +198,8 @@ void QQuickContainerPrivate::init()
contentModel = new QQmlObjectModel(q);
QObject::connect(contentModel, &QQmlObjectModel::countChanged, q, &QQuickContainer::countChanged);
QObject::connect(contentModel, &QQmlObjectModel::childrenChanged, q, &QQuickContainer::contentChildrenChanged);
+ connect(q, &QQuickControl::implicitContentWidthChanged, this, &QQuickContainerPrivate::updateContentWidth);
+ connect(q, &QQuickControl::implicitContentHeightChanged, this, &QQuickContainerPrivate::updateContentHeight);
}
void QQuickContainerPrivate::cleanup()
@@ -239,7 +241,7 @@ void QQuickContainerPrivate::insertItem(int index, QQuickItem *item)
updatingCurrent = true;
- item->setParentItem(effectiveContentItem(contentItem));
+ item->setParentItem(effectiveContentItem(getContentItem()));
QQuickItemPrivate::get(item)->addItemChangeListener(this, changeTypes);
contentModel->insert(index, item);
@@ -384,6 +386,8 @@ void QQuickContainerPrivate::itemDestroyed(QQuickItem *item)
int index = contentModel->indexOf(item, nullptr);
if (index != -1)
removeItem(index, item);
+ else
+ QQuickControlPrivate::itemDestroyed(item);
}
void QQuickContainerPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
@@ -435,6 +439,26 @@ void QQuickContainerPrivate::contentChildren_clear(QQmlListProperty<QQuickItem>
return QQuickContainerPrivate::get(q)->contentModel->clear();
}
+void QQuickContainerPrivate::updateContentWidth()
+{
+ Q_Q(QQuickContainer);
+ if (hasContentWidth || qFuzzyCompare(contentWidth, implicitContentWidth))
+ return;
+
+ contentWidth = implicitContentWidth;
+ emit q->contentWidthChanged();
+}
+
+void QQuickContainerPrivate::updateContentHeight()
+{
+ Q_Q(QQuickContainer);
+ if (hasContentHeight || qFuzzyCompare(contentHeight, implicitContentHeight))
+ return;
+
+ contentHeight = implicitContentHeight;
+ emit q->contentHeightChanged();
+}
+
QQuickContainer::QQuickContainer(QQuickItem *parent)
: QQuickControl(*(new QQuickContainerPrivate), parent)
{
@@ -750,6 +774,84 @@ QQuickItem *QQuickContainer::currentItem() const
return itemAt(d->currentIndex);
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Container::contentWidth
+
+ This property holds the content width. It is used for calculating the total
+ implicit width of the container.
+
+ Unless explicitly overridden, the content width is automatically calculated
+ based on the implicit width of the items in the container.
+
+ \sa contentHeight
+*/
+qreal QQuickContainer::contentWidth() const
+{
+ Q_D(const QQuickContainer);
+ return d->contentWidth;
+}
+
+void QQuickContainer::setContentWidth(qreal width)
+{
+ Q_D(QQuickContainer);
+ d->hasContentWidth = true;
+ if (qFuzzyCompare(d->contentWidth, width))
+ return;
+
+ d->contentWidth = width;
+ emit contentWidthChanged();
+}
+
+void QQuickContainer::resetContentWidth()
+{
+ Q_D(QQuickContainer);
+ if (!d->hasContentWidth)
+ return;
+
+ d->hasContentWidth = false;
+ d->updateContentWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Container::contentHeight
+
+ This property holds the content height. It is used for calculating the total
+ implicit height of the container.
+
+ Unless explicitly overridden, the content height is automatically calculated
+ based on the implicit height of the items in the container.
+
+ \sa contentWidth
+*/
+qreal QQuickContainer::contentHeight() const
+{
+ Q_D(const QQuickContainer);
+ return d->contentHeight;
+}
+
+void QQuickContainer::setContentHeight(qreal height)
+{
+ Q_D(QQuickContainer);
+ d->hasContentHeight = true;
+ if (qFuzzyCompare(d->contentHeight, height))
+ return;
+
+ d->contentHeight = height;
+ emit contentHeightChanged();
+}
+
+void QQuickContainer::resetContentHeight()
+{
+ Q_D(QQuickContainer);
+ if (!d->hasContentHeight)
+ return;
+
+ d->hasContentHeight = false;
+ d->updateContentHeight();
+}
+
void QQuickContainer::componentComplete()
{
Q_D(QQuickContainer);
@@ -775,7 +877,7 @@ void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem
static const int slotIndex = metaObject()->indexOfSlot("_q_currentIndexChanged()");
if (oldItem) {
- QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItemPrivate::get(oldItem)->removeItemChangeListener(d, QQuickItemPrivate::Children | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
QQuickItem *oldContentItem = effectiveContentItem(oldItem);
if (oldContentItem != oldItem)
QQuickItemPrivate::get(oldContentItem)->removeItemChangeListener(d, QQuickItemPrivate::Children);
@@ -786,7 +888,7 @@ void QQuickContainer::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem
}
if (newItem) {
- QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
+ QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight);
QQuickItem *newContentItem = effectiveContentItem(newItem);
if (newContentItem != newItem)
QQuickItemPrivate::get(newContentItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
diff --git a/src/quicktemplates2/qquickcontainer_p.h b/src/quicktemplates2/qquickcontainer_p.h
index 030497cf..310aacd1 100644
--- a/src/quicktemplates2/qquickcontainer_p.h
+++ b/src/quicktemplates2/qquickcontainer_p.h
@@ -64,6 +64,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainer : public QQuickControl
Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DefaultProperty", "contentData")
public:
@@ -87,6 +90,15 @@ public:
int currentIndex() const;
QQuickItem *currentItem() const;
+ // 2.5 (Qt 5.12)
+ qreal contentWidth() const;
+ void setContentWidth(qreal width);
+ void resetContentWidth();
+
+ qreal contentHeight() const;
+ void setContentHeight(qreal height);
+ void resetContentHeight();
+
public Q_SLOTS:
void setCurrentIndex(int index);
// 2.1 (Qt 5.8)
@@ -98,6 +110,9 @@ Q_SIGNALS:
void contentChildrenChanged();
void currentIndexChanged();
void currentItemChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void contentWidthChanged();
+ Q_REVISION(5) void contentHeightChanged();
protected:
QQuickContainer(QQuickContainerPrivate &dd, QQuickItem *parent);
diff --git a/src/quicktemplates2/qquickcontainer_p_p.h b/src/quicktemplates2/qquickcontainer_p_p.h
index 09a89b90..5ddf298a 100644
--- a/src/quicktemplates2/qquickcontainer_p_p.h
+++ b/src/quicktemplates2/qquickcontainer_p_p.h
@@ -50,12 +50,11 @@
#include <QtQuickTemplates2/private/qquickcontainer_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQml/private/qqmlobjectmodel_p.h>
QT_BEGIN_NAMESPACE
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainerPrivate : public QQuickControlPrivate
{
Q_DECLARE_PUBLIC(QQuickContainer)
@@ -93,6 +92,13 @@ public:
static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index);
static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop);
+ void updateContentWidth();
+ void updateContentHeight();
+
+ bool hasContentWidth = false;
+ bool hasContentHeight = false;
+ qreal contentWidth = 0;
+ qreal contentHeight = 0;
QObjectList contentData;
QQmlObjectModel *contentModel = nullptr;
int currentIndex = -1;
diff --git a/src/quicktemplates2/qquickcontentitem.cpp b/src/quicktemplates2/qquickcontentitem.cpp
new file mode 100644
index 00000000..95665f70
--- /dev/null
+++ b/src/quicktemplates2/qquickcontentitem.cpp
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickcontentitem_p.h"
+
+#include <QtQml/private/qqmlmetatype_p.h>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \internal
+
+ Helper class that aids debugging by producing more useful debugging output.
+*/
+
+QQuickContentItem::QQuickContentItem(QQuickItem *parent)
+ : QQuickItem(parent)
+{
+ setObjectName(QQmlMetaType::prettyTypeName(parent));
+}
+
+QQuickContentItem::QQuickContentItem(const QObject *scope, QQuickItem *parent)
+ : QQuickItem(parent)
+{
+ setObjectName(QQmlMetaType::prettyTypeName(scope));
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickcontentitem_p.h b/src/quicktemplates2/qquickcontentitem_p.h
new file mode 100644
index 00000000..df0f0b24
--- /dev/null
+++ b/src/quicktemplates2/qquickcontentitem_p.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKCONTENTITEM_P_H
+#define QQUICKCONTENTITEM_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuick/qquickitem.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContentItem : public QQuickItem
+{
+ Q_OBJECT
+
+public:
+ explicit QQuickContentItem(QQuickItem *parent = nullptr);
+ explicit QQuickContentItem(const QObject *scope, QQuickItem *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickContentItem)
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKCONTENTITEM_P_H
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index 4ac12dc4..26e28ebe 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -50,9 +50,6 @@
#include "qquickapplicationwindow_p.h"
#include "qquickdeferredexecute_p_p.h"
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/qpa/qplatformtheme.h>
-
#if QT_CONFIG(accessibility)
#include <QtQuick/private/qquickaccessibleattached_p.h>
#endif
@@ -79,15 +76,48 @@ QT_BEGIN_NAMESPACE
The \l {Item::}{implicitWidth} and \l {Item::}{implicitHeight} of a control
are typically based on the implicit sizes of the background and the content
- item plus any \l {Control::}{padding}. These properties determine how large
+ item plus any insets and paddings. These properties determine how large
the control will be when no explicit \l {Item::}{width} or
\l {Item::}{height} is specified.
+ The geometry of the \l {Control::}{contentItem} is determined by the padding.
+ The following example reserves 10px padding between the boundaries of the
+ control and its content:
+
+ \code
+ Control {
+ padding: 10
+
+ contentItem: Text {
+ text: "Content"
+ }
+ }
+ \endcode
+
The \l {Control::}{background} item fills the entire width and height of the
- control, unless an explicit size has been given for it.
+ control, unless insets or an explicit size have been given for it. Background
+ insets are useful for extending the touchable/interactive area of a control
+ without affecting its visual size. This is often used on touch devices to
+ ensure that a control is not too small to be interacted with by the user.
+ Insets affect the size of the control, and hence will affect how much space
+ they take up in a layout, for example.
- The geometry of the \l {Control::}{contentItem} is determined by the
- padding.
+ Negative insets can be used to make the background larger than the control.
+ The following example uses negative insets to place a shadow outside the
+ control's boundaries:
+
+ \code
+ Control {
+ topInset: -2
+ leftInset: -2
+ rightInset: -6
+ bottomInset: -6
+
+ background: BorderImage {
+ source: ":/images/shadowed-background.png"
+ }
+ }
+ \endcode
\section1 Event Handling
@@ -100,6 +130,8 @@ QT_BEGIN_NAMESPACE
\sa ApplicationWindow, Container
*/
+const QQuickItemPrivate::ChangeTypes QQuickControlPrivate::ImplicitSizeChanges = QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight | QQuickItemPrivate::Destroyed;
+
static bool isKeyFocusReason(Qt::FocusReason reason)
{
return reason == Qt::TabFocusReason || reason == Qt::BacktabFocusReason || reason == Qt::ShortcutFocusReason;
@@ -119,6 +151,12 @@ QQuickControlPrivate::~QQuickControlPrivate()
#endif
}
+void QQuickControlPrivate::init()
+{
+ Q_Q(QQuickControl);
+ QObject::connect(q, &QQuickItem::baselineOffsetChanged, q, &QQuickControl::baselineOffsetChanged);
+}
+
#if QT_CONFIG(quicktemplates2_multitouch)
bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
{
@@ -182,75 +220,163 @@ void QQuickControlPrivate::mirrorChange()
void QQuickControlPrivate::setTopPadding(qreal value, bool reset)
{
Q_Q(QQuickControl);
- qreal oldPadding = q->topPadding();
- topPadding = value;
- hasTopPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ const QMarginsF oldPadding = getPadding();
+ extra.value().topPadding = value;
+ extra.value().hasTopPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding.top(), value)) || (reset && !qFuzzyCompare(oldPadding.top(), getVerticalPadding()))) {
emit q->topPaddingChanged();
emit q->availableHeightChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(leftPadding, oldPadding, rightPadding, bottomPadding));
+ q->paddingChange(getPadding(), oldPadding);
}
}
void QQuickControlPrivate::setLeftPadding(qreal value, bool reset)
{
Q_Q(QQuickControl);
- qreal oldPadding = q->leftPadding();
- leftPadding = value;
- hasLeftPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ const QMarginsF oldPadding = getPadding();
+ extra.value().leftPadding = value;
+ extra.value().hasLeftPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding.left(), value)) || (reset && !qFuzzyCompare(oldPadding.left(), getHorizontalPadding()))) {
emit q->leftPaddingChanged();
emit q->availableWidthChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(oldPadding, topPadding, rightPadding, bottomPadding));
+ q->paddingChange(getPadding(), oldPadding);
}
}
void QQuickControlPrivate::setRightPadding(qreal value, bool reset)
{
Q_Q(QQuickControl);
- qreal oldPadding = q->rightPadding();
- rightPadding = value;
- hasRightPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ const QMarginsF oldPadding = getPadding();
+ extra.value().rightPadding = value;
+ extra.value().hasRightPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding.right(), value)) || (reset && !qFuzzyCompare(oldPadding.right(), getHorizontalPadding()))) {
emit q->rightPaddingChanged();
emit q->availableWidthChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(leftPadding, topPadding, oldPadding, bottomPadding));
+ q->paddingChange(getPadding(), oldPadding);
}
}
void QQuickControlPrivate::setBottomPadding(qreal value, bool reset)
{
Q_Q(QQuickControl);
- qreal oldPadding = q->bottomPadding();
- bottomPadding = value;
- hasBottomPadding = !reset;
- if ((!reset && !qFuzzyCompare(oldPadding, value)) || (reset && !qFuzzyCompare(oldPadding, padding))) {
+ const QMarginsF oldPadding = getPadding();
+ extra.value().bottomPadding = value;
+ extra.value().hasBottomPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldPadding.bottom(), value)) || (reset && !qFuzzyCompare(oldPadding.bottom(), getVerticalPadding()))) {
emit q->bottomPaddingChanged();
emit q->availableHeightChanged();
- q->paddingChange(QMarginsF(leftPadding, topPadding, rightPadding, bottomPadding),
- QMarginsF(leftPadding, topPadding, rightPadding, oldPadding));
+ q->paddingChange(getPadding(), oldPadding);
}
}
-void QQuickControlPrivate::resizeBackground()
+void QQuickControlPrivate::setHorizontalPadding(qreal value, bool reset)
{
Q_Q(QQuickControl);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- background->setHeight(q->height());
- p->heightValid = false;
- }
+ const QMarginsF oldPadding = getPadding();
+ const qreal oldHorizontalPadding = getHorizontalPadding();
+ horizontalPadding = value;
+ hasHorizontalPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldHorizontalPadding, value)) || (reset && !qFuzzyCompare(oldHorizontalPadding, padding))) {
+ const QMarginsF newPadding = getPadding();
+ if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
+ emit q->leftPaddingChanged();
+ if (!qFuzzyCompare(newPadding.right(), oldPadding.right()))
+ emit q->rightPaddingChanged();
+ emit q->horizontalPaddingChanged();
+ emit q->availableWidthChanged();
+ q->paddingChange(newPadding, oldPadding);
}
}
+void QQuickControlPrivate::setVerticalPadding(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ const QMarginsF oldPadding = getPadding();
+ const qreal oldVerticalPadding = getVerticalPadding();
+ verticalPadding = value;
+ hasVerticalPadding = !reset;
+ if ((!reset && !qFuzzyCompare(oldVerticalPadding, value)) || (reset && !qFuzzyCompare(oldVerticalPadding, padding))) {
+ const QMarginsF newPadding = getPadding();
+ if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
+ emit q->topPaddingChanged();
+ if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
+ emit q->bottomPaddingChanged();
+ emit q->verticalPaddingChanged();
+ emit q->availableHeightChanged();
+ q->paddingChange(newPadding, oldPadding);
+ }
+}
+
+void QQuickControlPrivate::setTopInset(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ const QMarginsF oldInset = getInset();
+ extra.value().topInset = value;
+ extra.value().hasTopInset = !reset;
+ if (!qFuzzyCompare(oldInset.top(), value)) {
+ emit q->topInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickControlPrivate::setLeftInset(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ const QMarginsF oldInset = getInset();
+ extra.value().leftInset = value;
+ extra.value().hasLeftInset = !reset;
+ if (!qFuzzyCompare(oldInset.left(), value)) {
+ emit q->leftInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickControlPrivate::setRightInset(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ const QMarginsF oldInset = getInset();
+ extra.value().rightInset = value;
+ extra.value().hasRightInset = !reset;
+ if (!qFuzzyCompare(oldInset.right(), value)) {
+ emit q->rightInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickControlPrivate::setBottomInset(qreal value, bool reset)
+{
+ Q_Q(QQuickControl);
+ const QMarginsF oldInset = getInset();
+ extra.value().bottomInset = value;
+ extra.value().hasBottomInset = !reset;
+ if (!qFuzzyCompare(oldInset.bottom(), value)) {
+ emit q->bottomInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickControlPrivate::resizeBackground()
+{
+ if (!background)
+ return;
+
+ resizingBackground = true;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
+ background->setX(getLeftInset());
+ background->setWidth(width - getLeftInset() - getRightInset());
+ }
+ if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
+ background->setY(getTopInset());
+ background->setHeight(height - getTopInset() - getBottomInset());
+ }
+
+ resizingBackground = false;
+}
+
void QQuickControlPrivate::resizeContent()
{
Q_Q(QQuickControl);
@@ -276,21 +402,73 @@ void QQuickControlPrivate::setContentItem_helper(QQuickItem *item, bool notify)
if (!contentItem.isExecuting())
cancelContentItem();
- q->contentItemChange(item, contentItem);
- delete contentItem;
+ QQuickItem *oldContentItem = contentItem;
+ if (oldContentItem) {
+ disconnect(oldContentItem, &QQuickItem::baselineOffsetChanged, this, &QQuickControlPrivate::updateBaselineOffset);
+ removeImplicitSizeListener(oldContentItem);
+ }
+
contentItem = item;
+ q->contentItemChange(item, oldContentItem);
+ delete oldContentItem;
if (item) {
+ connect(contentItem, &QQuickItem::baselineOffsetChanged, this, &QQuickControlPrivate::updateBaselineOffset);
if (!item->parentItem())
item->setParentItem(q);
if (componentComplete)
resizeContent();
+ addImplicitSizeListener(contentItem);
}
+ updateImplicitContentSize();
+ updateBaselineOffset();
+
if (notify && !contentItem.isExecuting())
emit q->contentItemChanged();
}
+qreal QQuickControlPrivate::getContentWidth() const
+{
+ return contentItem ? contentItem->implicitWidth() : 0;
+}
+
+qreal QQuickControlPrivate::getContentHeight() const
+{
+ return contentItem ? contentItem->implicitHeight() : 0;
+}
+
+void QQuickControlPrivate::updateImplicitContentWidth()
+{
+ Q_Q(QQuickControl);
+ const qreal oldWidth = implicitContentWidth;
+ implicitContentWidth = getContentWidth();
+ if (!qFuzzyCompare(implicitContentWidth, oldWidth))
+ emit q->implicitContentWidthChanged();
+}
+
+void QQuickControlPrivate::updateImplicitContentHeight()
+{
+ Q_Q(QQuickControl);
+ const qreal oldHeight = implicitContentHeight;
+ implicitContentHeight = getContentHeight();
+ if (!qFuzzyCompare(implicitContentHeight, oldHeight))
+ emit q->implicitContentHeightChanged();
+}
+
+void QQuickControlPrivate::updateImplicitContentSize()
+{
+ Q_Q(QQuickControl);
+ const qreal oldWidth = implicitContentWidth;
+ const qreal oldHeight = implicitContentHeight;
+ implicitContentWidth = getContentWidth();
+ implicitContentHeight = getContentHeight();
+ if (!qFuzzyCompare(implicitContentWidth, oldWidth))
+ emit q->implicitContentWidthChanged();
+ if (!qFuzzyCompare(implicitContentHeight, oldHeight))
+ emit q->implicitContentHeightChanged();
+}
+
#if QT_CONFIG(accessibility)
void QQuickControlPrivate::accessibilityActiveChanged(bool active)
{
@@ -337,21 +515,7 @@ QFont QQuickControlPrivate::parentFont(const QQuickItem *item)
if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
return window->font();
- return themeFont(QPlatformTheme::SystemFont);
-}
-
-QFont QQuickControlPrivate::themeFont(QPlatformTheme::Font type)
-{
- if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
- if (const QFont *font = theme->font(type)) {
- QFont f = *font;
- if (type == QPlatformTheme::SystemFont)
- f.resolve(0);
- return f;
- }
- }
-
- return QFont();
+ return QQuickTheme::font(QQuickTheme::System);
}
/*!
@@ -442,21 +606,7 @@ QPalette QQuickControlPrivate::parentPalette(const QQuickItem *item)
if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(item->window()))
return window->palette();
- return themePalette(QPlatformTheme::SystemPalette);
-}
-
-QPalette QQuickControlPrivate::themePalette(QPlatformTheme::Palette type)
-{
- if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
- if (const QPalette *palette = theme->palette(type)) {
- QPalette p = *palette;
- if (type == QPlatformTheme::SystemPalette)
- p.resolve(0);
- return p;
- }
- }
-
- return QPalette();
+ return QQuickTheme::palette(QQuickTheme::System);
}
/*!
@@ -672,14 +822,108 @@ void QQuickControlPrivate::executeBackground(bool complete)
quickCompleteDeferred(q, backgroundName(), background);
}
+void QQuickControlPrivate::updateBaselineOffset()
+{
+ Q_Q(QQuickControl);
+ if (extra.isAllocated() && extra.value().hasBaselineOffset)
+ return;
+
+ if (!contentItem)
+ q->QQuickItem::setBaselineOffset(0);
+ else
+ q->QQuickItem::setBaselineOffset(getTopPadding() + contentItem->baselineOffset());
+}
+
+void QQuickControlPrivate::addImplicitSizeListener(QQuickItem *item, ChangeTypes changes)
+{
+ addImplicitSizeListener(item, this, changes);
+}
+
+void QQuickControlPrivate::removeImplicitSizeListener(QQuickItem *item, ChangeTypes changes)
+{
+ removeImplicitSizeListener(item, this, changes);
+}
+
+void QQuickControlPrivate::addImplicitSizeListener(QQuickItem *item, QQuickItemChangeListener *listener, ChangeTypes changes)
+{
+ if (!item || !listener)
+ return;
+ QQuickItemPrivate::get(item)->addItemChangeListener(listener, changes);
+}
+
+void QQuickControlPrivate::removeImplicitSizeListener(QQuickItem *item, QQuickItemChangeListener *listener, ChangeTypes changes)
+{
+ if (!item || !listener)
+ return;
+ QQuickItemPrivate::get(item)->removeItemChangeListener(listener, changes);
+}
+
+void QQuickControlPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickControl);
+ if (item == background)
+ emit q->implicitBackgroundWidthChanged();
+ else if (item == contentItem)
+ updateImplicitContentWidth();
+}
+
+void QQuickControlPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickControl);
+ if (item == background)
+ emit q->implicitBackgroundHeightChanged();
+ else if (item == contentItem)
+ updateImplicitContentHeight();
+}
+
+void QQuickControlPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
+{
+ Q_UNUSED(diff);
+ if (resizingBackground || item != background || !change.sizeChange())
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ // Only set hasBackgroundWidth/Height if it was a width/height change,
+ // otherwise we're prevented from setting a width/height in the future.
+ if (change.widthChange())
+ extra.value().hasBackgroundWidth = p->widthValid;
+ if (change.heightChange())
+ extra.value().hasBackgroundHeight = p->heightValid;
+ resizeBackground();
+}
+
+void QQuickControlPrivate::itemDestroyed(QQuickItem *item)
+{
+ Q_Q(QQuickControl);
+ if (item == background) {
+ background = nullptr;
+ emit q->implicitBackgroundWidthChanged();
+ emit q->implicitBackgroundHeightChanged();
+ } else if (item == contentItem) {
+ contentItem = nullptr;
+ updateImplicitContentSize();
+ }
+}
+
QQuickControl::QQuickControl(QQuickItem *parent)
: QQuickItem(*(new QQuickControlPrivate), parent)
{
+ Q_D(QQuickControl);
+ d->init();
}
QQuickControl::QQuickControl(QQuickControlPrivate &dd, QQuickItem *parent)
: QQuickItem(dd, parent)
{
+ Q_D(QQuickControl);
+ d->init();
+}
+
+QQuickControl::~QQuickControl()
+{
+ Q_D(QQuickControl);
+ d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
+ d->removeImplicitSizeListener(d->contentItem);
}
void QQuickControl::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &value)
@@ -861,10 +1105,18 @@ void QQuickControl::setPadding(qreal padding)
Q_D(QQuickControl);
if (qFuzzyCompare(d->padding, padding))
return;
- QMarginsF oldPadding(leftPadding(), topPadding(), rightPadding(), bottomPadding());
+
+ const QMarginsF oldPadding = d->getPadding();
+ const qreal oldVerticalPadding = d->getVerticalPadding();
+ const qreal oldHorizontalPadding = d->getHorizontalPadding();
+
d->padding = padding;
emit paddingChanged();
- QMarginsF newPadding(leftPadding(), topPadding(), rightPadding(), bottomPadding());
+
+ const QMarginsF newPadding = d->getPadding();
+ const qreal newVerticalPadding = d->getVerticalPadding();
+ const qreal newHorizontalPadding = d->getHorizontalPadding();
+
if (!qFuzzyCompare(newPadding.top(), oldPadding.top()))
emit topPaddingChanged();
if (!qFuzzyCompare(newPadding.left(), oldPadding.left()))
@@ -873,10 +1125,15 @@ void QQuickControl::setPadding(qreal padding)
emit rightPaddingChanged();
if (!qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
emit bottomPaddingChanged();
+ if (!qFuzzyCompare(newVerticalPadding, oldVerticalPadding))
+ emit verticalPaddingChanged();
+ if (!qFuzzyCompare(newHorizontalPadding, oldHorizontalPadding))
+ emit horizontalPaddingChanged();
if (!qFuzzyCompare(newPadding.top(), oldPadding.top()) || !qFuzzyCompare(newPadding.bottom(), oldPadding.bottom()))
emit availableHeightChanged();
if (!qFuzzyCompare(newPadding.left(), oldPadding.left()) || !qFuzzyCompare(newPadding.right(), oldPadding.right()))
emit availableWidthChanged();
+
paddingChange(newPadding, oldPadding);
}
@@ -888,16 +1145,15 @@ void QQuickControl::resetPadding()
/*!
\qmlproperty real QtQuick.Controls::Control::topPadding
- This property holds the top padding.
+ This property holds the top padding. Unless explicitly set, the value
+ is equal to \c verticalPadding.
- \sa {Control Layout}, padding, bottomPadding, availableHeight
+ \sa {Control Layout}, padding, bottomPadding, verticalPadding, availableHeight
*/
qreal QQuickControl::topPadding() const
{
Q_D(const QQuickControl);
- if (d->hasTopPadding)
- return d->topPadding;
- return d->padding;
+ return d->getTopPadding();
}
void QQuickControl::setTopPadding(qreal padding)
@@ -915,16 +1171,15 @@ void QQuickControl::resetTopPadding()
/*!
\qmlproperty real QtQuick.Controls::Control::leftPadding
- This property holds the left padding.
+ This property holds the left padding. Unless explicitly set, the value
+ is equal to \c horizontalPadding.
- \sa {Control Layout}, padding, rightPadding, availableWidth
+ \sa {Control Layout}, padding, rightPadding, horizontalPadding, availableWidth
*/
qreal QQuickControl::leftPadding() const
{
Q_D(const QQuickControl);
- if (d->hasLeftPadding)
- return d->leftPadding;
- return d->padding;
+ return d->getLeftPadding();
}
void QQuickControl::setLeftPadding(qreal padding)
@@ -942,16 +1197,15 @@ void QQuickControl::resetLeftPadding()
/*!
\qmlproperty real QtQuick.Controls::Control::rightPadding
- This property holds the right padding.
+ This property holds the right padding. Unless explicitly set, the value
+ is equal to \c horizontalPadding.
- \sa {Control Layout}, padding, leftPadding, availableWidth
+ \sa {Control Layout}, padding, leftPadding, horizontalPadding, availableWidth
*/
qreal QQuickControl::rightPadding() const
{
Q_D(const QQuickControl);
- if (d->hasRightPadding)
- return d->rightPadding;
- return d->padding;
+ return d->getRightPadding();
}
void QQuickControl::setRightPadding(qreal padding)
@@ -969,16 +1223,15 @@ void QQuickControl::resetRightPadding()
/*!
\qmlproperty real QtQuick.Controls::Control::bottomPadding
- This property holds the bottom padding.
+ This property holds the bottom padding. Unless explicitly set, the value
+ is equal to \c verticalPadding.
- \sa {Control Layout}, padding, topPadding, availableHeight
+ \sa {Control Layout}, padding, topPadding, verticalPadding, availableHeight
*/
qreal QQuickControl::bottomPadding() const
{
Q_D(const QQuickControl);
- if (d->hasBottomPadding)
- return d->bottomPadding;
- return d->padding;
+ return d->getBottomPadding();
}
void QQuickControl::setBottomPadding(qreal padding)
@@ -1311,15 +1564,36 @@ void QQuickControl::setBackground(QQuickItem *background)
if (!d->background.isExecuting())
d->cancelBackground();
+ const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
+ const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
+
+ if (d->extra.isAllocated()) {
+ d->extra.value().hasBackgroundWidth = false;
+ d->extra.value().hasBackgroundHeight = false;
+ }
+
+ d->removeImplicitSizeListener(d->background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
delete d->background;
d->background = background;
+
if (background) {
background->setParentItem(this);
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (p->widthValid || p->heightValid) {
+ d->extra.value().hasBackgroundWidth = p->widthValid;
+ d->extra.value().hasBackgroundHeight = p->heightValid;
+ }
if (isComponentComplete())
d->resizeBackground();
+ d->addImplicitSizeListener(background, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
+
+ if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
+ emit implicitBackgroundWidthChanged();
+ if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
+ emit implicitBackgroundHeightChanged();
if (!d->background.isExecuting())
emit backgroundChanged();
}
@@ -1366,6 +1640,30 @@ void QQuickControl::setContentItem(QQuickItem *item)
d->setContentItem_helper(item, true);
}
+qreal QQuickControl::baselineOffset() const
+{
+ Q_D(const QQuickControl);
+ return d->baselineOffset;
+}
+
+void QQuickControl::setBaselineOffset(qreal offset)
+{
+ Q_D(QQuickControl);
+ d->extra.value().hasBaselineOffset = true;
+ QQuickItem::setBaselineOffset(offset);
+}
+
+void QQuickControl::resetBaselineOffset()
+{
+ Q_D(QQuickControl);
+ if (!d->extra.isAllocated() || !d->extra.value().hasBaselineOffset)
+ return;
+
+ if (d->extra.isAllocated())
+ d->extra.value().hasBaselineOffset = false;
+ d->updateBaselineOffset();
+}
+
/*!
\since QtQuick.Controls 2.3 (Qt 5.10)
\qmlproperty palette QtQuick.Controls::Control::palette
@@ -1435,6 +1733,278 @@ void QQuickControl::resetPalette()
setPalette(QPalette());
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::horizontalPadding
+
+ This property holds the horizontal padding. Unless explicitly set, the value
+ is equal to \c padding.
+
+ \sa {Control Layout}, padding, leftPadding, rightPadding, verticalPadding
+*/
+qreal QQuickControl::horizontalPadding() const
+{
+ Q_D(const QQuickControl);
+ return d->getHorizontalPadding();
+}
+
+void QQuickControl::setHorizontalPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ d->setHorizontalPadding(padding);
+}
+
+void QQuickControl::resetHorizontalPadding()
+{
+ Q_D(QQuickControl);
+ d->setHorizontalPadding(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::verticalPadding
+
+ This property holds the vertical padding. Unless explicitly set, the value
+ is equal to \c padding.
+
+ \sa {Control Layout}, padding, topPadding, bottomPadding, horizontalPadding
+*/
+qreal QQuickControl::verticalPadding() const
+{
+ Q_D(const QQuickControl);
+ return d->getVerticalPadding();
+}
+
+void QQuickControl::setVerticalPadding(qreal padding)
+{
+ Q_D(QQuickControl);
+ d->setVerticalPadding(padding);
+}
+
+void QQuickControl::resetVerticalPadding()
+{
+ Q_D(QQuickControl);
+ d->setVerticalPadding(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::implicitContentWidth
+ \readonly
+
+ This property holds the implicit content width.
+
+ For basic controls, the value is equal to \c {contentItem ? contentItem.implicitWidth : 0}.
+ For types that inherit Container or Pane, the value is calculated based on the content children.
+
+ This is typically used, together with \l implicitBackgroundWidth, to calculate
+ the \l {Item::}{implicitWidth}:
+
+ \code
+ Control {
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ }
+ \endcode
+
+ \sa implicitContentHeight, implicitBackgroundWidth
+*/
+qreal QQuickControl::implicitContentWidth() const
+{
+ Q_D(const QQuickControl);
+ return d->implicitContentWidth;
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::implicitContentHeight
+ \readonly
+
+ This property holds the implicit content height.
+
+ For basic controls, the value is equal to \c {contentItem ? contentItem.implicitHeight : 0}.
+ For types that inherit Container or Pane, the value is calculated based on the content children.
+
+ This is typically used, together with \l implicitBackgroundHeight, to calculate
+ the \l {Item::}{implicitHeight}:
+
+ \code
+ Control {
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+ }
+ \endcode
+
+ \sa implicitContentWidth, implicitBackgroundHeight
+*/
+qreal QQuickControl::implicitContentHeight() const
+{
+ Q_D(const QQuickControl);
+ return d->implicitContentHeight;
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::implicitBackgroundWidth
+ \readonly
+
+ This property holds the implicit background width.
+
+ The value is equal to \c {background ? background.implicitWidth : 0}.
+
+ This is typically used, together with \l implicitContentWidth, to calculate
+ the \l {Item::}{implicitWidth}:
+
+ \code
+ Control {
+ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,
+ implicitContentWidth + leftPadding + rightPadding)
+ }
+ \endcode
+
+ \sa implicitBackgroundHeight, implicitContentWidth
+*/
+qreal QQuickControl::implicitBackgroundWidth() const
+{
+ Q_D(const QQuickControl);
+ if (!d->background)
+ return 0;
+ return d->background->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::implicitBackgroundHeight
+ \readonly
+
+ This property holds the implicit background height.
+
+ The value is equal to \c {background ? background.implicitHeight : 0}.
+
+ This is typically used, together with \l implicitContentHeight, to calculate
+ the \l {Item::}{implicitHeight}:
+
+ \code
+ Control {
+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
+ implicitContentHeight + topPadding + bottomPadding)
+ }
+ \endcode
+
+ \sa implicitBackgroundWidth, implicitContentHeight
+*/
+qreal QQuickControl::implicitBackgroundHeight() const
+{
+ Q_D(const QQuickControl);
+ if (!d->background)
+ return 0;
+ return d->background->implicitHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::topInset
+
+ This property holds the top inset for the background.
+
+ \sa {Control Layout}, bottomInset
+*/
+qreal QQuickControl::topInset() const
+{
+ Q_D(const QQuickControl);
+ return d->getTopInset();
+}
+
+void QQuickControl::setTopInset(qreal inset)
+{
+ Q_D(QQuickControl);
+ d->setTopInset(inset);
+}
+
+void QQuickControl::resetTopInset()
+{
+ Q_D(QQuickControl);
+ d->setTopInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::leftInset
+
+ This property holds the left inset for the background.
+
+ \sa {Control Layout}, rightInset
+*/
+qreal QQuickControl::leftInset() const
+{
+ Q_D(const QQuickControl);
+ return d->getLeftInset();
+}
+
+void QQuickControl::setLeftInset(qreal inset)
+{
+ Q_D(QQuickControl);
+ d->setLeftInset(inset);
+}
+
+void QQuickControl::resetLeftInset()
+{
+ Q_D(QQuickControl);
+ d->setLeftInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::rightInset
+
+ This property holds the right inset for the background.
+
+ \sa {Control Layout}, leftInset
+*/
+qreal QQuickControl::rightInset() const
+{
+ Q_D(const QQuickControl);
+ return d->getRightInset();
+}
+
+void QQuickControl::setRightInset(qreal inset)
+{
+ Q_D(QQuickControl);
+ d->setRightInset(inset);
+}
+
+void QQuickControl::resetRightInset()
+{
+ Q_D(QQuickControl);
+ d->setRightInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Control::bottomInset
+
+ This property holds the bottom inset for the background.
+
+ \sa {Control Layout}, topInset
+*/
+qreal QQuickControl::bottomInset() const
+{
+ Q_D(const QQuickControl);
+ return d->getBottomInset();
+}
+
+void QQuickControl::setBottomInset(qreal inset)
+{
+ Q_D(QQuickControl);
+ d->setBottomInset(inset);
+}
+
+void QQuickControl::resetBottomInset()
+{
+ Q_D(QQuickControl);
+ d->setBottomInset(0, true);
+}
+
void QQuickControl::classBegin()
{
Q_D(QQuickControl);
@@ -1451,6 +2021,7 @@ void QQuickControl::componentComplete()
QQuickItem::componentComplete();
d->resizeBackground();
d->resizeContent();
+ d->updateBaselineOffset();
if (!d->hasLocale)
d->locale = QQuickControlPrivate::calcLocale(d->parentItem);
#if QT_CONFIG(quicktemplates2_hover)
@@ -1465,12 +2036,12 @@ void QQuickControl::componentComplete()
QFont QQuickControl::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
+ return QQuickTheme::font(QQuickTheme::System);
}
QPalette QQuickControl::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette);
+ return QQuickTheme::palette(QQuickTheme::System);
}
void QQuickControl::focusInEvent(QFocusEvent *event)
@@ -1632,6 +2203,7 @@ void QQuickControl::paddingChange(const QMarginsF &newPadding, const QMarginsF &
Q_UNUSED(newPadding);
Q_UNUSED(oldPadding);
d->resizeContent();
+ d->updateBaselineOffset();
}
void QQuickControl::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
@@ -1652,6 +2224,14 @@ void QQuickControl::paletteChange(const QPalette &newPalette, const QPalette &ol
Q_UNUSED(oldPalette);
}
+void QQuickControl::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
+{
+ Q_D(QQuickControl);
+ Q_UNUSED(newInset);
+ Q_UNUSED(oldInset);
+ d->resizeBackground();
+}
+
#if QT_CONFIG(accessibility)
QAccessible::Role QQuickControl::accessibleRole() const
{
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
index 6b2d48d6..a38e34f9 100644
--- a/src/quicktemplates2/qquickcontrol_p.h
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -79,12 +79,25 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControl : public QQuickItem
Q_PROPERTY(bool wheelEnabled READ isWheelEnabled WRITE setWheelEnabled NOTIFY wheelEnabledChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
+ Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset RESET resetBaselineOffset NOTIFY baselineOffsetChanged FINAL)
// 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal horizontalPadding READ horizontalPadding WRITE setHorizontalPadding RESET resetHorizontalPadding NOTIFY horizontalPaddingChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal verticalPadding READ verticalPadding WRITE setVerticalPadding RESET resetVerticalPadding NOTIFY verticalPaddingChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitContentWidth READ implicitContentWidth NOTIFY implicitContentWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitContentHeight READ implicitContentHeight NOTIFY implicitContentHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem")
public:
explicit QQuickControl(QQuickItem *parent = nullptr);
+ ~QQuickControl();
QFont font() const;
void setFont(const QFont &font);
@@ -147,11 +160,46 @@ public:
QQuickItem *contentItem() const;
void setContentItem(QQuickItem *item);
+ qreal baselineOffset() const;
+ void setBaselineOffset(qreal offset);
+ void resetBaselineOffset();
+
// 2.3 (Qt 5.10)
QPalette palette() const;
void setPalette(const QPalette &palette);
void resetPalette();
+ // 2.5 (Qt 5.12)
+ qreal horizontalPadding() const;
+ void setHorizontalPadding(qreal padding);
+ void resetHorizontalPadding();
+
+ qreal verticalPadding() const;
+ void setVerticalPadding(qreal padding);
+ void resetVerticalPadding();
+
+ qreal implicitContentWidth() const;
+ qreal implicitContentHeight() const;
+
+ qreal implicitBackgroundWidth() const;
+ qreal implicitBackgroundHeight() const;
+
+ qreal topInset() const;
+ void setTopInset(qreal inset);
+ void resetTopInset();
+
+ qreal leftInset() const;
+ void setLeftInset(qreal inset);
+ void resetLeftInset();
+
+ qreal rightInset() const;
+ void setRightInset(qreal inset);
+ void resetRightInset();
+
+ qreal bottomInset() const;
+ void setBottomInset(qreal inset);
+ void resetBottomInset();
+
Q_SIGNALS:
void fontChanged();
void availableWidthChanged();
@@ -172,8 +220,20 @@ Q_SIGNALS:
void wheelEnabledChanged();
void backgroundChanged();
void contentItemChanged();
+ void baselineOffsetChanged();
// 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void horizontalPaddingChanged();
+ Q_REVISION(5) void verticalPaddingChanged();
+ Q_REVISION(5) void implicitContentWidthChanged();
+ Q_REVISION(5) void implicitContentHeightChanged();
+ Q_REVISION(5) void implicitBackgroundWidthChanged();
+ Q_REVISION(5) void implicitBackgroundHeightChanged();
+ Q_REVISION(5) void topInsetChanged();
+ Q_REVISION(5) void leftInsetChanged();
+ Q_REVISION(5) void rightInsetChanged();
+ Q_REVISION(5) void bottomInsetChanged();
protected:
virtual QFont defaultFont() const;
@@ -217,6 +277,7 @@ protected:
virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
virtual void paletteChange(const QPalette &newPalette, const QPalette &oldPalette);
+ virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
#if QT_CONFIG(accessibility)
virtual QAccessible::Role accessibleRole() const;
diff --git a/src/quicktemplates2/qquickcontrol_p_p.h b/src/quicktemplates2/qquickcontrol_p_p.h
index f90bb094..a657307b 100644
--- a/src/quicktemplates2/qquickcontrol_p_p.h
+++ b/src/quicktemplates2/qquickcontrol_p_p.h
@@ -50,10 +50,11 @@
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
#include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQml/private/qlazilyallocated_p.h>
-#include <qpa/qplatformtheme.h>
#if QT_CONFIG(accessibility)
#include <QtGui/qaccessible.h>
@@ -63,7 +64,7 @@ QT_BEGIN_NAMESPACE
class QQuickAccessibleAttached;
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControlPrivate : public QQuickItemPrivate
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickControlPrivate : public QQuickItemPrivate, public QQuickItemChangeListener
#if QT_CONFIG(accessibility)
, public QAccessible::ActivationObserver
#endif
@@ -79,6 +80,8 @@ public:
return control->d_func();
}
+ void init();
+
#if QT_CONFIG(quicktemplates2_multitouch)
virtual bool acceptTouch(const QTouchEvent::TouchPoint &point);
#endif
@@ -89,10 +92,31 @@ public:
void mirrorChange() override;
+ inline QMarginsF getPadding() const { return QMarginsF(getLeftPadding(), getTopPadding(), getRightPadding(), getBottomPadding()); }
+ inline qreal getTopPadding() const { return extra.isAllocated() && extra->hasTopPadding ? extra->topPadding : getVerticalPadding(); }
+ inline qreal getLeftPadding() const { return extra.isAllocated() && extra->hasLeftPadding ? extra->leftPadding : getHorizontalPadding(); }
+ inline qreal getRightPadding() const { return extra.isAllocated() && extra->hasRightPadding ? extra->rightPadding : getHorizontalPadding(); }
+ inline qreal getBottomPadding() const { return extra.isAllocated() && extra->hasBottomPadding ? extra->bottomPadding : getVerticalPadding(); }
+ inline qreal getHorizontalPadding() const { return hasHorizontalPadding ? horizontalPadding : padding; }
+ inline qreal getVerticalPadding() const { return hasVerticalPadding ? verticalPadding : padding; }
+
void setTopPadding(qreal value, bool reset = false);
void setLeftPadding(qreal value, bool reset = false);
void setRightPadding(qreal value, bool reset = false);
void setBottomPadding(qreal value, bool reset = false);
+ void setHorizontalPadding(qreal value, bool reset = false);
+ void setVerticalPadding(qreal value, bool reset = false);
+
+ inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
+ inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
+ inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
+ inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
+ inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
+
+ void setTopInset(qreal value, bool reset = false);
+ void setLeftInset(qreal value, bool reset = false);
+ void setRightInset(qreal value, bool reset = false);
+ void setBottomInset(qreal value, bool reset = false);
void resizeBackground();
virtual void resizeContent();
@@ -116,7 +140,6 @@ public:
updateFont(font);
}
static QFont parentFont(const QQuickItem *item);
- static QFont themeFont(QPlatformTheme::Font type);
virtual void resolvePalette();
void inheritPalette(const QPalette &palette);
@@ -128,7 +151,6 @@ public:
updatePalette(palette);
}
static QPalette parentPalette(const QQuickItem *item);
- static QPalette themePalette(QPlatformTheme::Palette type);
void updateLocale(const QLocale &l, bool e);
static void updateLocaleRecur(QQuickItem *item, const QLocale &l);
@@ -146,28 +168,68 @@ public:
virtual void cancelBackground();
virtual void executeBackground(bool complete = false);
+ void updateBaselineOffset();
+
+ static const ChangeTypes ImplicitSizeChanges;
+
+ void addImplicitSizeListener(QQuickItem *item, ChangeTypes changes = ImplicitSizeChanges);
+ void removeImplicitSizeListener(QQuickItem *item, ChangeTypes changes = ImplicitSizeChanges);
+
+ static void addImplicitSizeListener(QQuickItem *item, QQuickItemChangeListener *listener, ChangeTypes changes = ImplicitSizeChanges);
+ static void removeImplicitSizeListener(QQuickItem *item, QQuickItemChangeListener *listener, ChangeTypes changes = ImplicitSizeChanges);
+
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ void itemDestroyed(QQuickItem *item) override;
+
+ virtual qreal getContentWidth() const;
+ virtual qreal getContentHeight() const;
+
+ void updateImplicitContentWidth();
+ void updateImplicitContentHeight();
+ void updateImplicitContentSize();
+
struct ExtraData {
+ bool hasTopPadding = false;
+ bool hasLeftPadding = false;
+ bool hasRightPadding = false;
+ bool hasBottomPadding = false;
+ bool hasBaselineOffset = false;
+ bool hasTopInset = false;
+ bool hasLeftInset = false;
+ bool hasRightInset = false;
+ bool hasBottomInset = false;
+ bool hasBackgroundWidth = false;
+ bool hasBackgroundHeight = false;
+ qreal topPadding = 0;
+ qreal leftPadding = 0;
+ qreal rightPadding = 0;
+ qreal bottomPadding = 0;
+ qreal topInset = 0;
+ qreal leftInset = 0;
+ qreal rightInset = 0;
+ qreal bottomInset = 0;
QFont requestedFont;
QPalette requestedPalette;
};
QLazilyAllocated<ExtraData> extra;
- bool hasTopPadding = false;
- bool hasLeftPadding = false;
- bool hasRightPadding = false;
- bool hasBottomPadding = false;
+ bool hasHorizontalPadding = false;
+ bool hasVerticalPadding = false;
bool hasLocale = false;
bool wheelEnabled = false;
#if QT_CONFIG(quicktemplates2_hover)
bool hovered = false;
bool explicitHoverEnabled = false;
#endif
+ bool resizingBackground = false;
int touchId = -1;
qreal padding = 0;
- qreal topPadding = 0;
- qreal leftPadding = 0;
- qreal rightPadding = 0;
- qreal bottomPadding = 0;
+ qreal horizontalPadding = 0;
+ qreal verticalPadding = 0;
+ qreal implicitContentWidth = 0;
+ qreal implicitContentHeight = 0;
qreal spacing = 0;
QLocale locale;
QFont resolvedFont;
diff --git a/src/quicktemplates2/qquickdelaybutton.cpp b/src/quicktemplates2/qquickdelaybutton.cpp
index 5b32fc71..ba5953a0 100644
--- a/src/quicktemplates2/qquickdelaybutton.cpp
+++ b/src/quicktemplates2/qquickdelaybutton.cpp
@@ -256,12 +256,12 @@ void QQuickDelayButton::nextCheckState()
QFont QQuickDelayButton::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::PushButtonFont);
+ return QQuickTheme::font(QQuickTheme::Button);
}
QPalette QQuickDelayButton::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ButtonPalette);
+ return QQuickTheme::palette(QQuickTheme::Button);
}
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickdial.cpp b/src/quicktemplates2/qquickdial.cpp
index a4124678..123f9b1b 100644
--- a/src/quicktemplates2/qquickdial.cpp
+++ b/src/quicktemplates2/qquickdial.cpp
@@ -75,6 +75,8 @@ QT_BEGIN_NAMESPACE
\row \li Set \l value to \l to \li \c Qt.Key_End
\endtable
+ \include qquickdial.qdocinc inputMode
+
\sa {Customizing Dial}, {Input Controls}
*/
@@ -99,9 +101,12 @@ public:
qreal valueAt(qreal position) const;
qreal snapPosition(qreal position) const;
qreal positionAt(const QPointF &point) const;
+ qreal circularPositionAt(const QPointF &point) const;
+ qreal linearPositionAt(const QPointF &point) const;
void setPosition(qreal position);
void updatePosition();
bool isLargeChange(const QPointF &eventPos, qreal proposedPosition) const;
+ bool isHorizontalOrVertical() const;
void handlePress(const QPointF &point) override;
void handleMove(const QPointF &point) override;
@@ -119,7 +124,9 @@ public:
qreal stepSize = 0;
bool pressed = false;
QPointF pressPoint;
+ qreal positionBeforePress = 0;
QQuickDial::SnapMode snapMode = QQuickDial::NoSnap;
+ QQuickDial::InputMode inputMode = QQuickDial::Circular;
bool wrap = false;
bool live = true;
QQuickDeferredPointer<QQuickItem> handle;
@@ -145,6 +152,11 @@ qreal QQuickDialPrivate::snapPosition(qreal position) const
qreal QQuickDialPrivate::positionAt(const QPointF &point) const
{
+ return inputMode == QQuickDial::Circular ? circularPositionAt(point) : linearPositionAt(point);
+}
+
+qreal QQuickDialPrivate::circularPositionAt(const QPointF &point) const
+{
qreal yy = height / 2.0 - point.y();
qreal xx = point.x() - width / 2.0;
qreal angle = (xx || yy) ? std::atan2(yy, xx) : 0;
@@ -156,6 +168,32 @@ qreal QQuickDialPrivate::positionAt(const QPointF &point) const
return normalizedAngle;
}
+qreal QQuickDialPrivate::linearPositionAt(const QPointF &point) const
+{
+ // This value determines the range (either horizontal or vertical)
+ // within which the dial can be dragged.
+ // The larger this value is, the further the drag distance
+ // must be to go from a position of e.g. 0.0 to 1.0.
+ qreal dragArea = 0;
+
+ // The linear input mode uses a "relative" input system,
+ // where the distance from the press point is used to calculate
+ // the change in position. Moving the mouse above the press
+ // point increases the position (when inputMode is Vertical),
+ // and vice versa. This prevents the dial from jumping when clicked.
+ qreal dragDistance = 0;
+
+ if (inputMode == QQuickDial::Horizontal) {
+ dragArea = width * 2;
+ dragDistance = pressPoint.x() - point.x();
+ } else {
+ dragArea = height * 2;
+ dragDistance = point.y() - pressPoint.y();
+ }
+ const qreal normalisedDifference = dragDistance / dragArea;
+ return qBound(0.0, positionBeforePress - normalisedDifference, 1.0);
+}
+
void QQuickDialPrivate::setPosition(qreal pos)
{
Q_Q(QQuickDial);
@@ -184,11 +222,17 @@ bool QQuickDialPrivate::isLargeChange(const QPointF &eventPos, qreal proposedPos
return qAbs(proposedPosition - position) >= 0.5 && eventPos.y() >= height / 2;
}
+bool QQuickDialPrivate::isHorizontalOrVertical() const
+{
+ return inputMode == QQuickDial::Horizontal || inputMode == QQuickDial::Vertical;
+}
+
void QQuickDialPrivate::handlePress(const QPointF &point)
{
Q_Q(QQuickDial);
QQuickControlPrivate::handlePress(point);
pressPoint = point;
+ positionBeforePress = position;
q->setPressed(true);
}
@@ -201,7 +245,7 @@ void QQuickDialPrivate::handleMove(const QPointF &point)
if (snapMode == QQuickDial::SnapAlways)
pos = snapPosition(pos);
- if (wrap || (!wrap && !isLargeChange(point, pos))) {
+ if (wrap || (!wrap && (isHorizontalOrVertical() || !isLargeChange(point, pos)))) {
if (live)
q->setValue(valueAt(pos));
else
@@ -221,7 +265,7 @@ void QQuickDialPrivate::handleRelease(const QPointF &point)
if (snapMode != QQuickDial::NoSnap)
pos = snapPosition(pos);
- if (wrap || (!wrap && !isLargeChange(point, pos)))
+ if (wrap || (!wrap && (isHorizontalOrVertical() || !isLargeChange(point, pos))))
q->setValue(valueAt(pos));
if (!qFuzzyCompare(pos, oldPos))
emit q->moved();
@@ -232,6 +276,7 @@ void QQuickDialPrivate::handleRelease(const QPointF &point)
q->setPressed(false);
pressPoint = QPointF();
+ positionBeforePress = 0;
}
void QQuickDialPrivate::handleUngrab()
@@ -239,6 +284,7 @@ void QQuickDialPrivate::handleUngrab()
Q_Q(QQuickDial);
QQuickControlPrivate::handleUngrab();
pressPoint = QPointF();
+ positionBeforePress = 0;
q->setPressed(false);
}
@@ -454,6 +500,32 @@ void QQuickDial::setSnapMode(SnapMode mode)
}
/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty enumeration QtQuick.Controls::Dial::inputMode
+
+ This property holds the input mode.
+
+ \include qquickdial.qdocinc inputMode
+
+ The default value is \c Dial.Circular.
+*/
+QQuickDial::InputMode QQuickDial::inputMode() const
+{
+ Q_D(const QQuickDial);
+ return d->inputMode;
+}
+
+void QQuickDial::setInputMode(QQuickDial::InputMode mode)
+{
+ Q_D(QQuickDial);
+ if (d->inputMode == mode)
+ return;
+
+ d->inputMode = mode;
+ emit inputModeChanged();
+}
+
+/*!
\qmlproperty bool QtQuick.Controls::Dial::wrap
This property holds whether the dial wraps when dragged.
diff --git a/src/quicktemplates2/qquickdial_p.h b/src/quicktemplates2/qquickdial_p.h
index d2caccfc..cc641c78 100644
--- a/src/quicktemplates2/qquickdial_p.h
+++ b/src/quicktemplates2/qquickdial_p.h
@@ -72,6 +72,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDial : public QQuickControl
Q_PROPERTY(QQuickItem *handle READ handle WRITE setHandle NOTIFY handleChanged FINAL)
// 2.2 (Qt 5.9)
Q_PROPERTY(bool live READ live WRITE setLive NOTIFY liveChanged FINAL REVISION 2)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(InputMode inputMode READ inputMode WRITE setInputMode NOTIFY inputModeChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,handle")
public:
@@ -103,6 +105,13 @@ public:
SnapMode snapMode() const;
void setSnapMode(SnapMode mode);
+ enum InputMode {
+ Circular,
+ Horizontal,
+ Vertical,
+ };
+ Q_ENUM(InputMode)
+
bool wrap() const;
void setWrap(bool wrap);
@@ -116,6 +125,10 @@ public:
bool live() const;
void setLive(bool live);
+ // 2.5 (Qt 5.12)
+ InputMode inputMode() const;
+ void setInputMode(InputMode mode);
+
public Q_SLOTS:
void increase();
void decrease();
@@ -134,6 +147,8 @@ Q_SIGNALS:
// 2.2 (Qt 5.9)
Q_REVISION(2) void moved();
Q_REVISION(2) void liveChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void inputModeChanged();
protected:
void keyPressEvent(QKeyEvent *event) override;
diff --git a/src/quicktemplates2/qquickdialog.cpp b/src/quicktemplates2/qquickdialog.cpp
index cce1ae47..7d3152e2 100644
--- a/src/quicktemplates2/qquickdialog.cpp
+++ b/src/quicktemplates2/qquickdialog.cpp
@@ -183,7 +183,13 @@ QQuickDialog::QQuickDialog(QObject *parent)
: QQuickPopup(*(new QQuickDialogPrivate), parent)
{
Q_D(QQuickDialog);
- d->layout.reset(new QQuickPageLayout(d->popupItem));
+ connect(d->popupItem, &QQuickPopupItem::titleChanged, this, &QQuickDialog::titleChanged);
+ connect(d->popupItem, &QQuickPopupItem::headerChanged, this, &QQuickDialog::headerChanged);
+ connect(d->popupItem, &QQuickPopupItem::footerChanged, this, &QQuickDialog::footerChanged);
+ connect(d->popupItem, &QQuickPopupItem::implicitHeaderWidthChanged, this, &QQuickDialog::implicitHeaderWidthChanged);
+ connect(d->popupItem, &QQuickPopupItem::implicitHeaderHeightChanged, this, &QQuickDialog::implicitHeaderHeightChanged);
+ connect(d->popupItem, &QQuickPopupItem::implicitFooterWidthChanged, this, &QQuickDialog::implicitFooterWidthChanged);
+ connect(d->popupItem, &QQuickPopupItem::implicitFooterHeightChanged, this, &QQuickDialog::implicitFooterHeightChanged);
}
/*!
@@ -206,18 +212,14 @@ QQuickDialog::QQuickDialog(QObject *parent)
QString QQuickDialog::title() const
{
Q_D(const QQuickDialog);
- return d->title;
+ return d->popupItem->title();
}
void QQuickDialog::setTitle(const QString &title)
{
Q_D(QQuickDialog);
- if (d->title == title)
- return;
-
- d->title = title;
+ d->popupItem->setTitle(title);
setAccessibleName(title);
- emit titleChanged();
}
/*!
@@ -239,14 +241,14 @@ void QQuickDialog::setTitle(const QString &title)
QQuickItem *QQuickDialog::header() const
{
Q_D(const QQuickDialog);
- return d->layout->header();
+ return d->popupItem->header();
}
void QQuickDialog::setHeader(QQuickItem *header)
{
Q_D(QQuickDialog);
- QQuickItem *oldHeader = d->layout->header();
- if (!d->layout->setHeader(header))
+ QQuickItem *oldHeader = d->popupItem->header();
+ if (oldHeader == header)
return;
if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(oldHeader)) {
@@ -256,6 +258,7 @@ void QQuickDialog::setHeader(QQuickItem *header)
if (d->buttonBox == buttonBox)
d->buttonBox = nullptr;
}
+
if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(header)) {
connect(buttonBox, &QQuickDialogButtonBox::accepted, this, &QQuickDialog::accept);
connect(buttonBox, &QQuickDialogButtonBox::rejected, this, &QQuickDialog::reject);
@@ -264,9 +267,7 @@ void QQuickDialog::setHeader(QQuickItem *header)
buttonBox->setStandardButtons(d->standardButtons);
}
- if (isComponentComplete())
- d->layout->update();
- emit headerChanged();
+ d->popupItem->setHeader(header);
}
/*!
@@ -288,14 +289,14 @@ void QQuickDialog::setHeader(QQuickItem *header)
QQuickItem *QQuickDialog::footer() const
{
Q_D(const QQuickDialog);
- return d->layout->footer();
+ return d->popupItem->footer();
}
void QQuickDialog::setFooter(QQuickItem *footer)
{
Q_D(QQuickDialog);
- QQuickItem *oldFooter = d->layout->footer();
- if (!d->layout->setFooter(footer))
+ QQuickItem *oldFooter = d->popupItem->footer();
+ if (oldFooter == footer)
return;
if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(oldFooter)) {
@@ -313,9 +314,7 @@ void QQuickDialog::setFooter(QQuickItem *footer)
buttonBox->setStandardButtons(d->standardButtons);
}
- if (isComponentComplete())
- d->layout->update();
- emit footerChanged();
+ d->popupItem->setFooter(footer);
}
/*!
@@ -413,6 +412,74 @@ void QQuickDialog::setResult(int result)
}
/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Dialog::implicitHeaderWidth
+ \readonly
+
+ This property holds the implicit header width.
+
+ The value is equal to \c {header && header.visible ? header.implicitWidth : 0}.
+
+ \sa implicitHeaderHeight, implicitFooterWidth
+*/
+qreal QQuickDialog::implicitHeaderWidth() const
+{
+ Q_D(const QQuickDialog);
+ return d->popupItem->implicitHeaderWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Dialog::implicitHeaderHeight
+ \readonly
+
+ This property holds the implicit header height.
+
+ The value is equal to \c {header && header.visible ? header.implicitHeight : 0}.
+
+ \sa implicitHeaderWidth, implicitFooterHeight
+*/
+qreal QQuickDialog::implicitHeaderHeight() const
+{
+ Q_D(const QQuickDialog);
+ return d->popupItem->implicitHeaderHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Dialog::implicitFooterWidth
+ \readonly
+
+ This property holds the implicit footer width.
+
+ The value is equal to \c {footer && footer.visible ? footer.implicitWidth : 0}.
+
+ \sa implicitFooterHeight, implicitHeaderWidth
+*/
+qreal QQuickDialog::implicitFooterWidth() const
+{
+ Q_D(const QQuickDialog);
+ return d->popupItem->implicitFooterWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Dialog::implicitFooterHeight
+ \readonly
+
+ This property holds the implicit footer height.
+
+ The value is equal to \c {footer && footer.visible ? footer.implicitHeight : 0}.
+
+ \sa implicitFooterWidth, implicitHeaderHeight
+*/
+qreal QQuickDialog::implicitFooterHeight() const
+{
+ Q_D(const QQuickDialog);
+ return d->popupItem->implicitFooterHeight();
+}
+
+/*!
\qmlmethod void QtQuick.Controls::Dialog::accept()
Closes the dialog and emits the \l accepted() signal.
@@ -457,27 +524,6 @@ void QQuickDialog::done(int result)
emit rejected();
}
-void QQuickDialog::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickDialog);
- QQuickPopup::geometryChanged(newGeometry, oldGeometry);
- d->layout->update();
-}
-
-void QQuickDialog::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
-{
- Q_D(QQuickDialog);
- QQuickPopup::paddingChange(newPadding, oldPadding);
- d->layout->update();
-}
-
-void QQuickDialog::spacingChange(qreal newSpacing, qreal oldSpacing)
-{
- Q_D(QQuickDialog);
- QQuickPopup::spacingChange(newSpacing, oldSpacing);
- d->layout->update();
-}
-
#if QT_CONFIG(accessibility)
QAccessible::Role QQuickDialog::accessibleRole() const
{
@@ -490,7 +536,7 @@ void QQuickDialog::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->title);
+ setAccessibleName(d->popupItem->title());
}
#endif
diff --git a/src/quicktemplates2/qquickdialog_p.h b/src/quicktemplates2/qquickdialog_p.h
index d22685b6..38a1b396 100644
--- a/src/quicktemplates2/qquickdialog_p.h
+++ b/src/quicktemplates2/qquickdialog_p.h
@@ -66,6 +66,11 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialog : public QQuickPopup
// 2.3 (Qt 5.10)
Q_PROPERTY(int result READ result WRITE setResult NOTIFY resultChanged FINAL REVISION 3)
Q_FLAGS(QPlatformDialogHelper::StandardButtons)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY implicitFooterHeightChanged FINAL REVISION 5)
public:
explicit QQuickDialog(QObject *parent = nullptr);
@@ -90,6 +95,13 @@ public:
int result() const;
void setResult(int result);
+ // 2.5 (Qt 5.12)
+ qreal implicitHeaderWidth() const;
+ qreal implicitHeaderHeight() const;
+
+ qreal implicitFooterWidth() const;
+ qreal implicitFooterHeight() const;
+
public Q_SLOTS:
virtual void accept();
virtual void reject();
@@ -108,12 +120,13 @@ Q_SIGNALS:
Q_REVISION(3) void discarded();
Q_REVISION(3) void helpRequested();
Q_REVISION(3) void resultChanged();
+ // 2.5 (Qt 5.12)
+ void implicitHeaderWidthChanged();
+ void implicitHeaderHeightChanged();
+ void implicitFooterWidthChanged();
+ void implicitFooterHeightChanged();
protected:
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
- void spacingChange(qreal newSpacing, qreal oldSpacing) override;
-
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
void accessibilityActiveChanged(bool active) override;
diff --git a/src/quicktemplates2/qquickdialog_p_p.h b/src/quicktemplates2/qquickdialog_p_p.h
index e8008cec..20dce56c 100644
--- a/src/quicktemplates2/qquickdialog_p_p.h
+++ b/src/quicktemplates2/qquickdialog_p_p.h
@@ -50,7 +50,6 @@
#include <QtQuickTemplates2/private/qquickdialog_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p_p.h>
-#include <QtQuickTemplates2/private/qquickpagelayout_p_p.h>
#include <QtGui/qpa/qplatformdialoghelper.h>
QT_BEGIN_NAMESPACE
@@ -75,7 +74,6 @@ public:
int result = 0;
QString title;
QQuickDialogButtonBox *buttonBox = nullptr;
- QScopedPointer<QQuickPageLayout> layout;
QPlatformDialogHelper::StandardButtons standardButtons = QPlatformDialogHelper::NoButton;
};
diff --git a/src/quicktemplates2/qquickdialogbuttonbox.cpp b/src/quicktemplates2/qquickdialogbuttonbox.cpp
index e53313b1..03f5f8e8 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox.cpp
+++ b/src/quicktemplates2/qquickdialogbuttonbox.cpp
@@ -192,16 +192,27 @@ QT_BEGIN_NAMESPACE
\sa accepted(), rejected(), helpRequested()
*/
+static QPlatformDialogHelper::ButtonLayout platformButtonLayout()
+{
+ return QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::DialogButtonBoxLayout).value<QPlatformDialogHelper::ButtonLayout>();
+}
+
void QQuickDialogButtonBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
- Q_UNUSED(item);
- resizeContent();
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
+ if (item == contentItem)
+ resizeContent();
+ else
+ updateImplicitContentWidth();
}
void QQuickDialogButtonBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
- Q_UNUSED(item);
- resizeContent();
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
+ if (item == contentItem)
+ resizeContent();
+ else
+ updateImplicitContentHeight();
}
// adapted from QStyle::alignedRect()
@@ -212,7 +223,7 @@ static QRectF alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment
qreal y = rectangle.y();
qreal w = size.width();
qreal h = size.height();
- if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)
+ if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter || (alignment & Qt::AlignVertical_Mask) == 0)
y += (rectangle.size().height() - h) / 2;
else if ((alignment & Qt::AlignBottom) == Qt::AlignBottom)
y += rectangle.size().height() - h;
@@ -230,11 +241,8 @@ void QQuickDialogButtonBoxPrivate::resizeContent()
return;
QRectF geometry = q->boundingRect().adjusted(q->leftPadding(), q->topPadding(), -q->rightPadding(), -q->bottomPadding());
- if (alignment != 0) {
- qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentItem->property("contentWidth").toReal();
- qreal ch = (alignment & Qt::AlignVertical_Mask) == 0 ? q->availableHeight() : contentItem->property("contentHeight").toReal();
- geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(cw, ch), geometry);
- }
+ if (alignment != 0)
+ geometry = alignedRect(q->isMirrored() ? Qt::RightToLeft : Qt::LeftToRight, alignment, QSizeF(contentWidth, contentHeight), geometry);
contentItem->setPosition(geometry.topLeft());
contentItem->setSize(geometry.size());
@@ -251,8 +259,8 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
const int valign = alignment & Qt::AlignVertical_Mask;
QVector<QQuickAbstractButton *> buttons;
- const qreal maxItemWidth = ((contentItem ? contentItem->width() : q->availableWidth()) - qMax(0, count - 1) * spacing) / count;
- const qreal maxItemHeight = contentItem ? contentItem->height() : q->availableHeight();
+ const qreal cw = (alignment & Qt::AlignHorizontal_Mask) == 0 ? q->availableWidth() : contentWidth;
+ const qreal itemWidth = (cw - qMax(0, count - 1) * spacing) / count;
for (int i = 0; i < count; ++i) {
QQuickItem *item = q->itemAt(i);
@@ -260,11 +268,11 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
if (!p->widthValid) {
if (!halign)
- item->setWidth(maxItemWidth);
+ item->setWidth(itemWidth);
else
item->resetWidth();
if (!valign)
- item->setHeight(maxItemHeight);
+ item->setHeight(contentHeight);
else
item->resetHeight();
p->widthValid = false;
@@ -274,6 +282,11 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
}
struct ButtonLayout {
+ ButtonLayout(QPlatformDialogHelper::ButtonLayout layout)
+ : m_layout(QPlatformDialogHelper::buttonLayout(Qt::Horizontal, layout))
+ {
+ }
+
bool operator()(QQuickAbstractButton *first, QQuickAbstractButton *second)
{
const QPlatformDialogHelper::ButtonRole firstRole = QQuickDialogPrivate::buttonRole(first);
@@ -296,20 +309,47 @@ void QQuickDialogButtonBoxPrivate::updateLayout()
return firstRole != QPlatformDialogHelper::InvalidRole;
}
- static const int *themeButtonLayout()
- {
- const int hint = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::DialogButtonBoxLayout).toInt();
- return QPlatformDialogHelper::buttonLayout(Qt::Horizontal, static_cast<QPlatformDialogHelper::ButtonLayout>(hint));
- }
- const int *m_layout = themeButtonLayout();
+ const int *m_layout;
};
- std::sort(buttons.begin(), buttons.end(), ButtonLayout());
+ std::sort(buttons.begin(), buttons.end(), ButtonLayout(static_cast<QPlatformDialogHelper::ButtonLayout>(buttonLayout)));
for (int i = 0; i < buttons.count() - 1; ++i)
q->insertItem(i, buttons.at(i));
}
+qreal QQuickDialogButtonBoxPrivate::getContentWidth() const
+{
+ Q_Q(const QQuickDialogButtonBox);
+ const int count = contentModel->count();
+ const qreal totalSpacing = qMax(0, count - 1) * spacing;
+ qreal totalWidth = totalSpacing;
+ qreal maxWidth = 0;
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item) {
+ totalWidth += item->implicitWidth();
+ maxWidth = qMax(maxWidth, item->implicitWidth());
+ }
+ }
+ if ((alignment & Qt::AlignHorizontal_Mask) == 0)
+ totalWidth = qMax(totalWidth, count * maxWidth + totalSpacing);
+ return totalWidth;
+}
+
+qreal QQuickDialogButtonBoxPrivate::getContentHeight() const
+{
+ Q_Q(const QQuickDialogButtonBox);
+ const int count = contentModel->count();
+ qreal maxHeight = 0;
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item)
+ maxHeight = qMax(maxHeight, item->implicitHeight());
+ }
+ return maxHeight;
+}
+
void QQuickDialogButtonBoxPrivate::handleClick()
{
Q_Q(QQuickDialogButtonBox);
@@ -405,6 +445,9 @@ void QQuickDialogButtonBoxPrivate::removeStandardButtons()
QQuickDialogButtonBox::QQuickDialogButtonBox(QQuickItem *parent)
: QQuickContainer(*(new QQuickDialogButtonBoxPrivate), parent)
{
+ Q_D(QQuickDialogButtonBox);
+ d->changeTypes |= QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
+ d->buttonLayout = platformButtonLayout();
}
QQuickDialogButtonBox::~QQuickDialogButtonBox()
@@ -596,6 +639,43 @@ QQuickDialogButtonBoxAttached *QQuickDialogButtonBox::qmlAttachedProperties(QObj
return new QQuickDialogButtonBoxAttached(object);
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty enumeration QtQuick.Controls::DialogButtonBox::buttonLayout
+
+ This property holds the button layout policy to be used when arranging the buttons contained in the button box.
+ The default value is platform-specific.
+
+ Available values:
+ \value DialogButtonBox.WinLayout Use a policy appropriate for applications on Windows.
+ \value DialogButtonBox.MacLayout Use a policy appropriate for applications on macOS.
+ \value DialogButtonBox.KdeLayout Use a policy appropriate for applications on KDE.
+ \value DialogButtonBox.GnomeLayout Use a policy appropriate for applications on GNOME.
+ \value DialogButtonBox.AndroidLayout Use a policy appropriate for applications on Android.
+*/
+QPlatformDialogHelper::ButtonLayout QQuickDialogButtonBox::buttonLayout() const
+{
+ Q_D(const QQuickDialogButtonBox);
+ return d->buttonLayout;
+}
+
+void QQuickDialogButtonBox::setButtonLayout(QPlatformDialogHelper::ButtonLayout layout)
+{
+ Q_D(QQuickDialogButtonBox);
+ if (d->buttonLayout == layout)
+ return;
+
+ d->buttonLayout = layout;
+ if (isComponentComplete())
+ d->updateLayout();
+ emit buttonLayoutChanged();
+}
+
+void QQuickDialogButtonBox::resetButtonLayout()
+{
+ setButtonLayout(platformButtonLayout());
+}
+
void QQuickDialogButtonBox::updatePolish()
{
Q_D(QQuickDialogButtonBox);
@@ -640,6 +720,7 @@ void QQuickDialogButtonBox::itemAdded(int index, QQuickItem *item)
QObjectPrivate::connect(button, &QQuickAbstractButton::clicked, d, &QQuickDialogButtonBoxPrivate::handleClick);
if (QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(item, false)))
QQuickDialogButtonBoxAttachedPrivate::get(attached)->setButtonBox(this);
+ d->updateImplicitContentSize();
if (isComponentComplete())
polish();
}
@@ -652,6 +733,7 @@ void QQuickDialogButtonBox::itemRemoved(int index, QQuickItem *item)
QObjectPrivate::disconnect(button, &QQuickAbstractButton::clicked, d, &QQuickDialogButtonBoxPrivate::handleClick);
if (QQuickDialogButtonBoxAttached *attached = qobject_cast<QQuickDialogButtonBoxAttached *>(qmlAttachedPropertiesObject<QQuickDialogButtonBox>(item, false)))
QQuickDialogButtonBoxAttachedPrivate::get(attached)->setButtonBox(nullptr);
+ d->updateImplicitContentSize();
if (isComponentComplete())
polish();
}
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p.h
index 1e3cdeef..51ae473f 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p.h
@@ -66,6 +66,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickDialogButtonBox : public QQuickCont
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment RESET resetAlignment NOTIFY alignmentChanged FINAL)
Q_PROPERTY(QPlatformDialogHelper::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons NOTIFY standardButtonsChanged FINAL)
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(QPlatformDialogHelper::ButtonLayout buttonLayout READ buttonLayout WRITE setButtonLayout RESET resetButtonLayout NOTIFY buttonLayoutChanged FINAL REVISION 5)
Q_FLAGS(QPlatformDialogHelper::StandardButtons)
public:
@@ -94,6 +96,13 @@ public:
static QQuickDialogButtonBoxAttached *qmlAttachedProperties(QObject *object);
+ // 2.5 (Qt 5.12)
+ Q_ENUMS(QPlatformDialogHelper::ButtonLayout)
+
+ QPlatformDialogHelper::ButtonLayout buttonLayout() const;
+ void setButtonLayout(QPlatformDialogHelper::ButtonLayout layout);
+ void resetButtonLayout();
+
Q_SIGNALS:
void accepted();
void rejected();
@@ -107,6 +116,8 @@ Q_SIGNALS:
Q_REVISION(3) void applied();
Q_REVISION(3) void reset();
Q_REVISION(3) void discarded();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void buttonLayoutChanged();
protected:
void updatePolish() override;
diff --git a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
index a98a299b..66386911 100644
--- a/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
+++ b/src/quicktemplates2/qquickdialogbuttonbox_p_p.h
@@ -67,7 +67,12 @@ public:
void itemImplicitHeightChanged(QQuickItem *item) override;
void resizeContent() override;
+
void updateLayout();
+
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
+
void handleClick();
QQuickAbstractButton *createStandardButton(QPlatformDialogHelper::StandardButton button);
@@ -76,6 +81,7 @@ public:
Qt::Alignment alignment = 0;
QQuickDialogButtonBox::Position position = QQuickDialogButtonBox::Footer;
QPlatformDialogHelper::StandardButtons standardButtons = QPlatformDialogHelper::NoButton;
+ QPlatformDialogHelper::ButtonLayout buttonLayout = QPlatformDialogHelper::UnknownLayout;
QQmlComponent *delegate = nullptr;
};
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index e06d9bba..f2d74b31 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -37,6 +37,7 @@
#include "qquickdrawer_p.h"
#include "qquickdrawer_p_p.h"
#include "qquickpopupitem_p_p.h"
+#include "qquickpopuppositioner_p_p.h"
#include <QtGui/qstylehints.h>
#include <QtGui/private/qguiapplication_p.h>
@@ -171,6 +172,14 @@ QT_BEGIN_NAMESPACE
\sa SwipeView, {Customizing Drawer}, {Navigation Controls}, {Popup Controls}
*/
+class QQuickDrawerPositioner : public QQuickPopupPositioner
+{
+public:
+ QQuickDrawerPositioner(QQuickDrawer *drawer) : QQuickPopupPositioner(drawer) { }
+
+ void reposition() override;
+};
+
qreal QQuickDrawerPrivate::offsetAt(const QPointF &point) const
{
qreal offset = positionAt(point) - position;
@@ -203,14 +212,24 @@ qreal QQuickDrawerPrivate::positionAt(const QPointF &point) const
}
}
-void QQuickDrawerPrivate::reposition()
+QQuickPopupPositioner *QQuickDrawerPrivate::getPositioner()
{
Q_Q(QQuickDrawer);
- QQuickWindow *window = q->window();
+ if (!positioner)
+ positioner = new QQuickDrawerPositioner(q);
+ return positioner;
+}
+
+void QQuickDrawerPositioner::reposition()
+{
+ QQuickDrawer *drawer = static_cast<QQuickDrawer*>(popup());
+ QQuickWindow *window = drawer->window();
if (!window)
return;
- switch (edge) {
+ const qreal position = drawer->position();
+ QQuickItem *popupItem = drawer->popupItem();
+ switch (drawer->edge()) {
case Qt::LeftEdge:
popupItem->setX((position - 1.0) * popupItem->width());
break;
@@ -225,7 +244,7 @@ void QQuickDrawerPrivate::reposition()
break;
}
- QQuickPopupPrivate::reposition();
+ QQuickPopupPositioner::reposition();
}
void QQuickDrawerPrivate::showOverlay()
diff --git a/src/quicktemplates2/qquickdrawer_p_p.h b/src/quicktemplates2/qquickdrawer_p_p.h
index 00055cee..5f1086de 100644
--- a/src/quicktemplates2/qquickdrawer_p_p.h
+++ b/src/quicktemplates2/qquickdrawer_p_p.h
@@ -67,7 +67,7 @@ public:
qreal offsetAt(const QPointF &point) const;
qreal positionAt(const QPointF &point) const;
- void reposition() override;
+ QQuickPopupPositioner *getPositioner() override;
void showOverlay() override;
void hideOverlay() override;
void resizeOverlay() override;
diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp
index 8cc91f11..7f3c7a2d 100644
--- a/src/quicktemplates2/qquickgroupbox.cpp
+++ b/src/quicktemplates2/qquickgroupbox.cpp
@@ -92,6 +92,9 @@ public:
void cancelLabel();
void executeLabel(bool complete = false);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
QString title;
QQuickDeferredPointer<QQuickItem> label;
};
@@ -116,11 +119,33 @@ void QQuickGroupBoxPrivate::executeLabel(bool complete)
quickCompleteDeferred(q, labelName(), label);
}
+void QQuickGroupBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickGroupBox);
+ QQuickFramePrivate::itemImplicitWidthChanged(item);
+ if (item == label)
+ emit q->implicitLabelWidthChanged();
+}
+
+void QQuickGroupBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickGroupBox);
+ QQuickFramePrivate::itemImplicitHeightChanged(item);
+ if (item == label)
+ emit q->implicitLabelHeightChanged();
+}
+
QQuickGroupBox::QQuickGroupBox(QQuickItem *parent)
: QQuickFrame(*(new QQuickGroupBoxPrivate), parent)
{
}
+QQuickGroupBox::~QQuickGroupBox()
+{
+ Q_D(QQuickGroupBox);
+ d->removeImplicitSizeListener(d->label);
+}
+
/*!
\qmlproperty string QtQuick.Controls::GroupBox::title
@@ -170,14 +195,65 @@ void QQuickGroupBox::setLabel(QQuickItem *label)
if (!d->label.isExecuting())
d->cancelLabel();
+ const qreal oldImplicitLabelWidth = implicitLabelWidth();
+ const qreal oldImplicitLabelHeight = implicitLabelHeight();
+
+ d->removeImplicitSizeListener(d->label);
delete d->label;
d->label = label;
- if (label && !label->parentItem())
- label->setParentItem(this);
+
+ if (label) {
+ if (!label->parentItem())
+ label->setParentItem(this);
+ d->addImplicitSizeListener(label);
+ }
+
+ if (!qFuzzyCompare(oldImplicitLabelWidth, implicitLabelWidth()))
+ emit implicitLabelWidthChanged();
+ if (!qFuzzyCompare(oldImplicitLabelHeight, implicitLabelHeight()))
+ emit implicitLabelHeightChanged();
if (!d->label.isExecuting())
emit labelChanged();
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::GroupBox::implicitLabelWidth
+ \readonly
+
+ This property holds the implicit label width.
+
+ The value is equal to \c {label ? label.implicitWidth : 0}.
+
+ \sa implicitLabelHeight
+*/
+qreal QQuickGroupBox::implicitLabelWidth() const
+{
+ Q_D(const QQuickGroupBox);
+ if (!d->label)
+ return 0;
+ return d->label->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::GroupBox::implicitLabelHeight
+ \readonly
+
+ This property holds the implicit label height.
+
+ The value is equal to \c {label ? label.implicitHeight : 0}.
+
+ \sa implicitLabelWidth
+*/
+qreal QQuickGroupBox::implicitLabelHeight() const
+{
+ Q_D(const QQuickGroupBox);
+ if (!d->label)
+ return 0;
+ return d->label->implicitHeight();
+}
+
void QQuickGroupBox::componentComplete()
{
Q_D(QQuickGroupBox);
@@ -187,12 +263,12 @@ void QQuickGroupBox::componentComplete()
QFont QQuickGroupBox::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::GroupBoxTitleFont);
+ return QQuickTheme::font(QQuickTheme::GroupBox);
}
QPalette QQuickGroupBox::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::GroupBoxPalette);
+ return QQuickTheme::palette(QQuickTheme::GroupBox);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickgroupbox_p.h b/src/quicktemplates2/qquickgroupbox_p.h
index b46d91fd..de36d7d7 100644
--- a/src/quicktemplates2/qquickgroupbox_p.h
+++ b/src/quicktemplates2/qquickgroupbox_p.h
@@ -59,10 +59,14 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickGroupBox : public QQuickFrame
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitLabelWidth READ implicitLabelWidth NOTIFY implicitLabelWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitLabelHeight READ implicitLabelHeight NOTIFY implicitLabelHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem,label")
public:
explicit QQuickGroupBox(QQuickItem *parent = nullptr);
+ ~QQuickGroupBox();
QString title() const;
void setTitle(const QString &title);
@@ -70,9 +74,16 @@ public:
QQuickItem *label() const;
void setLabel(QQuickItem *label);
+ // 2.5 (Qt 5.12)
+ qreal implicitLabelWidth() const;
+ qreal implicitLabelHeight() const;
+
Q_SIGNALS:
void titleChanged();
void labelChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void implicitLabelWidthChanged();
+ Q_REVISION(5) void implicitLabelHeightChanged();
protected:
void componentComplete() override;
diff --git a/src/quicktemplates2/qquickitemdelegate.cpp b/src/quicktemplates2/qquickitemdelegate.cpp
index c13cd7ed..ac409118 100644
--- a/src/quicktemplates2/qquickitemdelegate.cpp
+++ b/src/quicktemplates2/qquickitemdelegate.cpp
@@ -117,12 +117,12 @@ void QQuickItemDelegate::setHighlighted(bool highlighted)
QFont QQuickItemDelegate::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ItemViewFont);
+ return QQuickTheme::font(QQuickTheme::ItemView);
}
QPalette QQuickItemDelegate::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ItemViewPalette);
+ return QQuickTheme::palette(QQuickTheme::ItemView);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index 2b23616a..124483fb 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -93,22 +93,76 @@ QQuickLabelPrivate::~QQuickLabelPrivate()
#endif
}
-void QQuickLabelPrivate::resizeBackground()
+void QQuickLabelPrivate::setTopInset(qreal value, bool reset)
{
Q_Q(QQuickLabel);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid) {
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid) {
- background->setHeight(q->height());
- p->heightValid = false;
- }
+ const QMarginsF oldInset = getInset();
+ extra.value().topInset = value;
+ extra.value().hasTopInset = !reset;
+ if (!qFuzzyCompare(oldInset.top(), value)) {
+ emit q->topInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickLabelPrivate::setLeftInset(qreal value, bool reset)
+{
+ Q_Q(QQuickLabel);
+ const QMarginsF oldInset = getInset();
+ extra.value().leftInset = value;
+ extra.value().hasLeftInset = !reset;
+ if (!qFuzzyCompare(oldInset.left(), value)) {
+ emit q->leftInsetChanged();
+ q->insetChange(getInset(), oldInset);
}
}
+void QQuickLabelPrivate::setRightInset(qreal value, bool reset)
+{
+ Q_Q(QQuickLabel);
+ const QMarginsF oldInset = getInset();
+ extra.value().rightInset = value;
+ extra.value().hasRightInset = !reset;
+ if (!qFuzzyCompare(oldInset.right(), value)) {
+ emit q->rightInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickLabelPrivate::setBottomInset(qreal value, bool reset)
+{
+ Q_Q(QQuickLabel);
+ const QMarginsF oldInset = getInset();
+ extra.value().bottomInset = value;
+ extra.value().hasBottomInset = !reset;
+ if (!qFuzzyCompare(oldInset.bottom(), value)) {
+ emit q->bottomInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickLabelPrivate::resizeBackground()
+{
+ if (!background)
+ return;
+
+ resizingBackground = true;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
+ background->setX(getLeftInset());
+ background->setWidth(width - getLeftInset() - getRightInset());
+ }
+ if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
+ background->setY(getTopInset());
+ background->setHeight(height - getTopInset() - getBottomInset());
+ }
+
+ resizingBackground = false;
+}
+
/*!
\internal
@@ -128,7 +182,7 @@ void QQuickLabelPrivate::inheritFont(const QFont &font)
QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
parentFont.resolve(extra.isAllocated() ? extra->requestedFont.resolve() | font.resolve() : font.resolve());
- const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::LabelFont);
+ const QFont defaultFont = QQuickTheme::font(QQuickTheme::Label);
const QFont resolvedFont = parentFont.resolve(defaultFont);
setFont_helper(resolvedFont);
@@ -170,7 +224,7 @@ void QQuickLabelPrivate::inheritPalette(const QPalette &palette)
QPalette parentPalette = extra.isAllocated() ? extra->requestedPalette.resolve(palette) : palette;
parentPalette.resolve(extra.isAllocated() ? extra->requestedPalette.resolve() | palette.resolve() : palette.resolve());
- const QPalette defaultPalette = QQuickControlPrivate::themePalette(QPlatformTheme::LabelPalette);
+ const QPalette defaultPalette = QQuickTheme::palette(QQuickTheme::Label);
const QPalette resolvedPalette = parentPalette.resolve(defaultPalette);
setPalette_helper(resolvedPalette);
@@ -238,6 +292,42 @@ void QQuickLabelPrivate::executeBackground(bool complete)
quickCompleteDeferred(q, backgroundName(), background);
}
+void QQuickLabelPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
+{
+ Q_UNUSED(diff);
+ if (resizingBackground || item != background || !change.sizeChange())
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ extra.value().hasBackgroundWidth = p->widthValid;
+ extra.value().hasBackgroundHeight = p->heightValid;
+ resizeBackground();
+}
+
+void QQuickLabelPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickLabel);
+ if (item == background)
+ emit q->implicitBackgroundWidthChanged();
+}
+
+void QQuickLabelPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickLabel);
+ if (item == background)
+ emit q->implicitBackgroundHeightChanged();
+}
+
+void QQuickLabelPrivate::itemDestroyed(QQuickItem *item)
+{
+ Q_Q(QQuickLabel);
+ if (item == background) {
+ background = nullptr;
+ emit q->implicitBackgroundWidthChanged();
+ emit q->implicitBackgroundHeightChanged();
+ }
+}
+
QQuickLabel::QQuickLabel(QQuickItem *parent)
: QQuickText(*(new QQuickLabelPrivate), parent)
{
@@ -245,6 +335,12 @@ QQuickLabel::QQuickLabel(QQuickItem *parent)
QObjectPrivate::connect(this, &QQuickText::textChanged, d, &QQuickLabelPrivate::textChanged);
}
+QQuickLabel::~QQuickLabel()
+{
+ Q_D(QQuickLabel);
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
+}
+
QFont QQuickLabel::font() const
{
return QQuickText::font();
@@ -288,15 +384,36 @@ void QQuickLabel::setBackground(QQuickItem *background)
if (!d->background.isExecuting())
d->cancelBackground();
+ const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
+ const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
+
+ if (d->extra.isAllocated()) {
+ d->extra.value().hasBackgroundWidth = false;
+ d->extra.value().hasBackgroundHeight = false;
+ }
+
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
delete d->background;
d->background = background;
+
if (background) {
background->setParentItem(this);
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (p->widthValid || p->heightValid) {
+ d->extra.value().hasBackgroundWidth = p->widthValid;
+ d->extra.value().hasBackgroundHeight = p->heightValid;
+ }
if (isComponentComplete())
d->resizeBackground();
+ QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
+
+ if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
+ emit implicitBackgroundWidthChanged();
+ if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
+ emit implicitBackgroundHeightChanged();
if (!d->background.isExecuting())
emit backgroundChanged();
}
@@ -333,6 +450,148 @@ void QQuickLabel::resetPalette()
setPalette(QPalette());
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Label::implicitBackgroundWidth
+ \readonly
+
+ This property holds the implicit background width.
+
+ The value is equal to \c {background ? background.implicitWidth : 0}.
+
+ \sa implicitBackgroundHeight
+*/
+qreal QQuickLabel::implicitBackgroundWidth() const
+{
+ Q_D(const QQuickLabel);
+ if (!d->background)
+ return 0;
+ return d->background->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Label::implicitBackgroundHeight
+ \readonly
+
+ This property holds the implicit background height.
+
+ The value is equal to \c {background ? background.implicitHeight : 0}.
+
+ \sa implicitBackgroundWidth
+*/
+qreal QQuickLabel::implicitBackgroundHeight() const
+{
+ Q_D(const QQuickLabel);
+ if (!d->background)
+ return 0;
+ return d->background->implicitHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Label::topInset
+
+ This property holds the top inset for the background.
+
+ \sa {Control Layout}, bottomInset
+*/
+qreal QQuickLabel::topInset() const
+{
+ Q_D(const QQuickLabel);
+ return d->getTopInset();
+}
+
+void QQuickLabel::setTopInset(qreal inset)
+{
+ Q_D(QQuickLabel);
+ d->setTopInset(inset);
+}
+
+void QQuickLabel::resetTopInset()
+{
+ Q_D(QQuickLabel);
+ d->setTopInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Label::leftInset
+
+ This property holds the left inset for the background.
+
+ \sa {Control Layout}, rightInset
+*/
+qreal QQuickLabel::leftInset() const
+{
+ Q_D(const QQuickLabel);
+ return d->getLeftInset();
+}
+
+void QQuickLabel::setLeftInset(qreal inset)
+{
+ Q_D(QQuickLabel);
+ d->setLeftInset(inset);
+}
+
+void QQuickLabel::resetLeftInset()
+{
+ Q_D(QQuickLabel);
+ d->setLeftInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Label::rightInset
+
+ This property holds the right inset for the background.
+
+ \sa {Control Layout}, leftInset
+*/
+qreal QQuickLabel::rightInset() const
+{
+ Q_D(const QQuickLabel);
+ return d->getRightInset();
+}
+
+void QQuickLabel::setRightInset(qreal inset)
+{
+ Q_D(QQuickLabel);
+ d->setRightInset(inset);
+}
+
+void QQuickLabel::resetRightInset()
+{
+ Q_D(QQuickLabel);
+ d->setRightInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Label::bottomInset
+
+ This property holds the bottom inset for the background.
+
+ \sa {Control Layout}, topInset
+*/
+qreal QQuickLabel::bottomInset() const
+{
+ Q_D(const QQuickLabel);
+ return d->getBottomInset();
+}
+
+void QQuickLabel::setBottomInset(qreal inset)
+{
+ Q_D(QQuickLabel);
+ d->setBottomInset(inset);
+}
+
+void QQuickLabel::resetBottomInset()
+{
+ Q_D(QQuickLabel);
+ d->setBottomInset(0, true);
+}
+
void QQuickLabel::classBegin()
{
Q_D(QQuickLabel);
@@ -380,4 +639,12 @@ void QQuickLabel::geometryChanged(const QRectF &newGeometry, const QRectF &oldGe
d->resizeBackground();
}
+void QQuickLabel::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
+{
+ Q_D(QQuickLabel);
+ Q_UNUSED(newInset);
+ Q_UNUSED(oldInset);
+ d->resizeBackground();
+}
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicklabel_p.h b/src/quicktemplates2/qquicklabel_p.h
index 5486d311..89c9c77b 100644
--- a/src/quicktemplates2/qquicklabel_p.h
+++ b/src/quicktemplates2/qquicklabel_p.h
@@ -63,10 +63,18 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickLabel : public QQuickText
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
// 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background")
public:
explicit QQuickLabel(QQuickItem *parent = nullptr);
+ ~QQuickLabel();
QFont font() const;
void setFont(const QFont &font);
@@ -79,11 +87,38 @@ public:
void setPalette(const QPalette &palette);
void resetPalette();
+ // 2.5 (Qt 5.12)
+ qreal implicitBackgroundWidth() const;
+ qreal implicitBackgroundHeight() const;
+
+ qreal topInset() const;
+ void setTopInset(qreal inset);
+ void resetTopInset();
+
+ qreal leftInset() const;
+ void setLeftInset(qreal inset);
+ void resetLeftInset();
+
+ qreal rightInset() const;
+ void setRightInset(qreal inset);
+ void resetRightInset();
+
+ qreal bottomInset() const;
+ void setBottomInset(qreal inset);
+ void resetBottomInset();
+
Q_SIGNALS:
void fontChanged();
void backgroundChanged();
// 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void implicitBackgroundWidthChanged();
+ Q_REVISION(5) void implicitBackgroundHeightChanged();
+ Q_REVISION(5) void topInsetChanged();
+ Q_REVISION(5) void leftInsetChanged();
+ Q_REVISION(5) void rightInsetChanged();
+ Q_REVISION(5) void bottomInsetChanged();
protected:
void classBegin() override;
@@ -91,6 +126,7 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
private:
Q_DISABLE_COPY(QQuickLabel)
diff --git a/src/quicktemplates2/qquicklabel_p_p.h b/src/quicktemplates2/qquicklabel_p_p.h
index 4d6c7de7..e1010698 100644
--- a/src/quicktemplates2/qquicklabel_p_p.h
+++ b/src/quicktemplates2/qquicklabel_p_p.h
@@ -50,6 +50,7 @@
#include <QtQml/private/qlazilyallocated_p.h>
#include <QtQuick/private/qquicktext_p_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h>
#if QT_CONFIG(accessibility)
@@ -58,7 +59,7 @@
QT_BEGIN_NAMESPACE
-class QQuickLabelPrivate : public QQuickTextPrivate
+class QQuickLabelPrivate : public QQuickTextPrivate, public QQuickItemChangeListener
#if QT_CONFIG(accessibility)
, public QAccessible::ActivationObserver
#endif
@@ -74,6 +75,17 @@ public:
return static_cast<QQuickLabelPrivate *>(QObjectPrivate::get(item));
}
+ inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
+ inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
+ inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
+ inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
+ inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
+
+ void setTopInset(qreal value, bool reset = false);
+ void setLeftInset(qreal value, bool reset = false);
+ void setRightInset(qreal value, bool reset = false);
+ void setBottomInset(qreal value, bool reset = false);
+
void resizeBackground();
void resolveFont();
@@ -104,12 +116,28 @@ public:
void cancelBackground();
void executeBackground(bool complete = false);
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemDestroyed(QQuickItem *item) override;
+
struct ExtraData {
+ bool hasTopInset = false;
+ bool hasLeftInset = false;
+ bool hasRightInset = false;
+ bool hasBottomInset = false;
+ bool hasBackgroundWidth = false;
+ bool hasBackgroundHeight = false;
+ qreal topInset = 0;
+ qreal leftInset = 0;
+ qreal rightInset = 0;
+ qreal bottomInset = 0;
QFont requestedFont;
QPalette requestedPalette;
};
QLazilyAllocated<ExtraData> extra;
+ bool resizingBackground = false;
QPalette resolvedPalette;
QQuickDeferredPointer<QQuickItem> background;
};
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp
index e321b4c9..7086db91 100644
--- a/src/quicktemplates2/qquickmenu.cpp
+++ b/src/quicktemplates2/qquickmenu.cpp
@@ -40,6 +40,7 @@
#include "qquickmenubaritem_p.h"
#include "qquickmenubar_p.h"
#include "qquickpopupitem_p_p.h"
+#include "qquickpopuppositioner_p_p.h"
#include "qquickaction_p.h"
#include <QtGui/qevent.h>
@@ -183,6 +184,14 @@ static bool shouldCascade()
#endif
}
+class QQuickMenuPositioner : public QQuickPopupPositioner
+{
+public:
+ QQuickMenuPositioner(QQuickMenu *menu) : QQuickPopupPositioner(menu) { }
+
+ void reposition() override;
+};
+
QQuickMenuPrivate::QQuickMenuPrivate()
{
Q_Q(QQuickMenu);
@@ -390,21 +399,30 @@ void QQuickMenuPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange,
resizeItems();
}
-void QQuickMenuPrivate::reposition()
+QQuickPopupPositioner *QQuickMenuPrivate::getPositioner()
{
Q_Q(QQuickMenu);
- if (parentMenu) {
- if (cascade) {
- if (popupItem->isMirrored())
- q->setPosition(QPointF(-q->width() - parentMenu->leftPadding() + q->overlap(), -q->topPadding()));
- else if (parentItem)
- q->setPosition(QPointF(parentItem->width() + parentMenu->rightPadding() - q->overlap(), -q->topPadding()));
+ if (!positioner)
+ positioner = new QQuickMenuPositioner(q);
+ return positioner;
+}
+
+void QQuickMenuPositioner::reposition()
+{
+ QQuickMenu *menu = static_cast<QQuickMenu *>(popup());
+ QQuickMenuPrivate *p = QQuickMenuPrivate::get(menu);
+ if (p->parentMenu) {
+ if (p->cascade) {
+ if (p->popupItem->isMirrored())
+ menu->setPosition(QPointF(-menu->width() - p->parentMenu->leftPadding() + menu->overlap(), -menu->topPadding()));
+ else if (p->parentItem)
+ menu->setPosition(QPointF(p->parentItem->width() + p->parentMenu->rightPadding() - menu->overlap(), -menu->topPadding()));
} else {
- q->setPosition(QPointF(parentMenu->x() + (parentMenu->width() - q->width()) / 2,
- parentMenu->y() + (parentMenu->height() - q->height()) / 2));
+ menu->setPosition(QPointF(p->parentMenu->x() + (p->parentMenu->width() - menu->width()) / 2,
+ p->parentMenu->y() + (p->parentMenu->height() - menu->height()) / 2));
}
}
- QQuickPopupPrivate::reposition();
+ QQuickPopupPositioner::reposition();
}
bool QQuickMenuPrivate::prepareEnterTransition()
@@ -1451,12 +1469,12 @@ void QQuickMenu::timerEvent(QTimerEvent *event)
QFont QQuickMenu::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::MenuFont);
+ return QQuickTheme::font(QQuickTheme::Menu);
}
QPalette QQuickMenu::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::MenuPalette);
+ return QQuickTheme::palette(QQuickTheme::Menu);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickmenu_p_p.h b/src/quicktemplates2/qquickmenu_p_p.h
index bcf3d683..c0bb2702 100644
--- a/src/quicktemplates2/qquickmenu_p_p.h
+++ b/src/quicktemplates2/qquickmenu_p_p.h
@@ -96,7 +96,7 @@ public:
void itemDestroyed(QQuickItem *item) override;
void itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &diff) override;
- void reposition() override;
+ QQuickPopupPositioner *getPositioner() override;
bool prepareEnterTransition() override;
bool prepareExitTransition() override;
bool blockInput(QQuickItem *item, const QPointF &point) const override;
diff --git a/src/quicktemplates2/qquickmenubar.cpp b/src/quicktemplates2/qquickmenubar.cpp
index 876cc471..62205b6e 100644
--- a/src/quicktemplates2/qquickmenubar.cpp
+++ b/src/quicktemplates2/qquickmenubar.cpp
@@ -79,7 +79,7 @@ QT_BEGIN_NAMESPACE
void QQuickMenuBarPrivate::createItems()
{
// removeItem() will remove stuff from contentData, so we have to make a copy of it.
- const auto originalContentData = contentData;
+ const auto originalContentData = QQuickContainerPrivate::contentData;
// Sanity check that there aren't any items we don't know about.
Q_ASSERT(contentModel->count() == 0);
@@ -230,49 +230,44 @@ void QQuickMenuBarPrivate::onMenuAboutToHide()
activateItem(nullptr);
}
-void QQuickMenuBarPrivate::updateContentSize()
+qreal QQuickMenuBarPrivate::getContentWidth() const
{
- Q_Q(QQuickMenuBar);
- if (hasContentWidth && hasContentHeight)
- return;
-
+ Q_Q(const QQuickMenuBar);
const int count = contentModel->count();
- if (count <= 0 || !contentItem)
- return;
-
- qreal maxHeight = 0;
qreal totalWidth = qMax(0, count - 1) * spacing;
-
for (int i = 0; i < count; ++i) {
QQuickItem *item = q->itemAt(i);
- if (item) {
- totalWidth += item->width();
- maxHeight = qMax(maxHeight, item->implicitHeight());
- }
- }
-
- bool contentWidthChange = false;
- if (!hasContentWidth && !qFuzzyCompare(contentWidth, totalWidth)) {
- contentWidth = totalWidth;
- contentWidthChange = true;
+ if (item)
+ totalWidth += item->implicitWidth();
}
+ return totalWidth;
+}
- bool contentHeightChange = false;
- if (!hasContentHeight && !qFuzzyCompare(contentHeight, maxHeight)) {
- contentHeight = maxHeight;
- contentHeightChange = true;
+qreal QQuickMenuBarPrivate::getContentHeight() const
+{
+ Q_Q(const QQuickMenuBar);
+ const int count = contentModel->count();
+ qreal maxHeight = 0;
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item)
+ maxHeight = qMax(maxHeight, item->implicitHeight());
}
+ return maxHeight;
+}
- if (contentWidthChange)
- emit q->contentWidthChanged();
- if (contentHeightChange)
- emit q->contentHeightChanged();
+void QQuickMenuBarPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
+ if (item != contentItem)
+ updateImplicitContentWidth();
}
-void QQuickMenuBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &)
+void QQuickMenuBarPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
- if ((change.widthChange() && !hasContentWidth) || (change.heightChange() && !hasContentHeight))
- updateContentSize();
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
+ if (item != contentItem)
+ updateImplicitContentHeight();
}
void QQuickMenuBarPrivate::contentData_append(QQmlListProperty<QObject> *prop, QObject *obj)
@@ -282,7 +277,7 @@ void QQuickMenuBarPrivate::contentData_append(QQmlListProperty<QObject> *prop, Q
if (!menuBarPrivate->componentComplete) {
// Don't add items until we're complete, as the delegate could change in the meantime.
// We'll add it to contentData and create it when we're complete.
- menuBarPrivate->contentData.append(obj);
+ menuBarPrivate->QQuickContainerPrivate::contentData.append(obj);
return;
}
@@ -433,83 +428,30 @@ QQuickMenu *QQuickMenuBar::takeMenu(int index)
}
/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
\qmlproperty real QtQuick.Controls::MenuBar::contentWidth
This property holds the content width. It is used for calculating the total
implicit width of the menu bar.
- Unless explicitly overridden, the content width is automatically calculated
- based on the total implicit width of the items and the \l {Control::}{spacing}
- of the menu bar.
+ \note This property is available in MenuBar since QtQuick.Controls 2.3 (Qt 5.10),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentHeight
+ \sa Container::contentWidth
*/
-qreal QQuickMenuBar::contentWidth() const
-{
- Q_D(const QQuickMenuBar);
- return d->contentWidth;
-}
-
-void QQuickMenuBar::setContentWidth(qreal width)
-{
- Q_D(QQuickMenuBar);
- d->hasContentWidth = true;
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
-}
-
-void QQuickMenuBar::resetContentWidth()
-{
- Q_D(QQuickMenuBar);
- if (!d->hasContentWidth)
- return;
-
- d->hasContentWidth = false;
- if (isComponentComplete())
- d->updateContentSize();
-}
/*!
+ \since QtQuick.Controls 2.3 (Qt 5.10)
\qmlproperty real QtQuick.Controls::MenuBar::contentHeight
This property holds the content height. It is used for calculating the total
implicit height of the menu bar.
- Unless explicitly overridden, the content height is automatically calculated
- based on the maximum implicit height of the items.
+ \note This property is available in MenuBar since QtQuick.Controls 2.3 (Qt 5.10),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentWidth
+ \sa Container::contentHeight
*/
-qreal QQuickMenuBar::contentHeight() const
-{
- Q_D(const QQuickMenuBar);
- return d->contentHeight;
-}
-
-void QQuickMenuBar::setContentHeight(qreal height)
-{
- Q_D(QQuickMenuBar);
- d->hasContentHeight = true;
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
-}
-
-void QQuickMenuBar::resetContentHeight()
-{
- Q_D(QQuickMenuBar);
- if (!d->hasContentHeight)
- return;
-
- d->hasContentHeight = false;
- if (isComponentComplete())
- d->updateContentSize();
-}
/*!
\qmlproperty list<Menu> QtQuick.Controls::MenuBar::menus
@@ -520,37 +462,31 @@ void QQuickMenuBar::resetContentHeight()
of the menu bar, and also menus that have been dynamically added or
inserted using the \l addMenu() and \l insertMenu() methods, respectively.
*/
-QQmlListProperty<QQuickMenu> QQuickMenuBar::menus()
+QQmlListProperty<QQuickMenu> QQuickMenuBarPrivate::menus()
{
- return QQmlListProperty<QQuickMenu>(this, nullptr,
+ Q_Q(QQuickMenuBar);
+ return QQmlListProperty<QQuickMenu>(q, nullptr,
QQuickMenuBarPrivate::menus_append,
QQuickMenuBarPrivate::menus_count,
QQuickMenuBarPrivate::menus_at,
QQuickMenuBarPrivate::menus_clear);
}
-QQmlListProperty<QObject> QQuickMenuBar::contentData()
+QQmlListProperty<QObject> QQuickMenuBarPrivate::contentData()
{
- return QQmlListProperty<QObject>(this, nullptr,
+ Q_Q(QQuickMenuBar);
+ return QQmlListProperty<QObject>(q, nullptr,
QQuickMenuBarPrivate::contentData_append,
QQuickContainerPrivate::contentData_count,
QQuickContainerPrivate::contentData_at,
QQuickContainerPrivate::contentData_clear);
}
-void QQuickMenuBar::updatePolish()
-{
- Q_D(QQuickMenuBar);
- QQuickContainer::updatePolish();
- d->updateContentSize();
-}
-
void QQuickMenuBar::componentComplete()
{
Q_D(QQuickMenuBar);
QQuickContainer::componentComplete();
d->createItems();
- d->updateContentSize();
}
bool QQuickMenuBar::eventFilter(QObject *object, QEvent *event)
@@ -633,10 +569,7 @@ void QQuickMenuBar::itemAdded(int index, QQuickItem *item)
if (QQuickMenu *menu = menuBarItem->menu())
QObjectPrivate::connect(menu, &QQuickPopup::aboutToHide, d, &QQuickMenuBarPrivate::onMenuAboutToHide);
}
- if (isComponentComplete())
- polish();
- if (isComponentComplete())
- polish();
+ d->updateImplicitContentSize();
emit menusChanged();
}
@@ -657,17 +590,18 @@ void QQuickMenuBar::itemRemoved(int index, QQuickItem *item)
if (QQuickMenu *menu = menuBarItem->menu())
QObjectPrivate::disconnect(menu, &QQuickPopup::aboutToHide, d, &QQuickMenuBarPrivate::onMenuAboutToHide);
}
+ d->updateImplicitContentSize();
emit menusChanged();
}
QFont QQuickMenuBar::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::MenuBarFont);
+ return QQuickTheme::font(QQuickTheme::MenuBar);
}
QPalette QQuickMenuBar::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::MenuBarPalette);
+ return QQuickTheme::palette(QQuickTheme::MenuBar);
}
#if QT_CONFIG(accessibility)
@@ -678,3 +612,5 @@ QAccessible::Role QQuickMenuBar::accessibleRole() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qquickmenubar_p.cpp"
diff --git a/src/quicktemplates2/qquickmenubar_p.h b/src/quicktemplates2/qquickmenubar_p.h
index 8c703f25..983bb578 100644
--- a/src/quicktemplates2/qquickmenubar_p.h
+++ b/src/quicktemplates2/qquickmenubar_p.h
@@ -59,10 +59,10 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickMenuBar : public QQuickContainer
{
Q_OBJECT
Q_PROPERTY(QQmlComponent *delegate READ delegate WRITE setDelegate NOTIFY delegateChanged FINAL)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickMenu> menus READ menus NOTIFY menusChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL) // re-declare QQuickContainer::contentWidth (REV 5)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL) // re-declare QQuickContainer::contentHeight (REV 5)
+ Q_PRIVATE_PROPERTY(QQuickMenuBar::d_func(), QQmlListProperty<QQuickMenu> menus READ menus NOTIFY menusChanged FINAL)
+ Q_PRIVATE_PROPERTY(QQuickMenuBar::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL)
public:
explicit QQuickMenuBar(QQuickItem *parent = nullptr);
@@ -76,27 +76,12 @@ public:
Q_INVOKABLE void removeMenu(QQuickMenu *menu);
Q_INVOKABLE QQuickMenu *takeMenu(int index);
- qreal contentWidth() const;
- void setContentWidth(qreal width);
- void resetContentWidth();
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
- void resetContentHeight();
-
- QQmlListProperty<QQuickMenu> menus();
- QQmlListProperty<QObject> contentData();
-
Q_SIGNALS:
void delegateChanged();
- void contentWidthChanged();
- void contentHeightChanged();
void menusChanged();
protected:
- void updatePolish() override;
void componentComplete() override;
-
bool eventFilter(QObject *object, QEvent *event) override;
void keyPressEvent(QKeyEvent *event) override;
void keyReleaseEvent(QKeyEvent *event) override;
diff --git a/src/quicktemplates2/qquickmenubar_p_p.h b/src/quicktemplates2/qquickmenubar_p_p.h
index 24824292..4d5e61e6 100644
--- a/src/quicktemplates2/qquickmenubar_p_p.h
+++ b/src/quicktemplates2/qquickmenubar_p_p.h
@@ -66,6 +66,9 @@ public:
return menuBar->d_func();
}
+ QQmlListProperty<QQuickMenu> menus();
+ QQmlListProperty<QObject> contentData();
+
void createItems();
QQuickItem *beginCreateItem();
@@ -82,8 +85,11 @@ public:
void onItemTriggered();
void onMenuAboutToHide();
- void updateContentSize();
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
+
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
static void contentData_append(QQmlListProperty<QObject> *prop, QObject *obj);
@@ -94,10 +100,6 @@ public:
bool popupMode = false;
bool triggering = false;
- bool hasContentWidth = false;
- bool hasContentHeight = false;
- qreal contentWidth = 0;
- qreal contentHeight = 0;
QQmlComponent *delegate = nullptr;
QPointer<QQuickMenuBarItem> currentItem;
};
diff --git a/src/quicktemplates2/qquickmenubaritem.cpp b/src/quicktemplates2/qquickmenubaritem.cpp
index cbf490b8..f32baff5 100644
--- a/src/quicktemplates2/qquickmenubaritem.cpp
+++ b/src/quicktemplates2/qquickmenubaritem.cpp
@@ -167,12 +167,12 @@ void QQuickMenuBarItem::geometryChanged(const QRectF &newGeometry, const QRectF
QFont QQuickMenuBarItem::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::MenuBarFont);
+ return QQuickTheme::font(QQuickTheme::MenuBar);
}
QPalette QQuickMenuBarItem::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::MenuBarPalette);
+ return QQuickTheme::palette(QQuickTheme::MenuBar);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickmenuitem.cpp b/src/quicktemplates2/qquickmenuitem.cpp
index 7a7b9b0b..b02b8e60 100644
--- a/src/quicktemplates2/qquickmenuitem.cpp
+++ b/src/quicktemplates2/qquickmenuitem.cpp
@@ -256,12 +256,12 @@ void QQuickMenuItem::componentComplete()
QFont QQuickMenuItem::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::MenuItemFont);
+ return QQuickTheme::font(QQuickTheme::Menu);
}
QPalette QQuickMenuItem::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::MenuPalette);
+ return QQuickTheme::palette(QQuickTheme::Menu);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickmenuseparator.cpp b/src/quicktemplates2/qquickmenuseparator.cpp
index dee5287a..0e2ed9e3 100644
--- a/src/quicktemplates2/qquickmenuseparator.cpp
+++ b/src/quicktemplates2/qquickmenuseparator.cpp
@@ -71,9 +71,14 @@ QQuickMenuSeparator::QQuickMenuSeparator(QQuickItem *parent)
{
}
+QFont QQuickMenuSeparator::defaultFont() const
+{
+ return QQuickTheme::font(QQuickTheme::Menu);
+}
+
QPalette QQuickMenuSeparator::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::MenuPalette);
+ return QQuickTheme::palette(QQuickTheme::Menu);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickmenuseparator_p.h b/src/quicktemplates2/qquickmenuseparator_p.h
index 002b68ba..1e687fd0 100644
--- a/src/quicktemplates2/qquickmenuseparator_p.h
+++ b/src/quicktemplates2/qquickmenuseparator_p.h
@@ -60,6 +60,7 @@ public:
explicit QQuickMenuSeparator(QQuickItem *parent = nullptr);
protected:
+ QFont defaultFont() const override;
QPalette defaultPalette() const override;
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp
index 25dce5e6..93196c4c 100644
--- a/src/quicktemplates2/qquickpage.cpp
+++ b/src/quicktemplates2/qquickpage.cpp
@@ -35,14 +35,16 @@
****************************************************************************/
#include "qquickpage_p.h"
-#include "qquickcontrol_p_p.h"
-#include "qquickpagelayout_p_p.h"
+#include "qquickpage_p_p.h"
+#include "qquicktabbar_p.h"
+#include "qquicktoolbar_p.h"
+#include "qquickdialogbuttonbox_p.h"
QT_BEGIN_NAMESPACE
/*!
\qmltype Page
- \inherits Control
+ \inherits Pane
\instantiates QQuickPage
\inqmlmodule QtQuick.Controls
\since 5.7
@@ -84,37 +86,142 @@ QT_BEGIN_NAMESPACE
{Focus Management in Qt Quick Controls 2}
*/
-class QQuickPagePrivate : public QQuickControlPrivate
+static const QQuickItemPrivate::ChangeTypes LayoutChanges = QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility | QQuickItemPrivate::Destroyed
+ | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
+
+namespace {
+ enum Position {
+ Header,
+ Footer
+ };
+
+ Q_STATIC_ASSERT(int(Header) == int(QQuickTabBar::Header));
+ Q_STATIC_ASSERT(int(Footer) == int(QQuickTabBar::Footer));
+
+ Q_STATIC_ASSERT(int(Header) == int(QQuickToolBar::Header));
+ Q_STATIC_ASSERT(int(Footer) == int(QQuickToolBar::Footer));
+
+ Q_STATIC_ASSERT(int(Header) == int(QQuickDialogButtonBox::Header));
+ Q_STATIC_ASSERT(int(Footer) == int(QQuickDialogButtonBox::Footer));
+
+ static void setPos(QQuickItem *item, Position position)
+ {
+ if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(item))
+ toolBar->setPosition(static_cast<QQuickToolBar::Position>(position));
+ else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(item))
+ tabBar->setPosition(static_cast<QQuickTabBar::Position>(position));
+ else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(item))
+ buttonBox->setPosition(static_cast<QQuickDialogButtonBox::Position>(position));
+ }
+}
+
+void QQuickPagePrivate::relayout()
{
- Q_DECLARE_PUBLIC(QQuickPage)
+ Q_Q(QQuickPage);
+ const qreal hh = header && header->isVisible() ? header->height() : 0;
+ const qreal fh = footer && footer->isVisible() ? footer->height() : 0;
+ const qreal hsp = hh > 0 ? spacing : 0;
+ const qreal fsp = fh > 0 ? spacing : 0;
+
+ if (contentItem) {
+ contentItem->setY(q->topPadding() + hh + hsp);
+ contentItem->setX(q->leftPadding());
+ contentItem->setWidth(q->availableWidth());
+ contentItem->setHeight(q->availableHeight() - hh - fh - hsp - fsp);
+ }
-public:
- QQuickItem *getContentItem() override;
+ if (header)
+ header->setWidth(q->width());
- qreal contentWidth = 0;
- qreal contentHeight = 0;
- QString title;
- QScopedPointer<QQuickPageLayout> layout;
-};
+ if (footer) {
+ footer->setY(q->height() - footer->height());
+ footer->setWidth(q->width());
+ }
+}
+
+void QQuickPagePrivate::resizeContent()
+{
+ relayout();
+}
-QQuickItem *QQuickPagePrivate::getContentItem()
+void QQuickPagePrivate::itemVisibilityChanged(QQuickItem *item)
{
Q_Q(QQuickPage);
- if (QQuickItem *item = QQuickControlPrivate::getContentItem())
- return item;
- return new QQuickItem(q);
+ QQuickPanePrivate::itemVisibilityChanged(item);
+ if (item == header) {
+ emit q->implicitHeaderWidthChanged();
+ emit q->implicitHeaderHeightChanged();
+ relayout();
+ } else if (item == footer) {
+ emit q->implicitFooterWidthChanged();
+ emit q->implicitFooterHeightChanged();
+ relayout();
+ }
+}
+
+void QQuickPagePrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickPage);
+ QQuickPanePrivate::itemImplicitWidthChanged(item);
+ if (item == header)
+ emit q->implicitHeaderWidthChanged();
+ else if (item == footer)
+ emit q->implicitFooterWidthChanged();
+}
+
+void QQuickPagePrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickPage);
+ QQuickPanePrivate::itemImplicitHeightChanged(item);
+ if (item == header)
+ emit q->implicitHeaderHeightChanged();
+ else if (item == footer)
+ emit q->implicitFooterHeightChanged();
+}
+
+void QQuickPagePrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF & diff)
+{
+ QQuickPanePrivate::itemGeometryChanged(item, change, diff);
+ if (item == header || item == footer)
+ relayout();
+}
+
+void QQuickPagePrivate::itemDestroyed(QQuickItem *item)
+{
+ Q_Q(QQuickPage);
+ QQuickPanePrivate::itemDestroyed(item);
+ if (item == header) {
+ header = nullptr;
+ relayout();
+ emit q->implicitHeaderWidthChanged();
+ emit q->implicitHeaderHeightChanged();
+ emit q->headerChanged();
+ } else if (item == footer) {
+ footer = nullptr;
+ relayout();
+ emit q->implicitFooterWidthChanged();
+ emit q->implicitFooterHeightChanged();
+ emit q->footerChanged();
+ }
}
QQuickPage::QQuickPage(QQuickItem *parent)
- : QQuickControl(*(new QQuickPagePrivate), parent)
+ : QQuickPane(*(new QQuickPagePrivate), parent)
+{
+}
+
+QQuickPage::QQuickPage(QQuickPagePrivate &dd, QQuickItem *parent)
+ : QQuickPane(dd, parent)
+{
+}
+
+QQuickPage::~QQuickPage()
{
Q_D(QQuickPage);
- setFlag(ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-#if QT_CONFIG(cursor)
- setCursor(Qt::ArrowCursor);
-#endif
- d->layout.reset(new QQuickPageLayout(this));
+ if (d->header)
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, LayoutChanges);
+ if (d->footer)
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, LayoutChanges);
}
/*!
@@ -185,16 +292,29 @@ void QQuickPage::setTitle(const QString &title)
QQuickItem *QQuickPage::header() const
{
Q_D(const QQuickPage);
- return d->layout->header();
+ return d->header;
}
void QQuickPage::setHeader(QQuickItem *header)
{
Q_D(QQuickPage);
- if (!d->layout->setHeader(header))
+ if (d->header == header)
return;
+
+ if (d->header) {
+ QQuickItemPrivate::get(d->header)->removeItemChangeListener(d, LayoutChanges);
+ d->header->setParentItem(nullptr);
+ }
+ d->header = header;
+ if (header) {
+ header->setParentItem(this);
+ QQuickItemPrivate::get(header)->addItemChangeListener(d, LayoutChanges);
+ if (qFuzzyIsNull(header->z()))
+ header->setZ(1);
+ setPos(header, Header);
+ }
if (isComponentComplete())
- d->layout->update();
+ d->relayout();
emit headerChanged();
}
@@ -213,150 +333,120 @@ void QQuickPage::setHeader(QQuickItem *header)
QQuickItem *QQuickPage::footer() const
{
Q_D(const QQuickPage);
- return d->layout->footer();
+ return d->footer;
}
void QQuickPage::setFooter(QQuickItem *footer)
{
Q_D(QQuickPage);
- if (!d->layout->setFooter(footer))
+ if (d->footer == footer)
return;
+
+ if (d->footer) {
+ QQuickItemPrivate::get(d->footer)->removeItemChangeListener(d, LayoutChanges);
+ footer->setParentItem(nullptr);
+ }
+ d->footer = footer;
+ if (footer) {
+ footer->setParentItem(this);
+ QQuickItemPrivate::get(footer)->addItemChangeListener(d, LayoutChanges);
+ if (qFuzzyIsNull(footer->z()))
+ footer->setZ(1);
+ setPos(footer, Footer);
+ }
if (isComponentComplete())
- d->layout->update();
+ d->relayout();
emit footerChanged();
}
/*!
- \qmlproperty list<Object> QtQuick.Controls::Page::contentData
- \default
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Page::implicitHeaderWidth
+ \readonly
- This property holds the list of content data.
+ This property holds the implicit header width.
- The list contains all objects that have been declared in QML as children
- of the container.
+ The value is equal to \c {header && header.visible ? header.implicitWidth : 0}.
- \note Unlike \c contentChildren, \c contentData does include non-visual QML
- objects.
-
- \sa Item::data, contentChildren
+ \sa implicitHeaderHeight, implicitFooterWidth
*/
-QQmlListProperty<QObject> QQuickPage::contentData()
+qreal QQuickPage::implicitHeaderWidth() const
{
- return QQmlListProperty<QObject>(contentItem(), nullptr,
- QQuickItemPrivate::data_append,
- QQuickItemPrivate::data_count,
- QQuickItemPrivate::data_at,
- QQuickItemPrivate::data_clear);
+ Q_D(const QQuickPage);
+ if (!d->header || !d->header->isVisible())
+ return 0;
+ return d->header->implicitWidth();
}
/*!
- \qmlproperty list<Item> QtQuick.Controls::Page::contentChildren
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Page::implicitHeaderHeight
+ \readonly
- This property holds the list of content children.
+ This property holds the implicit header height.
- The list contains all items that have been declared in QML as children
- of the page.
+ The value is equal to \c {header && header.visible ? header.implicitHeight : 0}.
- \note Unlike \c contentData, \c contentChildren does not include non-visual
- QML objects.
-
- \sa Item::children, contentData
+ \sa implicitHeaderWidth, implicitFooterHeight
*/
-QQmlListProperty<QQuickItem> QQuickPage::contentChildren()
+qreal QQuickPage::implicitHeaderHeight() const
{
- return QQmlListProperty<QQuickItem>(contentItem(), nullptr,
- QQuickItemPrivate::children_append,
- QQuickItemPrivate::children_count,
- QQuickItemPrivate::children_at,
- QQuickItemPrivate::children_clear);
+ Q_D(const QQuickPage);
+ if (!d->header || !d->header->isVisible())
+ return 0;
+ return d->header->implicitHeight();
}
/*!
- \qmlproperty real QtQuick.Controls::Page::contentWidth
- \since QtQuick.Controls 2.1 (Qt 5.8)
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Page::implicitFooterWidth
+ \readonly
+
+ This property holds the implicit footer width.
- This property holds the content width. It is used for calculating the total
- implicit width of the page.
+ The value is equal to \c {footer && footer.visible ? footer.implicitWidth : 0}.
- \sa contentHeight
+ \sa implicitFooterHeight, implicitHeaderWidth
*/
-qreal QQuickPage::contentWidth() const
+qreal QQuickPage::implicitFooterWidth() const
{
Q_D(const QQuickPage);
- return d->contentWidth;
-}
-
-void QQuickPage::setContentWidth(qreal width)
-{
- Q_D(QQuickPage);
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
+ if (!d->footer || !d->footer->isVisible())
+ return 0;
+ return d->footer->implicitWidth();
}
/*!
- \qmlproperty real QtQuick.Controls::Page::contentHeight
- \since QtQuick.Controls 2.1 (Qt 5.8)
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Page::implicitFooterHeight
+ \readonly
- This property holds the content height. It is used for calculating the total
- implicit height of the page.
+ This property holds the implicit footer height.
- \sa contentWidth
+ The value is equal to \c {footer && footer.visible ? footer.implicitHeight : 0}.
+
+ \sa implicitFooterWidth, implicitHeaderHeight
*/
-qreal QQuickPage::contentHeight() const
+qreal QQuickPage::implicitFooterHeight() const
{
Q_D(const QQuickPage);
- return d->contentHeight;
-}
-
-void QQuickPage::setContentHeight(qreal height)
-{
- Q_D(QQuickPage);
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
+ if (!d->footer || !d->footer->isVisible())
+ return 0;
+ return d->footer->implicitHeight();
}
void QQuickPage::componentComplete()
{
Q_D(QQuickPage);
- QQuickControl::componentComplete();
- d->layout->update();
-}
-
-void QQuickPage::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
-{
- QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged);
- if (newItem)
- connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPage::contentChildrenChanged);
- emit contentChildrenChanged();
-}
-
-void QQuickPage::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- Q_D(QQuickPage);
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
- d->layout->update();
-}
-
-void QQuickPage::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
-{
- Q_D(QQuickPage);
- QQuickControl::paddingChange(newPadding, oldPadding);
- d->layout->update();
+ QQuickPane::componentComplete();
+ d->relayout();
}
void QQuickPage::spacingChange(qreal newSpacing, qreal oldSpacing)
{
Q_D(QQuickPage);
- QQuickControl::spacingChange(newSpacing, oldSpacing);
- d->layout->update();
+ QQuickPane::spacingChange(newSpacing, oldSpacing);
+ d->relayout();
}
#if QT_CONFIG(accessibility)
@@ -368,7 +458,7 @@ QAccessible::Role QQuickPage::accessibleRole() const
void QQuickPage::accessibilityActiveChanged(bool active)
{
Q_D(QQuickPage);
- QQuickControl::accessibilityActiveChanged(active);
+ QQuickPane::accessibilityActiveChanged(active);
if (active)
setAccessibleName(d->title);
diff --git a/src/quicktemplates2/qquickpage_p.h b/src/quicktemplates2/qquickpage_p.h
index 0789e996..b7888ad6 100644
--- a/src/quicktemplates2/qquickpage_p.h
+++ b/src/quicktemplates2/qquickpage_p.h
@@ -48,28 +48,31 @@
// We mean it.
//
-#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickpane_p.h>
#include <QtQml/qqmllist.h>
QT_BEGIN_NAMESPACE
class QQuickPagePrivate;
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPage : public QQuickControl
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPage : public QQuickPane
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
Q_PROPERTY(QQuickItem *header READ header WRITE setHeader NOTIFY headerChanged FINAL)
Q_PROPERTY(QQuickItem *footer READ footer WRITE setFooter NOTIFY footerChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
// 2.1 (Qt 5.8)
Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL REVISION 1)
Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL REVISION 1)
- Q_CLASSINFO("DefaultProperty", "contentData")
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitHeaderWidth READ implicitHeaderWidth NOTIFY implicitHeaderWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitHeaderHeight READ implicitHeaderHeight NOTIFY implicitHeaderHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitFooterWidth READ implicitFooterWidth NOTIFY implicitFooterWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitFooterHeight READ implicitFooterHeight NOTIFY implicitFooterHeightChanged FINAL REVISION 5)
public:
explicit QQuickPage(QQuickItem *parent = nullptr);
+ ~QQuickPage();
QString title() const;
void setTitle(const QString &title);
@@ -80,31 +83,28 @@ public:
QQuickItem *footer() const;
void setFooter(QQuickItem *footer);
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
+ // 2.5 (Qt 5.12)
+ qreal implicitHeaderWidth() const;
+ qreal implicitHeaderHeight() const;
- // 2.1 (Qt 5.8)
- qreal contentWidth() const;
- void setContentWidth(qreal width);
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
+ qreal implicitFooterWidth() const;
+ qreal implicitFooterHeight() const;
Q_SIGNALS:
void titleChanged();
void headerChanged();
void footerChanged();
- void contentChildrenChanged();
- // 2.1 (Qt 5.8)
- Q_REVISION(1) void contentWidthChanged();
- Q_REVISION(1) void contentHeightChanged();
+ // 2.5 (Qt 5.12)
+ void implicitHeaderWidthChanged();
+ void implicitHeaderHeightChanged();
+ void implicitFooterWidthChanged();
+ void implicitFooterHeightChanged();
protected:
+ QQuickPage(QQuickPagePrivate &dd, QQuickItem *parent);
+
void componentComplete() override;
- void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
- void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
- void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding) override;
void spacingChange(qreal newSpacing, qreal oldSpacing) override;
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickpagelayout_p_p.h b/src/quicktemplates2/qquickpage_p_p.h
index a3807b62..b7d89ac4 100644
--- a/src/quicktemplates2/qquickpagelayout_p_p.h
+++ b/src/quicktemplates2/qquickpage_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKPAGELAYOUT_P_P_H
-#define QQUICKPAGELAYOUT_P_P_H
+#ifndef QQUICKPAGE_P_P_H
+#define QQUICKPAGE_P_P_H
//
// W A R N I N G
@@ -48,39 +48,31 @@
// We mean it.
//
-#include <QtQuick/private/qquickitemchangelistener_p.h>
+#include <QtQuickTemplates2/private/qquickpane_p_p.h>
QT_BEGIN_NAMESPACE
-class QQuickControl;
+class QQuickPane;
-class QQuickPageLayout : public QQuickItemChangeListener
+class QQuickPagePrivate : public QQuickPanePrivate
{
-public:
- explicit QQuickPageLayout(QQuickControl *control);
- ~QQuickPageLayout();
-
- QQuickItem *header() const;
- bool setHeader(QQuickItem *header);
+ Q_DECLARE_PUBLIC(QQuickPage)
- QQuickItem *footer() const;
- bool setFooter(QQuickItem *footer);
-
- void update();
+public:
+ void relayout();
+ void resizeContent() override;
-protected:
void itemVisibilityChanged(QQuickItem *item) override;
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
- void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF & diff) override;
void itemDestroyed(QQuickItem *item) override;
-private:
- QQuickItem *m_header = nullptr;
- QQuickItem *m_footer = nullptr;
- QQuickControl *m_control = nullptr;
+ QString title;
+ QQuickItem *header = nullptr;
+ QQuickItem *footer = nullptr;
};
QT_END_NAMESPACE
-#endif // QQUICKPAGELAYOUT_P_P_H
+#endif // QQUICKPAGE_P_P_H
diff --git a/src/quicktemplates2/qquickpageindicator.cpp b/src/quicktemplates2/qquickpageindicator.cpp
index dd90402e..d29158a8 100644
--- a/src/quicktemplates2/qquickpageindicator.cpp
+++ b/src/quicktemplates2/qquickpageindicator.cpp
@@ -39,7 +39,6 @@
#include <QtCore/qmath.h>
#include <QtQuick/private/qquickitem_p.h>
-#include <QtQuick/private/qquickitemchangelistener_p.h>
QT_BEGIN_NAMESPACE
@@ -84,7 +83,7 @@ QT_BEGIN_NAMESPACE
\sa SwipeView, {Customizing PageIndicator}, {Indicator Controls}
*/
-class QQuickPageIndicatorPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+class QQuickPageIndicatorPrivate : public QQuickControlPrivate
{
Q_DECLARE_PUBLIC(QQuickPageIndicator)
diff --git a/src/quicktemplates2/qquickpagelayout.cpp b/src/quicktemplates2/qquickpagelayout.cpp
deleted file mode 100644
index 6312cc97..00000000
--- a/src/quicktemplates2/qquickpagelayout.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: http://www.qt.io/licensing/
-**
-** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL3$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPLv3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or later as published by the Free
-** Software Foundation and appearing in the file LICENSE.GPL included in
-** the packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 2.0 requirements will be
-** met: http://www.gnu.org/licenses/gpl-2.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickpagelayout_p_p.h"
-#include "qquickcontrol_p.h"
-#include "qquickcontrol_p_p.h"
-#include "qquicktoolbar_p.h"
-#include "qquicktabbar_p.h"
-#include "qquickdialogbuttonbox_p.h"
-
-#include <QtQuick/private/qquickitem_p.h>
-
-QT_BEGIN_NAMESPACE
-
-static const QQuickItemPrivate::ChangeTypes ItemChanges = QQuickItemPrivate::Geometry | QQuickItemPrivate::Visibility | QQuickItemPrivate::Destroyed
- | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
-
-namespace {
- enum Position {
- Header,
- Footer
- };
-
- Q_STATIC_ASSERT(int(Header) == int(QQuickTabBar::Header));
- Q_STATIC_ASSERT(int(Footer) == int(QQuickTabBar::Footer));
-
- Q_STATIC_ASSERT(int(Header) == int(QQuickToolBar::Header));
- Q_STATIC_ASSERT(int(Footer) == int(QQuickToolBar::Footer));
-
- Q_STATIC_ASSERT(int(Header) == int(QQuickDialogButtonBox::Header));
- Q_STATIC_ASSERT(int(Footer) == int(QQuickDialogButtonBox::Footer));
-}
-
-static void setPosition(QQuickItem *item, Position position)
-{
- if (QQuickToolBar *toolBar = qobject_cast<QQuickToolBar *>(item))
- toolBar->setPosition(static_cast<QQuickToolBar::Position>(position));
- else if (QQuickTabBar *tabBar = qobject_cast<QQuickTabBar *>(item))
- tabBar->setPosition(static_cast<QQuickTabBar::Position>(position));
- else if (QQuickDialogButtonBox *buttonBox = qobject_cast<QQuickDialogButtonBox *>(item))
- buttonBox->setPosition(static_cast<QQuickDialogButtonBox::Position>(position));
-}
-
-QQuickPageLayout::QQuickPageLayout(QQuickControl *control)
- : m_control(control)
-{
-}
-
-QQuickPageLayout::~QQuickPageLayout()
-{
- if (m_header)
- QQuickItemPrivate::get(m_header)->removeItemChangeListener(this, ItemChanges);
- if (m_footer)
- QQuickItemPrivate::get(m_footer)->removeItemChangeListener(this, ItemChanges);
-}
-
-QQuickItem *QQuickPageLayout::header() const
-{
- return m_header;
-}
-
-bool QQuickPageLayout::setHeader(QQuickItem *header)
-{
- if (m_header == header)
- return false;
-
- if (m_header) {
- QQuickItemPrivate::get(m_header)->removeItemChangeListener(this, ItemChanges);
- m_header->setParentItem(nullptr);
- }
- m_header = header;
- if (header) {
- header->setParentItem(m_control);
- QQuickItemPrivate::get(header)->addItemChangeListener(this, ItemChanges);
- if (qFuzzyIsNull(header->z()))
- header->setZ(1);
- setPosition(header, Header);
- }
- return true;
-}
-
-QQuickItem *QQuickPageLayout::footer() const
-{
- return m_footer;
-}
-
-bool QQuickPageLayout::setFooter(QQuickItem *footer)
-{
- if (m_footer == footer)
- return false;
-
- if (m_footer) {
- QQuickItemPrivate::get(m_footer)->removeItemChangeListener(this, ItemChanges);
- m_footer->setParentItem(nullptr);
- }
- m_footer = footer;
- if (footer) {
- footer->setParentItem(m_control);
- QQuickItemPrivate::get(footer)->addItemChangeListener(this, ItemChanges);
- if (qFuzzyIsNull(footer->z()))
- footer->setZ(1);
- setPosition(footer, Footer);
- }
- return true;
-}
-
-void QQuickPageLayout::update()
-{
- QQuickItem *content = QQuickControlPrivate::get(m_control)->contentItem;
-
- const qreal hh = m_header && m_header->isVisible() ? m_header->height() : 0;
- const qreal fh = m_footer && m_footer->isVisible() ? m_footer->height() : 0;
- const qreal hsp = hh > 0 ? m_control->spacing() : 0;
- const qreal fsp = fh > 0 ? m_control->spacing() : 0;
-
- if (content) {
- content->setY(m_control->topPadding() + hh + hsp);
- content->setX(m_control->leftPadding());
- content->setWidth(m_control->availableWidth());
- content->setHeight(m_control->availableHeight() - hh - fh - hsp - fsp);
- }
-
- if (m_header)
- m_header->setWidth(m_control->width());
-
- if (m_footer) {
- m_footer->setY(m_control->height() - m_footer->height());
- m_footer->setWidth(m_control->width());
- }
-}
-
-void QQuickPageLayout::itemVisibilityChanged(QQuickItem *)
-{
- update();
-}
-
-void QQuickPageLayout::itemImplicitWidthChanged(QQuickItem *)
-{
- update();
-}
-
-void QQuickPageLayout::itemImplicitHeightChanged(QQuickItem *)
-{
- update();
-}
-
-void QQuickPageLayout::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
-{
- update();
-}
-
-void QQuickPageLayout::itemDestroyed(QQuickItem *item)
-{
- if (item == m_header)
- m_header = nullptr;
- else if (item == m_footer)
- m_footer = nullptr;
-}
-
-QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpane.cpp b/src/quicktemplates2/qquickpane.cpp
index 7d3754de..d923267f 100644
--- a/src/quicktemplates2/qquickpane.cpp
+++ b/src/quicktemplates2/qquickpane.cpp
@@ -36,6 +36,7 @@
#include "qquickpane_p.h"
#include "qquickpane_p_p.h"
+#include "qquickcontentitem_p.h"
QT_BEGIN_NAMESPACE
@@ -106,32 +107,142 @@ QT_BEGIN_NAMESPACE
{Focus Management in Qt Quick Controls 2}
*/
+void QQuickPanePrivate::init()
+{
+ Q_Q(QQuickPane);
+ q->setFlag(QQuickItem::ItemIsFocusScope);
+ q->setAcceptedMouseButtons(Qt::AllButtons);
+#if QT_CONFIG(cursor)
+ q->setCursor(Qt::ArrowCursor);
+#endif
+ connect(q, &QQuickControl::implicitContentWidthChanged, this, &QQuickPanePrivate::updateContentWidth);
+ connect(q, &QQuickControl::implicitContentHeightChanged, this, &QQuickPanePrivate::updateContentHeight);
+}
+
+QList<QQuickItem *> QQuickPanePrivate::contentChildItems() const
+{
+ if (!contentItem)
+ return QList<QQuickItem *>();
+
+ return contentItem->childItems();
+}
+
QQuickItem *QQuickPanePrivate::getContentItem()
{
Q_Q(QQuickPane);
if (QQuickItem *item = QQuickControlPrivate::getContentItem())
return item;
- return new QQuickItem(q);
+
+ return new QQuickContentItem(q);
+}
+
+void QQuickPanePrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ QQuickControlPrivate::itemImplicitWidthChanged(item);
+
+ if (item == firstChild)
+ updateImplicitContentWidth();
+}
+
+void QQuickPanePrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ QQuickControlPrivate::itemImplicitHeightChanged(item);
+
+ if (item == firstChild)
+ updateImplicitContentHeight();
+}
+
+void QQuickPanePrivate::contentChildrenChange()
+{
+ Q_Q(QQuickPane);
+ QQuickItem *newFirstChild = contentChildItems().value(0);
+ if (newFirstChild != firstChild) {
+ if (firstChild)
+ removeImplicitSizeListener(firstChild);
+ if (newFirstChild)
+ addImplicitSizeListener(newFirstChild);
+ firstChild = newFirstChild;
+ }
+
+ updateImplicitContentSize();
+ emit q->contentChildrenChanged();
+}
+
+qreal QQuickPanePrivate::getContentWidth() const
+{
+ if (!contentItem)
+ return 0;
+
+ const qreal cw = contentItem->implicitWidth();
+ if (!qFuzzyIsNull(cw))
+ return cw;
+
+ const auto contentChildren = contentChildItems();
+ if (contentChildren.count() == 1)
+ return contentChildren.first()->implicitWidth();
+
+ return 0;
+}
+
+qreal QQuickPanePrivate::getContentHeight() const
+{
+ if (!contentItem)
+ return 0;
+
+ const qreal ch = contentItem->implicitHeight();
+ if (!qFuzzyIsNull(ch))
+ return ch;
+
+ const auto contentChildren = contentChildItems();
+ if (contentChildren.count() == 1)
+ return contentChildren.first()->implicitHeight();
+
+ return 0;
+}
+
+void QQuickPanePrivate::updateContentWidth()
+{
+ Q_Q(QQuickPane);
+ if (hasContentWidth || qFuzzyCompare(contentWidth, implicitContentWidth))
+ return;
+
+ const qreal oldContentWidth = contentWidth;
+ contentWidth = implicitContentWidth;
+ q->contentSizeChange(QSizeF(contentWidth, contentHeight), QSizeF(oldContentWidth, contentHeight));
+ emit q->contentWidthChanged();
+}
+
+void QQuickPanePrivate::updateContentHeight()
+{
+ Q_Q(QQuickPane);
+ if (hasContentHeight || qFuzzyCompare(contentHeight, implicitContentHeight))
+ return;
+
+ const qreal oldContentHeight = contentHeight;
+ contentHeight = implicitContentHeight;
+ q->contentSizeChange(QSizeF(contentWidth, contentHeight), QSizeF(contentWidth, oldContentHeight));
+ emit q->contentHeightChanged();
}
QQuickPane::QQuickPane(QQuickItem *parent)
: QQuickControl(*(new QQuickPanePrivate), parent)
{
- setFlag(QQuickItem::ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-#if QT_CONFIG(cursor)
- setCursor(Qt::ArrowCursor);
-#endif
+ Q_D(QQuickPane);
+ d->init();
+}
+
+QQuickPane::~QQuickPane()
+{
+ Q_D(QQuickPane);
+ d->removeImplicitSizeListener(d->contentItem);
+ d->removeImplicitSizeListener(d->firstChild);
}
QQuickPane::QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent)
: QQuickControl(dd, parent)
{
- setFlag(QQuickItem::ItemIsFocusScope);
- setAcceptedMouseButtons(Qt::AllButtons);
-#if QT_CONFIG(cursor)
- setCursor(Qt::ArrowCursor);
-#endif
+ Q_D(QQuickPane);
+ d->init();
}
/*!
@@ -153,13 +264,26 @@ qreal QQuickPane::contentWidth() const
void QQuickPane::setContentWidth(qreal width)
{
Q_D(QQuickPane);
+ d->hasContentWidth = true;
if (qFuzzyCompare(d->contentWidth, width))
return;
+ const qreal oldWidth = d->contentWidth;
d->contentWidth = width;
+ contentSizeChange(QSizeF(width, d->contentHeight), QSizeF(oldWidth, d->contentHeight));
emit contentWidthChanged();
}
+void QQuickPane::resetContentWidth()
+{
+ Q_D(QQuickPane);
+ if (!d->hasContentWidth)
+ return;
+
+ d->hasContentHeight = false;
+ d->updateContentWidth();
+}
+
/*!
\qmlproperty real QtQuick.Controls::Pane::contentHeight
@@ -179,13 +303,26 @@ qreal QQuickPane::contentHeight() const
void QQuickPane::setContentHeight(qreal height)
{
Q_D(QQuickPane);
+ d->hasContentHeight = true;
if (qFuzzyCompare(d->contentHeight, height))
return;
+ const qreal oldHeight = d->contentHeight;
d->contentHeight = height;
+ contentSizeChange(QSizeF(d->contentWidth, height), QSizeF(d->contentWidth, oldHeight));
emit contentHeightChanged();
}
+void QQuickPane::resetContentHeight()
+{
+ Q_D(QQuickPane);
+ if (!d->hasContentHeight)
+ return;
+
+ d->hasContentHeight = false;
+ d->updateContentHeight();
+}
+
/*!
\qmlproperty list<Object> QtQuick.Controls::Pane::contentData
\default
@@ -200,9 +337,10 @@ void QQuickPane::setContentHeight(qreal height)
\sa Item::data, contentChildren
*/
-QQmlListProperty<QObject> QQuickPane::contentData()
+QQmlListProperty<QObject> QQuickPanePrivate::contentData()
{
- return QQmlListProperty<QObject>(contentItem(), nullptr,
+ Q_Q(QQuickPane);
+ return QQmlListProperty<QObject>(q->contentItem(), nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -222,23 +360,42 @@ QQmlListProperty<QObject> QQuickPane::contentData()
\sa Item::children, contentData
*/
-QQmlListProperty<QQuickItem> QQuickPane::contentChildren()
+QQmlListProperty<QQuickItem> QQuickPanePrivate::contentChildren()
{
- return QQmlListProperty<QQuickItem>(contentItem(), nullptr,
+ Q_Q(QQuickPane);
+ return QQmlListProperty<QQuickItem>(q->contentItem(), nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
QQuickItemPrivate::children_clear);
}
+void QQuickPane::componentComplete()
+{
+ Q_D(QQuickPane);
+ QQuickControl::componentComplete();
+ d->updateImplicitContentSize();
+}
+
void QQuickPane::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
{
+ Q_D(QQuickPane);
QQuickControl::contentItemChange(newItem, oldItem);
- if (oldItem)
- disconnect(oldItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
- if (newItem)
- connect(newItem, &QQuickItem::childrenChanged, this, &QQuickPane::contentChildrenChanged);
- emit contentChildrenChanged();
+ if (oldItem) {
+ d->removeImplicitSizeListener(oldItem);
+ QObjectPrivate::disconnect(oldItem, &QQuickItem::childrenChanged, d, &QQuickPanePrivate::contentChildrenChange);
+ }
+ if (newItem) {
+ d->addImplicitSizeListener(newItem);
+ QObjectPrivate::connect(newItem, &QQuickItem::childrenChanged, d, &QQuickPanePrivate::contentChildrenChange);
+ }
+ d->contentChildrenChange();
+}
+
+void QQuickPane::contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize)
+{
+ Q_UNUSED(newSize)
+ Q_UNUSED(oldSize)
}
#if QT_CONFIG(accessibility)
@@ -249,3 +406,5 @@ QAccessible::Role QQuickPane::accessibleRole() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qquickpane_p.cpp"
diff --git a/src/quicktemplates2/qquickpane_p.h b/src/quicktemplates2/qquickpane_p.h
index 759c59d8..86b2c9f2 100644
--- a/src/quicktemplates2/qquickpane_p.h
+++ b/src/quicktemplates2/qquickpane_p.h
@@ -58,23 +58,23 @@ class QQuickPanePrivate;
class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPane : public QQuickControl
{
Q_OBJECT
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth NOTIFY contentWidthChanged FINAL)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight NOTIFY contentHeightChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL)
+ Q_PRIVATE_PROPERTY(QQuickPane::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PRIVATE_PROPERTY(QQuickPane::d_func(), QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
Q_CLASSINFO("DefaultProperty", "contentData")
public:
explicit QQuickPane(QQuickItem *parent = nullptr);
+ ~QQuickPane();
qreal contentWidth() const;
void setContentWidth(qreal width);
+ void resetContentWidth();
qreal contentHeight() const;
void setContentHeight(qreal height);
-
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
+ void resetContentHeight();
Q_SIGNALS:
void contentWidthChanged();
@@ -84,7 +84,10 @@ Q_SIGNALS:
protected:
QQuickPane(QQuickPanePrivate &dd, QQuickItem *parent);
+ void componentComplete() override;
+
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ virtual void contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize);
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickpane_p_p.h b/src/quicktemplates2/qquickpane_p_p.h
index c811c487..bd89aee2 100644
--- a/src/quicktemplates2/qquickpane_p_p.h
+++ b/src/quicktemplates2/qquickpane_p_p.h
@@ -59,10 +59,30 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPanePrivate : public QQuickControlP
Q_DECLARE_PUBLIC(QQuickPane)
public:
+ void init();
+
+ virtual QQmlListProperty<QObject> contentData();
+ virtual QQmlListProperty<QQuickItem> contentChildren();
+ virtual QList<QQuickItem *> contentChildItems() const;
+
QQuickItem *getContentItem() override;
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
+
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
+ void contentChildrenChange();
+
+ void updateContentWidth();
+ void updateContentHeight();
+
+ bool hasContentWidth = false;
+ bool hasContentHeight = false;
qreal contentWidth = 0;
qreal contentHeight = 0;
+ QQuickItem *firstChild = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index b69dab64..d5e2c940 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -36,6 +36,7 @@
#include "qquickpopup_p.h"
#include "qquickpopup_p_p.h"
+#include "qquickpopupanchors_p.h"
#include "qquickpopupitem_p_p.h"
#include "qquickpopuppositioner_p_p.h"
#include "qquickapplicationwindow_p.h"
@@ -109,14 +110,42 @@ QT_BEGIN_NAMESPACE
\image qtquickcontrols2-popup.png
The \l implicitWidth and \l implicitHeight of a popup are typically based
- on the implicit sizes of the background and the content item plus any
- \l padding. These properties determine how large the popup will be when no
+ on the implicit sizes of the background and the content item plus any insets
+ and paddings. These properties determine how large the popup will be when no
explicit \l width or \l height is specified.
+ The geometry of the \l contentItem is determined by the padding. The following
+ example reserves 10px padding between the boundaries of the popup and its content:
+
+ \code
+ Popup {
+ padding: 10
+
+ contentItem: Text {
+ text: "Content"
+ }
+ }
+ \endcode
+
The \l background item fills the entire width and height of the popup,
- unless an explicit size has been given for it.
+ unless insets or an explicit size have been given for it.
+
+ Negative insets can be used to make the background larger than the popup.
+ The following example uses negative insets to place a shadow outside the
+ popup's boundaries:
- The geometry of the \l contentItem is determined by the \l padding.
+ \code
+ Popup {
+ topInset: -2
+ leftInset: -2
+ rightInset: -6
+ bottomInset: -6
+
+ background: BorderImage {
+ source: ":/images/shadowed-background.png"
+ }
+ }
+ \endcode
\section1 Popup Sizing
@@ -178,6 +207,11 @@ QT_BEGIN_NAMESPACE
\include qquickoverlay-popup-parent.qdocinc
+ Another way to center a popup in the window regardless of its parent item
+ is to use \l {anchors.centerIn}:
+
+ \snippet qtquickcontrols2-popup.qml centerIn
+
\sa {Popup Controls}, {Customizing Popup}, ApplicationWindow
*/
@@ -230,7 +264,10 @@ void QQuickPopupPrivate::init()
QObject::connect(popupItem, &QQuickControl::paddingChanged, q, &QQuickPopup::paddingChanged);
QObject::connect(popupItem, &QQuickControl::backgroundChanged, q, &QQuickPopup::backgroundChanged);
QObject::connect(popupItem, &QQuickControl::contentItemChanged, q, &QQuickPopup::contentItemChanged);
- positioner = new QQuickPopupPositioner(q);
+ QObject::connect(popupItem, &QQuickControl::implicitContentWidthChanged, q, &QQuickPopup::implicitContentWidthChanged);
+ QObject::connect(popupItem, &QQuickControl::implicitContentHeightChanged, q, &QQuickPopup::implicitContentHeightChanged);
+ QObject::connect(popupItem, &QQuickControl::implicitBackgroundWidthChanged, q, &QQuickPopup::implicitBackgroundWidthChanged);
+ QObject::connect(popupItem, &QQuickControl::implicitBackgroundHeightChanged, q, &QQuickPopup::implicitBackgroundHeightChanged);
}
void QQuickPopupPrivate::closeOrReject()
@@ -400,7 +437,7 @@ bool QQuickPopupPrivate::prepareEnterTransition()
visible = true;
transitionState = EnterTransition;
popupItem->setVisible(true);
- positioner->setParentItem(parentItem);
+ getPositioner()->setParentItem(parentItem);
emit q->visibleChanged();
}
return true;
@@ -439,7 +476,7 @@ void QQuickPopupPrivate::finalizeEnterTransition()
void QQuickPopupPrivate::finalizeExitTransition()
{
Q_Q(QQuickPopup);
- positioner->setParentItem(nullptr);
+ getPositioner()->setParentItem(nullptr);
popupItem->setParentItem(nullptr);
popupItem->setVisible(false);
destroyOverlay();
@@ -525,6 +562,55 @@ void QQuickPopupPrivate::setBottomMargin(qreal value, bool reset)
}
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlpropertygroup QtQuick.Controls::Popup::anchors
+ \qmlproperty Object QtQuick.Controls::Popup::anchors.centerIn
+
+ Anchors provide a way to position an item by specifying its
+ relationship with other items.
+
+ A common use case is to center a popup within its parent. One way to do
+ this is with the \l {Item::}{x} and \l {Item::}{y} properties. Anchors offer
+ a more convenient approach:
+
+ \qml
+ Pane {
+ // ...
+
+ Popup {
+ anchors.centerIn: parent
+ }
+ }
+ \endqml
+
+ It is also possible to center the popup in the window by using \l Overlay:
+
+ \snippet qtquickcontrols2-popup.qml centerIn
+
+ This makes it easy to center a popup in the window from any component.
+
+ \note Popups can only be centered within their immediate parent or
+ the window overlay; trying to center in other items will produce a warning.
+
+ \sa {Popup Positioning}, {Item::anchors}
+*/
+QQuickPopupAnchors *QQuickPopupPrivate::getAnchors()
+{
+ Q_Q(QQuickPopup);
+ if (!anchors)
+ anchors = new QQuickPopupAnchors(q);
+ return anchors;
+}
+
+QQuickPopupPositioner *QQuickPopupPrivate::getPositioner()
+{
+ Q_Q(QQuickPopup);
+ if (!positioner)
+ positioner = new QQuickPopupPositioner(q);
+ return positioner;
+}
+
void QQuickPopupPrivate::setWindow(QQuickWindow *newWindow)
{
Q_Q(QQuickPopup);
@@ -566,7 +652,7 @@ void QQuickPopupPrivate::itemDestroyed(QQuickItem *item)
void QQuickPopupPrivate::reposition()
{
- positioner->reposition();
+ getPositioner()->reposition();
}
static QQuickItem *createDimmer(QQmlComponent *component, QQuickPopup *popup, QQuickItem *parent)
@@ -955,17 +1041,13 @@ void QQuickPopup::setImplicitHeight(qreal height)
qreal QQuickPopup::contentWidth() const
{
Q_D(const QQuickPopup);
- return d->contentWidth;
+ return d->popupItem->contentWidth();
}
void QQuickPopup::setContentWidth(qreal width)
{
Q_D(QQuickPopup);
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
+ d->popupItem->setContentWidth(width);
}
/*!
@@ -981,17 +1063,13 @@ void QQuickPopup::setContentWidth(qreal width)
qreal QQuickPopup::contentHeight() const
{
Q_D(const QQuickPopup);
- return d->contentHeight;
+ return d->popupItem->contentHeight();
}
void QQuickPopup::setContentHeight(qreal height)
{
Q_D(QQuickPopup);
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
+ d->popupItem->setContentHeight(height);
}
/*!
@@ -1249,11 +1327,12 @@ void QQuickPopup::resetPadding()
/*!
\qmlproperty real QtQuick.Controls::Popup::topPadding
- This property holds the top padding.
+ This property holds the top padding. Unless explicitly set, the value
+ is equal to \c verticalPadding.
\include qquickpopup-padding.qdocinc
- \sa padding, bottomPadding, availableHeight
+ \sa padding, bottomPadding, verticalPadding, availableHeight
*/
qreal QQuickPopup::topPadding() const
{
@@ -1276,11 +1355,12 @@ void QQuickPopup::resetTopPadding()
/*!
\qmlproperty real QtQuick.Controls::Popup::leftPadding
- This property holds the left padding.
+ This property holds the left padding. Unless explicitly set, the value
+ is equal to \c horizontalPadding.
\include qquickpopup-padding.qdocinc
- \sa padding, rightPadding, availableWidth
+ \sa padding, rightPadding, horizontalPadding, availableWidth
*/
qreal QQuickPopup::leftPadding() const
{
@@ -1303,11 +1383,12 @@ void QQuickPopup::resetLeftPadding()
/*!
\qmlproperty real QtQuick.Controls::Popup::rightPadding
- This property holds the right padding.
+ This property holds the right padding. Unless explicitly set, the value
+ is equal to \c horizontalPadding.
\include qquickpopup-padding.qdocinc
- \sa padding, leftPadding, availableWidth
+ \sa padding, leftPadding, horizontalPadding, availableWidth
*/
qreal QQuickPopup::rightPadding() const
{
@@ -1330,11 +1411,12 @@ void QQuickPopup::resetRightPadding()
/*!
\qmlproperty real QtQuick.Controls::Popup::bottomPadding
- This property holds the bottom padding.
+ This property holds the bottom padding. Unless explicitly set, the value
+ is equal to \c verticalPadding.
\include qquickpopup-padding.qdocinc
- \sa padding, topPadding, availableHeight
+ \sa padding, topPadding, verticalPadding, availableHeight
*/
qreal QQuickPopup::bottomPadding() const
{
@@ -1524,8 +1606,9 @@ void QQuickPopup::setParentItem(QQuickItem *parent)
QQuickItemPrivate::get(d->parentItem)->removeItemChangeListener(d, QQuickItemPrivate::Destroyed);
}
d->parentItem = parent;
- if (d->positioner->parentItem())
- d->positioner->setParentItem(parent);
+ QQuickPopupPositioner *positioner = d->getPositioner();
+ if (positioner->parentItem())
+ positioner->setParentItem(parent);
if (parent) {
QObjectPrivate::connect(parent, &QQuickItem::windowChanged, d, &QQuickPopupPrivate::setWindow);
QQuickItemPrivate::get(d->parentItem)->addItemChangeListener(d, QQuickItemPrivate::Destroyed);
@@ -1620,13 +1703,12 @@ void QQuickPopup::setContentItem(QQuickItem *item)
\sa Item::data, contentChildren
*/
-QQmlListProperty<QObject> QQuickPopup::contentData()
+QQmlListProperty<QObject> QQuickPopupPrivate::contentData()
{
- Q_D(QQuickPopup);
- QQuickControlPrivate *p = QQuickControlPrivate::get(d->popupItem);
+ QQuickControlPrivate *p = QQuickControlPrivate::get(popupItem);
if (!p->contentItem)
p->executeContentItem();
- return QQmlListProperty<QObject>(d->popupItem->contentItem(), nullptr,
+ return QQmlListProperty<QObject>(popupItem->contentItem(), nullptr,
QQuickItemPrivate::data_append,
QQuickItemPrivate::data_count,
QQuickItemPrivate::data_at,
@@ -1646,10 +1728,9 @@ QQmlListProperty<QObject> QQuickPopup::contentData()
\sa Item::children, contentData
*/
-QQmlListProperty<QQuickItem> QQuickPopup::contentChildren()
+QQmlListProperty<QQuickItem> QQuickPopupPrivate::contentChildren()
{
- Q_D(QQuickPopup);
- return QQmlListProperty<QQuickItem>(d->popupItem->contentItem(), nullptr,
+ return QQmlListProperty<QQuickItem>(popupItem->contentItem(), nullptr,
QQuickItemPrivate::children_append,
QQuickItemPrivate::children_count,
QQuickItemPrivate::children_at,
@@ -2042,6 +2123,236 @@ void QQuickPopup::setExit(QQuickTransition *transition)
emit exitChanged();
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::horizontalPadding
+
+ This property holds the horizontal padding. Unless explicitly set, the value
+ is equal to \c padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa padding, leftPadding, rightPadding, verticalPadding
+*/
+qreal QQuickPopup::horizontalPadding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->horizontalPadding();
+}
+
+void QQuickPopup::setHorizontalPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setHorizontalPadding(padding);
+}
+
+void QQuickPopup::resetHorizontalPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetHorizontalPadding();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::verticalPadding
+
+ This property holds the vertical padding. Unless explicitly set, the value
+ is equal to \c padding.
+
+ \include qquickpopup-padding.qdocinc
+
+ \sa padding, topPadding, bottomPadding, horizontalPadding
+*/
+qreal QQuickPopup::verticalPadding() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->verticalPadding();
+}
+
+void QQuickPopup::setVerticalPadding(qreal padding)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setVerticalPadding(padding);
+}
+
+void QQuickPopup::resetVerticalPadding()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetVerticalPadding();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::implicitContentWidth
+ \readonly
+
+ This property holds the implicit content width.
+
+ The value is calculated based on the content children.
+
+ \sa implicitContentHeight, implicitBackgroundWidth
+*/
+qreal QQuickPopup::implicitContentWidth() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->implicitContentWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::implicitContentHeight
+ \readonly
+
+ This property holds the implicit content height.
+
+ The value is calculated based on the content children.
+
+ \sa implicitContentWidth, implicitBackgroundHeight
+*/
+qreal QQuickPopup::implicitContentHeight() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->implicitContentHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::implicitBackgroundWidth
+ \readonly
+
+ This property holds the implicit background width.
+
+ The value is equal to \c {background ? background.implicitWidth : 0}.
+
+ \sa implicitBackgroundHeight, implicitContentWidth
+*/
+qreal QQuickPopup::implicitBackgroundWidth() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->implicitBackgroundWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::implicitBackgroundHeight
+ \readonly
+
+ This property holds the implicit background height.
+
+ The value is equal to \c {background ? background.implicitHeight : 0}.
+
+ \sa implicitBackgroundWidth, implicitContentHeight
+*/
+qreal QQuickPopup::implicitBackgroundHeight() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->implicitBackgroundHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::topInset
+
+ This property holds the top inset for the background.
+
+ \sa {Popup Layout}, bottomInset
+*/
+qreal QQuickPopup::topInset() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->topInset();
+}
+
+void QQuickPopup::setTopInset(qreal inset)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setTopInset(inset);
+}
+
+void QQuickPopup::resetTopInset()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetTopInset();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::leftInset
+
+ This property holds the left inset for the background.
+
+ \sa {Popup Layout}, rightInset
+*/
+qreal QQuickPopup::leftInset() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->leftInset();
+}
+
+void QQuickPopup::setLeftInset(qreal inset)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setLeftInset(inset);
+}
+
+void QQuickPopup::resetLeftInset()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetLeftInset();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::rightInset
+
+ This property holds the right inset for the background.
+
+ \sa {Popup Layout}, leftInset
+*/
+qreal QQuickPopup::rightInset() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->rightInset();
+}
+
+void QQuickPopup::setRightInset(qreal inset)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setRightInset(inset);
+}
+
+void QQuickPopup::resetRightInset()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetRightInset();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Popup::bottomInset
+
+ This property holds the bottom inset for the background.
+
+ \sa {Popup Layout}, topInset
+*/
+qreal QQuickPopup::bottomInset() const
+{
+ Q_D(const QQuickPopup);
+ return d->popupItem->bottomInset();
+}
+
+void QQuickPopup::setBottomInset(qreal inset)
+{
+ Q_D(QQuickPopup);
+ d->popupItem->setBottomInset(inset);
+}
+
+void QQuickPopup::resetBottomInset()
+{
+ Q_D(QQuickPopup);
+ d->popupItem->resetBottomInset();
+}
+
bool QQuickPopup::filtersChildMouseEvents() const
{
Q_D(const QQuickPopup);
@@ -2217,6 +2528,14 @@ void QQuickPopup::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
Q_UNUSED(oldItem);
}
+void QQuickPopup::contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize)
+{
+ if (!qFuzzyCompare(newSize.width(), oldSize.width()))
+ emit contentWidthChanged();
+ if (!qFuzzyCompare(newSize.height(), oldSize.height()))
+ emit contentHeightChanged();
+}
+
void QQuickPopup::fontChange(const QFont &newFont, const QFont &oldFont)
{
Q_UNUSED(newFont);
@@ -2292,10 +2611,14 @@ void QQuickPopup::paddingChange(const QMarginsF &newPadding, const QMarginsF &ol
if (bp)
emit bottomPaddingChanged();
- if (lp || rp)
+ if (lp || rp) {
+ emit horizontalPaddingChanged();
emit availableWidthChanged();
- if (tp || bp)
+ }
+ if (tp || bp) {
+ emit verticalPaddingChanged();
emit availableHeightChanged();
+ }
}
void QQuickPopup::paletteChange(const QPalette &newPalette, const QPalette &oldPalette)
@@ -2312,14 +2635,26 @@ void QQuickPopup::spacingChange(qreal newSpacing, qreal oldSpacing)
emit spacingChanged();
}
+void QQuickPopup::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
+{
+ if (!qFuzzyCompare(newInset.top(), oldInset.top()))
+ emit topInsetChanged();
+ if (!qFuzzyCompare(newInset.left(), oldInset.left()))
+ emit leftInsetChanged();
+ if (!qFuzzyCompare(newInset.right(), oldInset.right()))
+ emit rightInsetChanged();
+ if (!qFuzzyCompare(newInset.bottom(), oldInset.bottom()))
+ emit bottomInsetChanged();
+}
+
QFont QQuickPopup::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::SystemFont);
+ return QQuickTheme::font(QQuickTheme::System);
}
QPalette QQuickPopup::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette);
+ return QQuickTheme::palette(QQuickTheme::System);
}
#if QT_CONFIG(accessibility)
@@ -2359,3 +2694,5 @@ bool QQuickPopup::setAccessibleProperty(const char *propertyName, const QVariant
}
QT_END_NAMESPACE
+
+#include "moc_qquickpopup_p.cpp"
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 2a42ff27..12dbd247 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -67,6 +67,7 @@
QT_BEGIN_NAMESPACE
class QQuickWindow;
+class QQuickPopupAnchors;
class QQuickPopupPrivate;
class QQuickTransition;
@@ -100,8 +101,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(QQuickItem *parent READ parentItem WRITE setParentItem RESET resetParentItem NOTIFY parentChanged FINAL)
Q_PROPERTY(QQuickItem *background READ background WRITE setBackground NOTIFY backgroundChanged FINAL)
Q_PROPERTY(QQuickItem *contentItem READ contentItem WRITE setContentItem NOTIFY contentItemChanged FINAL)
- Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
+ Q_PRIVATE_PROPERTY(QQuickPopup::d_func(), QQmlListProperty<QObject> contentData READ contentData FINAL)
+ Q_PRIVATE_PROPERTY(QQuickPopup::d_func(), QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
Q_PROPERTY(bool clip READ clip WRITE setClip NOTIFY clipChanged FINAL)
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL)
@@ -121,6 +122,18 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopup : public QObject, public QQml
Q_PROPERTY(bool mirrored READ isMirrored NOTIFY mirroredChanged FINAL REVISION 3)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged FINAL REVISION 3)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal horizontalPadding READ horizontalPadding WRITE setHorizontalPadding RESET resetHorizontalPadding NOTIFY horizontalPaddingChanged FINAL)
+ Q_PROPERTY(qreal verticalPadding READ verticalPadding WRITE setVerticalPadding RESET resetVerticalPadding NOTIFY verticalPaddingChanged FINAL)
+ Q_PRIVATE_PROPERTY(QQuickPopup::d_func(), QQuickPopupAnchors *anchors READ getAnchors DESIGNABLE false CONSTANT FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitContentWidth READ implicitContentWidth NOTIFY implicitContentWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitContentHeight READ implicitContentHeight NOTIFY implicitContentHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,contentItem")
Q_CLASSINFO("DefaultProperty", "contentData")
@@ -224,9 +237,6 @@ public:
QQuickItem *contentItem() const;
void setContentItem(QQuickItem *item);
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
bool clip() const;
void setClip(bool clip);
@@ -304,6 +314,37 @@ public:
void setPalette(const QPalette &palette);
void resetPalette();
+ // 2.5 (Qt 5.12)
+ qreal horizontalPadding() const;
+ void setHorizontalPadding(qreal padding);
+ void resetHorizontalPadding();
+
+ qreal verticalPadding() const;
+ void setVerticalPadding(qreal padding);
+ void resetVerticalPadding();
+
+ qreal implicitContentWidth() const;
+ qreal implicitContentHeight() const;
+
+ qreal implicitBackgroundWidth() const;
+ qreal implicitBackgroundHeight() const;
+
+ qreal topInset() const;
+ void setTopInset(qreal inset);
+ void resetTopInset();
+
+ qreal leftInset() const;
+ void setLeftInset(qreal inset);
+ void resetLeftInset();
+
+ qreal rightInset() const;
+ void setRightInset(qreal inset);
+ void resetRightInset();
+
+ qreal bottomInset() const;
+ void setBottomInset(qreal inset);
+ void resetBottomInset();
+
public Q_SLOTS:
void open();
void close();
@@ -359,6 +400,17 @@ Q_SIGNALS:
Q_REVISION(3) void mirroredChanged();
Q_REVISION(3) void enabledChanged();
Q_REVISION(3) void paletteChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void horizontalPaddingChanged();
+ Q_REVISION(5) void verticalPaddingChanged();
+ Q_REVISION(5) void implicitContentWidthChanged();
+ Q_REVISION(5) void implicitContentHeightChanged();
+ Q_REVISION(5) void implicitBackgroundWidthChanged();
+ Q_REVISION(5) void implicitBackgroundHeightChanged();
+ Q_REVISION(5) void topInsetChanged();
+ Q_REVISION(5) void leftInsetChanged();
+ Q_REVISION(5) void rightInsetChanged();
+ Q_REVISION(5) void bottomInsetChanged();
protected:
QQuickPopup(QQuickPopupPrivate &dd, QObject *parent);
@@ -387,6 +439,7 @@ protected:
#endif
virtual void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem);
+ virtual void contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize);
virtual void fontChange(const QFont &newFont, const QFont &oldFont);
virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
virtual void localeChange(const QLocale &newLocale, const QLocale &oldLocale);
@@ -395,6 +448,7 @@ protected:
virtual void paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding);
virtual void paletteChange(const QPalette &newPalette, const QPalette &oldPalette);
virtual void spacingChange(qreal newSpacing, qreal oldSpacing);
+ virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
virtual QFont defaultFont() const;
virtual QPalette defaultPalette() const;
diff --git a/src/quicktemplates2/qquickpopup_p_p.h b/src/quicktemplates2/qquickpopup_p_p.h
index 318ae598..e32fdb28 100644
--- a/src/quicktemplates2/qquickpopup_p_p.h
+++ b/src/quicktemplates2/qquickpopup_p_p.h
@@ -61,6 +61,7 @@ QT_BEGIN_NAMESPACE
class QQuickTransition;
class QQuickTransitionManager;
class QQuickPopup;
+class QQuickPopupAnchors;
class QQuickPopupItem;
class QQuickPopupPrivate;
class QQuickPopupPositioner;
@@ -92,6 +93,9 @@ public:
return popup->d_func();
}
+ QQmlListProperty<QObject> contentData();
+ QQmlListProperty<QQuickItem> contentChildren();
+
void init();
void closeOrReject();
bool tryClose(const QPointF &pos, QQuickPopup::ClosePolicy flags);
@@ -113,7 +117,7 @@ public:
bool handleTouchEvent(QQuickItem *item, QTouchEvent *event);
#endif
- virtual void reposition();
+ void reposition();
void createOverlay();
void destroyOverlay();
@@ -134,6 +138,9 @@ public:
void setRightMargin(qreal value, bool reset = false);
void setBottomMargin(qreal value, bool reset = false);
+ QQuickPopupAnchors *getAnchors();
+ virtual QQuickPopupPositioner *getPositioner();
+
void setWindow(QQuickWindow *window);
void itemDestroyed(QQuickItem *item) override;
@@ -175,8 +182,6 @@ public:
qreal leftMargin = 0;
qreal rightMargin = 0;
qreal bottomMargin = 0;
- qreal contentWidth = 0;
- qreal contentHeight = 0;
QPointF pressPoint;
TransitionState transitionState = NoTransition;
QQuickPopup::ClosePolicy closePolicy = DefaultClosePolicy;
@@ -190,6 +195,7 @@ public:
QList<QQuickStateAction> enterActions;
QList<QQuickStateAction> exitActions;
QQuickPopupTransitionManager transitionManager;
+ QQuickPopupAnchors *anchors = nullptr;
friend class QQuickPopupTransitionManager;
};
diff --git a/src/quicktemplates2/qquickpopupanchors.cpp b/src/quicktemplates2/qquickpopupanchors.cpp
new file mode 100644
index 00000000..5acc2934
--- /dev/null
+++ b/src/quicktemplates2/qquickpopupanchors.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquickpopupanchors_p.h"
+#include "qquickpopupanchors_p_p.h"
+#include "qquickpopup_p_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QQuickPopupAnchors::QQuickPopupAnchors(QQuickPopup *popup)
+ : QObject(*(new QQuickPopupAnchorsPrivate), popup)
+{
+ Q_D(QQuickPopupAnchors);
+ d->popup = popup;
+}
+
+QQuickItem *QQuickPopupAnchors::centerIn() const
+{
+ Q_D(const QQuickPopupAnchors);
+ return d->centerIn;
+}
+
+void QQuickPopupAnchors::setCenterIn(QQuickItem *item)
+{
+ Q_D(QQuickPopupAnchors);
+ if (item == d->centerIn)
+ return;
+
+ d->centerIn = item;
+ QQuickPopupPrivate::get(d->popup)->reposition();
+ emit centerInChanged();
+}
+
+void QQuickPopupAnchors::resetCenterIn()
+{
+ setCenterIn(nullptr);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickpopupanchors_p.h b/src/quicktemplates2/qquickpopupanchors_p.h
new file mode 100644
index 00000000..531c494e
--- /dev/null
+++ b/src/quicktemplates2/qquickpopupanchors_p.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKPOPUPANCHORS_P_H
+#define QQUICKPOPUPANCHORS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/qobject.h>
+#include <QtQml/qqml.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QQuickItem;
+class QQuickPopupAnchorsPrivate;
+class QQuickPopup;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickPopupAnchors : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QQuickItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
+
+public:
+ explicit QQuickPopupAnchors(QQuickPopup *popup);
+
+ QQuickItem *centerIn() const;
+ void setCenterIn(QQuickItem *item);
+ void resetCenterIn();
+
+Q_SIGNALS:
+ void centerInChanged();
+
+private:
+ Q_DISABLE_COPY(QQuickPopupAnchors)
+ Q_DECLARE_PRIVATE(QQuickPopupAnchors)
+};
+
+QT_END_NAMESPACE
+
+QML_DECLARE_TYPE(QQuickPopupAnchors)
+
+#endif // QQUICKPOPUPANCHORS_P_H
diff --git a/src/imports/controls/fusion/ScrollView.qml b/src/quicktemplates2/qquickpopupanchors_p_p.h
index 5cbd170a..989dc6df 100644
--- a/src/imports/controls/fusion/ScrollView.qml
+++ b/src/quicktemplates2/qquickpopupanchors_p_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2018 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,35 +34,42 @@
**
****************************************************************************/
-import QtQuick 2.11
-import QtQuick.Templates 2.4 as T
-import QtQuick.Controls 2.4
-import QtQuick.Controls.impl 2.4
-import QtQuick.Controls.Fusion 2.4
-import QtQuick.Controls.Fusion.impl 2.4
+#ifndef QQUICKPOPUPANCHORS_P_P_H
+#define QQUICKPOPUPANCHORS_P_P_H
-T.ScrollView {
- id: control
+//
+// 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.
+//
- implicitWidth: Math.max(background ? background.implicitWidth : 0, contentWidth + leftPadding + rightPadding)
- implicitHeight: Math.max(background ? background.implicitHeight : 0, contentHeight + topPadding + bottomPadding)
+#include <QtCore/private/qobject_p.h>
+#include <QtQuickTemplates2/private/qquickpopup_p_p.h>
- contentWidth: contentItem.implicitWidth || (contentChildren.length === 1 ? contentChildren[0].implicitWidth : -1)
- contentHeight: contentItem.implicitHeight || (contentChildren.length === 1 ? contentChildren[0].implicitHeight : -1)
+QT_BEGIN_NAMESPACE
- ScrollBar.vertical: ScrollBar {
- parent: control
- x: control.mirrored ? 0 : control.width - width
- y: control.topPadding
- height: control.availableHeight
- active: control.ScrollBar.horizontal.active
- }
+class QQuickItem;
+class QQuickPopup;
+
+class QQuickPopupAnchorsPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QQuickPopupAnchors)
- ScrollBar.horizontal: ScrollBar {
- parent: control
- x: control.leftPadding
- y: control.height - height
- width: control.availableWidth
- active: control.ScrollBar.vertical.active
+public:
+ static QQuickPopupAnchorsPrivate *get(QQuickPopupAnchors *popupAnchors)
+ {
+ return popupAnchors->d_func();
}
-}
+
+ QQuickPopup *popup = nullptr;
+ QQuickItem *centerIn = nullptr;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKPOPUPANCHORS_P_P_H
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index f835aef4..cf2fec41 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -37,7 +37,8 @@
#include "qquickpopupitem_p_p.h"
#include "qquickapplicationwindow_p.h"
#include "qquickshortcutcontext_p_p.h"
-#include "qquickcontrol_p_p.h"
+#include "qquickpage_p_p.h"
+#include "qquickcontentitem_p.h"
#include "qquickpopup_p_p.h"
#include "qquickdeferredexecute_p_p.h"
@@ -46,7 +47,7 @@
QT_BEGIN_NAMESPACE
-class QQuickPopupItemPrivate : public QQuickControlPrivate
+class QQuickPopupItemPrivate : public QQuickPagePrivate
{
Q_DECLARE_PUBLIC(QQuickPopupItem)
@@ -80,13 +81,13 @@ QQuickPopupItemPrivate::QQuickPopupItemPrivate(QQuickPopup *popup)
void QQuickPopupItemPrivate::implicitWidthChanged()
{
- QQuickControlPrivate::implicitWidthChanged();
+ QQuickPagePrivate::implicitWidthChanged();
emit popup->implicitWidthChanged();
}
void QQuickPopupItemPrivate::implicitHeightChanged()
{
- QQuickControlPrivate::implicitHeightChanged();
+ QQuickPagePrivate::implicitHeightChanged();
emit popup->implicitHeightChanged();
}
@@ -95,7 +96,7 @@ void QQuickPopupItemPrivate::resolveFont()
if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(popup->window()))
inheritFont(window->font());
else
- inheritFont(themeFont(QPlatformTheme::SystemFont));
+ inheritFont(QQuickTheme::font(QQuickTheme::System));
}
void QQuickPopupItemPrivate::resolvePalette()
@@ -103,15 +104,16 @@ void QQuickPopupItemPrivate::resolvePalette()
if (QQuickApplicationWindow *window = qobject_cast<QQuickApplicationWindow *>(popup->window()))
inheritPalette(window->palette());
else
- inheritPalette(themePalette(QPlatformTheme::SystemPalette));
+ inheritPalette(QQuickTheme::palette(QQuickTheme::System));
}
QQuickItem *QQuickPopupItemPrivate::getContentItem()
{
Q_Q(QQuickPopupItem);
- if (QQuickItem *item = QQuickControlPrivate::getContentItem())
+ if (QQuickItem *item = QQuickPagePrivate::getContentItem())
return item;
- return new QQuickItem(q);
+
+ return new QQuickContentItem(popup, q);
}
static inline QString contentItemName() { return QStringLiteral("contentItem"); }
@@ -151,7 +153,7 @@ void QQuickPopupItemPrivate::executeBackground(bool complete)
}
QQuickPopupItem::QQuickPopupItem(QQuickPopup *popup)
- : QQuickControl(*(new QQuickPopupItemPrivate(popup)), nullptr)
+ : QQuickPage(*(new QQuickPopupItemPrivate(popup)), nullptr)
{
setParent(popup);
setFlag(ItemIsFocusScope);
@@ -305,28 +307,35 @@ void QQuickPopupItem::wheelEvent(QWheelEvent *event)
void QQuickPopupItem::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
{
Q_D(QQuickPopupItem);
- QQuickControl::contentItemChange(newItem, oldItem);
+ QQuickPage::contentItemChange(newItem, oldItem);
d->popup->contentItemChange(newItem, oldItem);
}
+void QQuickPopupItem::contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize)
+{
+ Q_D(QQuickPopupItem);
+ QQuickPage::contentSizeChange(newSize, oldSize);
+ d->popup->contentSizeChange(newSize, oldSize);
+}
+
void QQuickPopupItem::fontChange(const QFont &newFont, const QFont &oldFont)
{
Q_D(QQuickPopupItem);
- QQuickControl::fontChange(newFont, oldFont);
+ QQuickPage::fontChange(newFont, oldFont);
d->popup->fontChange(newFont, oldFont);
}
void QQuickPopupItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickPopupItem);
- QQuickControl::geometryChanged(newGeometry, oldGeometry);
+ QQuickPage::geometryChanged(newGeometry, oldGeometry);
d->popup->geometryChanged(newGeometry, oldGeometry);
}
void QQuickPopupItem::localeChange(const QLocale &newLocale, const QLocale &oldLocale)
{
Q_D(QQuickPopupItem);
- QQuickControl::localeChange(newLocale, oldLocale);
+ QQuickPage::localeChange(newLocale, oldLocale);
d->popup->localeChange(newLocale, oldLocale);
}
@@ -339,21 +348,21 @@ void QQuickPopupItem::mirrorChange()
void QQuickPopupItem::itemChange(ItemChange change, const ItemChangeData &data)
{
Q_D(QQuickPopupItem);
- QQuickControl::itemChange(change, data);
+ QQuickPage::itemChange(change, data);
d->popup->itemChange(change, data);
}
void QQuickPopupItem::paddingChange(const QMarginsF &newPadding, const QMarginsF &oldPadding)
{
Q_D(QQuickPopupItem);
- QQuickControl::paddingChange(newPadding, oldPadding);
+ QQuickPage::paddingChange(newPadding, oldPadding);
d->popup->paddingChange(newPadding, oldPadding);
}
void QQuickPopupItem::paletteChange(const QPalette &newPalette, const QPalette &oldPalette)
{
Q_D(QQuickPopupItem);
- QQuickControl::paletteChange(newPalette, oldPalette);
+ QQuickPage::paletteChange(newPalette, oldPalette);
d->popup->paletteChange(newPalette, oldPalette);
}
@@ -379,7 +388,7 @@ QAccessible::Role QQuickPopupItem::accessibleRole() const
void QQuickPopupItem::accessibilityActiveChanged(bool active)
{
Q_D(const QQuickPopupItem);
- QQuickControl::accessibilityActiveChanged(active);
+ QQuickPage::accessibilityActiveChanged(active);
d->popup->accessibilityActiveChanged(active);
}
#endif
diff --git a/src/quicktemplates2/qquickpopupitem_p_p.h b/src/quicktemplates2/qquickpopupitem_p_p.h
index 0187b77a..a15aeb17 100644
--- a/src/quicktemplates2/qquickpopupitem_p_p.h
+++ b/src/quicktemplates2/qquickpopupitem_p_p.h
@@ -48,14 +48,13 @@
// We mean it.
//
-#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickpage_p.h>
QT_BEGIN_NAMESPACE
class QQuickPopup;
class QQuickPopupItemPrivate;
-
-class QQuickPopupItem : public QQuickControl
+class QQuickPopupItem : public QQuickPage
{
Q_OBJECT
@@ -88,6 +87,7 @@ protected:
#endif
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ void contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize) override;
void fontChange(const QFont &newFont, const QFont &oldFont) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void localeChange(const QLocale &newLocale, const QLocale &oldLocale) override;
diff --git a/src/quicktemplates2/qquickpopuppositioner.cpp b/src/quicktemplates2/qquickpopuppositioner.cpp
index 4fe5135c..ebd8ff29 100644
--- a/src/quicktemplates2/qquickpopuppositioner.cpp
+++ b/src/quicktemplates2/qquickpopuppositioner.cpp
@@ -34,10 +34,13 @@
**
****************************************************************************/
+#include "qquickoverlay_p.h"
#include "qquickpopuppositioner_p_p.h"
+#include "qquickpopupanchors_p.h"
#include "qquickpopupitem_p_p.h"
#include "qquickpopup_p_p.h"
+#include <QtQml/qqmlinfo.h>
#include <QtQuick/private/qquickitem_p.h>
QT_BEGIN_NAMESPACE
@@ -62,6 +65,11 @@ QQuickPopupPositioner::~QQuickPopupPositioner()
}
}
+QQuickPopup *QQuickPopupPositioner::popup() const
+{
+ return m_popup;
+}
+
QQuickItem *QQuickPopupPositioner::parentItem() const
{
return m_parentItem;
@@ -109,12 +117,31 @@ void QQuickPopupPositioner::reposition()
bool heightAdjusted = false;
QQuickPopupPrivate *p = QQuickPopupPrivate::get(m_popup);
- QRectF rect(p->allowHorizontalMove ? p->x : popupItem->x(),
- p->allowVerticalMove ? p->y : popupItem->y(),
+ const QQuickItem *centerInParent = p->anchors ? p->getAnchors()->centerIn() : nullptr;
+ const QQuickOverlay *centerInOverlay = qobject_cast<const QQuickOverlay*>(centerInParent);
+ QRectF rect(!centerInParent ? p->allowHorizontalMove ? p->x : popupItem->x() : 0,
+ !centerInParent ? p->allowVerticalMove ? p->y : popupItem->y() : 0,
!p->hasWidth && iw > 0 ? iw : w,
!p->hasHeight && ih > 0 ? ih : h);
if (m_parentItem) {
- rect.moveTopLeft(m_parentItem->mapToItem(popupItem->parentItem(), rect.topLeft()));
+ // m_parentItem is the parent that the popup should open in,
+ // and popupItem()->parentItem() is the overlay, so the mapToItem() calls below
+ // effectively map the rect to scene coordinates.
+ if (centerInParent) {
+ if (centerInParent != parentItem() && !centerInOverlay) {
+ qmlWarning(m_popup) << "Popup can only be centered within its immediate parent or Overlay.overlay";
+ return;
+ }
+
+ if (centerInOverlay) {
+ rect.moveCenter(QPointF(qRound(centerInOverlay->width() / 2.0), qRound(centerInOverlay->height() / 2.0)));
+ } else {
+ const QPointF parentItemCenter = QPointF(qRound(m_parentItem->width() / 2), qRound(m_parentItem->height() / 2));
+ rect.moveCenter(m_parentItem->mapToItem(popupItem->parentItem(), parentItemCenter));
+ }
+ } else {
+ rect.moveTopLeft(m_parentItem->mapToItem(popupItem->parentItem(), rect.topLeft()));
+ }
if (p->window) {
const QMarginsF margins = p->getMargins();
@@ -215,7 +242,11 @@ void QQuickPopupPositioner::reposition()
popupItem->setPosition(rect.topLeft());
- const QPointF effectivePos = m_parentItem ? m_parentItem->mapFromScene(rect.topLeft()) : rect.topLeft();
+ // If the popup was assigned a parent, rect will be in scene coordinates,
+ // so we need to map its top left back to item coordinates.
+ // However, if centering within the overlay, the coordinates will be relative
+ // to the window, so we don't need to do anything.
+ const QPointF effectivePos = m_parentItem && !centerInOverlay ? m_parentItem->mapFromScene(rect.topLeft()) : rect.topLeft();
if (!qFuzzyCompare(p->effectiveX, effectivePos.x())) {
p->effectiveX = effectivePos.x();
emit m_popup->xChanged();
diff --git a/src/quicktemplates2/qquickpopuppositioner_p_p.h b/src/quicktemplates2/qquickpopuppositioner_p_p.h
index db1f9b17..6eb990a7 100644
--- a/src/quicktemplates2/qquickpopuppositioner_p_p.h
+++ b/src/quicktemplates2/qquickpopuppositioner_p_p.h
@@ -61,6 +61,8 @@ public:
explicit QQuickPopupPositioner(QQuickPopup *popup);
~QQuickPopupPositioner();
+ QQuickPopup *popup() const;
+
QQuickItem *parentItem() const;
void setParentItem(QQuickItem *parent);
diff --git a/src/quicktemplates2/qquickradiobutton.cpp b/src/quicktemplates2/qquickradiobutton.cpp
index 86be3ed6..bf0c414c 100644
--- a/src/quicktemplates2/qquickradiobutton.cpp
+++ b/src/quicktemplates2/qquickradiobutton.cpp
@@ -99,12 +99,12 @@ QQuickRadioButton::QQuickRadioButton(QQuickItem *parent)
QFont QQuickRadioButton::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::RadioButtonFont);
+ return QQuickTheme::font(QQuickTheme::RadioButton);
}
QPalette QQuickRadioButton::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::RadioButtonPalette);
+ return QQuickTheme::palette(QQuickTheme::RadioButton);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickradiodelegate.cpp b/src/quicktemplates2/qquickradiodelegate.cpp
index fe603d36..12a1ffb7 100644
--- a/src/quicktemplates2/qquickradiodelegate.cpp
+++ b/src/quicktemplates2/qquickradiodelegate.cpp
@@ -100,7 +100,12 @@ QQuickRadioDelegate::QQuickRadioDelegate(QQuickItem *parent)
QFont QQuickRadioDelegate::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+ return QQuickTheme::font(QQuickTheme::ListView);
+}
+
+QPalette QQuickRadioDelegate::defaultPalette() const
+{
+ return QQuickTheme::palette(QQuickTheme::ListView);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickradiodelegate_p.h b/src/quicktemplates2/qquickradiodelegate_p.h
index 4db9959d..453856e4 100644
--- a/src/quicktemplates2/qquickradiodelegate_p.h
+++ b/src/quicktemplates2/qquickradiodelegate_p.h
@@ -63,6 +63,7 @@ public:
protected:
QFont defaultFont() const override;
+ QPalette defaultPalette() const override;
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickrangeslider.cpp b/src/quicktemplates2/qquickrangeslider.cpp
index 569d7645..ff488dac 100644
--- a/src/quicktemplates2/qquickrangeslider.cpp
+++ b/src/quicktemplates2/qquickrangeslider.cpp
@@ -74,7 +74,7 @@ QT_BEGIN_NAMESPACE
use the following syntax:
\code
- first.onValueChanged: console.log("first.value changed to " + first.value)
+ first.onMoved: console.log("first.value changed to " + first.value)
\endcode
The \l {first.position} and \l {second.position} properties are expressed as
@@ -263,8 +263,13 @@ void QQuickRangeSliderNode::setHandle(QQuickItem *handle)
if (!d->handle.isExecuting())
d->cancelHandle();
+ const qreal oldImplicitHandleWidth = implicitHandleWidth();
+ const qreal oldImplicitHandleHeight = implicitHandleHeight();
+
+ QQuickControlPrivate::get(d->slider)->removeImplicitSizeListener(d->handle);
delete d->handle;
d->handle = handle;
+
if (handle) {
if (!handle->parentItem())
handle->setParentItem(d->slider);
@@ -288,7 +293,13 @@ void QQuickRangeSliderNode::setHandle(QQuickItem *handle)
}
handle->setActiveFocusOnTab(true);
+ QQuickControlPrivate::get(d->slider)->addImplicitSizeListener(handle);
}
+
+ if (!qFuzzyCompare(oldImplicitHandleWidth, implicitHandleWidth()))
+ emit implicitHandleWidthChanged();
+ if (!qFuzzyCompare(oldImplicitHandleHeight, implicitHandleHeight()))
+ emit implicitHandleHeightChanged();
if (!d->handle.isExecuting())
emit handleChanged();
}
@@ -326,6 +337,22 @@ void QQuickRangeSliderNode::setHovered(bool hovered)
emit hoveredChanged();
}
+qreal QQuickRangeSliderNode::implicitHandleWidth() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ if (!d->handle)
+ return 0;
+ return d->handle->implicitWidth();
+}
+
+qreal QQuickRangeSliderNode::implicitHandleHeight() const
+{
+ Q_D(const QQuickRangeSliderNode);
+ if (!d->handle)
+ return 0;
+ return d->handle->implicitHeight();
+}
+
void QQuickRangeSliderNode::increase()
{
Q_D(QQuickRangeSliderNode);
@@ -360,10 +387,14 @@ public:
void updateHover(const QPointF &pos);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
bool live = true;
qreal from = defaultFrom;
qreal to = defaultTo;
qreal stepSize = 0;
+ qreal touchDragThreshold = -1;
QQuickRangeSliderNode *first = nullptr;
QQuickRangeSliderNode *second = nullptr;
QPointF pressPoint;
@@ -503,6 +534,7 @@ void QQuickRangeSliderPrivate::handleMove(const QPointF &point)
QQuickControlPrivate::handleMove(point);
QQuickRangeSliderNode *pressedNode = QQuickRangeSliderPrivate::pressedNode(touchId);
if (pressedNode) {
+ const qreal oldPos = pressedNode->position();
qreal pos = positionAt(q, pressedNode->handle(), point);
if (snapMode == QQuickRangeSlider::SnapAlways)
pos = snapPosition(q, pos);
@@ -510,6 +542,9 @@ void QQuickRangeSliderPrivate::handleMove(const QPointF &point)
pressedNode->setValue(valueAt(q, pos));
else
QQuickRangeSliderNodePrivate::get(pressedNode)->setPosition(pos);
+
+ if (!qFuzzyCompare(pressedNode->position(), oldPos))
+ emit pressedNode->moved();
}
}
@@ -525,6 +560,7 @@ void QQuickRangeSliderPrivate::handleRelease(const QPointF &point)
QQuickRangeSliderNodePrivate *pressedNodePrivate = QQuickRangeSliderNodePrivate::get(pressedNode);
if (q->keepMouseGrab() || q->keepTouchGrab()) {
+ const qreal oldPos = pressedNode->position();
qreal pos = positionAt(q, pressedNode->handle(), point);
if (snapMode != QQuickRangeSlider::NoSnap)
pos = snapPosition(q, pos);
@@ -535,6 +571,9 @@ void QQuickRangeSliderPrivate::handleRelease(const QPointF &point)
pressedNodePrivate->setPosition(pos);
q->setKeepMouseGrab(false);
q->setKeepTouchGrab(false);
+
+ if (!qFuzzyCompare(pressedNode->position(), oldPos))
+ emit pressedNode->moved();
}
pressedNode->setPressed(false);
pressedNodePrivate->touchId = -1;
@@ -559,6 +598,24 @@ void QQuickRangeSliderPrivate::updateHover(const QPointF &pos)
second->setHovered(secondHandle && secondHandle->isEnabled() && secondHandle->contains(q->mapToItem(secondHandle, pos)));
}
+void QQuickRangeSliderPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ QQuickControlPrivate::itemImplicitWidthChanged(item);
+ if (item == first->handle())
+ emit first->implicitHandleWidthChanged();
+ else if (item == second->handle())
+ emit second->implicitHandleWidthChanged();
+}
+
+void QQuickRangeSliderPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ QQuickControlPrivate::itemImplicitHeightChanged(item);
+ if (item == first->handle())
+ emit first->implicitHandleHeightChanged();
+ else if (item == second->handle())
+ emit second->implicitHandleHeightChanged();
+}
+
QQuickRangeSlider::QQuickRangeSlider(QQuickItem *parent)
: QQuickControl(*(new QQuickRangeSliderPrivate), parent)
{
@@ -573,6 +630,13 @@ QQuickRangeSlider::QQuickRangeSlider(QQuickItem *parent)
#endif
}
+QQuickRangeSlider::~QQuickRangeSlider()
+{
+ Q_D(QQuickRangeSlider);
+ d->removeImplicitSizeListener(d->first->handle());
+ d->removeImplicitSizeListener(d->second->handle());
+}
+
/*!
\qmlproperty real QtQuick.Controls::RangeSlider::from
@@ -630,6 +694,55 @@ void QQuickRangeSlider::setTo(qreal to)
}
/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty qreal QtQuick.Controls::RangeSlider::touchDragThreshold
+
+ This property holds the threshold (in logical pixels) at which a touch drag event will be initiated.
+ The mouse drag threshold won't be affected.
+ The default value is \c Qt.styleHints.startDragDistance.
+
+ \sa QStyleHints
+
+*/
+qreal QQuickRangeSlider::touchDragThreshold() const
+{
+ Q_D(const QQuickRangeSlider);
+ return d->touchDragThreshold;
+}
+
+void QQuickRangeSlider::setTouchDragThreshold(qreal touchDragThreshold)
+{
+ Q_D(QQuickRangeSlider);
+ if (d->touchDragThreshold == touchDragThreshold)
+ return;
+
+ d->touchDragThreshold = touchDragThreshold;
+ emit touchDragThresholdChanged();
+}
+
+void QQuickRangeSlider::resetTouchDragThreshold()
+{
+ setTouchDragThreshold(-1);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlmethod real QtQuick.Controls::RangeSlider::valueAt(real position)
+
+ Returns the value for the given \a position.
+
+ \sa first.value, second.value, first.position, second.position, live
+*/
+qreal QQuickRangeSlider::valueAt(qreal position) const
+{
+ Q_D(const QQuickRangeSlider);
+ const qreal value = (d->to - d->from) * position;
+ if (qFuzzyIsNull(d->stepSize))
+ return d->from + value;
+ return d->from + qRound(value / d->stepSize) * d->stepSize;
+}
+
+/*!
\qmlpropertygroup QtQuick.Controls::RangeSlider::first
\qmlproperty real QtQuick.Controls::RangeSlider::first.value
\qmlproperty real QtQuick.Controls::RangeSlider::first.position
@@ -637,6 +750,9 @@ void QQuickRangeSlider::setTo(qreal to)
\qmlproperty Item QtQuick.Controls::RangeSlider::first.handle
\qmlproperty bool QtQuick.Controls::RangeSlider::first.pressed
\qmlproperty bool QtQuick.Controls::RangeSlider::first.hovered
+ \qmlproperty real QtQuick.Controls::RangeSlider::first.implicitHandleWidth
+ \qmlproperty real QtQuick.Controls::RangeSlider::first.implicitHandleHeight
+ \qmlsignal void QtQuick.Controls::RangeSlider::moved()
\table
\header
@@ -677,6 +793,20 @@ void QQuickRangeSlider::setTo(qreal to)
\li hovered
\li This property holds whether the first handle is hovered.
This property was introduced in QtQuick.Controls 2.1.
+ \row
+ \li implicitHandleWidth
+ \li This property holds the implicit width of the first handle.
+ This property was introduced in QtQuick.Controls 2.5.
+ \row
+ \li implicitHandleHeight
+ \li This property holds the implicit height of the first handle.
+ This property was introduced in QtQuick.Controls 2.5.
+ \row
+ \li moved()
+ \li This signal is emitted when the first handle has been interactively moved
+ by the user by either touch, mouse, or keys.
+
+ This signal was introduced in QtQuick.Controls 2.5.
\endtable
\sa first.increase(), first.decrease()
@@ -695,6 +825,9 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const
\qmlproperty Item QtQuick.Controls::RangeSlider::second.handle
\qmlproperty bool QtQuick.Controls::RangeSlider::second.pressed
\qmlproperty bool QtQuick.Controls::RangeSlider::second.hovered
+ \qmlproperty real QtQuick.Controls::RangeSlider::second.implicitHandleWidth
+ \qmlproperty real QtQuick.Controls::RangeSlider::second.implicitHandleHeight
+ \qmlsignal void QtQuick.Controls::RangeSlider::moved()
\table
\header
@@ -735,6 +868,20 @@ QQuickRangeSliderNode *QQuickRangeSlider::first() const
\li hovered
\li This property holds whether the second handle is hovered.
This property was introduced in QtQuick.Controls 2.1.
+ \row
+ \li implicitHandleWidth
+ \li This property holds the implicit width of the second handle.
+ This property was introduced in QtQuick.Controls 2.5.
+ \row
+ \li implicitHandleHeight
+ \li This property holds the implicit height of the second handle.
+ This property was introduced in QtQuick.Controls 2.5.
+ \row
+ \li moved()
+ \li This signal is emitted when the second handle has been interactively moved
+ by the user by either touch, mouse, or keys.
+
+ This signal was introduced in QtQuick.Controls 2.5.
\endtable
\sa second.increase(), second.decrease()
@@ -971,6 +1118,7 @@ void QQuickRangeSlider::keyPressEvent(QKeyEvent *event)
if (!focusNode)
return;
+ const qreal oldValue = focusNode->value();
if (d->orientation == Qt::Horizontal) {
if (event->key() == Qt::Key_Left) {
focusNode->setPressed(true);
@@ -998,6 +1146,8 @@ void QQuickRangeSlider::keyPressEvent(QKeyEvent *event)
event->accept();
}
}
+ if (!qFuzzyCompare(focusNode->value(), oldValue))
+ emit focusNode->moved();
}
void QQuickRangeSlider::hoverEnterEvent(QHoverEvent *event)
@@ -1055,9 +1205,9 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event)
case Qt::TouchPointMoved:
if (!keepTouchGrab()) {
if (d->orientation == Qt::Horizontal)
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - point.startPos().x(), Qt::XAxis, &point));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - point.startPos().x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
else
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - point.startPos().y(), Qt::YAxis, &point));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - point.startPos().y(), Qt::YAxis, &point, qRound(d->touchDragThreshold)));
}
if (keepTouchGrab())
d->handleMove(point.pos());
diff --git a/src/quicktemplates2/qquickrangeslider_p.h b/src/quicktemplates2/qquickrangeslider_p.h
index 45de6bbb..a42245a1 100644
--- a/src/quicktemplates2/qquickrangeslider_p.h
+++ b/src/quicktemplates2/qquickrangeslider_p.h
@@ -70,9 +70,12 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSlider : public QQuickControl
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
// 2.3 (Qt 5.10)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal touchDragThreshold READ touchDragThreshold WRITE setTouchDragThreshold RESET resetTouchDragThreshold NOTIFY touchDragThresholdChanged FINAL REVISION 5)
public:
explicit QQuickRangeSlider(QQuickItem *parent = nullptr);
+ ~QQuickRangeSlider();
qreal from() const;
void setFrom(qreal from);
@@ -109,6 +112,12 @@ public:
bool isHorizontal() const;
bool isVertical() const;
+ // 2.5 (Qt 5.12)
+ qreal touchDragThreshold() const;
+ void setTouchDragThreshold(qreal touchDragThreshold);
+ void resetTouchDragThreshold();
+ Q_REVISION(5) Q_INVOKABLE qreal valueAt(qreal position) const;
+
Q_SIGNALS:
void fromChanged();
void toChanged();
@@ -117,6 +126,8 @@ Q_SIGNALS:
void orientationChanged();
// 2.2 (Qt 5.9)
Q_REVISION(2) void liveChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void touchDragThresholdChanged();
protected:
void focusInEvent(QFocusEvent *event) override;
@@ -156,6 +167,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickRangeSliderNode : public QObject
Q_PROPERTY(bool pressed READ isPressed WRITE setPressed NOTIFY pressedChanged FINAL)
// 2.1 (Qt 5.8)
Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitHandleWidth READ implicitHandleWidth NOTIFY implicitHandleWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitHandleHeight READ implicitHandleHeight NOTIFY implicitHandleHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "handle")
public:
@@ -178,6 +192,10 @@ public:
bool isHovered() const;
void setHovered(bool hovered);
+ // 2.5 (Qt 5.12)
+ qreal implicitHandleWidth() const;
+ qreal implicitHandleHeight() const;
+
public Q_SLOTS:
void increase();
void decrease();
@@ -190,6 +208,10 @@ Q_SIGNALS:
void pressedChanged();
// 2.1 (Qt 5.8)
Q_REVISION(1) void hoveredChanged();
+ // 2.5 (Qt 5.12)
+ /*Q_REVISION(5)*/ void moved();
+ /*Q_REVISION(5)*/ void implicitHandleWidthChanged();
+ /*Q_REVISION(5)*/ void implicitHandleHeightChanged();
private:
Q_DISABLE_COPY(QQuickRangeSliderNode)
diff --git a/src/quicktemplates2/qquickscrollview.cpp b/src/quicktemplates2/qquickscrollview.cpp
index 451f54d4..abd75d31 100644
--- a/src/quicktemplates2/qquickscrollview.cpp
+++ b/src/quicktemplates2/qquickscrollview.cpp
@@ -35,7 +35,7 @@
****************************************************************************/
#include "qquickscrollview_p.h"
-#include "qquickcontrol_p_p.h"
+#include "qquickpane_p_p.h"
#include "qquickscrollbar_p_p.h"
#include <QtQuick/private/qquickflickable_p.h>
@@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype ScrollView
- \inherits Control
+ \inherits Pane
\instantiates QQuickScrollView
\inqmlmodule QtQuick.Controls
\since 5.9
@@ -115,11 +115,15 @@ QT_BEGIN_NAMESPACE
{Focus Management in Qt Quick Controls 2}
*/
-class QQuickScrollViewPrivate : public QQuickControlPrivate
+class QQuickScrollViewPrivate : public QQuickPanePrivate
{
Q_DECLARE_PUBLIC(QQuickScrollView)
public:
+ QQmlListProperty<QObject> contentData() override;
+ QQmlListProperty<QQuickItem> contentChildren() override;
+ QList<QQuickItem *> contentChildItems() const override;
+
QQuickItem *getContentItem() override;
QQuickFlickable *ensureFlickable(bool content);
@@ -143,12 +147,20 @@ public:
static QQuickItem *contentChildren_at(QQmlListProperty<QQuickItem> *prop, int index);
static void contentChildren_clear(QQmlListProperty<QQuickItem> *prop);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+
bool wasTouched = false;
- qreal contentWidth = -1;
- qreal contentHeight = -1;
QQuickFlickable *flickable = nullptr;
};
+QList<QQuickItem *> QQuickScrollViewPrivate::contentChildItems() const
+{
+ if (!flickable)
+ return QList<QQuickItem *>();
+
+ return flickable->contentItem()->childItems();
+}
+
QQuickItem *QQuickScrollViewPrivate::getContentItem()
{
if (!contentItem)
@@ -178,7 +190,7 @@ bool QQuickScrollViewPrivate::setFlickable(QQuickFlickable *item, bool content)
if (attached)
QQuickScrollBarAttachedPrivate::get(attached)->setFlickable(nullptr);
- QObject::disconnect(flickable->contentItem(), &QQuickItem::childrenChanged, q, &QQuickScrollView::contentChildrenChanged);
+ QObjectPrivate::disconnect(flickable->contentItem(), &QQuickItem::childrenChanged, this, &QQuickPanePrivate::contentChildrenChange);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickScrollViewPrivate::updateContentWidth);
QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickScrollViewPrivate::updateContentHeight);
}
@@ -189,19 +201,19 @@ bool QQuickScrollViewPrivate::setFlickable(QQuickFlickable *item, bool content)
if (flickable) {
flickable->installEventFilter(q);
- if (contentWidth > 0)
- item->setContentWidth(contentWidth);
+ if (hasContentWidth)
+ flickable->setContentWidth(contentWidth);
else
updateContentWidth();
- if (contentHeight > 0)
- item->setContentHeight(contentHeight);
+ if (hasContentHeight)
+ flickable->setContentHeight(contentHeight);
else
updateContentHeight();
if (attached)
QQuickScrollBarAttachedPrivate::get(attached)->setFlickable(flickable);
- QObject::connect(flickable->contentItem(), &QQuickItem::childrenChanged, q, &QQuickScrollView::contentChildrenChanged);
+ QObjectPrivate::connect(flickable->contentItem(), &QQuickItem::childrenChanged, this, &QQuickPanePrivate::contentChildrenChange);
QObjectPrivate::connect(flickable, &QQuickFlickable::contentWidthChanged, this, &QQuickScrollViewPrivate::updateContentWidth);
QObjectPrivate::connect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickScrollViewPrivate::updateContentHeight);
}
@@ -216,11 +228,11 @@ void QQuickScrollViewPrivate::updateContentWidth()
return;
const qreal cw = flickable->contentWidth();
- if (qFuzzyCompare(cw, contentWidth))
+ if (qFuzzyCompare(cw, implicitContentWidth))
return;
- contentWidth = cw;
- emit q->contentWidthChanged();
+ implicitContentWidth = cw;
+ emit q->implicitContentWidthChanged();
}
void QQuickScrollViewPrivate::updateContentHeight()
@@ -230,11 +242,11 @@ void QQuickScrollViewPrivate::updateContentHeight()
return;
const qreal ch = flickable->contentHeight();
- if (qFuzzyCompare(ch, contentHeight))
+ if (qFuzzyCompare(ch, implicitContentHeight))
return;
- contentHeight = ch;
- emit q->contentHeightChanged();
+ implicitContentHeight = ch;
+ emit q->implicitContentHeightChanged();
}
QQuickScrollBar *QQuickScrollViewPrivate::verticalScrollBar() const
@@ -356,73 +368,24 @@ void QQuickScrollViewPrivate::contentChildren_clear(QQmlListProperty<QQuickItem>
children.clear(&children);
}
-QQuickScrollView::QQuickScrollView(QQuickItem *parent)
- : QQuickControl(*(new QQuickScrollViewPrivate), parent)
+void QQuickScrollViewPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
- setFlag(ItemIsFocusScope);
- setActiveFocusOnTab(true);
- setFiltersChildMouseEvents(true);
- setWheelEnabled(true);
-}
-
-/*!
- \qmlproperty real QtQuick.Controls::ScrollView::contentWidth
-
- This property holds the width of the scrollable content.
-
- If only a single item is used within a ScrollView, the content size is
- automatically calculated based on the implicit size of its contained item.
-
- \sa contentHeight, Sizing
-*/
-qreal QQuickScrollView::contentWidth() const
-{
- Q_D(const QQuickScrollView);
- return d->contentWidth;
-}
-
-void QQuickScrollView::setContentWidth(qreal width)
-{
- Q_D(QQuickScrollView);
- if (qFuzzyCompare(d->contentWidth, width))
+ // a special case for width<->height dependent content (wrapping text) in ScrollView
+ if (contentWidth < 0 && !componentComplete)
return;
- if (d->flickable) {
- d->flickable->setContentWidth(width);
- } else {
- d->contentWidth = width;
- emit contentWidthChanged();
- }
-}
-
-/*!
- \qmlproperty real QtQuick.Controls::ScrollView::contentHeight
-
- This property holds the height of the scrollable content.
-
- If only a single item is used within a ScrollView, the content size is
- automatically calculated based on the implicit size of its contained item.
-
- \sa contentWidth, Sizing
-*/
-qreal QQuickScrollView::contentHeight() const
-{
- Q_D(const QQuickScrollView);
- return d->contentHeight;
+ QQuickPanePrivate::itemImplicitWidthChanged(item);
}
-void QQuickScrollView::setContentHeight(qreal height)
+QQuickScrollView::QQuickScrollView(QQuickItem *parent)
+ : QQuickPane(*(new QQuickScrollViewPrivate), parent)
{
Q_D(QQuickScrollView);
- if (qFuzzyCompare(d->contentHeight, height))
- return;
+ d->contentWidth = -1;
+ d->contentHeight = -1;
- if (d->flickable) {
- d->flickable->setContentHeight(height);
- } else {
- d->contentHeight = height;
- emit contentHeightChanged();
- }
+ setFiltersChildMouseEvents(true);
+ setWheelEnabled(true);
}
/*!
@@ -437,10 +400,10 @@ void QQuickScrollView::setContentHeight(qreal height)
\sa Item::data, contentChildren
*/
-QQmlListProperty<QObject> QQuickScrollView::contentData()
+QQmlListProperty<QObject> QQuickScrollViewPrivate::contentData()
{
- Q_D(QQuickScrollView);
- return QQmlListProperty<QObject>(this, d,
+ Q_Q(QQuickScrollView);
+ return QQmlListProperty<QObject>(q, this,
QQuickScrollViewPrivate::contentData_append,
QQuickScrollViewPrivate::contentData_count,
QQuickScrollViewPrivate::contentData_at,
@@ -458,10 +421,10 @@ QQmlListProperty<QObject> QQuickScrollView::contentData()
\sa Item::children, contentData
*/
-QQmlListProperty<QQuickItem> QQuickScrollView::contentChildren()
+QQmlListProperty<QQuickItem> QQuickScrollViewPrivate::contentChildren()
{
- Q_D(QQuickScrollView);
- return QQmlListProperty<QQuickItem>(this, d,
+ Q_Q(QQuickScrollView);
+ return QQmlListProperty<QQuickItem>(q, this,
QQuickScrollViewPrivate::contentChildren_append,
QQuickScrollViewPrivate::contentChildren_count,
QQuickScrollViewPrivate::contentChildren_at,
@@ -517,13 +480,13 @@ bool QQuickScrollView::eventFilter(QObject *object, QEvent *event)
if (!d->wheelEnabled)
return true;
}
- return QQuickControl::eventFilter(object, event);
+ return QQuickPane::eventFilter(object, event);
}
void QQuickScrollView::keyPressEvent(QKeyEvent *event)
{
Q_D(QQuickScrollView);
- QQuickControl::keyPressEvent(event);
+ QQuickPane::keyPressEvent(event);
switch (event->key()) {
case Qt::Key_Up:
if (QQuickScrollBar *vbar = d->verticalScrollBar()) {
@@ -558,22 +521,26 @@ void QQuickScrollView::keyPressEvent(QKeyEvent *event)
void QQuickScrollView::componentComplete()
{
Q_D(QQuickScrollView);
- QQuickControl::componentComplete();
- if (!d->contentItem) {
+ QQuickPane::componentComplete();
+ if (!d->contentItem)
d->ensureFlickable(true);
- } else {
- if (d->contentWidth <= 0)
- d->updateContentWidth();
- if (d->contentHeight <= 0)
- d->updateContentHeight();
- }
}
void QQuickScrollView::contentItemChange(QQuickItem *newItem, QQuickItem *oldItem)
{
Q_D(QQuickScrollView);
- QQuickControl::contentItemChange(newItem, oldItem);
d->setFlickable(qobject_cast<QQuickFlickable *>(newItem), false);
+ QQuickPane::contentItemChange(newItem, oldItem);
+}
+
+void QQuickScrollView::contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize)
+{
+ Q_D(QQuickScrollView);
+ QQuickPane::contentSizeChange(newSize, oldSize);
+ if (d->flickable) {
+ d->flickable->setContentWidth(newSize.width());
+ d->flickable->setContentHeight(newSize.height());
+ }
}
#if QT_CONFIG(accessibility)
@@ -584,3 +551,5 @@ QAccessible::Role QQuickScrollView::accessibleRole() const
#endif
QT_END_NAMESPACE
+
+#include "moc_qquickscrollview_p.cpp"
diff --git a/src/quicktemplates2/qquickscrollview_p.h b/src/quicktemplates2/qquickscrollview_p.h
index 136260c2..2b8d260e 100644
--- a/src/quicktemplates2/qquickscrollview_p.h
+++ b/src/quicktemplates2/qquickscrollview_p.h
@@ -48,39 +48,20 @@
// We mean it.
//
-#include <QtQuickTemplates2/private/qquickcontrol_p.h>
+#include <QtQuickTemplates2/private/qquickpane_p.h>
#include <QtQml/qqmllist.h>
QT_BEGIN_NAMESPACE
class QQuickScrollViewPrivate;
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollView : public QQuickControl
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickScrollView : 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(QQmlListProperty<QObject> contentData READ contentData FINAL)
- Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
- Q_CLASSINFO("DefaultProperty", "contentData")
public:
explicit QQuickScrollView(QQuickItem *parent = nullptr);
- qreal contentWidth() const;
- void setContentWidth(qreal width);
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
-
- QQmlListProperty<QObject> contentData();
- QQmlListProperty<QQuickItem> contentChildren();
-
-Q_SIGNALS:
- void contentWidthChanged();
- void contentHeightChanged();
- void contentChildrenChanged();
-
protected:
bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
bool eventFilter(QObject *object, QEvent *event) override;
@@ -88,6 +69,7 @@ protected:
void componentComplete() override;
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
+ void contentSizeChange(const QSizeF &newSize, const QSizeF &oldSize) override;
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickslider.cpp b/src/quicktemplates2/qquickslider.cpp
index 5806aad5..179dcb64 100644
--- a/src/quicktemplates2/qquickslider.cpp
+++ b/src/quicktemplates2/qquickslider.cpp
@@ -105,11 +105,15 @@ public:
void cancelHandle();
void executeHandle(bool complete = false);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
qreal from = 0;
qreal to = 1;
qreal value = 0;
qreal position = 0;
qreal stepSize = 0;
+ qreal touchDragThreshold = -1; // in QQuickWindowPrivate::dragOverThreshold, '-1' implies using styleHints::startDragDistance()
bool live = true;
bool pressed = false;
QPointF pressPoint;
@@ -248,6 +252,22 @@ void QQuickSliderPrivate::executeHandle(bool complete)
quickCompleteDeferred(q, handleName(), handle);
}
+void QQuickSliderPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickSlider);
+ QQuickControlPrivate::itemImplicitWidthChanged(item);
+ if (item == handle)
+ emit q->implicitHandleWidthChanged();
+}
+
+void QQuickSliderPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickSlider);
+ QQuickControlPrivate::itemImplicitHeightChanged(item);
+ if (item == handle)
+ emit q->implicitHandleHeightChanged();
+}
+
QQuickSlider::QQuickSlider(QQuickItem *parent)
: QQuickControl(*(new QQuickSliderPrivate), parent)
{
@@ -259,6 +279,12 @@ QQuickSlider::QQuickSlider(QQuickItem *parent)
#endif
}
+QQuickSlider::~QQuickSlider()
+{
+ Q_D(QQuickSlider);
+ d->removeImplicitSizeListener(d->handle);
+}
+
/*!
\qmlproperty real QtQuick.Controls::Slider::from
@@ -549,10 +575,23 @@ void QQuickSlider::setHandle(QQuickItem *handle)
if (!d->handle.isExecuting())
d->cancelHandle();
+ const qreal oldImplicitHandleWidth = implicitHandleWidth();
+ const qreal oldImplicitHandleHeight = implicitHandleHeight();
+
+ d->removeImplicitSizeListener(d->handle);
delete d->handle;
d->handle = handle;
- if (handle && !handle->parentItem())
- handle->setParentItem(this);
+
+ if (handle) {
+ if (!handle->parentItem())
+ handle->setParentItem(this);
+ d->addImplicitSizeListener(handle);
+ }
+
+ if (!qFuzzyCompare(oldImplicitHandleWidth, implicitHandleWidth()))
+ emit implicitHandleWidthChanged();
+ if (!qFuzzyCompare(oldImplicitHandleHeight, implicitHandleHeight()))
+ emit implicitHandleHeightChanged();
if (!d->handle.isExecuting())
emit handleChanged();
}
@@ -629,6 +668,81 @@ void QQuickSlider::decrease()
setValue(d->value - step);
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty qreal QtQuick.Controls::Slider::touchDragThreshold
+
+ This property holds the threshold (in logical pixels) at which a touch drag event will be initiated.
+ The mouse drag threshold won't be affected.
+ The default value is \c Qt.styleHints.startDragDistance.
+
+ \sa QStyleHints
+*/
+qreal QQuickSlider::touchDragThreshold() const
+{
+ Q_D(const QQuickSlider);
+ return d->touchDragThreshold;
+}
+
+void QQuickSlider::setTouchDragThreshold(qreal touchDragThreshold)
+{
+ Q_D(QQuickSlider);
+ if (d->touchDragThreshold == touchDragThreshold)
+ return;
+
+ d->touchDragThreshold = touchDragThreshold;
+ emit touchDragThresholdChanged();
+}
+
+void QQuickSlider::resetTouchDragThreshold()
+{
+ setTouchDragThreshold(-1);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Slider::implicitHandleWidth
+ \readonly
+
+ This property holds the implicit handle width.
+
+ The value is equal to \c {handle ? handle.implicitWidth : 0}.
+
+ This is typically used, together with \l {Control::}{implicitContentWidth} and
+ \l {Control::}{implicitBackgroundWidth}, to calculate the \l {Item::}{implicitWidth}.
+
+ \sa implicitHandleHeight
+*/
+qreal QQuickSlider::implicitHandleWidth() const
+{
+ Q_D(const QQuickSlider);
+ if (!d->handle)
+ return 0;
+ return d->handle->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::Slider::implicitHandleHeight
+ \readonly
+
+ This property holds the implicit handle height.
+
+ The value is equal to \c {handle ? handle.implicitHeight : 0}.
+
+ This is typically used, together with \l {Control::}{implicitContentHeight} and
+ \l {Control::}{implicitBackgroundHeight}, to calculate the \l {Item::}{implicitHeight}.
+
+ \sa implicitHandleWidth
+*/
+qreal QQuickSlider::implicitHandleHeight() const
+{
+ Q_D(const QQuickSlider);
+ if (!d->handle)
+ return 0;
+ return d->handle->implicitHeight();
+}
+
void QQuickSlider::keyPressEvent(QKeyEvent *event)
{
Q_D(QQuickSlider);
@@ -697,9 +811,9 @@ void QQuickSlider::touchEvent(QTouchEvent *event)
case Qt::TouchPointMoved:
if (!keepTouchGrab()) {
if (d->orientation == Qt::Horizontal)
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point, qRound(d->touchDragThreshold)));
else
- setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point));
+ setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point, qRound(d->touchDragThreshold)));
}
if (keepTouchGrab())
d->handleMove(point.pos());
diff --git a/src/quicktemplates2/qquickslider_p.h b/src/quicktemplates2/qquickslider_p.h
index ee6bcffa..c65733dc 100644
--- a/src/quicktemplates2/qquickslider_p.h
+++ b/src/quicktemplates2/qquickslider_p.h
@@ -71,10 +71,15 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSlider : public QQuickControl
// 2.3 (Qt 5.10)
Q_PROPERTY(bool horizontal READ isHorizontal NOTIFY orientationChanged FINAL REVISION 3)
Q_PROPERTY(bool vertical READ isVertical NOTIFY orientationChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal touchDragThreshold READ touchDragThreshold WRITE setTouchDragThreshold RESET resetTouchDragThreshold NOTIFY touchDragThresholdChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitHandleWidth READ implicitHandleWidth NOTIFY implicitHandleWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitHandleHeight READ implicitHandleHeight NOTIFY implicitHandleHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background,handle")
public:
explicit QQuickSlider(QQuickItem *parent = nullptr);
+ ~QQuickSlider();
qreal from() const;
void setFrom(qreal from);
@@ -121,6 +126,14 @@ public:
bool isHorizontal() const;
bool isVertical() const;
+ // 2.5 (Qt 5.12)
+ qreal touchDragThreshold() const;
+ void setTouchDragThreshold(qreal touchDragThreshold);
+ void resetTouchDragThreshold();
+
+ qreal implicitHandleWidth() const;
+ qreal implicitHandleHeight() const;
+
public Q_SLOTS:
void increase();
void decrease();
@@ -139,6 +152,10 @@ Q_SIGNALS:
// 2.2 (Qt 5.9)
Q_REVISION(2) void moved();
Q_REVISION(2) void liveChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void touchDragThresholdChanged();
+ Q_REVISION(5) void implicitHandleWidthChanged();
+ Q_REVISION(5) void implicitHandleHeightChanged();
protected:
void keyPressEvent(QKeyEvent *event) override;
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp
index f1361330..7f4f59fa 100644
--- a/src/quicktemplates2/qquickspinbox.cpp
+++ b/src/quicktemplates2/qquickspinbox.cpp
@@ -135,6 +135,9 @@ public:
void handleRelease(const QPointF &point) override;
void handleUngrab() override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
bool editable = false;
bool wrap = false;
int from = 0;
@@ -403,6 +406,24 @@ void QQuickSpinBoxPrivate::handleUngrab()
stopPressRepeat();
}
+void QQuickSpinBoxPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ QQuickControlPrivate::itemImplicitWidthChanged(item);
+ if (item == up->indicator())
+ emit up->implicitIndicatorWidthChanged();
+ else if (item == down->indicator())
+ emit down->implicitIndicatorWidthChanged();
+}
+
+void QQuickSpinBoxPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ QQuickControlPrivate::itemImplicitHeightChanged(item);
+ if (item == up->indicator())
+ emit up->implicitIndicatorHeightChanged();
+ else if (item == down->indicator())
+ emit down->implicitIndicatorHeightChanged();
+}
+
QQuickSpinBox::QQuickSpinBox(QQuickItem *parent)
: QQuickControl(*(new QQuickSpinBoxPrivate), parent)
{
@@ -418,6 +439,13 @@ QQuickSpinBox::QQuickSpinBox(QQuickItem *parent)
#endif
}
+QQuickSpinBox::~QQuickSpinBox()
+{
+ Q_D(QQuickSpinBox);
+ d->removeImplicitSizeListener(d->up->indicator());
+ d->removeImplicitSizeListener(d->down->indicator());
+}
+
/*!
\qmlproperty int QtQuick.Controls::SpinBox::from
@@ -688,9 +716,13 @@ void QQuickSpinBox::setValueFromText(const QJSValue &callback)
\qmlproperty bool QtQuick.Controls::SpinBox::up.pressed
\qmlproperty Item QtQuick.Controls::SpinBox::up.indicator
\qmlproperty bool QtQuick.Controls::SpinBox::up.hovered
+ \qmlproperty real QtQuick.Controls::SpinBox::up.implicitIndicatorWidth
+ \qmlproperty real QtQuick.Controls::SpinBox::up.implicitIndicatorHeight
These properties hold the up indicator item and whether it is pressed or
- hovered. The \c up.hovered property was introduced in QtQuick.Controls 2.1.
+ hovered. The \c up.hovered property was introduced in QtQuick.Controls 2.1,
+ and the \c up.implicitIndicatorWidth and \c up.implicitIndicatorHeight
+ properties were introduced in QtQuick.Controls 2.5.
\sa increase()
*/
@@ -705,9 +737,13 @@ QQuickSpinButton *QQuickSpinBox::up() const
\qmlproperty bool QtQuick.Controls::SpinBox::down.pressed
\qmlproperty Item QtQuick.Controls::SpinBox::down.indicator
\qmlproperty bool QtQuick.Controls::SpinBox::down.hovered
+ \qmlproperty real QtQuick.Controls::SpinBox::down.implicitIndicatorWidth
+ \qmlproperty real QtQuick.Controls::SpinBox::down.implicitIndicatorHeight
These properties hold the down indicator item and whether it is pressed or
- hovered. The \c down.hovered property was introduced in QtQuick.Controls 2.1.
+ hovered. The \c down.hovered property was introduced in QtQuick.Controls 2.1,
+ and the \c down.implicitIndicatorWidth and \c down.implicitIndicatorHeight
+ properties were introduced in QtQuick.Controls 2.5.
\sa decrease()
*/
@@ -1000,12 +1036,12 @@ void QQuickSpinBox::localeChange(const QLocale &newLocale, const QLocale &oldLoc
QFont QQuickSpinBox::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::EditorFont);
+ return QQuickTheme::font(QQuickTheme::SpinBox);
}
QPalette QQuickSpinBox::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::TextLineEditPalette);
+ return QQuickTheme::palette(QQuickTheme::SpinBox);
}
#if QT_CONFIG(accessibility)
@@ -1082,13 +1118,24 @@ void QQuickSpinButton::setIndicator(QQuickItem *indicator)
if (!d->indicator.isExecuting())
d->cancelIndicator();
+ const qreal oldImplicitIndicatorWidth = implicitIndicatorWidth();
+ const qreal oldImplicitIndicatorHeight = implicitIndicatorHeight();
+
+ QQuickSpinBox *spinBox = static_cast<QQuickSpinBox *>(parent());
+ QQuickSpinBoxPrivate::get(spinBox)->removeImplicitSizeListener(d->indicator);
delete d->indicator;
d->indicator = indicator;
if (indicator) {
if (!indicator->parentItem())
- indicator->setParentItem(static_cast<QQuickItem *>(parent()));
+ indicator->setParentItem(spinBox);
+ QQuickSpinBoxPrivate::get(spinBox)->addImplicitSizeListener(indicator);
}
+
+ if (!qFuzzyCompare(oldImplicitIndicatorWidth, implicitIndicatorWidth()))
+ emit implicitIndicatorWidthChanged();
+ if (!qFuzzyCompare(oldImplicitIndicatorHeight, implicitIndicatorHeight()))
+ emit implicitIndicatorHeightChanged();
if (!d->indicator.isExecuting())
emit indicatorChanged();
}
@@ -1109,4 +1156,20 @@ void QQuickSpinButton::setHovered(bool hovered)
emit hoveredChanged();
}
+qreal QQuickSpinButton::implicitIndicatorWidth() const
+{
+ Q_D(const QQuickSpinButton);
+ if (!d->indicator)
+ return 0;
+ return d->indicator->implicitWidth();
+}
+
+qreal QQuickSpinButton::implicitIndicatorHeight() const
+{
+ Q_D(const QQuickSpinButton);
+ if (!d->indicator)
+ return 0;
+ return d->indicator->implicitHeight();
+}
+
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickspinbox_p.h b/src/quicktemplates2/qquickspinbox_p.h
index f5370331..4a339b76 100644
--- a/src/quicktemplates2/qquickspinbox_p.h
+++ b/src/quicktemplates2/qquickspinbox_p.h
@@ -81,6 +81,7 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinBox : public QQuickControl
public:
explicit QQuickSpinBox(QQuickItem *parent = nullptr);
+ ~QQuickSpinBox();
int from() const;
void setFrom(int from);
@@ -182,6 +183,9 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickSpinButton : public QObject
Q_PROPERTY(QQuickItem *indicator READ indicator WRITE setIndicator NOTIFY indicatorChanged FINAL)
// 2.1 (Qt 5.8)
Q_PROPERTY(bool hovered READ isHovered WRITE setHovered NOTIFY hoveredChanged FINAL REVISION 1)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(qreal implicitIndicatorWidth READ implicitIndicatorWidth NOTIFY implicitIndicatorWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitIndicatorHeight READ implicitIndicatorHeight NOTIFY implicitIndicatorHeightChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "indicator")
public:
@@ -197,11 +201,18 @@ public:
bool isHovered() const;
void setHovered(bool hovered);
+ // 2.5 (Qt 5.12)
+ qreal implicitIndicatorWidth() const;
+ qreal implicitIndicatorHeight() const;
+
Q_SIGNALS:
void pressedChanged();
void indicatorChanged();
// 2.1 (Qt 5.8)
Q_REVISION(1) void hoveredChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void implicitIndicatorWidthChanged();
+ Q_REVISION(5) void implicitIndicatorHeightChanged();
private:
Q_DISABLE_COPY(QQuickSpinButton)
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
index 3d6afa9f..7cb943a3 100644
--- a/src/quicktemplates2/qquickstackview_p.cpp
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -97,14 +97,14 @@ QList<QQuickStackElement *> QQuickStackViewPrivate::parseElements(int from, QQml
for (int i = from; i < argc; ++i) {
QV4::ScopedValue arg(scope, (*args)[i]);
if (QV4::ArrayObject *array = arg->as<QV4::ArrayObject>()) {
- int len = array->getLength();
- for (int j = 0; j < len; ++j) {
+ const uint len = uint(array->getLength());
+ for (uint j = 0; j < len; ++j) {
QString error;
- QV4::ScopedValue value(scope, array->getIndexed(j));
+ QV4::ScopedValue value(scope, array->get(j));
QQuickStackElement *element = createElement(value, context, &error);
if (element) {
if (j < len - 1) {
- QV4::ScopedValue props(scope, array->getIndexed(j + 1));
+ QV4::ScopedValue props(scope, array->get(j + 1));
if (initProperties(element, props, args))
++j;
}
diff --git a/src/quicktemplates2/qquickswipedelegate.cpp b/src/quicktemplates2/qquickswipedelegate.cpp
index fab50116..97c17a6b 100644
--- a/src/quicktemplates2/qquickswipedelegate.cpp
+++ b/src/quicktemplates2/qquickswipedelegate.cpp
@@ -1201,12 +1201,19 @@ void QQuickSwipeDelegate::touchEvent(QTouchEvent *event)
event->ignore();
}
+void QQuickSwipeDelegate::componentComplete()
+{
+ Q_D(QQuickSwipeDelegate);
+ QQuickItemDelegate::componentComplete();
+ QQuickSwipePrivate::get(&d->swipe)->reposition(DontAnimatePosition);
+}
+
void QQuickSwipeDelegate::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickSwipeDelegate);
QQuickControl::geometryChanged(newGeometry, oldGeometry);
- if (!qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
+ if (isComponentComplete() && !qFuzzyCompare(newGeometry.width(), oldGeometry.width())) {
QQuickSwipePrivate *swipePrivate = QQuickSwipePrivate::get(&d->swipe);
swipePrivate->reposition(DontAnimatePosition);
}
@@ -1214,7 +1221,12 @@ void QQuickSwipeDelegate::geometryChanged(const QRectF &newGeometry, const QRect
QFont QQuickSwipeDelegate::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+ return QQuickTheme::font(QQuickTheme::ListView);
+}
+
+QPalette QQuickSwipeDelegate::defaultPalette() const
+{
+ return QQuickTheme::palette(QQuickTheme::ListView);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquickswipedelegate_p.h b/src/quicktemplates2/qquickswipedelegate_p.h
index a9900eb8..53211ccb 100644
--- a/src/quicktemplates2/qquickswipedelegate_p.h
+++ b/src/quicktemplates2/qquickswipedelegate_p.h
@@ -79,9 +79,11 @@ protected:
void mouseReleaseEvent(QMouseEvent *event) override;
void touchEvent(QTouchEvent *event) override;
+ void componentComplete() override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
QFont defaultFont() const override;
+ QPalette defaultPalette() const override;
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickswipeview.cpp b/src/quicktemplates2/qquickswipeview.cpp
index d92f96aa..e6a88b47 100644
--- a/src/quicktemplates2/qquickswipeview.cpp
+++ b/src/quicktemplates2/qquickswipeview.cpp
@@ -113,6 +113,12 @@ public:
static QQuickSwipeViewPrivate *get(QQuickSwipeView *view);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
+
bool interactive = true;
Qt::Orientation orientation = Qt::Horizontal;
};
@@ -164,11 +170,44 @@ QQuickSwipeViewPrivate *QQuickSwipeViewPrivate::get(QQuickSwipeView *view)
return view->d_func();
}
+void QQuickSwipeViewPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickSwipeView);
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
+ if (item == q->currentItem())
+ updateImplicitContentWidth();
+}
+
+void QQuickSwipeViewPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickSwipeView);
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
+ if (item == q->currentItem())
+ updateImplicitContentHeight();
+}
+
+qreal QQuickSwipeViewPrivate::getContentWidth() const
+{
+ Q_Q(const QQuickSwipeView);
+ QQuickItem *currentItem = q->currentItem();
+ return currentItem ? currentItem->implicitWidth() : 0;
+}
+
+qreal QQuickSwipeViewPrivate::getContentHeight() const
+{
+ Q_Q(const QQuickSwipeView);
+ QQuickItem *currentItem = q->currentItem();
+ return currentItem ? currentItem->implicitHeight() : 0;
+}
+
QQuickSwipeView::QQuickSwipeView(QQuickItem *parent)
: QQuickContainer(*(new QQuickSwipeViewPrivate), parent)
{
+ Q_D(QQuickSwipeView);
+ d->changeTypes |= QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight;
setFlag(ItemIsFocusScope);
setActiveFocusOnTab(true);
+ QObjectPrivate::connect(this, &QQuickContainer::currentItemChanged, d, &QQuickControlPrivate::updateImplicitContentSize);
}
/*!
diff --git a/src/quicktemplates2/qquickswitch.cpp b/src/quicktemplates2/qquickswitch.cpp
index 3c84bbc7..675cb6ae 100644
--- a/src/quicktemplates2/qquickswitch.cpp
+++ b/src/quicktemplates2/qquickswitch.cpp
@@ -229,10 +229,14 @@ void QQuickSwitch::buttonChange(ButtonChange change)
QQuickAbstractButton::buttonChange(change);
}
+QFont QQuickSwitch::defaultFont() const
+{
+ return QQuickTheme::font(QQuickTheme::Switch);
+}
+
QPalette QQuickSwitch::defaultPalette() const
{
- // ### TODO: add QPlatformTheme::SwitchPalette
- return QQuickControlPrivate::themePalette(QPlatformTheme::CheckBoxPalette);
+ return QQuickTheme::palette(QQuickTheme::Switch);
}
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquickswitch_p.h b/src/quicktemplates2/qquickswitch_p.h
index 0faaf114..ddc32395 100644
--- a/src/quicktemplates2/qquickswitch_p.h
+++ b/src/quicktemplates2/qquickswitch_p.h
@@ -83,6 +83,7 @@ protected:
void nextCheckState() override;
void buttonChange(ButtonChange change) override;
+ QFont defaultFont() const override;
QPalette defaultPalette() const override;
private:
diff --git a/src/quicktemplates2/qquickswitchdelegate.cpp b/src/quicktemplates2/qquickswitchdelegate.cpp
index 9257a5fd..3a849be0 100644
--- a/src/quicktemplates2/qquickswitchdelegate.cpp
+++ b/src/quicktemplates2/qquickswitchdelegate.cpp
@@ -200,7 +200,12 @@ void QQuickSwitchDelegate::touchEvent(QTouchEvent *event)
QFont QQuickSwitchDelegate::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ListViewFont);
+ return QQuickTheme::font(QQuickTheme::ListView);
+}
+
+QPalette QQuickSwitchDelegate::defaultPalette() const
+{
+ return QQuickTheme::palette(QQuickTheme::ListView);
}
void QQuickSwitchDelegate::mirrorChange()
diff --git a/src/quicktemplates2/qquickswitchdelegate_p.h b/src/quicktemplates2/qquickswitchdelegate_p.h
index 973ec21d..1fb35aea 100644
--- a/src/quicktemplates2/qquickswitchdelegate_p.h
+++ b/src/quicktemplates2/qquickswitchdelegate_p.h
@@ -79,6 +79,8 @@ protected:
#endif
QFont defaultFont() const override;
+ QPalette defaultPalette() const override;
+
void mirrorChange() override;
void nextCheckState() override;
diff --git a/src/quicktemplates2/qquicktabbar.cpp b/src/quicktemplates2/qquicktabbar.cpp
index 2d732152..745023c3 100644
--- a/src/quicktemplates2/qquicktabbar.cpp
+++ b/src/quicktemplates2/qquicktabbar.cpp
@@ -104,15 +104,14 @@ public:
void updateCurrentIndex();
void updateLayout();
+ qreal getContentWidth() const override;
+ qreal getContentHeight() const override;
+
void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
void itemImplicitWidthChanged(QQuickItem *item) override;
void itemImplicitHeightChanged(QQuickItem *item) override;
bool updatingLayout = false;
- bool hasContentWidth = false;
- bool hasContentHeight = false;
- qreal contentWidth = 0;
- qreal contentHeight = 0;
QQuickTabBar::Position position = QQuickTabBar::Header;
};
@@ -154,8 +153,6 @@ void QQuickTabBarPrivate::updateLayout()
if (count <= 0 || !contentItem)
return;
- qreal maxHeight = 0;
- qreal totalWidth = 0;
qreal reservedWidth = 0;
int resizableCount = 0;
@@ -166,21 +163,15 @@ void QQuickTabBarPrivate::updateLayout()
QQuickItem *item = q->itemAt(i);
if (item) {
QQuickItemPrivate *p = QQuickItemPrivate::get(item);
- if (!p->widthValid) {
+ if (!p->widthValid)
++resizableCount;
- totalWidth += item->implicitWidth();
- } else {
+ else
reservedWidth += item->width();
- totalWidth += item->width();
- }
- maxHeight = qMax(maxHeight, item->implicitHeight());
allItems += item;
}
}
const qreal totalSpacing = qMax(0, count - 1) * spacing;
- totalWidth += totalSpacing;
-
const qreal itemWidth = (contentItem->width() - reservedWidth - totalSpacing) / qMax(1, resizableCount);
updatingLayout = true;
@@ -191,48 +182,68 @@ void QQuickTabBarPrivate::updateLayout()
p->widthValid = false;
}
if (!p->heightValid) {
- item->setHeight(hasContentHeight ? contentHeight : maxHeight);
+ item->setHeight(contentHeight);
p->heightValid = false;
} else {
- item->setY((maxHeight - item->height()) / 2);
+ item->setY((contentHeight - item->height()) / 2);
}
}
updatingLayout = false;
+}
- bool contentWidthChange = false;
- if (!hasContentWidth && !qFuzzyCompare(contentWidth, totalWidth)) {
- contentWidth = totalWidth;
- contentWidthChange = true;
+qreal QQuickTabBarPrivate::getContentWidth() const
+{
+ Q_Q(const QQuickTabBar);
+ const int count = contentModel->count();
+ qreal totalWidth = qMax(0, count - 1) * spacing;
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ if (!p->widthValid)
+ totalWidth += item->implicitWidth();
+ else
+ totalWidth += item->width();
+ }
}
+ return totalWidth;
+}
- bool contentHeightChange = false;
- if (!hasContentHeight && !qFuzzyCompare(contentHeight, maxHeight)) {
- contentHeight = maxHeight;
- contentHeightChange = true;
+qreal QQuickTabBarPrivate::getContentHeight() const
+{
+ Q_Q(const QQuickTabBar);
+ const int count = contentModel->count();
+ qreal maxHeight = 0;
+ for (int i = 0; i < count; ++i) {
+ QQuickItem *item = q->itemAt(i);
+ if (item)
+ maxHeight = qMax(maxHeight, item->implicitHeight());
}
-
- if (contentWidthChange)
- emit q->contentWidthChanged();
- if (contentHeightChange)
- emit q->contentHeightChanged();
+ return maxHeight;
}
-void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange, const QRectF &)
+void QQuickTabBarPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
{
- if (!updatingLayout)
+ QQuickContainerPrivate::itemGeometryChanged(item, change, diff);
+ if (!updatingLayout) {
+ if (change.sizeChange())
+ updateImplicitContentSize();
updateLayout();
+ }
}
-void QQuickTabBarPrivate::itemImplicitWidthChanged(QQuickItem *)
+void QQuickTabBarPrivate::itemImplicitWidthChanged(QQuickItem *item)
{
- if (!updatingLayout && !hasContentWidth)
- updateLayout();
+ QQuickContainerPrivate::itemImplicitWidthChanged(item);
+ if (item != contentItem)
+ updateImplicitContentWidth();
}
-void QQuickTabBarPrivate::itemImplicitHeightChanged(QQuickItem *)
+void QQuickTabBarPrivate::itemImplicitHeightChanged(QQuickItem *item)
{
- if (!updatingLayout && !hasContentHeight)
- updateLayout();
+ QQuickContainerPrivate::itemImplicitHeightChanged(item);
+ if (item != contentItem)
+ updateImplicitContentHeight();
}
QQuickTabBar::QQuickTabBar(QQuickItem *parent)
@@ -283,39 +294,11 @@ void QQuickTabBar::setPosition(Position position)
This property holds the content width. It is used for calculating the total
implicit width of the tab bar.
- Unless explicitly overridden, the content width is automatically calculated
- based on the total implicit width of the tabs and the \l {Control::}{spacing}
- of the tab bar.
+ \note This property is available in TabBar since QtQuick.Controls 2.2 (Qt 5.9),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentHeight
+ \sa Container::contentWidth
*/
-qreal QQuickTabBar::contentWidth() const
-{
- Q_D(const QQuickTabBar);
- return d->contentWidth;
-}
-
-void QQuickTabBar::setContentWidth(qreal width)
-{
- Q_D(QQuickTabBar);
- d->hasContentWidth = true;
- if (qFuzzyCompare(d->contentWidth, width))
- return;
-
- d->contentWidth = width;
- emit contentWidthChanged();
-}
-
-void QQuickTabBar::resetContentWidth()
-{
- Q_D(QQuickTabBar);
- if (!d->hasContentWidth)
- return;
-
- d->hasContentWidth = false;
- if (isComponentComplete())
- d->updateLayout();
-}
/*!
\since QtQuick.Controls 2.2 (Qt 5.9)
@@ -324,38 +307,11 @@ void QQuickTabBar::resetContentWidth()
This property holds the content height. It is used for calculating the total
implicit height of the tab bar.
- Unless explicitly overridden, the content height is automatically calculated
- based on the maximum implicit height of the tabs.
+ \note This property is available in TabBar since QtQuick.Controls 2.2 (Qt 5.9),
+ but it was promoted to the Container base type in QtQuick.Controls 2.5 (Qt 5.12).
- \sa contentWidth
+ \sa Container::contentHeight
*/
-qreal QQuickTabBar::contentHeight() const
-{
- Q_D(const QQuickTabBar);
- return d->contentHeight;
-}
-
-void QQuickTabBar::setContentHeight(qreal height)
-{
- Q_D(QQuickTabBar);
- d->hasContentHeight = true;
- if (qFuzzyCompare(d->contentHeight, height))
- return;
-
- d->contentHeight = height;
- emit contentHeightChanged();
-}
-
-void QQuickTabBar::resetContentHeight()
-{
- Q_D(QQuickTabBar);
- if (!d->hasContentHeight)
- return;
-
- d->hasContentHeight = false;
- if (isComponentComplete())
- d->updateLayout();
-}
QQuickTabBarAttached *QQuickTabBar::qmlAttachedProperties(QObject *object)
{
@@ -399,6 +355,7 @@ void QQuickTabBar::itemAdded(int index, QQuickItem *item)
QQuickTabBarAttached *attached = qobject_cast<QQuickTabBarAttached *>(qmlAttachedPropertiesObject<QQuickTabBar>(item));
if (attached)
QQuickTabBarAttachedPrivate::get(attached)->update(this, index);
+ d->updateImplicitContentSize();
if (isComponentComplete())
polish();
}
@@ -419,13 +376,19 @@ void QQuickTabBar::itemRemoved(int index, QQuickItem *item)
QQuickTabBarAttached *attached = qobject_cast<QQuickTabBarAttached *>(qmlAttachedPropertiesObject<QQuickTabBar>(item));
if (attached)
QQuickTabBarAttachedPrivate::get(attached)->update(nullptr, -1);
+ d->updateImplicitContentSize();
if (isComponentComplete())
polish();
}
+QFont QQuickTabBar::defaultFont() const
+{
+ return QQuickTheme::font(QQuickTheme::TabBar);
+}
+
QPalette QQuickTabBar::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::TabBarPalette);
+ return QQuickTheme::palette(QQuickTheme::TabBar);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktabbar_p.h b/src/quicktemplates2/qquicktabbar_p.h
index f0299bd5..5367118c 100644
--- a/src/quicktemplates2/qquicktabbar_p.h
+++ b/src/quicktemplates2/qquicktabbar_p.h
@@ -61,8 +61,8 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTabBar : public QQuickContainer
Q_OBJECT
Q_PROPERTY(Position position READ position WRITE setPosition NOTIFY positionChanged FINAL)
// 2.2 (Qt 5.9)
- Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 2)
- Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 2)
+ Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION 2) // re-declare QQuickContainer::contentWidth (REV 5)
+ Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION 2) // re-declare QQuickContainer::contentHeight (REV 5)
public:
explicit QQuickTabBar(QQuickItem *parent = nullptr);
@@ -76,22 +76,10 @@ public:
Position position() const;
void setPosition(Position position);
- // 2.2 (Qt 5.9)
- qreal contentWidth() const;
- void setContentWidth(qreal width);
- void resetContentWidth();
-
- qreal contentHeight() const;
- void setContentHeight(qreal height);
- void resetContentHeight();
-
static QQuickTabBarAttached *qmlAttachedProperties(QObject *object);
Q_SIGNALS:
void positionChanged();
- // 2.2 (Qt 5.9)
- Q_REVISION(2) void contentWidthChanged();
- Q_REVISION(2) void contentHeightChanged();
protected:
void updatePolish() override;
@@ -102,6 +90,7 @@ protected:
void itemMoved(int index, QQuickItem *item) override;
void itemRemoved(int index, QQuickItem *item) override;
+ QFont defaultFont() const override;
QPalette defaultPalette() const override;
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktabbutton.cpp b/src/quicktemplates2/qquicktabbutton.cpp
index 617d4aea..6e20b0da 100644
--- a/src/quicktemplates2/qquicktabbutton.cpp
+++ b/src/quicktemplates2/qquicktabbutton.cpp
@@ -72,12 +72,12 @@ QQuickTabButton::QQuickTabButton(QQuickItem *parent)
QFont QQuickTabButton::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::TabButtonFont);
+ return QQuickTheme::font(QQuickTheme::TabBar);
}
QPalette QQuickTabButton::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::TabBarPalette);
+ return QQuickTheme::palette(QQuickTheme::TabBar);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp
index db6d9283..ee7d0ae3 100644
--- a/src/quicktemplates2/qquicktextarea.cpp
+++ b/src/quicktemplates2/qquicktextarea.cpp
@@ -145,28 +145,76 @@ QQuickTextAreaPrivate::~QQuickTextAreaPrivate()
#endif
}
-void QQuickTextAreaPrivate::resizeBackground()
+void QQuickTextAreaPrivate::setTopInset(qreal value, bool reset)
{
Q_Q(QQuickTextArea);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- if (flickable)
- background->setWidth(flickable->width());
- else
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- if (flickable)
- background->setHeight(flickable->height());
- else
- background->setHeight(q->height());
- p->heightValid = false;
- }
+ const QMarginsF oldInset = getInset();
+ extra.value().topInset = value;
+ extra.value().hasTopInset = !reset;
+ if (!qFuzzyCompare(oldInset.top(), value)) {
+ emit q->topInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::setLeftInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextArea);
+ const QMarginsF oldInset = getInset();
+ extra.value().leftInset = value;
+ extra.value().hasLeftInset = !reset;
+ if (!qFuzzyCompare(oldInset.left(), value)) {
+ emit q->leftInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::setRightInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextArea);
+ const QMarginsF oldInset = getInset();
+ extra.value().rightInset = value;
+ extra.value().hasRightInset = !reset;
+ if (!qFuzzyCompare(oldInset.right(), value)) {
+ emit q->rightInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextAreaPrivate::setBottomInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextArea);
+ const QMarginsF oldInset = getInset();
+ extra.value().bottomInset = value;
+ extra.value().hasBottomInset = !reset;
+ if (!qFuzzyCompare(oldInset.bottom(), value)) {
+ emit q->bottomInsetChanged();
+ q->insetChange(getInset(), oldInset);
}
}
+void QQuickTextAreaPrivate::resizeBackground()
+{
+ if (!background)
+ return;
+
+ resizingBackground = true;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
+ background->setX(getLeftInset());
+ background->setWidth(width - getLeftInset() - getRightInset());
+ }
+ if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
+ background->setY(getTopInset());
+ background->setHeight(height - getTopInset() - getBottomInset());
+ }
+
+ resizingBackground = false;
+}
+
/*!
\internal
@@ -186,7 +234,7 @@ void QQuickTextAreaPrivate::inheritFont(const QFont &font)
QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
parentFont.resolve(extra.isAllocated() ? extra->requestedFont.resolve() | font.resolve() : font.resolve());
- const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::EditorFont);
+ const QFont defaultFont = QQuickTheme::font(QQuickTheme::TextArea);
const QFont resolvedFont = parentFont.resolve(defaultFont);
setFont_helper(resolvedFont);
@@ -228,7 +276,7 @@ void QQuickTextAreaPrivate::inheritPalette(const QPalette &palette)
QPalette parentPalette = extra.isAllocated() ? extra->requestedPalette.resolve(palette) : palette;
parentPalette.resolve(extra.isAllocated() ? extra->requestedPalette.resolve() | palette.resolve() : palette.resolve());
- const QPalette defaultPalette = QQuickControlPrivate::themePalette(QPlatformTheme::TextEditPalette);
+ const QPalette defaultPalette = QQuickTheme::palette(QQuickTheme::TextArea);
const QPalette resolvedPalette = parentPalette.resolve(defaultPalette);
setPalette_helper(resolvedPalette);
@@ -450,6 +498,30 @@ void QQuickTextAreaPrivate::executeBackground(bool complete)
quickCompleteDeferred(q, backgroundName(), background);
}
+void QQuickTextAreaPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickTextArea);
+ if (item == background)
+ emit q->implicitBackgroundWidthChanged();
+}
+
+void QQuickTextAreaPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickTextArea);
+ if (item == background)
+ emit q->implicitBackgroundHeightChanged();
+}
+
+void QQuickTextAreaPrivate::itemDestroyed(QQuickItem *item)
+{
+ Q_Q(QQuickTextArea);
+ if (item == background) {
+ background = nullptr;
+ emit q->implicitBackgroundWidthChanged();
+ emit q->implicitBackgroundHeightChanged();
+ }
+}
+
QQuickTextArea::QQuickTextArea(QQuickItem *parent)
: QQuickTextEdit(*(new QQuickTextAreaPrivate), parent)
{
@@ -470,6 +542,7 @@ QQuickTextArea::~QQuickTextArea()
Q_D(QQuickTextArea);
if (d->flickable)
d->detachFlickable();
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
QQuickTextAreaAttached *QQuickTextArea::qmlAttachedProperties(QObject *object)
@@ -518,8 +591,18 @@ void QQuickTextArea::setBackground(QQuickItem *background)
if (!d->background.isExecuting())
d->cancelBackground();
+ const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
+ const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
+
+ if (d->extra.isAllocated()) {
+ d->extra.value().hasBackgroundWidth = false;
+ d->extra.value().hasBackgroundHeight = false;
+ }
+
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
delete d->background;
d->background = background;
+
if (background) {
if (d->flickable)
background->setParentItem(d->flickable);
@@ -527,9 +610,20 @@ void QQuickTextArea::setBackground(QQuickItem *background)
background->setParentItem(this);
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (p->widthValid || p->heightValid) {
+ d->extra.value().hasBackgroundWidth = p->widthValid;
+ d->extra.value().hasBackgroundHeight = p->heightValid;
+ }
if (isComponentComplete())
d->resizeBackground();
+ QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
+
+ if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
+ emit implicitBackgroundWidthChanged();
+ if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
+ emit implicitBackgroundHeightChanged();
if (!d->background.isExecuting())
emit backgroundChanged();
}
@@ -561,6 +655,30 @@ void QQuickTextArea::setPlaceholderText(const QString &text)
}
/*!
+ \qmlproperty color QtQuick.Controls::TextArea::placeholderTextColor
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+
+ This property holds the color of placeholderText.
+
+ \sa placeholderText
+*/
+QColor QQuickTextArea::placeholderTextColor() const
+{
+ Q_D(const QQuickTextArea);
+ return d->placeholderColor;
+}
+
+void QQuickTextArea::setPlaceholderTextColor(const QColor &color)
+{
+ Q_D(QQuickTextArea);
+ if (d->placeholderColor == color)
+ return;
+
+ d->placeholderColor = color;
+ emit placeholderTextColorChanged();
+}
+
+/*!
\qmlproperty enumeration QtQuick.Controls::TextArea::focusReason
\include qquickcontrol-focusreason.qdocinc
@@ -697,6 +815,148 @@ void QQuickTextArea::resetPalette()
setPalette(QPalette());
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::implicitBackgroundWidth
+ \readonly
+
+ This property holds the implicit background width.
+
+ The value is equal to \c {background ? background.implicitWidth : 0}.
+
+ \sa implicitBackgroundHeight
+*/
+qreal QQuickTextArea::implicitBackgroundWidth() const
+{
+ Q_D(const QQuickTextArea);
+ if (!d->background)
+ return 0;
+ return d->background->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::implicitBackgroundHeight
+ \readonly
+
+ This property holds the implicit background height.
+
+ The value is equal to \c {background ? background.implicitHeight : 0}.
+
+ \sa implicitBackgroundWidth
+*/
+qreal QQuickTextArea::implicitBackgroundHeight() const
+{
+ Q_D(const QQuickTextArea);
+ if (!d->background)
+ return 0;
+ return d->background->implicitHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::topInset
+
+ This property holds the top inset for the background.
+
+ \sa {Control Layout}, bottomInset
+*/
+qreal QQuickTextArea::topInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getTopInset();
+}
+
+void QQuickTextArea::setTopInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setTopInset(inset);
+}
+
+void QQuickTextArea::resetTopInset()
+{
+ Q_D(QQuickTextArea);
+ d->setTopInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::leftInset
+
+ This property holds the left inset for the background.
+
+ \sa {Control Layout}, rightInset
+*/
+qreal QQuickTextArea::leftInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getLeftInset();
+}
+
+void QQuickTextArea::setLeftInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setLeftInset(inset);
+}
+
+void QQuickTextArea::resetLeftInset()
+{
+ Q_D(QQuickTextArea);
+ d->setLeftInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::rightInset
+
+ This property holds the right inset for the background.
+
+ \sa {Control Layout}, leftInset
+*/
+qreal QQuickTextArea::rightInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getRightInset();
+}
+
+void QQuickTextArea::setRightInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setRightInset(inset);
+}
+
+void QQuickTextArea::resetRightInset()
+{
+ Q_D(QQuickTextArea);
+ d->setRightInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextArea::bottomInset
+
+ This property holds the bottom inset for the background.
+
+ \sa {Control Layout}, topInset
+*/
+qreal QQuickTextArea::bottomInset() const
+{
+ Q_D(const QQuickTextArea);
+ return d->getBottomInset();
+}
+
+void QQuickTextArea::setBottomInset(qreal inset)
+{
+ Q_D(QQuickTextArea);
+ d->setBottomInset(inset);
+}
+
+void QQuickTextArea::resetBottomInset()
+{
+ Q_D(QQuickTextArea);
+ d->setBottomInset(0, true);
+}
+
void QQuickTextArea::classBegin()
{
Q_D(QQuickTextArea);
@@ -760,6 +1020,14 @@ void QQuickTextArea::geometryChanged(const QRectF &newGeometry, const QRectF &ol
d->resizeBackground();
}
+void QQuickTextArea::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
+{
+ Q_D(QQuickTextArea);
+ Q_UNUSED(newInset);
+ Q_UNUSED(oldInset);
+ d->resizeBackground();
+}
+
QSGNode *QQuickTextArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
Q_D(QQuickTextArea);
diff --git a/src/quicktemplates2/qquicktextarea_p.h b/src/quicktemplates2/qquicktextarea_p.h
index 5482ceae..3c38dabf 100644
--- a/src/quicktemplates2/qquicktextarea_p.h
+++ b/src/quicktemplates2/qquicktextarea_p.h
@@ -73,6 +73,14 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextArea : public QQuickTextEdit
Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1)
// 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(QColor placeholderTextColor READ placeholderTextColor WRITE setPlaceholderTextColor NOTIFY placeholderTextColorChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background")
public:
@@ -108,6 +116,29 @@ public:
void setPalette(const QPalette &palette);
void resetPalette();
+ // 2.5 (Qt 5.12)
+ QColor placeholderTextColor() const;
+ void setPlaceholderTextColor(const QColor &color);
+
+ qreal implicitBackgroundWidth() const;
+ qreal implicitBackgroundHeight() const;
+
+ qreal topInset() const;
+ void setTopInset(qreal inset);
+ void resetTopInset();
+
+ qreal leftInset() const;
+ void setLeftInset(qreal inset);
+ void resetLeftInset();
+
+ qreal rightInset() const;
+ void setRightInset(qreal inset);
+ void resetRightInset();
+
+ qreal bottomInset() const;
+ void setBottomInset(qreal inset);
+ void resetBottomInset();
+
Q_SIGNALS:
void fontChanged();
void implicitWidthChanged3();
@@ -123,6 +154,14 @@ Q_SIGNALS:
Q_REVISION(1) void hoverEnabledChanged();
// 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void placeholderTextColorChanged();
+ Q_REVISION(5) void implicitBackgroundWidthChanged();
+ Q_REVISION(5) void implicitBackgroundHeightChanged();
+ Q_REVISION(5) void topInsetChanged();
+ Q_REVISION(5) void leftInsetChanged();
+ Q_REVISION(5) void rightInsetChanged();
+ Q_REVISION(5) void bottomInsetChanged();
protected:
void classBegin() override;
@@ -130,6 +169,8 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
+
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
void focusInEvent(QFocusEvent *event) override;
diff --git a/src/quicktemplates2/qquicktextarea_p_p.h b/src/quicktemplates2/qquicktextarea_p_p.h
index 9120c61c..613551e4 100644
--- a/src/quicktemplates2/qquicktextarea_p_p.h
+++ b/src/quicktemplates2/qquicktextarea_p_p.h
@@ -80,6 +80,17 @@ public:
return static_cast<QQuickTextAreaPrivate *>(QObjectPrivate::get(item));
}
+ inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
+ inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
+ inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
+ inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
+ inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
+
+ void setTopInset(qreal value, bool reset = false);
+ void setLeftInset(qreal value, bool reset = false);
+ void setRightInset(qreal value, bool reset = false);
+ void setBottomInset(qreal value, bool reset = false);
+
void resizeBackground();
void resolveFont();
@@ -128,20 +139,36 @@ public:
void cancelBackground();
void executeBackground(bool complete = false);
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemDestroyed(QQuickItem *item) override;
+
#if QT_CONFIG(quicktemplates2_hover)
bool hovered = false;
bool explicitHoverEnabled = false;
#endif
struct ExtraData {
+ bool hasTopInset = false;
+ bool hasLeftInset = false;
+ bool hasRightInset = false;
+ bool hasBottomInset = false;
+ bool hasBackgroundWidth = false;
+ bool hasBackgroundHeight = false;
+ qreal topInset = 0;
+ qreal leftInset = 0;
+ qreal rightInset = 0;
+ qreal bottomInset = 0;
QFont requestedFont;
QPalette requestedPalette;
};
QLazilyAllocated<ExtraData> extra;
+ bool resizingBackground = false;
QPalette resolvedPalette;
QQuickDeferredPointer<QQuickItem> background;
QString placeholder;
+ QColor placeholderColor;
Qt::FocusReason focusReason = Qt::OtherFocusReason;
QQuickPressHandler pressHandler;
QQuickFlickable *flickable = nullptr;
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp
index e7c66f84..15acfeb6 100644
--- a/src/quicktemplates2/qquicktextfield.cpp
+++ b/src/quicktemplates2/qquicktextfield.cpp
@@ -126,22 +126,76 @@ QQuickTextFieldPrivate::~QQuickTextFieldPrivate()
#endif
}
-void QQuickTextFieldPrivate::resizeBackground()
+void QQuickTextFieldPrivate::setTopInset(qreal value, bool reset)
{
Q_Q(QQuickTextField);
- if (background) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(background);
- if (!p->widthValid && qFuzzyIsNull(background->x())) {
- background->setWidth(q->width());
- p->widthValid = false;
- }
- if (!p->heightValid && qFuzzyIsNull(background->y())) {
- background->setHeight(q->height());
- p->heightValid = false;
- }
+ const QMarginsF oldInset = getInset();
+ extra.value().topInset = value;
+ extra.value().hasTopInset = !reset;
+ if (!qFuzzyCompare(oldInset.top(), value)) {
+ emit q->topInsetChanged();
+ q->insetChange(getInset(), oldInset);
}
}
+void QQuickTextFieldPrivate::setLeftInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextField);
+ const QMarginsF oldInset = getInset();
+ extra.value().leftInset = value;
+ extra.value().hasLeftInset = !reset;
+ if (!qFuzzyCompare(oldInset.left(), value)) {
+ emit q->leftInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextFieldPrivate::setRightInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextField);
+ const QMarginsF oldInset = getInset();
+ extra.value().rightInset = value;
+ extra.value().hasRightInset = !reset;
+ if (!qFuzzyCompare(oldInset.right(), value)) {
+ emit q->rightInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextFieldPrivate::setBottomInset(qreal value, bool reset)
+{
+ Q_Q(QQuickTextField);
+ const QMarginsF oldInset = getInset();
+ extra.value().bottomInset = value;
+ extra.value().hasBottomInset = !reset;
+ if (!qFuzzyCompare(oldInset.bottom(), value)) {
+ emit q->bottomInsetChanged();
+ q->insetChange(getInset(), oldInset);
+ }
+}
+
+void QQuickTextFieldPrivate::resizeBackground()
+{
+ if (!background)
+ return;
+
+ resizingBackground = true;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (((!p->widthValid || !extra.isAllocated() || !extra->hasBackgroundWidth) && qFuzzyIsNull(background->x()))
+ || (extra.isAllocated() && (extra->hasLeftInset || extra->hasRightInset))) {
+ background->setX(getLeftInset());
+ background->setWidth(width - getLeftInset() - getRightInset());
+ }
+ if (((!p->heightValid || !extra.isAllocated() || !extra->hasBackgroundHeight) && qFuzzyIsNull(background->y()))
+ || (extra.isAllocated() && (extra->hasTopInset || extra->hasBottomInset))) {
+ background->setY(getTopInset());
+ background->setHeight(height - getTopInset() - getBottomInset());
+ }
+
+ resizingBackground = false;
+}
+
/*!
\internal
@@ -161,7 +215,7 @@ void QQuickTextFieldPrivate::inheritFont(const QFont &font)
QFont parentFont = extra.isAllocated() ? extra->requestedFont.resolve(font) : font;
parentFont.resolve(extra.isAllocated() ? extra->requestedFont.resolve() | font.resolve() : font.resolve());
- const QFont defaultFont = QQuickControlPrivate::themeFont(QPlatformTheme::EditorFont);
+ const QFont defaultFont = QQuickTheme::font(QQuickTheme::TextField);
const QFont resolvedFont = parentFont.resolve(defaultFont);
setFont_helper(resolvedFont);
@@ -203,7 +257,7 @@ void QQuickTextFieldPrivate::inheritPalette(const QPalette &palette)
QPalette parentPalette = extra.isAllocated() ? extra->requestedPalette.resolve(palette) : palette;
parentPalette.resolve(extra.isAllocated() ? extra->requestedPalette.resolve() | palette.resolve() : palette.resolve());
- const QPalette defaultPalette = QQuickControlPrivate::themePalette(QPlatformTheme::TextLineEditPalette);
+ const QPalette defaultPalette = QQuickTheme::palette(QQuickTheme::TextField);
const QPalette resolvedPalette = parentPalette.resolve(defaultPalette);
setPalette_helper(resolvedPalette);
@@ -325,6 +379,42 @@ void QQuickTextFieldPrivate::executeBackground(bool complete)
quickCompleteDeferred(q, backgroundName(), background);
}
+void QQuickTextFieldPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
+{
+ Q_UNUSED(diff);
+ if (resizingBackground || item != background || !change.sizeChange())
+ return;
+
+ QQuickItemPrivate *p = QQuickItemPrivate::get(item);
+ extra.value().hasBackgroundWidth = p->widthValid;
+ extra.value().hasBackgroundHeight = p->heightValid;
+ resizeBackground();
+}
+
+void QQuickTextFieldPrivate::itemImplicitWidthChanged(QQuickItem *item)
+{
+ Q_Q(QQuickTextField);
+ if (item == background)
+ emit q->implicitBackgroundWidthChanged();
+}
+
+void QQuickTextFieldPrivate::itemImplicitHeightChanged(QQuickItem *item)
+{
+ Q_Q(QQuickTextField);
+ if (item == background)
+ emit q->implicitBackgroundHeightChanged();
+}
+
+void QQuickTextFieldPrivate::itemDestroyed(QQuickItem *item)
+{
+ Q_Q(QQuickTextField);
+ if (item == background) {
+ background = nullptr;
+ emit q->implicitBackgroundWidthChanged();
+ emit q->implicitBackgroundHeightChanged();
+ }
+}
+
QQuickTextField::QQuickTextField(QQuickItem *parent)
: QQuickTextInput(*(new QQuickTextFieldPrivate), parent)
{
@@ -340,6 +430,12 @@ QQuickTextField::QQuickTextField(QQuickItem *parent)
QObjectPrivate::connect(this, &QQuickTextInput::echoModeChanged, d, &QQuickTextFieldPrivate::echoModeChanged);
}
+QQuickTextField::~QQuickTextField()
+{
+ Q_D(QQuickTextField);
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
+}
+
QFont QQuickTextField::font() const
{
return QQuickTextInput::font();
@@ -381,15 +477,36 @@ void QQuickTextField::setBackground(QQuickItem *background)
if (!d->background.isExecuting())
d->cancelBackground();
+ const qreal oldImplicitBackgroundWidth = implicitBackgroundWidth();
+ const qreal oldImplicitBackgroundHeight = implicitBackgroundHeight();
+
+ if (d->extra.isAllocated()) {
+ d->extra.value().hasBackgroundWidth = false;
+ d->extra.value().hasBackgroundHeight = false;
+ }
+
+ QQuickControlPrivate::removeImplicitSizeListener(d->background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
delete d->background;
d->background = background;
+
if (background) {
background->setParentItem(this);
if (qFuzzyIsNull(background->z()))
background->setZ(-1);
+ QQuickItemPrivate *p = QQuickItemPrivate::get(background);
+ if (p->widthValid || p->heightValid) {
+ d->extra.value().hasBackgroundWidth = p->widthValid;
+ d->extra.value().hasBackgroundHeight = p->heightValid;
+ }
if (isComponentComplete())
d->resizeBackground();
+ QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry);
}
+
+ if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth()))
+ emit implicitBackgroundWidthChanged();
+ if (!qFuzzyCompare(oldImplicitBackgroundHeight, implicitBackgroundHeight()))
+ emit implicitBackgroundHeightChanged();
if (!d->background.isExecuting())
emit backgroundChanged();
}
@@ -421,6 +538,30 @@ void QQuickTextField::setPlaceholderText(const QString &text)
}
/*!
+ \qmlproperty color QtQuick.Controls::TextField::placeholderTextColor
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+
+ This property holds the color of placeholderText.
+
+ \sa placeholderText
+*/
+QColor QQuickTextField::placeholderTextColor() const
+{
+ Q_D(const QQuickTextField);
+ return d->placeholderColor;
+}
+
+void QQuickTextField::setPlaceholderTextColor(const QColor &color)
+{
+ Q_D(QQuickTextField);
+ if (d->placeholderColor == color)
+ return;
+
+ d->placeholderColor = color;
+ emit placeholderTextColorChanged();
+}
+
+/*!
\qmlproperty enumeration QtQuick.Controls::TextField::focusReason
\include qquickcontrol-focusreason.qdocinc
@@ -557,6 +698,148 @@ void QQuickTextField::classBegin()
d->resolvePalette();
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextField::implicitBackgroundWidth
+ \readonly
+
+ This property holds the implicit background width.
+
+ The value is equal to \c {background ? background.implicitWidth : 0}.
+
+ \sa implicitBackgroundHeight
+*/
+qreal QQuickTextField::implicitBackgroundWidth() const
+{
+ Q_D(const QQuickTextField);
+ if (!d->background)
+ return 0;
+ return d->background->implicitWidth();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextField::implicitBackgroundHeight
+ \readonly
+
+ This property holds the implicit background height.
+
+ The value is equal to \c {background ? background.implicitHeight : 0}.
+
+ \sa implicitBackgroundWidth
+*/
+qreal QQuickTextField::implicitBackgroundHeight() const
+{
+ Q_D(const QQuickTextField);
+ if (!d->background)
+ return 0;
+ return d->background->implicitHeight();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextField::topInset
+
+ This property holds the top inset for the background.
+
+ \sa {Control Layout}, bottomInset
+*/
+qreal QQuickTextField::topInset() const
+{
+ Q_D(const QQuickTextField);
+ return d->getTopInset();
+}
+
+void QQuickTextField::setTopInset(qreal inset)
+{
+ Q_D(QQuickTextField);
+ d->setTopInset(inset);
+}
+
+void QQuickTextField::resetTopInset()
+{
+ Q_D(QQuickTextField);
+ d->setTopInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextField::leftInset
+
+ This property holds the left inset for the background.
+
+ \sa {Control Layout}, rightInset
+*/
+qreal QQuickTextField::leftInset() const
+{
+ Q_D(const QQuickTextField);
+ return d->getLeftInset();
+}
+
+void QQuickTextField::setLeftInset(qreal inset)
+{
+ Q_D(QQuickTextField);
+ d->setLeftInset(inset);
+}
+
+void QQuickTextField::resetLeftInset()
+{
+ Q_D(QQuickTextField);
+ d->setLeftInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextField::rightInset
+
+ This property holds the right inset for the background.
+
+ \sa {Control Layout}, leftInset
+*/
+qreal QQuickTextField::rightInset() const
+{
+ Q_D(const QQuickTextField);
+ return d->getRightInset();
+}
+
+void QQuickTextField::setRightInset(qreal inset)
+{
+ Q_D(QQuickTextField);
+ d->setRightInset(inset);
+}
+
+void QQuickTextField::resetRightInset()
+{
+ Q_D(QQuickTextField);
+ d->setRightInset(0, true);
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlproperty real QtQuick.Controls::TextField::bottomInset
+
+ This property holds the bottom inset for the background.
+
+ \sa {Control Layout}, topInset
+*/
+qreal QQuickTextField::bottomInset() const
+{
+ Q_D(const QQuickTextField);
+ return d->getBottomInset();
+}
+
+void QQuickTextField::setBottomInset(qreal inset)
+{
+ Q_D(QQuickTextField);
+ d->setBottomInset(inset);
+}
+
+void QQuickTextField::resetBottomInset()
+{
+ Q_D(QQuickTextField);
+ d->setBottomInset(0, true);
+}
+
void QQuickTextField::componentComplete()
{
Q_D(QQuickTextField);
@@ -604,6 +887,13 @@ void QQuickTextField::geometryChanged(const QRectF &newGeometry, const QRectF &o
d->resizeBackground();
}
+void QQuickTextField::insetChange(const QMarginsF &newInset, const QMarginsF &oldInset)
+{
+ Q_D(QQuickTextField);
+ Q_UNUSED(newInset);
+ Q_UNUSED(oldInset);
+ d->resizeBackground();
+}
QSGNode *QQuickTextField::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
QQuickDefaultClipNode *clipNode = static_cast<QQuickDefaultClipNode *>(oldNode);
diff --git a/src/quicktemplates2/qquicktextfield_p.h b/src/quicktemplates2/qquicktextfield_p.h
index 4757bd2d..d0d25d70 100644
--- a/src/quicktemplates2/qquicktextfield_p.h
+++ b/src/quicktemplates2/qquicktextfield_p.h
@@ -72,10 +72,19 @@ class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTextField : public QQuickTextInput
Q_PROPERTY(bool hoverEnabled READ isHoverEnabled WRITE setHoverEnabled RESET resetHoverEnabled NOTIFY hoverEnabledChanged FINAL REVISION 1)
// 2.3 (Qt 5.10)
Q_PROPERTY(QPalette palette READ palette WRITE setPalette RESET resetPalette NOTIFY paletteChanged FINAL REVISION 3)
+ // 2.5 (Qt 5.12)
+ Q_PROPERTY(QColor placeholderTextColor READ placeholderTextColor WRITE setPlaceholderTextColor NOTIFY placeholderTextColorChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundWidth READ implicitBackgroundWidth NOTIFY implicitBackgroundWidthChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal implicitBackgroundHeight READ implicitBackgroundHeight NOTIFY implicitBackgroundHeightChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal topInset READ topInset WRITE setTopInset RESET resetTopInset NOTIFY topInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal leftInset READ leftInset WRITE setLeftInset RESET resetLeftInset NOTIFY leftInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal rightInset READ rightInset WRITE setRightInset RESET resetRightInset NOTIFY rightInsetChanged FINAL REVISION 5)
+ Q_PROPERTY(qreal bottomInset READ bottomInset WRITE setBottomInset RESET resetBottomInset NOTIFY bottomInsetChanged FINAL REVISION 5)
Q_CLASSINFO("DeferredPropertyNames", "background")
public:
explicit QQuickTextField(QQuickItem *parent = nullptr);
+ ~QQuickTextField();
QFont font() const;
void setFont(const QFont &font);
@@ -102,6 +111,29 @@ public:
void setPalette(const QPalette &palette);
void resetPalette();
+ // 2.5 (Qt 5.12)
+ QColor placeholderTextColor() const;
+ void setPlaceholderTextColor(const QColor &color);
+
+ qreal implicitBackgroundWidth() const;
+ qreal implicitBackgroundHeight() const;
+
+ qreal topInset() const;
+ void setTopInset(qreal inset);
+ void resetTopInset();
+
+ qreal leftInset() const;
+ void setLeftInset(qreal inset);
+ void resetLeftInset();
+
+ qreal rightInset() const;
+ void setRightInset(qreal inset);
+ void resetRightInset();
+
+ qreal bottomInset() const;
+ void setBottomInset(qreal inset);
+ void resetBottomInset();
+
Q_SIGNALS:
void fontChanged();
void implicitWidthChanged3();
@@ -117,6 +149,14 @@ Q_SIGNALS:
Q_REVISION(1) void hoverEnabledChanged();
// 2.3 (Qt 5.10)
Q_REVISION(3) void paletteChanged();
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) void placeholderTextColorChanged();
+ Q_REVISION(5) void implicitBackgroundWidthChanged();
+ Q_REVISION(5) void implicitBackgroundHeightChanged();
+ Q_REVISION(5) void topInsetChanged();
+ Q_REVISION(5) void leftInsetChanged();
+ Q_REVISION(5) void rightInsetChanged();
+ Q_REVISION(5) void bottomInsetChanged();
protected:
void classBegin() override;
@@ -124,6 +164,8 @@ protected:
void itemChange(ItemChange change, const ItemChangeData &value) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
+ virtual void insetChange(const QMarginsF &newInset, const QMarginsF &oldInset);
+
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data) override;
void focusInEvent(QFocusEvent *event) override;
diff --git a/src/quicktemplates2/qquicktextfield_p_p.h b/src/quicktemplates2/qquicktextfield_p_p.h
index e863a92d..3389d3dc 100644
--- a/src/quicktemplates2/qquicktextfield_p_p.h
+++ b/src/quicktemplates2/qquicktextfield_p_p.h
@@ -50,6 +50,7 @@
#include <QtQml/private/qlazilyallocated_p.h>
#include <QtQuick/private/qquicktextinput_p_p.h>
+#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickTemplates2/private/qquickpresshandler_p_p.h>
#include <QtQuickTemplates2/private/qquickdeferredpointer_p_p.h>
@@ -61,7 +62,7 @@
QT_BEGIN_NAMESPACE
-class QQuickTextFieldPrivate : public QQuickTextInputPrivate
+class QQuickTextFieldPrivate : public QQuickTextInputPrivate, public QQuickItemChangeListener
#if QT_CONFIG(accessibility)
, public QAccessible::ActivationObserver
#endif
@@ -75,6 +76,17 @@ public:
static QQuickTextFieldPrivate *get(QQuickTextField *item) {
return static_cast<QQuickTextFieldPrivate *>(QObjectPrivate::get(item)); }
+ inline QMarginsF getInset() const { return QMarginsF(getLeftInset(), getTopInset(), getRightInset(), getBottomInset()); }
+ inline qreal getTopInset() const { return extra.isAllocated() ? extra->topInset : 0; }
+ inline qreal getLeftInset() const { return extra.isAllocated() ? extra->leftInset : 0; }
+ inline qreal getRightInset() const { return extra.isAllocated() ? extra->rightInset : 0; }
+ inline qreal getBottomInset() const { return extra.isAllocated() ? extra->bottomInset : 0; }
+
+ void setTopInset(qreal value, bool reset = false);
+ void setLeftInset(qreal value, bool reset = false);
+ void setRightInset(qreal value, bool reset = false);
+ void setBottomInset(qreal value, bool reset = false);
+
void resizeBackground();
void resolveFont();
@@ -116,20 +128,37 @@ public:
void cancelBackground();
void executeBackground(bool complete = false);
+ void itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) override;
+ void itemImplicitWidthChanged(QQuickItem *item) override;
+ void itemImplicitHeightChanged(QQuickItem *item) override;
+ void itemDestroyed(QQuickItem *item) override;
+
#if QT_CONFIG(quicktemplates2_hover)
bool hovered = false;
bool explicitHoverEnabled = false;
#endif
struct ExtraData {
+ bool hasTopInset = false;
+ bool hasLeftInset = false;
+ bool hasRightInset = false;
+ bool hasBottomInset = false;
+ bool hasBackgroundWidth = false;
+ bool hasBackgroundHeight = false;
+ qreal topInset = 0;
+ qreal leftInset = 0;
+ qreal rightInset = 0;
+ qreal bottomInset = 0;
QFont requestedFont;
QPalette requestedPalette;
};
QLazilyAllocated<ExtraData> extra;
+ bool resizingBackground = false;
QPalette resolvedPalette;
QQuickDeferredPointer<QQuickItem> background;
QString placeholder;
+ QColor placeholderColor;
Qt::FocusReason focusReason = Qt::OtherFocusReason;
QQuickPressHandler pressHandler;
};
diff --git a/src/quicktemplates2/qquicktheme.cpp b/src/quicktemplates2/qquicktheme.cpp
new file mode 100644
index 00000000..1ea0cef2
--- /dev/null
+++ b/src/quicktemplates2/qquicktheme.cpp
@@ -0,0 +1,166 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qquicktheme_p.h"
+#include "qquicktheme_p_p.h"
+
+#include <QtGui/qpa/qplatformtheme.h>
+#include <QtGui/private/qguiapplication_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QScopedPointer<QQuickTheme> QQuickThemePrivate::instance;
+
+static QPlatformTheme::Font platformFont(QQuickTheme::Scope scope)
+{
+ switch (scope) {
+ case QQuickTheme::Button: return QPlatformTheme::PushButtonFont;
+ case QQuickTheme::CheckBox: return QPlatformTheme::CheckBoxFont;
+ case QQuickTheme::ComboBox: return QPlatformTheme::ComboMenuItemFont;
+ case QQuickTheme::GroupBox: return QPlatformTheme::GroupBoxTitleFont;
+ case QQuickTheme::ItemView: return QPlatformTheme::ItemViewFont;
+ case QQuickTheme::Label: return QPlatformTheme::LabelFont;
+ case QQuickTheme::ListView: return QPlatformTheme::ListViewFont;
+ case QQuickTheme::Menu: return QPlatformTheme::MenuFont;
+ case QQuickTheme::MenuBar: return QPlatformTheme::MenuBarFont;
+ case QQuickTheme::RadioButton: return QPlatformTheme::RadioButtonFont;
+ case QQuickTheme::SpinBox: return QPlatformTheme::EditorFont;
+ case QQuickTheme::Switch: return QPlatformTheme::CheckBoxFont;
+ case QQuickTheme::TabBar: return QPlatformTheme::TabButtonFont;
+ case QQuickTheme::TextArea: return QPlatformTheme::EditorFont;
+ case QQuickTheme::TextField: return QPlatformTheme::EditorFont;
+ case QQuickTheme::ToolBar: return QPlatformTheme::ToolButtonFont;
+ case QQuickTheme::ToolTip: return QPlatformTheme::TipLabelFont;
+ case QQuickTheme::Tumbler: return QPlatformTheme::ItemViewFont;
+ default: return QPlatformTheme::SystemFont;
+ }
+}
+
+static QPlatformTheme::Palette platformPalette(QQuickTheme::Scope scope)
+{
+ switch (scope) {
+ case QQuickTheme::Button: return QPlatformTheme::ButtonPalette;
+ case QQuickTheme::CheckBox: return QPlatformTheme::CheckBoxPalette;
+ case QQuickTheme::ComboBox: return QPlatformTheme::ComboBoxPalette;
+ case QQuickTheme::GroupBox: return QPlatformTheme::GroupBoxPalette;
+ case QQuickTheme::ItemView: return QPlatformTheme::ItemViewPalette;
+ case QQuickTheme::Label: return QPlatformTheme::LabelPalette;
+ case QQuickTheme::ListView: return QPlatformTheme::ItemViewPalette;
+ case QQuickTheme::Menu: return QPlatformTheme::MenuPalette;
+ case QQuickTheme::MenuBar: return QPlatformTheme::MenuBarPalette;
+ case QQuickTheme::RadioButton: return QPlatformTheme::RadioButtonPalette;
+ case QQuickTheme::SpinBox: return QPlatformTheme::TextLineEditPalette;
+ case QQuickTheme::Switch: return QPlatformTheme::CheckBoxPalette;
+ case QQuickTheme::TabBar: return QPlatformTheme::TabBarPalette;
+ case QQuickTheme::TextArea: return QPlatformTheme::TextEditPalette;
+ case QQuickTheme::TextField: return QPlatformTheme::TextLineEditPalette;
+ case QQuickTheme::ToolBar: return QPlatformTheme::ToolButtonPalette;
+ case QQuickTheme::ToolTip: return QPlatformTheme::ToolTipPalette;
+ case QQuickTheme::Tumbler: return QPlatformTheme::ItemViewPalette;
+ default: return QPlatformTheme::SystemPalette;
+ }
+}
+
+QQuickTheme::QQuickTheme()
+ : d_ptr(new QQuickThemePrivate)
+{
+ d_ptr->q_ptr = this;
+}
+
+QQuickTheme::~QQuickTheme()
+{
+}
+
+QQuickTheme *QQuickTheme::instance()
+{
+ return QQuickThemePrivate::instance.data();
+}
+
+QFont QQuickTheme::font(Scope scope)
+{
+ const QFont *font = nullptr;
+ if (QQuickTheme *theme = instance())
+ font = QQuickThemePrivate::get(theme)->fonts[scope].data();
+ else if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ font = theme->font(platformFont(scope));
+
+ if (font) {
+ QFont f = *font;
+ if (scope == System)
+ f.resolve(0);
+ return f;
+ }
+
+ if (scope != System)
+ return QQuickTheme::font(System);
+
+ return QFont();
+}
+
+QPalette QQuickTheme::palette(Scope scope)
+{
+ const QPalette *palette = nullptr;
+ if (QQuickTheme *theme = instance())
+ palette = QQuickThemePrivate::get(theme)->palettes[scope].data();
+ else if (QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
+ palette = theme->palette(platformPalette(scope));
+
+ if (palette) {
+ QPalette f = *palette;
+ if (scope == System)
+ f.resolve(0);
+ return f;
+ }
+
+ if (scope != System)
+ return QQuickTheme::palette(System);
+
+ return QPalette();
+}
+
+void QQuickTheme::setFont(Scope scope, const QFont &font)
+{
+ Q_D(QQuickTheme);
+ d->fonts[scope] = QSharedPointer<QFont>::create(d->defaultFont ? d->defaultFont->resolve(font) : font);
+}
+
+void QQuickTheme::setPalette(Scope scope, const QPalette &palette)
+{
+ Q_D(QQuickTheme);
+ d->palettes[scope] = QSharedPointer<QPalette>::create(d->defaultPalette ? d->defaultPalette->resolve(palette) : palette);
+}
+
+QT_END_NAMESPACE
diff --git a/src/quickcontrols2/qquickproxytheme_p.h b/src/quicktemplates2/qquicktheme_p.h
index 879f03db..d51cc5b6 100644
--- a/src/quickcontrols2/qquickproxytheme_p.h
+++ b/src/quicktemplates2/qquicktheme_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKPROXYTHEME_P_H
-#define QQUICKPROXYTHEME_P_H
+#ifndef QQUICKTHEME_P_H
+#define QQUICKTHEME_P_H
//
// W A R N I N G
@@ -48,52 +48,57 @@
// We mean it.
//
-#include <QtGui/qpa/qplatformtheme.h>
-#include <QtQuickControls2/private/qtquickcontrols2global_p.h>
+#include <QtQuickTemplates2/private/qtquicktemplates2global_p.h>
+#include <QtCore/qscopedpointer.h>
+#include <QtGui/qfont.h>
+#include <QtGui/qpalette.h>
QT_BEGIN_NAMESPACE
-class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickProxyTheme : public QPlatformTheme
+class QQuickThemePrivate;
+
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTheme
{
public:
- explicit QQuickProxyTheme(QPlatformTheme *theme = nullptr);
- ~QQuickProxyTheme();
-
- QPlatformTheme* theme() const;
-
- QPlatformMenuItem* createPlatformMenuItem() const override;
- QPlatformMenu* createPlatformMenu() const override;
- QPlatformMenuBar* createPlatformMenuBar() const override;
- void showPlatformMenuBar() override;
-
- bool usePlatformNativeDialog(DialogType type) const override;
- QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const override;
-
-#ifndef QT_NO_SYSTEMTRAYICON
- QPlatformSystemTrayIcon *createPlatformSystemTrayIcon() const override;
-#endif
-
- const QPalette *palette(Palette type = SystemPalette) const override;
-
- const QFont *font(Font type = SystemFont) const override;
-
- QVariant themeHint(ThemeHint hint) const override;
-
- QPixmap standardPixmap(StandardPixmap sp, const QSizeF &size) const override;
- QIcon fileIcon(const QFileInfo &fileInfo, QPlatformTheme::IconOptions iconOptions = 0) const override;
-
- QIconEngine *createIconEngine(const QString &iconName) const override;
-
-#if QT_CONFIG(shortcut)
- QList<QKeySequence> keyBindings(QKeySequence::StandardKey key) const override;
-#endif
-
- QString standardButtonText(int button) const override;
+ QQuickTheme();
+ ~QQuickTheme();
+
+ static QQuickTheme *instance();
+
+ enum Scope {
+ System,
+ Button,
+ CheckBox,
+ ComboBox,
+ GroupBox,
+ ItemView,
+ Label,
+ ListView,
+ Menu,
+ MenuBar,
+ RadioButton,
+ SpinBox,
+ Switch,
+ TabBar,
+ TextArea,
+ TextField,
+ ToolBar,
+ ToolTip,
+ Tumbler
+ };
+
+ static QFont font(Scope scope);
+ static QPalette palette(Scope scope);
+
+ void setFont(Scope scope, const QFont &font);
+ void setPalette(Scope scope, const QPalette &palette);
private:
- QPlatformTheme *m_theme = nullptr;
+ Q_DISABLE_COPY(QQuickTheme)
+ Q_DECLARE_PRIVATE(QQuickTheme)
+ QScopedPointer<QQuickThemePrivate> d_ptr;
};
QT_END_NAMESPACE
-#endif // QQUICKPROXYTHEME_P_H
+#endif // QQUICKTHEME_P_H
diff --git a/src/quickcontrols2/qquicktheme_p.h b/src/quicktemplates2/qquicktheme_p_p.h
index 098ac7f1..c7421677 100644
--- a/src/quickcontrols2/qquicktheme_p.h
+++ b/src/quicktemplates2/qquicktheme_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
-** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
+** This file is part of the Qt Quick Templates 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -34,8 +34,8 @@
**
****************************************************************************/
-#ifndef QQUICKTHEME_P_H
-#define QQUICKTHEME_P_H
+#ifndef QQUICKTHEME_P_P_H
+#define QQUICKTHEME_P_P_H
//
// W A R N I N G
@@ -48,30 +48,31 @@
// We mean it.
//
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
-#include <QtCore/qscopedpointer.h>
-#include <QtGui/qfont.h>
-#include <QtGui/qpalette.h>
+#include <QtQuickTemplates2/private/qquicktheme_p.h>
QT_BEGIN_NAMESPACE
-class Q_QUICKCONTROLS2_PRIVATE_EXPORT QQuickTheme : public QQuickProxyTheme
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickThemePrivate
{
+ Q_DECLARE_PUBLIC(QQuickTheme)
+
public:
- QQuickTheme(const QString &name);
+ static QQuickThemePrivate *get(QQuickTheme *theme)
+ {
+ return theme->d_func();
+ }
- const QFont *font(Font type = SystemFont) const override;
- const QPalette *palette(Palette type = SystemPalette) const override;
+ static QScopedPointer<QQuickTheme> instance;
-protected:
- QFont resolveFont(const QFont &font) const;
- QPalette resolvePalette(const QPalette &palette) const;
+ static const int NScopes = QQuickTheme::Tumbler + 1;
-private:
- QScopedPointer<QFont> m_styleFont;
- QScopedPointer<QPalette> m_stylePalette;
+ QScopedPointer<const QFont> defaultFont;
+ QScopedPointer<const QPalette> defaultPalette;
+ QSharedPointer<QFont> fonts[NScopes];
+ QSharedPointer<QPalette> palettes[NScopes];
+ QQuickTheme *q_ptr = nullptr;
};
QT_END_NAMESPACE
-#endif // QQUICKTHEME_P_H
+#endif // QQUICKTHEME_P_P_H
diff --git a/src/quicktemplates2/qquicktoolbar.cpp b/src/quicktemplates2/qquicktoolbar.cpp
index a2f129fa..0abf0364 100644
--- a/src/quicktemplates2/qquicktoolbar.cpp
+++ b/src/quicktemplates2/qquicktoolbar.cpp
@@ -139,9 +139,14 @@ void QQuickToolBar::setPosition(Position position)
emit positionChanged();
}
+QFont QQuickToolBar::defaultFont() const
+{
+ return QQuickTheme::font(QQuickTheme::ToolBar);
+}
+
QPalette QQuickToolBar::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ToolButtonPalette);
+ return QQuickTheme::palette(QQuickTheme::ToolBar);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktoolbar_p.h b/src/quicktemplates2/qquicktoolbar_p.h
index b919c615..ef2ceb7e 100644
--- a/src/quicktemplates2/qquicktoolbar_p.h
+++ b/src/quicktemplates2/qquicktoolbar_p.h
@@ -75,6 +75,7 @@ Q_SIGNALS:
void positionChanged();
protected:
+ QFont defaultFont() const override;
QPalette defaultPalette() const override;
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktoolbutton.cpp b/src/quicktemplates2/qquicktoolbutton.cpp
index f87a58b2..eb70fbc4 100644
--- a/src/quicktemplates2/qquicktoolbutton.cpp
+++ b/src/quicktemplates2/qquicktoolbutton.cpp
@@ -71,12 +71,12 @@ QQuickToolButton::QQuickToolButton(QQuickItem *parent)
QFont QQuickToolButton::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ToolButtonFont);
+ return QQuickTheme::font(QQuickTheme::ToolBar);
}
QPalette QQuickToolButton::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ToolButtonPalette);
+ return QQuickTheme::palette(QQuickTheme::ToolBar);
}
QT_END_NAMESPACE
diff --git a/src/quicktemplates2/qquicktoolseparator.cpp b/src/quicktemplates2/qquicktoolseparator.cpp
index a6fdfc5b..625e85e9 100644
--- a/src/quicktemplates2/qquicktoolseparator.cpp
+++ b/src/quicktemplates2/qquicktoolseparator.cpp
@@ -131,9 +131,14 @@ bool QQuickToolSeparator::isVertical() const
return d->orientation == Qt::Vertical;
}
+QFont QQuickToolSeparator::defaultFont() const
+{
+ return QQuickTheme::font(QQuickTheme::ToolBar);
+}
+
QPalette QQuickToolSeparator::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ToolButtonPalette);
+ return QQuickTheme::palette(QQuickTheme::ToolBar);
}
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktoolseparator_p.h b/src/quicktemplates2/qquicktoolseparator_p.h
index 2108cc5b..c3c14b82 100644
--- a/src/quicktemplates2/qquicktoolseparator_p.h
+++ b/src/quicktemplates2/qquicktoolseparator_p.h
@@ -74,6 +74,7 @@ Q_SIGNALS:
void orientationChanged();
protected:
+ QFont defaultFont() const override;
QPalette defaultPalette() const override;
#if QT_CONFIG(accessibility)
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 282b093d..00090f66 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -270,14 +270,39 @@ QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
return new QQuickToolTipAttached(object);
}
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlmethod void QtQuick.Controls::ToolTip::show(string text, int timeout = -1)
+
+ This method shows the tooltip with \a text and \a timeout (milliseconds).
+*/
+void QQuickToolTip::show(const QString &text, int ms)
+{
+ if (ms >= 0)
+ setTimeout(ms);
+ setText(text);
+ open();
+}
+
+/*!
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+ \qmlmethod void QtQuick.Controls::ToolTip::hide()
+
+ This method hides the tooltip.
+*/
+void QQuickToolTip::hide()
+{
+ close();
+}
+
QFont QQuickToolTip::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::TipLabelFont);
+ return QQuickTheme::font(QQuickTheme::ToolTip);
}
QPalette QQuickToolTip::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ToolTipPalette);
+ return QQuickTheme::palette(QQuickTheme::ToolTip);
}
void QQuickToolTip::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
@@ -508,10 +533,8 @@ void QQuickToolTipAttached::show(const QString &text, int ms)
tip->resetWidth();
tip->resetHeight();
tip->setParentItem(qobject_cast<QQuickItem *>(parent()));
- tip->setTimeout(ms >= 0 ? ms : d->timeout);
tip->setDelay(d->delay);
- tip->setText(text);
- tip->open();
+ tip->show(text, ms >= 0 ? ms : d->timeout);
}
/*!
diff --git a/src/quicktemplates2/qquicktooltip_p.h b/src/quicktemplates2/qquicktooltip_p.h
index 60b02502..432bdd8e 100644
--- a/src/quicktemplates2/qquicktooltip_p.h
+++ b/src/quicktemplates2/qquicktooltip_p.h
@@ -84,6 +84,10 @@ Q_SIGNALS:
void delayChanged();
void timeoutChanged();
+public Q_SLOTS:
+ Q_REVISION(5) void show(const QString &text, int ms = -1);
+ Q_REVISION(5) void hide();
+
protected:
QFont defaultFont() const override;
QPalette defaultPalette() const override;
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 4b8b0d30..25710231 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -70,7 +70,8 @@ QT_BEGIN_NAMESPACE
The API is similar to that of views like \l ListView and \l PathView; a
\l model and \l delegate can be set, and the \l count and \l currentItem
- properties provide read-only access to information about the view.
+ properties provide read-only access to information about the view. To
+ position the view at a certain index, use \l positionViewAtIndex().
Unlike views like \l PathView and \l ListView, however, there is always a
current item (when the model isn't empty). This means that when \l count is
@@ -261,8 +262,9 @@ void QQuickTumblerPrivate::itemChildRemoved(QQuickItem *, QQuickItem *)
_q_updateItemHeights();
}
-void QQuickTumblerPrivate::itemGeometryChanged(QQuickItem *, QQuickGeometryChange change, const QRectF &)
+void QQuickTumblerPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff)
{
+ QQuickControlPrivate::itemGeometryChanged(item, change, diff);
if (change.sizeChange())
calculateDisplacements();
}
@@ -336,6 +338,8 @@ int QQuickTumbler::count() const
The value of this property is \c -1 when \l count is equal to \c 0. In all
other cases, it will be greater than or equal to \c 0.
+
+ \sa currentItem, positionViewAtIndex()
*/
int QQuickTumbler::currentIndex() const
{
@@ -356,6 +360,8 @@ void QQuickTumbler::setCurrentIndex(int currentIndex)
\readonly
This property holds the item at the current index.
+
+ \sa currentIndex, positionViewAtIndex()
*/
QQuickItem *QQuickTumbler::currentItem() const
{
@@ -457,6 +463,41 @@ bool QQuickTumbler::isMoving() const
return d->view && d->view->property("moving").toBool();
}
+/*!
+ \qmlmethod void QtQuick.Controls::Tumbler::positionViewAtIndex(int index, PositionMode mode)
+ \since QtQuick.Controls 2.5 (Qt 5.12)
+
+ Positions the view so that the \a index is at the position specified by \a mode.
+
+ For example:
+
+ \code
+ positionViewAtIndex(10, Tumbler.Center)
+ \endcode
+
+ If \l wrap is true (the default), the modes available to \l {PathView}'s
+ \l {PathView::}{positionViewAtIndex()} function
+ are available, otherwise the modes available to \l {ListView}'s
+ \l {ListView::}{positionViewAtIndex()} function
+ are available.
+
+ \note There is a known limitation that using \c Tumbler.Beginning when \l
+ wrap is \c true will result in the wrong item being positioned at the top
+ of view. As a workaround, pass \c {index - 1}.
+
+ \sa currentIndex
+*/
+void QQuickTumbler::positionViewAtIndex(int index, QQuickTumbler::PositionMode mode)
+{
+ Q_D(QQuickTumbler);
+ if (!d->view) {
+ d->warnAboutIncorrectContentItem();
+ return;
+ }
+
+ QMetaObject::invokeMethod(d->view, "positionViewAtIndex", Q_ARG(int, index), Q_ARG(int, mode));
+}
+
void QQuickTumbler::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickTumbler);
@@ -555,7 +596,7 @@ void QQuickTumblerPrivate::setupViewData(QQuickItem *newControlContentItem)
return;
if (viewContentItemType == QQuickTumblerPrivate::UnsupportedContentItemType) {
- qWarning() << "Tumbler: contentItem must contain either a PathView or a ListView";
+ warnAboutIncorrectContentItem();
return;
}
@@ -582,6 +623,12 @@ void QQuickTumblerPrivate::setupViewData(QQuickItem *newControlContentItem)
calculateDisplacements();
}
+void QQuickTumblerPrivate::warnAboutIncorrectContentItem()
+{
+ Q_Q(QQuickTumbler);
+ qmlWarning(q) << "Tumbler: contentItem must contain either a PathView or a ListView";
+}
+
void QQuickTumblerPrivate::syncCurrentIndex()
{
const int actualViewIndex = view->property("currentIndex").toInt();
@@ -793,12 +840,12 @@ void QQuickTumbler::updatePolish()
QFont QQuickTumbler::defaultFont() const
{
- return QQuickControlPrivate::themeFont(QPlatformTheme::ItemViewFont);
+ return QQuickTheme::font(QQuickTheme::Tumbler);
}
QPalette QQuickTumbler::defaultPalette() const
{
- return QQuickControlPrivate::themePalette(QPlatformTheme::ItemViewPalette);
+ return QQuickTheme::palette(QQuickTheme::Tumbler);
}
void QQuickTumblerAttachedPrivate::init(QQuickItem *delegateItem)
diff --git a/src/quicktemplates2/qquicktumbler_p.h b/src/quicktemplates2/qquicktumbler_p.h
index 5d4df4a7..3f7c06db 100644
--- a/src/quicktemplates2/qquicktumbler_p.h
+++ b/src/quicktemplates2/qquicktumbler_p.h
@@ -100,6 +100,19 @@ public:
// 2.2 (Qt 5.9)
bool isMoving() const;
+ enum PositionMode {
+ Beginning,
+ Center,
+ End,
+ Visible, // ListView-only
+ Contain,
+ SnapPosition
+ };
+ Q_ENUM(PositionMode)
+
+ // 2.5 (Qt 5.12)
+ Q_REVISION(5) Q_INVOKABLE void positionViewAtIndex(int index, PositionMode mode);
+
Q_SIGNALS:
void modelChanged();
void countChanged();
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h
index 9ed0647e..75c6cd1b 100644
--- a/src/quicktemplates2/qquicktumbler_p_p.h
+++ b/src/quicktemplates2/qquicktumbler_p_p.h
@@ -48,13 +48,12 @@
// We mean it.
//
-#include <QtQuick/private/qquickitemchangelistener_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
#include <QtQuickTemplates2/private/qquicktumbler_p.h>
QT_BEGIN_NAMESPACE
-class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickControlPrivate, public QQuickItemChangeListener
+class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickTumblerPrivate : public QQuickControlPrivate
{
Q_DECLARE_PUBLIC(QQuickTumbler)
@@ -103,6 +102,7 @@ public:
void disconnectFromView();
void setupViewData(QQuickItem *newControlContentItem);
+ void warnAboutIncorrectContentItem();
void syncCurrentIndex();
void setPendingCurrentIndex(int index);
diff --git a/src/quicktemplates2/quicktemplates2.pri b/src/quicktemplates2/quicktemplates2.pri
index b2193ec0..33bc47ca 100644
--- a/src/quicktemplates2/quicktemplates2.pri
+++ b/src/quicktemplates2/quicktemplates2.pri
@@ -15,6 +15,7 @@ HEADERS += \
$$PWD/qquickcombobox_p.h \
$$PWD/qquickcontainer_p.h \
$$PWD/qquickcontainer_p_p.h \
+ $$PWD/qquickcontentitem_p.h \
$$PWD/qquickcontrol_p.h \
$$PWD/qquickcontrol_p_p.h \
$$PWD/qquickdeferredexecute_p_p.h \
@@ -47,14 +48,16 @@ HEADERS += \
$$PWD/qquickoverlay_p.h \
$$PWD/qquickoverlay_p_p.h \
$$PWD/qquickpage_p.h \
+ $$PWD/qquickpage_p_p.h \
$$PWD/qquickpageindicator_p.h \
- $$PWD/qquickpagelayout_p_p.h \
$$PWD/qquickpalette_p.h \
$$PWD/qquickpaletteprovider_p.h \
$$PWD/qquickpane_p.h \
$$PWD/qquickpane_p_p.h \
$$PWD/qquickpopup_p.h \
$$PWD/qquickpopup_p_p.h \
+ $$PWD/qquickpopupanchors_p.h \
+ $$PWD/qquickpopupanchors_p_p.h \
$$PWD/qquickpopupitem_p_p.h \
$$PWD/qquickpopuppositioner_p_p.h \
$$PWD/qquickpresshandler_p_p.h \
@@ -86,6 +89,8 @@ HEADERS += \
$$PWD/qquicktextarea_p_p.h \
$$PWD/qquicktextfield_p.h \
$$PWD/qquicktextfield_p_p.h \
+ $$PWD/qquicktheme_p.h \
+ $$PWD/qquicktheme_p_p.h \
$$PWD/qquicktoolbar_p.h \
$$PWD/qquicktoolbutton_p.h \
$$PWD/qquicktoolseparator_p.h \
@@ -104,6 +109,7 @@ SOURCES += \
$$PWD/qquickcheckdelegate.cpp \
$$PWD/qquickcombobox.cpp \
$$PWD/qquickcontainer.cpp \
+ $$PWD/qquickcontentitem.cpp \
$$PWD/qquickcontrol.cpp \
$$PWD/qquickdeferredexecute.cpp \
$$PWD/qquickdelaybutton.cpp \
@@ -124,11 +130,11 @@ SOURCES += \
$$PWD/qquickoverlay.cpp \
$$PWD/qquickpage.cpp \
$$PWD/qquickpageindicator.cpp \
- $$PWD/qquickpagelayout.cpp \
$$PWD/qquickpalette.cpp \
$$PWD/qquickpaletteprovider.cpp \
$$PWD/qquickpane.cpp \
$$PWD/qquickpopup.cpp \
+ $$PWD/qquickpopupanchors.cpp \
$$PWD/qquickpopupitem.cpp \
$$PWD/qquickpopuppositioner.cpp \
$$PWD/qquickpresshandler.cpp \
@@ -155,6 +161,7 @@ SOURCES += \
$$PWD/qquicktabbutton.cpp \
$$PWD/qquicktextarea.cpp \
$$PWD/qquicktextfield.cpp \
+ $$PWD/qquicktheme.cpp \
$$PWD/qquicktoolbar.cpp \
$$PWD/qquicktoolbutton.cpp \
$$PWD/qquicktoolseparator.cpp \
diff --git a/tests/auto/controls/data/tst_abstractbutton.qml b/tests/auto/controls/data/tst_abstractbutton.qml
index d611a45a..1ed5e45d 100644
--- a/tests/auto/controls/data/tst_abstractbutton.qml
+++ b/tests/auto/controls/data/tst_abstractbutton.qml
@@ -744,7 +744,7 @@ TestCase {
}
function test_trigger(data) {
- var control = createTemporaryObject(actionButton, testCase, {"enabled": data.button, "action.enabled": data.action})
+ var control = createTemporaryObject(actionButton, testCase, {"action.enabled": data.action, "enabled": data.button})
verify(control)
compare(control.enabled, data.button)
diff --git a/tests/auto/controls/data/tst_control.qml b/tests/auto/controls/data/tst_control.qml
index a4d06fc1..5c66bd04 100644
--- a/tests/auto/controls/data/tst_control.qml
+++ b/tests/auto/controls/data/tst_control.qml
@@ -85,11 +85,42 @@ TestCase {
var control = createTemporaryObject(component, testCase)
verify(control)
+ var paddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "paddingChanged"})
+ verify(paddingSpy.valid)
+
+ var topPaddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "topPaddingChanged"})
+ verify(topPaddingSpy.valid)
+
+ var leftPaddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "leftPaddingChanged"})
+ verify(leftPaddingSpy.valid)
+
+ var rightPaddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rightPaddingChanged"})
+ verify(rightPaddingSpy.valid)
+
+ var bottomPaddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "bottomPaddingChanged"})
+ verify(bottomPaddingSpy.valid)
+
+ var horizontalPaddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "horizontalPaddingChanged"})
+ verify(horizontalPaddingSpy.valid)
+
+ var verticalPaddingSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "verticalPaddingChanged"})
+ verify(verticalPaddingSpy.valid)
+
+ var paddingChanges = 0
+ var topPaddingChanges = 0
+ var leftPaddingChanges = 0
+ var rightPaddingChanges = 0
+ var bottomPaddingChanges = 0
+ var horizontalPaddingChanges = 0
+ var verticalPaddingChanges = 0
+
compare(control.padding, 0)
compare(control.topPadding, 0)
compare(control.leftPadding, 0)
compare(control.rightPadding, 0)
compare(control.bottomPadding, 0)
+ compare(control.horizontalPadding, 0)
+ compare(control.verticalPadding, 0)
compare(control.availableWidth, 0)
compare(control.availableHeight, 0)
@@ -102,6 +133,15 @@ TestCase {
compare(control.leftPadding, 10)
compare(control.rightPadding, 10)
compare(control.bottomPadding, 10)
+ compare(control.horizontalPadding, 10)
+ compare(control.verticalPadding, 10)
+ compare(paddingSpy.count, ++paddingChanges)
+ compare(topPaddingSpy.count, ++topPaddingChanges)
+ compare(leftPaddingSpy.count, ++leftPaddingChanges)
+ compare(rightPaddingSpy.count, ++rightPaddingChanges)
+ compare(bottomPaddingSpy.count, ++bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, ++horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, ++verticalPaddingChanges)
control.topPadding = 20
compare(control.padding, 10)
@@ -109,6 +149,15 @@ TestCase {
compare(control.leftPadding, 10)
compare(control.rightPadding, 10)
compare(control.bottomPadding, 10)
+ compare(control.horizontalPadding, 10)
+ compare(control.verticalPadding, 10)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, ++topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
control.leftPadding = 30
compare(control.padding, 10)
@@ -116,6 +165,15 @@ TestCase {
compare(control.leftPadding, 30)
compare(control.rightPadding, 10)
compare(control.bottomPadding, 10)
+ compare(control.horizontalPadding, 10)
+ compare(control.verticalPadding, 10)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, ++leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
control.rightPadding = 40
compare(control.padding, 10)
@@ -123,6 +181,15 @@ TestCase {
compare(control.leftPadding, 30)
compare(control.rightPadding, 40)
compare(control.bottomPadding, 10)
+ compare(control.horizontalPadding, 10)
+ compare(control.verticalPadding, 10)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, ++rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
control.bottomPadding = 50
compare(control.padding, 10)
@@ -130,6 +197,15 @@ TestCase {
compare(control.leftPadding, 30)
compare(control.rightPadding, 40)
compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 10)
+ compare(control.verticalPadding, 10)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, ++bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
control.padding = 60
compare(control.padding, 60)
@@ -137,6 +213,143 @@ TestCase {
compare(control.leftPadding, 30)
compare(control.rightPadding, 40)
compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 60)
+ compare(control.verticalPadding, 60)
+ compare(paddingSpy.count, ++paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, ++horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, ++verticalPaddingChanges)
+
+ control.horizontalPadding = 80
+ compare(control.padding, 60)
+ compare(control.topPadding, 20)
+ compare(control.leftPadding, 30)
+ compare(control.rightPadding, 40)
+ compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 80)
+ compare(control.verticalPadding, 60)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, ++horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
+
+ control.verticalPadding = 90
+ compare(control.padding, 60)
+ compare(control.topPadding, 20)
+ compare(control.leftPadding, 30)
+ compare(control.rightPadding, 40)
+ compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 80)
+ compare(control.verticalPadding, 90)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, ++verticalPaddingChanges)
+
+ control.leftPadding = undefined
+ compare(control.padding, 60)
+ compare(control.topPadding, 20)
+ compare(control.leftPadding, 80)
+ compare(control.rightPadding, 40)
+ compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 80)
+ compare(control.verticalPadding, 90)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, ++leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
+
+ control.rightPadding = undefined
+ compare(control.padding, 60)
+ compare(control.topPadding, 20)
+ compare(control.leftPadding, 80)
+ compare(control.rightPadding, 80)
+ compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 80)
+ compare(control.verticalPadding, 90)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, ++rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
+
+ control.topPadding = undefined
+ compare(control.padding, 60)
+ compare(control.topPadding, 90)
+ compare(control.leftPadding, 80)
+ compare(control.rightPadding, 80)
+ compare(control.bottomPadding, 50)
+ compare(control.horizontalPadding, 80)
+ compare(control.verticalPadding, 90)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, ++topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
+
+ control.bottomPadding = undefined
+ compare(control.padding, 60)
+ compare(control.topPadding, 90)
+ compare(control.leftPadding, 80)
+ compare(control.rightPadding, 80)
+ compare(control.bottomPadding, 90)
+ compare(control.horizontalPadding, 80)
+ compare(control.verticalPadding, 90)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, ++bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
+
+ control.horizontalPadding = undefined
+ compare(control.padding, 60)
+ compare(control.topPadding, 90)
+ compare(control.leftPadding, 60)
+ compare(control.rightPadding, 60)
+ compare(control.bottomPadding, 90)
+ compare(control.horizontalPadding, 60)
+ compare(control.verticalPadding, 90)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, topPaddingChanges)
+ compare(leftPaddingSpy.count, ++leftPaddingChanges)
+ compare(rightPaddingSpy.count, ++rightPaddingChanges)
+ compare(bottomPaddingSpy.count, bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, ++horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, verticalPaddingChanges)
+
+ control.verticalPadding = undefined
+ compare(control.padding, 60)
+ compare(control.topPadding, 60)
+ compare(control.leftPadding, 60)
+ compare(control.rightPadding, 60)
+ compare(control.bottomPadding, 60)
+ compare(control.horizontalPadding, 60)
+ compare(control.verticalPadding, 60)
+ compare(paddingSpy.count, paddingChanges)
+ compare(topPaddingSpy.count, ++topPaddingChanges)
+ compare(leftPaddingSpy.count, leftPaddingChanges)
+ compare(rightPaddingSpy.count, rightPaddingChanges)
+ compare(bottomPaddingSpy.count, ++bottomPaddingChanges)
+ compare(horizontalPaddingSpy.count, horizontalPaddingChanges)
+ compare(verticalPaddingSpy.count, ++verticalPaddingChanges)
}
function test_availableSize() {
@@ -252,6 +465,12 @@ TestCase {
compare(control.background.height, control.height)
control.height = 240
+ // change implicit size (QTBUG-66455)
+ control.background.implicitWidth = 160
+ control.background.implicitHeight = 120
+ compare(control.background.width, control.width)
+ compare(control.background.height, control.height)
+
// has width => width does not follow
control.background.width /= 2
control.width += 20
@@ -921,19 +1140,278 @@ TestCase {
var control = createTemporaryObject(component, testCase)
verify(control)
+ var implicitWidthSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitWidthChanged"})
+ verify(implicitWidthSpy.valid)
+
+ var implicitHeightSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitHeightChanged"})
+ verify(implicitHeightSpy.valid)
+
+ var implicitContentWidthSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitContentWidthChanged"})
+ verify(implicitContentWidthSpy.valid)
+
+ var implicitContentHeightSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitContentHeightChanged"})
+ verify(implicitContentHeightSpy.valid)
+
+ var implicitBackgroundWidthSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitBackgroundWidthChanged"})
+ verify(implicitBackgroundWidthSpy.valid)
+
+ var implicitBackgroundHeightSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitBackgroundHeightChanged"})
+ verify(implicitBackgroundHeightSpy.valid)
+
+ var implicitWidthChanges = 0
+ var implicitHeightChanges = 0
+ var implicitContentWidthChanges = 0
+ var implicitContentHeightChanges = 0
+ var implicitBackgroundWidthChanges = 0
+ var implicitBackgroundHeightChanges = 0
+
compare(control.implicitWidth, 0)
compare(control.implicitHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
control.contentItem = rectangle.createObject(control, {implicitWidth: 10, implicitHeight: 20})
compare(control.implicitWidth, 10)
compare(control.implicitHeight, 20)
+ compare(control.implicitContentWidth, 10)
+ compare(control.implicitContentHeight, 20)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
+ compare(implicitContentWidthSpy.count, ++implicitContentWidthChanges)
+ compare(implicitContentHeightSpy.count, ++implicitContentHeightChanges)
+
+ control.contentItem.implicitWidth += 1
+ control.contentItem.implicitHeight += 1
+ compare(control.implicitWidth, 11)
+ compare(control.implicitHeight, 21)
+ compare(control.implicitContentWidth, 11)
+ compare(control.implicitContentHeight, 21)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitContentWidthSpy.count, ++implicitContentWidthChanges)
+ compare(implicitContentHeightSpy.count, ++implicitContentHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
control.background = rectangle.createObject(control, {implicitWidth: 20, implicitHeight: 30})
compare(control.implicitWidth, 20)
compare(control.implicitHeight, 30)
+ compare(control.implicitContentWidth,11)
+ compare(control.implicitContentHeight, 21)
+ compare(control.implicitBackgroundWidth, 20)
+ compare(control.implicitBackgroundHeight, 30)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitContentWidthSpy.count, implicitContentWidthChanges)
+ compare(implicitContentHeightSpy.count, implicitContentHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, ++implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, ++implicitBackgroundHeightChanges)
+
+ control.background.implicitWidth += 1
+ control.background.implicitHeight += 1
+ compare(control.implicitWidth, 21)
+ compare(control.implicitHeight, 31)
+ compare(control.implicitContentWidth, 11)
+ compare(control.implicitContentHeight, 21)
+ compare(control.implicitBackgroundWidth, 21)
+ compare(control.implicitBackgroundHeight, 31)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitContentWidthSpy.count, implicitContentWidthChanges)
+ compare(implicitContentHeightSpy.count, implicitContentHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, ++implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, ++implicitBackgroundHeightChanges)
+ }
+
+ function test_baseline() {
+ var control = createTemporaryObject(component, testCase)
+ verify(control)
+
+ compare(control.baselineOffset, 0)
+
+ var baselineSpy = signalSpy.createObject(control, {target: control, signalName: "baselineOffsetChanged"})
+ verify(baselineSpy.valid)
+
+ control.contentItem = rectangle.createObject(control, {baselineOffset: 12})
+ compare(control.baselineOffset, 12)
+ compare(baselineSpy.count, 1)
+
+ control.padding = 6
+ compare(control.baselineOffset, 18)
+ compare(baselineSpy.count, 2)
- control.padding = 100
- compare(control.implicitWidth, 210)
- compare(control.implicitHeight, 220)
+ control.baselineOffset = 3
+ compare(control.baselineOffset, 3)
+ compare(baselineSpy.count, 3)
+
+ control.padding = 9
+ compare(control.baselineOffset, 3)
+ compare(baselineSpy.count, 3)
+
+ control.baselineOffset = undefined
+ compare(control.baselineOffset, 21)
+ compare(baselineSpy.count, 4)
+
+ control.contentItem.baselineOffset = 3
+ compare(control.baselineOffset, 12)
+ compare(baselineSpy.count, 5)
+
+ control.contentItem = null
+ compare(control.baselineOffset, 0)
+ compare(baselineSpy.count, 6)
+ }
+
+ function test_inset() {
+ var control = createTemporaryObject(component, testCase, {background: rectangle.createObject(control)})
+ verify(control)
+
+ var topInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "topInsetChanged"})
+ verify(topInsetSpy.valid)
+
+ var leftInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "leftInsetChanged"})
+ verify(leftInsetSpy.valid)
+
+ var rightInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rightInsetChanged"})
+ verify(rightInsetSpy.valid)
+
+ var bottomInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "bottomInsetChanged"})
+ verify(bottomInsetSpy.valid)
+
+ var topInsetChanges = 0
+ var leftInsetChanges = 0
+ var rightInsetChanges = 0
+ var bottomInsetChanges = 0
+
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+
+ control.width = 100
+ control.height = 100
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+
+ control.topInset = 10
+ compare(control.topInset, 10)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 10)
+ compare(control.background.width, 100)
+ compare(control.background.height, 90)
+
+ control.leftInset = 20
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 80)
+ compare(control.background.height, 90)
+
+ control.rightInset = 30
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 90)
+
+ control.bottomInset = 40
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 50)
+
+ control.topInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 0)
+ compare(control.background.width, 50)
+ compare(control.background.height, 60)
+
+ control.leftInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 70)
+ compare(control.background.height, 60)
+
+ control.rightInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 60)
+
+ control.bottomInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
}
}
diff --git a/tests/auto/controls/data/tst_dial.qml b/tests/auto/controls/data/tst_dial.qml
index 33b0dbea..a2d32347 100644
--- a/tests/auto/controls/data/tst_dial.qml
+++ b/tests/auto/controls/data/tst_dial.qml
@@ -54,15 +54,19 @@ import QtQuick.Controls 2.2
TestCase {
id: testCase
- width: 200
- height: 200
+ width: 450
+ height: 450
visible: true
when: windowShown
name: "Dial"
Component {
id: dialComponent
- Dial {}
+ Dial {
+ width: 100
+ height: 100
+ anchors.centerIn: parent
+ }
}
Component {
@@ -592,4 +596,93 @@ TestCase {
mouseRelease(control)
compare(control.pressed, false)
}
+
+ function move(inputEventType, control, x, y) {
+ if (inputEventType === "mouseInput") {
+ mouseMove(control, x, y);
+ } else {
+ var touch = touchEvent(control);
+ touch.move(0, control, x, y).commit();
+ }
+ }
+
+ function press(inputEventType, control, x, y) {
+ if (inputEventType === "mouseInput") {
+ mousePress(control, x, y);
+ } else {
+ var touch = touchEvent(control);
+ touch.press(0, control, x, y).commit();
+ }
+ }
+
+ function release(inputEventType, control, x, y) {
+ if (inputEventType === "mouseInput") {
+ mouseRelease(control, x, y);
+ } else {
+ var touch = touchEvent(control);
+ touch.release(0, control, x, y).commit();
+ }
+ }
+
+ function test_horizontalAndVertical_data() {
+ var data = [
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 0.5, moveToY: 0.25, expectedPosition: 0.125 },
+ // Horizontal movement should have no effect on a vertical dial.
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 2.0, moveToY: 0.25, expectedPosition: 0.125 },
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 0.5, moveToY: 0.0, expectedPosition: 0.25 },
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 0.5, moveToY: -1.5, expectedPosition: 1.0 },
+ // Going above the drag area shouldn't make the position higher than 1.0.
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 0.5, moveToY: -2.0, expectedPosition: 1.0 },
+ // Try to decrease the position by moving the mouse down.
+ // The dial's position is 0 before the press event, so nothing should happen.
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 0.5, moveToY: 1.25, expectedPosition: 0.0 },
+
+ { eventType: "mouseInput", inputMode: Dial.Horizontal, moveToX: 0.75, moveToY: 0.5, expectedPosition: 0.125 },
+ // Vertical movement should have no effect on a horizontal dial.
+ { eventType: "mouseInput", inputMode: Dial.Horizontal, moveToX: 0.75, moveToY: 2.0, expectedPosition: 0.125 },
+ { eventType: "mouseInput", inputMode: Dial.Horizontal, moveToX: 1.0, moveToY: 0.5, expectedPosition: 0.25 },
+ { eventType: "mouseInput", inputMode: Dial.Horizontal, moveToX: 1.5, moveToY: 0.5, expectedPosition: 0.5 },
+ { eventType: "mouseInput", inputMode: Dial.Horizontal, moveToX: 2.5, moveToY: 0.5, expectedPosition: 1.0 },
+ // Going above the drag area shouldn't make the position higher than 1.0.
+ { eventType: "mouseInput", inputMode: Dial.Horizontal, moveToX: 2.525, moveToY: 0.5, expectedPosition: 1.0 },
+ // Try to decrease the position by moving the mouse to the left.
+ // The dial's position is 0 before the press event, so nothing should happen.
+ { eventType: "mouseInput", inputMode: Dial.Vertical, moveToX: 0.25, moveToY: 0.5, expectedPosition: 0.0 }
+ ];
+
+ // Do the same tests for touch by copying the mouse tests and adding them to the end of the array.
+ var mouseTestCount = data.length;
+ for (var i = mouseTestCount; i < mouseTestCount * 2; ++i) {
+ // Shallow-copy the object.
+ data[i] = JSON.parse(JSON.stringify(data[i - mouseTestCount]));
+ data[i].eventType = "touchInput";
+ }
+
+ for (i = 0; i < data.length; ++i) {
+ var row = data[i];
+ row.tag = "eventType=" + row.eventType + ", "
+ + "inputMode=" + (row.inputMode === Dial.Vertical ? "Vertical" : "Horizontal") + ", "
+ + "moveToX=" + row.moveToX + ", moveToY=" + row.moveToY + ", "
+ + "expectedPosition=" + row.expectedPosition;
+ }
+
+ return data;
+ }
+
+ function test_horizontalAndVertical(data) {
+ var control = createTemporaryObject(dialComponent, testCase, { inputMode: data.inputMode });
+ verify(control);
+
+ press(data.eventType, control);
+ compare(control.pressed, true);
+ // The position shouldn't change until the mouse has actually moved.
+ compare(control.position, 0);
+
+ move(data.eventType, control, control.width * data.moveToX, control.width * data.moveToY);
+ compare(control.position, data.expectedPosition);
+
+ release(data.eventType, control, control.width * data.moveToX, control.width * data.moveToY);
+ compare(control.pressed, false);
+ compare(control.position, data.expectedPosition);
+ }
}
diff --git a/tests/auto/controls/data/tst_dialogbuttonbox.qml b/tests/auto/controls/data/tst_dialogbuttonbox.qml
index 6faf0db4..ed181c5b 100644
--- a/tests/auto/controls/data/tst_dialogbuttonbox.qml
+++ b/tests/auto/controls/data/tst_dialogbuttonbox.qml
@@ -196,6 +196,31 @@ TestCase {
compare(roleSpy.count, 1)
}
+ function test_buttonLayout_data() {
+ return [
+ { tag: "WinLayout", buttonLayout: DialogButtonBox.WinLayout, button1Role: DialogButtonBox.AcceptRole, button2Role: DialogButtonBox.RejectRole },
+ { tag: "MacLayout", buttonLayout: DialogButtonBox.MacLayout, button1Role: DialogButtonBox.RejectRole, button2Role: DialogButtonBox.AcceptRole },
+ { tag: "KdeLayout", buttonLayout: DialogButtonBox.KdeLayout, button1Role: DialogButtonBox.AcceptRole, button2Role: DialogButtonBox.RejectRole },
+ { tag: "GnomeLayout", buttonLayout: DialogButtonBox.GnomeLayout, button1Role: DialogButtonBox.RejectRole, button2Role: DialogButtonBox.AcceptRole },
+ { tag: "AndroidLayout", buttonLayout: DialogButtonBox.AndroidLayout, button1Role: DialogButtonBox.RejectRole, button2Role: DialogButtonBox.AcceptRole }
+ ]
+ }
+
+ function test_buttonLayout(data) {
+ var control = createTemporaryObject(buttonBox, testCase, {buttonLayout: data.buttonLayout, standardButtons: DialogButtonBox.Ok|DialogButtonBox.Cancel})
+ verify(control)
+
+ compare(control.count, 2)
+
+ var button1 = control.itemAt(0)
+ verify(button1)
+ compare(button1.DialogButtonBox.buttonRole, data.button1Role)
+
+ var button2 = control.itemAt(1)
+ verify(button2)
+ compare(button2.DialogButtonBox.buttonRole, data.button2Role)
+ }
+
function test_implicitSize_data() {
return [
{ tag: "Ok", standardButtons: DialogButtonBox.Ok },
@@ -223,4 +248,31 @@ TestCase {
verify(implicitContentWidth > control.leftPadding + control.rightPadding)
verify(control.implicitWidth >= implicitContentWidth, qsTr("implicit width (%1) is less than content width (%2)").arg(control.implicitWidth).arg(implicitContentWidth))
}
+
+ Component {
+ id: okCancelBox
+ DialogButtonBox {
+ Button {
+ text: qsTr("OK")
+ }
+ Button {
+ text: qsTr("Cancel")
+ }
+ }
+ }
+
+ function test_buttonSize() {
+ var control = createTemporaryObject(okCancelBox, testCase)
+ verify(control)
+
+ var okButton = control.itemAt(0)
+ verify(okButton)
+ verify(okButton.width > 0)
+
+ var cancelButton = control.itemAt(1)
+ verify(cancelButton)
+ verify(cancelButton.width > 0)
+
+ compare(okButton.width + cancelButton.width, control.availableWidth - control.spacing)
+ }
}
diff --git a/tests/auto/controls/data/tst_frame.qml b/tests/auto/controls/data/tst_frame.qml
index c6ecdb43..95838155 100644
--- a/tests/auto/controls/data/tst_frame.qml
+++ b/tests/auto/controls/data/tst_frame.qml
@@ -106,6 +106,8 @@ TestCase {
verify(control.contentItem)
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
}
function test_oneChild() {
@@ -114,6 +116,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth > 100)
verify(control.implicitHeight > 30)
}
@@ -124,6 +128,8 @@ TestCase {
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
verify(control.implicitWidth > 0)
verify(control.implicitHeight > 0)
}
@@ -134,6 +140,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth > 100)
verify(control.implicitHeight > 30)
}
diff --git a/tests/auto/controls/data/tst_groupbox.qml b/tests/auto/controls/data/tst_groupbox.qml
index 28de0479..446283d8 100644
--- a/tests/auto/controls/data/tst_groupbox.qml
+++ b/tests/auto/controls/data/tst_groupbox.qml
@@ -106,6 +106,8 @@ TestCase {
verify(control.contentItem)
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
}
function test_oneChild() {
@@ -114,6 +116,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth > 100)
verify(control.implicitHeight > 30)
}
@@ -124,6 +128,8 @@ TestCase {
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
verify(control.implicitWidth > 0)
verify(control.implicitHeight > 0)
}
@@ -134,6 +140,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth > 100)
verify(control.implicitHeight > 30)
}
diff --git a/tests/auto/controls/data/tst_label.qml b/tests/auto/controls/data/tst_label.qml
index 69d273a7..8183f088 100644
--- a/tests/auto/controls/data/tst_label.qml
+++ b/tests/auto/controls/data/tst_label.qml
@@ -138,5 +138,157 @@ TestCase {
control.background = rectangle.createObject(control)
compare(control.background.width, control.width)
compare(control.background.height, control.height)
+
+ // change implicit size (QTBUG-66455)
+ control.background.implicitWidth = 160
+ control.background.implicitHeight = 120
+ compare(control.background.width, control.width)
+ compare(control.background.height, control.height)
+ }
+
+ function test_inset() {
+ var control = createTemporaryObject(label, testCase, {background: rectangle.createObject(control)})
+ verify(control)
+
+ var topInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "topInsetChanged"})
+ verify(topInsetSpy.valid)
+
+ var leftInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "leftInsetChanged"})
+ verify(leftInsetSpy.valid)
+
+ var rightInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rightInsetChanged"})
+ verify(rightInsetSpy.valid)
+
+ var bottomInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "bottomInsetChanged"})
+ verify(bottomInsetSpy.valid)
+
+ var topInsetChanges = 0
+ var leftInsetChanges = 0
+ var rightInsetChanges = 0
+ var bottomInsetChanges = 0
+
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+
+ control.width = 100
+ control.height = 100
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+
+ control.topInset = 10
+ compare(control.topInset, 10)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 10)
+ compare(control.background.width, 100)
+ compare(control.background.height, 90)
+
+ control.leftInset = 20
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 80)
+ compare(control.background.height, 90)
+
+ control.rightInset = 30
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 90)
+
+ control.bottomInset = 40
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 50)
+
+ control.topInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 0)
+ compare(control.background.width, 50)
+ compare(control.background.height, 60)
+
+ control.leftInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 70)
+ compare(control.background.height, 60)
+
+ control.rightInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 60)
+
+ control.bottomInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
}
}
diff --git a/tests/auto/controls/data/tst_page.qml b/tests/auto/controls/data/tst_page.qml
index 8fe4414b..c709c216 100644
--- a/tests/auto/controls/data/tst_page.qml
+++ b/tests/auto/controls/data/tst_page.qml
@@ -132,6 +132,8 @@ TestCase {
verify(control.contentItem)
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
}
function test_oneChild() {
@@ -140,6 +142,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
compare(control.implicitWidth, 100 + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, 30 + control.topPadding + control.bottomPadding)
}
@@ -150,6 +154,8 @@ TestCase {
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
compare(control.implicitWidth, Math.max(control.leftPadding + control.rightPadding,
control.background ? control.background.implicitWidth : 0))
compare(control.implicitHeight, Math.max(control.topPadding + control.bottomPadding,
@@ -162,6 +168,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
compare(control.implicitWidth, 100 + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, 30 + control.topPadding + control.bottomPadding)
}
diff --git a/tests/auto/controls/data/tst_pane.qml b/tests/auto/controls/data/tst_pane.qml
index 0d7e6536..8976d4f9 100644
--- a/tests/auto/controls/data/tst_pane.qml
+++ b/tests/auto/controls/data/tst_pane.qml
@@ -119,6 +119,8 @@ TestCase {
verify(control.contentItem)
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
}
function test_oneChild() {
@@ -127,8 +129,21 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth > 100)
verify(control.implicitHeight > 30)
+
+ compare(control.contentChildren.length, 1)
+ control.contentChildren[0].implicitWidth = 200
+ control.contentChildren[0].implicitHeight = 40
+
+ compare(control.contentWidth, 200)
+ compare(control.contentHeight, 40)
+ compare(control.implicitContentWidth, 200)
+ compare(control.implicitContentHeight, 40)
+ verify(control.implicitWidth > 200)
+ verify(control.implicitHeight > 40)
}
function test_twoChildren() {
@@ -137,6 +152,8 @@ TestCase {
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
verify(control.implicitWidth > 0)
verify(control.implicitHeight > 0)
}
@@ -147,6 +164,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth > 100)
verify(control.implicitHeight > 30)
}
diff --git a/tests/auto/controls/data/tst_popup.qml b/tests/auto/controls/data/tst_popup.qml
index 4951c13c..962feae2 100644
--- a/tests/auto/controls/data/tst_popup.qml
+++ b/tests/auto/controls/data/tst_popup.qml
@@ -48,10 +48,10 @@
**
****************************************************************************/
-import QtQuick 2.11
+import QtQuick 2.12
import QtTest 1.0
-import QtQuick.Controls 2.3
-import QtQuick.Templates 2.3 as T
+import QtQuick.Controls 2.5
+import QtQuick.Templates 2.5 as T
TestCase {
id: testCase
@@ -1270,6 +1270,77 @@ TestCase {
compare(control.background.height, 100 + (control.background.topInset || 0) + (control.background.bottomInset || 0))
}
+ function test_anchors() {
+ var control = createTemporaryObject(popupControl, applicationWindow.contentItem.Overlay.overlay,
+ { visible: true, width: 100, height: 100 })
+ verify(control)
+ verify(control.visible)
+ compare(control.parent, control.Overlay.overlay)
+ compare(control.x, 0)
+ compare(control.y, 0)
+
+ var overlay = control.Overlay.overlay
+ verify(overlay)
+
+ var centerInSpy = createTemporaryObject(signalSpy, testCase, { target: control.anchors, signalName: "centerInChanged" })
+ verify(centerInSpy.valid)
+
+ applicationWindow.visible = true
+ verify(waitForRendering(applicationWindow.contentItem))
+ verify(overlay.width > 0)
+ verify(overlay.height > 0)
+
+ // Center the popup in the window via the overlay.
+ control.anchors.centerIn = Qt.binding(function() { return control.parent; })
+ compare(centerInSpy.count, 1)
+ compare(control.x, (overlay.width - control.width) / 2)
+ compare(control.y, (overlay.height - control.height) / 2)
+
+ // Ensure that it warns when trying to set it to an item that's not its parent.
+ var anotherItem = createTemporaryObject(rect, applicationWindow.contentItem, { x: 100, y: 100, width: 50, height: 50 })
+ verify(anotherItem)
+
+ ignoreWarning(Qt.resolvedUrl("tst_popup.qml") + ":77:9: QML Popup: Popup can only be centered within its immediate parent or Overlay.overlay")
+ control.anchors.centerIn = anotherItem
+ // The property will change, because we can't be sure that the parent
+ // in QQuickPopupAnchors::setCenterIn() is the final parent, as some reparenting can happen.
+ // We still expect the warning from QQuickPopupPositioner::reposition() though.
+ compare(centerInSpy.count, 2)
+ compare(control.anchors.centerIn, anotherItem)
+
+ // The binding to the popup's parent was broken above, so restore it.
+ control.anchors.centerIn = Qt.binding(function() { return control.parent; })
+ compare(centerInSpy.count, 3)
+
+ // Change the popup's parent and ensure that it's anchored accordingly.
+ control.parent = Qt.binding(function() { return anotherItem; })
+ compare(control.parent, anotherItem)
+ compare(control.anchors.centerIn, anotherItem)
+ compare(centerInSpy.count, 4)
+ compare(control.x, (anotherItem.width - control.width) / 2)
+ compare(control.y, (anotherItem.height - control.height) / 2)
+
+ // Check that anchors.centerIn beats x and y coordinates as it does in QQuickItem.
+ control.x = 33;
+ control.y = 44;
+ compare(control.x, (anotherItem.width - control.width) / 2)
+ compare(control.y, (anotherItem.height - control.height) / 2)
+
+ // Check that the popup's x and y coordinates are restored when it's no longer centered.
+ control.anchors.centerIn = undefined
+ compare(centerInSpy.count, 5)
+ compare(control.x, 33)
+ compare(control.y, 44)
+
+ // Test centering in the overlay while having a different parent (anotherItem).
+ control.anchors.centerIn = overlay
+ compare(centerInSpy.count, 6)
+ compare(control.x, (overlay.width - control.width) / 2)
+ compare(control.y, (overlay.height - control.height) / 2)
+
+ // TODO: do this properly by creating a component or something
+ applicationWindow.visible = false
+ }
Component {
id: shortcutWindowComponent
diff --git a/tests/auto/controls/data/tst_rangeslider.qml b/tests/auto/controls/data/tst_rangeslider.qml
index 39b0c4b0..03b34a2a 100644
--- a/tests/auto/controls/data/tst_rangeslider.qml
+++ b/tests/auto/controls/data/tst_rangeslider.qml
@@ -291,12 +291,21 @@ TestCase {
var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"})
verify(firstPressedSpy.valid)
+ var firstMovedSpy = signalSpy.createObject(control, {target: control.first, signalName: "moved"})
+ verify(firstMovedSpy.valid)
+
var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"})
verify(secondPressedSpy.valid)
+ var secondMovedSpy = signalSpy.createObject(control, {target: control.second, signalName: "moved"})
+ verify(secondMovedSpy.valid)
+
+ // Press and release the first handle without moving it.
mousePress(control, control.leftPadding, control.height - control.bottomPadding, Qt.LeftButton)
compare(firstPressedSpy.count, 1)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 0)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, true)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -306,7 +315,9 @@ TestCase {
mouseRelease(control, control.leftPadding, control.height - control.bottomPadding, Qt.LeftButton)
compare(firstPressedSpy.count, 2)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 0)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, false)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -314,9 +325,12 @@ TestCase {
compare(control.second.value, 1.0)
compare(control.second.position, 1.0)
+ // Press and release the second handle without moving it.
mousePress(control, control.width - control.rightPadding, control.topPadding, Qt.LeftButton)
compare(firstPressedSpy.count, 2)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 1)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, false)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -326,7 +340,9 @@ TestCase {
mouseRelease(control, control.width - control.rightPadding, control.topPadding, Qt.LeftButton)
compare(firstPressedSpy.count, 2)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 2)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, false)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -334,9 +350,12 @@ TestCase {
compare(control.second.value, 1.0)
compare(control.second.position, 1.0)
+ // Press and release on the bottom left corner of the control without moving the handle.
mousePress(control, 0, control.height, Qt.LeftButton)
compare(firstPressedSpy.count, 3)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 2)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, true)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -346,7 +365,9 @@ TestCase {
mouseRelease(control, 0, control.height, Qt.LeftButton)
compare(firstPressedSpy.count, 4)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 2)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, false)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -354,9 +375,12 @@ TestCase {
compare(control.second.value, 1.0)
compare(control.second.position, 1.0)
+ // Drag the first handle.
mousePress(control, control.leftPadding, control.height - control.bottomPadding, Qt.LeftButton)
compare(firstPressedSpy.count, 5)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 2)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, true)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -369,7 +393,9 @@ TestCase {
var toY = horizontal ? control.first.handle.y : control.height * 0.5
mouseMove(control, toX, toY)
compare(firstPressedSpy.count, 5)
+ compare(firstMovedSpy.count, 1)
compare(secondPressedSpy.count, 2)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, true)
compare(control.first.value, data.live ? 0.5 : 0.0)
compare(control.first.position, 0.5)
@@ -381,7 +407,9 @@ TestCase {
mouseRelease(control, toX, toY, Qt.LeftButton)
compare(firstPressedSpy.count, 6)
+ compare(firstMovedSpy.count, 1)
compare(secondPressedSpy.count, 2)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, false)
compare(control.first.value, 0.5)
compare(control.first.position, 0.5)
@@ -408,13 +436,22 @@ TestCase {
var firstPressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"})
verify(firstPressedSpy.valid)
+ var firstMovedSpy = signalSpy.createObject(control, {target: control.first, signalName: "moved"})
+ verify(firstMovedSpy.valid)
+
var secondPressedSpy = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"})
verify(secondPressedSpy.valid)
+ var secondMovedSpy = signalSpy.createObject(control, {target: control.second, signalName: "moved"})
+ verify(secondMovedSpy.valid)
+
+ // Press and release the first handle without moving it.
var touch = touchEvent(control)
touch.press(0, control, control.width * 0.25, control.height * 0.75).commit()
compare(firstPressedSpy.count, 1)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 0)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, true)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -424,7 +461,9 @@ TestCase {
touch.release(0, control, control.width * 0.25, control.height * 0.75).commit()
compare(firstPressedSpy.count, 2)
+ compare(firstMovedSpy.count, 0)
compare(secondPressedSpy.count, 0)
+ compare(secondMovedSpy.count, 0)
compare(control.first.pressed, false)
compare(control.first.value, 0.0)
compare(control.first.position, 0.0)
@@ -432,6 +471,7 @@ TestCase {
compare(control.second.value, 1.0)
compare(control.second.position, 1.0)
+ // Press and release the second handle without moving it.
touch.press(0, control, control.width * 0.75, control.height * 0.25).commit()
compare(firstPressedSpy.count, 2)
compare(secondPressedSpy.count, 1)
@@ -452,6 +492,7 @@ TestCase {
compare(control.second.value, 1.0)
compare(control.second.position, 1.0)
+ // Press and release on the bottom left corner of the control without moving the handle.
touch.press(0, control, 0, control.height).commit()
compare(firstPressedSpy.count, 3)
compare(secondPressedSpy.count, 2)
@@ -482,6 +523,7 @@ TestCase {
compare(control.second.value, 1.0)
compare(control.second.position, 1.0)
+ // Drag the first handle.
var horizontal = control.orientation === Qt.Horizontal
var toX = horizontal ? control.width * 0.5 : control.first.handle.x
var toY = horizontal ? control.first.handle.y : control.height * 0.5
@@ -929,4 +971,115 @@ TestCase {
compare(control.first.pressed, false)
compare(control.second.pressed, false)
}
+
+ function test_touchDragThreshold_data() {
+ var d1 = 3; var d2 = 7;
+ return [
+ { tag: "horizontal", orientation: Qt.Horizontal, dx1: d1, dy1: 0, dx2: d2, dy2: 0 },
+ { tag: "vertical", orientation: Qt.Vertical, dx1: 0, dy1: -d1, dx2: 0, dy2: -d2 },
+ { tag: "horizontal2", orientation: Qt.Horizontal, dx1: -d1, dy1: 0, dx2: -d2, dy2: 0 },
+ { tag: "vertical2", orientation: Qt.Vertical, dx1: 0, dy1: d1, dx2: 0, dy2: d2 },
+ ]
+ }
+
+ function test_touchDragThreshold(data) {
+ var control = createTemporaryObject(sliderComponent, testCase, {touchDragThreshold: 10, live: true, orientation: data.orientation, first: {value: 0}, second: {value: 1}})
+ verify(control)
+ compare(control.touchDragThreshold, 10)
+
+ var valueChangedCount = 0
+ var valueChangedSpy = signalSpy.createObject(control, {target: control, signalName: "touchDragThresholdChanged"})
+ verify(valueChangedSpy.valid)
+
+ control.touchDragThreshold = undefined
+ compare(control.touchDragThreshold, -1) // reset to -1
+ compare(valueChangedSpy.count, ++valueChangedCount)
+
+ var t = 5
+ control.touchDragThreshold = t
+ compare(control.touchDragThreshold, t)
+ compare(valueChangedSpy.count, ++valueChangedCount)
+
+ control.touchDragThreshold = t
+ compare(control.touchDragThreshold, t)
+ compare(valueChangedSpy.count, valueChangedCount)
+
+ var pressedCount = 0
+ var pressedCount2 = 0
+ var visualPositionCount = 0
+ var visualPositionCount2 = 0
+
+ var pressedSpy = signalSpy.createObject(control, {target: control.first, signalName: "pressedChanged"})
+ verify(pressedSpy.valid)
+ var pressedSpy2 = signalSpy.createObject(control, {target: control.second, signalName: "pressedChanged"})
+ verify(pressedSpy2.valid)
+
+ var visualPositionSpy = signalSpy.createObject(control, {target: control.first, signalName: "visualPositionChanged"})
+ verify(visualPositionSpy.valid)
+ var visualPositionSpy2 = signalSpy.createObject(control, {target: control.second, signalName: "visualPositionChanged"})
+ verify(visualPositionSpy2.valid)
+
+ var touch = touchEvent(control)
+ control.first.value = 0.4
+ control.second.value = 1
+ var x0 = control.first.handle.x + control.first.handle.width * 0.5
+ var y0 = control.first.handle.y + control.first.handle.height * 0.5
+ touch.press(0, control, x0, y0).commit()
+ compare(pressedSpy.count, ++pressedCount)
+ compare(control.first.pressed, true)
+ compare(visualPositionSpy.count, ++visualPositionCount)
+
+ touch.move(0, control, x0 + data.dx1, y0 + data.dy1).commit()
+ compare(pressedSpy.count, pressedCount)
+ compare(control.first.pressed, true)
+ compare(visualPositionSpy.count, visualPositionCount)
+
+ touch.move(0, control, x0 + data.dx2, y0 + data.dy2).commit()
+ compare(pressedSpy.count, pressedCount)
+ compare(control.first.pressed, true)
+ compare(visualPositionSpy.count, ++visualPositionCount)
+
+ touch.release(0, control, x0 + data.dx2, y0 + data.dy2).commit()
+
+ control.first.value = 0
+ control.second.value = 0.6
+ x0 = control.second.handle.x + control.second.handle.width * 0.5
+ y0 = control.second.handle.y + control.second.handle.height * 0.5
+ touch.press(0, control, x0, y0).commit()
+ compare(pressedSpy2.count, ++pressedCount2)
+ compare(control.second.pressed, true)
+ compare(visualPositionSpy2.count, ++visualPositionCount2)
+
+ touch.move(0, control, x0 + data.dx1, y0 + data.dy1).commit()
+ compare(pressedSpy2.count, pressedCount2)
+ compare(control.second.pressed, true)
+ compare(visualPositionSpy2.count, visualPositionCount2)
+
+ touch.move(0, control, x0 + data.dx2, y0 + data.dy2).commit()
+ compare(pressedSpy2.count, pressedCount2)
+ compare(control.second.pressed, true)
+ compare(visualPositionSpy2.count, ++visualPositionCount2)
+ touch.release(0, control, x0 + data.dx2, y0 + data.dy2).commit()
+ }
+
+ function test_valueAt_data() {
+ return [
+ { tag: "0.0..1.0", from: 0.0, to: 1.0, values: [0.0, 0.2, 0.5, 1.0] },
+ { tag: "0..100", from: 0, to: 100, values: [0, 20, 50, 100] },
+ { tag: "100..-100", from: 100, to: -100, values: [100, 60, 0, -100] },
+ { tag: "-7..7", from: -7, to: 7, stepSize: 1.0, values: [-7.0, -4.0, 0.0, 7.0] },
+ { tag: "-3..7", from: -3, to: 7, stepSize: 5.0, values: [-3.0, -3.0, 2.0, 7.0] },
+ ]
+ }
+
+ function test_valueAt(data) {
+ var control = createTemporaryObject(sliderComponent, testCase,
+ { from: data.from, to: data.to, stepSize: data.stepSize })
+ verify(control)
+
+ compare(control.valueAt(0.0), data.values[0])
+ compare(control.valueAt(0.2), data.values[1])
+ compare(control.valueAt(0.5), data.values[2])
+ compare(control.valueAt(1.0), data.values[3])
+ }
}
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index a831e402..368bc9fd 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -804,4 +804,66 @@ TestCase {
mouseRelease(control)
compare(control.pressed, false)
}
+
+ function test_touchDragThreshold_data() {
+ var d1 = 3; var d2 = 7;
+ return [
+ { tag: "horizontal", orientation: Qt.Horizontal, dx1: d1, dy1: 0, dx2: d2, dy2: 0 },
+ { tag: "vertical", orientation: Qt.Vertical, dx1: 0, dy1: -d1, dx2: 0, dy2: -d2 },
+ { tag: "horizontal2", orientation: Qt.Horizontal, dx1: -d1, dy1: 0, dx2: -d2, dy2: 0 },
+ { tag: "vertical2", orientation: Qt.Vertical, dx1: 0, dy1: d1, dx2: 0, dy2: d2 }
+ ]
+ }
+
+ function test_touchDragThreshold(data) {
+ var control = createTemporaryObject(slider, testCase, {touchDragThreshold: 10, live: true, orientation: data.orientation, value: 0.5})
+ verify(control)
+ compare(control.touchDragThreshold, 10)
+
+ var valueChangedCount = 0
+ var valueChangedSpy = signalSpy.createObject(control, {target: control, signalName: "touchDragThresholdChanged"})
+ verify(valueChangedSpy.valid)
+
+ control.touchDragThreshold = undefined
+ compare(control.touchDragThreshold, -1) // reset to -1
+ compare(valueChangedSpy.count, ++valueChangedCount)
+
+ var t = 5
+ control.touchDragThreshold = t
+ compare(control.touchDragThreshold, t)
+ compare(valueChangedSpy.count, ++valueChangedCount)
+
+ control.touchDragThreshold = t
+ compare(control.touchDragThreshold, t)
+ compare(valueChangedSpy.count, valueChangedCount)
+
+ var pressedCount = 0
+ var movedCount = 0
+
+ var pressedSpy = signalSpy.createObject(control, {target: control, signalName: "pressedChanged"})
+ verify(pressedSpy.valid)
+
+ var movedSpy = signalSpy.createObject(control, {target: control, signalName: "moved"})
+ verify(movedSpy.valid)
+
+ var touch = touchEvent(control)
+ var x0 = control.handle.x + control.handle.width * 0.5
+ var y0 = control.handle.y + control.handle.height * 0.5
+ touch.press(0, control, x0, y0).commit()
+ compare(pressedSpy.count, ++pressedCount)
+ compare(movedSpy.count, movedCount)
+ compare(control.pressed, true)
+
+ touch.move(0, control, x0 + data.dx1, y0 + data.dy1).commit()
+ compare(pressedSpy.count, pressedCount)
+ compare(movedSpy.count, movedCount) // shouldn't move
+ compare(control.pressed, true)
+
+ touch.move(0, control, x0 + data.dx2, y0 + data.dy2).commit()
+ compare(pressedSpy.count, pressedCount)
+ compare(movedSpy.count, ++movedCount)
+ compare(control.pressed, true)
+
+ touch.release(0, control, x0 + data.dx2, y0 + data.dy2).commit()
+ }
}
diff --git a/tests/auto/controls/data/tst_swipeview.qml b/tests/auto/controls/data/tst_swipeview.qml
index 39311877..1f92bba4 100644
--- a/tests/auto/controls/data/tst_swipeview.qml
+++ b/tests/auto/controls/data/tst_swipeview.qml
@@ -85,43 +85,60 @@ TestCase {
compare(control.currentIndex, -1)
compare(control.currentItem, null)
- control.addItem(page.createObject(control, {text: "0"}))
+ var item0 = page.createObject(control, {text: "0"})
+ control.addItem(item0)
compare(control.count, 1)
compare(control.currentIndex, 0)
compare(control.currentItem.text, "0")
compare(currentItemChangedSpy.count, 1);
+ compare(control.contentWidth, item0.implicitWidth)
+ compare(control.contentHeight, item0.implicitHeight)
- control.addItem(page.createObject(control, {text: "1"}))
+ var item1 = page.createObject(control, {text: "11"})
+ control.addItem(item1)
compare(control.count, 2)
compare(control.currentIndex, 0)
compare(control.currentItem.text, "0")
compare(currentItemChangedSpy.count, 1);
+ compare(control.contentWidth, item0.implicitWidth)
+ compare(control.contentHeight, item0.implicitHeight)
- control.addItem(page.createObject(control, {text: "2"}))
+ var item2 = page.createObject(control, {text: "222"})
+ control.addItem(item2)
compare(control.count, 3)
compare(control.currentIndex, 0)
compare(control.currentItem.text, "0")
compare(currentItemChangedSpy.count, 1);
+ compare(control.contentWidth, item0.implicitWidth)
+ compare(control.contentHeight, item0.implicitHeight)
control.currentIndex = 1
compare(control.currentIndex, 1)
- compare(control.currentItem.text, "1")
+ compare(control.currentItem.text, "11")
compare(currentItemChangedSpy.count, 2);
+ compare(control.contentWidth, item1.implicitWidth)
+ compare(control.contentHeight, item1.implicitHeight)
control.currentIndex = 2
compare(control.currentIndex, 2)
- compare(control.currentItem.text, "2")
+ compare(control.currentItem.text, "222")
compare(currentItemChangedSpy.count, 3);
+ compare(control.contentWidth, item2.implicitWidth)
+ compare(control.contentHeight, item2.implicitHeight)
control.decrementCurrentIndex()
compare(control.currentIndex, 1)
- compare(control.currentItem.text, "1")
+ compare(control.currentItem.text, "11")
compare(currentItemChangedSpy.count, 4);
+ compare(control.contentWidth, item1.implicitWidth)
+ compare(control.contentHeight, item1.implicitHeight)
control.incrementCurrentIndex()
compare(control.currentIndex, 2)
- compare(control.currentItem.text, "2")
+ compare(control.currentItem.text, "222")
compare(currentItemChangedSpy.count, 5);
+ compare(control.contentWidth, item2.implicitWidth)
+ compare(control.contentHeight, item2.implicitHeight)
}
Component {
diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml
index adb27f78..58917d84 100644
--- a/tests/auto/controls/data/tst_tabbar.qml
+++ b/tests/auto/controls/data/tst_tabbar.qml
@@ -514,8 +514,10 @@ TestCase {
control.addItem(tab1)
tryCompare(tab1, "width", control.width)
compare(tab1.height, control.height)
- compare(control.contentWidth, tab1.implicitWidth)
- compare(control.contentHeight, tab1.implicitHeight)
+ compare(control.implicitContentWidth, tab1.implicitWidth)
+ compare(control.implicitContentHeight, tab1.implicitHeight)
+ compare(control.contentWidth, control.implicitContentWidth)
+ compare(control.contentHeight, control.implicitContentHeight)
compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
@@ -525,8 +527,10 @@ TestCase {
compare(tab1.height, control.height)
compare(tab2.width, (control.width - data.spacing) / 2)
compare(tab2.height, control.height)
- compare(control.contentWidth, tab1.implicitWidth + tab2.implicitWidth + data.spacing)
- compare(control.contentHeight, tab2.implicitHeight)
+ compare(control.implicitContentWidth, tab1.implicitWidth + tab2.implicitWidth + data.spacing)
+ compare(control.implicitContentHeight, tab2.implicitHeight)
+ compare(control.contentWidth, control.implicitContentWidth)
+ compare(control.contentHeight, control.implicitContentHeight)
compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
@@ -542,8 +546,10 @@ TestCase {
compare(tab3.y, (control.height - tab3.height) / 2)
compare(tab3.width, 50)
compare(tab3.height, tab1.implicitHeight - 10)
- compare(control.contentWidth, tab1.implicitWidth + tab2.implicitWidth + tab3.width + 2 * data.spacing)
- compare(control.contentHeight, tab2.implicitHeight)
+ compare(control.implicitContentWidth, tab1.implicitWidth + tab2.implicitWidth + tab3.width + 2 * data.spacing)
+ compare(control.implicitContentHeight, tab2.implicitHeight)
+ compare(control.contentWidth, control.implicitContentWidth)
+ compare(control.contentHeight, control.implicitContentHeight)
compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
@@ -556,8 +562,10 @@ TestCase {
compare(tab2.height, control.height)
compare(tab3.width, expectedWidth)
compare(tab3.height, tab3.implicitHeight)
- compare(control.contentWidth, tab1.implicitWidth + tab2.implicitWidth + tab3.implicitWidth + 2 * data.spacing)
- compare(control.contentHeight, tab2.implicitHeight)
+ compare(control.implicitContentWidth, tab1.implicitWidth + tab2.implicitWidth + tab3.implicitWidth + 2 * data.spacing)
+ compare(control.implicitContentHeight, tab2.implicitHeight)
+ compare(control.contentWidth, control.implicitContentWidth)
+ compare(control.contentHeight, control.implicitContentHeight)
compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 2de82d85..0a50e033 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -79,6 +79,11 @@ TestCase {
SignalSpy { }
}
+ Component {
+ id: rectangle
+ Rectangle { }
+ }
+
function test_creation() {
var control = createTemporaryObject(textArea, testCase)
verify(control)
@@ -86,15 +91,69 @@ TestCase {
function test_implicitSize() {
var control = createTemporaryObject(textArea, testCase)
+ verify(control)
var implicitWidthSpy = signalSpy.createObject(control, { target: control, signalName: "implicitWidthChanged"} )
+ verify(implicitWidthSpy.valid)
+
var implicitHeightSpy = signalSpy.createObject(control, { target: control, signalName: "implicitHeightChanged"} )
- control.background.implicitWidth = 400
- control.background.implicitHeight = 200
+ verify(implicitHeightSpy.valid)
+
+ var implicitBackgroundWidthSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitBackgroundWidthChanged"})
+ verify(implicitBackgroundWidthSpy.valid)
+
+ var implicitBackgroundHeightSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitBackgroundHeightChanged"})
+ verify(implicitBackgroundHeightSpy.valid)
+
+ var implicitWidthChanges = 0
+ var implicitHeightChanges = 0
+ var implicitBackgroundWidthChanges = 0
+ var implicitBackgroundHeightChanges = 0
+
+ verify(control.implicitWidth >= control.leftPadding + control.rightPadding)
+ verify(control.implicitHeight >= control.contentHeight + control.topPadding + control.bottomPadding)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+
+ control.background = rectangle.createObject(control, {implicitWidth: 400, implicitHeight: 200})
compare(control.implicitWidth, 400)
compare(control.implicitHeight, 200)
- compare(implicitWidthSpy.count, 1)
- compare(implicitHeightSpy.count, 1)
+ compare(control.implicitBackgroundWidth, 400)
+ compare(control.implicitBackgroundHeight, 200)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, ++implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, ++implicitBackgroundHeightChanges)
+
+ control.background = null
+ compare(control.implicitWidth, control.leftPadding + control.rightPadding)
+ verify(control.implicitHeight >= control.contentHeight + control.topPadding + control.bottomPadding)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, ++implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, ++implicitBackgroundHeightChanges)
+
+ control.text = "TextArea"
+ compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
+ verify(control.implicitHeight >= control.contentHeight + control.topPadding + control.bottomPadding)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
+
+ control.placeholderText = "..."
+ compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
+ verify(control.implicitHeight >= control.contentHeight + control.topPadding + control.bottomPadding)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, implicitWidthChanges)
+ compare(implicitHeightSpy.count, implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
}
function test_alignment_data() {
@@ -468,4 +527,165 @@ TestCase {
control.destroy()
wait(0)
}
+
+ function test_placeholderTextColor() {
+ var control = createTemporaryObject(textArea, testCase)
+ verify(control)
+
+ // usually default value should not be pure opacue black
+ verify(control.placeholderTextColor !== "#ff000000")
+ control.placeholderTextColor = "#12345678"
+ compare(control.placeholderTextColor, "#12345678")
+
+ for (var i = 0; i < control.children.length; ++i) {
+ if (control.children[i].hasOwnProperty("text"))
+ compare(control.children[i].color, control.placeholderTextColor) // placeholder.color
+ }
+ }
+
+ function test_inset() {
+ var control = createTemporaryObject(textArea, testCase, {background: rectangle.createObject(control)})
+ verify(control)
+
+ var topInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "topInsetChanged"})
+ verify(topInsetSpy.valid)
+
+ var leftInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "leftInsetChanged"})
+ verify(leftInsetSpy.valid)
+
+ var rightInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rightInsetChanged"})
+ verify(rightInsetSpy.valid)
+
+ var bottomInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "bottomInsetChanged"})
+ verify(bottomInsetSpy.valid)
+
+ var topInsetChanges = 0
+ var leftInsetChanges = 0
+ var rightInsetChanges = 0
+ var bottomInsetChanges = 0
+
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+
+ control.width = 100
+ control.height = 100
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+
+ control.topInset = 10
+ compare(control.topInset, 10)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 10)
+ compare(control.background.width, 100)
+ compare(control.background.height, 90)
+
+ control.leftInset = 20
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 80)
+ compare(control.background.height, 90)
+
+ control.rightInset = 30
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 90)
+
+ control.bottomInset = 40
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 50)
+
+ control.topInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 0)
+ compare(control.background.width, 50)
+ compare(control.background.height, 60)
+
+ control.leftInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 70)
+ compare(control.background.height, 60)
+
+ control.rightInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 60)
+
+ control.bottomInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+ }
}
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index 0fee7363..963046e4 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -82,34 +82,69 @@ TestCase {
function test_implicitSize() {
var control = createTemporaryObject(textField, testCase)
- verify(control.implicitWidth > control.leftPadding + control.rightPadding)
+ verify(control)
var implicitWidthSpy = signalSpy.createObject(control, { target: control, signalName: "implicitWidthChanged"} )
+ verify(implicitWidthSpy.valid)
+
var implicitHeightSpy = signalSpy.createObject(control, { target: control, signalName: "implicitHeightChanged"} )
+ verify(implicitHeightSpy.valid)
+
+ var implicitBackgroundWidthSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitBackgroundWidthChanged"})
+ verify(implicitBackgroundWidthSpy.valid)
+
+ var implicitBackgroundHeightSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "implicitBackgroundHeightChanged"})
+ verify(implicitBackgroundHeightSpy.valid)
+
+ var implicitWidthChanges = 0
+ var implicitHeightChanges = 0
+ var implicitBackgroundWidthChanges = 0
+ var implicitBackgroundHeightChanges = 0
+
+ verify(control.implicitWidth >= control.leftPadding + control.rightPadding)
+ verify(control.implicitHeight >= control.contentHeight + control.topPadding + control.bottomPadding)
+ compare(control.implicitBackgroundWidth, control.background.implicitWidth)
+ compare(control.implicitBackgroundHeight, control.background.implicitHeight)
control.background = rectangle.createObject(control, {implicitWidth: 400, implicitHeight: 200})
compare(control.implicitWidth, 400)
compare(control.implicitHeight, 200)
- compare(implicitWidthSpy.count, 1)
- compare(implicitHeightSpy.count, 1)
+ compare(control.implicitBackgroundWidth, 400)
+ compare(control.implicitBackgroundHeight, 200)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, ++implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, ++implicitBackgroundHeightChanges)
control.background = null
compare(control.implicitWidth, control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
- compare(implicitWidthSpy.count, 2)
- compare(implicitHeightSpy.count, 2)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, ++implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, ++implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, ++implicitBackgroundHeightChanges)
control.text = "TextField"
compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
- compare(implicitWidthSpy.count, 3)
- compare(implicitHeightSpy.count, 2)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, ++implicitWidthChanges)
+ compare(implicitHeightSpy.count, implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
control.placeholderText = "..."
- verify(control.implicitWidth < control.contentWidth + control.leftPadding + control.rightPadding)
+ compare(control.implicitWidth, control.contentWidth + control.leftPadding + control.rightPadding)
compare(control.implicitHeight, control.contentHeight + control.topPadding + control.bottomPadding)
- compare(implicitWidthSpy.count, 4)
- compare(implicitHeightSpy.count, 2)
+ compare(control.implicitBackgroundWidth, 0)
+ compare(control.implicitBackgroundHeight, 0)
+ compare(implicitWidthSpy.count, implicitWidthChanges)
+ compare(implicitHeightSpy.count, implicitHeightChanges)
+ compare(implicitBackgroundWidthSpy.count, implicitBackgroundWidthChanges)
+ compare(implicitBackgroundHeightSpy.count, implicitBackgroundHeightChanges)
}
function test_alignment_data() {
@@ -435,4 +470,167 @@ TestCase {
mouseClick(control, control.width / 2, control.height / 2, Qt.LeftButton | Qt.RightButton)
compare(control.selectedText, "")
}
+
+ // QTBUG-66260
+ function test_placeholderTextColor() {
+ var control = createTemporaryObject(textField, testCase)
+ verify(control)
+
+ // usually default value should not be pure opacue black
+ verify(control.placeholderTextColor !== "#ff000000")
+ control.placeholderTextColor = "#12345678"
+ compare(control.placeholderTextColor, "#12345678")
+
+ for (var i = 0; i < control.children.length; ++i) {
+ if (control.children[i].hasOwnProperty("text"))
+ compare(control.children[i].color, control.placeholderTextColor) // placeholder.color
+ }
+ }
+
+ function test_inset() {
+ var control = createTemporaryObject(textField, testCase, {background: rectangle.createObject(control)})
+ verify(control)
+
+ var topInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "topInsetChanged"})
+ verify(topInsetSpy.valid)
+
+ var leftInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "leftInsetChanged"})
+ verify(leftInsetSpy.valid)
+
+ var rightInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "rightInsetChanged"})
+ verify(rightInsetSpy.valid)
+
+ var bottomInsetSpy = createTemporaryObject(signalSpy, testCase, {target: control, signalName: "bottomInsetChanged"})
+ verify(bottomInsetSpy.valid)
+
+ var topInsetChanges = 0
+ var leftInsetChanges = 0
+ var rightInsetChanges = 0
+ var bottomInsetChanges = 0
+
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+
+ control.width = 100
+ control.height = 100
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+
+ control.topInset = 10
+ compare(control.topInset, 10)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 10)
+ compare(control.background.width, 100)
+ compare(control.background.height, 90)
+
+ control.leftInset = 20
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 80)
+ compare(control.background.height, 90)
+
+ control.rightInset = 30
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 90)
+
+ control.bottomInset = 40
+ compare(control.topInset, 10)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 10)
+ compare(control.background.width, 50)
+ compare(control.background.height, 50)
+
+ control.topInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 20)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, ++topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 20)
+ compare(control.background.y, 0)
+ compare(control.background.width, 50)
+ compare(control.background.height, 60)
+
+ control.leftInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 30)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, ++leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 70)
+ compare(control.background.height, 60)
+
+ control.rightInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 40)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, ++rightInsetChanges)
+ compare(bottomInsetSpy.count, bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 60)
+
+ control.bottomInset = undefined
+ compare(control.topInset, 0)
+ compare(control.leftInset, 0)
+ compare(control.rightInset, 0)
+ compare(control.bottomInset, 0)
+ compare(topInsetSpy.count, topInsetChanges)
+ compare(leftInsetSpy.count, leftInsetChanges)
+ compare(rightInsetSpy.count, rightInsetChanges)
+ compare(bottomInsetSpy.count, ++bottomInsetChanges)
+ compare(control.background.x, 0)
+ compare(control.background.y, 0)
+ compare(control.background.width, 100)
+ compare(control.background.height, 100)
+ }
+
}
diff --git a/tests/auto/controls/data/tst_toolbar.qml b/tests/auto/controls/data/tst_toolbar.qml
index 085c491d..c0f0845c 100644
--- a/tests/auto/controls/data/tst_toolbar.qml
+++ b/tests/auto/controls/data/tst_toolbar.qml
@@ -106,6 +106,8 @@ TestCase {
verify(control.contentItem)
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
}
function test_oneChild() {
@@ -114,6 +116,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth >= 100)
verify(control.implicitHeight >= 30)
}
@@ -124,6 +128,8 @@ TestCase {
compare(control.contentWidth, 0)
compare(control.contentHeight, 0)
+ compare(control.implicitContentWidth, 0)
+ compare(control.implicitContentHeight, 0)
verify(control.implicitWidth >= 0)
verify(control.implicitHeight >= 0)
}
@@ -134,6 +140,8 @@ TestCase {
compare(control.contentWidth, 100)
compare(control.contentHeight, 30)
+ compare(control.implicitContentWidth, 100)
+ compare(control.implicitContentHeight, 30)
verify(control.implicitWidth >= 100)
verify(control.implicitHeight >= 30)
}
diff --git a/tests/auto/controls/data/tst_tooltip.qml b/tests/auto/controls/data/tst_tooltip.qml
index e7cc6787..99b6ee14 100644
--- a/tests/auto/controls/data/tst_tooltip.qml
+++ b/tests/auto/controls/data/tst_tooltip.qml
@@ -329,4 +329,22 @@ TestCase {
verify(tooltip.visible)
}
}
+
+ Component {
+ id: nonAttachedToolTipComponent
+ ToolTip { }
+ }
+
+ function test_nonAttachedToolTipShowAndHide() {
+ var tip = createTemporaryObject(nonAttachedToolTipComponent, testCase)
+ verify(tip)
+ tip.show("hello");
+ verify(tip.visible)
+ verify(tip.text === "hello")
+ tip.hide()
+ tryCompare(tip, "visible", false)
+ tip.show("delay", 200)
+ verify(tip.visible)
+ tryCompare(tip, "visible", false)
+ }
}
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index d668fac0..18f63ed4 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -107,6 +107,10 @@ TestCase {
return Qt.point(tumblerXCenter(), yCenter);
}
+ function itemTopLeftPos(visualItemIndex) {
+ return Qt.point(tumbler.leftPadding, tumbler.topPadding + (tumblerDelegateHeight * visualItemIndex));
+ }
+
function checkItemSizes() {
var contentChildren = tumbler.wrap ? tumblerView.children : tumblerView.contentItem.children;
verify(contentChildren.length >= tumbler.count);
@@ -131,6 +135,21 @@ TestCase {
return null;
}
+ function findDelegateWithText(parent, text) {
+ for (var i = 0; i < parent.children.length; ++i) {
+ var child = parent.children[i];
+ if (child.hasOwnProperty("text") && child.text === text) {
+ return child;
+ }
+
+ var grandChild = findDelegateWithText(child, text);
+ if (grandChild)
+ return grandChild;
+ }
+
+ return null;
+ }
+
property Component noAttachedPropertiesDelegate: Text {
text: modelData
}
@@ -1010,8 +1029,8 @@ TestCase {
if (data.bottom !== undefined)
tumbler.bottomPadding = data.bottom;
- compare(tumbler.availableWidth, implicitTumblerWidth - tumbler.leftPadding - tumbler.rightPadding);
- compare(tumbler.availableHeight, implicitTumblerHeight - tumbler.topPadding - tumbler.bottomPadding);
+ compare(tumbler.availableWidth, tumbler.implicitWidth - tumbler.leftPadding - tumbler.rightPadding);
+ compare(tumbler.availableHeight, tumbler.implicitHeight - tumbler.topPadding - tumbler.bottomPadding);
compare(tumbler.contentItem.x, tumbler.leftPadding);
compare(tumbler.contentItem.y, tumbler.topPadding);
@@ -1107,6 +1126,51 @@ TestCase {
compare(label.text, "2");
}
+ function test_positionViewAtIndex_data() {
+ return [
+ // Should be 20, 21, ... but there is a documented limitation for this in positionViewAtIndex()'s docs.
+ { tag: "wrap=true, mode=Beginning", wrap: true, mode: Tumbler.Beginning, expectedVisibleIndices: [21, 22, 23, 24, 25] },
+ { tag: "wrap=true, mode=Center", wrap: true, mode: Tumbler.Center, expectedVisibleIndices: [18, 19, 20, 21, 22] },
+ { tag: "wrap=true, mode=End", wrap: true, mode: Tumbler.End, expectedVisibleIndices: [16, 17, 18, 19, 20] },
+ // Same as Beginning; should start at 20.
+ { tag: "wrap=true, mode=Contain", wrap: true, mode: Tumbler.Contain, expectedVisibleIndices: [21, 22, 23, 24, 25] },
+ { tag: "wrap=true, mode=SnapPosition", wrap: true, mode: Tumbler.SnapPosition, expectedVisibleIndices: [18, 19, 20, 21, 22] },
+ { tag: "wrap=false, mode=Beginning", wrap: false, mode: Tumbler.Beginning, expectedVisibleIndices: [20, 21, 22, 23, 24] },
+ { tag: "wrap=false, mode=Center", wrap: false, mode: Tumbler.Center, expectedVisibleIndices: [18, 19, 20, 21, 22] },
+ { tag: "wrap=false, mode=End", wrap: false, mode: Tumbler.End, expectedVisibleIndices: [16, 17, 18, 19, 20] },
+ { tag: "wrap=false, mode=Visible", wrap: false, mode: Tumbler.Visible, expectedVisibleIndices: [16, 17, 18, 19, 20] },
+ { tag: "wrap=false, mode=Contain", wrap: false, mode: Tumbler.Contain, expectedVisibleIndices: [16, 17, 18, 19, 20] },
+ { tag: "wrap=false, mode=SnapPosition", wrap: false, mode: Tumbler.SnapPosition, expectedVisibleIndices: [18, 19, 20, 21, 22] }
+ ]
+ }
+
+ function test_positionViewAtIndex(data) {
+ createTumbler({ wrap: data.wrap, model: 40, visibleItemCount: 5 })
+ compare(tumbler.wrap, data.wrap)
+
+ waitForRendering(tumbler)
+
+ tumbler.positionViewAtIndex(20, data.mode)
+ tryCompare(tumbler, "moving", false)
+
+ compare(tumbler.visibleItemCount, 5)
+ for (var i = 0; i < 5; ++i) {
+ // Find the item through its text, as that's easier than child/itemAt().
+ var text = data.expectedVisibleIndices[i].toString()
+ var item = findDelegateWithText(tumblerView, text)
+ verify(item, "found no item with text \"" + text + "\"")
+ compare(item.text, data.expectedVisibleIndices[i].toString())
+
+ // Ensure that it's at the position we expect.
+ var expectedPos = itemTopLeftPos(i)
+ var actualPos = testCase.mapFromItem(item, 0, 0)
+ compare(actualPos.x, expectedPos.x, "expected delegate with text " + item.text
+ + " to have an x pos of " + expectedPos.x + " but it was " + actualPos.x)
+ compare(actualPos.y, expectedPos.y, "expected delegate with text " + item.text
+ + " to have an y pos of " + expectedPos.y + " but it was " + actualPos.y)
+ }
+ }
+
Component {
id: setCurrentIndexOnImperativeModelChangeComponent
diff --git a/tests/auto/controls/default/BLACKLIST b/tests/auto/controls/default/BLACKLIST
new file mode 100644
index 00000000..1e63fcb0
--- /dev/null
+++ b/tests/auto/controls/default/BLACKLIST
@@ -0,0 +1,3 @@
+[Popup::test_shortcut]
+opensuse ci
+opensuse-leap ci
diff --git a/tests/auto/font/tst_font.cpp b/tests/auto/font/tst_font.cpp
index 75942286..cd41be91 100644
--- a/tests/auto/font/tst_font.cpp
+++ b/tests/auto/font/tst_font.cpp
@@ -45,7 +45,7 @@
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p_p.h>
using namespace QQuickVisualTestUtil;
@@ -85,6 +85,8 @@ static QFont testFont()
void tst_font::systemFont()
{
+ QSKIP("QTBUG-70063: qmlClearTypeRegistrations() call causes crash");
+
const QFont *originalSystemFont = QGuiApplicationPrivate::platformTheme()->font(QPlatformTheme::SystemFont);
if (!originalSystemFont)
QSKIP("Cannot test the system font on a minimal platform");
@@ -217,95 +219,85 @@ void tst_font::inheritance()
QCOMPARE(grandChild->property("font").value<QFont>(), windowFont);
}
-class TestFontTheme : public QQuickProxyTheme
+class TestFontTheme : public QQuickTheme
{
public:
- TestFontTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme)
- {
- std::fill(fonts, fonts + QPlatformTheme::NFonts, static_cast<QFont *>(0));
+ static const int NFonts = QQuickTheme::Tumbler + 1;
- for (int i = QPlatformTheme::SystemFont; i < QPlatformTheme::NFonts; ++i) {
+ TestFontTheme()
+ {
+ for (int i = 0; i < NFonts; ++i) {
QFont font = QFont();
font.setPixelSize(i + 10);
- fonts[i] = new QFont(font);
+ setFont(static_cast<Scope>(i), font);
}
-
- QGuiApplicationPrivate::platform_theme = this;
- }
-
- const QFont *font(Font type = SystemFont) const override
- {
- return fonts[type];
}
-
-private:
- QFont *fonts[QPlatformTheme::NFonts];
};
-Q_DECLARE_METATYPE(QPlatformTheme::Font)
+Q_DECLARE_METATYPE(QQuickTheme::Scope)
void tst_font::defaultFont_data()
{
QTest::addColumn<QString>("control");
- QTest::addColumn<QPlatformTheme::Font>("fontType");
-
- QTest::newRow("AbstractButton") << "AbstractButton" << QPlatformTheme::SystemFont;
- QTest::newRow("ApplicationWindow") << "ApplicationWindow" << QPlatformTheme::SystemFont;
- QTest::newRow("Button") << "Button" << QPlatformTheme::PushButtonFont;
- QTest::newRow("CheckBox") << "CheckBox" << QPlatformTheme::CheckBoxFont;
- QTest::newRow("CheckDelegate") << "CheckDelegate" << QPlatformTheme::ListViewFont;
- QTest::newRow("ComboBox") << "ComboBox" << QPlatformTheme::ComboMenuItemFont;
- QTest::newRow("Container") << "Container" << QPlatformTheme::SystemFont;
- QTest::newRow("Control") << "Control" << QPlatformTheme::SystemFont;
- QTest::newRow("Dial") << "Dial" << QPlatformTheme::SystemFont;
- QTest::newRow("Dialog") << "Dialog" << QPlatformTheme::SystemFont;
- QTest::newRow("DialogButtonBox") << "DialogButtonBox" << QPlatformTheme::SystemFont;
- QTest::newRow("Drawer") << "Drawer" << QPlatformTheme::SystemFont;
- QTest::newRow("Frame") << "Frame" << QPlatformTheme::SystemFont;
- QTest::newRow("GroupBox") << "GroupBox" << QPlatformTheme::GroupBoxTitleFont;
- QTest::newRow("ItemDelegate") << "ItemDelegate" << QPlatformTheme::ItemViewFont;
- QTest::newRow("Label") << "Label" << QPlatformTheme::LabelFont;
- QTest::newRow("Menu") << "Menu" << QPlatformTheme::MenuFont;
- QTest::newRow("MenuItem") << "MenuItem" << QPlatformTheme::MenuItemFont;
- QTest::newRow("MenuSeparator") << "MenuSeparator" << QPlatformTheme::SystemFont;
- QTest::newRow("Page") << "Page" << QPlatformTheme::SystemFont;
- QTest::newRow("Pane") << "Pane" << QPlatformTheme::SystemFont;
- QTest::newRow("Popup") << "Popup" << QPlatformTheme::SystemFont;
- QTest::newRow("ProgressBar") << "ProgressBar" << QPlatformTheme::SystemFont;
- QTest::newRow("RadioButton") << "RadioButton" << QPlatformTheme::RadioButtonFont;
- QTest::newRow("RadioDelegate") << "RadioDelegate" << QPlatformTheme::ListViewFont;
- QTest::newRow("RangeSlider") << "RangeSlider" << QPlatformTheme::SystemFont;
- QTest::newRow("RoundButton") << "RoundButton" << QPlatformTheme::PushButtonFont;
- QTest::newRow("ScrollBar") << "ScrollBar" << QPlatformTheme::SystemFont;
- QTest::newRow("ScrollIndicator") << "ScrollIndicator" << QPlatformTheme::SystemFont;
- QTest::newRow("Slider") << "Slider" << QPlatformTheme::SystemFont;
- QTest::newRow("SpinBox") << "SpinBox" << QPlatformTheme::EditorFont;
- QTest::newRow("SwipeDelegate") << "SwipeDelegate" << QPlatformTheme::ListViewFont;
- QTest::newRow("Switch") << "Switch" << QPlatformTheme::SystemFont; // ### TODO: add QPlatformTheme::SwitchFont
- QTest::newRow("SwitchDelegate") << "SwitchDelegate" << QPlatformTheme::ListViewFont;
- QTest::newRow("TabBar") << "TabBar" << QPlatformTheme::SystemFont;
- QTest::newRow("TabButton") << "TabButton" << QPlatformTheme::TabButtonFont;
- QTest::newRow("TextArea") << "TextArea" << QPlatformTheme::EditorFont;
- QTest::newRow("TextField") << "TextField" << QPlatformTheme::EditorFont;
- QTest::newRow("ToolBar") << "ToolBar" << QPlatformTheme::SystemFont;
- QTest::newRow("ToolButton") << "ToolButton" << QPlatformTheme::ToolButtonFont;
- QTest::newRow("ToolSeparator") << "ToolSeparator" << QPlatformTheme::SystemFont;
- QTest::newRow("ToolTip") << "ToolTip" << QPlatformTheme::TipLabelFont;
- QTest::newRow("Tumbler") << "Tumbler" << QPlatformTheme::ItemViewFont;
+ QTest::addColumn<QQuickTheme::Scope>("scope");
+
+ QTest::newRow("AbstractButton") << "AbstractButton" << QQuickTheme::System;
+ QTest::newRow("ApplicationWindow") << "ApplicationWindow" << QQuickTheme::System;
+ QTest::newRow("Button") << "Button" << QQuickTheme::Button;
+ QTest::newRow("CheckBox") << "CheckBox" << QQuickTheme::CheckBox;
+ QTest::newRow("CheckDelegate") << "CheckDelegate" << QQuickTheme::ListView;
+ QTest::newRow("ComboBox") << "ComboBox" << QQuickTheme::ComboBox;
+ QTest::newRow("Container") << "Container" << QQuickTheme::System;
+ QTest::newRow("Control") << "Control" << QQuickTheme::System;
+ QTest::newRow("Dial") << "Dial" << QQuickTheme::System;
+ QTest::newRow("Dialog") << "Dialog" << QQuickTheme::System;
+ QTest::newRow("DialogButtonBox") << "DialogButtonBox" << QQuickTheme::System;
+ QTest::newRow("Drawer") << "Drawer" << QQuickTheme::System;
+ QTest::newRow("Frame") << "Frame" << QQuickTheme::System;
+ QTest::newRow("GroupBox") << "GroupBox" << QQuickTheme::GroupBox;
+ QTest::newRow("ItemDelegate") << "ItemDelegate" << QQuickTheme::ItemView;
+ QTest::newRow("Label") << "Label" << QQuickTheme::Label;
+ QTest::newRow("Menu") << "Menu" << QQuickTheme::Menu;
+ QTest::newRow("MenuItem") << "MenuItem" << QQuickTheme::Menu;
+ QTest::newRow("MenuSeparator") << "MenuSeparator" << QQuickTheme::Menu;
+ QTest::newRow("Page") << "Page" << QQuickTheme::System;
+ QTest::newRow("Pane") << "Pane" << QQuickTheme::System;
+ QTest::newRow("Popup") << "Popup" << QQuickTheme::System;
+ QTest::newRow("ProgressBar") << "ProgressBar" << QQuickTheme::System;
+ QTest::newRow("RadioButton") << "RadioButton" << QQuickTheme::RadioButton;
+ QTest::newRow("RadioDelegate") << "RadioDelegate" << QQuickTheme::ListView;
+ QTest::newRow("RangeSlider") << "RangeSlider" << QQuickTheme::System;
+ QTest::newRow("RoundButton") << "RoundButton" << QQuickTheme::Button;
+ QTest::newRow("ScrollBar") << "ScrollBar" << QQuickTheme::System;
+ QTest::newRow("ScrollIndicator") << "ScrollIndicator" << QQuickTheme::System;
+ QTest::newRow("Slider") << "Slider" << QQuickTheme::System;
+ QTest::newRow("SpinBox") << "SpinBox" << QQuickTheme::SpinBox;
+ QTest::newRow("SwipeDelegate") << "SwipeDelegate" << QQuickTheme::ListView;
+ QTest::newRow("Switch") << "Switch" << QQuickTheme::Switch;
+ QTest::newRow("SwitchDelegate") << "SwitchDelegate" << QQuickTheme::ListView;
+ QTest::newRow("TabBar") << "TabBar" << QQuickTheme::TabBar;
+ QTest::newRow("TabButton") << "TabButton" << QQuickTheme::TabBar;
+ QTest::newRow("TextArea") << "TextArea" << QQuickTheme::TextArea;
+ QTest::newRow("TextField") << "TextField" << QQuickTheme::TextField;
+ QTest::newRow("ToolBar") << "ToolBar" << QQuickTheme::ToolBar;
+ QTest::newRow("ToolButton") << "ToolButton" << QQuickTheme::ToolBar;
+ QTest::newRow("ToolSeparator") << "ToolSeparator" << QQuickTheme::ToolBar;
+ QTest::newRow("ToolTip") << "ToolTip" << QQuickTheme::ToolTip;
+ QTest::newRow("Tumbler") << "Tumbler" << QQuickTheme::Tumbler;
}
void tst_font::defaultFont()
{
QFETCH(QString, control);
- QFETCH(QPlatformTheme::Font, fontType);
+ QFETCH(QQuickTheme::Scope, scope);
QQmlEngine engine;
QQmlComponent component(&engine);
component.setData(QString("import QtQuick.Controls 2.2; %1 { }").arg(control).toUtf8(), QUrl());
- // The call to setData() above causes QQuickDefaultTheme to be set as the platform theme,
+ // The call to setData() above causes QQuickDefaultTheme to be set as the current theme,
// so we must make sure we only set our theme afterwards.
- TestFontTheme theme(QGuiApplicationPrivate::platform_theme);
+ QQuickThemePrivate::instance.reset(new TestFontTheme);
QScopedPointer<QObject> object(component.create());
QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
@@ -313,16 +305,9 @@ void tst_font::defaultFont()
QVariant var = object->property("font");
QVERIFY(var.isValid());
- const QFont *expectedFont = theme.font(fontType);
- QVERIFY(expectedFont);
-
+ QFont expectedFont = QQuickTheme::font(scope);
QFont actualFont = var.value<QFont>();
-
- if (actualFont != *expectedFont) {
- qDebug() << QTest::currentDataTag() << actualFont << *expectedFont;
- }
-
- QCOMPARE(actualFont, *expectedFont);
+ QCOMPARE(actualFont, expectedFont);
}
void tst_font::listView_data()
diff --git a/tests/auto/palette/tst_palette.cpp b/tests/auto/palette/tst_palette.cpp
index f74e358a..e91fd732 100644
--- a/tests/auto/palette/tst_palette.cpp
+++ b/tests/auto/palette/tst_palette.cpp
@@ -38,7 +38,6 @@
#include "../shared/visualtestutil.h"
#include <QtGui/qpalette.h>
-#include <QtGui/qpa/qplatformtheme.h>
#include <QtGui/private/qguiapplication_p.h>
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
@@ -46,7 +45,7 @@
#include <QtQuickTemplates2/private/qquickcontrol_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p_p.h>
using namespace QQuickVisualTestUtil;
@@ -88,7 +87,7 @@ void tst_palette::palette_data()
QTest::addColumn<QString>("testFile");
QTest::addColumn<QPalette>("expectedPalette");
- QPalette defaultPalette = QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette);
+ QPalette defaultPalette = QQuickTheme::palette(QQuickTheme::System);
defaultPalette.setColor(QPalette::Base, QColor("#efefef"));
defaultPalette.setColor(QPalette::Text, QColor("#101010"));
@@ -172,7 +171,7 @@ void tst_palette::inheritance()
QObject *grandChild = window->property("grandChild").value<QObject *>();
QVERIFY(control && child && grandChild);
- QPalette defaultPalette = QQuickControlPrivate::themePalette(QPlatformTheme::SystemPalette);
+ QPalette defaultPalette = QQuickTheme::palette(QQuickTheme::System);
defaultPalette.setColor(QPalette::Base, QColor("#efefef"));
defaultPalette.setColor(QPalette::Text, QColor("#101010"));
@@ -217,148 +216,92 @@ void tst_palette::inheritance()
QCOMPARE(grandChild->property("palette").value<QPalette>(), windowPalette);
}
-class TestTheme : public QQuickProxyTheme
+class TestTheme : public QQuickTheme
{
public:
- TestTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme)
- {
- std::fill(palettes, palettes + QPlatformTheme::NPalettes, static_cast<QPalette *>(0));
-
- QPalette palette = QPalette();
- palette.setColor(QPalette::Window, Qt::gray);
- palettes[QPlatformTheme::SystemPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::ToolTipBase, Qt::yellow);
- palettes[QPlatformTheme::ToolTipPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::ButtonText, Qt::blue);
- palettes[QPlatformTheme::ToolButtonPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::Button, Qt::red);
- palettes[QPlatformTheme::ButtonPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::Text, Qt::green);
- palettes[QPlatformTheme::CheckBoxPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::Text, Qt::blue);
- palettes[QPlatformTheme::RadioButtonPalette] = new QPalette(palette);
-
- // HeaderPalette unused
-
- palette.setColor(QPalette::Base, Qt::darkGray);
- palettes[QPlatformTheme::ComboBoxPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::Base, Qt::lightGray);
- palettes[QPlatformTheme::ItemViewPalette] = new QPalette(palette);
-
- // MessageBoxLabelPalette unused
-
- palette.setColor(QPalette::ButtonText, Qt::white);
- palettes[QPlatformTheme::TabBarPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::WindowText, Qt::darkGray);
- palettes[QPlatformTheme::LabelPalette] = new QPalette(palette);
+ static const int NPalettes = QQuickTheme::Tumbler + 1;
- palette.setColor(QPalette::Mid, Qt::gray);
- palettes[QPlatformTheme::GroupBoxPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::Shadow, Qt::darkYellow);
- palettes[QPlatformTheme::MenuPalette] = new QPalette(palette);
-
- // MenuBarPalette unused
-
- palette.setColor(QPalette::Base, Qt::cyan);
- palettes[QPlatformTheme::TextEditPalette] = new QPalette(palette);
-
- palette.setColor(QPalette::Base, Qt::magenta);
- palettes[QPlatformTheme::TextLineEditPalette] = new QPalette(palette);
-
- QGuiApplicationPrivate::platform_theme = this;
- }
-
- const QPalette *palette(Palette type = SystemPalette) const override
+ TestTheme()
{
- return palettes[type];
+ for (int i = 0; i < NPalettes; ++i)
+ setPalette(static_cast<Scope>(i), QPalette(QColor::fromRgb(i)));
}
-
-private:
- QPalette *palettes[QPlatformTheme::NPalettes];
};
-Q_DECLARE_METATYPE(QPlatformTheme::Palette)
+Q_DECLARE_METATYPE(QQuickTheme::Scope)
void tst_palette::defaultPalette_data()
{
QTest::addColumn<QString>("control");
- QTest::addColumn<QPlatformTheme::Palette>("paletteType");
-
- QTest::newRow("AbstractButton") << "AbstractButton" << QPlatformTheme::SystemPalette;
- QTest::newRow("ApplicationWindow") << "ApplicationWindow" << QPlatformTheme::SystemPalette;
- QTest::newRow("Button") << "Button" << QPlatformTheme::ButtonPalette;
- QTest::newRow("CheckBox") << "CheckBox" << QPlatformTheme::CheckBoxPalette;
- QTest::newRow("CheckDelegate") << "CheckDelegate" << QPlatformTheme::ItemViewPalette;
- QTest::newRow("ComboBox") << "ComboBox" << QPlatformTheme::ComboBoxPalette;
- QTest::newRow("Container") << "Container" << QPlatformTheme::SystemPalette;
- QTest::newRow("Control") << "Control" << QPlatformTheme::SystemPalette;
- QTest::newRow("Dial") << "Dial" << QPlatformTheme::SystemPalette;
- QTest::newRow("Dialog") << "Dialog" << QPlatformTheme::SystemPalette;
- QTest::newRow("DialogButtonBox") << "DialogButtonBox" << QPlatformTheme::SystemPalette;
- QTest::newRow("Drawer") << "Drawer" << QPlatformTheme::SystemPalette;
- QTest::newRow("Frame") << "Frame" << QPlatformTheme::SystemPalette;
- QTest::newRow("GroupBox") << "GroupBox" << QPlatformTheme::GroupBoxPalette;
- QTest::newRow("ItemDelegate") << "ItemDelegate" << QPlatformTheme::ItemViewPalette;
- QTest::newRow("Label") << "Label" << QPlatformTheme::LabelPalette;
- QTest::newRow("Menu") << "Menu" << QPlatformTheme::MenuPalette;
- QTest::newRow("MenuItem") << "MenuItem" << QPlatformTheme::MenuPalette;
- QTest::newRow("MenuSeparator") << "MenuSeparator" << QPlatformTheme::MenuPalette;
- QTest::newRow("Page") << "Page" << QPlatformTheme::SystemPalette;
- QTest::newRow("Pane") << "Pane" << QPlatformTheme::SystemPalette;
- QTest::newRow("Popup") << "Popup" << QPlatformTheme::SystemPalette;
- QTest::newRow("ProgressBar") << "ProgressBar" << QPlatformTheme::SystemPalette;
- QTest::newRow("RadioButton") << "RadioButton" << QPlatformTheme::RadioButtonPalette;
- QTest::newRow("RadioDelegate") << "RadioDelegate" << QPlatformTheme::ItemViewPalette;
- QTest::newRow("RangeSlider") << "RangeSlider" << QPlatformTheme::SystemPalette;
- QTest::newRow("RoundButton") << "RoundButton" << QPlatformTheme::ButtonPalette;
- QTest::newRow("ScrollBar") << "ScrollBar" << QPlatformTheme::SystemPalette;
- QTest::newRow("ScrollIndicator") << "ScrollIndicator" << QPlatformTheme::SystemPalette;
- QTest::newRow("Slider") << "Slider" << QPlatformTheme::SystemPalette;
- QTest::newRow("SpinBox") << "SpinBox" << QPlatformTheme::TextLineEditPalette;
- QTest::newRow("SwipeDelegate") << "SwipeDelegate" << QPlatformTheme::ItemViewPalette;
- QTest::newRow("Switch") << "Switch" << QPlatformTheme::CheckBoxPalette; // ### TODO: add QPlatformTheme::SwitchPalette
- QTest::newRow("SwitchDelegate") << "SwitchDelegate" << QPlatformTheme::ItemViewPalette;
- QTest::newRow("TabBar") << "TabBar" << QPlatformTheme::TabBarPalette;
- QTest::newRow("TabButton") << "TabButton" << QPlatformTheme::TabBarPalette;
- QTest::newRow("TextArea") << "TextArea" << QPlatformTheme::TextEditPalette;
- QTest::newRow("TextField") << "TextField" << QPlatformTheme::TextLineEditPalette;
- QTest::newRow("ToolBar") << "ToolBar" << QPlatformTheme::ToolButtonPalette;
- QTest::newRow("ToolButton") << "ToolButton" << QPlatformTheme::ToolButtonPalette;
- QTest::newRow("ToolSeparator") << "ToolSeparator" << QPlatformTheme::ToolButtonPalette;
- QTest::newRow("ToolTip") << "ToolTip" << QPlatformTheme::ToolTipPalette;
- QTest::newRow("Tumbler") << "Tumbler" << QPlatformTheme::ItemViewPalette;
+ QTest::addColumn<QQuickTheme::Scope>("scope");
+
+ QTest::newRow("AbstractButton") << "AbstractButton" << QQuickTheme::System;
+ QTest::newRow("ApplicationWindow") << "ApplicationWindow" << QQuickTheme::System;
+ QTest::newRow("Button") << "Button" << QQuickTheme::Button;
+ QTest::newRow("CheckBox") << "CheckBox" << QQuickTheme::CheckBox;
+ QTest::newRow("CheckDelegate") << "CheckDelegate" << QQuickTheme::ListView;
+ QTest::newRow("ComboBox") << "ComboBox" << QQuickTheme::ComboBox;
+ QTest::newRow("Container") << "Container" << QQuickTheme::System;
+ QTest::newRow("Control") << "Control" << QQuickTheme::System;
+ QTest::newRow("Dial") << "Dial" << QQuickTheme::System;
+ QTest::newRow("Dialog") << "Dialog" << QQuickTheme::System;
+ QTest::newRow("DialogButtonBox") << "DialogButtonBox" << QQuickTheme::System;
+ QTest::newRow("Drawer") << "Drawer" << QQuickTheme::System;
+ QTest::newRow("Frame") << "Frame" << QQuickTheme::System;
+ QTest::newRow("GroupBox") << "GroupBox" << QQuickTheme::GroupBox;
+ QTest::newRow("ItemDelegate") << "ItemDelegate" << QQuickTheme::ItemView;
+ QTest::newRow("Label") << "Label" << QQuickTheme::Label;
+ QTest::newRow("Menu") << "Menu" << QQuickTheme::Menu;
+ QTest::newRow("MenuItem") << "MenuItem" << QQuickTheme::Menu;
+ QTest::newRow("MenuSeparator") << "MenuSeparator" << QQuickTheme::Menu;
+ QTest::newRow("Page") << "Page" << QQuickTheme::System;
+ QTest::newRow("Pane") << "Pane" << QQuickTheme::System;
+ QTest::newRow("Popup") << "Popup" << QQuickTheme::System;
+ QTest::newRow("ProgressBar") << "ProgressBar" << QQuickTheme::System;
+ QTest::newRow("RadioButton") << "RadioButton" << QQuickTheme::RadioButton;
+ QTest::newRow("RadioDelegate") << "RadioDelegate" << QQuickTheme::ListView;
+ QTest::newRow("RangeSlider") << "RangeSlider" << QQuickTheme::System;
+ QTest::newRow("RoundButton") << "RoundButton" << QQuickTheme::Button;
+ QTest::newRow("ScrollBar") << "ScrollBar" << QQuickTheme::System;
+ QTest::newRow("ScrollIndicator") << "ScrollIndicator" << QQuickTheme::System;
+ QTest::newRow("Slider") << "Slider" << QQuickTheme::System;
+ QTest::newRow("SpinBox") << "SpinBox" << QQuickTheme::SpinBox;
+ QTest::newRow("SwipeDelegate") << "SwipeDelegate" << QQuickTheme::ListView;
+ QTest::newRow("Switch") << "Switch" << QQuickTheme::Switch;
+ QTest::newRow("SwitchDelegate") << "SwitchDelegate" << QQuickTheme::ListView;
+ QTest::newRow("TabBar") << "TabBar" << QQuickTheme::TabBar;
+ QTest::newRow("TabButton") << "TabButton" << QQuickTheme::TabBar;
+ QTest::newRow("TextArea") << "TextArea" << QQuickTheme::TextArea;
+ QTest::newRow("TextField") << "TextField" << QQuickTheme::TextField;
+ QTest::newRow("ToolBar") << "ToolBar" << QQuickTheme::ToolBar;
+ QTest::newRow("ToolButton") << "ToolButton" << QQuickTheme::ToolBar;
+ QTest::newRow("ToolSeparator") << "ToolSeparator" << QQuickTheme::ToolBar;
+ QTest::newRow("ToolTip") << "ToolTip" << QQuickTheme::ToolTip;
+ QTest::newRow("Tumbler") << "Tumbler" << QQuickTheme::Tumbler;
}
void tst_palette::defaultPalette()
{
QFETCH(QString, control);
- QFETCH(QPlatformTheme::Palette, paletteType);
-
- TestTheme theme(QGuiApplicationPrivate::platform_theme);
+ QFETCH(QQuickTheme::Scope, scope);
QQmlEngine engine;
QQmlComponent component(&engine);
component.setData(QString("import QtQuick.Controls 2.3; %1 { }").arg(control).toUtf8(), QUrl());
+ // The call to setData() above causes QQuickDefaultTheme to be set as the current theme,
+ // so we must make sure we only set our theme afterwards.
+ QQuickThemePrivate::instance.reset(new TestTheme);
+
QScopedPointer<QObject> object(component.create());
QVERIFY2(!object.isNull(), qPrintable(component.errorString()));
QVariant var = object->property("palette");
QVERIFY(var.isValid());
- const QPalette *expectedPalette = theme.palette(paletteType);
- QVERIFY(expectedPalette);
-
+ QPalette expectedPalette = QQuickTheme::palette(scope);
QPalette actualPalette = var.value<QPalette>();
- QCOMPARE(actualPalette, *expectedPalette);
+ QCOMPARE(actualPalette, expectedPalette);
}
void tst_palette::listView_data()
diff --git a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp
index aeeddb10..dec32e36 100644
--- a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp
+++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp
@@ -50,7 +50,7 @@
#include <QtQuickTemplates2/private/qquickpopup_p.h>
#include <QtQuickTemplates2/private/qquicktextarea_p.h>
#include <QtQuickTemplates2/private/qquicktextfield_p.h>
-#include <QtQuickControls2/private/qquickproxytheme_p.h>
+#include <QtQuickTemplates2/private/qquicktheme_p_p.h>
#include "../shared/util.h"
#include "../shared/visualtestutil.h"
@@ -555,24 +555,18 @@ void tst_QQuickApplicationWindow::font()
QCOMPARE(item6->font(), font);
}
-class TestTheme : public QQuickProxyTheme
+class TestTheme : public QQuickTheme
{
public:
- TestTheme(QPlatformTheme *theme) : QQuickProxyTheme(theme), m_font("Courier")
- { QGuiApplicationPrivate::platform_theme = this; }
-
- const QFont *font(Font type = SystemFont) const override
+ TestTheme()
{
- Q_UNUSED(type);
- return &m_font;
+ setFont(System, QFont("Courier"));
}
-
- QFont m_font;
};
void tst_QQuickApplicationWindow::defaultFont()
{
- TestTheme theme(QGuiApplicationPrivate::platform_theme);
+ QQuickThemePrivate::instance.reset(new TestTheme);
QQmlEngine engine;
QQmlComponent component(&engine);
@@ -581,7 +575,7 @@ void tst_QQuickApplicationWindow::defaultFont()
QScopedPointer<QQuickApplicationWindow> window;
window.reset(static_cast<QQuickApplicationWindow *>(component.create()));
QVERIFY(!window.isNull());
- QCOMPARE(window->font(), *theme.font());
+ QCOMPARE(window->font(), QQuickTheme::font(QQuickTheme::System));
}
void tst_QQuickApplicationWindow::locale()
diff --git a/tests/auto/qquickmaterialstyleconf/data/applicationwindow.qml b/tests/auto/qquickmaterialstyleconf/data/applicationwindow.qml
index 65196393..9a31966f 100644
--- a/tests/auto/qquickmaterialstyleconf/data/applicationwindow.qml
+++ b/tests/auto/qquickmaterialstyleconf/data/applicationwindow.qml
@@ -57,8 +57,13 @@ ApplicationWindow {
height: 400
property alias label: label
+ property alias button: button
Label {
id: label
}
+
+ Button {
+ id: button
+ }
}
diff --git a/tests/auto/qquickmaterialstyleconf/qquickmaterialstyleconf.qrc b/tests/auto/qquickmaterialstyleconf/qquickmaterialstyleconf.qrc
index 53ba6450..49219139 100644
--- a/tests/auto/qquickmaterialstyleconf/qquickmaterialstyleconf.qrc
+++ b/tests/auto/qquickmaterialstyleconf/qquickmaterialstyleconf.qrc
@@ -1,5 +1,7 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>qtquickcontrols2.conf</file>
-</qresource>
+<RCC>
+ <qresource prefix="/">
+ <file>qtquickcontrols2.conf</file>
+ <file>variant-dense.conf</file>
+ <file>variant-normal.conf</file>
+ </qresource>
</RCC>
diff --git a/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp b/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp
index 17d1ea6d..72136445 100644
--- a/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp
+++ b/tests/auto/qquickmaterialstyleconf/tst_qquickmaterialstyleconf.cpp
@@ -36,6 +36,7 @@
#include <qtest.h>
#include <QtQuick/private/qquickitem_p.h>
+#include <QtQuickControls2/private/qquickstyle_p.h>
#include "../shared/util.h"
#include "../shared/visualtestutil.h"
@@ -49,6 +50,8 @@ public:
private slots:
void conf();
+ void variants_data();
+ void variants();
};
void tst_qquickmaterialstyleconf::conf()
@@ -73,6 +76,45 @@ void tst_qquickmaterialstyleconf::conf()
QCOMPARE(label->property("font").value<QFont>(), customFont);
}
+void tst_qquickmaterialstyleconf::variants_data()
+{
+ QTest::addColumn<QByteArray>("confPath");
+ QTest::addColumn<int>("expectedButtonHeight");
+ // Just to ensure that the correct conf is loaded.
+ QTest::addColumn<QColor>("expectedColor");
+
+ // (36 button height + 12 touchable area)
+ QTest::newRow("normal") << QByteArray(":/variant-normal.conf") << 48 << QColor::fromRgb(0x123456);
+ // We specified a custom variant (dense), so the button should be small.
+ // (32 button height + 12 touchable area)
+ QTest::newRow("dense") << QByteArray(":/variant-dense.conf") << 44 << QColor::fromRgb(0x789abc);
+}
+
+void tst_qquickmaterialstyleconf::variants()
+{
+ QFETCH(QByteArray, confPath);
+ QFETCH(int, expectedButtonHeight);
+ QFETCH(QColor, expectedColor);
+
+ qmlClearTypeRegistrations();
+ QQuickStylePrivate::reset();
+ qputenv("QT_QUICK_CONTROLS_CONF", confPath);
+
+ QQuickApplicationHelper helper(this, QLatin1String("applicationwindow.qml"));
+
+ QQuickApplicationWindow *window = helper.appWindow;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickItem *label = window->property("label").value<QQuickItem*>();
+ QVERIFY(label);
+ QCOMPARE(label->property("color").value<QColor>(), expectedColor);
+
+ QQuickItem *button = window->property("button").value<QQuickItem*>();
+ QVERIFY(button);
+ QCOMPARE(button->height(), expectedButtonHeight);
+}
+
QTEST_MAIN(tst_qquickmaterialstyleconf)
#include "tst_qquickmaterialstyleconf.moc"
diff --git a/tests/auto/qquickmaterialstyleconf/variant-dense.conf b/tests/auto/qquickmaterialstyleconf/variant-dense.conf
new file mode 100644
index 00000000..6636894e
--- /dev/null
+++ b/tests/auto/qquickmaterialstyleconf/variant-dense.conf
@@ -0,0 +1,6 @@
+[Controls]
+Style=Material
+
+[Material]
+Variant=Dense
+Foreground=#789abc
diff --git a/tests/auto/qquickmaterialstyleconf/variant-normal.conf b/tests/auto/qquickmaterialstyleconf/variant-normal.conf
new file mode 100644
index 00000000..08778e92
--- /dev/null
+++ b/tests/auto/qquickmaterialstyleconf/variant-normal.conf
@@ -0,0 +1,6 @@
+[Controls]
+Style=Material
+
+[Material]
+Variant=Normal
+Foreground=#123456
diff --git a/tests/auto/qquickmenu/tst_qquickmenu.cpp b/tests/auto/qquickmenu/tst_qquickmenu.cpp
index adb3d7aa..27cd8aaa 100644
--- a/tests/auto/qquickmenu/tst_qquickmenu.cpp
+++ b/tests/auto/qquickmenu/tst_qquickmenu.cpp
@@ -124,7 +124,7 @@ void tst_QQuickMenu::count()
QCOMPARE(menu->count(), 1);
QCOMPARE(countSpy.count(), 3);
- QQuickItem *item = menu->takeItem(0);
+ QScopedPointer<QQuickItem> item(menu->takeItem(0));
QVERIFY(item);
QCOMPARE(menu->count(), 0);
QCOMPARE(countSpy.count(), 4);
diff --git a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp
index 1d5844ee..cfcdee5e 100644
--- a/tests/auto/qquickmenubar/tst_qquickmenubar.cpp
+++ b/tests/auto/qquickmenubar/tst_qquickmenubar.cpp
@@ -45,6 +45,7 @@
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
#include <QtQuickTemplates2/private/qquickmenu_p.h>
#include <QtQuickTemplates2/private/qquickmenubar_p.h>
+#include <QtQuickTemplates2/private/qquickmenubar_p_p.h>
#include <QtQuickTemplates2/private/qquickmenubaritem_p.h>
#include <QtQuickTemplates2/private/qquickmenuitem_p.h>
@@ -107,6 +108,13 @@ void tst_qquickmenubar::mouse()
QQuickMenuBarItem *viewMenuBarItem = qobject_cast<QQuickMenuBarItem *>(viewMenuBarMenu->parentItem());
QQuickMenuBarItem *helpMenuBarItem = qobject_cast<QQuickMenuBarItem *>(helpMenuBarMenu->parentItem());
QVERIFY(fileMenuBarItem && editMenuBarItem && viewMenuBarItem && helpMenuBarItem);
+ // Something about postponing delegate creation to component completion
+ // means that the fileMenuBarItem->isHighlighted() check below fails occasionally.
+ // Give it a chance to sort itself out before sending move events.
+ QQuickMenuBarPrivate *menuBarPrivate = QQuickMenuBarPrivate::get(menuBar);
+ menuBar->polish();
+ QVERIFY(menuBarPrivate->polishScheduled);
+ QTRY_VERIFY(!menuBarPrivate->polishScheduled);
// highlight a menubar item
QTest::mouseMove(window.data(), fileMenuBarItem->mapToScene(QPointF(fileMenuBarItem->width() / 2, fileMenuBarItem->height() / 2)).toPoint());
diff --git a/tests/auto/qquickninepatchimage/tst_qquickninepatchimage.cpp b/tests/auto/qquickninepatchimage/tst_qquickninepatchimage.cpp
index b5dd7f2f..5a62c00a 100644
--- a/tests/auto/qquickninepatchimage/tst_qquickninepatchimage.cpp
+++ b/tests/auto/qquickninepatchimage/tst_qquickninepatchimage.cpp
@@ -210,11 +210,20 @@ void tst_qquickninepatchimage::implicitSize_data()
QTest::addColumn<QString>("file");
QTest::addColumn<QSizeF>("implicitSize");
- const QStringList files = QStringList() << "foo.9.png" << "padding.9.png" << "inset-all.9.png" << "inset-topleft.9.png" << "inset-bottomright.9.png";
-
- for (const QString &file : files) {
+ const struct TestFile {
+ QString name;
+ QSizeF sizeHint;
+ } testFiles [] = {
+ { "foo.9.png", QSizeF(40, 40) },
+ { "padding.9.png", QSizeF(40, 40) },
+ { "inset-all.9.png", QSizeF(45, 45) },
+ { "inset-topleft.9.png", QSizeF(42, 41) },
+ { "inset-bottomright.9.png", QSizeF(43, 44) }
+ };
+
+ for (const TestFile &file : testFiles) {
for (int dpr = 1; dpr <= 4; ++dpr)
- QTest::newRow(qPrintable(QString::fromLatin1("%1 DPR=%2").arg(file).arg(dpr))) << dpr << file << QSizeF(40, 40);
+ QTest::newRow(qPrintable(QString::fromLatin1("%1 DPR=%2").arg(file.name).arg(dpr))) << dpr << file.name << file.sizeHint;
}
}
diff --git a/tests/auto/qquickstyle/data/DummyStyle/Button.qml b/tests/auto/qquickstyle/data/dummyStyles/DummyStyle/Button.qml
index 5b08222c..5b08222c 100644
--- a/tests/auto/qquickstyle/data/DummyStyle/Button.qml
+++ b/tests/auto/qquickstyle/data/dummyStyles/DummyStyle/Button.qml
diff --git a/tests/auto/qquickstyle/qquickstyle.pro b/tests/auto/qquickstyle/qquickstyle.pro
index 983e5438..ef1dd2e0 100644
--- a/tests/auto/qquickstyle/qquickstyle.pro
+++ b/tests/auto/qquickstyle/qquickstyle.pro
@@ -18,3 +18,11 @@ RESOURCES += qrcStyles1
qrcStyles2.files = $$files(qrcStyles2/QrcStyle2/*.qml)
qrcStyles2.prefix = /
RESOURCES += qrcStyles2
+
+qrcStyles3.files = $$files(qrcStyles3/QrcStyle3/*.qml)
+qrcStyles3.prefix = /
+RESOURCES += qrcStyles3
+
+qrcStyles4.files = $$files(qrcStyles4/QrcStyle4/*.qml)
+qrcStyles4.prefix = /
+RESOURCES += qrcStyles4
diff --git a/tests/auto/qquickstyle/qrcStyles3/QrcStyle3/Button.qml b/tests/auto/qquickstyle/qrcStyles3/QrcStyle3/Button.qml
new file mode 100644
index 00000000..5b08222c
--- /dev/null
+++ b/tests/auto/qquickstyle/qrcStyles3/QrcStyle3/Button.qml
@@ -0,0 +1,2 @@
+import QtQuick.Templates 2.0 as T
+T.Button { }
diff --git a/tests/auto/qquickstyle/qrcStyles4/QrcStyle4/Button.qml b/tests/auto/qquickstyle/qrcStyles4/QrcStyle4/Button.qml
new file mode 100644
index 00000000..5b08222c
--- /dev/null
+++ b/tests/auto/qquickstyle/qrcStyles4/QrcStyle4/Button.qml
@@ -0,0 +1,2 @@
+import QtQuick.Templates 2.0 as T
+T.Button { }
diff --git a/tests/auto/qquickstyle/tst_qquickstyle.cpp b/tests/auto/qquickstyle/tst_qquickstyle.cpp
index 8b2358f8..8d09a293 100644
--- a/tests/auto/qquickstyle/tst_qquickstyle.cpp
+++ b/tests/auto/qquickstyle/tst_qquickstyle.cpp
@@ -55,6 +55,8 @@ private slots:
void commandLineArgument();
void environmentVariables();
void availableStyles();
+ void qrcStylePaths_data();
+ void qrcStylePaths();
void qrcInQtQuickControlsStylePathEnvVar_data();
void qrcInQtQuickControlsStylePathEnvVar();
@@ -154,8 +156,8 @@ void tst_QQuickStyle::availableStyles()
{
QString path = QFINDTESTDATA("data");
QVERIFY(!path.isEmpty());
- qputenv("QT_QUICK_CONTROLS_STYLE_PATH", path.toLocal8Bit());
+ QQuickStyle::addStylePath(path);
QStringList paths = QQuickStylePrivate::stylePaths();
QVERIFY(paths.contains(path));
@@ -170,6 +172,43 @@ void tst_QQuickStyle::availableStyles()
}
}
+void tst_QQuickStyle::qrcStylePaths_data()
+{
+ QTest::addColumn<QString>("stylePath");
+ QTest::addColumn<QString>("expectedStyleName");
+
+ QTest::addRow("qrc:/qrcStyles1") << QString::fromLatin1("qrc:/qrcStyles1") << QString::fromLatin1("QrcStyle1");
+ QTest::addRow(":/qrcStyles2") << QString::fromLatin1(":/qrcStyles2") << QString::fromLatin1("QrcStyle2");
+}
+
+void tst_QQuickStyle::qrcStylePaths()
+{
+ QFETCH(QString, stylePath);
+ QFETCH(QString, expectedStyleName);
+
+ QQuickStyle::addStylePath(stylePath);
+
+ const QStringList paths = QQuickStylePrivate::stylePaths();
+ QString expectedStylePath = stylePath;
+ if (expectedStylePath.startsWith(QLatin1String("qrc")))
+ expectedStylePath.remove(0, 3);
+ if (!paths.contains(expectedStylePath)) {
+ QString message;
+ QDebug stream(&message);
+ stream.nospace() << "QQuickStylePrivate::stylePaths() doesn't contain " << expectedStylePath << ":\n" << paths;
+ QFAIL(qPrintable(message));
+ }
+
+ const QStringList styles = QQuickStyle::availableStyles();
+ QVERIFY(!styles.isEmpty());
+ if (!styles.contains(expectedStyleName)) {
+ QString message;
+ QDebug stream(&message);
+ stream.nospace() << "QQuickStyle::availableStyles() doesn't contain " << expectedStyleName << ":\n" << styles;
+ QFAIL(qPrintable(message));
+ }
+}
+
void tst_QQuickStyle::qrcInQtQuickControlsStylePathEnvVar_data()
{
QTest::addColumn<QString>("environmentVariable");
@@ -181,13 +220,15 @@ void tst_QQuickStyle::qrcInQtQuickControlsStylePathEnvVar_data()
{
QString environmentVariable;
QDebug stream(&environmentVariable);
+ // We use qrcStyles3 and qrcStyles4 in order to not conflict with
+ // qrcStylePaths(), since we currently have no way of clearing customStylePaths.
stream.noquote().nospace() << "/some/bogus/path/" << listSeparator
- << ":/qrcStyles1";
+ << ":/qrcStyles3";
QStringList expectedAvailableStyles = defaultAvailableStyles;
- // We need to move the Default style to the start of the list,
+ // We need to keep the Default style at the start of the list,
// as that's what availableStyles() does.
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle1"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle3"));
QTest::addRow("%s", qPrintable(environmentVariable))
<< environmentVariable << expectedAvailableStyles;
@@ -196,11 +237,11 @@ void tst_QQuickStyle::qrcInQtQuickControlsStylePathEnvVar_data()
{
QString environmentVariable;
QDebug stream(&environmentVariable);
- stream.noquote().nospace() << ":/qrcStyles2" << listSeparator
+ stream.noquote().nospace() << ":/qrcStyles4" << listSeparator
<< "/some/bogus/path";
QStringList expectedAvailableStyles = defaultAvailableStyles;
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle2"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle4"));
QTest::addRow("%s", qPrintable(environmentVariable))
<< environmentVariable << expectedAvailableStyles;
@@ -209,14 +250,14 @@ void tst_QQuickStyle::qrcInQtQuickControlsStylePathEnvVar_data()
{
QString environmentVariable;
QDebug stream(&environmentVariable);
- stream.noquote().nospace() << ":/qrcStyles1" << listSeparator
- << ":/qrcStyles2" << listSeparator
- << QFINDTESTDATA("data");
+ stream.noquote().nospace() << ":/qrcStyles3" << listSeparator
+ << ":/qrcStyles4" << listSeparator
+ << QFINDTESTDATA("data/dummyStyles");
QStringList expectedAvailableStyles = defaultAvailableStyles;
expectedAvailableStyles.insert(1, QLatin1String("DummyStyle"));
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle2"));
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle1"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle4"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle3"));
QTest::addRow("%s", qPrintable(environmentVariable))
<< environmentVariable << expectedAvailableStyles;
@@ -225,13 +266,13 @@ void tst_QQuickStyle::qrcInQtQuickControlsStylePathEnvVar_data()
{
QString environmentVariable;
QDebug stream(&environmentVariable);
- stream.noquote().nospace() << QFINDTESTDATA("data") << listSeparator
- << ":/qrcStyles1" << listSeparator
- << ":/qrcStyles2";
+ stream.noquote().nospace() << QFINDTESTDATA("data/dummyStyles") << listSeparator
+ << ":/qrcStyles3" << listSeparator
+ << ":/qrcStyles4";
QStringList expectedAvailableStyles = defaultAvailableStyles;
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle2"));
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle1"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle4"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle3"));
expectedAvailableStyles.insert(1, QLatin1String("DummyStyle"));
QTest::addRow("%s", qPrintable(environmentVariable))
@@ -243,13 +284,13 @@ void tst_QQuickStyle::qrcInQtQuickControlsStylePathEnvVar_data()
QDebug stream(&environmentVariable);
// Same as the last row, except it adds a superfluous separator
// to ensure that it handles it gracefully rather than failing an assertion.
- stream.noquote().nospace() << QFINDTESTDATA("data") << listSeparator
- << ":/qrcStyles1" << listSeparator
- << ":/qrcStyles2" << listSeparator;
+ stream.noquote().nospace() << QFINDTESTDATA("data/dummyStyles") << listSeparator
+ << ":/qrcStyles3" << listSeparator
+ << ":/qrcStyles4" << listSeparator;
QStringList expectedAvailableStyles = defaultAvailableStyles;
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle2"));
- expectedAvailableStyles.insert(1, QLatin1String("QrcStyle1"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle4"));
+ expectedAvailableStyles.insert(1, QLatin1String("QrcStyle3"));
expectedAvailableStyles.insert(1, QLatin1String("DummyStyle"));
QTest::addRow("%s", qPrintable(environmentVariable))
diff --git a/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp b/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp
index e90a8bd9..ce2e2e99 100644
--- a/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp
+++ b/tests/auto/qquickstyleselector/tst_qquickstyleselector.cpp
@@ -96,7 +96,7 @@ void tst_QQuickStyleSelector::select_data()
QTest::newRow("nosuch/label") << "Label.qml" << "NoSuchStyle" << "data" << "" << testFileUrl("Label.qml").toString();
QTest::newRow("/nosuch/label") << "Label.qml" << "NoSuchStyle" << dataDirectory() << "" << testFileUrl("Label.qml").toString();
- QTest::newRow("label->base") << "Label.qml" << "" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
+ QTest::newRow("label->base") << "Label.qml" << "" << "data" << "FallbackStyle" << testFileUrl("Label.qml").toString();
QTest::newRow("/label->base") << "Label.qml" << "" << dataDirectory() << "FallbackStyle" << testFileUrl("Label.qml").toString();
QTest::newRow("fs/label->base") << "Label.qml" << "FileSystemStyle" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
QTest::newRow("/fs/label->base") << "Label.qml" << "FileSystemStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("FallbackStyle/Label.qml").toString();
@@ -115,7 +115,7 @@ void tst_QQuickStyleSelector::select_data()
QTest::newRow("nosuch/button") << "Button.qml" << "NoSuchStyle" << "data" << "" << testFileUrl("Button.qml").toString();
QTest::newRow("/nosuch/button") << "Button.qml" << "NoSuchStyle" << dataDirectory() << "" << testFileUrl("Button.qml").toString();
- QTest::newRow("button->base") << "Button.qml" << "" << "data" << "FallbackStyle" << testFileUrl("FallbackStyle/Button.qml").toString();
+ QTest::newRow("button->base") << "Button.qml" << "" << "data" << "FallbackStyle" << testFileUrl("Button.qml").toString();
QTest::newRow("/button->base") << "Button.qml" << "" << dataDirectory() << "FallbackStyle" << testFileUrl("Button.qml").toString();
QTest::newRow("fs/button->base") << "Button.qml" << "FileSystemStyle" << "data" << "FallbackStyle" << testFileUrl("FileSystemStyle/Button.qml").toString();
QTest::newRow("/fs/button->base") << "Button.qml" << "FileSystemStyle" << dataDirectory() << "FallbackStyle" << testFileUrl("FileSystemStyle/Button.qml").toString();
@@ -137,7 +137,9 @@ void tst_QQuickStyleSelector::select()
QQuickStyle::setFallbackStyle(fallback);
QQuickStyleSelector selector;
- selector.setBaseUrl(dataDirectoryUrl());
+ selector.addSelector(style);
+ selector.addSelector(fallback);
+ selector.setPaths(QStringList() << dataDirectory() << ":/");
QCOMPARE(selector.select(file), expected);
}
@@ -146,7 +148,8 @@ void tst_QQuickStyleSelector::platformSelectors()
QQuickStyle::setStyle(QDir(dataDirectory()).filePath("PlatformStyle"));
QQuickStyleSelector selector;
- selector.setBaseUrl(dataDirectoryUrl());
+ selector.addSelector("PlatformStyle");
+ selector.setPaths(QStringList() << dataDirectory());
#if defined(Q_OS_LINUX)
QCOMPARE(selector.select("Button.qml"), testFileUrl("PlatformStyle/+linux/Button.qml").toString());
diff --git a/tests/auto/sanity/sanity.pro b/tests/auto/sanity/sanity.pro
index 50030e80..c792c073 100644
--- a/tests/auto/sanity/sanity.pro
+++ b/tests/auto/sanity/sanity.pro
@@ -5,7 +5,7 @@ QT += qml testlib core-private qml-private
CONFIG += testcase
macos:CONFIG -= app_bundle
-DEFINES += QQC2_IMPORT_PATH=\\\"$$QQC2_SOURCE_TREE/src/imports\\\"
+include(../../auto/shared/util.pri)
SOURCES += \
$$PWD/tst_sanity.cpp
diff --git a/tests/auto/sanity/tst_sanity.cpp b/tests/auto/sanity/tst_sanity.cpp
index df440ebd..69553d93 100644
--- a/tests/auto/sanity/tst_sanity.cpp
+++ b/tests/auto/sanity/tst_sanity.cpp
@@ -43,6 +43,9 @@
#include <QtQml/private/qqmljsast_p.h>
#include <QtQml/private/qqmljsastvisitor_p.h>
#include <QtQml/private/qqmlmetatype_p.h>
+#include "../../auto/shared/visualtestutil.h"
+
+using namespace QQuickVisualTestUtil;
Q_GLOBAL_STATIC(QObjectList, qt_qobjects)
@@ -329,42 +332,6 @@ void tst_Sanity::ids_data()
QTest::newRow(qPrintable(it.key())) << it.key() << it.value();
}
-static void addTestRows(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList())
-{
- // We cannot use QQmlComponent to load QML files directly from the source tree.
- // For styles that use internal QML types (eg. material/Ripple.qml), the source
- // dir would be added as an "implicit" import path overriding the actual import
- // path (qtbase/qml/QtQuick/Controls.2/Material). => The QML engine fails to load
- // the style C++ plugin from the implicit import path (the source dir).
- //
- // Therefore we only use the source tree for finding out the set of QML files that
- // a particular style implements, and then we locate the respective QML files in
- // the engine's import path. This way we can use QQmlComponent to load each QML file
- // for benchmarking.
-
- const QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files);
- for (const QFileInfo &entry : entries) {
- QString name = entry.baseName();
- if (!skiplist.contains(name)) {
- const auto importPathList = engine->importPathList();
- for (const QString &importPath : importPathList) {
- QString name = entry.dir().dirName() + "/" + entry.fileName();
- QString filePath = importPath + "/" + targetPath + "/" + entry.fileName();
- if (QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
- break;
- } else {
- filePath = QQmlFile::urlToLocalFileOrQrc(filePath);
- if (!filePath.isEmpty() && QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl(filePath);
- break;
- }
- }
- }
- }
- }
-}
-
void tst_Sanity::attachedObjects()
{
QFETCH(QUrl, url);
@@ -388,11 +355,11 @@ void tst_Sanity::attachedObjects()
void tst_Sanity::attachedObjects_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "calendar", "Qt/labs/calendar");
- addTestRows(&engine, "controls", "QtQuick/Controls.2");
- addTestRows(&engine, "controls/fusion", "QtQuick/Controls.2", QStringList() << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
- addTestRows(&engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
- addTestRows(&engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
+ addTestRowForEachControl(&engine, "calendar", "Qt/labs/calendar");
+ addTestRowForEachControl(&engine, "controls", "QtQuick/Controls.2");
+ addTestRowForEachControl(&engine, "controls/fusion", "QtQuick/Controls.2", QStringList() << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
+ addTestRowForEachControl(&engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
+ addTestRowForEachControl(&engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
}
QTEST_MAIN(tst_Sanity)
diff --git a/tests/auto/shared/util.pri b/tests/auto/shared/util.pri
index 77c2cc59..16f37f8a 100644
--- a/tests/auto/shared/util.pri
+++ b/tests/auto/shared/util.pri
@@ -7,3 +7,4 @@ SOURCES += $$PWD/visualtestutil.cpp \
$$PWD/util.cpp
DEFINES += QT_QMLTEST_DATADIR=\\\"$${_PRO_FILE_PWD_}/data\\\"
+DEFINES += QQC2_IMPORT_PATH=\\\"$$QQC2_SOURCE_TREE/src/imports\\\"
diff --git a/tests/auto/shared/visualtestutil.cpp b/tests/auto/shared/visualtestutil.cpp
index c5e69812..3eaaa588 100644
--- a/tests/auto/shared/visualtestutil.cpp
+++ b/tests/auto/shared/visualtestutil.cpp
@@ -40,6 +40,8 @@
#include <QtCore/QDebug>
#include <QtGui/QCursor>
#include <QtCore/QCoreApplication>
+#include <QtQml/QQmlFile>
+#include <QtTest/QTest>
bool QQuickVisualTestUtil::delegateVisible(QQuickItem *item)
{
@@ -92,3 +94,42 @@ void QQuickVisualTestUtil::centerOnScreen(QQuickWindow *window)
const QPoint offset = QPoint(window->width() / 2, window->height() / 2);
window->setFramePosition(screenGeometry.center() - offset);
}
+
+void QQuickVisualTestUtil::addTestRowForEachControl(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist)
+{
+ // We cannot use QQmlComponent to load QML files directly from the source tree.
+ // For styles that use internal QML types (eg. material/Ripple.qml), the source
+ // dir would be added as an "implicit" import path overriding the actual import
+ // path (qtbase/qml/QtQuick/Controls.2/Material). => The QML engine fails to load
+ // the style C++ plugin from the implicit import path (the source dir).
+ //
+ // Therefore we only use the source tree for finding out the set of QML files that
+ // a particular style implements, and then we locate the respective QML files in
+ // the engine's import path. This way we can use QQmlComponent to load each QML file
+ // for benchmarking.
+
+ const QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files);
+ for (const QFileInfo &entry : entries) {
+ QString name = entry.baseName();
+ if (!skiplist.contains(name)) {
+ const auto importPathList = engine->importPathList();
+ for (const QString &importPath : importPathList) {
+ QString name = entry.dir().dirName() + "/" + entry.fileName();
+ QString filePath = importPath + "/" + targetPath + "/" + entry.fileName();
+ if (filePath.startsWith(":"))
+ filePath.prepend("qrc");
+ if (QFile::exists(filePath)) {
+ QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
+ break;
+ } else {
+ QUrl url(filePath);
+ filePath = QQmlFile::urlToLocalFileOrQrc(filePath);
+ if (!filePath.isEmpty() && QFile::exists(filePath)) {
+ QTest::newRow(qPrintable(name)) << url;
+ break;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/shared/visualtestutil.h b/tests/auto/shared/visualtestutil.h
index a6b52fef..d5e651c5 100644
--- a/tests/auto/shared/visualtestutil.h
+++ b/tests/auto/shared/visualtestutil.h
@@ -136,6 +136,8 @@ namespace QQuickVisualTestUtil
QQuickApplicationWindow *appWindow;
QQuickWindow *window;
};
+
+ void addTestRowForEachControl(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList());
}
#define QQUICK_VERIFY_POLISH(item) \
diff --git a/tests/benchmarks/creationtime/creationtime.pro b/tests/benchmarks/creationtime/creationtime.pro
index 4c11c2e6..a594027e 100644
--- a/tests/benchmarks/creationtime/creationtime.pro
+++ b/tests/benchmarks/creationtime/creationtime.pro
@@ -5,7 +5,7 @@ QT += qml testlib
CONFIG += testcase
macos:CONFIG -= app_bundle
-DEFINES += QQC2_IMPORT_PATH=\\\"$$QQC2_SOURCE_TREE/src/imports\\\"
+include(../../auto/shared/util.pri)
SOURCES += \
tst_creationtime.cpp
diff --git a/tests/benchmarks/creationtime/tst_creationtime.cpp b/tests/benchmarks/creationtime/tst_creationtime.cpp
index 1d300b1c..41d7224d 100644
--- a/tests/benchmarks/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/creationtime/tst_creationtime.cpp
@@ -37,6 +37,10 @@
#include <QtQml>
#include <QtTest>
+#include "../../auto/shared/visualtestutil.h"
+
+using namespace QQuickVisualTestUtil;
+
class tst_CreationTime : public QObject
{
Q_OBJECT
@@ -71,42 +75,6 @@ void tst_CreationTime::init()
engine.clearComponentCache();
}
-static void addTestRows(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList())
-{
- // We cannot use QQmlComponent to load QML files directly from the source tree.
- // For styles that use internal QML types (eg. material/Ripple.qml), the source
- // dir would be added as an "implicit" import path overriding the actual import
- // path (qtbase/qml/QtQuick/Controls.2/Material). => The QML engine fails to load
- // the style C++ plugin from the implicit import path (the source dir).
- //
- // Therefore we only use the source tree for finding out the set of QML files that
- // a particular style implements, and then we locate the respective QML files in
- // the engine's import path. This way we can use QQmlComponent to load each QML file
- // for benchmarking.
-
- const QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files);
- for (const QFileInfo &entry : entries) {
- QString name = entry.baseName();
- if (!skiplist.contains(name)) {
- const auto importPathList = engine->importPathList();
- for (const QString &importPath : importPathList) {
- QString name = entry.dir().dirName() + "/" + entry.fileName();
- QString filePath = importPath + "/" + targetPath + "/" + entry.fileName();
- if (QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
- break;
- } else {
- filePath = QQmlFile::urlToLocalFileOrQrc(filePath);
- if (!filePath.isEmpty() && QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl(filePath);
- break;
- }
- }
- }
- }
- }
-}
-
static void doBenchmark(QQmlEngine *engine, const QUrl &url)
{
QQmlComponent component(engine);
@@ -131,7 +99,7 @@ void tst_CreationTime::controls()
void tst_CreationTime::controls_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "controls", "QtQuick/Controls.2", QStringList() << "ApplicationWindow");
+ addTestRowForEachControl(&engine, "controls", "QtQuick/Controls.2", QStringList() << "ApplicationWindow");
}
void tst_CreationTime::fusion()
@@ -143,7 +111,7 @@ void tst_CreationTime::fusion()
void tst_CreationTime::fusion_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "controls/fusion", "QtQuick/Controls.2/Fusion", QStringList() << "ApplicationWindow" << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
+ addTestRowForEachControl(&engine, "controls/fusion", "QtQuick/Controls.2/Fusion", QStringList() << "ApplicationWindow" << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
}
void tst_CreationTime::imagine()
@@ -155,7 +123,7 @@ void tst_CreationTime::imagine()
void tst_CreationTime::imagine_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "controls/imagine", "QtQuick/Controls.2/Imagine", QStringList() << "ApplicationWindow");
+ addTestRowForEachControl(&engine, "controls/imagine", "QtQuick/Controls.2/Imagine", QStringList() << "ApplicationWindow");
}
void tst_CreationTime::material()
@@ -167,7 +135,7 @@ void tst_CreationTime::material()
void tst_CreationTime::material_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "ApplicationWindow" << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
+ addTestRowForEachControl(&engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "ApplicationWindow" << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
}
void tst_CreationTime::universal()
@@ -179,7 +147,7 @@ void tst_CreationTime::universal()
void tst_CreationTime::universal_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "ApplicationWindow" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
+ addTestRowForEachControl(&engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "ApplicationWindow" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
}
void tst_CreationTime::calendar()
@@ -191,7 +159,7 @@ void tst_CreationTime::calendar()
void tst_CreationTime::calendar_data()
{
QTest::addColumn<QUrl>("url");
- addTestRows(&engine, "calendar", "Qt/labs/calendar");
+ addTestRowForEachControl(&engine, "calendar", "Qt/labs/calendar");
}
QTEST_MAIN(tst_CreationTime)
diff --git a/tests/benchmarks/objectcount/objectcount.pro b/tests/benchmarks/objectcount/objectcount.pro
index 3d7d411b..046bfc45 100644
--- a/tests/benchmarks/objectcount/objectcount.pro
+++ b/tests/benchmarks/objectcount/objectcount.pro
@@ -5,7 +5,7 @@ QT += quick testlib core-private
CONFIG += testcase
macos:CONFIG -= app_bundle
-DEFINES += QQC2_IMPORT_PATH=\\\"$$QQC2_SOURCE_TREE/src/imports\\\"
+include(../../auto/shared/util.pri)
SOURCES += \
tst_objectcount.cpp
diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp
index fcb6be5b..c37469c3 100644
--- a/tests/benchmarks/objectcount/tst_objectcount.cpp
+++ b/tests/benchmarks/objectcount/tst_objectcount.cpp
@@ -38,6 +38,9 @@
#include <QtQuick>
#include <QtCore/private/qhooks_p.h>
#include <iostream>
+#include "../../auto/shared/visualtestutil.h"
+
+using namespace QQuickVisualTestUtil;
static int qt_verbose = qgetenv("VERBOSE").toInt() != 0;
@@ -88,49 +91,13 @@ void tst_ObjectCount::cleanup()
qtHookData[QHooks::RemoveQObject] = 0;
}
-static void addTestRows(QQmlEngine *engine, const QString &sourcePath, const QString &targetPath, const QStringList &skiplist = QStringList())
-{
- // We cannot use QQmlComponent to load QML files directly from the source tree.
- // For styles that use internal QML types (eg. material/Ripple.qml), the source
- // dir would be added as an "implicit" import path overriding the actual import
- // path (qtbase/qml/QtQuick/Controls.2/Material). => The QML engine fails to load
- // the style C++ plugin from the implicit import path (the source dir).
- //
- // Therefore we only use the source tree for finding out the set of QML files that
- // a particular style implements, and then we locate the respective QML files in
- // the engine's import path. This way we can use QQmlComponent to load each QML file
- // for benchmarking.
-
- const QFileInfoList entries = QDir(QQC2_IMPORT_PATH "/" + sourcePath).entryInfoList(QStringList("*.qml"), QDir::Files);
- for (const QFileInfo &entry : entries) {
- QString name = entry.baseName();
- if (!skiplist.contains(name)) {
- const auto importPathList = engine->importPathList();
- for (const QString &importPath : importPathList) {
- QString name = entry.dir().dirName() + "/" + entry.fileName();
- QString filePath = importPath + "/" + targetPath + "/" + entry.fileName();
- if (QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl::fromLocalFile(filePath);
- break;
- } else {
- filePath = QQmlFile::urlToLocalFileOrQrc(filePath);
- if (!filePath.isEmpty() && QFile::exists(filePath)) {
- QTest::newRow(qPrintable(name)) << QUrl(filePath);
- break;
- }
- }
- }
- }
- }
-}
-
static void initTestRows(QQmlEngine *engine)
{
- addTestRows(engine, "controls", "QtQuick/Controls.2");
- addTestRows(engine, "controls/fusion", "QtQuick/Controls.2/Fusion", QStringList() << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
- addTestRows(engine, "controls/imagine", "QtQuick/Controls.2/Imagine");
- addTestRows(engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
- addTestRows(engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
+ addTestRowForEachControl(engine, "controls", "QtQuick/Controls.2");
+ addTestRowForEachControl(engine, "controls/fusion", "QtQuick/Controls.2/Fusion", QStringList() << "ButtonPanel" << "CheckIndicator" << "RadioIndicator" << "SliderGroove" << "SliderHandle" << "SwitchIndicator");
+ addTestRowForEachControl(engine, "controls/imagine", "QtQuick/Controls.2/Imagine");
+ addTestRowForEachControl(engine, "controls/material", "QtQuick/Controls.2/Material", QStringList() << "Ripple" << "SliderHandle" << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator" << "BoxShadow" << "ElevationEffect" << "CursorDelegate");
+ addTestRowForEachControl(engine, "controls/universal", "QtQuick/Controls.2/Universal", QStringList() << "CheckIndicator" << "RadioIndicator" << "SwitchIndicator");
}
template <typename T>
diff --git a/tests/manual/screenshots/qtquickcontrols2.conf b/tests/manual/screenshots/qtquickcontrols2.conf
index b6c7c87e..d2081db1 100644
--- a/tests/manual/screenshots/qtquickcontrols2.conf
+++ b/tests/manual/screenshots/qtquickcontrols2.conf
@@ -1,2 +1,5 @@
[Controls]
Style=Material
+
+[Material]
+;Variant=Dense
diff --git a/tests/manual/screenshots/screenshots.qml b/tests/manual/screenshots/screenshots.qml
index 2b031dce..20275b17 100644
--- a/tests/manual/screenshots/screenshots.qml
+++ b/tests/manual/screenshots/screenshots.qml
@@ -58,7 +58,7 @@ ApplicationWindow {
title: "Qt Quick Controls 2 - Screenshots"
visible: true
width: Math.max(600, loader.implicitWidth)
- height: Math.max(600, loader.implicitHeight)
+ height: Math.max(600, loader.implicitHeight + header.implicitHeight + footer.implicitHeight)
property string currentFilePath
property url lastSaveUrl