aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyle.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Remove qtquickcontrols2 sources and explain where they wentHEADdevMitch Curtis2021-08-161-505/+0
| | | | | | | | | | | | Now that qtquickcontrols2 has been merged into qtdeclarative, we should make it obvious that this repo should no longer be used, by preventing it from being built. Task-number: QTBUG-95173 Pick-to: 6.2 Change-Id: I95bd6a214f3d75a865ab163ee0a1f9ffbeb7a051 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Ensure that C++ Qt Quick tests are run with all applicable stylesMitch Curtis2021-01-131-0/+16
| | | | | | | | | | | | | Since 8b534487044dfb3b464431ecb91ef4e0864af4ed, the C++ tests were only being run with the default style for the platform that they were run on. Fix this by keeping track of whether a default style is in use and checking it in the tests. Pick-to: 6.0 Change-Id: I4ddd90aba12ede83fff0d3d1002534e79fce8c87 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Allow style to be set to "Default" for compatibilityMitch Curtis2020-12-091-2/+5
| | | | | | | | | | | | | | | This unbreaks Qt 5 applications that weren't specifying a style or were specifying Default. [ChangeLog][Important Behavior Changes] Setting the style to "Default" now behaves the same way as not specifying a style; a relevant style will be chosen based on the platform. To use the style previously known as "Default", use "Basic". Task-number: QTBUG-85984 Pick-to: 6.0 Change-Id: I8e5533f9c6834765610773e46f97fbd56a242039 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Ensure that Fusion style is used by default on LinuxMitch Curtis2020-12-091-1/+1
| | | | | | | | Fix typo in qquickstyle. Pick-to: 6.0 Change-Id: Id567f7359ae7aa346b38f94ae1add29aeb73039a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make adjustments for using QFont::setFamilies()Andy Shaw2020-11-301-1/+1
| | | | | | | | | | Since we only depend on using setFamilies() now instead of setFamily() then we can rely on the fact that it will be resolved correctly, so we can remove the code that was ensuring that family() would take precedence if families() was empty. Change-Id: Iea1464ec840dc76c04a4acae445cab367e03d3ca Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Native style: Enable windows styleJan Arve Sæther2020-11-041-7/+5
| | | | | | Task-number: QTBUG-86399 Change-Id: I634db1d4514a685743504748251e53703676881a Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Make tests explicitly use Basic where necessaryMitch Curtis2020-10-071-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | The previous commit changes the how the default style is set, and since the tests all assumed that Basic was the default, we now need to ensure it is explicitly set. If we want to, we can revert this patch (or file-by-file) later and ensure that these tests work with all styles. For now, just keep things working as they used to. Tests that use QTEST_QUICKCONTROLS_MAIN are not changed, as they already run with all built-in styles. Tests that don't use types that will cause issues, like tst_qquickcolor, do not need to be changed. tst_snippets can be run manually to produce screenshots, so we specify its style in a qtquickcontrols2.conf file to allow it to be overridden by e.g. application arguments (QQuickStyle::setStyle() takes precedence over all other approaches of setting a style). Change-Id: Ifae7e959f89a41a757c170272038fad139bba04f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Default to the most appropriate built-in style if none is specifiedMitch Curtis2020-10-071-0/+21
| | | | | | | | | | | | | [ChangeLog][Styles] An appropriate built-in style is now used as the default style if one is available for the target platform. For example, when running a Qt Quick Controls application on macOS, the macOS style will be used. On Android, the Material style will be used. When running on e.g. an embedded device, where no native style is available, use the Basic (formerly "Default") style. Change-Id: Ie61d1a8a1a83fbeba63387c7ca3671084f47bc04 Fixes: QTBUG-86403 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Support compile-time style selectionMitch Curtis2020-09-241-0/+3
| | | | | | | | | | | | | | By allowing importing styles without first importing QtQuick.Controls, which does runtime style selection. [ChangeLog][Styles] It's now possible to select a style at compile-time by importing that style explicitly instead of QtQuick.Controls. This avoids the need to do run-time style selection and hence deploy the QtQuick.Controls plugin with the application. Change-Id: I666d6dc7727fffd2c7b05743855f2086f076465a Fixes: QTBUG-86284 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Rename "Default" style to "Basic"Mitch Curtis2020-09-241-3/+3
| | | | | | | | | | | | [ChangeLog][Styles] The Default style was renamed to Basic to account for the introduction of the platform styles (macOS, Windows), which will be used by default (where possible) when no style is specified. Fixes: QTBUG-85984 Task-number: QTBUG-68814 Task-number: QTBUG-86403 Change-Id: I22b3199c8662e4ee5d55a1be1a51c9856ac62376 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix fallback styles overwriting themesMitch Curtis2020-09-241-0/+3
| | | | | | | | | | | | | | | | | | | | | In Qt 5, QtQuickControls2Plugin::registerTypes() was responsible for calling initializeTheme() on each style plugin. Now that we delegate more work to the QML engine, each style plugin calls initializeTheme() via registerTypes(). To avoid fallback styles overwriting font and palette data set by the current style, we need to check if the theme has been intialized before calling initializeTheme(). To do this, we add a static "themeInitialized" bool that QQuickStylePlugin sets to true after calling intializeTheme() for the first time. It checks this value and avoids calling intializeTheme() if it's true. We also need to make QQuickStylePlugin ensure that the theme it's initializing belongs to the current style. Fixes: QTBUG-86303 Change-Id: Ie65e646677c78622829f4949c41cb79204cf5786 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix more compiler warnings from deprecated application attributesVolker Hilsheimer2020-09-161-1/+0
| | | | | | | | | Also cleanup documentation, with the exception of the "High-DPI Support in Qt Quick Controls" page, which needs to be either removed or rewritten after some fact checking. Change-Id: I3cdf1f8554f8f26627a9a5f17c2ee0038c933468 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: temporarily disable the Windows style until it's completeRichard Moe Gustavsen2020-09-071-3/+4
| | | | | | | | | | Since the Windows style is not yet complete, it's best to disable it until it is, otherwise causes auto test failures that might already be fixed. Task-number: QTBUG-86399 Change-Id: I1acb130aa872e9effc82cc326e37a037024d49ca Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: only list available built-in stylesRichard Moe Gustavsen2020-09-071-0/+4
| | | | | | | | | | Don't add e.g Windows style to the list of built-in styles when running on other platforms than Windows. The Windows style is only available on Windows. Otherwise e.g the autotests will try to execute all the tests for a style that is not present. Change-Id: Iee8b052fd284840951a77d117071ab1b59ee92bc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Native style: add macOS and Windows to QQuickStylePrivate::builtInStyles()Richard Moe Gustavsen2020-08-281-2/+9
| | | | | Change-Id: I9b9aa44fd02a02fcd0ca7671abe120b806acc2cb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use qmlRegisterModuleImport() to register stylesMitch Curtis2020-08-261-302/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch completes the cumulative work done in previous patches. - Uses qmlRegisterModuleImport() to register styles. This has some added requirements: - Each style must now be a QML module -- that is, it must have a qmldir file. - As a result of the above, the module must be available within the QML import path in order to be found. - The various forms of accepted style names have been reduced down to one ("Material", "MyStyle", etc). See below for an explanation of why. - The following API in QQuickStyle is removed: addStylePath(), availableStyles(), path(), stylePathList(). These no longer make sense now that we reuse the existing QML import system. - Adds the tst_qquickstyleselector auto test back as "styleimports". qmlRegisterModuleImport() vs resolvedUrl() Previously we would use QQuickStyleSelector to select individual QML files based on which style was set. We'd do this once when QtQuick.Controls was first imported. With Qt 6, and the requirement that each style be a proper QML module, qmlRegisterModuleImport() was introduced. This allows us to "link" one import with another. For an example of what this looks like in practice, suppose the style was set to "MyStyle", and the fallback to "Material". The "QtQuick.Controls" import will be linked to "MyStyle", "MyStyle" to "QtQuick.Controls.Material", and as a final fallback (for controls like Action which only the Default style implements), "QtQuick.Controls.Material" to "QtQuick.Controls.Default". This is the same behavior as in Qt 5 (see qquickstyleselector.cpp): // 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) This is a necessary step to enable compilation of QML to C++. Reducing the set of accepted style names The problem In QtQuickControls2Plugin() we need to call QQuickStylePrivate::init(baseUrl()) in order to detect if the style is a custom style in QQuickStyleSpec::resolve() (by checking if the style path starts with the base URL). In Qt 5, init() is called in QtQuickControls2Plugin::registerTypes(), but in Qt 6 that's too late, because we need to call qmlRegisterModuleImport() in the constructor. qmlRegisterModuleImport() itself requires the style to have already been set in order to create the correct import URI ("QtQuick.Controls.X" for built-in styles, "MyCustomStyle" for custom styles). The solution By reducing the valid forms for style names down to one: ./myapp -style MyStyle we solve the problem of needing baseUrl() to determine if the style is a custom style or not, but needing to call it too early (since we now call qmlRegisterModuleImport() in QtQuickControls2Plugin(), which itself requires the style to have already been set). baseUrl() can't have been set before the constructor is finished. All of the various forms for _setting_ a style are still valid; environment variables, qtquickcontrols2.conf, etc. [ChangeLog][Important Behavior Changes] Custom styles must now have a qmldir that lists the files that the style implements. For example, for a style that only implements Button: --- module MyStyle Button 1.0 Button.qml --- In addition, there is now only one valid, case-sensitive form for style names: "Material", "MyStyle", etc. These changes are done to help enable the compilation of QML code to C++, as well as improve tooling capabilities. [ChangeLog][Important Behavior Changes] The following API was removed: - QQuickStyle::addStylePath() - QQuickStyle::availableStyles() - QQuickStyle::path() - QQuickStyle::stylePathList() - QT_QUICK_CONTROLS_STYLE_PATH This API is no longer necessary and/or able to be provided now that styles are treated as regular QML modules. Task-number: QTBUG-82922 Change-Id: I3b281131903c7c3c1cf0616eb7486a872dccd730 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Register C++ types declarativelyMitch Curtis2020-08-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Adapt to the new way of registering C++ types. The types need to be seen at compile time so that code can be generated that invokes them. This patch: - Adds QML_* macros where applicable. - Adapts the build system files to the new way of registering modules. - Splits up the QtQuick.Controls[.*].impl files into their own plugins, as we can only register one QML module per .pro file. - Removes C++ type registration calls in every plugin. - Moves private types from src/quickcontrols2/quickcontrols2.pro to src/quickcontrols2/impl/quickcontrols2-impl.pro. Some of these types need to be exposed to QML, but quickcontrols2.pro is already in use to declare the QtQuick.Controls import (and also provides the public C++ QQuickStyle API), and the new QML_IMPORT_NAME/VERSION syntax only allows one module per project. As some of the types that need to be exposed to QML are also referenced by some C++ code (e.g. tests, etc.), we just move all of the private types to the new library. Follow-up patches will register the QML types declaratively. Task-number: QTBUG-82922 Change-Id: Iaf9ee106237d61701d57a8896f3822304c8151a6 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Adapt to renaming of QQmlMetaType::isModule()Ulf Hermann2020-06-301-2/+4
| | | | | | Change-Id: I2db7915377caec6c80e04979a5813c605ae33e09 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Adapt to plugin unloading changesMitch Curtis2020-03-121-0/+23
| | | | | | | | | | | | | | | | | | | | As of c2081016e in qtdeclarative, plugins are no longer unloaded on macOS, and QQmlExtensionPlugin::unregisterTypes() should be used instead. This patch: - Moves everything that was done in destructors to unregisterTypes(). - Ensures that the style selector is destroyed in QQuickStylePlugin::unregisterTypes() so that previous styles that were set do not stick around after qmlClearTypeRegistrations() is called. This ensures that runtime style-switching continues to work. - Adds more logging output to make it easier to diagnose issues in the future. - Adds more code comments to ease maintenance. Change-Id: Ibbfeba4501d6ba0d5a257dcceace3498904a816e Fixes: QTBUG-82811 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devSimon Hausmann2020-03-101-3/+10
|\ | | | | | | | | | | | | Conflicts: src/imports/controls/qtquickcontrols2plugin.cpp Change-Id: Ifc09ea9f71fdba119fe8eed99f0bdcb402444f27
| * Use Qt::SplitBehavior in preference to QString::SplitBehaviorEdward Welbourne2020-03-051-2/+2
| | | | | | | | | | | | | | | | The Qt version was added in 5.14 "for use as eventual replacement for QString::SplitBehavior." Move another step closer to that goal. Change-Id: I3ed1abd00bf54da654c9ccade427f5756b99b595 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * Follow QML2_IMPORT_PATH in path searchDavid Edmundson2020-01-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When searching for styles we include QLibraryInfo::Qml2ImportsPath so it makes sense to continue that to also include the runtime QML2_IMPORT_PATH when searching for QQC2 themes. It used to be included, but in 5.14 this behavior changed as a result of 7db4df2deca52a30b4c068abd4683a1720cf281e, so this line is restored. Change-Id: I185b29b323d870fc724e655104eaf42034707738 Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Look for the fallback style in all of the style pathsAndy Shaw2020-01-271-1/+7
| | | | | | | | | | | | | | Fixes: QTBUG-81216 Change-Id: I9d3efeec7f9ec2beda24ff74e39d04104f5eb967 Reviewed-by: BogDan Vatra <bogdan@kdab.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Fix build with latest qtdeclarativeSimon Hausmann2020-02-131-2/+2
|/ | | | | | | | | | Commit 789929f939a60462373beae37ab4373809095cff in qtdeclarative introduced QTypeRevision and changed internal API that's used here. Change-Id: I994084a26ac15a1795fd5d5add46113e3571402f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Include the Android specific path for the importsAndy Shaw2019-11-151-2/+7
| | | | | | | | | | | androiddeployqt will put all the files originally in the assets into a rcc file now instead of having them copied over as before. Therefore the styles need to be searched for in that path to see if they exist. Fixes: QTBUG-79952 Change-Id: Ief8fc59257d3b329dd8b5b28190433e1b1a7f12d Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: BogDan Vatra <bogdan@kdab.com>
* Minor performance improvements suggested by clang-tidyAlbert Astals Cid2019-10-071-1/+1
| | | | | | | | * Add const & to function parameters * Add const & to variables assigned from functions that return const & Change-Id: Ibf35e54ffb78f164493222125411f2ba279cb861 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: Replace the "Qt Quick Controls 2" instancesVenugopal Shivashankar2019-08-221-9/+9
| | | | | | | | | Now that Controls 1 is deprecated, it's ideal to use "Qt Quick Controls" instead of "Qt Quick Controls 2". Task-number: QTBUG-70333 Change-Id: Ie745db4b61071ddb5e06150d4e739cda74c59f41 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-07-171-0/+63
|\ | | | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickstyle.cpp src/quicktemplates2/qquickscrollview.cpp tests/auto/qquickstyle/tst_qquickstyle.cpp Change-Id: I9afddf07a956f43cf0445e91b8d1a02f167b6bd5
| * Fix qrc paths in QT_QUICK_CONTROLS_STYLE_PATHMitch Curtis2018-07-161-2/+60
| | | | | | | | | | | | | | | | | | Parse the environment variable manually when the platform's list separator is ':', to avoid issues with qrc paths (which start with ':') not working. Task-number: QTBUG-68219 Change-Id: Ic71d49da5a72a37bc1d2e7b19fbf1de71b3917f3 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | QQuickStyle::addStylePath(): fix support for qrc pathsMitch Curtis2018-06-251-0/+2
| | | | | | | | | | | | | | | | The code lacked handling for the "qrc" scheme. Task-number: QTBUG-68222 Change-Id: Ia0dfdb748b8bdb40c893375b9de77bd8c05986b6 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Move font/palette reading to QQuickStylePrivateJ-P Nurmi2018-05-161-0/+79
| | | | | | | | | | | | | | | | Instead of moving the code back and forth between different plugins, promote it to QQuickStylePrivate so it can be used from any plugin. Change-Id: Ifb80923750ff531676dc3347dacf0aff8c026fdb Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Fix external styles in static buildsJ-P Nurmi2018-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression caused by d2897a6c. For example, running a statically built Gallery example with the Material style resulted to: QQmlApplicationEngine failed to load component qrc:/gallery.qml:58 Type ApplicationWindow unavailable file:///path/to/QtQuick/Controls.2/Material/qmldir:-1 module "QtQuick.Controls.Material" plugin "qtquickcontrols2materialstyleplugin" not found Even if we install .qml files in static builds (so that people can copy them as a starting point from a Qt for iOS installation), those files must not be loaded in static builds. Previously this case was handled by the QT_STATIC guard in the former typeUrl(), but the special case was missed while taking QQuickStyleSelector into use for the internal types in d2897a6c. Change-Id: Ie4d7956c7eccb0f4e67b6f3a2b5368437636fa78 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devJ-P Nurmi2018-03-231-3/+3
|\| | | | | | | | | | | | | | | Conflicts: src/quickcontrols2/qquickstyle.cpp tests/auto/controls/data/tst_popup.qml Change-Id: I7b7bb5f9c63b32eef65c9b2e68f56baa3da69cff
| * QQuickStyle: use local 8-bit for paths from env varsJ-P Nurmi2018-03-231-4/+4
| | | | | | | | | | | | | | We must not assume that paths are Latin-1 strings. Change-Id: I13814bf29c9ebb12b71e5c559843589946a7ecac Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-201-1/+2
|\| | | | | | | Change-Id: I69ada9110df30ea5f20710a2d1e6ac6b6a448b21
| * Avoid crashes when the qquickcontrols2 plugin gets unloadedLars Knoll2018-03-161-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | The styleSpec() can be a nullptr in some cases, so test for that before calling reset() on it. Fixes a crash on exit in the qqmlextensionsplugin autotest of qtdeclarative if qtquickcontrols2 has been compiled. Change-Id: Ic43cbec57b36f9a0181d3b0c50d4a19236b5870e Reviewed-by: J-P Nurmi <jpnurmi@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
| * QQuickStyle: fix and test QT_QUICK_CONTROLS_CONFJ-P Nurmi2018-02-201-0/+1
| | | | | | | | | | | | | | | | Reset QT_QUICK_CONTROLS_CONF when appropriate, and add some tests too since the environment variable is now public and documented. Change-Id: I09fba950de7c34f22c4cf802ea5c0a337c84f0bd Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickStyle: add API for managing style pathsJ-P Nurmi2018-03-161-2/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to be able to use/refer to/select styles by name: - ./myapp -style Glossy - :/qtquickcontrols2.conf: [Controls] Style=Glossy - QT_QUICK_CONTROLS_STYLE=Glossy ./myapp the style needs to be available in a place where QQC2 can find it by the given name. Normally, QQC2 scans for available styles in the QT_INSTALL_QML/QtQuick/Controls.2/ directory, where all the built-in styles reside. However, 3rd party styles may want to install styles into their own namespace, especially if they offer style-specific API. If a style is installed elsewhere, QQC2 needs to be made aware of the style path to make it possible to locate the style. Previously, the QT_QUICK_CONTROLS_STYLE_PATH environment variable was the only way. This adds proper C++ API, inspired by QQmlEngine's importPathList and pluginPathList, to manage QQC2 style paths. [ChangeLog][Controls][QQuickStyle] Added stylePathList() and addStylePath() methods for managing the list of directories where Qt Quick Controls 2 searches for available styles. Task-number: QTBUG-67062 Change-Id: I1e85b5e09ba869483c0937ac61a0a2dcfc8e774e Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Refactor QQuickStyleSelectorJ-P Nurmi2018-03-131-3/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of trying to determine a single base URL based on the import URI of the plugin, and whether built in static mode, provide a list of paths where to lookup styles, in priority order: - requested style path (-style /path/to/style) - QT_QUICK_CONTROLS_STYLE_PATH environment variable - QT_INSTALL_QML/QtQuick/Controls.2/ - qrc://qt-project.org/imports/QtQuick/Controls.2/ Furthermore, provide the requested style name and the fallback style name as a simple list of selectors. The lookup order is: 1) requested style 2) fallback style 3) default style As a result, QQuickStyleSelector implementation is a lot simpler, completely independent of QQuickStyle, and the style lookup works regardless of whether the files are in QRC or on the file system. This allows us to utilize QRC and the Qt Quick Compiler in the future. Note: two data rows in tst_QQuickStyleSelector::select_data() had to be fixed. Not sure how the expected values ended up like that, but as the comments say, "Label.qml exists in the default and fallback styles" and "Button.qml exists in all styles", so it makes no sense to expect that Label.qml or Button.qml is selected from the FallbackStyle when a valid "data" folder is specified. Change-Id: I18dea9fddf8f079e0140b51b567814da0df2802c Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickStyle: de-duplicate codeJ-P Nurmi2018-03-121-12/+12
| | | | | | | | | | | | | | Unify reading of QML2_IMPORT_PATH and QT_QUICK_CONTROLS_STYLE_PATH. Change-Id: Icb2a7b6156b5d32235adfe4abec5873256e6fcb5 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Add Dense Material style variant for desktopMitch Curtis2018-02-191-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2018-01-101-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/BusyIndicator.qml src/imports/controls/CheckBox.qml src/imports/controls/CheckDelegate.qml src/imports/controls/ComboBox.qml src/imports/controls/DelayButton.qml src/imports/controls/Dial.qml src/imports/controls/ItemDelegate.qml src/imports/controls/MenuItem.qml src/imports/controls/RadioButton.qml src/imports/controls/RadioDelegate.qml src/imports/controls/SwipeDelegate.qml src/imports/controls/Switch.qml src/imports/controls/SwitchDelegate.qml src/imports/controls/doc/src/qtquickcontrols2-configuration.qdoc src/imports/controls/material/CheckDelegate.qml src/imports/controls/material/ItemDelegate.qml src/imports/controls/material/MenuItem.qml src/imports/controls/material/RadioDelegate.qml src/imports/controls/material/SwipeDelegate.qml src/imports/controls/material/SwitchDelegate.qml src/imports/controls/qquickdefaultbusyindicator.cpp src/imports/controls/qquickdefaultbusyindicator_p.h src/imports/controls/qtquickcontrols2plugin.cpp src/imports/controls/universal/CheckDelegate.qml src/imports/controls/universal/ItemDelegate.qml src/imports/controls/universal/MenuItem.qml src/imports/controls/universal/RadioDelegate.qml src/imports/controls/universal/SwipeDelegate.qml src/imports/controls/universal/SwitchDelegate.qml src/quickcontrols2/quickcontrols2.pri src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickmenu.cpp src/quicktemplates2/qquickpopup_p.h Change-Id: Ib25c8b4a7fe018b7c0ade9b02bfaaa6980118c15
| * Doc: improve Style/FallbackStyle documentationMitch Curtis2018-01-041-0/+4
| | | | | | | | | | | | | | | | | | Link to relevant documentation and add entries for the Controls section to the configuration file docs. Task-number: QTBUG-65445 Change-Id: I175866167e36403475520ea4de0cb299aae542d7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2017-12-151-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf examples/quickcontrols2/quickcontrols2.pro src/imports/controls/ComboBox.qml src/quicktemplates2/qquickabstractbutton.cpp src/quicktemplates2/qquickabstractbutton_p.h src/quicktemplates2/qquickapplicationwindow_p.h src/quicktemplates2/qquickcombobox.cpp src/quicktemplates2/qquickcontainer.cpp src/quicktemplates2/qquickcontrol.cpp src/quicktemplates2/qquickcontrol_p.h src/quicktemplates2/qquickcontrol_p_p.h src/quicktemplates2/qquicklabel_p.h src/quicktemplates2/qquicklabel_p_p.h src/quicktemplates2/qquickslider_p.h src/quicktemplates2/qquickspinbox.cpp src/quicktemplates2/qquicktextarea_p.h src/quicktemplates2/qquicktextarea_p_p.h src/quicktemplates2/qquicktextfield_p.h src/quicktemplates2/qquicktextfield_p_p.h tests/auto/auto.pro tests/auto/controls/data/tst_combobox.qml Change-Id: I34cdd5a9794e34e0f38f70353f2a2d04dfc11074
| * Fix QQuickStyle::setFallbackStyle() in static buildsJ-P Nurmi2017-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | Use QQmlFile::urlToLocalFileOrQrc() instead of QUrl::toLocalFile() to avoid assuming a local file path. In static builds, QML files are in QRC. Task-number: QTBUG-65016 Change-Id: Ide36e5269d8692620f352574c726fbd1997c0a77 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | QQuickStyle: fix warning about empty filenameMitch Curtis2017-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 0dee566e98f5ff4f224e596de1c04de4f9685df4 (in qtbase) added a check for empty file names to QFileSystemEngine, and we run into that: Empty filename passed to function The fix is to check for empty file names before calling QFile::exists(). Change-Id: I273ea62f97ddcbf5b1a7952405a67ccb45c7672a Reviewed-by: Liang Qi <liang.qi@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devJ-P Nurmi2017-06-081-3/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/controls/doc/src/qtquickcontrols2-index.qdoc src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc src/quicktemplates2/qquickapplicationwindow.cpp src/quicktemplates2/qquickmenu.cpp src/quicktemplates2/qquickmenu_p.h src/quicktemplates2/qquickpopup.cpp tests/auto/auto.pro Change-Id: I856a022d38abd84763127539f46ef032ddc53c3d
| * Fix QQuickStyle::availableStyles()J-P Nurmi2017-06-071-3/+6
| | | | | | | | | | | | | | | | | | Filter out macOS debug symbol (.dSYM) directories from the list of available styles. Task-number: QTBUG-60973 Change-Id: I5b9c3f4af946d44b1601f32bf7da699c29a86689 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Move isDarkTheme() to QQuickStylePrivateJ-P Nurmi2017-03-221-0/+20
| | | | | | | | | | | | | | | | | | 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/+18
|/ | | | | | | | | | 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>