[Qt-interest] basic question about button and slot

Ankit Agarwal ankit17.ag at gmail.com
Tue Feb 10 06:21:58 CET 2009


Hi,
As the button is in QWidget (myWidget.cpp), I think that you need to connect
the clicked() signal to your slot buttonClicked() in the myWidget.cpp itself
and the slot should also be the part of the same.

On Tue, Feb 10, 2009 at 10:46 AM, <ri at eeda.denso.co.jp> wrote:

>  hey there
>
> here's where I am:
>
> + a window (QWidget) (myWindow.cpp) with a button
> + a click on the button will create a dialog ( myDialog.cpp ) which takes
> the window as its parent
> + the dialog wants to read some members of the parent
>
> Now, where should I write the buttonClicked() slot?
>
> in the myWindow.cpp or the myDialog.cpp?
>
> I tried to put it in myDialog.cpp( which I think is natrual )
>
> there I wrote:
>
> void myDialog::buttonClicked()
> {
>    ... ...
>
>    this->parentWidget()->memberA->xxx();
>
>    ... ...
>
> }
>
> But got a  "class QWidget' has no member named 'memberA' " error.
>
> Is it necessary to implement the buttonClicked() slot in myWindow.cpp?
> or am I just doing things in a wrong way?
>
> I know it sounds like an entry-level question but I do need some help.
> thanks in advance!
>
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>


-- 
Regards,
Ankit Agarwal
SW Engineer
Vegayan Systems
email : ankit_agarwal at vegayan.com
Blog : http://ankit17.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090210/c8d4b1d6/attachment.html 


More information about the Qt-interest-old mailing list