PDA

View Full Version : how to find a child widget?



TheRonin
8th November 2006, 10:26
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.. :confused:

TheRonin
8th November 2006, 10:30
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.