Added cmdNew implementation.
This commit is contained in:
@@ -419,7 +419,7 @@ void XQViewModel::cmdDelete( const XQCommand& command )
|
||||
}
|
||||
}
|
||||
|
||||
//! macht 'delete' wirder rückgängig.
|
||||
//! macht 'delete' wieder rückgängig.
|
||||
|
||||
void XQViewModel::cmdDeleteUndo( const XQCommand& command )
|
||||
{
|
||||
@@ -432,18 +432,16 @@ void XQViewModel::cmdDeleteUndo( const XQCommand& command )
|
||||
void XQViewModel::cmdNew( const XQCommand& command )
|
||||
{
|
||||
|
||||
// __fix
|
||||
/*
|
||||
const QModelIndex& origin = command.originIndex();
|
||||
if( !origin.isValid() )
|
||||
throw XQException("cmdNewRow failed: index not valid ");
|
||||
|
||||
XQItem* target = xqItemFromIndex( origin );
|
||||
|
||||
const QModelIndex& origin = command.originIndex();
|
||||
|
||||
|
||||
XQItem& target = xqItemFromIndex( origin );
|
||||
// current data node
|
||||
XQNodePtr node = target->contentNode();
|
||||
XQNodePtr node = target.contentNode();
|
||||
|
||||
// we create a new data node
|
||||
//XQNodePtr newNode = new XQNodePtr( node->tag_name(), node->parent() );
|
||||
XQNodePtr newNode = XQNode::make_node( node->tag_name(), node->tag_value(), node->parent() );
|
||||
// store node in node->parent()
|
||||
//node->add_before_me( newNode );
|
||||
@@ -451,7 +449,7 @@ void XQViewModel::cmdNew( const XQCommand& command )
|
||||
const XQModelSection& section = _sections.sectionFromIndex( origin );
|
||||
|
||||
// create new item row
|
||||
XQItemList list = _itemFactory.createGenericRow( newNode, section.sheetRootNode );
|
||||
XQItemList list =_itemFactory.makeRow( section.sheetRootNode(), newNode );
|
||||
|
||||
// add it to the treeview ...
|
||||
insertRow( origin.row(), list );
|
||||
@@ -460,32 +458,30 @@ void XQViewModel::cmdNew( const XQCommand& command )
|
||||
treeTable()->setCurrentIndex( list[0]->index() );
|
||||
// ... editable
|
||||
treeTable()->edit( list[0]->index() );
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void XQViewModel::toggleSection( const XQModelSection& section )
|
||||
{
|
||||
|
||||
/*
|
||||
|
||||
if(_treeTable)
|
||||
{
|
||||
|
||||
qDebug() << " ---- FIRZ: " << _sections.keyOf( sec );
|
||||
const QModelIndex& index = section.persistentModelIndex();
|
||||
qDebug() << " ---- toggle section: FIRZ: " << index.isValid() << " : " << index.data().toString() << " : " << section.contentType();//_sections.keyOf( sec );
|
||||
int fstRow = _sections.firstRow( index );
|
||||
int lstRow = _sections.lastRow( index );
|
||||
_treeTable->toggleRowsHidden(fstRow, lstRow );
|
||||
|
||||
|
||||
|
||||
emit sectionToggled( section );
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
emit sectionToggled( section );
|
||||
|
||||
}
|
||||
|
||||
void XQViewModel::toggleSection( const QString& sectionKey )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//! entfernt die neu angelegte zeile.
|
||||
|
||||
void XQViewModel::cmdNewUndo( const XQCommand& command )
|
||||
|
@@ -56,6 +56,7 @@ public:
|
||||
|
||||
void expandNewItem(const QModelIndex& index);
|
||||
void toggleSection( const XQModelSection& section );
|
||||
void toggleSection( const QString& sectionKey );
|
||||
|
||||
//little helpers
|
||||
const XQItem& xqRootItem();
|
||||
@@ -118,8 +119,7 @@ signals:
|
||||
protected:
|
||||
|
||||
void addSection(const XQItemList& list, const XQNodePtr& sheetNode );
|
||||
virtual void initContextMenu(){}
|
||||
|
||||
virtual void initContextMenu() = 0;
|
||||
// __fixme: should be created from xml
|
||||
virtual void setupViewProperties();
|
||||
|
||||
|
Reference in New Issue
Block a user