From f5467114b789dcb33ad88105fe84bddf42436d8c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 9 Nov 2016 17:06:17 +0100 Subject: 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 --- examples/quickcontrols2/gallery/gallery.cpp | 1 + examples/quickcontrols2/gallery/gallery.qml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'examples') 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) -- cgit v1.2.3