[solved]calling a dialog in another dialog
-
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
-
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
@ -
Please refer to the Qt example: $QTDIR\Examples\4.7\dialogs\standarddialogs
-
r@h@, please don't open new threads with same problem. I've already removed duplicate one, please don't create new.
-
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.
-
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]
-
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?
-
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....
-
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.
-
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.
-
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. -
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).