[solved]calling a dialog in another dialog
-
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]
-
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?
-
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.
-
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 -
and about high lighting the code how can i do that?
i don't know it. -
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.
-
excuse me Denis.
what do you mean by screenshot of directory?
how can i do that? -
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).
-
this is the pro file:
@TARGET = NoteBook
TEMPLATE = app
SOURCES += dialog.cpp
../source/src/main.cpp
../signup.cpp
HEADERS += dialog.h
../source/src/User.h
../source/src/TagRelation.h
../source/src/Tag.h
../source/src/header.h
../source/src/Content.h
../source/src/BaseRelation.h
../source/src/BaseIndex.h
../source/src/BaseEntity.h
../signup.h
FORMS += dialog.ui
../signup.ui
@ -
I see in your .pro file that your signup.h is NOT in the same directory as your dialog.cpp. You should either use
@
#include "../signup.h"
@
or add to your .pro file
@
INCLUDEPATH += ../
@ -
thank you Denis.
it works.
really thank you......
and thank from everybody that reply me and help me to solve this problem. -
You are welcome. Don't forget to mark thread as [solved]
-
ok.sure.