[Qt-interest] Basic non modal dialog question - part 2

John McClurkin jwm at nei.nih.gov
Thu Feb 25 15:15:34 CET 2010


Phil wrote:
> On Wed, 17 Feb 2010 03:17:32 pm Ellen Kestrel wrote:
>>  Declare all of your dialogs (as pointers) as members in the main
>>  application class, and then use connect to connect signals from those
>>  dialogs to slots in the main application class (or to slots in other
>>  dialog classes). 
> 
> I'm afraid I must ask for some more hand-holding.
> 
> I understand how to handle dialogs that are a distinct class in themselves 
> but I do not understand how to declare a dialog as a class member, as 
> suggested above.
> 
> Using Designer, I have created a dialog (dialog.ui) with an object name of 
> Dialog. How do I make that dialog a member of my application class? 
> Because the dialog is not a class there are no .h or .cpp files.
> 
You do it like any other C++ member. Declare a pointer of type dialog 
class in your main application class, then instantiated with new.

app.h
	MyDialog *m_mydialogptr;

app.cpp
	m_mydialogptr = new MyDialog;



More information about the Qt-interest-old mailing list