beginner's problem!!!

Olaf Hartig OleBowle at gmx.de
Tue Apr 10 09:51:30 UTC 2001


Am Dienstag, 10. April 2001 01:37 schrieben Sie:
> hi everyone,
>
> I'm trying to write a kde application with kdevelop 1.3, that uses 4
> different dialog windows.
> I created the dialogs with the kdevelop dialog editor and made the
> source files of all the dialogs.
> Now I 've got the class_1 for dialog 1, class_2 for dialog 2, etc.
>
> in the main() finction of my application I created the objects of all my
> dialog classes with code like this:
>
> class_1 *class1 = new class_1();
> class_2 *class2 = new class_2();
> etc.
>
> ok, so far everything works fine, but now I want to connect the signal
> clicked of the QPushButton widget in
> class_1 with the show() slot in class_2. When I try:
>
> QObject::connect( QPushButton, SIGNAL(clicked()), class_2,
> SLOT(show()));
>
> I get an error because the QPushButton is declared as protected(by the
> dialog editor).
>
> Do I have to declare QPushButton manually as public or is there another
> way to do this?????
>
>
> Thank you!!!!
>
> michael

It's better to create another signal (e.g. sigNext) in the first dialog 
(class_1) and connect the button's signal (clicked) to your signal in 
class_1's constructor:

connect( myButton, SIGNAL(clicked()), this, SIGNAL(sigNext()) ); 

Now you can connect the dialogs signal to the second dialogs show-slot in 
your main-function.

Something general: I don't know what your application does, but it sounds 
like a wizard-like program (like the wizard you create a new project in 
KDevelop with). We have much better ways to implement this. You should take a 
look at the classes KWizard/QWizard. 
To learn more about KDE2-programing I recommend the book "KDE 2 development". 
At 
	http://kde20development.andamooka.org
you may order it or take a look in the online-HTML-version. You should take a 
look at chapter 8 ("Using dialog boxes").

Ole

-
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