faking success.
This commit is contained in:
@@ -59,9 +59,12 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
|
||||
{
|
||||
for(const auto& section : _sections )
|
||||
{
|
||||
qDebug() << " --- wtf1: " << contentNode->to_string();
|
||||
qDebug() << " --- wtf2: " << section.sheetRootNode->to_string();
|
||||
|
||||
if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") )
|
||||
{
|
||||
XQItem* newTreeentry = _itemFactory.makeContentItem( contentNode, section.sheetRootNode );
|
||||
XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode );
|
||||
section.headerItem().appendRow( newTreeentry );
|
||||
_treeTable->expand( section.modelIndex );
|
||||
// ??
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include <xqnodewriter.h>
|
||||
|
||||
|
||||
//! firz
|
||||
//! konstruktor.
|
||||
|
||||
XQMainWindow::XQMainWindow( QWidget* parent )
|
||||
: QMainWindow(parent)
|
||||
@@ -34,7 +34,7 @@ XQMainWindow::XQMainWindow( QWidget* parent )
|
||||
}
|
||||
|
||||
|
||||
//! firz
|
||||
//! actions & document struktur einrichten.
|
||||
|
||||
void XQMainWindow::initMainWindow()
|
||||
{
|
||||
@@ -67,6 +67,7 @@ void XQMainWindow::initMainWindow()
|
||||
connect( _mainTreeView, SIGNAL(clicked(QModelIndex)), this, SLOT(onTreeItemClicked(QModelIndex)) );
|
||||
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
|
||||
|
||||
|
||||
connect( &_mainModelView, &XQViewModel::xqItemCreated, this, [=, this](XQItem* item)
|
||||
{
|
||||
// when a new main tree item has been created ...
|
||||
@@ -102,7 +103,7 @@ void XQMainWindow::initMainWindow()
|
||||
}
|
||||
|
||||
|
||||
//! firz
|
||||
//! slot für zentrales undo
|
||||
|
||||
void XQMainWindow::onUndo()
|
||||
{
|
||||
@@ -113,14 +114,13 @@ void XQMainWindow::onUndo()
|
||||
}
|
||||
|
||||
|
||||
//!
|
||||
//! slot für zentrales redo
|
||||
|
||||
void XQMainWindow::onRedo()
|
||||
{
|
||||
qDebug() << " --- redo Pressed";
|
||||
if(_undoStack.canRedo())
|
||||
_undoStack.redo();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -214,8 +214,9 @@ void XQMainWindow::onAbout()
|
||||
}
|
||||
|
||||
|
||||
//! firz
|
||||
// when item in the left tree is clicked, switch view on the right side
|
||||
//! wenn ein item im navigations-baum geklickt wird, soll die document
|
||||
//! view rechts angepasst werden.
|
||||
|
||||
void XQMainWindow::onTreeItemClicked(const QModelIndex& index )
|
||||
{
|
||||
|
||||
@@ -234,8 +235,8 @@ void XQMainWindow::onTreeItemClicked(const QModelIndex& index )
|
||||
}
|
||||
|
||||
|
||||
//! firz
|
||||
// when item in the left tree is clicked, switch view on the right side
|
||||
//! beim click auf ein tab im linken fenster wird der navigationsbaum angepasst.
|
||||
|
||||
void XQMainWindow::onTabClicked( int index )
|
||||
{
|
||||
const QString& key = _documentStore[index].treeItem->attribute( c_ProjectID );
|
||||
@@ -293,8 +294,10 @@ void XQMainWindow::loadDocument( const QString& fileName )
|
||||
|
||||
// read the model data
|
||||
childModel->setContent( contentRoot->first_child() );
|
||||
|
||||
// create new entry in the left side main tree view
|
||||
XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
||||
|
||||
XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
||||
_mainTreeView->setCurrentIndex( newEntry->index() );
|
||||
_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
|
||||
|
||||
|
@@ -115,20 +115,6 @@ XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const
|
||||
}
|
||||
|
||||
|
||||
XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry )
|
||||
{
|
||||
// den itemtype des neuen items rausfinden
|
||||
QString typeKey = sheetEntry->attribute("ItemType");
|
||||
//XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
|
||||
XQItemType* itemType = makeItemType(sheetEntry); // throws
|
||||
|
||||
const QString* contentPtr = contentNode->attribute_ptr( sheetEntry->tag_name() );
|
||||
|
||||
XQItem* newItem = new XQItem( itemType, contentPtr );
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
|
||||
XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetEntry )
|
||||
{
|
||||
@@ -140,15 +126,42 @@ XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetEntry )
|
||||
|
||||
// den itemtype des neuen items rausfinden
|
||||
QString typeKey = sheetEntry->attribute("HeaderItemType");
|
||||
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
|
||||
//XQItemType* itemType = makeItemType(sheetEntry); // throws
|
||||
XQItemType* itemType = findItemTypeTemplate(typeKey);
|
||||
// das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung
|
||||
const QString* contentPtr = sheetEntry->attribute_ptr("HeaderCaption");
|
||||
|
||||
XQItem* newHeaderItem = new XQItem( itemType, contentPtr );
|
||||
return new XQItem( itemType, contentPtr );
|
||||
|
||||
return newHeaderItem;
|
||||
}
|
||||
|
||||
XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry )
|
||||
{
|
||||
// den itemtype des neuen items rausfinden
|
||||
QString typeKey = sheetEntry->attribute("ItemType");
|
||||
//XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
|
||||
XQItemType* itemType = makeItemType(sheetEntry); // throws
|
||||
|
||||
const QString* contentPtr = contentNode->attribute_ptr( sheetEntry->tag_name() );
|
||||
|
||||
return new XQItem( itemType, contentPtr );
|
||||
|
||||
}
|
||||
|
||||
|
||||
XQItem* XQItemFactory::makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry )
|
||||
{
|
||||
// den itemtype des neuen items rausfinden
|
||||
QString typeKey = sheetEntry->attribute("ItemType");
|
||||
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
|
||||
//XQItemType* itemType = makeItemType(sheetEntry); // throws
|
||||
|
||||
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
|
||||
|
||||
XQItem* newItem = new XQItem( itemType, contentPtr );
|
||||
|
||||
return newItem;
|
||||
}
|
||||
|
||||
void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const
|
||||
{
|
||||
|
@@ -34,6 +34,7 @@ public:
|
||||
|
||||
XQItem* makeHeaderItem(const XQNodePtr& typeSheetNode );
|
||||
XQItem* makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry );
|
||||
XQItem* makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry );
|
||||
|
||||
virtual XQItemList makeHeaderRow( const XQNodePtr& sheetNode );
|
||||
virtual XQItemList makeContentRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode );
|
||||
|
@@ -224,6 +224,7 @@ namespace znode
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! hängt einen knoten an meine kinderliste an.
|
||||
int add_child( const zshared_node& node )
|
||||
{
|
||||
_children.push_back( node );
|
||||
|
Reference in New Issue
Block a user