Hi,
I set up Qt for Netbeans yesterday following this tutorial : https://netbeans.org/kb/docs/cnd/qt-applications.html
But I have a problem with the Qt Library.
I create a HelloForm class (example) but I have compilation problems, just making a call of an instance of HelloForm :
#include <QtGui/QApplication>
#include <QtGui>
#include "HelloForm.h"
int main(int argc, char *argv[]) {
HelloForm form();
// form.show();
return app.exec();
}
#include <QtGui/QApplication>
#include <QtGui>
#include "HelloForm.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
HelloForm form();
// form.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
#ifndef _HELLOFORM_H
#define _HELLOFORM_H
#include "ui_HelloForm.h"
Q_OBJECT
public:
HelloForm();
virtual ~HelloForm();
private:
Ui::HelloForm widget;
};
#endif /* _HELLOFORM_H */
#ifndef _HELLOFORM_H
#define _HELLOFORM_H
#include "ui_HelloForm.h"
class HelloForm : public QWidget {
Q_OBJECT
public:
HelloForm();
virtual ~HelloForm();
private:
Ui::HelloForm widget;
};
#endif /* _HELLOFORM_H */
To copy to clipboard, switch view to plain text mode
#include "HelloForm.h"
HelloForm::HelloForm() {
widget.setupUi(this);
}
HelloForm::~HelloForm() {
}
#include "HelloForm.h"
HelloForm::HelloForm() {
widget.setupUi(this);
}
HelloForm::~HelloForm() {
}
To copy to clipboard, switch view to plain text mode
Erros are :
HelloForm.cpp: In constructor 'HelloForm::HelloForm()':
HelloForm.cpp:11:24: erreur: no matching function for call to 'Ui::HelloForm::setupUi(HelloForm* const)'
HelloForm.cpp:11:24: note: candidate is:
In file included from HelloForm.h:11:0,
from HelloForm.cpp:8:
ui_HelloForm.
h:28:10: note
: void Ui_HelloForm
::setupUi(QDialog*)ui_HelloForm.h:28:10: note: no known conversion for argument 1 from 'HelloForm* const' to 'QDialog*'
HelloForm.cpp: In constructor 'HelloForm::HelloForm()':
HelloForm.cpp:11:24: erreur: no matching function for call to 'Ui::HelloForm::setupUi(HelloForm* const)'
HelloForm.cpp:11:24: note: candidate is:
In file included from HelloForm.h:11:0,
from HelloForm.cpp:8:
ui_HelloForm.h:28:10: note: void Ui_HelloForm::setupUi(QDialog*)
ui_HelloForm.h:28:10: note: no known conversion for argument 1 from 'HelloForm* const' to 'QDialog*'
To copy to clipboard, switch view to plain text mode
I checked the Qt parameters and everthing seems to be ok... Any idea ?
I am using Qt 4.8.x and Netbeans 7.2
Thanks
Bookmarks