trashed it.
This commit is contained in:
@@ -123,8 +123,8 @@ void XQMainWindow::initMainWindow()
|
||||
_mainModelView.initModel( c_MainModelName );
|
||||
|
||||
// #2. load demo data
|
||||
loadDocument( c_DocumentFileName1 );
|
||||
loadDocument( c_DocumentFileName2 );
|
||||
//loadDocument( c_DocumentFileName1 );
|
||||
//loadDocument( c_DocumentFileName2 );
|
||||
|
||||
qDebug() << " --- all here: " << XQNode::s_Count;
|
||||
|
||||
@@ -261,6 +261,10 @@ void XQMainWindow::onTreeItemClicked(const QModelIndex& index )
|
||||
_mainTreeView->selectionModel()->select(index, QItemSelectionModel::Select);
|
||||
//entry.setBackground( QBrush( Qt::green ) );
|
||||
|
||||
QVariant variant = entry.QStandardItem::data( XQItem::ContentNodeRole );
|
||||
|
||||
XQNodePtr ptr = variant.value<XQNodePtr>();
|
||||
|
||||
QString key = entry.attribute(c_ProjectID);
|
||||
qDebug() << " --- FIRZ: key: " << key;
|
||||
|
||||
|
@@ -303,6 +303,25 @@ XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//! erzeugt eine header-item row.
|
||||
|
||||
XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& sheetNode )
|
||||
{
|
||||
|
||||
XQItemList list;
|
||||
|
||||
for( const auto& sheetEntry : sheetNode->children() )
|
||||
{
|
||||
list.append( makeHeaderItem( sheetEntry ) );
|
||||
}
|
||||
|
||||
Q_ASSERT(!list.empty());
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
//! erzeugt eine item-row.
|
||||
|
||||
XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||
@@ -321,20 +340,37 @@ XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNo
|
||||
//
|
||||
|
||||
for( const auto& sheetEntry : sheetNode->children() )
|
||||
{
|
||||
list.append( makeItem( sheetEntry, contentNode ) );
|
||||
{
|
||||
list.append( makeContentItem( sheetEntry, contentNode ) );
|
||||
}
|
||||
|
||||
if( !list.empty() )
|
||||
{
|
||||
// wir merken uns den original content node auch, aber
|
||||
// im ersten Item.
|
||||
dynamic_cast<XQItem*>(list[0])->setContentNode(contentNode);
|
||||
}
|
||||
Q_ASSERT(!list.empty());
|
||||
|
||||
// wir merken uns den original content node auch, aber
|
||||
// im ersten Item.
|
||||
dynamic_cast<XQItem*>(list[0])->setContentNode(contentNode);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetNode )
|
||||
{
|
||||
// den itemtype des neuen items rausfinden
|
||||
XQItemType* itemType = makeItemType(sheetNode); // throws
|
||||
|
||||
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
||||
// der content wird indirect über den tag-name des sheetnode geholt
|
||||
|
||||
XQItem* newItem = new XQItem( itemType, sheetNode->attribute_ptr(c_Caption) );
|
||||
|
||||
// __fixme!
|
||||
if( newItem->isCheckable() )
|
||||
newItem->setCheckState( Qt::Checked );
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
//! fixme! unsinn!
|
||||
//! erzeugt ein XQItem aus einer typ-beschreibung ('sheetNode') und einem daten-knoten ('contentNode').
|
||||
//! wenn der content node nicht gesetzt ist, wird stattdess das attribut 'Caption' aus der typ-beschreibung
|
||||
|
@@ -34,12 +34,12 @@ public:
|
||||
|
||||
//XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
|
||||
// wozu ist das gut?
|
||||
//XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
XQItemList makeHeaderRow( const XQNodePtr& sheetNode );
|
||||
XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||
|
||||
XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||
XQItem* makeItem( const XQNodePtr& sheetNode, const QString* contentPtr );
|
||||
// wozu ist das gut?
|
||||
//XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
|
||||
XQStaticItem* makeStaticItem( const XQNodePtr& sheetNode, const QString& contentPtr );
|
||||
|
||||
|
||||
@@ -53,6 +53,12 @@ protected:
|
||||
|
||||
bool isValid();
|
||||
|
||||
XQItem* makeHeaderItem( const XQNodePtr& sheetNode );
|
||||
XQItem* makeContentItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||
|
||||
XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||
XQItem* makeItem( const XQNodePtr& sheetNode, const QString* contentPtr );
|
||||
|
||||
// shortcuts
|
||||
using ItemConfigFunc = std::function<void( XQItem* item, const QString& attrValue, XQNodePtr contentNode, XQNodePtr sheetNode )>;
|
||||
using ItemConfigMap = QMap<QString,ItemConfigFunc>;
|
||||
|
@@ -107,8 +107,8 @@ void XQViewModel::initModel(const QString& modelName)
|
||||
// #2: (optionalen?) header erzeugen
|
||||
const XQNodePtr header = sectionNode->find_child_by_tag_name( c_Header );
|
||||
if( header )
|
||||
{
|
||||
XQItemList list = _itemFactory.makeContentRow( header, nullptr );
|
||||
{
|
||||
XQItemList list = _itemFactory.makeHeaderRow( header );
|
||||
addSection(list, sectionNode );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user