-   Programming (
-   -   Forms with Qt (

Raphael_T 05-11-2004 04:14 PM

Forms with Qt
I'm developping my first program with QT and I have a little problem.

I have two forms.

Form 1 with only one button.

Form 2 with a message.

Just what I want is the form 2 to be called when I push the button of the form 1.

How can I do that ?

leonscape 05-11-2004 04:41 PM

What is form 2 derived from?

Raphael_T 05-11-2004 05:01 PM

I don't think it's actually derived from something. I have my project overview on my right and I have all my form1.ui and form2.ui under my

leonscape 05-11-2004 05:13 PM

Under where you have the .ui and project, there's a second window that has tabs named Objects and members.

It will say what class of widget the forms are when you click on them in the above window you have there. ( i.e. QDialog, QMainWindow, etc.. )

( I presume where talking about Qt Designer )

Raphael_T 05-11-2004 05:15 PM

they are QDialog

leonscape 05-11-2004 05:21 PM

In Form1 connect the buttons clicked() signal to a slot. In that slot have the code

Form2 *theName( this );

Thats it . The caller recieves control back. so if you need to set anything else with form2 you can. After the slot returns everthing carries on as normal. Don't forget to have some way of closing your dialog, and that Form2's header is available to form1.

Raphael_T 05-11-2004 10:37 PM

Where do I put the slots? public, protected or private.

And where do I look to know if the header is available for the form 1 ?

leonscape 05-12-2004 06:41 AM

Usually you put slots under protected.

for your second question I think ( because I usually code these, not use Qt Desginer ), That right clicking on the ui.h file gives you the option to include files in the context menu. But check the manual for details.

Raphael_T 05-12-2004 09:44 AM

There is probably something that I'm doing bad. Here is my code. If you can tell me what i'm doing wrong.

the file structure
| |_video/Le_Dojo.ui.h
| |_video/inventaire1.ui.h

code in video/Le_dojo.ui.h

** ui.h extension file, included from the uic-generated form implementation.
** If you wish to add, delete or rename functions or slots use
** Qt Designer which will update this file, preserving your code. Create an
** init() function in place of a constructor, and a destroy() function in
** place of a destructor.

#include "video/inventaire1.ui.h"
#include "Form8"

void Le_Dojo::inventaire1()
Form8 *theName( this );

there is no code in /video/inventaire1.ui.h

If you could help me understand. thanks.

Raphael_T 05-12-2004 10:32 AM

If you could tell me where you edit these files, i would be very thankful.

leonscape 05-12-2004 02:42 PM

I believe the include should be form8.h, This is a generated file. Also I believe the make process (after qmake ) will do this for you.

I'm out of my depth with QTDesigner, try going through the Designer Manual and Tutorials. This contains the answers I think.

All times are GMT -5. The time now is 02:45 AM.