Layout spacing has been fixed

This commit is contained in:
Arin Alexander 2019-02-06 18:41:56 +03:00
parent 505f1398e3
commit 35cd54919a
3 changed files with 7 additions and 7 deletions

View File

@ -34,7 +34,7 @@ public:
int childrenCount(); int childrenCount();
int layoutSpacing() const; int layoutSpacing() const;
void setLayoutSpacing(int layoutSpacing); void setLayoutSpacing(int layoutSpacing);
qreal layoutSpacingMM(){ return m_layoutSpacing * mmFactor();}
protected: protected:
void beforeDelete(); void beforeDelete();
void childAddedEvent(BaseDesignIntf *child); void childAddedEvent(BaseDesignIntf *child);

View File

@ -159,7 +159,7 @@ void HorizontalLayout::updateLayoutSize()
} }
if (h>0) setHeight(h+spaceBorder*2); if (h>0) setHeight(h+spaceBorder*2);
if (layoutType() == Layout) if (layoutType() == Layout)
setWidth(w + layoutSpacing() * (visibleItemCount-1)); setWidth(w + layoutSpacingMM() * (visibleItemCount-1));
else{ else{
relocateChildren(); relocateChildren();
if (!isRelocating()){ if (!isRelocating()){
@ -183,7 +183,7 @@ void HorizontalLayout::relocateChildren()
foreach (BaseDesignIntf* item, layoutsChildren()) { foreach (BaseDesignIntf* item, layoutsChildren()) {
if (item->isVisible() || itemMode() == DesignMode){ if (item->isVisible() || itemMode() == DesignMode){
item->setPos(curX,spaceBorder); item->setPos(curX,spaceBorder);
curX += item->width() + layoutSpacing(); curX += item->width() + layoutSpacingMM();
item->setHeight(height()-(spaceBorder * 2)); item->setHeight(height()-(spaceBorder * 2));
} }
} }
@ -203,7 +203,7 @@ void HorizontalLayout::divideSpace(){
} }
} }
itemsSumSize += layoutSpacing() * (visibleItemsCount-1); itemsSumSize += layoutSpacingMM() * (visibleItemsCount-1);
if (itemMode() == DesignMode && !layoutsChildren().isEmpty()){ if (itemMode() == DesignMode && !layoutsChildren().isEmpty()){
qreal delta = (width() - (itemsSumSize+spaceBorder*2)); qreal delta = (width() - (itemsSumSize+spaceBorder*2));

View File

@ -51,7 +51,7 @@ void VerticalLayout::updateLayoutSize()
} }
} }
if (w>0) setWidth(w+spaceBorder*2); if (w>0) setWidth(w+spaceBorder*2);
setHeight(h + layoutSpacing() *(visibleItemCount-1)); setHeight(h + layoutSpacingMM() *(visibleItemCount-1));
} }
void VerticalLayout::relocateChildren() void VerticalLayout::relocateChildren()
@ -69,7 +69,7 @@ void VerticalLayout::relocateChildren()
foreach (BaseDesignIntf* item, layoutsChildren()) { foreach (BaseDesignIntf* item, layoutsChildren()) {
if (item->isVisible() || itemMode() == DesignMode){ if (item->isVisible() || itemMode() == DesignMode){
item->setPos(spaceBorder, curY); item->setPos(spaceBorder, curY);
curY+=item->height() + layoutSpacing(); curY+=item->height() + layoutSpacingMM();
item->setWidth(width() - (spaceBorder * 2)); item->setWidth(width() - (spaceBorder * 2));
} }
} }
@ -163,7 +163,7 @@ void VerticalLayout::divideSpace()
} }
} }
itemsSumSize += layoutSpacing() * (visibleItemsCount - 1); itemsSumSize += layoutSpacingMM() * (visibleItemsCount - 1);
qreal delta = (height() - (itemsSumSize+spaceBorder*2)) / (visibleItemsCount!=0 ? visibleItemsCount : 1); qreal delta = (height() - (itemsSumSize+spaceBorder*2)) / (visibleItemsCount!=0 ? visibleItemsCount : 1);
for (int i=0; i<layoutsChildren().size(); ++i){ for (int i=0; i<layoutsChildren().size(); ++i){