[Qt-interest] basic question about button and slot

ri at eeda.denso.co.jp ri at eeda.denso.co.jp
Tue Feb 10 06:16:05 CET 2009


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!
 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090210/f7308b4a/attachment.html 


More information about the Qt-interest-old mailing list