PDA

View Full Version : 2x2 Grid Layout with custom widgets and widgets show/hide problem



airproject
30th April 2012, 16:17
Hi guys!
I have faced the following problem while programming in QT 4.7:
I have a main window layed out horisontally, containing kind of a control panel (left) and QGridLayout(right). QGridLayout is 2x2 and contains 4 custom widgets derived from QWidget class. When a particular widget in a grid is doubleclicked it is maximized. I have accomplished it by setting the visibility of the rest of widgets in a grid to false. When such a maximized widget is doubleclicked again, the view should revert to it's normal state (2x2).

And the problem is: when i am setting the wisibility of all 4 widgets within the gridlayout to true, I can see the process of grid resizing (5 steps) instead of seeing the whole grid recalled at once. Such behaviour is non-pleaseant and annoying. Is there a way to block the grid visibility before all elements are recalculated? I have tried several approaches found on the net but none of them worked for me.

Best regards.

//*problem solved
My custom widget used the repaint() method within showEvent(). The repaint() was substituted with update() as the documentation (http://qt-project.org/doc/qt-4.8/qwidget.html#repaint) says and the probelm disappeared. Now all widgets appear at once =). thx dr.greenthumb, you're da s*t:)