Results 1 to 5 of 5

Thread: show() on parent widget doesn't show the child widgets

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2013
    Location
    Everett WA USA
    Posts
    12
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: show() on parent widget doesn't show the child widgets

    Thanks for the response.

    We are not explicitly creating hidden windows. Just normal Widget Creation. Are these widgets hidden if we create using new operator ?

    We have an old application and they window management has been written using list in C++. I am trying to port that application to Qt such that Qt can take over the window management. So, the order in which the windows are managed in old code should be done in Qt as well.

    Is there a way to inform the Qt to process the show() event once after the event loop started.? Or Calling show() does is sufficient?

    Please advice

    Regards
    SRaju

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: show() on parent widget doesn't show the child widgets

    Quote Originally Posted by sraju View Post
    We are not explicitly creating hidden windows. Just normal Widget Creation. Are these widgets hidden if we create using new operator ?
    I meant the main window. Do you call show() somewhere in main() before starting the event loop or are you calling show() after creating the children?

    By default all widgets are not yet visible and need to be shown. Children are shown with their parent unless they have been explicitly hidden.

    So it depends if your main window has already been shown at the time of child creation. If it has, then the children will remain hidden (their parent didn't get shown after their creation).

    Quote Originally Posted by sraju View Post
    We have an old application and they window management has been written using list in C++. I am trying to port that application to Qt such that Qt can take over the window management. So, the order in which the windows are managed in old code should be done in Qt as well.
    Is this an MDI application? Are you using QMdiArea?

    Quote Originally Posted by sraju View Post
    Is there a way to inform the Qt to process the show() event once after the event loop started.? Or Calling show() does is sufficient?
    Calling show() is sufficient, it results in an event being sent to the respective widget, so it needs a running event loop to get processed.

    Cheers,
    _

  3. #3
    Join Date
    Oct 2013
    Location
    Everett WA USA
    Posts
    12
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: show() on parent widget doesn't show the child widgets

    I meant the main window. Do you call show() somewhere in main() before starting the event loop or are you calling show() after creating the children?
    No. I will not be calling the show() I will call the show() on Main Widget After creating the child widgets and it is after the event loop starts.

    By default all widgets are not yet visible and need to be shown. Children are shown with their parent unless they have been explicitly hidden.

    So it depends if your main window has already been shown at the time of child creation. If it has, then the children will remain hidden (their parent didn't get shown after their creation).
    It has answered my query and concludes that each child widgets needs to be shown when they are added after the event loop starts.
    Is this an MDI application? Are you using QMdiArea?
    No, it's not designed using QMdiArea. We are considering each QWidget as a Window and it is serving our purpose.

    Thanks for the support.


    Regards
    SRaju

Similar Threads

  1. Replies: 4
    Last Post: 7th January 2013, 23:43
  2. show widget over other widgets
    By maston in forum Qt Programming
    Replies: 3
    Last Post: 23rd June 2010, 09:31
  3. Custom Widget doesn t show.
    By Frej in forum Qt Tools
    Replies: 12
    Last Post: 11th March 2010, 10:48
  4. QMainWindow and custom widget doesn't show
    By Peppy in forum Qt Programming
    Replies: 9
    Last Post: 26th December 2009, 15:09
  5. Corner widget in QTabWidget doesn't show up
    By ePharaoh in forum Qt Programming
    Replies: 2
    Last Post: 6th April 2006, 17:02

Tags for this Thread

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.