diff --git a/limereport/scripteditor/lrscripteditor.cpp b/limereport/scripteditor/lrscripteditor.cpp index d78a361..f40068a 100644 --- a/limereport/scripteditor/lrscripteditor.cpp +++ b/limereport/scripteditor/lrscripteditor.cpp @@ -272,7 +272,8 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa { if (report){ m_model.clear(); - + QIcon signalIcon(":/report/images/signal"); + QIcon propertyIcon(":/report/images/property"); addAdditionalDatawords(report->dataManager()); for ( int i = 0; i < report->pageCount(); ++i){ @@ -283,18 +284,18 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa itemNode->setIcon(QIcon(":/report/images/object")); m_model.invisibleRootItem()->appendRow(itemNode); - QStringList items = extractSlotNames(page->pageItem()); + QStringList items = extractSignalNames(page->pageItem()); foreach(QString slotName, items){ QStandardItem* slotItem = new QStandardItem; slotItem->setText(slotName); - slotItem->setIcon(QIcon(":/report/images/signal")); + slotItem->setIcon(signalIcon); itemNode->appendRow(slotItem); } - items = extractPropertyes(page->pageItem()); + items = extractProperties(page->pageItem()); foreach(QString propertyName, items){ QStandardItem* properyItem = new QStandardItem; properyItem->setText(propertyName); - properyItem->setIcon(QIcon(":/report/images/property")); + properyItem->setIcon(propertyIcon); itemNode->appendRow(properyItem); } foreach (BaseDesignIntf* item, page->pageItem()->childBaseItems()){ @@ -311,7 +312,7 @@ void ReportStructureCompleater::updateCompleaterModel(DataSourceManager *dataMan addAdditionalDatawords(dataManager); } -QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item) +QStringList ReportStructureCompleater::extractSignalNames(BaseDesignIntf *item) { QStringList result; if (!item) return result; @@ -333,7 +334,7 @@ QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item) return result; } -QStringList ReportStructureCompleater::extractPropertyes(BaseDesignIntf *item) +QStringList ReportStructureCompleater::extractProperties(BaseDesignIntf *item) { QStringList result; if (!item) return result; @@ -353,24 +354,43 @@ void ReportStructureCompleater::addChildItem(BaseDesignIntf *item, const QString { if (!item) return; + QIcon signalIcon(":/report/images/signal"); + QIcon propertyIcon(":/report/images/property"); + QStandardItem* itemNode = new QStandardItem; itemNode->setText(pageName+"_"+item->objectName()); itemNode->setIcon(QIcon(":/report/images/object")); parent->appendRow(itemNode); - QStringList items = extractSlotNames(item); + QStringList items; + + if (!m_signals.contains(item->metaObject()->className())){ + items = extractSignalNames(item); + m_signals.insert(item->metaObject()->className(),items); + } else { + items = m_signals.value(item->metaObject()->className()); + } + foreach(QString slotName, items){ QStandardItem* slotItem = new QStandardItem; slotItem->setText(slotName); - slotItem->setIcon(QIcon(":/report/images/signal")); + slotItem->setIcon(signalIcon); itemNode->appendRow(slotItem); } - items = extractPropertyes(item); + + if (!m_properties.contains(item->metaObject()->className())){ + items = extractProperties(item); + m_properties.insert(item->metaObject()->className(),items); + } else { + items = m_properties.value(item->metaObject()->className()); + } + foreach(QString propertyName, items){ QStandardItem* properyItem = new QStandardItem; properyItem->setText(propertyName); - properyItem->setIcon(QIcon(":/report/images/property")); + properyItem->setIcon(propertyIcon); itemNode->appendRow(properyItem); } + foreach (BaseDesignIntf* child, item->childBaseItems()){ addChildItem(child, pageName, parent); } diff --git a/limereport/scripteditor/lrscripteditor.h b/limereport/scripteditor/lrscripteditor.h index 31d16fd..e9e0aa6 100644 --- a/limereport/scripteditor/lrscripteditor.h +++ b/limereport/scripteditor/lrscripteditor.h @@ -33,12 +33,14 @@ public: void updateCompleaterModel(ReportEnginePrivateInterface* report); void updateCompleaterModel(DataSourceManager* dataManager); protected: - QStringList extractSlotNames(BaseDesignIntf* item); - QStringList extractPropertyes(BaseDesignIntf* item); + QStringList extractSignalNames(BaseDesignIntf* item); + QStringList extractProperties(BaseDesignIntf* item); void addChildItem(BaseDesignIntf *item, const QString &pageName, QStandardItem *parent); void addAdditionalDatawords(DataSourceManager *dataManager); private: QStandardItemModel m_model; + QMap m_properties; + QMap m_signals; }; class ScriptEditor : public QWidget