PDA

View Full Version : Compilation error creating a project on QT4.0.1??



darpan
7th March 2006, 08:55
Hi

I had created a form named imagedialog.ui and then added the following code in Main.cpp

#include <qdialog.h>
#include "ui_imagedialog.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QDialog *window = new QDialog;
Ui::ImageDialog ui;
ui.setupUi(window);

window->show();
return app.exec();
}



Then i used the
qmake -project
qmake
make

it creates the "ui_imagedialog.h" file but there is some error in main.cpp :-
main.cpp: In function `int main(int, char**)':
main.cpp:21: error: 'ImageDialog' is not a member of 'Ui'
main.cpp:21: error: expected `;' before "ui"
main.cpp:22: error: 'ui' was not declared in this scope
make: *** [main.o] Error 1

Where i am wrong plz assist me.

Best Regards

zlatko
7th March 2006, 09:20
are you sure that your form has ImageDialog name?

ChristianEhrlicher
7th March 2006, 09:22
main.cpp:21: error: 'ImageDialog' is not a member of 'Ui'


What's the problem here? Take a look into ui_imagedialog.h and see if ImageDialog is available in the namespace Ui.

darpan
7th March 2006, 11:06
Hi
Following code snippet is written in ui_imagedialog.h


namespace Ui {
class Dialog: public Ui_Dialog {};
} // namespace Ui



Thanks

zlatko
7th March 2006, 11:21
so you must use Dialog instead ImageDialog

darpan
8th March 2006, 07:10
Hi
How can i connect a Button to a user defined slot(). In qt 4.0.1 we can easily connect two object just by draging. but how i can connect a Button to a user difned slot in qt 4.0.1.

So that i can code what i want to do on the click of any button.



Thanks and regards

Kapil
8th March 2006, 08:16
hi,

You can do so by the use of signal and slots... there is a proper documentation on it.. Just follow that and you would be able to do the same...
the function for it would be..

connect(pushButton,SIGNAL(clicked()),objectname,SL OT(functionname()));