Find Components with function...
harry at kdevelop.org
Thu Jul 18 19:48:33 UTC 2002
On Thursday 18 July 2002 18:39, you wrote:
> but how I do it ???
> Please... give me a example code...
well, you have something like
QPushButton* btn = new QPushButton( "text", this, "name1" );
"this" is the parent of the button. If you need it later, you can ask "this"
for a child named "name1" and you'll get a QObject* back (just take a look at
the QObject documentation).
QObject* obj = child( "name1" );
if ( !obj ) return; //no object with that name exists
now you have to cast it into a pushbutton:
QPushButton* btn = (QPushButton*)obj->qt_cast( "QPushButton" );
if ( !btn ) return; // cast failed, object is no PushButton
you can also use dynamic_cast if you don't like the qt_cast.
Hope that helps,
P.S.: Qt related questions should go to qt-interest mailing list, this is a
list about KDevelop issues...
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
More information about the KDevelop