diff options
Diffstat (limited to 'src/controls/doc/src/qtquickcontrols2-index.qdoc')
-rw-r--r-- | src/controls/doc/src/qtquickcontrols2-index.qdoc | 57 |
1 files changed, 51 insertions, 6 deletions
diff --git a/src/controls/doc/src/qtquickcontrols2-index.qdoc b/src/controls/doc/src/qtquickcontrols2-index.qdoc index 40d18801..b371ab1b 100644 --- a/src/controls/doc/src/qtquickcontrols2-index.qdoc +++ b/src/controls/doc/src/qtquickcontrols2-index.qdoc @@ -29,20 +29,65 @@ \page qtquickcontrols2-index.html \title Qt Quick Controls 2 - \brief The Qt Quick Controls 2 module provides a set of UI controls for Qt Quick. + \brief The Qt Quick Controls 2 module provides a set of UI controls for Qt + Quick. - The Qt Quick Controls 2 module provides a set of controls that can be used to - build complete interfaces in Qt Quick. + The Qt Quick Controls 2 module provides a set of controls that can be used + to build complete interfaces in Qt Quick. - The module is new in Qt 5.6. + \section1 QML Types - Visit the \l{Qt Quick Controls 2 Overview} page to get started. + \generatelist {qmltypesbymodule QtQuick.Controls} + + \section1 Getting Started + + A basic example of a QML file that makes use of controls is shown here: + + \snippet basic-example.qml 0 + + \section1 Setting Up Controls from C++ + + Although QQuickView has traditionally been used to display QML files in a + C++ application, doing this means you can only set window properties from + C++. + + With Qt Quick Controls 2, declare an ApplicationWindow as the root item of + your application and launch it by using QQmlApplicationEngine instead. + This ensures that you can control top level window properties from QML. + + A basic example of a source file that makes use of controls is shown here: + + \code + #include <QApplication> + #include <QQmlApplicationEngine> + + int main(int argc, char *argv[]) + { + QGuiApplication app(argc, argv); + QQmlApplicationEngine engine("main.qml"); + return app.exec(); + } + \endcode + + \section2 Using C++ Data From QML + + If you need to register a C++ class to use from QML, you can call + qmlRegisterType() before declaring your QQmlApplicationEngine. + See \l [QtQml] {Defining QML Types from C++} for more information. + + If you need to expose data to QML components, you need to make them + available to the context of the current QML engine. See QQmlContext for + more information. + + \section2 Deploying Qt Quick Controls 2 + + TODO \section1 Related information \list \li \l{Qt Quick} - \li \l{Qt Quick Controls 2 Overview} + \li \l{Qt Quick Layouts} \li \l{Qt Quick Controls 2 QML Types}{Qt Quick Controls 2 QML Types} \endlist */ |