Results 1 to 2 of 2

Thread: how to find a child widget?

  1. #1
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default how to find a child widget?

    A program i'm writing has to for a given widget, cycle through its children in an automated manner. That is to say, we can not assume to have any knowledge about any child widgets but would like to loop through them at run time.

    The QWidget class has the bool focusNextChild() and bool focusPreviousChild() methods. These however, shift the focus to the next child widget. I want to simply identify and return a pointer to the next or previous child widget. Example method names might be: QWidget* findNextChild() and QWidget* findPreviousChild()

    Any suggestions? I hope i'm explaining the problem well enough..

  2. #2
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    99
    Thanks
    11
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to find a child widget?

    Hmm..never mind. I found a T findChild(const QString & name = QString() ) const under the QObject class. I'm sure i can use it to do what i want.

Similar Threads

  1. How to get focus event in child widget
    By YuriyRusinov in forum Qt Programming
    Replies: 4
    Last Post: 17th October 2006, 07:53
  2. minimize child widget
    By sreedhar in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2006, 12:02
  3. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  4. Referencing Parent Widget from Child
    By taylor34 in forum Qt Programming
    Replies: 8
    Last Post: 11th April 2006, 15:13
  5. Cannot find line or rectangle widget
    By Kapil in forum Newbie
    Replies: 3
    Last Post: 23rd February 2006, 11:01

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.