PDA

View Full Version : Delete a QGridLayout and New QGridLayout at runtime



sabeesh
5th November 2007, 09:17
Hi,
I have a QGridLayout in my program. In a function I create it like this,
SnapLayout = new QGridLayout(this);
in that function I create some QLabel and add some that to SnapLayout like this,

SnapLayout->addWidget(pixmapLabels[i][j], i + 1, j + 1 )

At run time I call this function, when i click on a button. The brobs is that at first time ( loading time ) no error display and that function is working. But when I try to call this function, a message display like this,
QLayout: Attempting to add QLayout "" to CImageView "", which already has a layout

First time it display all the QLabel and at the second time it display the old QLabels only,
Didn't display the new one.
How can I solve this probs?
Please help me

wysota
5th November 2007, 13:01
Either delete the old layout before applying the new one or reuse the old layout replacing widgets instead of creating the new layout.