aboutsummaryrefslogtreecommitdiffstats
path: root/src/quickcontrols2/qquickstyleselector_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.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.h')
-rw-r--r--src/quickcontrols2/qquickstyleselector_p.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/quickcontrols2/qquickstyleselector_p.h b/src/quickcontrols2/qquickstyleselector_p.h
index 29dba836..c4c0f540 100644
--- a/src/quickcontrols2/qquickstyleselector_p.h
+++ b/src/quickcontrols2/qquickstyleselector_p.h
@@ -67,10 +67,13 @@ public:
QQuickStyleSelector();
~QQuickStyleSelector();
- QUrl baseUrl() const;
- void setBaseUrl(const QUrl &url);
+ QStringList selectors() const;
+ void addSelector(const QString &selector);
- QString select(const QString &fileName) const;
+ QStringList paths() const;
+ void setPaths(const QStringList &paths);
+
+ QUrl select(const QString &fileName) const;
private:
Q_DISABLE_COPY(QQuickStyleSelector)