mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-01-11 20:31:04 +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()
|
void HorizontalLayout::relocateChildren()
|
||||||
{
|
{
|
||||||
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
int spaceBorder = (borderLines() != 0) ? borderLineSize() : 0;
|
||||||
if (layoutsChildren().count()<childItems().size()-1){
|
if (layoutsChildren().count() < childItems().size()-1){
|
||||||
layoutsChildren().clear();
|
layoutsChildren().clear();
|
||||||
foreach (BaseDesignIntf* item, childBaseItems()) {
|
foreach (BaseDesignIntf* item, childBaseItems()) {
|
||||||
layoutsChildren().append(item);
|
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));
|
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()
|
QObject* TableBuilder::addRow()
|
||||||
{
|
{
|
||||||
checkBaseLayout();
|
checkBaseLayout();
|
||||||
HorizontalLayout* newRow = new HorizontalLayout(m_baseLayout, m_baseLayout);
|
HorizontalLayout* newRow = new HorizontalLayout(m_baseLayout, m_baseLayout);
|
||||||
for(int i = 0; i < m_horizontalLayout->childrenCount(); ++i){
|
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);
|
BaseDesignIntf* cloneItem = item->cloneItem(item->itemMode(), newRow, newRow);
|
||||||
newRow->addChild(cloneItem);
|
newRow->addChild(cloneItem);
|
||||||
}
|
}
|
||||||
@ -1883,11 +1890,14 @@ void TableBuilder::buildTable(const QString& datasourceName)
|
|||||||
checkBaseLayout();
|
checkBaseLayout();
|
||||||
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::RENDER_MODE);
|
m_dataManager->dataSourceHolder(datasourceName)->invalidate(IDataSource::RENDER_MODE);
|
||||||
m_dataManager->dataSource(datasourceName)->first();
|
m_dataManager->dataSource(datasourceName)->first();
|
||||||
|
bool firstTime = true;
|
||||||
|
QObject* row = m_horizontalLayout;
|
||||||
while(!m_dataManager->dataSource(datasourceName)->eof()){
|
while(!m_dataManager->dataSource(datasourceName)->eof()){
|
||||||
fillInRowData(addRow());
|
if (!firstTime) row = addRow();
|
||||||
|
else firstTime = false;
|
||||||
|
fillInRowData(row);
|
||||||
m_dataManager->dataSource(datasourceName)->next();
|
m_dataManager->dataSource(datasourceName)->next();
|
||||||
}
|
}
|
||||||
m_horizontalLayout->setHeight(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TableBuilder::checkBaseLayout()
|
void TableBuilder::checkBaseLayout()
|
||||||
|
@ -307,9 +307,8 @@ private:
|
|||||||
class TableBuilder: public QObject{
|
class TableBuilder: public QObject{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
TableBuilder(LimeReport::HorizontalLayout* layout, DataSourceManager* dataManager)
|
TableBuilder(LimeReport::HorizontalLayout* layout, DataSourceManager* dataManager);
|
||||||
: m_horizontalLayout(layout), m_baseLayout(0), m_dataManager(dataManager){}
|
~TableBuilder(){delete m_patternLayout;}
|
||||||
~TableBuilder(){}
|
|
||||||
Q_INVOKABLE QObject* addRow();
|
Q_INVOKABLE QObject* addRow();
|
||||||
Q_INVOKABLE QObject* currentRow();
|
Q_INVOKABLE QObject* currentRow();
|
||||||
Q_INVOKABLE void fillInRowData(QObject* row);
|
Q_INVOKABLE void fillInRowData(QObject* row);
|
||||||
@ -318,6 +317,7 @@ private:
|
|||||||
void checkBaseLayout();
|
void checkBaseLayout();
|
||||||
private:
|
private:
|
||||||
LimeReport::HorizontalLayout* m_horizontalLayout;
|
LimeReport::HorizontalLayout* m_horizontalLayout;
|
||||||
|
LimeReport::HorizontalLayout* m_patternLayout;
|
||||||
LimeReport::VerticalLayout* m_baseLayout;
|
LimeReport::VerticalLayout* m_baseLayout;
|
||||||
DataSourceManager* m_dataManager;
|
DataSourceManager* m_dataManager;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user