Added cmdNew implementation.
This commit is contained in:
@@ -98,6 +98,8 @@ void XQChildModel::addSectionEntry( const QString& key, const XQNodePtr& content
|
||||
void XQChildModel::initContextMenu()
|
||||
{
|
||||
|
||||
_sections.dump();
|
||||
|
||||
// __fixme! add a menu title
|
||||
_contextMenu->clear();
|
||||
|
||||
@@ -117,7 +119,7 @@ void XQChildModel::initContextMenu()
|
||||
|
||||
// __fixme! set 'toggle section <name>' entry
|
||||
//contextMenu.actions().first()->setText("<name>");
|
||||
_contextMenu->addAction( "icn29Dummy", "Toggle Section", XQCommand::cmdToggleSection, hasSel);
|
||||
_contextMenu->addAction( "icn29Dummy", "Hide Section", XQCommand::cmdToggleSection, true );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -80,7 +80,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
QApplication app(argc, argv);
|
||||
//app.setStyle("fusion");
|
||||
//app.setStyle("WindowsVista");
|
||||
XQMainWindow window;
|
||||
window.show();
|
||||
|
||||
|
@@ -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();
|
||||
|
||||
|
@@ -110,8 +110,8 @@
|
||||
|
||||
<Section ContentType="Battery" >
|
||||
<Header>
|
||||
<BatteryID Caption="Name" ItemType="HeaderType" />
|
||||
<BatteryName Caption="Battery" ItemType="HeaderType" />
|
||||
<BatteryID Caption="Battery" ItemType="HeaderType" />
|
||||
<BatteryName Caption="Name" ItemType="HeaderType" />
|
||||
<Manufacturer Caption="Manufacturer" ItemType="HeaderType" />
|
||||
<Capacity Caption="Capacity" ItemType="HeaderType"/>
|
||||
<Yield Caption="Yield" ItemType="HeaderType" />
|
||||
|
Reference in New Issue
Block a user