PDA

View Full Version : Problem with Qt Netbeans, method calls



0_Azerty_0
9th April 2013, 11:03
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[]) {

QApplication app(argc, argv);

HelloForm form();
// form.show();

return app.exec();
}



#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 */



#include "HelloForm.h"

HelloForm::HelloForm() {
widget.setupUi(this);
}

HelloForm::~HelloForm() {
}


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*'

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

BalaQT
9th April 2013, 15:42
did u try clean and make again?

Hope it helps,
Bala

0_Azerty_0
10th April 2013, 17:36
I did.
Could it be a version problem ?