PDA

View Full Version : Adding/removing widgets dynamically...



ReilenBlaeyze
16th February 2006, 01:43
I want to dynamically add and remove widgets to a display, but it doesn't seem to work...

the addBackground slot is called on properly but no extra widgets appear, even when I resize it. What can I do to make it work?

I have members:


QPtrList<BackgroundWidget> *backgrounds;
QVBoxLayout *backgroundsLayout;


This is supposed to add stuff:

void KreatorMain::addBackground() {
int value=backgroundValue->value();
QString name=backgroundName->currentText();
BackgroundWidget *bg=
new BackgroundWidget( name, value,
generalBackgroundsTab, "", 0);
backgrounds->append(bg);
connect(bg,SIGNAL(removeBackground()),this,SLOT(re moveBackground()));
backgroundsLayout->addWidget(bg);

}

jacek
16th February 2006, 01:44
Try calling the show() method.

ReilenBlaeyze
16th February 2006, 11:55
Alright, that works :)

Now I need to see if I can remove them again