sections in treeview.

This commit is contained in:
2025-08-18 21:09:57 +02:00
parent 429c939cdf
commit c870ef8801
5 changed files with 31 additions and 18 deletions

View File

@@ -63,11 +63,11 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
_treeTable->expand( index );
// ... und markieren
_treeTable->setCurrentIndex( index );
// den gesamten projekt knoten speichern, warum?
//newItem->setContentNode(contentNode);
// quellknoten auch speichern
newItem->setContentNode( contentNode );
// erzeuger sheet node speichern
newItem->setSheetNode( sheetNode );
emit itemCreated( newItem );
//emit itemCreated( newItem );
return newItem;
@@ -78,6 +78,17 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
throw XQException( "addProjectItem: main model should not be empty!" );
}
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
{
//XQNodePtr sheetNode = projectParent->sheetNode();
//XQItem* newItem = _itemFactory.makeItem(sheetNode, contentPtr );
XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection");
XQItem* newItem = _itemFactory.makeItem(sheetNode, &section.contentType() );
projectItem->appendRow( newItem );
_treeTable->expand( projectItem->index() );
}
/*
XQItem* XQMainModel::addSectionItem( XQItem* projectItem )
{

View File

@@ -33,8 +33,7 @@ public:
virtual ~XQMainModel() = default;
XQItem* addProjectItem( XQNodePtr contentNode );
public slots:
void addSectionItem( const XQModelSection& section, XQItem* projectItem );
protected:

View File

@@ -124,7 +124,7 @@ void XQMainWindow::initMainWindow()
// #2. load demo data
loadDocument( c_DocumentFileName1 );
//loadDocument( c_DocumentFileName2 );
loadDocument( c_DocumentFileName2 );
qDebug() << " --- all here: " << XQNode::s_Count;
@@ -259,12 +259,17 @@ void XQMainWindow::onTreeItemClicked(const QModelIndex& index )
qDebug() << " --- mainWindow onTreeItemClicked:" << entry.text();
return;
//_mainTreeView->selectionModel()->select(index, QItemSelectionModel::Select);
//entry->setBackground( QBrush( Qt::green ) );
_mainTreeView->selectionModel()->select(index, QItemSelectionModel::Select);
entry.setBackground( QBrush( Qt::green ) );
QString key = entry.attribute(c_ProjectID);
if( _documentStore.contains(key) )
qDebug() << " --- FIRZ: key: " << key;
bool isThere = _documentStore.contains(key);
if( isThere)
_tabWidget->setCurrentWidget( _documentStore[key].modelView->treeTable() );
}
@@ -283,14 +288,13 @@ void XQMainWindow::onSectionCreated( const XQModelSection& section )
{
if( _currentProjectItem )
{
;
_mainModelView.addSectionItem( section, _currentProjectItem );
}
qDebug() << " --- XXX section created: " << section.contentType() << ":" << section.contentType();
}
void XQMainWindow::onSectionToggled( const XQModelSection& section )
{
qDebug() << " --- XXX section toggled: " << section.contentType() << ":" << section.sheetRootNode()->to_string();
//qDebug() << " --- XXX section toggled: " << section.contentType() << ":" << section.sheetRootNode()->to_string();
}
//! liest eine XML datei namens 'fileName'