From a337ef39a425394e22f120141fc2aba18d84705e Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Thu, 23 Aug 2018 00:53:27 +0300 Subject: [PATCH] Report structure browser has been modified --- limereport/objectsbrowser/lrobjectbrowser.cpp | 23 +++++++++++++++++-- limereport/objectsbrowser/lrobjectbrowser.h | 2 +- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/limereport/objectsbrowser/lrobjectbrowser.cpp b/limereport/objectsbrowser/lrobjectbrowser.cpp index 2b51db5..a7e39ba 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.cpp +++ b/limereport/objectsbrowser/lrobjectbrowser.cpp @@ -90,7 +90,7 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report foreach (BaseDesignIntf* item, reportItem->childBaseItems()) { if (item != ignoredItem){ - ObjectBrowserNode* treeItem = new ObjectBrowserNode(parentNode); + ObjectBrowserNode* treeItem = new ObjectBrowserNode(/*parentNode*/); treeItem->setText(0,item->objectName()); treeItem->setObject(item); treeItem->setIcon(0,QIcon(":/items/"+extractClassName(item->metaObject()->className()))); @@ -102,7 +102,26 @@ void ObjectBrowser::fillNode(QTreeWidgetItem* parentNode, BaseDesignIntf* report this, SLOT(slotItemParentChanged(BaseDesignIntf*,BaseDesignIntf*)), Qt::UniqueConnection); } m_itemsMap.insert(item,treeItem); - parentNode->addChild(treeItem); + + BandDesignIntf* band = dynamic_cast(item); + + QSet subBands; + subBands << BandDesignIntf::SubDetailBand << + BandDesignIntf::SubDetailHeader << + BandDesignIntf::SubDetailFooter; + + if (band && subBands.contains(band->bandType())){ + ObjectBrowserNode* parentBandNode = 0; + if (band->bandType() == BandDesignIntf::SubDetailBand){ + parentBandNode = m_itemsMap.value(band->parentBand()); + } else { + parentBandNode = m_itemsMap.value(band->parentBand()->parentBand()); + } + if(parentBandNode) + parentBandNode->addChild(treeItem); + } else { + parentNode->addChild(treeItem); + } if (!item->childBaseItems().isEmpty()) fillNode(treeItem,item, ignoredItem); } diff --git a/limereport/objectsbrowser/lrobjectbrowser.h b/limereport/objectsbrowser/lrobjectbrowser.h index c82fb27..3616c41 100644 --- a/limereport/objectsbrowser/lrobjectbrowser.h +++ b/limereport/objectsbrowser/lrobjectbrowser.h @@ -42,7 +42,7 @@ public: void setObject(QObject* value); QObject* object() const; explicit ObjectBrowserNode(QTreeWidget *view); - explicit ObjectBrowserNode(QTreeWidgetItem *parent); + explicit ObjectBrowserNode(QTreeWidgetItem *parent = 0); bool operator <(const QTreeWidgetItem& other) const; private: QObject* m_object;