aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/platform/doc/src/includes/widgets.qdocinc
blob: c89c3ca0aaa9f8830a897cdfda180be82da7c405 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
//! [1]
The Qt Labs Platform module uses Qt Widgets as a fallback on platforms that
do not have a native implementation available. Therefore, applications that
use types from the Qt Labs Platform module should link to QtWidgets and use
\l QApplication instead of \l QGuiApplication.

To link against the QtWidgets library, add the following to your qmake project
file:

\code
QT += widgets
\endcode

Create an instance of \l QApplication in \c main():

\code
#include <QApplication>
#include <QQmlApplicationEngine>

int main(int argc, char *argv[])
{
    QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    QApplication app(argc, argv);
    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    return app.exec();
}
\endcode
//! [1]