forked from qt-creator/qt-creator
Timeline: Clear excess row heights when reducing the number of rows
Otherwise, if you increase the number of rows again later you get surprising results. Change-Id: I3ec809820716368849415f9dcdb1ec9208844353 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
@@ -136,6 +136,8 @@ void TimelineModel::setExpandedRowCount(int rows)
|
|||||||
{
|
{
|
||||||
Q_D(TimelineModel);
|
Q_D(TimelineModel);
|
||||||
if (d->expandedRowCount != rows) {
|
if (d->expandedRowCount != rows) {
|
||||||
|
if (d->rowOffsets.length() > rows)
|
||||||
|
d->rowOffsets.resize(rows);
|
||||||
d->expandedRowCount = rows;
|
d->expandedRowCount = rows;
|
||||||
emit expandedRowCountChanged();
|
emit expandedRowCountChanged();
|
||||||
if (d->expanded)
|
if (d->expanded)
|
||||||
|
@@ -232,8 +232,12 @@ void tst_TimelineModel::height()
|
|||||||
QCOMPARE(dummy.height(), 2 * DefaultRowHeight);
|
QCOMPARE(dummy.height(), 2 * DefaultRowHeight);
|
||||||
dummy.setExpanded(true);
|
dummy.setExpanded(true);
|
||||||
QCOMPARE(dummy.height(), 3 * DefaultRowHeight);
|
QCOMPARE(dummy.height(), 3 * DefaultRowHeight);
|
||||||
dummy.setExpandedRowHeight(0, 80);
|
dummy.setExpandedRowHeight(1, 80);
|
||||||
QCOMPARE(dummy.height(), 2 * DefaultRowHeight + 80);
|
QCOMPARE(dummy.height(), 2 * DefaultRowHeight + 80);
|
||||||
|
dummy.clear();
|
||||||
|
dummy.loadData();
|
||||||
|
dummy.setExpanded(true);
|
||||||
|
QCOMPARE(dummy.rowHeight(1), DefaultRowHeight); // Make sure the row height gets reset.
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_TimelineModel::count()
|
void tst_TimelineModel::count()
|
||||||
|
Reference in New Issue
Block a user