Hi,

I use a QGraphicsGridLayout to lay out some QGraphicsWidget items like this:

Qt Code:
  1. _layout->addItem(_anLegend,0,0);
  2. _layout->addItem(_dateField,1,0);
  3. _layout->addItem(_leftScale,0,1);
  4. _layout->addItem(_anCurCanvas,0,2);
  5. _layout->addItem(_rightScale,0,3);
  6. _layout->addItem(_timeScale,1,2,1,1);
  7. _layout->addItem(_diLegend,2,0,1,2);
  8. _layout->addItem(_diCurCanvas,2,2,1,1);
To copy to clipboard, switch view to plain text mode 

When I comment the last two lines (thus not adding _diLegend and _diCurCanvas), the layout changes accordingly, and my remaining components get the extra space. Great.

However, when I add the items to the layout as shown, but later on hide them thus...

Qt Code:
  1. _diCurCanvas->setVisible(false);
  2. _diLegend->setVisible(false);
  3. _layout->invalidate();
  4. _layout->activate();
To copy to clipboard, switch view to plain text mode 

...the items become invisible, but the layout does not hand out the extra space; I get the blank background at the position the items were.

What am I missing? Do I have to change the size policy of items as they become invisible? I though layouts consider and handle item (in)visibility?