Find Components with function...
Harald Fernengel
harry at kdevelop.org
Thu Jul 18 20:48:33 BST 2002
Hi,
On Thursday 18 July 2002 18:39, you wrote:
> Thanks...
>
> 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,
Harry
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:
unsubscribe »your-email-address«
More information about the KDevelop
mailing list