little breakthrought im QML Layouts
This commit is contained in:
90
src/main.cpp
90
src/main.cpp
@@ -15,6 +15,13 @@
|
||||
#include <QDebug>
|
||||
#include <QApplication>
|
||||
#include <QMetaType>
|
||||
#include <QGuiApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QUrl>
|
||||
#include <QQmlContext>
|
||||
|
||||
#include <xqchildmodel.h>
|
||||
#include <xqquickwidget.h>
|
||||
|
||||
#include <xqmainwindow.h>
|
||||
|
||||
@@ -49,12 +56,58 @@ who is who:
|
||||
|
||||
*/
|
||||
|
||||
XQChildModel* createChildModel()
|
||||
{
|
||||
XQChildModel* myModel = new XQChildModel();
|
||||
|
||||
myModel->initModel( c_ChildModelName );
|
||||
|
||||
XQNodeFactory treeLoader;
|
||||
// xml daten laden
|
||||
XQNodePtr rawTree = treeLoader.load_tree( qPrintable(c_DocumentFileName1) );
|
||||
// versteckten root node ignorieren
|
||||
XQNodePtr contentRoot = rawTree->first_child();
|
||||
myModel->addModelData( contentRoot->first_child() );
|
||||
|
||||
return myModel;
|
||||
|
||||
}
|
||||
|
||||
|
||||
class DummyModel : public XQChildModel
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
DummyModel()
|
||||
{
|
||||
|
||||
initModel( c_ChildModelName );
|
||||
XQNodeFactory treeLoader;
|
||||
// xml daten laden
|
||||
XQNodePtr rawTree = treeLoader.load_tree( qPrintable(c_DocumentFileName1) );
|
||||
// versteckten root node ignorieren
|
||||
XQNodePtr contentRoot = rawTree->first_child();
|
||||
addModelData( contentRoot->first_child() );
|
||||
|
||||
//XQTreeTable* treeTable = new XQTreeTable;
|
||||
//treeTable->setModel(this);
|
||||
//setTreeTable( treeTable );
|
||||
|
||||
//treeTable->show();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
using namespace Qt::Literals::StringLiterals;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
// Signal für einzelne QStandardItem-Änderungen
|
||||
connect(model, &QStandardItemModel::itemChanged,
|
||||
this, [](QStandardItem *changedItem){
|
||||
@@ -63,10 +116,41 @@ connect(model, &QStandardItemModel::itemChanged,
|
||||
});
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
QApplication app(argc, argv);
|
||||
//app.setStyle("fusion");
|
||||
XQMainWindow window;
|
||||
window.show();
|
||||
*/
|
||||
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
|
||||
XQMainWindow::setupWorkingDir();
|
||||
XQItemFactory::instance().initItemFactory( c_ModelSheetFileName );
|
||||
|
||||
XQChildModel* myModel = createChildModel();
|
||||
qmlRegisterType< XQChildModel>("MyApp.Models", 1, 0, "MyChildModel");
|
||||
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
engine.rootContext()->setContextProperty("myChildModel", myModel);
|
||||
|
||||
QObject::connect(
|
||||
&engine,
|
||||
&QQmlApplicationEngine::objectCreationFailed,
|
||||
&app,
|
||||
[]() { QCoreApplication::exit(-1); },
|
||||
Qt::QueuedConnection);
|
||||
|
||||
qDebug() << " fitz!";
|
||||
|
||||
engine.load( QUrl(QStringLiteral("qrc:/dummyview.qml")) );
|
||||
//engine.load( QUrl(QStringLiteral("qrc:/xqtableview.qml")) );
|
||||
|
||||
qDebug() << " hhakl!";
|
||||
|
||||
return app.exec();
|
||||
|
||||
|
Reference in New Issue
Block a user