mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 17:14:40 +03:00
Accelerated opening of the file by the designer
This commit is contained in:
parent
537fec13fd
commit
766c5b36d4
@ -272,7 +272,8 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa
|
|||||||
{
|
{
|
||||||
if (report){
|
if (report){
|
||||||
m_model.clear();
|
m_model.clear();
|
||||||
|
QIcon signalIcon(":/report/images/signal");
|
||||||
|
QIcon propertyIcon(":/report/images/property");
|
||||||
addAdditionalDatawords(report->dataManager());
|
addAdditionalDatawords(report->dataManager());
|
||||||
|
|
||||||
for ( int i = 0; i < report->pageCount(); ++i){
|
for ( int i = 0; i < report->pageCount(); ++i){
|
||||||
@ -283,18 +284,18 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa
|
|||||||
itemNode->setIcon(QIcon(":/report/images/object"));
|
itemNode->setIcon(QIcon(":/report/images/object"));
|
||||||
m_model.invisibleRootItem()->appendRow(itemNode);
|
m_model.invisibleRootItem()->appendRow(itemNode);
|
||||||
|
|
||||||
QStringList items = extractSlotNames(page->pageItem());
|
QStringList items = extractSignalNames(page->pageItem());
|
||||||
foreach(QString slotName, items){
|
foreach(QString slotName, items){
|
||||||
QStandardItem* slotItem = new QStandardItem;
|
QStandardItem* slotItem = new QStandardItem;
|
||||||
slotItem->setText(slotName);
|
slotItem->setText(slotName);
|
||||||
slotItem->setIcon(QIcon(":/report/images/signal"));
|
slotItem->setIcon(signalIcon);
|
||||||
itemNode->appendRow(slotItem);
|
itemNode->appendRow(slotItem);
|
||||||
}
|
}
|
||||||
items = extractPropertyes(page->pageItem());
|
items = extractProperties(page->pageItem());
|
||||||
foreach(QString propertyName, items){
|
foreach(QString propertyName, items){
|
||||||
QStandardItem* properyItem = new QStandardItem;
|
QStandardItem* properyItem = new QStandardItem;
|
||||||
properyItem->setText(propertyName);
|
properyItem->setText(propertyName);
|
||||||
properyItem->setIcon(QIcon(":/report/images/property"));
|
properyItem->setIcon(propertyIcon);
|
||||||
itemNode->appendRow(properyItem);
|
itemNode->appendRow(properyItem);
|
||||||
}
|
}
|
||||||
foreach (BaseDesignIntf* item, page->pageItem()->childBaseItems()){
|
foreach (BaseDesignIntf* item, page->pageItem()->childBaseItems()){
|
||||||
@ -311,7 +312,7 @@ void ReportStructureCompleater::updateCompleaterModel(DataSourceManager *dataMan
|
|||||||
addAdditionalDatawords(dataManager);
|
addAdditionalDatawords(dataManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item)
|
QStringList ReportStructureCompleater::extractSignalNames(BaseDesignIntf *item)
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
if (!item) return result;
|
if (!item) return result;
|
||||||
@ -333,7 +334,7 @@ QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList ReportStructureCompleater::extractPropertyes(BaseDesignIntf *item)
|
QStringList ReportStructureCompleater::extractProperties(BaseDesignIntf *item)
|
||||||
{
|
{
|
||||||
QStringList result;
|
QStringList result;
|
||||||
if (!item) return result;
|
if (!item) return result;
|
||||||
@ -353,24 +354,43 @@ void ReportStructureCompleater::addChildItem(BaseDesignIntf *item, const QString
|
|||||||
{
|
{
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
|
QIcon signalIcon(":/report/images/signal");
|
||||||
|
QIcon propertyIcon(":/report/images/property");
|
||||||
|
|
||||||
QStandardItem* itemNode = new QStandardItem;
|
QStandardItem* itemNode = new QStandardItem;
|
||||||
itemNode->setText(pageName+"_"+item->objectName());
|
itemNode->setText(pageName+"_"+item->objectName());
|
||||||
itemNode->setIcon(QIcon(":/report/images/object"));
|
itemNode->setIcon(QIcon(":/report/images/object"));
|
||||||
parent->appendRow(itemNode);
|
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){
|
foreach(QString slotName, items){
|
||||||
QStandardItem* slotItem = new QStandardItem;
|
QStandardItem* slotItem = new QStandardItem;
|
||||||
slotItem->setText(slotName);
|
slotItem->setText(slotName);
|
||||||
slotItem->setIcon(QIcon(":/report/images/signal"));
|
slotItem->setIcon(signalIcon);
|
||||||
itemNode->appendRow(slotItem);
|
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){
|
foreach(QString propertyName, items){
|
||||||
QStandardItem* properyItem = new QStandardItem;
|
QStandardItem* properyItem = new QStandardItem;
|
||||||
properyItem->setText(propertyName);
|
properyItem->setText(propertyName);
|
||||||
properyItem->setIcon(QIcon(":/report/images/property"));
|
properyItem->setIcon(propertyIcon);
|
||||||
itemNode->appendRow(properyItem);
|
itemNode->appendRow(properyItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (BaseDesignIntf* child, item->childBaseItems()){
|
foreach (BaseDesignIntf* child, item->childBaseItems()){
|
||||||
addChildItem(child, pageName, parent);
|
addChildItem(child, pageName, parent);
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,14 @@ public:
|
|||||||
void updateCompleaterModel(ReportEnginePrivateInterface* report);
|
void updateCompleaterModel(ReportEnginePrivateInterface* report);
|
||||||
void updateCompleaterModel(DataSourceManager* dataManager);
|
void updateCompleaterModel(DataSourceManager* dataManager);
|
||||||
protected:
|
protected:
|
||||||
QStringList extractSlotNames(BaseDesignIntf* item);
|
QStringList extractSignalNames(BaseDesignIntf* item);
|
||||||
QStringList extractPropertyes(BaseDesignIntf* item);
|
QStringList extractProperties(BaseDesignIntf* item);
|
||||||
void addChildItem(BaseDesignIntf *item, const QString &pageName, QStandardItem *parent);
|
void addChildItem(BaseDesignIntf *item, const QString &pageName, QStandardItem *parent);
|
||||||
void addAdditionalDatawords(DataSourceManager *dataManager);
|
void addAdditionalDatawords(DataSourceManager *dataManager);
|
||||||
private:
|
private:
|
||||||
QStandardItemModel m_model;
|
QStandardItemModel m_model;
|
||||||
|
QMap<QString, QStringList> m_properties;
|
||||||
|
QMap<QString, QStringList> m_signals;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptEditor : public QWidget
|
class ScriptEditor : public QWidget
|
||||||
|
Loading…
Reference in New Issue
Block a user