aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quickcontrols2/gallery
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-09 17:06:17 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-10 11:28:10 +0000
commitf5467114b789dcb33ad88105fe84bddf42436d8c (patch)
treebac248119788d47ee05e99e6f0cdf2ac0c179407 /examples/quickcontrols2/gallery
parentd6e03b3837f369e9fc94915ef3ad649903845382 (diff)
QQuickStyle::availableStyles()
This allows us to introduce platform-specific styles, such as the iOS style, and make them appear correctly in the Gallery example so that we don't have to hard-code the lists separately for different platforms. [ChangeLog][Controls][QQuickStyle] Added availableStyles() method that returns the list of available built-in styles. Change-Id: Ieea88577f402cbc52a844d6777e64c6bd55c5ab9 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'examples/quickcontrols2/gallery')
-rw-r--r--examples/quickcontrols2/gallery/gallery.cpp1
-rw-r--r--examples/quickcontrols2/gallery/gallery.qml2
2 files changed, 2 insertions, 1 deletions
diff --git a/examples/quickcontrols2/gallery/gallery.cpp b/examples/quickcontrols2/gallery/gallery.cpp
index 90b63cac..bfbdb49c 100644
--- a/examples/quickcontrols2/gallery/gallery.cpp
+++ b/examples/quickcontrols2/gallery/gallery.cpp
@@ -60,6 +60,7 @@ int main(int argc, char *argv[])
QQuickStyle::setStyle(settings.value("style").toString());
QQmlApplicationEngine engine;
+ engine.rootContext()->setContextProperty("availableStyles", QQuickStyle::availableStyles());
engine.load(QUrl("qrc:/gallery.qml"));
if (engine.rootObjects().isEmpty())
return -1;
diff --git a/examples/quickcontrols2/gallery/gallery.qml b/examples/quickcontrols2/gallery/gallery.qml
index 89c0c607..c68765b5 100644
--- a/examples/quickcontrols2/gallery/gallery.qml
+++ b/examples/quickcontrols2/gallery/gallery.qml
@@ -256,7 +256,7 @@ ApplicationWindow {
ComboBox {
id: styleBox
property int styleIndex: -1
- model: ["Default", "Material", "Universal"]
+ model: availableStyles
Component.onCompleted: {
styleIndex = find(settings.style, Qt.MatchFixedString)
if (styleIndex !== -1)