Fix Column/Row size when no items being positioned
Change-Id: I0bf55c13e55856dd7292e5eda159086096dea86b Reviewed-on: http://codereview.qt.nokia.com/2158 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
This commit is contained in:
parent
1a1ce3775b
commit
d7630a80bd
|
@ -211,7 +211,7 @@ void QSGBasePositioner::prePositioning()
|
||||||
positionedItems.append(*item);
|
positionedItems.append(*item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QSizeF contentSize;
|
QSizeF contentSize(0,0);
|
||||||
doPositioning(&contentSize);
|
doPositioning(&contentSize);
|
||||||
if(d->addTransition || d->moveTransition)
|
if(d->addTransition || d->moveTransition)
|
||||||
finishApplyTransitions();
|
finishApplyTransitions();
|
||||||
|
@ -288,10 +288,11 @@ void QSGColumn::doPositioning(QSizeF *contentSize)
|
||||||
contentSize->setWidth(qMax(contentSize->width(), child.item->width()));
|
contentSize->setWidth(qMax(contentSize->width(), child.item->width()));
|
||||||
|
|
||||||
voffset += child.item->height();
|
voffset += child.item->height();
|
||||||
voffset += spacing();
|
if (ii != positionedItems.count() - 1)
|
||||||
|
voffset += spacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
contentSize->setHeight(voffset - spacing());
|
contentSize->setHeight(voffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QSGColumn::reportConflictingAnchors()
|
void QSGColumn::reportConflictingAnchors()
|
||||||
|
@ -370,10 +371,11 @@ void QSGRow::doPositioning(QSizeF *contentSize)
|
||||||
contentSize->setHeight(qMax(contentSize->height(), child.item->height()));
|
contentSize->setHeight(qMax(contentSize->height(), child.item->height()));
|
||||||
|
|
||||||
hoffset += child.item->width();
|
hoffset += child.item->width();
|
||||||
hoffset += spacing();
|
if (ii != positionedItems.count() - 1)
|
||||||
|
hoffset += spacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
contentSize->setWidth(hoffset - spacing());
|
contentSize->setWidth(hoffset);
|
||||||
|
|
||||||
if (d->isLeftToRight())
|
if (d->isLeftToRight())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
Item{
|
||||||
|
width: 400
|
||||||
|
height: 400
|
||||||
|
Column{
|
||||||
|
spacing: 20
|
||||||
|
objectName: "column"
|
||||||
|
Item{
|
||||||
|
width: 0
|
||||||
|
height: 20
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
Item{
|
||||||
|
width: 20
|
||||||
|
height: 0
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
Item{
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Row{
|
||||||
|
spacing: 20
|
||||||
|
objectName: "row"
|
||||||
|
Item{
|
||||||
|
width: 0
|
||||||
|
height: 20
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
Item{
|
||||||
|
width: 20
|
||||||
|
height: 0
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
Item{
|
||||||
|
width: 20
|
||||||
|
height: 20
|
||||||
|
visible: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -88,6 +88,7 @@ private slots:
|
||||||
void test_flow_implicit_resize();
|
void test_flow_implicit_resize();
|
||||||
void test_conflictinganchors();
|
void test_conflictinganchors();
|
||||||
void test_mirroring();
|
void test_mirroring();
|
||||||
|
void test_allInvisible();
|
||||||
private:
|
private:
|
||||||
QSGView *createView(const QString &filename);
|
QSGView *createView(const QString &filename);
|
||||||
};
|
};
|
||||||
|
@ -1251,6 +1252,24 @@ void tst_qsgpositioners::test_mirroring()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tst_qsgpositioners::test_allInvisible()
|
||||||
|
{
|
||||||
|
//QTBUG-19361
|
||||||
|
QSGView *canvas = createView(SRCDIR "/data/allInvisible.qml");
|
||||||
|
|
||||||
|
QSGItem *root = qobject_cast<QSGItem*>(canvas->rootObject());
|
||||||
|
QVERIFY(root);
|
||||||
|
|
||||||
|
QSGRow *row = canvas->rootObject()->findChild<QSGRow*>("row");
|
||||||
|
QVERIFY(row != 0);
|
||||||
|
QVERIFY(row->width() == 0);
|
||||||
|
QVERIFY(row->height() == 0);
|
||||||
|
QSGColumn *column = canvas->rootObject()->findChild<QSGColumn*>("column");
|
||||||
|
QVERIFY(column != 0);
|
||||||
|
QVERIFY(column->width() == 0);
|
||||||
|
QVERIFY(column->height() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
QSGView *tst_qsgpositioners::createView(const QString &filename)
|
QSGView *tst_qsgpositioners::createView(const QString &filename)
|
||||||
{
|
{
|
||||||
QSGView *canvas = new QSGView(0);
|
QSGView *canvas = new QSGView(0);
|
||||||
|
|
Loading…
Reference in New Issue