Results 1 to 7 of 7

Thread: Child widgets

Hybrid View

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

    Default Re: Child widgets

    Thanks, but I am still missing something! I tried your code and a new window opened with the original window still there, but the original window was now empty. How do I close the original window? So you think that the stacked widgets, even if they are connected to databases won't be much of a resource issue?

    Thanks
    Rick

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Child widgets

    You should only have one "MainWindow". Your page1 should be the MainWindow::centralWidget() when the app starts and when the slot is called page2 is set as centralWidget.

    Don't know what kind of resource restrictions you have or what size data sets you are working with but maybe the following will be of help: I created a stacked widget with four pages, each displaying a QTableView, with a corresponding QSqlQueryModel. I queried (select *) a db containing three tables each 14 columns wide: one with 21,143 records (used in two views), one with 17,540 records, and one with 35,036 records. I ran the app on an older machine (AMD Athlon XP 2700+ with 512MB of memory) and had no performance problems. The top command reports the app uses 27MB (5.4%) of system memory.
    Last edited by norobro; 10th August 2010 at 03:09. Reason: typo

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

    Default Re: Child widgets

    I don't know why it isn't working like it should??? I think the stacked widgets is the way to go then. I am trying to figure out the stacked widgets now I am using Creator 2.0 and can get the form and the holder for the stacked widgets. I see the properties for page and page_2. I can't find the properties to put in the name of the widget I want for each page. From the examples it shows the form created from code. How do I put the widgets I want on the stacked widgets?

  4. #4
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Child widgets

    Here's a small example app. I just threw it together so the layout is pretty sloppy but maybe it will help.
    Attached Files Attached Files

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

    Default Re: Child widgets

    I feel stupid! I was trying to create separate widgets for the pages and then couldn't find how to load them! You just build each widget on each page! Thanks....Sometimes it helps to see an example!
    Thanks a bunch!
    I am sure I will be back several times while I am trying to learn this QT stuff!

Similar Threads

  1. Replies: 5
    Last Post: 18th April 2010, 23:31
  2. How to get the child widgets from a Widget?
    By prykHetQuo in forum Qt Programming
    Replies: 2
    Last Post: 29th January 2009, 13:26
  3. Child Widgets In MainWindow
    By RY in forum Newbie
    Replies: 3
    Last Post: 4th October 2008, 08:39
  4. hello! i have a simple child widgets question
    By ht1 in forum Qt Programming
    Replies: 3
    Last Post: 17th November 2007, 23:49
  5. setClipPath on child widgets.
    By bunjee in forum Qt Programming
    Replies: 9
    Last Post: 27th May 2007, 19:12

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.