aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/qquickmaterialstyle.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Material: use 8 px vertical padding for ItemDelegateMitch Curtis2018-02-211-5/+0
| | | | | | | | | | All of the other delegates also use 8 px vertical padding. This prevents ItemDelegate from being eager to grow to 49 pixels on certain platforms with slightly larger text heights, like macOS on a MacBook Pro. Change-Id: Id1d6e10af5f0e9c7e9e772bf1d667e32f97c17d7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Add Dense Material style variant for desktopMitch Curtis2018-02-191-11/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current Material style is based on the mobile variant of the design, which is far too large for desktop applications. From https://material.io/guidelines/components/lists.html#lists-usage: "When the mouse and keyboard are the primary input methods, measurements may be condensed to accommodate denser layouts." This patch adds a dense variant of the style where most controls like buttons and delegates are smaller in height and use smaller font sizes. Note that the Material design guidelines seem to distinguish between mobile, desktop and dense measurements, where "dense" seems to be a specialization of desktop. We cannot afford to/do not see sense in maintaining three separate variants, so the dense variant will be the only desktop version of the Material style. [ChangeLog][Material] Added Dense variant of the Material style for use on desktop platforms. Some controls are slightly smaller in height and use smaller font sizes. The variant can be enabled by setting QT_QUICK_CONTROLS_MATERIAL_VARIANT to Dense or setting Variant=Dense in the qtquickcontrols.conf file. Task-number: QTBUG-51109 Change-Id: I11846b7f6e61f7b5dcf3c146b18c220234a73ef2 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* QQuickMaterialStyle: init the globals from the pluginMitch Curtis2018-02-191-74/+67
| | | | | Change-Id: I83e754c145becb91cc0fc849434d4843ee24361f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Rename QQuickStyleAttached to QQuickAttachedObjectJ-P Nurmi2017-03-221-18/+18
| | | | | | | | | This is becoming a generic recursive attached object type that can be used for palettes too, which are planned to be used for the upcoming image-based style. Change-Id: I693d307ea16e73540ec9519b2ab18a314ff44272 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Move isDarkTheme() to QQuickStylePrivateJ-P Nurmi2017-03-221-4/+2
| | | | | | | | | QQuickStyleAttached is being generalized to a recursive attached object type that can be used for palettes too, which are planned to be used for the upcoming image-based style. Change-Id: I4c1d25624ee11bb0ec6cd5ee2656c36e622e2139 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Move settings from QQuickStyleAttached to QQuickStylePrivateJ-P Nurmi2017-03-221-2/+2
| | | | | | | | | | The settings were added before QQuickStyle(Private) existed. Now QQuickStyle(Private) is a lot more logical place for the settings that are not specific to the attached style attributes only, but can be also determine which style is used etc. Change-Id: I7bc432c330d58ab501b51b0ee8eaf24697155324 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Fix build with -no-feature-settingsJ-P Nurmi2017-01-311-0/+2
| | | | | Change-Id: I204c50539288df16c4d4010e91c8ecc60f202ec6 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* QtQuickControls2: Use the newly-introduced qmlWarning instead of qmlInfoRobin Burchell2017-01-131-2/+2
| | | | | | | | qmlInfo will shortly be returning info-level messages (as the name hints), rather than warning level messages. Change-Id: I94123464b12b30a4ba085cfb7b606bc26df9b76e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: de-couple foreground and primaryTextColorJ-P Nurmi2016-11-161-8/+8
| | | | | | | | | | | | In order to get the ComboBox colors right, it must be possible to query the original primary text color value. It was very convenient to make Material.primaryTextColor return custom Material.foreground colors, because that way we didn't have to touch our QML files, but this approach is no longer usable. Task-number: QTBUG-57167 Change-Id: Iee003e96112b919dc7c84a906e4f5691b0f2a6ab Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-10-191-0/+14
|\ | | | | | | | | | | | | | | Conflicts: src/imports/controls/doc/snippets/qtquickcontrols2-swipedelegate.qml src/imports/controls/material/qquickmaterialstyle.cpp Change-Id: I00b533e28407f87a31588e92109a468a5bfb4cc8
| * Material: introduce an active and disabled icon colorsKonstantin Ritt2016-10-171-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://material.google.com/style/icons.html#icons-system-icons > The standard opacity for an active icon on a light background is 54% (#000000). An inactive icon, which is lower in the visual hierarchy, should have an opacity of 26% (#000000). > The standard opacity for an active icon on a dark background is 100% (#FFFFFF). An inactive icon, which is lower in the visual hierarchy, should have an opacity of 30% (#FFFFFF). Change-Id: I5916855cd0a4005ee55ac781207ac9cf4d078a34 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into 5.8J-P Nurmi2016-10-031-1/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/quickcontrols2/gallery/gallery.qrc src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/doc/qtquickcontrols2.qdocconf src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/qtquickcontrols2plugin.cpp src/quicktemplates2/qquicktooltip.cpp src/quicktemplates2/qquicktooltip_p.h src/quicktemplates2/qquicktumbler.cpp tests/auto/controls/data/tst_spinbox.qml tests/auto/controls/data/tst_tumbler.qml tests/auto/qquickmaterialstyle/data/tst_material.qml Change-Id: I25b7473b47739043b6f768603bece30b18021318
| * Material: fix dark dialog colorJ-P Nurmi2016-10-021-1/+1
| | | | | | | | | | | | | | | | https://material.google.com/style/color.html#color-themes Task-number: QTBUG-53266 Change-Id: I870d8e4871cae8d4940264c046d6ddf74dbe023f Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * Material: fix accent update on theme changeJ-P Nurmi2016-09-301-0/+4
| | | | | | | | | | Change-Id: I9cb3fd6bdbedc0e7ca472b815502bce48dca00b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into 5.8J-P Nurmi2016-09-061-3/+12
|\| | | | | | | Change-Id: Ief98cd56abd13cfa4e30578e150207462a8243b8
| * Material: fix ToolBar to respect Material.backgroundJ-P Nurmi2016-09-061-0/+7
| | | | | | | | | | | | Task-number: QTBUG-55687 Change-Id: I815291847bad72ae58b66dc70b510ce11cd88b8d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Material: fix popups to respect Material.backgroundJ-P Nurmi2016-09-061-0/+4
| | | | | | | | | | | | Task-number: QTBUG-55687 Change-Id: I217ad905cc06228a6a1608c0721dc20a31db6d9b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into 5.8J-P Nurmi2016-09-021-6/+2
|\| | | | | | | Change-Id: I82da1e547c4ead1181ade19f77c62651c00998a3
| * Material: ignore Material.background unless explicitly setMitch Curtis2016-09-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Doing Material.background: "red" in an ApplicationWindow shouldn't affect the background color of e.g. a Button. The background property should still propagate though, so we change buttonColor() to ignore the value of background if it wasn't explicitly set. Change-Id: I09b4df142935b19de35a77bd68c6c062417b74fc Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * Cleanup unused QQuickMaterialStyle::drawerBackgroundColorJ-P Nurmi2016-09-021-5/+0
| | | | | | | | | | | | | | Drawer uses Material.dialogColor Change-Id: I4af7c5920a3603685fdca9d39b23f7db9edd09df Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-08-231-45/+58
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/material/qquickmaterialstyle.cpp src/imports/controls/universal/qquickuniversalstyle.cpp src/quicktemplates2/qquickpopup_p_p.h src/quicktemplates2/qquicktooltip.cpp tests/auto/auto.pro Change-Id: I88b347dd85278e14f7b2ca468e30648c6432b6f2
| * Material: document the attached style propertiesMitch Curtis2016-08-191-0/+5
| | | | | | | | | | Change-Id: I8349ec366c75b9480533bb9b61a3748e09e9560e Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * Material: ensure setting background/foreground worksMitch Curtis2016-08-191-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add hasGlobalForeground and hasGlobalBackground. These are set to true when a foreground/background color is specified via settings (qtquickcontrols2.conf file or environment variables), and then used to initialize each attached style object's m_hasForeground and m_hasBackground property. - Add tst_qquickmaterialstyleconf auto test to ensure that global settings are respected. Change-Id: I436773e355c6d470215fb9cfe8fbff402d2979d9 Task-number: QTBUG-55366 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * Material: rename defaultX variables to globalXMitch Curtis2016-08-191-43/+43
| | | | | | | | | | | | | | | | | | For example, defaultPrimary will become globalPrimary. This better reflects the reality that these are not true defaults because they can be overridden by settings and makes it easier to read the code. Change-Id: Idf09e5b0c6a2d91663730c00e3d32f2be49e15c6 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Add ComboBox::flatJ-P Nurmi2016-08-111-1/+3
| | | | | | | | | | | | | | | | | | [ChangeLog][ComboBox] Added a flat property that provides more suitable looks for using ComboBox in a ToolBar. Task-number: QTBUG-54935 Change-Id: Id458a078486aeac5d542a57f3ed247d63d25e95c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Material: rename ripple color propertiesJ-P Nurmi2016-07-211-5/+5
| | | | | | | | | | | | | | They are no longer specific to CheckBoxes, but used in most controls. Change-Id: I404aeab706479d0b666529ebdb09caa6b8085cae Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickMaterialStyle: cleanup several unused colorsJ-P Nurmi2016-07-211-73/+4
| | | | | | | | | | | | | | | | | | These are no longer used now that the hovered and focused states are visualized by the ripple background, and the pressed state by the ripple waves and the elevation shadow. Change-Id: Ia2d315c2d8b31e4fcd77534f6128584b9daeb8d8 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Material: revise Button visualsJ-P Nurmi2016-07-201-16/+1
| | | | | | | | | | | | | | | | | | | | | | Pressed buttons were way too dark, and ripples weren't even visible for highlighted buttons. Now that we have ripples, we don't need to use so many different color shades to present various button states. Also, visualize the checked state with a little accented bar like the Android ToggleButton does. Change-Id: Id717b658bfe70ba211e4da5a6addc6e10a2df3e5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Material: tweak ScrollBar looks and behaviorJ-P Nurmi2016-07-181-0/+5
| | | | | | | | | | | | | | | | | | | | Model the Material style scroll bar after the Chrome OS scroll bar. This adds a hover effect, and makes the transient timeout much longer to make the scroll bars easier to use on desktop. Task-number: QTBUG-50003 Change-Id: I5b1798e6c6b04482eab21d56e48935e2a9c69250 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-06-011-2/+15
|\| | | | | | | | | | | | | | | | | | | | | Comparing colors in tst_material.qml works fine now. Conflicts: examples/quickcontrols2/gallery/qtquickcontrols2.conf tests/auto/material/data/tst_material.qml Task-number: QTBUG-53556 Change-Id: I59970442a09bd72bf0ce53fe838c560ca8daf325
| * Material: fix the reset of primary and accentLiang Qi2016-05-261-2/+8
| | | | | | | | | | | | | | | | | | Also fix a test in dev(see 44ac831c). Done-with: J-P Nurmi <jpnurmi@qt.io> Task-number: QTBUG-53556 Change-Id: I0b156727b07ed8c135c4a7bb6bb31fb2b280d4ec Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
| * SpinBox: disable up and down indicators when appropriateMitch Curtis2016-05-241-0/+7
| | | | | | | | | | | | Change-Id: I6fbfde582723632c9b955a6e7ee380179b7b6a32 Task-number: QTBUG-53519 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Introduce a 'System' theme to the styles.Friedemann Kleint2016-05-261-1/+13
|/ | | | | | | | | | | | | | | | Setting the theme to System chooses either the light or dark theme based on the system theme colors. However, when reading the value of the theme property, the value is never System, but the actual theme. [ChangeLog][Controls][Material] Added Material.System theme enum value, that can be used to let the Material style choose either the light or dark theme based on the system theme colors. [ChangeLog][Controls][Universal] Added Universal.System theme enum value, that can be used to let the Universal style choose either the light or dark theme based on the system theme colors. Change-Id: Ibfc9f01953cb8322b64d59413cfbaef9d4bb28fd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: fix flat button colorsNikita Krupenko2016-05-091-8/+10
| | | | | | | | As 251afe3eaac3367c5c659dddc1e8854f833d5112 changed the way, how button color are retrieved, use it for flat buttons too. Change-Id: I28448c597b027293b1acac22dad586e0e7156707 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: set correct ToolBar foreground color for built-in primariesJ-P Nurmi2016-05-091-0/+36
| | | | | | | | | | When the primary color is one of the predefined values, we can choose the appropriate light or dark foreground color according to: https://www.google.com/design/spec/style/color.html#color-color-palette Change-Id: I2a25211ec3bc091211ce58b809089acaa32cb960 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Nikita Krupenko <krnekit@gmail.com>
* Material: use proper shade for light and dark themeNikita Krupenko2016-05-091-9/+16
| | | | | Change-Id: I2c93887890113a0ba37ce967349458c4b296a9ed Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: emit paletteChanged() on background color changeNikita Krupenko2016-05-061-0/+1
| | | | | | | | After 251afe3eaac3367c5c659dddc1e8854f833d5112 button color now depends on the background color. Change-Id: I297bf77f1303c07c3fa03e55ac57d8fe3228da4d Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: fix raised button color for dark themeNikita Krupenko2016-05-061-1/+1
| | | | | | | | In 251afe3eaac3367c5c659dddc1e8854f833d5112 it became the same as in light theme. Change-Id: Iba5017be5d87ce0d346bcfd1bcdb0371fe650593 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: mark internal darkerShade() function as staticNikita Krupenko2016-05-061-1/+1
| | | | | Change-Id: I1d2e181f411e7337970669fc7a1bb3b8a37e1aed Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: Add proper elevation supportMichael Spencer2016-05-041-31/+88
| | | | | | | | | | | | - Added an ElevationEffect component based on elevation shadows from Angular Material - Use it on Button, ToolBar, ComboBox, Drawer, Pane, Popup, Menu, and Switch - Add an elevation property to the Material attached object - Update the button colors based on the elevation property Change-Id: I5152e1a56bdcb1016cc4f945a16ef510e0cdece6 Task-number: QTBUG-51276 Reviewed-by: Nikita Krupenko <krnekit@gmail.com> Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Remove unnecessary TODO commentsMitch Curtis2016-04-291-3/+0
| | | | | | | It's OK to have approximations of color values and easing curves. Change-Id: Id0cb5cd80e5086ba1a8b35ac2f6c569b3c4002d0 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7J-P Nurmi2016-04-271-0/+2
|\ | | | | | | Change-Id: Ifb2d12d09994f3970b117ee76522c7d9c7152587
| * Material: update palette on primary/accent color changeNikita Krupenko2016-04-201-0/+2
| | | | | | | | | | | | Task-number: QTBUG-52631 Change-Id: Ib1649f44cdbc14770b1759ef7f4d7ea92f148cc1 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Rename env vars (QT_LABS_CONTROLS_XXX -> QT_QUICK_CONTROLS_XXX)J-P Nurmi2016-04-221-5/+5
| | | | | | | | | | Change-Id: Ie903d3491b03d4ec05dd28462a19ee464331d2a2 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* | Material: rename internal constants for divider colorNikita Krupenko2016-04-201-6/+6
| | | | | | | | | | Change-Id: If34a0f6db74a8cd3e75fd0fa2217bbb4920d71d2 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Material: make highlighted buttons respect explicitly set foregroundJ-P Nurmi2016-04-181-0/+2
| | | | | | | | | | | | | | | | | | Highlighted buttons are special and don't automatically inherit the foreground color from the parent, but this change makes it possible to change the color by setting it explicitly on a highlighted button. Change-Id: I2e2f90ca001cdfffb47e5cf29266715243d7dd18 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* | Material: add foreground and background attached propertiesJ-P Nurmi2016-04-151-3/+183
| | | | | | | | | | | | | | | | | | | | | | | | This has been a common request on the mailing lists and forums. Users want to customize the text color of various controls without having to replace whole delegates. This change makes it possible to specify both foreground (eg. Button text) and background (eg. ApplicationWindow, Page and Pane background) colors so that they propagate to children in the same way than accent, primary and theme do. Change-Id: Idae52650ed8620beeff7bf4c8263ffdc1f6ef728 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* | Add QQuickMaterialStyle::variantToRgba()J-P Nurmi2016-04-151-42/+31
| | | | | | | | | | | | | | Extracted from setAccent() and setPrimary() Change-Id: I2dff1d0f605cc210f6b86b5aa1a1f5ff284b20af Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* | Controls: update license headersJ-P Nurmi2016-04-141-2/+2
| | | | | | | | | | | | | | This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. Change-Id: Ib653135662bfd353a73290539995e8e5be211587 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>