Results 1 to 3 of 3

Thread: refresh form after adding a widget

  1. #1
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default refresh form after adding a widget

    Hello everyone,

    I'm trying to add a QGLWidget inside a QMainWindow, after the first "show()".

    The code looks like that :

    Qt Code:
    1. _window = new QMainWindow;
    2. _ui.setupUi(_window);
    3. createActions();
    4. _window->show();
    To copy to clipboard, switch view to plain text mode 

    and inside a slot (when I push a button) :

    Qt Code:
    1. myGLWidget *glwidget=new myGLWidget(_ui.centralwidget);
    2. glwidget->setGeometry(QRect(20, 200, 660, 680));
    To copy to clipboard, switch view to plain text mode 

    when, I put the myGLWidget before _window->show(), the widget is displayed, but, when inside the slot, it is like nothing appened...

    -> Is there a method (show, refresh, update.. ?) to force my QGLWidget to show itself?

    Cyrille

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: refresh form after adding a widget

    Yes, call show() on the gl widget just like you did for the main window.

  3. The following user says thank you to wysota for this useful post:

    cyrille (2nd February 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Smile Re: refresh form after adding a widget

    Thanks a lot, ... I thought I already tried "show()" and that's why I posted here.
    Well it works anyway, thank you again!

Similar Threads

  1. adding widgets to tabWidgets pages
    By quickNitin in forum Newbie
    Replies: 1
    Last Post: 23rd November 2006, 09:59
  2. Replies: 5
    Last Post: 10th May 2006, 00:20
  3. adding my wdget to Tab
    By therealjag in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2006, 19:28
  4. [Qt 4.1.0] Split a widget on demand
    By Townk in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2006, 14:16
  5. Replies: 4
    Last Post: 6th February 2006, 14:30

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.