Results 1 to 3 of 3

Thread: How to get the child widgets from a Widget?

  1. #1
    Join Date
    Jan 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11

    Question How to get the child widgets from a Widget?

    Qt version: 4.4.3:


    Consider the code:

    Qt Code:
    1. QWidget *scrollAreaWidgetContents;
    2.  
    3. // ...
    4.  
    5.  
    6. // Used for the naming of the checkboxes
    7. unsigned count= 1;
    8.  
    9.  
    10. // Adds the checkboxes empty
    11. for(unsigned j= 1; j<= 8; ++j)
    12. {
    13. QCheckBox *checkBox= new QCheckBox(scrollAreaWidgetContents);
    14.  
    15. ++count;
    16.  
    17. checkBox->setObjectName(QString("checkBox_%1").arg(QString::number(count)));
    18. checkBox->setGeometry(QRect(50* (j+ 1)+ 37, 20* i, 83, 20));
    19. }
    20.  
    21. // ...
    22.  
    23.  
    24. switch(runLevelsInfostring[0])
    25. {
    26. case '0':
    27. scrollAreaWidgetContents.nextInFocusChain()->setCheckState(Qt::Checked);
    28. }
    To copy to clipboard, switch view to plain text mode 

    I want to make the checkbox named "checkBox_1", to become << checkBox_1->setCheckState(Qt::Checked); >> How can I do that?

    Thanks.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to get the child widgets from a Widget?

    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Jan 2009
    Posts
    29
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to get the child widgets from a Widget?

    Thanks for your answer.

Similar Threads

  1. QDockWidget inside another widget in the center?
    By Antebios in forum Qt Programming
    Replies: 1
    Last Post: 16th February 2010, 08:06
  2. hello! i have a simple child widgets question
    By ht1 in forum Qt Programming
    Replies: 3
    Last Post: 18th November 2007, 00:49
  3. removing child widget
    By db in forum Newbie
    Replies: 1
    Last Post: 16th August 2007, 13:19
  4. minimize child widget
    By sreedhar in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2006, 13:02
  5. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 13: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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.