0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-23 16:22:58 +03:00

Script editor modified

This commit is contained in:
Arin Alex 2018-03-23 00:03:43 +03:00
parent fbbf6af33d
commit dcae0255ae
5 changed files with 30 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 509 B

View File

@ -179,5 +179,7 @@
<file alias="/images/deleteDialog">images/deleteDialog.png</file>
<file alias="/images/copy">images/copy3.png</file>
<file alias="/images/paste">images/paste2.png</file>
<file alias="/images/property">images/property.png</file>
<file alias="/images/signal">images/signal.png</file>
</qresource>
</RCC>

View File

@ -219,8 +219,6 @@ void ScriptEditor::slotOnCurrentChanged(const QModelIndex &to, const QModelIndex
}
}
QString ReportStructureCompleater::pathFromIndex(const QModelIndex &index) const
{
QStringList dataList;
@ -284,15 +282,24 @@ void ReportStructureCompleater::updateCompleaterModel(ReportEnginePrivateInterfa
itemNode->setText(page->pageItem()->objectName());
m_model.invisibleRootItem()->appendRow(itemNode);
QStringList slotsNames = extractSlotNames(page->pageItem());
foreach(QString slotName, slotsNames){
QStringList items = extractSlotNames(page->pageItem());
foreach(QString slotName, items){
QStandardItem* slotItem = new QStandardItem;
slotItem->setText(slotName);
slotItem->setIcon(QIcon(":/report/images/signal"));
itemNode->appendRow(slotItem);
}
items = extractPropertyes(page->pageItem());
foreach(QString propertyName, items){
QStandardItem* properyItem = new QStandardItem;
properyItem->setText(propertyName);
properyItem->setIcon(QIcon(":/report/images/property"));
itemNode->appendRow(properyItem);
}
foreach (BaseDesignIntf* item, page->pageItem()->childBaseItems()){
addChildItem(item, itemNode->text(), m_model.invisibleRootItem());
}
}
}
}
@ -325,6 +332,22 @@ QStringList ReportStructureCompleater::extractSlotNames(BaseDesignIntf *item)
return result;
}
QStringList ReportStructureCompleater::extractPropertyes(BaseDesignIntf *item)
{
QStringList result;
if (!item) return result;
QMetaObject const * mo = item->metaObject();
while (mo){
for(int i = mo->propertyOffset(); i < mo->propertyCount(); ++i)
{
result.append(QString::fromLatin1(mo->property(i).name()));
}
mo = mo->superClass();
}
result.sort();
return result;
}
void ReportStructureCompleater::addChildItem(BaseDesignIntf *item, const QString &pageName, QStandardItem *parent)
{
if (!item) return;

View File

@ -34,6 +34,7 @@ public:
void updateCompleaterModel(DataSourceManager* dataManager);
protected:
QStringList extractSlotNames(BaseDesignIntf* item);
QStringList extractPropertyes(BaseDesignIntf* item);
void addChildItem(BaseDesignIntf *item, const QString &pageName, QStandardItem *parent);
void addAdditionalDatawords(DataSourceManager *dataManager);
private: