Hi all again.
More problems with Qt, now with Designer.
I have created a really easy GUI, which name is Form.ui. I also have created myform.pro with the following lines:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += MyForm.h
FORMS += Form.ui
SOURCES += main.cpp MyForm.cpp
And main.cpp :
#include <QApplication >
#include "MyForm.h"
int main(int argc, char **argv)
{
QApplication a(argc, argv);
MyForm form;
form.show();
return a.exec();
}
And MyForm.h:
#include "ui_Form.h"
class MyForm:public QWidget
{
Q_OBJECT
public:
MyForm(QWidget* parent=0);
private:
Ui::MyForm ui;
}
And MyForm.cpp:
#include "MyForm.h"
MyForm::MyForm( QWidget* parent):QWidget (parent)
{
ui.setupUi(this );
}
Very simple, and that's the way I guess it is used for each form in Designer.
Result: error in compilation: MyForm.h:9: error: ‘MyForm’ in namespace ‘Ui’ does not name a type, line 9 in MyForm.h is the declaration of the object Ui::MyForm ui;
I don't know hot to do...so if anyone knows something I'd be glad to hear and learn. Thanks to all!
More problems with Qt, now with Designer.
I have created a really easy GUI, which name is Form.ui. I also have created myform.pro with the following lines:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
# Input
HEADERS += MyForm.h
FORMS += Form.ui
SOURCES += main.cpp MyForm.cpp
And main.cpp :
#include <QApplication >
#include "MyForm.h"
int main(int argc, char **argv)
{
QApplication a(argc, argv);
MyForm form;
form.show();
return a.exec();
}
And MyForm.h:
#include "ui_Form.h"
class MyForm:public QWidget
{
Q_OBJECT
public:
MyForm(QWidget* parent=0);
private:
Ui::MyForm ui;
}
And MyForm.cpp:
#include "MyForm.h"
MyForm::MyForm( QWidget* parent):QWidget (parent)
{
ui.setupUi(this );
}
Very simple, and that's the way I guess it is used for each form in Designer.
Result: error in compilation: MyForm.h:9: error: ‘MyForm’ in namespace ‘Ui’ does not name a type, line 9 in MyForm.h is the declaration of the object Ui::MyForm ui;
I don't know hot to do...so if anyone knows something I'd be glad to hear and learn. Thanks to all!
Comment