LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-11-2004, 04:14 PM   #1
Raphael_T
LQ Newbie
 
Registered: Oct 2003
Distribution: Mandrake 9.1, Red Hat 7.3
Posts: 21

Rep: Reputation: 15
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 ?
 
Old 05-11-2004, 04:41 PM   #2
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
What is form 2 derived from?
 
Old 05-11-2004, 05:01 PM   #3
Raphael_T
LQ Newbie
 
Registered: Oct 2003
Distribution: Mandrake 9.1, Red Hat 7.3
Posts: 21

Original Poster
Rep: Reputation: 15
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 project.pro.
 
Old 05-11-2004, 05:13 PM   #4
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
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 )
 
Old 05-11-2004, 05:15 PM   #5
Raphael_T
LQ Newbie
 
Registered: Oct 2003
Distribution: Mandrake 9.1, Red Hat 7.3
Posts: 21

Original Poster
Rep: Reputation: 15
they are QDialog
 
Old 05-11-2004, 05:21 PM   #6
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

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

Form2 *theName( this );
theName->show();

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.
 
Old 05-11-2004, 10:37 PM   #7
Raphael_T
LQ Newbie
 
Registered: Oct 2003
Distribution: Mandrake 9.1, Red Hat 7.3
Posts: 21

Original Poster
Rep: Reputation: 15
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 ?
 
Old 05-12-2004, 06:41 AM   #8
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
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.
 
Old 05-12-2004, 09:44 AM   #9
Raphael_T
LQ Newbie
 
Registered: Oct 2003
Distribution: Mandrake 9.1, Red Hat 7.3
Posts: 21

Original Poster
Rep: Reputation: 15
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

project.pro
|
|_Form1:video/Le_Dojo.ui
| |_video/Le_Dojo.ui.h
|
|_Form8:video/inventaire1.ui
| |_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 );
theName->show();
}

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


If you could help me understand. thanks.

Last edited by Raphael_T; 05-12-2004 at 10:25 AM.
 
Old 05-12-2004, 10:32 AM   #10
Raphael_T
LQ Newbie
 
Registered: Oct 2003
Distribution: Mandrake 9.1, Red Hat 7.3
Posts: 21

Original Poster
Rep: Reputation: 15
If you could tell me where you edit these files, i would be very thankful.
 
Old 05-12-2004, 02:42 PM   #11
leonscape
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Debian SID / KDE 3.5
Posts: 2,313

Rep: Reputation: 48
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms in HTML J_K9 Programming 5 06-30-2005 02:21 PM
Oracle forms 6i RuudVV Linux - Software 2 05-17-2004 10:58 AM
Compiling C++ with Forms josh89 Programming 2 04-22-2004 08:27 PM
Oracle Forms 6i seeone Linux - Software 0 03-01-2004 04:55 PM
qt forms help alrawab Programming 1 10-15-2003 03:24 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration