aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/material/qquickmaterialtheme.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Create and init QQuickTheme from QtQuickControls2PluginJ-P Nurmi2018-05-221-18/+15
| | | | | | | | | | | | | | | Instead of creating and setting the QQuickTheme instance from each style plugin (e.g. QtQuickControls2MaterialStylePlugin), create the QQuickTheme instance in QtQuickControls2Plugin when the style is being resolved, and just pass the instance to be initialized by the style plugin(s). This avoids the problem that QQuickTheme API was virtual, and sub-classes created from plugins would have vtables destroyed before the QQuickTheme was destroyed. Task-number: QTBUG-67062 Task-number: QTBUG-68087 Change-Id: I19e9ced5296b708c2668c30163389cb3da6be7cf Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTheme: add setters to make getters non-virtualJ-P Nurmi2018-05-221-34/+22
| | | | | | | | | | This allows us to add more themable attributes (on the side of fonts and palettes) after the QQuickTheme API has been made public, because it won't require adding virtuals. Only the resolve() method is virtual. Task-number: QTBUG-67062 Change-Id: I6a5cc8d15aeaa5a9a0fe9b6d2591077f8822daac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add QQuickTheme::ScopeJ-P Nurmi2018-03-151-13/+14
| | | | | | | | | | | Replace the old enums that were originally copied from QPlatformTheme, including irrelevant entries for DockWidget, MdiSubWindow, MessageBox, with a unified enum that will be matched to cover everything needed for theming fonts and palettes for Qt Quick Controls 2. Task-number: QTBUG-67062 Change-Id: Ia99d092f28c00210c0c7f24d4241eb5a5d9ceb5b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* QQuickTheme: add missing fonts and palettesJ-P Nurmi2018-03-151-0/+1
| | | | | | | | | SpinBox, Switch, and Tumbler were previously not available in QPlatformTheme, but now we have our own enums so we can add them. Task-number: QTBUG-67062 Change-Id: Ie99a49b464fbbd25051181b75d721f537b8e3a68 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add Dense Material style variant for desktopMitch Curtis2018-02-191-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Material: specify the desired button layout in the styleJ-P Nurmi2018-02-171-10/+0
| | | | | | | | | This eliminates an undesired dependency from QQuickMaterialTheme to QPlatformTheme. Task-number: QTBUG-51921 Change-Id: I43c8ab076118b85cf1ae6c85cf1ee5d3e7b8bc74 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Cleanup unnecessary explicit references to QPlatformThemeJ-P Nurmi2018-02-151-13/+13
| | | | | | | | | QQuickTheme is being separated from QPlatformTheme. Reduce references to QPlatformTheme to make the transition to QQuickTheme smoother. Task-number: QTBUG-51921 Change-Id: I6dbbe39bf0b465df16a88bcc26e2b2a32cc42c93 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Read :/qtquickcontrols2.conf in QQuickStylePluginJ-P Nurmi2018-02-151-8/+11
| | | | | | | | | | | | | | | | | QQuickTheme is going to be promoted from libQQC2 to libQQT2 so that it can provide dark and light palettes (and later, icons). The first step is to refactor out the :/qtquickcontrols2.conf reading code, which cannot be in style-agnostic libQQT2. Read the conf file in QQuickStyle Plugin instead. The additional benefit is that we don't need duplicate name() methods for styles and their themes. Even though QQuickStyle Plugin's name handling is case-insensitive, QSetting is case-sensitive. Therefore all QQuickStylePlugin::name() overrides have been updated to use capital first letter. This name is used to lookup the correct section in :/qtquickcontrols2.conf. Task-number: QTBUG-63331 Change-Id: I07b1269d9dbc2c9568e6f22f2da75951fde7b669 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Introduce MenuBarJ-P Nurmi2017-07-261-0/+1
| | | | | | | | | | | | | | MenuBar is an ordinary Item. It can be located basically anywhere, but the idea is to introduce a new ApplicationWindow::menuBar property in a follow-up commit. Currently the example snippets are using the header property. [ChangeLog][Controls][MenuBar] Introduced a MenuBar control. Task-number: QTBUG-60350 Change-Id: Ie66dc457a3d8edbe8362fab2a591dc49442c95e2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Add support for configurable fontsJ-P Nurmi2017-05-311-2/+9
| | | | | | | | | | | | | | | | | | | | | | A style's default font is specified in qtquickcontrols2.conf in a "Font" group under the style's section. QSettings supports the following two alternative syntaxes: [Default] Font\Family=Open Sans Font\PixelSize=20 or [Default\Font] Family=Open Sans PixelSize=20 [ChangeLog][Controls] Added support for specifying the default font for different styles in qtquickcontrols2.conf. Change-Id: I54e1efb79a2913eab35174dbf09b6956fe740e28 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Material: use Android button layout for dialogsNikita Krupenko2017-04-251-8/+1
| | | | | | | | | | | | It used macOS layout before, but now there is more appropriate layout added to the QtGui. [ChangeLog][Important Behavior Changes] DialogButtonBox with Material theme now uses Android button layout. Task-number: QTBUG-58060 Change-Id: I1caa56c532078e09c93c101ce5e6f562b7773c88 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Material: use proper layout of the buttons in the DialogButtonBoxNikita Krupenko2017-03-101-0/+18
| | | | | | | | | | Instead of using system button layout, use layout from macOS, which better fits the Material Design guidelines and also used in the Android QPA plugin. Task-number: QTBUG-58060 Change-Id: I06381219b5f1ad0a32742487fd314a8017d82dfc Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Replace QStringLiteral with QLatin1String in the proxy themesJ-P Nurmi2016-10-251-4/+4
| | | | | | | | | | | | This allows us, in theory, to test multiple styles in the same process by calling qmlClearTypeRegistrations() between each style test round. When QML types are cleared, QML plugins are unloaded, and the current style plugin's proxy platform theme is destroyed. It leads to a nasty crash if there are fonts stored in the Qt font database that have their family names stored in the read-only data of an unloaded plugin. Change-Id: I32a70077ac4502e16a753fb68f7efeef35d239b5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Don't use QFont::exactMatch() for fonts comparisonNikita Krupenko2016-05-181-3/+7
| | | | | | | | | This function can return false even if the font found. Compare fonts by QFontInfo::family() instead. Change-Id: I519dd11ef7cba7395ca5b815d3973ddf585c439a Task-number: QTBUG-53377 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Use ToolTip font from themeNikita Krupenko2016-04-261-0/+6
| | | | | Change-Id: I9a95bcd02a48528bc3e3315c7aa730a2d43bb002 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* Use font from theme for list delegatesNikita Krupenko2016-04-141-0/+5
| | | | | Change-Id: I48208fb6b5f7df6e1e824d36a256d9b1643cd16d Reviewed-by: J-P Nurmi <jpnurmi@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>
* Themes: cache result of QFont::family()Anton Kudryavtsev2016-03-281-5/+6
| | | | | Change-Id: I5318a61dbb699e2f251d218e614c1a2ff02d53a7 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* Use fonts from theme for editable controlsNikita Krupenko2016-03-191-0/+5
| | | | | | | Also set proper fonts for editable controls in Material theme. Change-Id: I78b8f8597a653af593787e569d6ba5ee7bf182a9 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Cleanup QQuickProxyStyleJ-P Nurmi2016-03-181-4/+0
| | | | | | | | | | | Install and remove the proxy theme automatically to eliminate the need for TestTheme do it in tst_applicationwindow. Furthermore, fix some Qt coding conventions, align header guards, remove unneeded empty destructor, and add missing explicit keywords for one-parameter constructors and cleanup somemeaningless ones in paremeterless ctors. Change-Id: Ib95dad003e35e468e941f3a0d2be5b21323fcccd Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Material: corrected default, ToolButton and checkable controls fontsNikita Krupenko2016-03-161-8/+3
| | | | | | | | | According to Android sources, ToolButton has the same font, as other buttons and checkable controls use default (system) font. Also, set proper size for default font. Change-Id: I355ab57ef476918bab346538fefbd6c0209d2221 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Material: return proper themeFont() for controlsNikita Krupenko2016-02-171-4/+26
| | | | | | | This allow to get proper fonts for most controls. Change-Id: I4b43ce05b09c30f59dca7d23e8d890fa9dfb74ab Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Material: fix fontsJ-P Nurmi2016-02-091-2/+12
| | | | | | | | | | | | Request Roboto or Noto if exists, fallback to the system font. Even if we fallback to the system font, set the sizes appropriately. The latest spec for tabs says that the font size 14sp (scaled px) and all caps. https://www.google.com/design/spec/components/tabs.html#tabs-specs Change-Id: I34ecadf21306921e2115630ea41771dfef627b48 Task-number: QTBUG-50971 Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Replace QLatin1Literal occurrences with QStringLiteralKonstantin Ritt2015-12-161-2/+2
| | | | | Change-Id: I37bd9dd933c2125dbe6d382bf6d0a6a46b31c1dd Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Use TabButtonFont and GroupBoxTitleFont from QPlatformThemeLiang Qi2015-12-101-3/+3
| | | | | | | | * QQuickGroupBox: GroupBoxTitleFont * QQuickTabButton: TabButtonFont Change-Id: Ib2e58a95c49353536231cc93d28dba075629c59f Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
* Material: move to QQuickProxyTheme way for font settingsLiang Qi2015-12-011-0/+64
Change-Id: Ib3fe1809887bbcf3db1822c6eb0182e0181cf70f Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>