Report structure browser has been modified

This commit is contained in:
Arin Alex 2018-08-23 00:53:27 +03:00
parent 3c22c63600
commit a337ef39a4
2 changed files with 22 additions and 3 deletions

View File

@ -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<BandDesignIntf*>(item);
QSet<BandDesignIntf::BandsType> 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);
}

View File

@ -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;