reworked section handling (a bit)
This commit is contained in:
@@ -271,39 +271,38 @@ void XQMainWindow::onTabClicked( int index )
|
||||
_mainTreeView->setCurrentIndex( _documentStore[index].treeItem->index() );
|
||||
}
|
||||
|
||||
void XQMainWindow::onSectionCreated( const XQModelSection* section )
|
||||
void XQMainWindow::onSectionCreated( const XQModelSection& section )
|
||||
{
|
||||
qDebug() << " --- XXX section created: " << section->row();
|
||||
qDebug() << " --- XXX section created: " << section.contentType() << ":" << section.contentType();
|
||||
}
|
||||
|
||||
void XQMainWindow::onSectionToggled( const XQModelSection* section )
|
||||
void XQMainWindow::onSectionToggled( const XQModelSection& section )
|
||||
{
|
||||
qDebug() << " --- XXX section toggled: " << section->row();
|
||||
qDebug() << " --- XXX section toggled: " << section.contentType() << ":" << section.sheetRootNode()->to_string();
|
||||
}
|
||||
|
||||
//! liest eine XML datei namens 'fileName'
|
||||
|
||||
void XQMainWindow::loadDocument( const QString& fileName )
|
||||
{
|
||||
// gibts die Datei?
|
||||
|
||||
// gibts die Datei?
|
||||
if( !QFile::exists( fileName) )
|
||||
throw XQException( "no such file", fileName );
|
||||
|
||||
// load data tree from xml file
|
||||
XQNodeFactory treeLoader;
|
||||
// xml daten laden
|
||||
XQNodePtr rawTree = treeLoader.load_tree( qPrintable(fileName) );
|
||||
|
||||
// versteckten root node ignorieren
|
||||
XQNodePtr contentRoot = rawTree->first_child();
|
||||
|
||||
// Project-ID behandeln
|
||||
const QString& pID = contentRoot->attribute(c_ProjectID);
|
||||
int idx = _documentStore.indexOf( pID );
|
||||
if( idx > -1 )
|
||||
{
|
||||
const XQDocument& doc = _documentStore.at(idx);
|
||||
const XQDocument& document = _documentStore.at(idx);
|
||||
QMessageBox::warning( this, "Load Document", QString("File: %1 already loaded.").arg( fileName ) );
|
||||
_mainTreeView->setCurrentIndex( doc.treeItem->index() );
|
||||
_mainTreeView->setCurrentIndex( document.treeItem->index() );
|
||||
_tabWidget->setCurrentIndex( idx );
|
||||
return;
|
||||
}
|
||||
@@ -322,8 +321,9 @@ void XQMainWindow::loadDocument( const QString& fileName )
|
||||
// Ein neues Child-Model erzeugen
|
||||
XQChildModel* childModel = new XQChildModel(this);
|
||||
|
||||
// die Modelstruktur anlegen
|
||||
childModel->initModel( c_ChildModelName );
|
||||
connect( childModel, SIGNAL(sectionCreated(XQModelSection)), this, SLOT(onSectionCreated(XQModelSection)) );
|
||||
connect( childModel, SIGNAL(sectionToggled(XQModelSection)), this, SLOT(onSectionToggled(XQModelSection)) );
|
||||
|
||||
|
||||
// Den globalen undo-stack ...
|
||||
childModel->setUndoStack(&_undoStack);
|
||||
@@ -331,24 +331,17 @@ void XQMainWindow::loadDocument( const QString& fileName )
|
||||
// und die TreeView übergeben
|
||||
childModel->setTreeTable(childTreeView);
|
||||
|
||||
bool c1 = connect( childModel, SIGNAL(sectionCreated(const XQModelSection*)), this, SLOT(onSectionCreated(const XQModelSection*)) );
|
||||
bool c2 = connect( childModel, SIGNAL(sectionToggled(const XQModelSection*)), this, SLOT(onSectionToggled(const XQModelSection*)) );
|
||||
// create new entry in the left side main tree view
|
||||
//XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
||||
//_mainTreeView->setCurrentIndex( newEntry->index() );
|
||||
//_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
|
||||
|
||||
qDebug() << " --- EWTF: " << c1 << ":" << c2;
|
||||
// die Modelstruktur anlegen
|
||||
childModel->initModel( c_ChildModelName );
|
||||
|
||||
// model inhalte laden
|
||||
childModel->setContent( contentRoot->first_child() );
|
||||
|
||||
/*
|
||||
// create new entry in the left side main tree view
|
||||
XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
||||
_mainTreeView->setCurrentIndex( newEntry->index() );
|
||||
_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user