/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see http://www.qt.io/terms-conditions. For further
** information use the contact form at http://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: http://www.gnu.org/copyleft/fdl.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \page qtquickcontrols2-styles.html
    \title Styling Qt Quick Controls 2

    Qt Quick Controls 2 comes with a selection of styles.

    \raw HTML
    <table style="background:transparent; border:0px">
      <tr>
        <td style="border:0px">
          <a href="qtquickcontrols2-default.html">
            <img src="images/qtquickcontrols2-default.png" width="45%"/>
          </a>
        </td>
        <td style="border:0px">
          <a href="qtquickcontrols2-material.html">
            <img src="images/qtquickcontrols2-material.png" width="75%"/>
          </a>
        </td>
        <td style="border:0px">
          <a href="qtquickcontrols2-universal.html">
            <img src="images/qtquickcontrols2-universal.png" width="75%"/>
          </a>
        </td>
      </tr>
      <tr>
        <td style="border:0px">
          The <a href="qtquickcontrols2-default.html">Default</a> style is
          a simple and light-weight all-round style that offers the maximum
          performance for Qt Quick Controls 2.
        </td>
        <td style="border:0px">
          The <a href="qtquickcontrols2-material.html">Material</a> style offers an appealing design
          based on the <a href="https://www.google.com/design/spec/material-design/introduction.html">
          Google Material Design Guidelines</a>, but requires more system resources than the Default style.
        </td>
        <td style="border:0px">
          The <a href="qtquickcontrols2-universal.html">Universal</a> style offers an appealing design
          based on the <a href="https://dev.windows.com/design">Microsoft Universal Design Guidelines</a>,
          but requires more system resources than the Default style.
        </td>
      </tr>
    </table>
    \endraw

    \section1 Using Styles in Qt Quick Controls 2

    In order to run an application with a specific style, either configure the
    style using \l QQuickStyle in C++, pass a command line argument, or set an
    environment variable. Alternatively, the preferred style and style-specific
    attributes can be specified in a configuration file.

    The priority of these approaches follows the order they are listed below,
    from highest to lowest. That is, using QQuickStyle to set the style will
    always take priority over using the command line argument, for example.

    \section2 Using QQuickStyle in C++

    \l QQuickStyle provides API for configuring a specific style. The following
    example runs a Qt Quick Controls 2 application with the Material style:

    \code
    #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();
    }
    \endcode

    \section2 Command line argument

    Passing a \c -style command line argument is the convenient way to test different
    styles. It takes precedence over the other methods listed below. The following
    example runs a Qt Quick Controls 2 application with the Material style:

    \code
    ./app -style material
    \endcode

    \section2 Environment variable

    Setting the \c QT_QUICK_CONTROLS_STYLE environment variable can be used to set
    a system-wide style preference. It takes precedence over the configuration file
    mentioned below. The following example runs a Qt Quick Controls 2 application with
    the Universal style:

    \code
    QT_QUICK_CONTROLS_STYLE=universal ./app
    \endcode

    \section2 Configuration file
    \target qtquickcontrols2-conf

    Qt Quick Controls 2 support a special configuration file, \c :/qtquickcontrols2.conf,
    that is built into an application's resources.

    The configuration file can specify the preferred style (may be overridden by either
    of the methods described earlier) and certain style-specific attributes. The following
    example specifies that the preferred style is the Material style. Furthermore, when the
    application is run with the Material style, its theme is light and the accent and primary
    colors are teal and blue grey, respectively. However, if the application is run with the
    Universal style instead, the theme is dark and the accent color is red.

    \code
    [Controls]
    Style=Material

    [Universal]
    Theme=Dark
    Accent=Red

    [Material]
    Theme=Light
    Accent=Teal
    Primary=BlueGrey
    \endcode

    In order to make it possible for Qt Quick Controls 2 to find the configuration file,
    it must be built into application's resources using the \l {The Qt Resource System}.
    Here's an example \c .qrc file:

    \code
    <!DOCTYPE RCC><RCC version="1.0">
    <qresource prefix="/">
        <file>qtquickcontrols2.conf</file>
    </qresource>
    </RCC>
    \endcode

    \note Qt Quick Controls 2 uses a file selector to load the configuration file. It
    is possible to provide a different configuration file for different platforms and
    locales. See \l QFileSelector documentation for more details.

    Finally, the \c .qrc file must be listed in the application's \c .pro file so that
    the build system knows about it. For example:

    \code
    RESOURCES = application.qrc
    \endcode

    \section1 Related Information
    \list
    \li \l {Default Style}
    \li \l {Material Style}
    \li \l {Universal Style}
    \li \l{Using File Selectors with Qt Quick Controls 2}
    \li \l {Deploying Qt Quick Controls 2 Applications}
    \endlist
*/
