happy crashing
This commit is contained in:
@@ -52,10 +52,13 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
|
|||||||
|
|
||||||
if( contentNode->attribute( c_ContentType) == section.contentType() )
|
if( contentNode->attribute( c_ContentType) == section.contentType() )
|
||||||
{
|
{
|
||||||
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
|
const QString& content = contentNode->attribute( "ProjectName" );
|
||||||
// __fixme! das ist mist!
|
// __fixme! das ist mist!
|
||||||
const XQNodePtr sheetNode = section.sheetRootNode()->first_child();
|
const XQNodePtr sheetNode = section.sheetRootNode()->first_child();
|
||||||
XQItem* newItem = _itemFactory.makeItem(sheetNode, contentPtr );
|
XQItem* newItem = _itemFactory.makeItem(sheetNode, content );
|
||||||
|
// erzeuger sheet node speichern
|
||||||
|
newItem->setSheetNode( sheetNode );
|
||||||
|
|
||||||
// den neuen eintrag in die passende section der übersicht eintragen ...
|
// den neuen eintrag in die passende section der übersicht eintragen ...
|
||||||
section.headerItem().appendRow( newItem );
|
section.headerItem().appendRow( newItem );
|
||||||
// ... ausklappen...
|
// ... ausklappen...
|
||||||
@@ -64,9 +67,7 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
|
|||||||
// ... und markieren
|
// ... und markieren
|
||||||
_treeTable->setCurrentIndex( index );
|
_treeTable->setCurrentIndex( index );
|
||||||
// quellknoten auch speichern
|
// quellknoten auch speichern
|
||||||
newItem->setContentNode( contentNode );
|
//newItem->setContentNode( contentNode );
|
||||||
// erzeuger sheet node speichern
|
|
||||||
newItem->setSheetNode( sheetNode );
|
|
||||||
//emit itemCreated( newItem );
|
//emit itemCreated( newItem );
|
||||||
|
|
||||||
return newItem;
|
return newItem;
|
||||||
@@ -81,18 +82,7 @@ XQItem* XQMainModel::addProjectItem( XQNodePtr contentNode )
|
|||||||
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
|
void XQMainModel::addSectionItem( const XQModelSection& section, XQItem* projectItem )
|
||||||
{
|
{
|
||||||
XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection");
|
XQNodePtr sheetNode = projectItem->sheetNode()->find_child_by_tag_name("CurrentSection");
|
||||||
XQItem* newItem = _itemFactory.makeItem(sheetNode, §ion.contentType() );
|
XQItem* newItem = _itemFactory.makeItem(sheetNode, section.contentType() );
|
||||||
projectItem->appendRow( newItem );
|
projectItem->appendRow( newItem );
|
||||||
_treeTable->expand( projectItem->index() );
|
_treeTable->expand( projectItem->index() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
XQItem* XQMainModel::addSectionItem( XQItem* projectItem )
|
|
||||||
{
|
|
||||||
const XQNodePtr& parentSheet = projectItem->sheetNode();
|
|
||||||
const XQNodePtr sheetNode = parentSheet->first_child();
|
|
||||||
return _itemFactor.makeItem( sheetNode, new QString("fitz!"));
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
@@ -341,7 +341,7 @@ void XQItem::setUnitType(UnitType unitType)
|
|||||||
|
|
||||||
QString XQItem::content() const
|
QString XQItem::content() const
|
||||||
{
|
{
|
||||||
// umleitung auf text()
|
// umleitung auf raw text
|
||||||
return data( Qt::EditRole ).toString();
|
return data( Qt::EditRole ).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +77,6 @@ bool XQItemFactory::isValid()
|
|||||||
XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry )
|
XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry )
|
||||||
{
|
{
|
||||||
QString typeKey = sheetEntry->attribute( c_ItemType );
|
QString typeKey = sheetEntry->attribute( c_ItemType );
|
||||||
|
|
||||||
XQItemType* itemType = findItemTypeTemplate(typeKey);
|
XQItemType* itemType = findItemTypeTemplate(typeKey);
|
||||||
|
|
||||||
// wir prüfen, ob im sheetEntry noch zusätzliche attribute vorhanden
|
// wir prüfen, ob im sheetEntry noch zusätzliche attribute vorhanden
|
||||||
@@ -266,17 +265,18 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const
|
|||||||
|
|
||||||
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode )
|
||||||
{
|
{
|
||||||
|
// den itemtype des neuen items rausfinden
|
||||||
|
XQItemType* itemType = makeItemType(sheetNode); // throws
|
||||||
|
|
||||||
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
||||||
// der content wird indirect über den tag-name des sheetnode geholt
|
// der content wird indirect über den tag-name des sheetnode geholt
|
||||||
|
|
||||||
const QString* contentPtr{};
|
|
||||||
// das ist Unterschied vom HeaderItem zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
// das ist Unterschied vom HeaderItem zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
||||||
if(!contentNode)
|
if(!contentNode)
|
||||||
contentPtr = sheetNode->attribute_ptr(c_Caption);
|
return makeItem( sheetNode, sheetNode->attribute(c_Caption) );
|
||||||
else
|
|
||||||
// der content wird indirect über den tag-name des sheetnode geholt
|
|
||||||
contentPtr = contentNode->attribute_ptr( sheetNode->tag_name() );
|
|
||||||
|
|
||||||
|
// der content wird indirect über den tag-name des sheetnode geholt
|
||||||
|
const QString* contentPtr = contentNode->attribute_ptr( sheetNode->tag_name() );
|
||||||
return makeItem( sheetNode, contentPtr );
|
return makeItem( sheetNode, contentPtr );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,10 +284,7 @@ XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& co
|
|||||||
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const QString* contentPtr )
|
XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const QString* contentPtr )
|
||||||
{
|
{
|
||||||
// den itemtype des neuen items rausfinden
|
// den itemtype des neuen items rausfinden
|
||||||
QString typeKey = sheetNode->attribute(c_ItemType);
|
|
||||||
|
|
||||||
XQItemType* itemType = makeItemType(sheetNode); // throws
|
XQItemType* itemType = makeItemType(sheetNode); // throws
|
||||||
|
|
||||||
XQItem* newItem = new XQItem( itemType, contentPtr );
|
XQItem* newItem = new XQItem( itemType, contentPtr );
|
||||||
|
|
||||||
// __fixme!
|
// __fixme!
|
||||||
@@ -299,6 +296,19 @@ XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const QString* cont
|
|||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XQStaticItem* XQItemFactory::makeStaticItem( const XQNodePtr& sheetNode, const QString& content )
|
||||||
|
{
|
||||||
|
XQItemType* itemType = makeItemType(sheetNode); // throws
|
||||||
|
XQStaticItem* newItem = new XQStaticItem( itemType, content );
|
||||||
|
// __fixme!
|
||||||
|
if( newItem->isCheckable() )
|
||||||
|
{
|
||||||
|
newItem->setCheckState( Qt::Checked );
|
||||||
|
}
|
||||||
|
return newItem;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//! erzeugt eine item-row.
|
//! erzeugt eine item-row.
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||||
XQItem* makeItem( const XQNodePtr& sheetNode, const QString* contentPtr );
|
XQItem* makeItem( const XQNodePtr& sheetNode, const QString* contentPtr );
|
||||||
|
XQStaticItem* makeStaticItem( const XQNodePtr& sheetNode, const QString& contentPtr );
|
||||||
|
|
||||||
XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode );
|
||||||
//XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
//XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||||
|
Reference in New Issue
Block a user