PDA

View Full Version : old layout item remain on widget



lllturtle
25th March 2011, 05:54
hello everyone ,
i've got some problem about change the layout item's.
i'm using : qt 4.7 in winidows xp sp3

i made a simple program , with 2 button's change a mainLayout item
the item compositing by several label , and i put some word in corner ,
after change layout (from 4 label to 2 label) some word still exist on window
and part of button covered by the old label .

i put whole project and picture in attachments , any suggestion would be appreciate

thanks :)
and sorry for my poor english
---------
another problem is after i delete the layout item
i always got the following msg , but everything keep going

QCoreApplication:: postEvent: Unexpected null receiver
QLayout::addChildLayout: layout "" already has a parent

code about delete layout item

QLayoutItem *child;
while ((child = mainLayout->takeAt(0)) != 0) {
child->widget()->deleteLater();
}
delete child;

BalaQT
25th March 2011, 08:45
hi,

after change layout (from 4 label to 2 label) some word still exist on window
and part of button covered by the old label .
I'm not sure what you are asking, but if you have problems in removing the widgets in layout,
try
void QLayout::removeWidget ( QWidget * widget ).
this will remove the added widget.

i put whole project and picture in attachments , any suggestion would be appreciate
The attachment is 3kb so cant read the files.

bala

lllturtle
25th March 2011, 09:05
Hi bala ,
thank's for your reply ,
actually i need to remove layout , because i use two part of layouts(the button layout and label layout) combine to one
and i've already try to remove item
mainLayout->removeItem(child);
but seems the same result .


The attachment is 3kb so cant read the files.
i've test download the file ,and unzip file , use qt open and compile ,
it should be ok! :confused:

BalaQT
25th March 2011, 10:53
hi lllturtle,

i've test download the file ,and unzip file , use qt open and compile ,
it should be ok!
apologies i downloaded in windows. in linux its working fine.:)

can u explain what u want to acheive when u press two button?

bala

lllturtle
28th March 2011, 02:07
hi bala ,

can u explain what u want to acheive when u press two button?
when the "one" button pressed : i put 2 label to print on top left corner and bottom right corner ,add into vertical layout
"two" button pressed : i put 4 label just like one , but the label height shrink , i've past some pic's on first post ,it can distinct clearly
the problem is when i chenge the label , the old label didn't clear somewhere .