mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2024-12-23 20:22:58 +03:00
TableBuilder has been fixed
This commit is contained in:
parent
87d0bd5f28
commit
65a3a36770
@ -169,7 +169,7 @@ void HorizontalLayout::updateLayoutSize()
|
||||
void HorizontalLayout::relocateChildren()
|
||||
{
|
||||
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
||||
if (layoutsChildren().count()<childItems().size()-1){
|
||||
if (layoutsChildren().count() < childItems().size()-1){
|
||||
layoutsChildren().clear();
|
||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||
layoutsChildren().append(item);
|
||||
|
@ -1844,12 +1844,19 @@ QObject* DatasourceFunctions::createTableBuilder(BaseDesignIntf* horizontalLayou
|
||||
return new TableBuilder(dynamic_cast<LimeReport::HorizontalLayout*>(horizontalLayout), dynamic_cast<DataSourceManager*>(m_dataManager));
|
||||
}
|
||||
|
||||
TableBuilder::TableBuilder(HorizontalLayout* layout, DataSourceManager* dataManager)
|
||||
: m_horizontalLayout(layout), m_baseLayout(0), m_dataManager(dataManager)
|
||||
{
|
||||
if (m_horizontalLayout)
|
||||
m_patternLayout = dynamic_cast<HorizontalLayout*>(m_horizontalLayout->cloneItem(m_horizontalLayout->itemMode()));
|
||||
}
|
||||
|
||||
QObject* TableBuilder::addRow()
|
||||
{
|
||||
checkBaseLayout();
|
||||
HorizontalLayout* newRow = new HorizontalLayout(m_baseLayout, m_baseLayout);
|
||||
for(int i = 0; i < m_horizontalLayout->childrenCount(); ++i){
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(m_horizontalLayout->at(i));
|
||||
BaseDesignIntf* item = dynamic_cast<BaseDesignIntf*>(m_patternLayout->at(i));
|
||||
BaseDesignIntf* cloneItem = item->cloneItem(item->itemMode(), newRow, newRow);
|
||||
newRow->addChild(cloneItem);
|
||||
}
|
||||
@ -1883,11 +1890,14 @@ void TableBuilder::buildTable(const QString& datasourceName)
|
||||
checkBaseLayout();
|
||||
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::RENDER_MODE);
|
||||
m_dataManager->dataSource(datasourceName)->first();
|
||||
bool firstTime = true;
|
||||
QObject* row = m_horizontalLayout;
|
||||
while(!m_dataManager->dataSource(datasourceName)->eof()){
|
||||
fillInRowData(addRow());
|
||||
if (!firstTime) row = addRow();
|
||||
else firstTime = false;
|
||||
fillInRowData(row);
|
||||
m_dataManager->dataSource(datasourceName)->next();
|
||||
}
|
||||
m_horizontalLayout->setHeight(0);
|
||||
}
|
||||
|
||||
void TableBuilder::checkBaseLayout()
|
||||
|
@ -307,9 +307,8 @@ private:
|
||||
class TableBuilder: public QObject{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TableBuilder(LimeReport::HorizontalLayout* layout, DataSourceManager* dataManager)
|
||||
: m_horizontalLayout(layout), m_baseLayout(0), m_dataManager(dataManager){}
|
||||
~TableBuilder(){}
|
||||
TableBuilder(LimeReport::HorizontalLayout* layout, DataSourceManager* dataManager);
|
||||
~TableBuilder(){delete m_patternLayout;}
|
||||
Q_INVOKABLE QObject* addRow();
|
||||
Q_INVOKABLE QObject* currentRow();
|
||||
Q_INVOKABLE void fillInRowData(QObject* row);
|
||||
@ -318,6 +317,7 @@ private:
|
||||
void checkBaseLayout();
|
||||
private:
|
||||
LimeReport::HorizontalLayout* m_horizontalLayout;
|
||||
LimeReport::HorizontalLayout* m_patternLayout;
|
||||
LimeReport::VerticalLayout* m_baseLayout;
|
||||
DataSourceManager* m_dataManager;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user