Commit cf8b00bb authored by Leander Schulten's avatar Leander Schulten
Browse files

Inplement first qml tests

parent 99bde1da
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
Item{
height: 100
width: parent.width
Text {
text: devs.model.rowCount()
}
ListView{
id:devs
model: deviceModel
anchors.fill: parent
delegate: ItemDelegate{
text:model.modelData
}
}
}
......@@ -14,19 +14,22 @@
#include "usermanagment.h"
#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include "device.h"
#include <QQmlContext>
#include <QFileInfo>
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
const auto filename = "QTJSONFile.json";
QFile file(filename);
qDebug()<< QFileInfo(file).absoluteFilePath() <<'\n';
auto model = IDBaseDataModel<Channel>::singletone();
ApplicationData::loadData(file);
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
qDebug() << model->rowCount()<<'\n';
......@@ -42,7 +45,9 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
engine.load(QUrl(QLatin1String("qrc:/Test.qml")));
engine.rootContext()->setContextProperty("deviceModel",IDBaseDataModel<DevicePrototype>::singletone());
qDebug() << "Number of Elements : "<<IDBaseDataModel<DevicePrototype>::singletone()->rowCount()<<'\n';
engine.load(QUrl(QLatin1String("qrc:/main.qml")));
return app.exec();
......
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
title: qsTr("Lichtsteuerung")
header:TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
TabButton {
text: qsTr("Devices")
}
TabButton {
text: qsTr("DevicePrototypes")
}
TabButton {
text: qsTr("ProgrammPrototypes")
}
TabButton {
text: qsTr("Programms")
}
}
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
DeviceView{
}
Page{
title: "test"
Rectangle{
height: 100
width: 100
anchors.centerIn: parent
color: "red"
}
}
Page {
Label {
text: qsTr("Second page")
anchors.centerIn: parent
}
Button{
contentItem: Text {
id: testwe
text: qsTr("text");
rotation: 90
}
}
}
}
}
......@@ -2,5 +2,7 @@
<qresource prefix="/">
<file>Test.qml</file>
<file>qtquickcontrols2.conf</file>
<file>main.qml</file>
<file>DeviceView.qml</file>
</qresource>
</RCC>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment