Results 1 to 5 of 5

Thread: Child widget problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    107
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Child widget problem

    I didn't use a stacked widget because of my concerns with resources as several widgets will be connected to databases, so I was going to load and unload each widget as needed. Which way is better?

    I think I am missing something because I tried
    Qt Code:
    1. 1.Page2* page2 = new Page2 (this) ;
    To copy to clipboard, switch view to plain text mode 
    and Page2 still opened as its own window, not a window within mainwindow. What did I miss?
    Thanks for taking your time!
    Rick

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Child widget problem

    As told, you have to put that widget into the layout of your mainwindow. (See layout() to get it, or use setCentralWidget(), but that depends on your needs)

  3. #3
    Join Date
    Aug 2010
    Posts
    107
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    5

    Default Re: Child widget problem

    I am not sure how to add the widget into the layout of my window dynamically. I looked at the QLayout* QWidget::layout()const class and couldn't figure it out. I think I might need to place some sort of placeholder widget in the mainwindow widget and then somehow load and unload the widgets as needed. could you give me a little more information? Thanks
    Rick

Similar Threads

  1. [problem] No mouse input to child widget
    By Demandred in forum Newbie
    Replies: 3
    Last Post: 13th April 2010, 13:44
  2. Replies: 7
    Last Post: 14th January 2010, 08:47
  3. Replies: 4
    Last Post: 3rd October 2009, 08:19
  4. let parent widget grow with child widget?
    By BeS in forum Qt Programming
    Replies: 3
    Last Post: 17th February 2009, 11:17
  5. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00

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.