0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Page loading has been fixed

This commit is contained in:
Arin Alexander 2016-03-16 00:38:50 +03:00
parent ad138f7257
commit 5597089985
2 changed files with 34 additions and 9 deletions

View File

@ -369,52 +369,70 @@ BandDesignIntf *PageItemDesignIntf::dataBandAt(int index)
void PageItemDesignIntf::setTopMargin(int value) void PageItemDesignIntf::setTopMargin(int value)
{ {
if (m_topMargin!=value){ if (m_topMargin!=value){
m_sizeChainging = true;
int oldValue = m_topMargin; int oldValue = m_topMargin;
m_topMargin=value; m_topMargin=value;
if (!isLoading()){
updateMarginRect(); updateMarginRect();
notify("topMargin",oldValue,value); notify("topMargin",oldValue,value);;
}
m_sizeChainging = false;
} }
} }
void PageItemDesignIntf::setBottomMargin(int value) void PageItemDesignIntf::setBottomMargin(int value)
{ {
if (m_bottomMargin!=value){ if (m_bottomMargin!=value){
m_sizeChainging = true;
int oldValue = m_bottomMargin; int oldValue = m_bottomMargin;
m_bottomMargin=value; m_bottomMargin=value;
if (!isLoading()){
updateMarginRect(); updateMarginRect();
notify("bottomMargin",oldValue,value); notify("bottomMargin",oldValue,value);
} }
m_sizeChainging = false;
}
} }
void PageItemDesignIntf::setLeftMargin(int value) void PageItemDesignIntf::setLeftMargin(int value)
{ {
if (m_leftMargin!=value){ if (m_leftMargin!=value){
m_sizeChainging = true;
int oldValue = m_leftMargin; int oldValue = m_leftMargin;
m_leftMargin=value; m_leftMargin=value;
if (!isLoading()){
updateMarginRect(); updateMarginRect();
notify("leftMargin",oldValue,value); notify("leftMargin",oldValue,value);
} }
m_sizeChainging = false;
}
} }
void PageItemDesignIntf::setRightMargin(int value) void PageItemDesignIntf::setRightMargin(int value)
{ {
if (m_rightMargin!=value){ if (m_rightMargin!=value){
m_sizeChainging = true;
int oldValue = m_rightMargin; int oldValue = m_rightMargin;
m_rightMargin=value; m_rightMargin=value;
if (!isLoading()){
updateMarginRect(); updateMarginRect();
notify("rightMargin",oldValue,value); notify("rightMargin",oldValue,value);
} }
m_sizeChainging = false;
}
} }
void PageItemDesignIntf::setPageOrientation(PageItemDesignIntf::Orientation value) void PageItemDesignIntf::setPageOrientation(PageItemDesignIntf::Orientation value)
{ {
if (!m_sizeChainging && m_pageOrientaion!=value){ if (!m_sizeChainging && m_pageOrientaion!=value){
m_sizeChainging = true; m_sizeChainging = true;
PageItemDesignIntf::Orientation oldValue = m_pageOrientaion;
m_pageOrientaion = value; m_pageOrientaion = value;
if (!isLoading()){ if (!isLoading()){
qreal tmpWidth = width(); qreal tmpWidth = width();
setWidth(height()); setWidth(height());
setHeight(tmpWidth); setHeight(tmpWidth);
notify("pageOrientation",oldValue,value);
} }
m_sizeChainging = false; m_sizeChainging = false;
} }
@ -497,7 +515,7 @@ void PageItemDesignIntf::updateMarginRect()
m_pageRect.adjust(m_leftMargin*mmFactor(),m_topMargin*mmFactor(), m_pageRect.adjust(m_leftMargin*mmFactor(),m_topMargin*mmFactor(),
-m_rightMargin*mmFactor(),-m_bottomMargin*mmFactor()); -m_rightMargin*mmFactor(),-m_bottomMargin*mmFactor());
foreach(BandDesignIntf* band,m_bands){ foreach(BandDesignIntf* band,m_bands){
band->setWidth(pageRect().width()); band->setWidth(pageRect().width()/band->columnsCount());
relocateBands(); relocateBands();
} }
foreach (BaseDesignIntf* item, childBaseItems()) { foreach (BaseDesignIntf* item, childBaseItems()) {
@ -551,6 +569,12 @@ int PageItemDesignIntf::gridStep()
else return 2; else return 2;
} }
void PageItemDesignIntf::objectLoadFinished()
{
BaseDesignIntf::objectLoadFinished();
updateMarginRect();
}
PageItemDesignIntf::Ptr PageItemDesignIntf::create(QObject *owner) PageItemDesignIntf::Ptr PageItemDesignIntf::create(QObject *owner)
{ {
return PageItemDesignIntf::Ptr(new PageItemDesignIntf(owner)); return PageItemDesignIntf::Ptr(new PageItemDesignIntf(owner));

View File

@ -103,6 +103,7 @@ public:
QList<BandDesignIntf *>& bands(); QList<BandDesignIntf *>& bands();
void setGridStep(int value); void setGridStep(int value);
int gridStep(); int gridStep();
void objectLoadFinished();
protected slots: protected slots:
void bandDeleted(QObject* band); void bandDeleted(QObject* band);
void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry); void bandGeometryChanged(QObject* /*object*/, QRectF newGeometry, QRectF oldGeometry);