[Qt-interest] basic question about button and slot

ri at eeda.denso.co.jp ri at eeda.denso.co.jp
Tue Feb 10 06:28:50 CET 2009


Thank you
 
then what about I have another button in the dialog and want to access memberA?
 
I still ain't sure that if I write the anotherButtonClicked() slot in the myDialog.cpp
 
how do I get all parent's members in the slot .
 
 


________________________________

From: Ankit Agarwal [mailto:ankit17.ag at gmail.com] 
Sent: Tuesday, February 10, 2009 2:22 PM
To: 黎 新懿
Cc: qt-interest at trolltech.com
Subject: Re: [Qt-interest] basic question about button and slot


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/cc596607/attachment.html 


More information about the Qt-interest-old mailing list