PDA

View Full Version : QGridLayout update



sophister
2nd May 2009, 09:19
Hi to all:

I use a QGridLayout in my QMainWindow, and have added some QToolButtons into it. But when I delete some QToolButtons in another dialog, the QGridLayout don't update itself. What's worse, even if I call the QGridLayout::update(), it still show part of the QToolButtons that have been deleted!!
why??

olidem
2nd May 2009, 15:08
Without seeing any code, i would suspect that you only think that you have deleted these buttons. Are you really sure that they have been deleted?

sophister
2nd May 2009, 16:35
Yeah, I'm sure I have deleted the chosen QToolButton, using the following codes:

ui->gridLayout->removeWidget(iter.value());
the
iter.value() returns the a pointer to the QToolButton in the GRridLayout to be deleted.

Lykurg
2nd May 2009, 17:24
What's the "iter.value()" parent? What's happen if you additionaly call
delete iter.value();

sophister
2nd May 2009, 17:35
Actually, I keep some QToolButtons in an QMap<QString, QToolButton *>, and I through the Iterator to delete the chosen QToolButton, and delete it in the QGridLayout at the same time.
But, failed