From d3f2cbeaecd60465d77d6cd97d200aec3bf1c7c5 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Wed, 13 Aug 2025 22:25:01 +0200 Subject: [PATCH 1/6] Still works... --- src/application/xqappdata.cpp | 4 +- src/application/xqchildmodel.cpp | 13 +++--- src/application/xqchildmodel.h | 3 -- src/application/xqmainmodel.cpp | 25 +---------- src/application/xqmainmodel.h | 1 - src/items/xqitemfactory.cpp | 2 +- src/model/xqviewmodel.cpp | 54 +++++++--------------- src/model/xqviewmodel.h | 3 +- xml/modelsheets.xml | 77 +++++++++++++++++++++++++++++++- 9 files changed, 106 insertions(+), 76 deletions(-) diff --git a/src/application/xqappdata.cpp b/src/application/xqappdata.cpp index 7cc6c9e..b7027c9 100644 --- a/src/application/xqappdata.cpp +++ b/src/application/xqappdata.cpp @@ -71,7 +71,7 @@ namespace XQAppData insert( "icn29Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserReload)); insert( "icn30Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveFDIcon)); insert( "icn31Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)); - insert( "icn32Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserStop)); + insert( "BrowserStop", QApplication::style()->standardIcon(QStyle::SP_BrowserStop)); insert( "icn33Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveHDIcon)); insert( "icn34Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion)); insert( "icn35Dummy", QApplication::style()->standardIcon(QStyle::SP_CommandLink)); @@ -249,3 +249,5 @@ namespace XQAppData } */ }; // namespace XQAppData + + diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index c22b44b..74f9404 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -32,7 +32,7 @@ XQChildModel::XQChildModel( QObject *parent ) //! erzeugt die basisstruktur des models. - +/* void XQChildModel::initModel(const QString& modelName) { @@ -84,16 +84,17 @@ void XQChildModel::initModel(const QString& modelName) } - /* + // empty row: - XQNodePtr contentNode = XQNode::make_node( sheetNode->tag_name() ); - XQItemList emptyRow = _itemFactory.makeEmptyRow( contentNode, sheetNode ); - appendRow( emptyRow ); - */ + // XQNodePtr contentNode = XQNode::make_node( sheetNode->tag_name() ); + // XQItemList emptyRow = _itemFactory.makeEmptyRow( contentNode, sheetNode ); + // appendRow( emptyRow ); + } // for } +*/ //! erzegut den sichtbaren inhalt des models aus einem root-datenknoten. diff --git a/src/application/xqchildmodel.h b/src/application/xqchildmodel.h index 40dae0b..2e0681c 100644 --- a/src/application/xqchildmodel.h +++ b/src/application/xqchildmodel.h @@ -29,13 +29,10 @@ public: explicit XQChildModel(QObject *parent = nullptr); virtual ~XQChildModel() = default; - void initModel(const QString& modelName) override; void setContent(const XQNodePtr& contentRoot ); protected: - - //void setupViewProperties() override; void initContextMenu() override; diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp index d8378c0..018dbf7 100644 --- a/src/application/xqmainmodel.cpp +++ b/src/application/xqmainmodel.cpp @@ -34,29 +34,6 @@ XQMainModel::XQMainModel(QObject *parent ) } -//! initialisiert dieses model über den namen. - -void XQMainModel::initModel(const QString& modelName) -{ - - // model rootnode finden -> - XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws - - // #1: über alle sections - for( auto& section : modelSheet->children() ) - { - // #2: (optionalen) header erzeugen - const XQNodePtr header = section->find_child_by_tag_name( "Header"); - if( header ) - { - XQItemList list = _itemFactory.makeHeader( header ); - Q_ASSERT(!list.isEmpty()); - addSection(list, section ); - } - - } -} - //! erzeugt einen eintrag in der baum-übersicht. @@ -79,7 +56,7 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode ) return newTreeentry; } } - throw XQException( "createTreeEntry: main model should not be emtpy!" ); + throw XQException( "createTreeEntry: main model should not be empty!" ); } //! leere default implementation diff --git a/src/application/xqmainmodel.h b/src/application/xqmainmodel.h index dfd4856..443b7dd 100644 --- a/src/application/xqmainmodel.h +++ b/src/application/xqmainmodel.h @@ -32,7 +32,6 @@ public: explicit XQMainModel(QObject *parent = nullptr); virtual ~XQMainModel() = default; - void initModel(const QString& modelName) override; XQItem* createTreeEntry( XQNodePtr contentNode ); public slots: diff --git a/src/items/xqitemfactory.cpp b/src/items/xqitemfactory.cpp index 718097e..bd522cc 100644 --- a/src/items/xqitemfactory.cpp +++ b/src/items/xqitemfactory.cpp @@ -319,7 +319,7 @@ XQItemList XQItemFactory::makeHeader( const XQNodePtr& headerNode ) { XQItemList list; - + // über alle kinder der
sektion for( const auto& headerEntry : headerNode->children() ) { qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption"); diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 2fab942..56d3c10 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -83,57 +83,37 @@ XQItem& XQViewModel::xqFirstItem(int row) const return *static_cast( QStandardItemModel::item(row) ); } -//! create the own model structure -void XQViewModel::initModel( const QString& modelName) + +//! initialisiert dieses model über den namen. Es wird hier +//! nur die strukur erzeugt, keine inhalte. + +void XQViewModel::initModel(const QString& modelName) { /* model section header + data section ... */ + // model rootnode finden -> + XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws - /* - // #0: Wir suchen die Model-Beschreibung - XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws - - // #1: Wir erzeugen die Model-Struktur: Jedes Kind beschreibt einen - // XML-Datentyp, z.B. , - // Jeder XML-Knoten entspricht einer Zeile im späteren Model, jedes - // Attribut wird einem eigenen Feld (XQItem) abgebildet. - - for( const auto& sheetNode : modelSheet->children() ) + // #1: über alle sections + for( auto& section : modelSheet->children() ) { - - - XQItemList list = _itemFactory.makeHeaderRow( sheetNode ); - - // für jeden XML-Knotentyp in der Modelbeschreibung erzeugen wir eine section - addSection(list, sheetNode ); - - // jedes kind kann enthält einen itemType und einen headerItemType. Für - // diese sind eventuell weitere attribute vorhanden, die die im type - // enthaltenen defualt-werte überschreiben. - - for( const auto& sheetChild : sheetNode->children() ) + // #2: (optionalen) header erzeugen + const XQNodePtr header = section->find_child_by_tag_name( "Header"); + if( header ) { - //qDebug() << "---- kloppo: " << sheetChild->tag_name() << ": " << sheetChild->to_string(); - extendItemType( sheetChild ); + XQItemList list = _itemFactory.makeHeader( header ); + Q_ASSERT(!list.isEmpty()); + addSection(list, section ); } - - - // empty row: - //XQNodePtr contentNode = XQNode::make_node( sheetNode->tag_name() ); - //XQItemList emptyRow = _itemFactory.makeEmptyRow( contentNode, sheetNode ); - //appendRow( emptyRow ); - - - } // for - */ - + } } diff --git a/src/model/xqviewmodel.h b/src/model/xqviewmodel.h index 585253f..6085a88 100644 --- a/src/model/xqviewmodel.h +++ b/src/model/xqviewmodel.h @@ -48,7 +48,6 @@ public: QUndoStack* undoStack(); void setUndoStack( QUndoStack* undoStack ); - //! create the own model structure virtual void initModel( const QString& modelName); //little helpers @@ -73,7 +72,7 @@ public: /*! - Derzeit wir die default-implementierung von data/setData genutzt. hier wäre dann die + Derzeit wird die default-implementierung von data/setData genutzt. hier wäre dann die Stelle um setData & data an externe 'handler' umzubiegen, siehe giovannies 'model-injection' QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override diff --git a/xml/modelsheets.xml b/xml/modelsheets.xml index 39d9351..9b61535 100644 --- a/xml/modelsheets.xml +++ b/xml/modelsheets.xml @@ -71,8 +71,83 @@ + +
+
+ + + + + + + + + +
+ + + + + + + + + + + + + +
+ +
+
+ + + + + + + +
+ + + + + + + + + +
+ +
+
+ + + + + + + +
+ + + + + + + + + +
+ +
+ + + + @@ -105,4 +180,4 @@
- + From a6fb7e82bd5642789377c2fe4691592c7e699391 Mon Sep 17 00:00:00 2001 From: Christoph Holzheuer Date: Thu, 14 Aug 2025 19:13:53 +0200 Subject: [PATCH 2/6] works again --- src/application/xqappdata.h | 1 + src/application/xqchildmodel.cpp | 80 ++++----------------------- src/application/xqmainmodel.cpp | 1 + src/application/xqmainwindow.cpp | 25 ++++++++- src/application/xqmainwindow.h | 2 + src/items/xqitemfactory.cpp | 92 +++++++++----------------------- src/items/xqitemfactory.h | 13 ++--- src/items/xqitemtype.cpp | 2 +- src/model/xqmodelsectionlist.cpp | 8 ++- src/model/xqviewmodel.cpp | 2 +- src/nodes/znode_payload.h | 3 ++ xml/modeldata1.xtr | 2 +- xml/modeldata2.xtr | 2 +- xml/modeldata3.xtr | 2 +- xml/modelsheets.xml | 18 +++---- 15 files changed, 92 insertions(+), 161 deletions(-) diff --git a/src/application/xqappdata.h b/src/application/xqappdata.h index 7237337..e4b288a 100644 --- a/src/application/xqappdata.h +++ b/src/application/xqappdata.h @@ -27,6 +27,7 @@ const QString c_Version = "0.1.1 04.09.2024"; const QString c_ItemType = "ItemType"; const QString c_Caption = "Caption"; const QString c_Header = "Header"; +const QString c_ContentType = "ContentType"; const QString c_MainModelName = "DocumentTreeModel"; const QString c_ChildModelName = "DocumentDetailsModel"; diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index 74f9404..d509d8c 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -31,73 +31,7 @@ XQChildModel::XQChildModel( QObject *parent ) } -//! erzeugt die basisstruktur des models. -/* -void XQChildModel::initModel(const QString& modelName) -{ - - auto extendItemType = [=,this](const XQNodePtr& entry) - { - const QString& typeName = entry->attribute("ItemType"); - XQItemType* itemType = _itemFactory.findItemTypeTemplate( typeName); // throws - // über alle attribute - for (const auto& attr : entry->attributes()) - { - // prüfen, ob der itemType des attribute schon hat - int role = itemType->hasAttribute( attr.first); - // wenn ja, überschreiben - if( role != XQItem::NoRole ) - { - QVariant newValue = _itemFactory.makeVariant(role,attr.second); - itemType->replaceAttribute( newValue, role ); - } - - } - - }; - - // #0: Wir suchen die Model-Beschreibung - XQNodePtr modelSheet = _itemFactory.findModelSheet( modelName ); // throws - - // #1: Wir erzeugen die Model-Struktur: Jedes Kind beschreibt einen - // XML-Datentyp, z.B. , - // Jeder XML-Knoten entspricht einer Zeile im späteren Model, jedes - // Attribut wird einem eigenen Feld (XQItem) abgebildet. - - for( const auto& sheetNode : modelSheet->children() ) - { - - - XQItemList list = _itemFactory.makeHeaderRow( sheetNode ); - - // für jeden XML-Knotentyp in der Modelbeschreibung erzeugen wir eine section - addSection(list, sheetNode ); - - // jedes kind kann enthält einen itemType und einen headerItemType. Für - // diese sind eventuell weitere attribute vorhanden, die die im type - // enthaltenen defualt-werte überschreiben. - - for( const auto& sheetChild : sheetNode->children() ) - { - //qDebug() << "---- kloppo: " << sheetChild->tag_name() << ": " << sheetChild->to_string(); - extendItemType( sheetChild ); - } - - - - // empty row: - // XQNodePtr contentNode = XQNode::make_node( sheetNode->tag_name() ); - // XQItemList emptyRow = _itemFactory.makeEmptyRow( contentNode, sheetNode ); - // appendRow( emptyRow ); - - - } // for - -} -*/ - - -//! erzegut den sichtbaren inhalt des models aus einem root-datenknoten. +//! erzegt den sichtbaren inhalt des models aus einem root-datenknoten. void XQChildModel::setContent( const XQNodePtr& contentRoot ) { @@ -113,14 +47,20 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot ) // haben, hier: . ... for (const auto& contentEntry : _contentRoot->children()) { + + qDebug() << " --- GOGOGO: 00: " << contentEntry->to_string(); + // Das ist hier der Typ des Eintrags: Panel, Battery ... QString key = contentEntry->tag_name(); + qDebug() << " --- GOGOGO: " << key; // 'silent failure' hier der Datenbaum kann auch Knoten enthalten // die nicht für uns gedacht sind. if (!_sections.hasValidSection(key)) continue; + qDebug() << " --- GOGOGO: FOUND!" << key; + XQModelSection& section = _sections.at( key ); // wir speichern das parent des datenknoten auch in der // section. @@ -128,8 +68,10 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot ) section.contentRootNode = contentEntry->parent(); int newRow = _sections.lastRow(section); - //qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow; - XQItemList list = _itemFactory.makeContentRow( contentEntry, section.sheetRootNode ); + XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, contentEntry ); + + qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow; + // als Baum? //section.headerItem().appendRow( list ); insertRow( newRow, list); diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp index 018dbf7..ad087cd 100644 --- a/src/application/xqmainmodel.cpp +++ b/src/application/xqmainmodel.cpp @@ -39,6 +39,7 @@ XQMainModel::XQMainModel(QObject *parent ) XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode ) { + for(const auto& section : _sections ) { qDebug() << " --- wtf1: " << contentNode->to_string(); diff --git a/src/application/xqmainwindow.cpp b/src/application/xqmainwindow.cpp index 73f56b7..bf8d14a 100644 --- a/src/application/xqmainwindow.cpp +++ b/src/application/xqmainwindow.cpp @@ -34,12 +34,34 @@ XQMainWindow::XQMainWindow( QWidget* parent ) } +// setzt das working directory: dieses muss das 'xml' datenverzeichnis enthalten. + +void XQMainWindow::setupWorkingDir() +{ + QDir dir = QDir::current(); + + while (dir.exists()) + { + QString xmlPath = dir.absoluteFilePath("xml"); + if (QDir(xmlPath).exists()) + { + qDebug() << " --- CD TO: " << dir.absolutePath(); + QDir::setCurrent( dir.absolutePath() ); + } + if (!dir.cdUp()) + return; + } +} + + //! actions & document struktur einrichten. void XQMainWindow::initMainWindow() { qDebug() << " --- initMainWindow(): here we go!"; + // das working dir setzen: 'xml' muss als unterverzeichnis vorhanden sein. + setupWorkingDir(); // als allererstes laden wir die Modelschreibungen XQItemFactory::instance().initItemFactory( c_ModelSheetFileName ); @@ -295,11 +317,12 @@ 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 ); _mainTreeView->setCurrentIndex( newEntry->index() ); _documentStore.addDocument( fileName, pTitle, newEntry, childModel ); + */ } diff --git a/src/application/xqmainwindow.h b/src/application/xqmainwindow.h index ee3478a..a0a167c 100644 --- a/src/application/xqmainwindow.h +++ b/src/application/xqmainwindow.h @@ -51,6 +51,8 @@ public slots: protected: + void setupWorkingDir(); + // fixme implement void showDocumnet( const QString& key ){} void loadDocument( const QString& fileName ); diff --git a/src/items/xqitemfactory.cpp b/src/items/xqitemfactory.cpp index bd522cc..8644a65 100644 --- a/src/items/xqitemfactory.cpp +++ b/src/items/xqitemfactory.cpp @@ -28,7 +28,7 @@ void XQItemFactory::initItemFactory( const QString& modelSheetFileName ) // über alle attribute for( const auto& [key,value] : sheetNode->attributes() ) { - qDebug() << " --- conf item Type: " << key << " : " << value; + //qDebug() << " --- conf item Type: " << key << " : " << value; setItemDataFromString( *itemType, key, value ); } }; @@ -97,6 +97,8 @@ XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry ) return itemType; } +//! firz! + XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const { if( !key.isEmpty() && s_ItemTypeTemplates.contains(key)) @@ -105,6 +107,8 @@ XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const } +//! firz! + XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const { XQNodePtr modelSheet = _modelSheet->find_child_by_tag_name( modelName ); @@ -115,26 +119,7 @@ XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const } - -XQItem* XQItemFactory::makeHeaderItem( const XQNodePtr& sheetEntry ) -{ - // header items are all non-data items: - // - section header row items - // - main tree header items - // - main tree child items - // - also: static items, hidden items - - // den itemtype des neuen items rausfinden - QString typeKey = sheetEntry->attribute("HeaderItemType"); - //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"); - - return new XQItem( itemType, contentPtr ); - -} - +//! firz! XQItem* XQItemFactory::makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry ) { @@ -150,6 +135,9 @@ XQItem* XQItemFactory::makeTreeChildItem( const XQNodePtr& contentNode, const XQ return newItem; } + +//! firz! + void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const { int dataRole = XQItem::fetchItemDataRole( roleKey ); @@ -162,6 +150,8 @@ void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, } +//! firz! + QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const { @@ -283,23 +273,15 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const /// -XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry ) -{ - // den itemtype des neuen items rausfinden - QString typeKey = sheetEntry->attribute(c_ItemType); - //XQItemType* itemType = findItemTypeTemplate(typeKey); // throws - XQItemType* itemType = makeItemType(sheetEntry); // throws - // das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung - const QString* contentPtr = contentNode->attribute_ptr( sheetEntry->tag_name() ); +//! erzeugt ein XQItem aus einer typ-beschreibung ('sheetNode') und einem daten-knoten ('contentNode'). +//! wenn der content node nicht gesetzt ist, wird stattdess das attribut 'Caption' aus der typ-beschreibung +//! verwendet: es handelt sich dann um ein header item, das erzeugt wurde. - return new XQItem( itemType, contentPtr ); - -} - - XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ) +XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ) { // den itemtype des neuen items rausfinden QString typeKey = sheetNode->attribute(c_ItemType); + qDebug() << " --- makeItem: typeKey: " << typeKey << ": " << sheetNode->to_string(); //XQItemType* itemType = makeItemType(sheetEntry); // throws XQItemType* itemType = findItemTypeTemplate(typeKey); // fallunterscheidung beim inhalt: @@ -315,14 +297,14 @@ XQItem* XQItemFactory::makeContentItem( const XQNodePtr& contentNode, const XQNo } -XQItemList XQItemFactory::makeHeader( const XQNodePtr& headerNode ) +XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& headerNode ) { XQItemList list; // über alle kinder der
sektion for( const auto& headerEntry : headerNode->children() ) { - qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption"); + //qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption"); XQItem* headerItem = makeItem( headerEntry ); list.append( headerItem ); } @@ -332,36 +314,9 @@ XQItemList XQItemFactory::makeHeader( const XQNodePtr& headerNode ) } -XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& sheetNode ) -{ - XQItemList list; - // Die Kinder des Knotens beschreiben die einzelnen - // Attribute des XML-Datenknotens - for( const auto& attrNode : sheetNode->children() ) - { - // ?? - //if(attrNode->has_children() ) - // continue; +//! erzeugt eine header item row. - XQItem* headerItem = makeHeaderItem( attrNode ); - list.append( headerItem ); - } - - if( !list.empty() ) - { - // wir merken uns den original content node auch, aber - // im ersten Item. - dynamic_cast(list[0])->setContentNode(sheetNode); - // brauchen wir den noch? - dynamic_cast(list[0])->setSheetNode(sheetNode); - } - - return list; -} - - -// no clone here ! -XQItemList XQItemFactory::makeContentRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ) +XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ) { XQItemList list; @@ -378,7 +333,7 @@ XQItemList XQItemFactory::makeContentRow( const XQNodePtr& contentNode, const XQ for( const auto& sheetEntry : sheetNode->children() ) { - list.append( makeContentItem( contentNode, sheetEntry ) ); + list.append( makeItem( sheetEntry, contentNode ) ); } if( !list.empty() ) @@ -392,6 +347,7 @@ XQItemList XQItemFactory::makeContentRow( const XQNodePtr& contentNode, const XQ } +/* XQItemList XQItemFactory::makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ) { Q_UNUSED(contentNode) @@ -408,8 +364,9 @@ XQItemList XQItemFactory::makeEmptyRow( const XQNodePtr& contentNode, const XQNo return list; } +*/ - +/* XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ) { @@ -429,3 +386,4 @@ XQItemList XQItemFactory::createGenericRow( const XQNodePtr& contentNode, const return makeContentRow(contentNode, sheetNode ); } +*/ diff --git a/src/items/xqitemfactory.h b/src/items/xqitemfactory.h index db0b645..535d7bf 100644 --- a/src/items/xqitemfactory.h +++ b/src/items/xqitemfactory.h @@ -32,20 +32,17 @@ public: XQNodePtr findModelSheet( const QString& modelName ) const; - XQItem* makeHeaderItem(const XQNodePtr& typeSheetNode ); - XQItem* makeContentItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry ); + XQItem* makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry ); XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr); - XQItemList makeHeader( const XQNodePtr& sheetNode ); - - XQItemList makeHeaderRow( const XQNodePtr& sheetNode ); - XQItemList makeContentRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); - XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); + XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ); + //XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); + // wozu ist das gut? - XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); + //XQItemList createGenericRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); void setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const; diff --git a/src/items/xqitemtype.cpp b/src/items/xqitemtype.cpp index 91aef3d..4a0e9bb 100644 --- a/src/items/xqitemtype.cpp +++ b/src/items/xqitemtype.cpp @@ -65,7 +65,7 @@ QVariant XQItemType::data( int role ) const void XQItemType::setData(const QVariant& value, int role ) { - qDebug() << " --- itemType set Data:" << role << " : " << value.toString(); + //qDebug() << " --- itemType set Data:" << role << " : " << value.toString(); return QStandardItem::setData(value,role); } diff --git a/src/model/xqmodelsectionlist.cpp b/src/model/xqmodelsectionlist.cpp index 74a69b6..ce3a9d8 100644 --- a/src/model/xqmodelsectionlist.cpp +++ b/src/model/xqmodelsectionlist.cpp @@ -61,8 +61,12 @@ XQItem& XQModelSection::XQModelSection::headerItem() const void XQModelSectionList::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode) { - XQModelSection section(idx, sheetNode); - addAtKey(sheetNode->tag_name(), section); + if( !sheetNode->has_attribute( c_ContentType) ) + throw XQException( "section list: Section node needs attribute 'ContentType'!"); + + XQModelSection section(idx, sheetNode->find_child_by_tag_name("Data")); + qDebug() << " ---- ADD section: " << sheetNode->attribute( c_ContentType); + addAtKey(sheetNode->attribute( c_ContentType), section); } bool XQModelSectionList::hasValidSection(const QString& sectionKey) const diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 56d3c10..258348e 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -108,7 +108,7 @@ void XQViewModel::initModel(const QString& modelName) const XQNodePtr header = section->find_child_by_tag_name( "Header"); if( header ) { - XQItemList list = _itemFactory.makeHeader( header ); + XQItemList list = _itemFactory.makeHeaderRow( header ); Q_ASSERT(!list.isEmpty()); addSection(list, section ); } diff --git a/src/nodes/znode_payload.h b/src/nodes/znode_payload.h index 2cbd940..2253d23 100644 --- a/src/nodes/znode_payload.h +++ b/src/nodes/znode_payload.h @@ -170,6 +170,9 @@ namespace znode typename zattributes::const_iterator pos = _attributes.find(key); if( pos == _attributes.end() ) return false; + // leer gilded nicht + if( xstr_is_empty( pos->second ) ) + return false; return true; } diff --git a/xml/modeldata1.xtr b/xml/modeldata1.xtr index 7b62e47..89253ec 100644 --- a/xml/modeldata1.xtr +++ b/xml/modeldata1.xtr @@ -1,6 +1,6 @@ - + diff --git a/xml/modeldata2.xtr b/xml/modeldata2.xtr index 8198148..b2fa088 100644 --- a/xml/modeldata2.xtr +++ b/xml/modeldata2.xtr @@ -1,7 +1,7 @@ - + diff --git a/xml/modeldata3.xtr b/xml/modeldata3.xtr index ae9d9fa..f7c783b 100644 --- a/xml/modeldata3.xtr +++ b/xml/modeldata3.xtr @@ -1,6 +1,6 @@ - + diff --git a/xml/modelsheets.xml b/xml/modelsheets.xml index 9b61535..83267c2 100644 --- a/xml/modelsheets.xml +++ b/xml/modelsheets.xml @@ -42,7 +42,7 @@ DocumentDetailsModel: --> -
+
@@ -50,7 +50,7 @@
-
+
@@ -58,7 +58,7 @@
-
+
@@ -74,8 +74,8 @@ -
-
+
+
@@ -101,8 +101,8 @@
-
-
+
+
@@ -122,8 +122,8 @@
-
-
+
+
From 0d7ab33c742bb3dd6cbe3d0348c5191e989ba113 Mon Sep 17 00:00:00 2001 From: "DIASPORA\\chris" Date: Thu, 14 Aug 2025 21:36:39 +0200 Subject: [PATCH 3/6] reworked model sections. --- {src/items => deprecated}/xqgenericitem.cpp | 0 {src/items => deprecated}/xqgenericitem.h | 0 src/application/xqappdata.h | 1 + src/application/xqchildmodel.cpp | 8 ---- src/application/xqmainmodel.cpp | 17 ++++++- src/items/xqitemfactory.cpp | 21 +-------- src/items/xqitemfactory.h | 3 -- src/model/xqmodelsectionlist.cpp | 32 +++++++------ src/model/xqmodelsectionlist.h | 9 ++-- src/model/xqviewmodel.cpp | 51 +++++++++++++++------ src/model/xqviewmodel.h | 3 -- src/xtree.pro | 2 - xml/modelsheets.xml | 2 +- 13 files changed, 79 insertions(+), 70 deletions(-) rename {src/items => deprecated}/xqgenericitem.cpp (100%) rename {src/items => deprecated}/xqgenericitem.h (100%) diff --git a/src/items/xqgenericitem.cpp b/deprecated/xqgenericitem.cpp similarity index 100% rename from src/items/xqgenericitem.cpp rename to deprecated/xqgenericitem.cpp diff --git a/src/items/xqgenericitem.h b/deprecated/xqgenericitem.h similarity index 100% rename from src/items/xqgenericitem.h rename to deprecated/xqgenericitem.h diff --git a/src/application/xqappdata.h b/src/application/xqappdata.h index e4b288a..73cd6f6 100644 --- a/src/application/xqappdata.h +++ b/src/application/xqappdata.h @@ -28,6 +28,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_MainModelName = "DocumentTreeModel"; const QString c_ChildModelName = "DocumentDetailsModel"; diff --git a/src/application/xqchildmodel.cpp b/src/application/xqchildmodel.cpp index d509d8c..9e16dfc 100644 --- a/src/application/xqchildmodel.cpp +++ b/src/application/xqchildmodel.cpp @@ -47,20 +47,14 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot ) // haben, hier: . ... for (const auto& contentEntry : _contentRoot->children()) { - - qDebug() << " --- GOGOGO: 00: " << contentEntry->to_string(); - // Das ist hier der Typ des Eintrags: Panel, Battery ... QString key = contentEntry->tag_name(); - qDebug() << " --- GOGOGO: " << key; // 'silent failure' hier der Datenbaum kann auch Knoten enthalten // die nicht für uns gedacht sind. if (!_sections.hasValidSection(key)) continue; - qDebug() << " --- GOGOGO: FOUND!" << key; - XQModelSection& section = _sections.at( key ); // wir speichern das parent des datenknoten auch in der // section. @@ -70,8 +64,6 @@ void XQChildModel::setContent( const XQNodePtr& contentRoot ) XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, contentEntry ); - qDebug() << " --- AHJA: " << key << " -- last Row dazu: " << newRow; - // als Baum? //section.headerItem().appendRow( list ); insertRow( newRow, list); diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp index ad087cd..047919c 100644 --- a/src/application/xqmainmodel.cpp +++ b/src/application/xqmainmodel.cpp @@ -40,6 +40,7 @@ XQMainModel::XQMainModel(QObject *parent ) XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode ) { + /* for(const auto& section : _sections ) { qDebug() << " --- wtf1: " << contentNode->to_string(); @@ -47,7 +48,20 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode ) if( contentNode->attribute("State") == section.sheetRootNode->attribute("State") ) { - XQItem* newTreeentry = _itemFactory.makeTreeChildItem( contentNode, section.sheetRootNode ); + //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 + + const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" ); + + XQItem* newItem = new XQItem( itemType, contentPtr ); + + return newItem; + section.headerItem().appendRow( newTreeentry ); _treeTable->expand( section.modelIndex ); // ?? @@ -57,6 +71,7 @@ XQItem* XQMainModel::createTreeEntry( XQNodePtr contentNode ) return newTreeentry; } } + */ throw XQException( "createTreeEntry: main model should not be empty!" ); } diff --git a/src/items/xqitemfactory.cpp b/src/items/xqitemfactory.cpp index 8644a65..dd135fb 100644 --- a/src/items/xqitemfactory.cpp +++ b/src/items/xqitemfactory.cpp @@ -119,24 +119,7 @@ XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const } -//! firz! - -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; -} - - -//! firz! +//! erzeugt eine QVariant aus dem gegebenen string und setzt diese dann via role im item. void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, const QString& source ) const { @@ -150,7 +133,7 @@ void XQItemFactory::setItemDataFromString( XQItem& item, const QString& roleKey, } -//! firz! +//! erzeugt eine QVariant aus dem gegebenen string QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const { diff --git a/src/items/xqitemfactory.h b/src/items/xqitemfactory.h index 535d7bf..b5f4872 100644 --- a/src/items/xqitemfactory.h +++ b/src/items/xqitemfactory.h @@ -32,9 +32,6 @@ public: XQNodePtr findModelSheet( const QString& modelName ) const; - - XQItem* makeTreeChildItem( const XQNodePtr& contentNode, const XQNodePtr& sheetEntry ); - XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr); XQItemList makeHeaderRow( const XQNodePtr& sheetNode ); diff --git a/src/model/xqmodelsectionlist.cpp b/src/model/xqmodelsectionlist.cpp index ce3a9d8..b2c20cd 100644 --- a/src/model/xqmodelsectionlist.cpp +++ b/src/model/xqmodelsectionlist.cpp @@ -13,7 +13,7 @@ #include -#include + //! kontstruktor. übergibt den start-index und einen model-knoten mit der beschreibung @@ -38,6 +38,7 @@ bool XQModelSection::operator==(const XQModelSection& other) const bool XQModelSection::isValid() const { + qDebug() << " mi: " << modelIndex.isValid() << " sheetNode: " << (bool)(sheetRootNode); return modelIndex.isValid() && sheetRootNode; } @@ -57,32 +58,27 @@ XQItem& XQModelSection::XQModelSection::headerItem() const return XQItem::xqItemFromIndex( modelIndex ); } - - -void XQModelSectionList::addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode) -{ - if( !sheetNode->has_attribute( c_ContentType) ) - throw XQException( "section list: Section node needs attribute 'ContentType'!"); - - XQModelSection section(idx, sheetNode->find_child_by_tag_name("Data")); - qDebug() << " ---- ADD section: " << sheetNode->attribute( c_ContentType); - addAtKey(sheetNode->attribute( c_ContentType), section); -} +//! testet, ob die unter 'sectionKey' eine gültige section vorhanden ist. bool XQModelSectionList::hasValidSection(const QString& sectionKey) const { + qDebug() << " ---- FIND section: " << sectionKey << ":" << contains(sectionKey) << ":" << at(sectionKey).isValid(); if (!contains(sectionKey) ) return false; return at(sectionKey).isValid(); } +//! gibt für einen model index die 'zuständige' section zurück. -const XQModelSection& XQModelSectionList::sectionxqItemFromIndex( const QModelIndex& index ) const +const XQModelSection& XQModelSectionList::sectionFromIndex( const QModelIndex& index ) const { return sectionFromRow( index.row() ); } +//! gibt für eine zeile die 'zuständige' section zurück: der bestand an section wird +//! nach der passenden section durchsucht. + const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const { @@ -99,18 +95,26 @@ const XQModelSection& XQModelSectionList::sectionFromRow(int itemRow ) const } +//! ermittelt die erste zeile einer section. + int XQModelSectionList::firstRow(const QModelIndex& idx) const { return sectionFromRow(idx.row() ).row(); } +//! ermittelt die zeile unterhalb des gegebenen modelindex, +//! zum einfügen neuer items ebendort. + int XQModelSectionList::lastRow(const QModelIndex& idx) const { return lastRow(sectionFromRow(idx.row())); } +//! ermittelt die zeile unterhalb der gegebenen section, +//! zum einfügen neuer items ebendort. + int XQModelSectionList::lastRow(const XQModelSection& section ) const { //qDebug() << " -- last row in section: " << section.modelIndex.data().toString() << " --> " << section.modelIndex.row(); @@ -129,6 +133,8 @@ int XQModelSectionList::lastRow(const XQModelSection& section ) const } +//! gibt alle sections aus, zum ankucken. + void XQModelSectionList::dump() const { qDebug() << " --- sections dump(): " < -#include -#include -class XQItem; +#include +#include /** * @brief Struct containing data for a header section @@ -54,11 +53,11 @@ public: XQModelSectionList() = default; virtual ~XQModelSectionList() = default; - void addSectionEntry(const QModelIndex& idx, XQNodePtr sheetNode ); + void createSectionEntry(const XQItemList& list, const XQNodePtr& sheetNode ); bool hasValidSection(const QString& sectionKey) const; const XQModelSection& sectionFromRow( int row ) const; - const XQModelSection& sectionxqItemFromIndex( const QModelIndex& index ) const; + const XQModelSection& sectionFromIndex( const QModelIndex& index ) const; int firstRow(const QModelIndex& idx) const; int lastRow(const QModelIndex& idx) const; diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 258348e..52bebae 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -104,12 +104,12 @@ void XQViewModel::initModel(const QString& modelName) // #1: über alle sections for( auto& section : modelSheet->children() ) { - // #2: (optionalen) header erzeugen + // #2: (optionalen?) header erzeugen const XQNodePtr header = section->find_child_by_tag_name( "Header"); if( header ) { - XQItemList list = _itemFactory.makeHeaderRow( header ); - Q_ASSERT(!list.isEmpty()); + //XQItemList list = _itemFactory.makeHeaderRow( header ); + XQItemList list = _itemFactory.makeContentRow( header, nullptr ); addSection(list, section ); } @@ -117,6 +117,33 @@ void XQViewModel::initModel(const QString& modelName) } +//! hilfsfunktion: fügt die liste unserem model hinzu und erzeugt eine 'section'. +//! die section kann erst gültig sein, wenn die items im model gelandet sind, +//! deswegen ist das hier zusammengefasst. + +//! erzeugt dann eine section aus einer frisch erzeugten itemlist. der erste modelindex +//! der liste und der unterknoten 'Data' werden gespeichert. + +void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode ) +{ + // 1. die liste darf nicht leer sein + Q_ASSERT(!list.isEmpty()); + // 2. sheetNode muss da sein + Q_ASSERT(sheetNode); + // 3. 'ContenType' muss vorhanden sein + if( !sheetNode->has_attribute( c_ContentType) ) + throw XQException( "section list: Section node needs attribute 'ContentType'!"); + // 4. Data child muss auch da sein + XQNodePtr dataNode = sheetNode->find_child_by_tag_name( c_Data ); + if( !dataNode ) + throw XQException( "section list: 'Data' child is missing!"); + + // 5. das erzeugt dann auch valide indices + appendRow(list); + + XQModelSection section(list[0]->index(), dataNode ); + _sections.addAtKey(sheetNode->attribute( c_ContentType), section); +} //! SLOT, der aufgerufen wird, wenn eine edit-action getriggert wurde. void XQViewModel::onActionTriggered(QAction* action) @@ -263,10 +290,13 @@ void XQViewModel::cmdCut( XQCommand& command ) { // ... holen das erste item, das auch den content node enthält //const XQNodeBackup& entry = *it; - //XQItem& firstItem = xqFirstItem( (*it).itemPos ); - //qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id; // jetzt löschen, dabei wird die parent-verbindung entfernt const XQNodeBackup& entry = *it; + + XQItem& firstItem = xqFirstItem( (*it).itemPos ); + qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id; + + entry.contentNode->unlink_self(); removeRow(entry.itemPos ); } @@ -404,7 +434,7 @@ void XQViewModel::cmdNew( XQCommand& command ) // store node in node->parent() //node->add_before_me( newNode ); // store node also in 'command' to enable undo - const XQModelSection& section = _sections.sectionxqItemFromIndex( origin ); + const XQModelSection& section = _sections.sectionFromIndex( origin ); // create new item row XQItemList list = _itemFactory.createGenericRow( newNode, section.sheetRootNode ); @@ -484,15 +514,6 @@ void XQViewModel::setupViewProperties() } -//! füg eine section mit header hinzu. - -void XQViewModel::addSection( const XQItemList& list, const XQNodePtr& sheetNode ) -{ - appendRow(list); - _sections.addSectionEntry( list[0]->index(), sheetNode ); -} - - //! gibt den undo-stack zurück. QUndoStack* XQViewModel::undoStack() diff --git a/src/model/xqviewmodel.h b/src/model/xqviewmodel.h index 6085a88..8b84534 100644 --- a/src/model/xqviewmodel.h +++ b/src/model/xqviewmodel.h @@ -104,9 +104,6 @@ signals: protected: void addSection(const XQItemList& list, const XQNodePtr& sheetNode ); - -protected: - virtual void initContextMenu() = 0; // __fixme: should be created from xml diff --git a/src/xtree.pro b/src/xtree.pro index 1415e11..00a8b87 100644 --- a/src/xtree.pro +++ b/src/xtree.pro @@ -15,7 +15,6 @@ HEADERS += \ application/xqmainmodel.h \ application/xqmainwindow.h \ application/xqappdata.h \ - items/xqgenericitem.h \ items/xqitem.h \ items/xqitemfactory.h \ items/xqitemtype.h \ @@ -52,7 +51,6 @@ SOURCES += \ application/xqmainmodel.cpp \ application/xqmainwindow.cpp \ application/xqappdata.cpp \ - items/xqgenericitem.cpp \ items/xqitem.cpp \ items/xqitemfactory.cpp \ items/xqitemtype.cpp \ diff --git a/xml/modelsheets.xml b/xml/modelsheets.xml index 83267c2..ad50027 100644 --- a/xml/modelsheets.xml +++ b/xml/modelsheets.xml @@ -8,7 +8,7 @@ - + From 6865e6aaaa8e2f35b4f81471376147179bc42344 Mon Sep 17 00:00:00 2001 From: "DIASPORA\\chris" Date: Thu, 14 Aug 2025 22:03:31 +0200 Subject: [PATCH 4/6] cleanups. --- src/model/xqviewmodel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 52bebae..9f41079 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -144,6 +144,8 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode XQModelSection section(list[0]->index(), dataNode ); _sections.addAtKey(sheetNode->attribute( c_ContentType), section); } + + //! SLOT, der aufgerufen wird, wenn eine edit-action getriggert wurde. void XQViewModel::onActionTriggered(QAction* action) @@ -296,12 +298,12 @@ void XQViewModel::cmdCut( XQCommand& command ) XQItem& firstItem = xqFirstItem( (*it).itemPos ); qDebug() << " --- Cut: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id; - entry.contentNode->unlink_self(); removeRow(entry.itemPos ); } } + //! entfernte knoten wieder einfügen , 'command' enthält die liste void XQViewModel::cmdCutUndo( XQCommand& command ) From c87da2802a0316577dc6bfa412f8e645d3f9e895 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Fri, 15 Aug 2025 20:31:40 +0200 Subject: [PATCH 5/6] backup --- deprecated/reste.cpp | 84 ++++++++++++++ src/application/xqappdata.cpp | 184 ++++++++++++++++--------------- src/application/xqappdata.h | 6 +- src/application/xqmainmodel.cpp | 41 ------- src/application/xqmainmodel.h | 2 +- src/items/xqitemfactory.cpp | 50 +++------ src/items/xqitemfactory.h | 2 +- src/items/xqitemtype.cpp | 32 +++--- src/items/xqitemtype.h | 4 +- src/main.cpp | 4 +- src/model/xqmodelsectionlist.cpp | 2 - src/model/xqviewmodel.cpp | 7 +- src/xtree.pro | 2 + xml/modelsheets.xml | 108 +----------------- 14 files changed, 235 insertions(+), 293 deletions(-) create mode 100644 deprecated/reste.cpp diff --git a/deprecated/reste.cpp b/deprecated/reste.cpp new file mode 100644 index 0000000..0cf18cf --- /dev/null +++ b/deprecated/reste.cpp @@ -0,0 +1,84 @@ +XQItem* createTreeEntry( XQNodePtr contentNode ); + + + +//! erzeugt einen eintrag in der baum-übersicht. + +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.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 + + const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" ); + + XQItem* newItem = new XQItem( itemType, contentPtr ); + + 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!" ); +} +
+
+ + + + + + + +
+ + + + + + + + + +
+ +
+
+ + + + + + + +
+ + + + + + + + + +
\ No newline at end of file diff --git a/src/application/xqappdata.cpp b/src/application/xqappdata.cpp index b7027c9..3aa03fc 100644 --- a/src/application/xqappdata.cpp +++ b/src/application/xqappdata.cpp @@ -32,7 +32,7 @@ namespace XQAppData - class XQAppIconMap : public QMap + class XQAppIconMap : public QMap { public: @@ -40,85 +40,85 @@ namespace XQAppData void init() { - insert( "DirIcon" , QApplication::style()->standardIcon(QStyle::SP_DirIcon)); - insert( "FileDialogBack", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack)); - insert( "FileDialogContentsView", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView)); - insert( "FileDialogDetailedView", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView)); - insert( "icn05Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd)); - insert( "icn06Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView)); - insert( "icn07Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView)); - insert( "icn08Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder)); - insert( "icn09Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart)); - insert( "icn10Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent)); - insert( "icn11Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowBack)); - insert( "icn12Dummy", QApplication::style()->standardIcon(QStyle::SP_DirIcon)); - insert( "icn13Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipBackward)); - insert( "icn14Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowDown)); - insert( "icn15Dummy", QApplication::style()->standardIcon(QStyle::SP_DirLinkIcon)); - insert( "icn16Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipForward)); - insert( "icn17Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowForward)); - insert( "icn18Dummy", QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon)); - insert( "icn19Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaStop)); - insert( "icn20Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowLeft)); - insert( "icn21Dummy", QApplication::style()->standardIcon(QStyle::SP_DockWidgetCloseButton)); - insert( "icn22Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolume)); - insert( "icn23Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowRight)); - insert( "icn24Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon)); - insert( "icn25Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolumeMuted)); - insert( "icn26Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowUp)); - insert( "icn27Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveDVDIcon)); - insert( "icn28Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical)); - insert( "icn29Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserReload)); - insert( "icn30Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveFDIcon)); - insert( "icn31Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation)); - insert( "BrowserStop", QApplication::style()->standardIcon(QStyle::SP_BrowserStop)); - insert( "icn33Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveHDIcon)); - insert( "icn34Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion)); - insert( "icn35Dummy", QApplication::style()->standardIcon(QStyle::SP_CommandLink)); - insert( "icn36Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveNetIcon)); - insert( "icn37Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning)); - insert( "icn38Dummy", QApplication::style()->standardIcon(QStyle::SP_ComputerIcon)); - insert( "icn39Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack)); - insert( "icn40Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton)); - insert( "icn41Dummy", QApplication::style()->standardIcon(QStyle::SP_CustomBase)); - insert( "icn42Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView)); - insert( "icn43Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarContextHelpButton)); - insert( "icn44Dummy", QApplication::style()->standardIcon(QStyle::SP_DesktopIcon)); - insert( "icn45Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView)); - insert( "icn46Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton)); - insert( "icn47Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton)); - insert( "icn48Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd)); - insert( "icn49Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton)); - insert( "icn50Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton)); - insert( "icn51Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView)); - insert( "icn52Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMinButton)); - insert( "icn53Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton)); - insert( "icn54Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView)); - insert( "icn55Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarNormalButton)); - insert( "icn56Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogDiscardButton)); - insert( "icn57Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder)); - insert( "icn58Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarShadeButton)); - insert( "icn59Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogHelpButton)); - insert( "icn60Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart)); - insert( "icn61Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarUnshadeButton)); - insert( "icn62Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogNoButton)); - insert( "icn63Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent)); - insert( "icn64Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton)); - insert( "icn65Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogOkButton)); - insert( "FileIcon", QApplication::style()->standardIcon(QStyle::SP_FileIcon)); - insert( "icn67Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton)); - insert( "icn68Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogResetButton)); - insert( "icn70Dummy", QApplication::style()->standardIcon(QStyle::SP_FileLinkIcon)); - insert( "TrashIcon", QApplication::style()->standardIcon(QStyle::SP_TrashIcon)); - insert( "icn72Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton)); - insert( "icn73Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPause)); - insert( "icn74Dummy", QApplication::style()->standardIcon(QStyle::SP_VistaShield)); - insert( "icn75Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogYesButton)); - insert( "icn76Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPlay)); - insert( "icn77Dummy", QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon)); - insert( "icn79Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward)); - insert( "DirHomeIcon", QApplication::style()->standardIcon(QStyle::SP_DirHomeIcon)); - insert( "icn81Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward)); + namedInsert( "DirIcon" , QStyle::SP_DirIcon ); + namedInsert( "FileDialogBack", QStyle::SP_FileDialogBack ); + namedInsert( "FileDialogContentsView", QStyle::SP_FileDialogContentsView ); + namedInsert( "FileDialogDetailedView", QStyle::SP_FileDialogDetailedView ); + namedInsert( "icn05Dummy", QStyle::SP_FileDialogEnd ); + namedInsert( "icn06Dummy", QStyle::SP_FileDialogInfoView ); + namedInsert( "icn07Dummy", QStyle::SP_FileDialogListView ); + namedInsert( "icn08Dummy", QStyle::SP_FileDialogNewFolder ); + namedInsert( "icn09Dummy", QStyle::SP_FileDialogStart ); + namedInsert( "icn10Dummy", QStyle::SP_FileDialogToParent ); + namedInsert( "icn11Dummy", QStyle::SP_ArrowBack ); + namedInsert( "icn12Dummy", QStyle::SP_DirIcon ); + namedInsert( "icn13Dummy", QStyle::SP_MediaSkipBackward ); + namedInsert( "icn14Dummy", QStyle::SP_ArrowDown ); + namedInsert( "icn15Dummy", QStyle::SP_DirLinkIcon ); + namedInsert( "icn16Dummy", QStyle::SP_MediaSkipForward ); + namedInsert( "icn17Dummy", QStyle::SP_ArrowForward ); + namedInsert( "icn18Dummy", QStyle::SP_DirOpenIcon ); + namedInsert( "icn19Dummy", QStyle::SP_MediaStop ); + namedInsert( "icn20Dummy", QStyle::SP_ArrowLeft ); + namedInsert( "icn21Dummy", QStyle::SP_DockWidgetCloseButton ); + namedInsert( "icn22Dummy", QStyle::SP_MediaVolume ); + namedInsert( "icn23Dummy", QStyle::SP_ArrowRight ); + namedInsert( "icn24Dummy", QStyle::SP_DriveCDIcon ); + namedInsert( "icn25Dummy", QStyle::SP_MediaVolumeMuted ); + namedInsert( "icn26Dummy", QStyle::SP_ArrowUp ); + namedInsert( "icn27Dummy", QStyle::SP_DriveDVDIcon ); + namedInsert( "icn28Dummy", QStyle::SP_MessageBoxCritical ); + namedInsert( "icn29Dummy", QStyle::SP_BrowserReload ); + namedInsert( "icn30Dummy", QStyle::SP_DriveFDIcon ); + namedInsert( "icn31Dummy", QStyle::SP_MessageBoxInformation ); + namedInsert( "BrowserStop", QStyle::SP_BrowserStop ); + namedInsert( "icn33Dummy", QStyle::SP_DriveHDIcon ); + namedInsert( "icn34Dummy", QStyle::SP_MessageBoxQuestion ); + namedInsert( "icn35Dummy", QStyle::SP_CommandLink ); + namedInsert( "icn36Dummy", QStyle::SP_DriveNetIcon ); + namedInsert( "icn37Dummy", QStyle::SP_MessageBoxWarning ); + namedInsert( "icn38Dummy", QStyle::SP_ComputerIcon ); + namedInsert( "icn39Dummy", QStyle::SP_FileDialogBack ); + namedInsert( "icn40Dummy", QStyle::SP_TitleBarCloseButton ); + namedInsert( "icn41Dummy", QStyle::SP_CustomBase ); + namedInsert( "icn42Dummy", QStyle::SP_FileDialogContentsView ); + namedInsert( "icn43Dummy", QStyle::SP_TitleBarContextHelpButton ); + namedInsert( "DesktopIcon", QStyle::SP_DesktopIcon ); + namedInsert( "icn45Dummy", QStyle::SP_FileDialogDetailedView ); + namedInsert( "icn46Dummy", QStyle::SP_TitleBarMaxButton ); + namedInsert( "icn47Dummy", QStyle::SP_DialogApplyButton ); + namedInsert( "icn48Dummy", QStyle::SP_FileDialogEnd ); + namedInsert( "icn49Dummy", QStyle::SP_TitleBarMenuButton ); + namedInsert( "icn50Dummy", QStyle::SP_DialogCancelButton ); + namedInsert( "icn51Dummy", QStyle::SP_FileDialogInfoView ); + namedInsert( "icn52Dummy", QStyle::SP_TitleBarMinButton ); + namedInsert( "icn53Dummy", QStyle::SP_DialogCloseButton ); + namedInsert( "icn54Dummy", QStyle::SP_FileDialogListView ); + namedInsert( "icn55Dummy", QStyle::SP_TitleBarNormalButton ); + namedInsert( "icn56Dummy", QStyle::SP_DialogDiscardButton ); + namedInsert( "icn57Dummy", QStyle::SP_FileDialogNewFolder ); + namedInsert( "icn58Dummy", QStyle::SP_TitleBarShadeButton ); + namedInsert( "icn59Dummy", QStyle::SP_DialogHelpButton ); + namedInsert( "icn60Dummy", QStyle::SP_FileDialogStart ); + namedInsert( "icn61Dummy", QStyle::SP_TitleBarUnshadeButton ); + namedInsert( "icn62Dummy", QStyle::SP_DialogNoButton ); + namedInsert( "icn63Dummy", QStyle::SP_FileDialogToParent ); + namedInsert( "icn64Dummy", QStyle::SP_ToolBarHorizontalExtensionButton ); + namedInsert( "icn65Dummy", QStyle::SP_DialogOkButton ); + namedInsert( "FileIcon", QStyle::SP_FileIcon ); + namedInsert( "icn67Dummy", QStyle::SP_ToolBarVerticalExtensionButton ); + namedInsert( "icn68Dummy", QStyle::SP_DialogResetButton ); + namedInsert( "icn70Dummy", QStyle::SP_FileLinkIcon ); + namedInsert( "TrashIcon", QStyle::SP_TrashIcon ); + namedInsert( "icn72Dummy", QStyle::SP_DialogSaveButton ); + namedInsert( "icn73Dummy", QStyle::SP_MediaPause ); + namedInsert( "icn74Dummy", QStyle::SP_VistaShield ); + namedInsert( "icn75Dummy", QStyle::SP_DialogYesButton ); + namedInsert( "icn76Dummy", QStyle::SP_MediaPlay ); + namedInsert( "icn77Dummy", QStyle::SP_DirClosedIcon ); + namedInsert( "icn79Dummy", QStyle::SP_MediaSeekBackward ); + namedInsert( "DirHomeIcon", QStyle::SP_DirHomeIcon ); + namedInsert( "icn81Dummy", QStyle::SP_MediaSeekForward ); /* auto from = to_underlying(QIcon::ThemeIcon::AddressBookNew); auto to = to_underlying(QIcon::ThemeIcon::NThemeIcons); @@ -134,8 +134,17 @@ namespace XQAppData } - }; + void namedInsert( const QString& key, QStyle::StandardPixmap pixmapID ) + { + QIcon icon = QApplication::style()->standardIcon( pixmapID ); + insert( key, XQIcon( icon, key ) ); + //_keysToNames.insert() + } + protected: + + QMap _keysToNames; + }; @@ -150,18 +159,15 @@ namespace XQAppData static XQAppIconMap s_IconMap; - bool hasTypeIcon(const QString& key ) + + XQIcon typeIcon(const QString& key ) { if(s_IconMap.isEmpty()) s_IconMap.init(); - return !key.isEmpty() && s_IconMap.contains(key); - } - - QIcon typeIcon(const QString& key ) - { - if( hasTypeIcon(key) ) + if( s_IconMap.contains(key) ) return s_IconMap[key]; - return QApplication::style()->standardIcon(QStyle::SP_TrashIcon); + static XQIcon s_FallBackIcon( QApplication::style()->standardIcon( QStyle::SP_TrashIcon), "NoIcon" ); + return s_FallBackIcon; } diff --git a/src/application/xqappdata.h b/src/application/xqappdata.h index 73cd6f6..4ccddaf 100644 --- a/src/application/xqappdata.h +++ b/src/application/xqappdata.h @@ -19,7 +19,8 @@ #include #include #include -#include + +#include #include const QString c_Version = "0.1.1 04.09.2024"; @@ -48,8 +49,7 @@ namespace XQAppData { //class XQAppIconMap; - bool hasTypeIcon(const QString& key ); - QIcon typeIcon(const QString& key ); + XQIcon typeIcon(const QString& key ); } #endif // XQAPPDATA_H diff --git a/src/application/xqmainmodel.cpp b/src/application/xqmainmodel.cpp index 047919c..bcb106a 100644 --- a/src/application/xqmainmodel.cpp +++ b/src/application/xqmainmodel.cpp @@ -34,47 +34,6 @@ XQMainModel::XQMainModel(QObject *parent ) } - -//! erzeugt einen eintrag in der baum-übersicht. - -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.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 - - const QString* contentPtr = contentNode->attribute_ptr( "ProjectName" ); - - XQItem* newItem = new XQItem( itemType, contentPtr ); - - 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!" ); -} - //! leere default implementation void XQMainModel::initContextMenu() diff --git a/src/application/xqmainmodel.h b/src/application/xqmainmodel.h index 443b7dd..a3c83ec 100644 --- a/src/application/xqmainmodel.h +++ b/src/application/xqmainmodel.h @@ -32,7 +32,7 @@ public: explicit XQMainModel(QObject *parent = nullptr); virtual ~XQMainModel() = default; - XQItem* createTreeEntry( XQNodePtr contentNode ); + public slots: diff --git a/src/items/xqitemfactory.cpp b/src/items/xqitemfactory.cpp index dd135fb..957d89f 100644 --- a/src/items/xqitemfactory.cpp +++ b/src/items/xqitemfactory.cpp @@ -68,28 +68,32 @@ bool XQItemFactory::isValid() } -//! es reicht nicht, einen itemType aus den itemType-templates zu +//! Es reicht nicht, einen itemType aus den itemType-templates zu //! holen: möglicherweise muss der noch mit zusätzlichen attributen -//! ergänzt werden, (hier 'UnitType' ). +//! ergänzt werden. +//! Vom aufwand ist es auch egal, ob ich daten aus dem XML in das +//! item oder den itemtyp schreiben muss. XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry ) { - QString typeKey = sheetEntry->attribute("ItemType"); + QString typeKey = sheetEntry->attribute( c_ItemType ); XQItemType* itemType = findItemTypeTemplate(typeKey); // wir prüfen, ob im sheetEntry noch zusätzliche attribute vorhanden // sind, die wir in dem itemType müssen + qDebug() << " --- makeItemType: " << sheetEntry->to_string(); + // über alle attribute - for (const auto& attr : sheetEntry->attributes()) + for (const auto& attrEntry : sheetEntry->attributes()) { // prüfen, ob der itemType des attribute schon hat - int role = itemType->hasAttribute( attr.first); + int role = itemType->roleForAttributeKey( attrEntry.first ); // wenn ja, überschreiben if( role != XQItem::NoRole ) { - QVariant newValue = makeVariant(role,attr.second); + QVariant newValue = makeVariant(role, attrEntry.second ); itemType = itemType->replaceAttribute( newValue, role ); } @@ -97,7 +101,7 @@ XQItemType* XQItemFactory::makeItemType(const XQNodePtr& sheetEntry ) return itemType; } -//! firz! +//! sucht einen item typ aus der map mit 'vorgefertigen' itemtypen. XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const { @@ -107,7 +111,7 @@ XQItemType* XQItemFactory::findItemTypeTemplate(const QString& key ) const } -//! firz! +//! sucht eine model-beschreibung XQNodePtr XQItemFactory::findModelSheet( const QString& modelName ) const { @@ -153,6 +157,7 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const case XQItem::ItemTypeRole: { // itemType() -> XQItemType* + qDebug() << " --- makeVariant: make ItemType: " << source; XQItemType* itemType = findItemTypeTemplate( source ); value = QVariant::fromValue(itemType); break; @@ -202,10 +207,8 @@ QVariant XQItemFactory::makeVariant( int dataRole, const QString& source ) const case XQItem::IconRole: - { - QIcon typeIcon; - if(XQAppData::hasTypeIcon(source)) - typeIcon = XQAppData::typeIcon(source); + { + QIcon typeIcon = XQAppData::typeIcon(source); value = QVariant::fromValue(typeIcon); break; } @@ -264,9 +267,8 @@ XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& co { // den itemtype des neuen items rausfinden QString typeKey = sheetNode->attribute(c_ItemType); - qDebug() << " --- makeItem: typeKey: " << typeKey << ": " << sheetNode->to_string(); - //XQItemType* itemType = makeItemType(sheetEntry); // throws - XQItemType* itemType = findItemTypeTemplate(typeKey); + + XQItemType* itemType = makeItemType(sheetNode); // throws // fallunterscheidung beim inhalt: const QString* contentPtr{}; // das ist Unterschied zum normalen Item: Der Titel kommt aus der Modelbeschreibung @@ -280,24 +282,8 @@ XQItem* XQItemFactory::makeItem( const XQNodePtr& sheetNode, const XQNodePtr& co } -XQItemList XQItemFactory::makeHeaderRow( const XQNodePtr& headerNode ) -{ - XQItemList list; - // über alle kinder der
sektion - for( const auto& headerEntry : headerNode->children() ) - { - //qDebug() << " --- headerEntry: " << headerEntry->tag_name() << ": " << headerEntry->attribute( "ItemType") << headerEntry->attribute( "Caption"); - XQItem* headerItem = makeItem( headerEntry ); - list.append( headerItem ); - } - - return list; - -} - - -//! erzeugt eine header item row. +//! erzeugt eine item-row. XQItemList XQItemFactory::makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ) { diff --git a/src/items/xqitemfactory.h b/src/items/xqitemfactory.h index b5f4872..3376be5 100644 --- a/src/items/xqitemfactory.h +++ b/src/items/xqitemfactory.h @@ -34,7 +34,7 @@ public: XQItem* makeItem( const XQNodePtr& sheetNode, const XQNodePtr& contentNode=nullptr); - XQItemList makeHeaderRow( const XQNodePtr& sheetNode ); + XQItemList makeContentRow( const XQNodePtr& sheetNode, const XQNodePtr& contentNode ); //XQItemList makeEmptyRow( const XQNodePtr& contentNode, const XQNodePtr& sheetNode ); diff --git a/src/items/xqitemtype.cpp b/src/items/xqitemtype.cpp index 4a0e9bb..2831dcb 100644 --- a/src/items/xqitemtype.cpp +++ b/src/items/xqitemtype.cpp @@ -70,18 +70,17 @@ void XQItemType::setData(const QVariant& value, int role ) } //! tested, ob ein attribute (z.B. unitType) hier vorhanden ist -int XQItemType::hasAttribute( const QString& attrKey ) +int XQItemType::roleForAttributeKey( const QString& attrKey ) { int role = XQItem::fetchItemDataRole(attrKey); // gibbed überhaupt eine rolle für unser attribut? - if( role == XQItem::NoRole) - return XQItem::NoRole; - - // wenn ja, ist die role hier besetzt? - QVariant value = data(role); - if( !value.isValid() || value.isNull() ) - return XQItem::NoRole; - + if( role != XQItem::NoRole) + { + // wenn ja, ist die role hier besetzt? + QVariant value = data(role); + if( !value.isValid() || value.isNull() ) + return XQItem::NoRole; + } return role; } @@ -91,6 +90,7 @@ int XQItemType::hasAttribute( const QString& attrKey ) XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role ) { + qDebug() << " --- Before: " << makeItemTypeKey() << " role:" << XQItem::fetchItemDataRoleName(role) << " value:" << newValue.toString(); // hat sich überhaupt was geändert? QVariant oldValue = data(role); @@ -115,8 +115,10 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role ) // speichern s_ItemTypeMap.insert( newKey, myClone ); - // und ins item übernehmen - //item.setItemType( myClone ); + + + + qDebug() << " --- After: " << myClone->makeItemTypeKey(); /// Obacht! Der alte, geänderte itemType bleibt erhalten /// und verrottet ggf. ohne Daseinszweck @@ -131,6 +133,7 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role ) QVariant XQItemType::formatText( const XQItem& item ) const { XQItem::UnitType uType = unitType(); + //qDebug() << " --- formatText: " << XQItem::fetchUnitTypeToString( uType); const QString& cont = item.content(); if( uType != XQItem::NoUnitType ) return formatToSI( cont, uType ); @@ -244,10 +247,11 @@ QString XQItemType::makeItemTypeKey() key = key.arg( renderStyleToString() ); key = key.arg( editorTypeToString() ); key = key.arg( unitTypeToString() ); - key = key.arg( contentFormat() ); - + key = key.arg( contentFormat() ); key = key.arg( data(XQItem::FlagsRole).toString() ); - key = key.arg( icon().name() ); + // icons haben leider keine namen, es sei denn, sie kommen aus einen theme + //key = key.arg( icon().name() ); + key = key.arg( icon().cacheKey() ); key = key.arg( fixedChoicesToString() ); return key; diff --git a/src/items/xqitemtype.h b/src/items/xqitemtype.h index af4559a..d9bf4a5 100644 --- a/src/items/xqitemtype.h +++ b/src/items/xqitemtype.h @@ -40,12 +40,12 @@ public: QVariant data( int role ) const override; void setData(const QVariant& value, int role ) override; - virtual QVariant formatText( const XQItem& item ) const; + QVariant formatText( const XQItem& item ) const; QString formatToSI(const QString& rawText, XQItem::UnitType unitType ) const; QString unFormatFromSI(const QString& valueText ) const; - int hasAttribute( const QString& attrKey ); + int roleForAttributeKey( const QString& attrKey ); XQItemType* replaceAttribute(const QVariant& newValue, int role ); QString makeItemTypeKey(); diff --git a/src/main.cpp b/src/main.cpp index 819e40c..0da358a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,6 +14,7 @@ #include #include +#include #include @@ -48,12 +49,13 @@ who is who: */ - int main(int argc, char *argv[]) { QApplication app(argc, argv); + QIcon icon; + //app.setStyle("fusion"); XQMainWindow window; window.show(); diff --git a/src/model/xqmodelsectionlist.cpp b/src/model/xqmodelsectionlist.cpp index b2c20cd..49f5a06 100644 --- a/src/model/xqmodelsectionlist.cpp +++ b/src/model/xqmodelsectionlist.cpp @@ -38,7 +38,6 @@ bool XQModelSection::operator==(const XQModelSection& other) const bool XQModelSection::isValid() const { - qDebug() << " mi: " << modelIndex.isValid() << " sheetNode: " << (bool)(sheetRootNode); return modelIndex.isValid() && sheetRootNode; } @@ -62,7 +61,6 @@ XQItem& XQModelSection::XQModelSection::headerItem() const bool XQModelSectionList::hasValidSection(const QString& sectionKey) const { - qDebug() << " ---- FIND section: " << sectionKey << ":" << contains(sectionKey) << ":" << at(sectionKey).isValid(); if (!contains(sectionKey) ) return false; return at(sectionKey).isValid(); diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 9f41079..39db345 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -107,8 +107,7 @@ void XQViewModel::initModel(const QString& modelName) // #2: (optionalen?) header erzeugen const XQNodePtr header = section->find_child_by_tag_name( "Header"); if( header ) - { - //XQItemList list = _itemFactory.makeHeaderRow( header ); + { XQItemList list = _itemFactory.makeContentRow( header, nullptr ); addSection(list, section ); } @@ -318,7 +317,7 @@ void XQViewModel::cmdCutUndo( XQCommand& command ) const XQNodePtr& savedNode = entry.contentNode; // __fix! should not be _contentRoot! savedNode->add_me_at( entry.nodePos, _contentRoot ); - XQItemList list = _itemFactory.makeContentRow( savedNode, section.sheetRootNode ); + XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, savedNode ); XQItem& firstItem = *((XQItem*)list[0]); qDebug() << " --- Cut Undo: " << firstItem.text() << " " << firstItem.row() << " id#" << entry.contentNode->_id << " count: " << entry.contentNode.use_count(); @@ -353,7 +352,7 @@ void XQViewModel::cmdPaste( XQCommand& command ) XQNodePtr newNode = entry.contentNode->clone(section.contentRootNode ); newNode->clone(section.contentRootNode )->add_me_at( nodePos ); // ... und damit eine frische item-row erzeugen - XQItemList list = _itemFactory.makeContentRow( newNode, section.sheetRootNode ); + XQItemList list = _itemFactory.makeContentRow( section.sheetRootNode, newNode ); insertRow( insRow, list ); // die neue item-row selektieren const QModelIndex& selIdx = list[0]->index(); diff --git a/src/xtree.pro b/src/xtree.pro index 00a8b87..5c8f6bf 100644 --- a/src/xtree.pro +++ b/src/xtree.pro @@ -43,6 +43,7 @@ HEADERS += \ util/xsingleton.h \ util/xtreewalker.h \ widgets/xqcontextmenu.h \ + widgets/xqicon.h \ widgets/xqtreetable.h SOURCES += \ @@ -67,6 +68,7 @@ SOURCES += \ pugixml/pugixml.cpp \ util/xqexception.cpp \ widgets/xqcontextmenu.cpp \ + widgets/xqicon.cpp \ widgets/xqtreetable.cpp diff --git a/xml/modelsheets.xml b/xml/modelsheets.xml index ad50027..7b4d78d 100644 --- a/xml/modelsheets.xml +++ b/xml/modelsheets.xml @@ -9,38 +9,17 @@ - + - + - - - - -
@@ -66,7 +45,6 @@
-
@@ -88,11 +66,11 @@
- - + + - + @@ -101,83 +79,7 @@
-
-
- - - - - - - -
- - - - - - - - - -
-
-
- - - - - - - -
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From eac668d297edc81b18aea509ddfa861390ae98a7 Mon Sep 17 00:00:00 2001 From: "PANIK\\chris" Date: Fri, 15 Aug 2025 20:55:53 +0200 Subject: [PATCH 6/6] removed XQIcon --- deprecated/xqicon.cpp | 29 +++++++++ deprecated/xqicon.h | 35 +++++++++++ src/application/xqappdata.cpp | 112 +++++++--------------------------- src/application/xqappdata.h | 5 +- src/items/xqitemtype.cpp | 13 +++- src/model/xqviewmodel.cpp | 2 + src/xtree.pro | 2 - 7 files changed, 101 insertions(+), 97 deletions(-) create mode 100644 deprecated/xqicon.cpp create mode 100644 deprecated/xqicon.h diff --git a/deprecated/xqicon.cpp b/deprecated/xqicon.cpp new file mode 100644 index 0000000..b489a90 --- /dev/null +++ b/deprecated/xqicon.cpp @@ -0,0 +1,29 @@ +/*************************************************************************** + + source::worx xtree + Copyright © 2024-2025 c.holzheuer + christoph.holzheuer@gmail.com + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#include + +XQIcon::XQIcon() +{} + +XQIcon::XQIcon( const QIcon& icon, const QString& iconKey ) + : QIcon{icon}, _iconKey{iconKey} +{ + +} + +const QString& XQIcon::iconKey() +{ + return _iconKey; +} diff --git a/deprecated/xqicon.h b/deprecated/xqicon.h new file mode 100644 index 0000000..7f4a41c --- /dev/null +++ b/deprecated/xqicon.h @@ -0,0 +1,35 @@ +/*************************************************************************** + + source::worx xtree + Copyright © 2024-2025 c.holzheuer + christoph.holzheuer@gmail.com + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + +***************************************************************************/ + + +#ifndef XQICON_H +#define XQICON_H + +#include + +class XQIcon : public QIcon +{ +public: + + XQIcon(); + XQIcon( const QIcon& icon, const QString& iconKey ); + + const QString& iconKey(); + +protected: + + QString _iconKey; + +}; + +#endif // XQICON_H diff --git a/src/application/xqappdata.cpp b/src/application/xqappdata.cpp index 3aa03fc..df86997 100644 --- a/src/application/xqappdata.cpp +++ b/src/application/xqappdata.cpp @@ -32,11 +32,14 @@ namespace XQAppData - class XQAppIconMap : public QMap + class XQAppIconMap : public QMap { public: - XQAppIconMap() = default; + XQAppIconMap() + { + + } void init() { @@ -80,7 +83,6 @@ namespace XQAppData namedInsert( "icn38Dummy", QStyle::SP_ComputerIcon ); namedInsert( "icn39Dummy", QStyle::SP_FileDialogBack ); namedInsert( "icn40Dummy", QStyle::SP_TitleBarCloseButton ); - namedInsert( "icn41Dummy", QStyle::SP_CustomBase ); namedInsert( "icn42Dummy", QStyle::SP_FileDialogContentsView ); namedInsert( "icn43Dummy", QStyle::SP_TitleBarContextHelpButton ); namedInsert( "DesktopIcon", QStyle::SP_DesktopIcon ); @@ -137,8 +139,13 @@ namespace XQAppData void namedInsert( const QString& key, QStyle::StandardPixmap pixmapID ) { QIcon icon = QApplication::style()->standardIcon( pixmapID ); - insert( key, XQIcon( icon, key ) ); - //_keysToNames.insert() + insert( key, icon ); + _keysToNames.insert( icon.cacheKey(), key ); + } + + QString iconName( const QIcon& icon ) + { + return _keysToNames[icon.cacheKey()]; } protected: @@ -160,100 +167,23 @@ namespace XQAppData static XQAppIconMap s_IconMap; - XQIcon typeIcon(const QString& key ) + QIcon typeIcon(const QString& key ) { if(s_IconMap.isEmpty()) s_IconMap.init(); if( s_IconMap.contains(key) ) return s_IconMap[key]; - static XQIcon s_FallBackIcon( QApplication::style()->standardIcon( QStyle::SP_TrashIcon), "NoIcon" ); - return s_FallBackIcon; + + return QApplication::style()->standardIcon( QStyle::SP_TrashIcon); } + QString iconName( const QIcon& icon ) + { + if(s_IconMap.isEmpty()) + s_IconMap.init(); + return s_IconMap.iconName(icon); + } - /* - { "icnFolder" , QApplication::style()->standardIcon(QStyle::SP_DirIcon) }, - { "icnFolder" , QApplication::style()->standardIcon(QStyle::SP_DirIcon"); - { "icn02Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack"); - { "icn03Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView"); - { "icn04Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView"); - { "icn05Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd"); - { "icn06Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView"); - { "icn07Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView"); - { "icn08Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder"); - { "icn09Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart"); - { "icn10Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent"); - { "icn11Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowBack"); - { "icn12Dummy", QApplication::style()->standardIcon(QStyle::SP_DirIcon"); - { "icn13Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipBackward"); - { "icn14Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowDown"); - { "icn15Dummy", QApplication::style()->standardIcon(QStyle::SP_DirLinkIcon"); - { "icn16Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSkipForward"); - { "icn17Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowForward"); - { "icn18Dummy", QApplication::style()->standardIcon(QStyle::SP_DirOpenIcon"); - { "icn19Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaStop"); - { "icn20Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowLeft"); - { "icn21Dummy", QApplication::style()->standardIcon(QStyle::SP_DockWidgetCloseButton"); - { "icn22Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolume"); - { "icn23Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowRight"); - { "icn24Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveCDIcon"); - { "icn25Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaVolumeMuted"); - { "icn26Dummy", QApplication::style()->standardIcon(QStyle::SP_ArrowUp"); - { "icn27Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveDVDIcon"); - { "icn28Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxCritical"); - { "icn29Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserReload"); - { "icn30Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveFDIcon"); - { "icn31Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation"); - { "icn32Dummy", QApplication::style()->standardIcon(QStyle::SP_BrowserStop"); - { "icn33Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveHDIcon"); - { "icn34Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxQuestion"); - { "icn35Dummy", QApplication::style()->standardIcon(QStyle::SP_CommandLink"); - { "icn36Dummy", QApplication::style()->standardIcon(QStyle::SP_DriveNetIcon"); - { "icn37Dummy", QApplication::style()->standardIcon(QStyle::SP_MessageBoxWarning"); - { "icn38Dummy", QApplication::style()->standardIcon(QStyle::SP_ComputerIcon"); - { "icn39Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogBack"); - { "icn40Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarCloseButton"); - { "icn41Dummy", QApplication::style()->standardIcon(QStyle::SP_CustomBase"); - { "icn42Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogContentsView"); - { "icn43Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarContextHelpButton"); - { "icn44Dummy", QApplication::style()->standardIcon(QStyle::SP_DesktopIcon"); - { "icn45Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView"); - { "icn46Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMaxButton"); - { "icn47Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogApplyButton"); - { "icn48Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogEnd"); - { "icn49Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMenuButton"); - { "icn50Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCancelButton"); - { "icn51Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogInfoView"); - { "icn52Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarMinButton"); - { "icn53Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogCloseButton"); - { "icn54Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogListView"); - { "icn55Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarNormalButton"); - { "icn56Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogDiscardButton"); - { "icn57Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogNewFolder"); - { "icn58Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarShadeButton"); - { "icn59Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogHelpButton"); - { "icn60Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogStart"); - { "icn61Dummy", QApplication::style()->standardIcon(QStyle::SP_TitleBarUnshadeButton"); - { "icn62Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogNoButton"); - { "icn63Dummy", QApplication::style()->standardIcon(QStyle::SP_FileDialogToParent"); - { "icn64Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarHorizontalExtensionButton"); - { "icn65Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogOkButton"); - { "icn66Dummy", QApplication::style()->standardIcon(QStyle::SP_FileIcon"); - { "icn67Dummy", QApplication::style()->standardIcon(QStyle::SP_ToolBarVerticalExtensionButton"); - { "icn68Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogResetButton"); - { "icn70Dummy", QApplication::style()->standardIcon(QStyle::SP_FileLinkIcon"); - { "icn71Dummy", QApplication::style()->standardIcon(QStyle::SP_TrashIcon"); - { "icn72Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogSaveButton"); - { "icn73Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPause"); - { "icn74Dummy", QApplication::style()->standardIcon(QStyle::SP_VistaShield"); - { "icn75Dummy", QApplication::style()->standardIcon(QStyle::SP_DialogYesButton"); - { "icn76Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaPlay"); - { "icn77Dummy", QApplication::style()->standardIcon(QStyle::SP_DirClosedIcon"); - { "icn79Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekBackward"); - { "icn80Dummy", QApplication::style()->standardIcon(QStyle::SP_DirHomeIcon"); - { "icn81Dummy", QApplication::style()->standardIcon(QStyle::SP_MediaSeekForward)} - } - */ }; // namespace XQAppData diff --git a/src/application/xqappdata.h b/src/application/xqappdata.h index 4ccddaf..b84be83 100644 --- a/src/application/xqappdata.h +++ b/src/application/xqappdata.h @@ -19,8 +19,8 @@ #include #include #include +#include -#include #include const QString c_Version = "0.1.1 04.09.2024"; @@ -49,7 +49,8 @@ namespace XQAppData { //class XQAppIconMap; - XQIcon typeIcon(const QString& key ); + QIcon typeIcon(const QString& key ); + QString iconName( const QIcon& icon ); } #endif // XQAPPDATA_H diff --git a/src/items/xqitemtype.cpp b/src/items/xqitemtype.cpp index 2831dcb..189e0d1 100644 --- a/src/items/xqitemtype.cpp +++ b/src/items/xqitemtype.cpp @@ -90,7 +90,15 @@ int XQItemType::roleForAttributeKey( const QString& attrKey ) XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role ) { - qDebug() << " --- Before: " << makeItemTypeKey() << " role:" << XQItem::fetchItemDataRoleName(role) << " value:" << newValue.toString(); + QString msg = newValue.toString(); + if( role == XQItem::IconRole ) + { + QIcon icn = newValue.value(); + msg = XQAppData::iconName( icn ); + } + + qDebug() << " --- Before: " << makeItemTypeKey() << " role:" << XQItem::fetchItemDataRoleName(role) << " value:" << msg; + // hat sich überhaupt was geändert? QVariant oldValue = data(role); @@ -251,7 +259,8 @@ QString XQItemType::makeItemTypeKey() key = key.arg( data(XQItem::FlagsRole).toString() ); // icons haben leider keine namen, es sei denn, sie kommen aus einen theme //key = key.arg( icon().name() ); - key = key.arg( icon().cacheKey() ); + //key = key.arg( icon().cacheKey() ); + key = key.arg( XQAppData::iconName( icon() ) ); key = key.arg( fixedChoicesToString() ); return key; diff --git a/src/model/xqviewmodel.cpp b/src/model/xqviewmodel.cpp index 39db345..2350b37 100644 --- a/src/model/xqviewmodel.cpp +++ b/src/model/xqviewmodel.cpp @@ -197,6 +197,8 @@ void XQViewModel::onActionTriggered(QAction* action) void XQViewModel::onCommandRedo( XQCommand& command ) { + QMap> s_RedoMap; + try { diff --git a/src/xtree.pro b/src/xtree.pro index 5c8f6bf..00a8b87 100644 --- a/src/xtree.pro +++ b/src/xtree.pro @@ -43,7 +43,6 @@ HEADERS += \ util/xsingleton.h \ util/xtreewalker.h \ widgets/xqcontextmenu.h \ - widgets/xqicon.h \ widgets/xqtreetable.h SOURCES += \ @@ -68,7 +67,6 @@ SOURCES += \ pugixml/pugixml.cpp \ util/xqexception.cpp \ widgets/xqcontextmenu.cpp \ - widgets/xqicon.cpp \ widgets/xqtreetable.cpp