aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyleselector_p_p.h
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2018-03-12 16:51:32 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2018-03-13 10:37:59 +0000
commit0cd3f970fff9643129a046a2bab1d79ce2f97c28 (patch)
tree54f9453c55068ba864cb3c212f6476dc7ed71310 /src/quickcontrols2/qquickstyleselector_p_p.h
parent57aa9580f07307c5e277e52362943e7efd1f9ac9 (diff)
Refactor QQuickStyleSelector
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>
Diffstat (limited to 'src/quickcontrols2/qquickstyleselector_p_p.h')
-rw-r--r--src/quickcontrols2/qquickstyleselector_p_p.h9
1 files changed, 3 insertions, 6 deletions
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