diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-07-29 05:53:05 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-07-29 05:53:05 (GMT) |
commit | 1f277281ea853fb99a4187f30ec1ddaaf8b86ed2 (patch) | |
tree | fb85706fa2d606130c0b0bfe6bf1795ee1aa71bc | |
parent | 9abd22080de9898a5edf0cb4d9973d3ce611af62 (diff) | |
download | Qt-1f277281ea853fb99a4187f30ec1ddaaf8b86ed2.zip Qt-1f277281ea853fb99a4187f30ec1ddaaf8b86ed2.tar.gz Qt-1f277281ea853fb99a4187f30ec1ddaaf8b86ed2.tar.bz2 |
Fix layout sizing
Conflicts:
src/declarative/fx/qfxlayouts.cpp
-rw-r--r-- | src/declarative/fx/qfxlayouts.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp index 0546845..da34b8c 100644 --- a/src/declarative/fx/qfxlayouts.cpp +++ b/src/declarative/fx/qfxlayouts.cpp @@ -354,11 +354,14 @@ void QFxBaseLayout::preLayout() d->_animated.clear(); doLayout(); //Set the layout's size to be the rect containing all children - //Also set the margin + //d->aut determines whether a dimension is sum or max + //Also sets the margin qreal width=0; qreal height=0; + qreal maxWidth=0; + qreal maxHeight=0; foreach(QFxItem *item, d->_items){ - if (item->opacity() == 0.0){ + if (item->opacity() != 0.0){ if (!d->_animated.contains(item)){ setMovingItem(item); QPointF p(item->x(), item->y()); @@ -369,6 +372,8 @@ void QFxBaseLayout::preLayout() item->setPos(p); setMovingItem(0); } + maxWidth = qMax(maxWidth, item->width()); + maxHeight = qMax(maxHeight, item->height()); width = qMax(width, item->x() + item->width()); height = qMax(height, item->y() + item->height()); } @@ -376,14 +381,19 @@ void QFxBaseLayout::preLayout() width += d->_margin; height+= d->_margin; - if (d->aut & Horizontal) - setWidth(int(width)); - else if (parentItem()) - setImplicitWidth(parentItem()->width()); - if (d->aut & Vertical) - setHeight(int(height)); - else if (parentItem()) - setImplicitHeight(parentItem()->height()); + if(d->aut & Both){ + setImplicitHeight(int(height)); + setImplicitWidth(int(width)); + }else if (d->aut & Horizontal){ + setImplicitWidth(int(width)); + setImplicitHeight(int(maxHeight)); + } else if (d->aut & Vertical){ + setImplicitHeight(int(height)); + setImplicitWidth(int(maxWidth)); + }else{ + setImplicitHeight(int(maxHeight)); + setImplicitWidth(int(maxWidth)); + } setLayoutItem(0); } @@ -656,7 +666,6 @@ void QFxVerticalLayout::doLayout() } finishApplyTransitions(); setMovingItem(this); - setHeight(voffset); setMovingItem(0); } @@ -823,7 +832,6 @@ void QFxHorizontalLayout::doLayout() hoffset += spacing(); } finishApplyTransitions(); - setWidth(hoffset); } QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GridLayout,QFxGridLayout) |