This commit is contained in:
2025-09-25 22:36:59 +02:00
parent defa6a1906
commit 6b675cb85e
4 changed files with 4 additions and 44 deletions

View File

@@ -117,7 +117,7 @@ void XQMainWindow::initMainWindow()
// #2. load demo data
loadDocument( c_DocumentFileName1 );
loadDocument( c_DocumentFileName2, true );
//loadDocument( c_DocumentFileName2, true );
//loadDocument( c_DocumentFileName2 );
//loadDocument( c_DocumentFileName3 );
@@ -428,44 +428,6 @@ void XQMainWindow::loadDocument( const QString& fileName, bool useQML )
}
void XQMainWindow::loadDocumentQML( const QString& fileName )
{
// gibts die Datei?
if( !QFile::exists( fileName) )
throw XQException( "no such file", fileName );
XQNodeFactory treeLoader;
// xml daten laden
XQNodePtr rawTree = treeLoader.load_tree( qPrintable(fileName) );
// versteckten root node ignorieren
XQNodePtr contentRoot = rawTree->first_child();
// 'friendly Name' ist ein Link auf ein anderes Attribute
// das als Namen verwendet wird.
const QString& fName = contentRoot->friendly_name();
// Ein neues Child-Model erzeugen
XQChildModel* childModel = new XQChildModel(this);
// die Modelstruktur anlegen
childModel->initModel( c_ChildModelName );
// model inhalte laden
childModel->addModelData( contentRoot->first_child() );
XQQuickWidget* quickChild = new XQQuickWidget(_tabWidget);
//quickChild->setResizeMode(QQuickWidget::SizeViewToRootObject);
quickChild->rootContext()->setContextProperty("xtrChildModel", childModel);
quickChild->setSource(QUrl("qrc:/xqtreeview.qml"));
_tabWidget->addTab( quickChild, "QML:"+fName );
_tabWidget->setCurrentWidget( quickChild );
quickChild->setResizeMode(QQuickWidget::SizeRootObjectToView);
}
//! speichert ein XML unter dem 'filename'
void XQMainWindow::saveDocument( const QString& fileName )

View File

@@ -64,12 +64,10 @@ public slots:
// fixme implement
//void showDocument( const QString& key ){}
void loadDocument( const QString& fileName, bool useQML=false );
void loadDocumentQML( const QString& fileName );
void saveDocument( const QString& fileName );
static void setupWorkingDir();
protected:
XQNodePtr createDataTree( const QString& fileName );

View File

@@ -166,10 +166,10 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode
if( !sheetNode->has_attribute( c_ContentType) )
throw XQException( "section list: Section node needs attribute 'ContentType'!");
// 5. das erzeugt dann auch valide indices
// 4. das erzeugt dann auch valide indices
appendRow(list);
// 6. jetzt können wir auch die section erzeugen
// 5. jetzt können wir auch die section erzeugen
const XQModelSection& section = _sections.createSection( list[0]->index(), sheetNode );
// ... und es der welt mitteilen.