Moved child row creation to XQItemFactory, some other cleanups.
This commit is contained in:
@@ -88,48 +88,17 @@ void XQChildModel::addModelData( const XQNodePtr& contentRoot )
|
|||||||
// Die Beschreibungen für die optionalen Kinder
|
// Die Beschreibungen für die optionalen Kinder
|
||||||
// steck im ersten Knoten des Model-Sheets
|
// steck im ersten Knoten des Model-Sheets
|
||||||
if( !sheetNode->first_child()->has_children() )
|
if( !sheetNode->first_child()->has_children() )
|
||||||
{
|
|
||||||
qDebug() << " --- no sheet node for children";
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
addSectionChildren( list.front(), sheetNode->first_child(), contentEntry );
|
XQItemList childList = _itemFactory.makeRow( sheetNode, contentEntry );
|
||||||
|
// als kinder einfügen
|
||||||
|
list.front()->appendRow( childList );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // for
|
} // for
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void XQChildModel::addSectionChildren( QStandardItem* parent, const XQNodePtr& sheetNode, const XQNodePtr& contentEntry )
|
|
||||||
{
|
|
||||||
qDebug() << " --- AddModelData: CHILD Found for: :" << contentEntry->to_string() << " sheet parent: " << sheetNode->tag_name();
|
|
||||||
for (const auto& contentChild : contentEntry->children())
|
|
||||||
{
|
|
||||||
const QString& contentKey = contentChild->tag_name();
|
|
||||||
qDebug() << " --- Na Hopp1: " << contentChild->to_string() << " -> " <<contentKey;
|
|
||||||
qDebug() << " --- Na Hopp2: " << sheetNode->to_string();
|
|
||||||
// wir brauchen ein beschreibenden sheetnode für diesen content-child knoten
|
|
||||||
if( sheetNode->has_child( contentKey ))
|
|
||||||
{
|
|
||||||
const XQNodePtr& sheetChild = sheetNode->child(contentKey);
|
|
||||||
qDebug() << " --- Na Also: " << sheetChild->to_string();
|
|
||||||
|
|
||||||
|
|
||||||
for( const auto& sheetX : sheetChild->children() )
|
|
||||||
{
|
|
||||||
qDebug() << " --- --- sheetX: " << sheetX->to_string();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
XQItemList list = _itemFactory.makeRow( sheetChild, contentChild );
|
|
||||||
//insertRow( parent->row()+1, list );
|
|
||||||
parent->appendRow( list );
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//! erzeugt ein adhoc-contextmenu, je nachdem welche aktionen gerade möglich sind.
|
//! erzeugt ein adhoc-contextmenu, je nachdem welche aktionen gerade möglich sind.
|
||||||
|
|
||||||
|
@@ -31,7 +31,6 @@ public:
|
|||||||
|
|
||||||
void addModelData(const XQNodePtr& contentRoot );
|
void addModelData(const XQNodePtr& contentRoot );
|
||||||
void addSectionEntry( const QString& key, const XQNodePtr& contentEntry );
|
void addSectionEntry( const QString& key, const XQNodePtr& contentEntry );
|
||||||
void addSectionChildren(QStandardItem* parent, const XQNodePtr& sheetNode, const XQNodePtr& contentEntry );
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ void XQMainWindow::initMainWindow()
|
|||||||
// #2. load demo data
|
// #2. load demo data
|
||||||
loadDocument( c_DocumentFileName1 );
|
loadDocument( c_DocumentFileName1 );
|
||||||
//loadDocument( c_DocumentFileName2, true );
|
//loadDocument( c_DocumentFileName2, true );
|
||||||
//loadDocument( c_DocumentFileName2 );
|
loadDocument( c_DocumentFileName2 );
|
||||||
//loadDocument( c_DocumentFileName3 );
|
//loadDocument( c_DocumentFileName3 );
|
||||||
|
|
||||||
|
|
||||||
@@ -260,7 +260,6 @@ void XQMainWindow::onTreeViewItemClicked( const XQItem& item )
|
|||||||
|
|
||||||
void XQMainWindow::onTreeViewItemChanged(const XQItem& item )
|
void XQMainWindow::onTreeViewItemChanged(const XQItem& item )
|
||||||
{
|
{
|
||||||
qDebug() << " --- TREE VIEW itemChanged: text" << item.text() << " parent: " << item.parent()->text() << " type: " << item.itemType().text() << " : " << (void*)&_mainModel << " : " << (void*) sender();
|
|
||||||
// hier müssen wir erst das projekt aktivieren
|
// hier müssen wir erst das projekt aktivieren
|
||||||
XQItem* xqItem = static_cast<XQItem*>(item.parent());
|
XQItem* xqItem = static_cast<XQItem*>(item.parent());
|
||||||
onTreeViewItemClicked( *xqItem );
|
onTreeViewItemClicked( *xqItem );
|
||||||
@@ -269,7 +268,6 @@ void XQMainWindow::onTreeViewItemChanged(const XQItem& item )
|
|||||||
int idx = _tabWidget->currentIndex();
|
int idx = _tabWidget->currentIndex();
|
||||||
if(_documentStore.contains(idx) )
|
if(_documentStore.contains(idx) )
|
||||||
{
|
{
|
||||||
qDebug() << " --- Has Document and might toggle: " << item.text();
|
|
||||||
XQViewModel& childModel = *_documentStore[idx].viewModel;
|
XQViewModel& childModel = *_documentStore[idx].viewModel;
|
||||||
childModel.onToggleSection(item.text());
|
childModel.onToggleSection(item.text());
|
||||||
}
|
}
|
||||||
|
@@ -167,13 +167,23 @@ XQItemList XQItemFactory::makeRow(const XQNodePtr& sheetNode, const XQNodePtr& c
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
XQItemList XQItemFactory::makeChildRow( XQItem* parent, const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
|
||||||
{
|
|
||||||
Q_UNUSED(parent);
|
|
||||||
Q_UNUSED(sheetNode);
|
|
||||||
Q_UNUSED(contentNode);
|
|
||||||
|
|
||||||
return XQItemList();
|
//! Erzeugt kind-items zu einem section-eintrag.
|
||||||
|
|
||||||
|
XQItemList XQItemFactory::makeChildRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||||
|
{
|
||||||
|
XQItemList list;
|
||||||
|
for (const auto& contentChild : contentNode->children())
|
||||||
|
{
|
||||||
|
const QString& contentKey = contentChild->tag_name();
|
||||||
|
// wir brauchen ein beschreibenden sheetnode für diesen content-child knoten
|
||||||
|
if( sheetNode->has_child( contentKey ))
|
||||||
|
{
|
||||||
|
const XQNodePtr& sheetChild = sheetNode->child(contentKey);
|
||||||
|
list = makeRow( sheetChild, contentChild );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Erzeugt ein XQItem aus einer typ-beschreibung ('sheetNode') und einem daten-knoten ('contentNode').
|
//! Erzeugt ein XQItem aus einer typ-beschreibung ('sheetNode') und einem daten-knoten ('contentNode').
|
||||||
|
@@ -32,8 +32,9 @@ public:
|
|||||||
|
|
||||||
XQNodePtr findModelSheet( const QString& modelName ) const;
|
XQNodePtr findModelSheet( const QString& modelName ) const;
|
||||||
|
|
||||||
|
// __fix auf nicht vorhandenen content felder prüfen! vereinheitlichen!
|
||||||
XQItemList makeRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
XQItemList makeRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||||
XQItemList makeChildRow( XQItem* parent, const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
XQItemList makeChildRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||||
XQItem* makeSingleItem( const XQNodePtr& sheetNode, const QString& caption );
|
XQItem* makeSingleItem( const XQNodePtr& sheetNode, const QString& caption );
|
||||||
|
|
||||||
void setItemTypeDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const;
|
void setItemTypeDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const;
|
||||||
|
@@ -182,8 +182,6 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode
|
|||||||
|
|
||||||
void XQViewModel::onToggleSection(const QString& sectionKey )
|
void XQViewModel::onToggleSection(const QString& sectionKey )
|
||||||
{
|
{
|
||||||
qDebug() << " --- Model: " << this->objectName() << " should toggle: " << sectionKey << ": " << _sections.hasValidSection( sectionKey );
|
|
||||||
_sections.dump();
|
|
||||||
if(_sections.hasValidSection( sectionKey ) )
|
if(_sections.hasValidSection( sectionKey ) )
|
||||||
toggleSection( _sections.sectionByKey(sectionKey) );
|
toggleSection( _sections.sectionByKey(sectionKey) );
|
||||||
}
|
}
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
<HeaderType RenderStyle="HeaderStyle" EditorType="LineEditType" ItemFlags="IsEnabled"/>
|
<HeaderType RenderStyle="HeaderStyle" EditorType="LineEditType" ItemFlags="IsEnabled"/>
|
||||||
<HiddenType RenderStyle="HiddenStyle"/>
|
<HiddenType RenderStyle="HiddenStyle"/>
|
||||||
<StaticType RenderStyle="PlainStyle"/>
|
<StaticType RenderStyle="PlainStyle"/>
|
||||||
|
<FilePickerType RenderStyle="PlainStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" Icon="DirIcon" />
|
||||||
<PlainType RenderStyle="PlainStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
|
<PlainType RenderStyle="PlainStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
|
||||||
<ValueType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="Coulomb"/>
|
<ValueType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="Coulomb"/>
|
||||||
<CheckableType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" />
|
<CheckableType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" />
|
||||||
@@ -121,17 +122,17 @@
|
|||||||
<ModelSheet>
|
<ModelSheet>
|
||||||
<BatteryID ItemType="PlainType">
|
<BatteryID ItemType="PlainType">
|
||||||
<Images>
|
<Images>
|
||||||
<FrontView ItemType="PlainType"/>
|
<FrontView ItemType="FilePickerType"/>
|
||||||
<PackageView ItemType="PlainType"/>
|
<PackageView ItemType="FilePickerType"/>
|
||||||
<InstalledView ItemType="PlainType"/>
|
<InstalledView ItemType="FilePickerType"/>
|
||||||
</Images >
|
</Images >
|
||||||
<Documents>
|
<Documents>
|
||||||
<Manual ItemType="PlainType"/>
|
<Manual ItemType="FilePickerType"/>
|
||||||
<Installation ItemType="PlainType"/>
|
<Installation ItemType="FilePickerType"/>
|
||||||
</Documents>
|
</Documents>
|
||||||
<Certificates>
|
<Certificates>
|
||||||
<Certificate ItemType="PlainType"/>
|
<Certificate ItemType="FilePickerType"/>
|
||||||
<Conformity ItemType="PlainType"/>
|
<Conformity ItemType="FilePickerType"/>
|
||||||
</Certificates>
|
</Certificates>
|
||||||
</BatteryID>
|
</BatteryID>
|
||||||
<BatteryName ItemType="PlainType" />
|
<BatteryName ItemType="PlainType" />
|
||||||
|
Reference in New Issue
Block a user