Find Components with function...

Harald Fernengel harry at kdevelop.org
Thu Jul 18 16:57:09 BST 2002


Hi,

On Thursday 18 July 2002 16:10, you wrote:
> I create an aplication with one per type component declared as pointer...
>
> ex:
>
>    QCheckBox *checkBox;
>    QPushButton *pushButton;
>
> Into archive .cpp I use this components as...
>
>    pushButton = new QPushButton( "Text1", this, "name1" );
>    pushButton = new QPushButton( "Text2", this, "name2" );
>
> How I do to call the button with name "name1" in other part of my code ???
>
> It is possible... or I have declarate...
>
>    QPushButton *firstButton;
>    QPushButton *secondButton;
>
> Making bad .h archive...

It doesn't make bad .h files to store a pointer to each object you create. If 
you really have a good reason to do that, you can ask the parent object for 
its children using this->child( "name1" ) and casting it into a QPushButton 
but this is of course much slower than using secondButton->blah().

Best regards,
Harry

-
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