adding projects to project tree works again.
This commit is contained in:
@@ -29,7 +29,7 @@ const QString c_ItemType = "ItemType";
|
||||
const QString c_Caption = "Caption";
|
||||
const QString c_Header = "Header";
|
||||
const QString c_ContentType = "ContentType";
|
||||
const QString c_Data = "Data";
|
||||
const QString c_ModelSheet = "ModelSheet";
|
||||
|
||||
const QString c_MainModelName = "DocumentTreeModel";
|
||||
const QString c_ChildModelName = "DocumentDetailsModel";
|
||||
|
@@ -43,40 +43,36 @@ void XQMainModel::initContextMenu()
|
||||
|
||||
//! erzeugt einen eintrag in der baum-übersicht.
|
||||
|
||||
XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode )
|
||||
XQItem* XQMainModel::makeTreeItem( XQNodePtr contentNode )
|
||||
{
|
||||
|
||||
// wir durchsuchen alle unsere section nach dem passenden content-type,
|
||||
// hier: content-type beschreibt die
|
||||
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.makeTreeChildItem( contentNode, section.sheetRootNode );
|
||||
|
||||
makeTreeChildItem:
|
||||
// den itemtype des neuen items rausfinden
|
||||
QString typeKey = sheetEntry->attribute("ItemType");
|
||||
XQItemType* itemType = findItemTypeTemplate(typeKey); // throws
|
||||
//XQItemType* itemType = makeItemType(sheetEntry); // throws
|
||||
if( contentNode->attribute( c_ContentType) == section.contentType() )
|
||||
{
|
||||
|
||||
qDebug() << " --- wtf1: " << contentNode->to_string();
|
||||
qDebug() << " --- wtf2: " << section.sectionRootNode()->to_string();
|
||||
qDebug() << " --- wtf3: " << section.sheetRootNode()->to_string();
|
||||
|
||||
const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" );
|
||||
// __fixme! das ist mist!
|
||||
XQItem* newItem = _itemFactory.makeItem(section.sheetRootNode()->child(0), contentPtr );
|
||||
|
||||
XQItem* newItem = new XQItem( itemType, contentPtr );
|
||||
section.headerItem().appendRow( newItem );
|
||||
_treeTable->expand( section.modelIndex() );
|
||||
// ??
|
||||
_treeTable->setCurrentIndex( section.modelIndex() );
|
||||
newItem->setContentNode(contentNode);
|
||||
emit itemCreated( newItem );
|
||||
|
||||
return newItem;
|
||||
|
||||
section.headerItem().appendRow( newTreeentry );
|
||||
_treeTable->expand( section.modelIndex );
|
||||
// ??
|
||||
_treeTable->setCurrentIndex( section.modelIndex );
|
||||
newTreeentry->setContentNode(contentNode);
|
||||
emit xqItemCreated( newTreeentry );
|
||||
return newTreeentry;
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
throw XQException( "createTreeEntry: main model should not be empty!" );
|
||||
throw XQException( "makeTreeItem: main model should not be empty!" );
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ public:
|
||||
explicit XQMainModel(QObject *parent = nullptr);
|
||||
virtual ~XQMainModel() = default;
|
||||
|
||||
XQItem* createTreeEntry( XQNodePtr contentNode );
|
||||
XQItem* makeTreeItem( XQNodePtr contentNode );
|
||||
|
||||
public slots:
|
||||
|
||||
|
@@ -15,12 +15,14 @@
|
||||
#include <QDebug>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
#include <xqmainwindow.h>
|
||||
#include <xqcommand.h>
|
||||
#include <xqexception.h>
|
||||
#include <xqitemfactory.h>
|
||||
#include <xqnodewriter.h>
|
||||
#include <xqquickwidget.h>
|
||||
|
||||
|
||||
//! konstruktor.
|
||||
@@ -91,7 +93,13 @@ void XQMainWindow::initMainWindow()
|
||||
|
||||
connect( _tabWidget, SIGNAL(tabBarClicked(int)), this, SLOT(onTabClicked(int)) );
|
||||
|
||||
|
||||
/*
|
||||
XQQuickWidget* butt = new XQQuickWidget;
|
||||
butt->resize(800,600);
|
||||
butt->setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint);
|
||||
butt->move( 1200,300);
|
||||
butt->show();
|
||||
*/
|
||||
|
||||
/*
|
||||
connect( &_mainModelView, &XQViewModel::itemCreated, this, [=, this](XQItem* item)
|
||||
@@ -324,15 +332,14 @@ void XQMainWindow::loadDocument( const QString& fileName )
|
||||
connect( childModel, SIGNAL(sectionCreated(XQModelSection)), this, SLOT(onSectionCreated(XQModelSection)) );
|
||||
connect( childModel, SIGNAL(sectionToggled(XQModelSection)), this, SLOT(onSectionToggled(XQModelSection)) );
|
||||
|
||||
|
||||
// Den globalen undo-stack ...
|
||||
childModel->setUndoStack(&_undoStack);
|
||||
|
||||
// und die TreeView übergeben
|
||||
childModel->setTreeTable(childTreeView);
|
||||
|
||||
// create new entry in the left side main tree view
|
||||
//XQItem* newEntry = _mainModelView.createTreeEntry( contentRoot );
|
||||
// neuen eintrag im übsichts-baum erzeugen
|
||||
XQItem* newEntry = _mainModelView.makeTreeItem( contentRoot );
|
||||
//_mainTreeView->setCurrentIndex( newEntry->index() );
|
||||
//_documentStore.addDocument( fileName, pTitle, newEntry, childModel );
|
||||
|
||||
|
Reference in New Issue
Block a user