-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
31 lines (29 loc) · 1.08 KB
/
Copy pathmain.cpp
File metadata and controls
31 lines (29 loc) · 1.08 KB
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
30
31
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include <QtQuick/QQuickView>
#include "Models/SubListedListModel.h"
#include "Models/devicemodelitem.h"
int main(int argc, char *argv[])
{
//Запуск как в примере с touch
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
Models::ListModel* devicesModel = new Models::SubListedListModel(new DeviceModelItem());
//DEBUG
devicesModel->appendRow(new DeviceModelItem());
devicesModel->appendRow(new DeviceModelItem());
devicesModel->appendRow(new DeviceModelItem());
devicesModel->appendRow(new DeviceModelItem());
devicesModel->appendRow(new DeviceModelItem());
engine.rootContext()->setContextProperty("deviceModel",devicesModel);
engine.load(QUrl("qrc:///qml/main.qml"));
QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel); \
if ( !window ) {
qWarning("Error: Your root item has to be a Window."); \
return -1;
}
window->show();
return app.exec();
}