[solved]calling a dialog in another dialog
-
wrote on 9 Jul 2011, 07:27 last edited by
hi everybody
i'm new in qt programming.
in my program there are 2 dialogs.
one of them is main dialog with a pushbotton in it.
i want that when i push the botton in the main dialog ,second dialog opens.
i add
@
#include "seconddialogname.h"
& add
secondDialog *var-name;
var-name->show();
@
to the fmainDialog.cpp filebut it doesn't work!
i got an (no such file or directory)error about including the second dialog in the maindialog
can anyone help me please?
i searches about it a lot,but i didn't fine any usefull result!!!!!
thank uEdit: please use @ tags around code sections; Andre
-
wrote on 9 Jul 2011, 07:41 last edited by
if anyone know the answer please help me.
i'm in hurry & i should write my program till tommorow.
thank u. -
wrote on 9 Jul 2011, 08:09 last edited by
this is my code
@
#include "dialog.h"
#include "ui_dialog.h"
#include "signup.h"void Dialog::on_cmdSignup_clicked()
{
// Signup *mySignup=new Signup;
mySignup->show();
}@
*and these are the errors *
@
dialog.cpp:3:20: error: signup.h: No such file or directory
dialog.cpp: In member function 'void Dialog::on_cmdSignup_clicked()':
dialog.cpp:58: error: 'Signup' was not declared in this scope
dialog.cpp:58: error: expected ';' before 's'
dialog.cpp:59: error: 's' was not declared in this scope
@ -
wrote on 9 Jul 2011, 08:20 last edited by
Please refer to the Qt example: $QTDIR\Examples\4.7\dialogs\standarddialogs
-
wrote on 9 Jul 2011, 08:31 last edited by
r@h@, please don't open new threads with same problem. I've already removed duplicate one, please don't create new.
-
wrote on 9 Jul 2011, 08:43 last edited by
ok Denis.
but i've stuck wuth that problem .
that's y............. :( -
wrote on 9 Jul 2011, 08:52 last edited by
Solve the problem step by step. Line 1 of your error messages is not that hard to interpret, is it?
-
wrote on 9 Jul 2011, 08:59 last edited by
thank u to reply Andre.
ok.
well i think this is the main problem .
coz if signup.h be known in dialog.cpp ,i think other errors should be disappear.
am i right? -
wrote on 9 Jul 2011, 09:09 last edited by
Try and see...
On a side note: please try to write proper English. By that I don't mean that you can not make mistakes (we, including yours truly, are not all native speakers after all), but please do take care to avoid MSN L337-speak. That is: write "you", not "u", and "because" instead of "coz" please, and also take care of using proper capitals and punctuation. That would make your messages easier to read, thus enabling readers to focus on your problem, instead of trying to understand what you want to tell us.
-
wrote on 9 Jul 2011, 09:32 last edited by
okay.
my english is not so good.okay.
sorry if i made mistake.
"signup" and "dialog" are the names of two dialogs in my program.
"dialog" form has a pushbutton with the name of "signup".
i want that when i push this button ,"signup form opens.
i include signup.h in dialog.cpp and then use an object from signup class with the name of mySignup ,to open a signup form in on_cmdSignup_clicked() function by pushin signup button.
but the problem is that i recieve an error (not such file or directory) about including signup.h.
this is the code:
@
#include "dialog.h"
#include "ui_dialog.h"
#include "signup.h"void Dialog::on_cmdSignup_clicked()
{
Signup *mySignup=new Signup;
mySignup->exec();}
@and these are errors:
@
dialog.cpp:3:20: error: signup.h: No such file or directory
dialog.cpp: In member function 'void Dialog::on_cmdSignup_clicked()':
dialog.cpp:56: error: 'Signup' was not declared in this scope
dialog.cpp:56: error: 'mySignup' was not declared in this scope
dialog.cpp:56: error: expected type-specifier before 'Signup'
dialog.cpp:56: error: expected ';' before 'Signup'
@thank you to help me.
[edit: code highlighted / Denis Kormalev]
-
wrote on 9 Jul 2011, 09:40 last edited by
The error means your program doesn't find the signup.h file.
Do you know where it is?
Did you put it in your pro file?
-
wrote on 9 Jul 2011, 09:42 last edited by
r@h@, Andre already asked you to highlight code with @ tags. I'm asking you again. Highlighted code is much easier to read.
Do you have this file (sighup.h) in same directory where your dialog.cpp contains? If not do you have needed directory in INCLUDEPATH in your pro file?
-
wrote on 9 Jul 2011, 09:54 last edited by
in fact my question is that why when i use <#include "signup.h" > in dialog.cpp ,i receive an (no such file or directory)error .
it's not possible in QT to include a dialog in another dialog?and how can i call a dialog by pushing a button in another dialog?
i hope i could explain what's my problem with this program....
-
wrote on 9 Jul 2011, 09:55 last edited by
Can you answer my questions about directory structure. I don't think anybody can help you without this info. Crystal balls are not so strong.
-
wrote on 9 Jul 2011, 10:04 last edited by
yes,(signup.h) file is in same directory where dioalog.cpp contains.
and i add signup.h by
(right click on Form directory in the project)->(add new ) -> (Qt Designer Form Class)
yes , (signup.h) is in HEADERS in .pro file -
wrote on 9 Jul 2011, 10:06 last edited by
and about high lighting the code how can i do that?
i don't know it. -
wrote on 9 Jul 2011, 10:07 last edited by
Are you sure you don't have any typos in filename? If you include existing file from same directory it will work. Can you post here screenshot of directory where your dialog.cpp contains?
P.S. About highlighting. Andre and I already said that you can use @ tags for it.
-
wrote on 9 Jul 2011, 10:21 last edited by
excuse me Denis.
what do you mean by screenshot of directory?
how can i do that? -
wrote on 9 Jul 2011, 10:43 last edited by
you mean project by directory?
if yes,so (signup.h) is in the same directory where dialog.cpp contains.
actually (signup.h) and (dialog.h) are in th Headers part,
(signup.cpp) and (dialog.cpp) are in the Sources part.
i thought maybe including a dialog in another dialog is not possible in Qt
and that's why i got that error. -
wrote on 9 Jul 2011, 10:44 last edited by
If you use Linux just go in console into your dir, type ls there and copy output here. If you use Windows open your directory in Explorer and make a screenshot of it (or use dir comand in windows console).
1/25