aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyleselector.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add "qt.quick.controls.style" logging category for style lookupJ-P Nurmi2018-03-131-1/+7
| | | | | | | | | | Helps to debug where the .qml files are selected from. Especially with the upcoming Qt Quick Compiler and QRC changes, it will be important to be able to verify which files are being used, but this also helps investigating issues with custom styles. Change-Id: I2b2b4f57b3288e0ab204c624ef6d8eb92268698b Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Refactor QQuickStyleSelectorJ-P Nurmi2018-03-131-77/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.9' into 5.10J-P Nurmi2018-01-101-12/+18
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
| * Fix license headersJani Heikkinen2017-12-221-12/+18
| | | | | | | | | | | | | | | | | | Old header.LGPL21 header was used at some files. Replase those with new header.LGPL one Task-number: QTBUG-57147 Change-Id: I7d707c15b33c0f14810ef8fffef9f74dd4192e64 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | QQuickStyleSelector: fix built-in file selectorsJ-P Nurmi2017-05-201-2/+10
|/ | | | | | | | | | | | | | | | While selecting style files, the standard built-in platform and local file selectors ("+linux", "+macos", "+windows"...) must be prefixed with the standard file selector indicator ("+"). Previously the style selector would not pick up platform-specific style files unless they were supplied without the prefix. [ChangeLog][Controls][Styles] Fixed the style selection mechanism so that now it is possible to organize platform and locale-specific files into sub-directories, such as "+linux", "+macos", and "+windows". Change-Id: Ia44b6f14fd0247943486fd27609147827bda9666 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Make QQuickStyleSelector::select() more robustJ-P Nurmi2017-03-011-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | While debugging QTBUG-59026, I found out that QLocale::name() is empty with the "C" locale. Because the empty locale name was used as a selector in QQuickStyleSelector, it ended up registering QML types using URLs that contained a double slash (empty locale selector matched): QtQuick/Controls.2/Material//RadioButton.qml At the same time, the QML engine imported implicitly internal QML types constructing the URLs directly based on the location on the file system without a double slash: QtQuick/Controls.2/Material/RadioIndicator.qml As a result, the same QML module ended up having types registered from two different URLs, which is not allowed. This change simply prevents both problems. First of all, if the locale name is empty for any reason, it won't be added anymore to the list of selectors. Furthermore, the final selected URL is normalized to avoid redundant dashes. Task-number: QTBUG-59026 Change-Id: I19b890451aaddfe4277bb6b26bc3c1394a75a704 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Welcome to 2017J-P Nurmi2017-01-091-1/+1
| | | | | Change-Id: If68cff4efacc7dc5719c8b8e61937e85e9076870 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Let specifying the fallback style for custom stylesJ-P Nurmi2016-10-251-17/+46
| | | | | | | | | | | | | | | | | | For example, you can call QQuickStyle::setStyle(":/mycontrols") and QQuickStyle::setFallbackStyle("Material") to select a custom style so that the missing files will fallback to the Material style. Notice that the Material and Universal styles do not contain all files. For example, the non-visual Control.qml, Container.qml are not duplicated. For these, we must fallback to the Default style that is guaranteed to contain them all. [ChangeLog][Controls] Added support for specifying the fallback style for custom styles via :/qtquickcontrols2.conf, QT_QUICK_CONTROLS_FALLBACK_STYLE or QQuickStyle::setFallbackStyle(). Change-Id: I00be1c8c6aaca875ef851c90d018e9b5e2f501b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Use QFileSelectorPrivate::selectionHelper()J-P Nurmi2016-05-301-30/+3
| | | | | Change-Id: I0d37dd650e7be4e160d4d49dcb3c678c54f12218 Reviewed-by: Liang Qi <liang.qi@qt.io>
* Optimize QQuickStyleSelectorJ-P Nurmi2016-04-261-9/+8
| | | | | | | | | | | QQuickStyle::name() accesses a Q_GLOBAL_STATIC and splits the style path. Don't call it repeatedly, but store the value in constructor to share it for all consequent select() calls. QQuickStyleSelector is allocated on the stack in QtQuickControls2Plugin::registerTypes(), so memory usage is no concern. Change-Id: I31c1693bca277911232e3cbd7cb6f55b2aa7ed2a Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* QQuickStyleSelector: fix relative path handlingJ-P Nurmi2016-04-251-2/+6
| | | | | | | | | | | | This makes it possible to pass a relative path to the style: ./myapp -style relative/path/to/my/style To make the tests pass, includes a fix to avoid double slashes in selected URLs. Change-Id: I1b366eb7793523dd0f1058236661cedaa1216f3d Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* QQuickStyleSelector: re-use QFileSelectorPrivate::platformSelectors()J-P Nurmi2016-04-251-34/+3
| | | | | | | Better not to duplicate this code, because it will easily get out of sync. Change-Id: I9a5eb97cee2c3d15ebc4af157cee3d54d4a9e700 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
* QQuickStyleSelector: don't force lowercase style nameJ-P Nurmi2016-04-211-1/+1
| | | | | | | | | | | We'll have to also implement case-insensitive style lookup later. For now, this is required to be able to rename the imports, because the styles will reside in folders called "Material" and "Universal" instead of "material" and "universal" as they were before. Change-Id: I71edf1d447d78440a79241e53cb674f85b872078 Task-number: QTBUG-52549 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* 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>
* Controls: rename the C++ module to qtquickcontrols2J-P Nurmi2016-04-131-0/+193
Change-Id: I087a39baebc296a340739161874636926adaa56c Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>