Results 1 to 5 of 5

Thread: Repainting/Refreshing Layout after one QWidget * has changed

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    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: Repainting/Refreshing Layout after one QWidget * has changed

    You only change the body variable. Qt still has a pointer to the old widget. See QStackedWidget and QStackedLayout. Also don't forget to show the new widget.

  2. #2
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    80
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Repainting/Refreshing Layout after one QWidget * has changed

    Is there a way to tell QT to use the pointer on the new widget instead of the pointer of the old one ?

    Alternatively is it possible to delete the entire layout and create a new one ?

  3. #3
    Join Date
    Jan 2008
    Location
    Germany
    Posts
    80
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Repainting/Refreshing Layout after one QWidget * has changed

    This seems to work:

    Qt Code:
    1. void
    2. DriverView::refreshDriverView() {
    3. body->hide();
    4. mainLayout->removeWidget(body);
    5. body = driverFactory()->driverUserInterface(driverFactory()->currentDriver());
    6. mainLayout->addWidget(body);
    7. body->show();
    8. }
    To copy to clipboard, switch view to plain text mode 

    Is there anything that speeks against this ?

  4. #4
    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: Repainting/Refreshing Layout after one QWidget * has changed

    Quote Originally Posted by schall_l View Post
    Is there anything that speeks against this ?
    Where do you get rid of unused widgets?

Similar Threads

  1. changing layout of a widget
    By mikro in forum Qt Programming
    Replies: 10
    Last Post: 4th August 2009, 20:21
  2. Dynamic updates of a QWidget in a QScrollArea
    By plamkata in forum Qt Programming
    Replies: 2
    Last Post: 20th July 2008, 23:45
  3. Qt layout memory issue
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 25th August 2007, 17:11
  4. "dynamic" layout
    By hulk in forum Qt Programming
    Replies: 2
    Last Post: 9th May 2006, 07:16
  5. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 19:57

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
  •  
Qt is a trademark of The Qt Company.