PDA

View Full Version : setMainWidget



peace_comp
10th March 2008, 21:47
Peace..
hey ..
I try to compile a simple qt programm whch I found in a tuto .. but I get the following error >> 'class QApplication' has no member named 'setMainWidget'

#include <QApplication.h>
#include <qpainter.h>
#include <qlabel.h>
#include <qpixmap.h>
#include <qpaintdevice.h>
void Dessiner(QPaintDevice * dev)
{ }
int main (int argc, char* argv[])
{
QApplication app(argc, argv) ;
QPixmap pix(300, 200) ;
Dessiner(&pix) ;
QLabel label(0) ;
label.setPixmap(pix) ;
app.setMainWidget(&label) ;
label.show() ;
return app.exec() ;
}
so is setMainWidget a member of QApplication class ??
plz help

wysota
10th March 2008, 21:50
QApplication::setMainWidget() is a method from Qt3 whereas you seem to be using Qt4.

peace_comp
10th March 2008, 22:20
Yea Im using Qt4 ..so wht should I put instead ?

wysota
10th March 2008, 22:22
Nothing, you can remove that line.

peace_comp
10th March 2008, 22:25
So by default it is taken as a main widget !!
thanks for help