invented creation-mode for items
This commit is contained in:
@@ -305,7 +305,7 @@ XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const
|
||||
|
||||
//! erzeugt eine item-row.
|
||||
|
||||
XQItemList XQItemFactory::makeRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||
XQItemList XQItemFactory::makeRow(CreationMode mode, const XQNodePtr& sheetNode, const XQNodePtr& contentNode, const QString& captionKey )
|
||||
{
|
||||
|
||||
XQItemList list;
|
||||
@@ -321,7 +321,7 @@ XQItemList XQItemFactory::makeRow( const XQNodePtr& sheetNode, const XQNodePtr&
|
||||
//
|
||||
|
||||
for( const auto& sheetEntry : sheetNode->children() )
|
||||
list.append( makeItem( sheetEntry, contentNode ) );
|
||||
list.append( makeItem( mode, sheetEntry, contentNode, captionKey ) );
|
||||
|
||||
Q_ASSERT(!list.empty());
|
||||
|
||||
@@ -338,19 +338,29 @@ XQItemList XQItemFactory::makeRow( const XQNodePtr& sheetNode, const XQNodePtr&
|
||||
//! wenn der content node nicht gesetzt ist, wird stattdess das attribut 'Caption' aus der typ-beschreibung
|
||||
//! verwendet: es handelt sich dann um ein header item, das erzeugt wurde.
|
||||
|
||||
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||
XQItem* XQItemFactory::makeItem(CreationMode mode, const XQNodePtr& sheetNode, const XQNodePtr& contentNode, const QString& captionKey )
|
||||
{
|
||||
// den itemtype des neuen items rausfinden
|
||||
XQItemType* itemType = makeItemType(sheetNode); // throws
|
||||
|
||||
const QString* contentPtr{};
|
||||
|
||||
// das ist Unterschied vom HeaderItem zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
||||
if(!contentNode)
|
||||
contentPtr = sheetNode->attribute_ptr(c_Caption);
|
||||
else
|
||||
// der content wird indirect über den tag-name des sheetnode geholt
|
||||
contentPtr = contentNode->attribute_ptr( sheetNode->tag_name() );
|
||||
// das ist Unterschied vom HeaderItem zum normalen Item: Der Titel kommt aus der Modelbeschreibung,
|
||||
// sonst wird der content indirekt über den tag-name des sheetnode geholt
|
||||
|
||||
switch( mode )
|
||||
{
|
||||
case mHeader:
|
||||
contentPtr = sheetNode->attribute_ptr(captionKey);
|
||||
break;
|
||||
|
||||
case mData:
|
||||
contentPtr = contentNode->attribute_ptr( sheetNode->tag_name() );
|
||||
break;
|
||||
|
||||
case mSingle:
|
||||
contentPtr = contentNode->attribute_ptr( captionKey );
|
||||
}
|
||||
|
||||
XQItem* newItem = new XQItem( itemType, contentPtr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user