added section signals

This commit is contained in:
2025-08-16 16:39:23 +02:00
parent d249c9c631
commit 8756793039
9 changed files with 648 additions and 13 deletions

View File

@@ -87,10 +87,14 @@ void XQMainWindow::initMainWindow()
//connect( _mainTreeView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onDoubleClicked(QModelIndex)) );
connect( _mainTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(onTreeItemClicked(QModelIndex)) );
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
connect( &_mainModelView, &XQViewModel::xqItemCreated, this, [=, this](XQItem* item)
/*
connect( &_mainModelView, &XQViewModel::itemCreated, this, [=, this](XQItem* item)
{
// when a new main tree item has been created ...
QString pID = item->contentNode()->attribute(c_ProjectID);
@@ -99,6 +103,7 @@ void XQMainWindow::initMainWindow()
if( _documentStore.contains( pID ) )
_tabWidget->setCurrentWidget( _documentStore[pID].modelView->treeTable() );
} );
*/
try
{
@@ -266,6 +271,15 @@ void XQMainWindow::onTabClicked( int index )
_mainTreeView->setCurrentIndex( _documentStore[index].treeItem->index() );
}
void XQMainWindow::onSectionCreated( const XQModelSection* section )
{
qDebug() << " --- XXX section created: " << section->row();
}
void XQMainWindow::onSectionToggled( const XQModelSection* section )
{
qDebug() << " --- XXX section toggled: " << section->row();
}
//! liest eine XML datei namens 'fileName'
@@ -307,14 +321,22 @@ void XQMainWindow::loadDocument( const QString& fileName )
// Ein neues Child-Model erzeugen
XQChildModel* childModel = new XQChildModel(this);
// die Modelstruktur anlegen
childModel->initModel( c_ChildModelName );
// Den globalen undo-stack ...
childModel->setUndoStack(&_undoStack);
// und die TreeView übergeben
childModel->setTreeTable(childTreeView);
// read the model data
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*)) );
qDebug() << " --- EWTF: " << c1 << ":" << c2;
// model inhalte laden
childModel->setContent( contentRoot->first_child() );
/*
@@ -324,6 +346,10 @@ void XQMainWindow::loadDocument( const QString& fileName )
_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
*/
}

View File

@@ -48,6 +48,10 @@ public slots:
void onTreeItemClicked(const QModelIndex& index );
void onTabClicked( int index );
//void onItemCreated( XQItem* item );
void onSectionCreated( const XQModelSection* section);
void onSectionToggled( const XQModelSection* section );
protected: