diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2018-03-15 13:41:54 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2018-03-16 12:06:11 +0000 |
commit | 7dbe1348cc7270a28026b012610f5a2bbe7ae429 (patch) | |
tree | 989c72ef932f14c86443ed618254c346ddd61089 /tests/auto/qquickstyle | |
parent | 87d3e84c75839b736d45f2773fc5fb4ecce14296 (diff) |
QQuickStyle: add API for managing style paths
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>
Diffstat (limited to 'tests/auto/qquickstyle')
-rw-r--r-- | tests/auto/qquickstyle/tst_qquickstyle.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qquickstyle/tst_qquickstyle.cpp b/tests/auto/qquickstyle/tst_qquickstyle.cpp index 4a34f24a..555e1686 100644 --- a/tests/auto/qquickstyle/tst_qquickstyle.cpp +++ b/tests/auto/qquickstyle/tst_qquickstyle.cpp @@ -151,8 +151,8 @@ void tst_QQuickStyle::availableStyles() { QString path = QFINDTESTDATA("data"); QVERIFY(!path.isEmpty()); - qputenv("QT_QUICK_CONTROLS_STYLE_PATH", path.toLocal8Bit()); + QQuickStyle::addStylePath(path); QStringList paths = QQuickStylePrivate::stylePaths(); QVERIFY(paths.contains(path)); |