QQuickStyle Class

The QQQuickStyle class allows configuring the application style. More...

Header: #include <QQuickStyle>
Since: Qt 5.7

Static Public Members

QString name()
QString path()
void setStyle(const QString &style)

Detailed Description

The QQQuickStyle class allows configuring the application style.

QQuickStyle provides API for querying and configuring the application styles of Qt Quick Controls 2.

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QQuickStyle>

int main(int argc, char *argv[])
{
    QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QGuiApplication app(argc, argv);

    QQuickStyle::setStyle("Material");

    QQmlApplicationEngine engine;
    engine.load(QUrl("qrc:/main.qml"));

    return app.exec();
}

Note: The style must be configured before loading QML that imports Qt Quick Controls 2. It is not possible to change the style after the QML types have been registered.

See also Styling Qt Quick Controls 2.

Member Function Documentation

[static] QString QQuickStyle::name()

Returns the name of the application style.

Note: The application style can be specified by passing a -style command line argument. Therefore name() may not return a fully resolved value if called before constructing a QGuiApplication.

[static] QString QQuickStyle::path()

Returns the path of an overridden application style, or an empty string if the style is one of the built-in Qt Quick Controls 2 styles.

Note: The application style can be specified by passing a -style command line argument. Therefore path() may not return a fully resolved value if called before constructing a QGuiApplication.

[static] void QQuickStyle::setStyle(const QString &style)

Sets the application style to style.

Note: The style must be configured before loading QML that imports Qt Quick Controls 2. It is not possible to change the style after the QML types have been registered.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.