Subclassing QGLWidget using Qt Creator error -
i'm trying make simple subclass of qglwidget
using qt creator, generated .h , .cpp file using qt creator wizard generated following code:
viewport.cpp
#include "viewport.h" viewport::viewport(qobject *parent) : qglwidget(parent) { }
viewport.h
#ifndef viewport_h #define viewport_h #include <qglwidget> class viewport : public qglwidget { q_object public: explicit viewport(qobject *parent = 0); signals: public slots: }; #endif // viewport_h
i added qt += opengl
.pro file got rid of of errors i'm left 2 don't understand:
/projects/tree_gen/qt_project/tree_gen-build-desktop-qt_4_8_4_in_path__system__debug/../tree_gen/viewport.cpp:4: error: invalid conversion 'qobject*' 'qwidget*' /projects/tree_gen/qt_project/tree_gen-build-desktop-qt_4_8_4_in_path__system__debug/../tree_gen/viewport.cpp:4: error: initializing argument 1 of 'qglwidget::qglwidget(qwidget*, const qglwidget*, qt::windowflags)'
ive not changed anything, trying compile qt gave me, ideas?
qglwidget widget , takes qwidget*
parent, it's idea use kind of parent widget class too: explicit viewport(qwidget *parent = 0); //don't forget modify .cpp too
Comments
Post a Comment