Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.1
-
None
-
Ubuntu 9.10
-
183abff6ffcb020b8f0c4041cc82bba0d3b03863
Description
In QGraphicsGridLayout, column spacing affects layout size even if the items are removed and columnCount returns zero. Internally the column count (QGridLayoutEngine::columnCount()) is still the same as before removing.
Attached test case (modified tst_qgraphicsgridlayout):
void SpacingTest::columnSpacing() { QGraphicsScene scene; QGraphicsView view(&scene); QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window); QGraphicsGridLayout *layout = new QGraphicsGridLayout(); scene.addItem(widget); widget->setLayout(layout); populateLayout(layout, 2, 1); layout->setContentsMargins(0, 0, 0, 0); layout->setColumnSpacing(0, 20); view.show(); widget->show(); layout->removeAt(1); layout->removeAt(0); widget->resize(widget->effectiveSizeHint(Qt::MinimumSize)); QApplication::processEvents(); QCOMPARE(layout->preferredSize(), QSizeF(0, 0)); // is (20,0) delete widget; }