Results 1 to 3 of 3

Thread: Adding/removing widgets dynamically...

  1. #1
    Join Date
    Feb 2006
    Location
    Enschede, NL, EU
    Posts
    19
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Adding/removing widgets dynamically...

    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:
    Qt Code:
    1. QPtrList<BackgroundWidget> *backgrounds;
    2. QVBoxLayout *backgroundsLayout;
    To copy to clipboard, switch view to plain text mode 

    This is supposed to add stuff:
    Qt Code:
    1. void KreatorMain::addBackground() {
    2. int value=backgroundValue->value();
    3. QString name=backgroundName->currentText();
    4. BackgroundWidget *bg=
    5. new BackgroundWidget( name, value,
    6. generalBackgroundsTab, "", 0);
    7. backgrounds->append(bg);
    8. connect(bg,SIGNAL(removeBackground()),this,SLOT(removeBackground()));
    9. backgroundsLayout->addWidget(bg);
    10.  
    11. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Adding/removing widgets dynamically...

    Try calling the show() method.

  3. #3
    Join Date
    Feb 2006
    Location
    Enschede, NL, EU
    Posts
    19
    Thanks
    1
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Adding/removing widgets dynamically...

    Alright, that works

    Now I need to see if I can remove them again

Similar Threads

  1. Mac OS X Top-Level Transparent Widgets
    By tinsuke in forum Qt Programming
    Replies: 0
    Last Post: 17th October 2008, 16:01
  2. Upper limit on number of widgets?
    By jdiewald in forum Qt Programming
    Replies: 1
    Last Post: 29th September 2008, 23:00
  3. Replies: 2
    Last Post: 16th May 2008, 14:39
  4. Replies: 11
    Last Post: 7th July 2006, 13:09
  5. Replies: 2
    Last Post: 22nd February 2006, 14:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.