c++ - Don't understand why I can't call setCentralWidget in QMainWindow subclass -
//clposter.h class clposter : public qmainwindow { q_object
public: clposter();
private slots: qwidget createcentralwidget(); void createactions(); void createmenu(); void createstatusbar(); void loadsavedposts(); };
//clposter.cpp clposter::clposter() { setwindowtitle("craigslist poster");
qwidget mainwidget = createcentralwidget(); setcentralwidget(mainwidget);
// createactions(); // createmenu(); // createstatusbar();
// loadsavedposts(); // checkforactionsneeded(); //may want break more functions }
the error i'm getting this:
/usr/include/qt4/qtgui/qwidget.h:: in constructor ‘clposter::clposter()’: /usr/include/qt4/qtgui/qwidget.h:787: error: ‘qwidget::qwidget(const qwidget&)’ private /home/brett/projects/clposter/clposter-build-desktop/../clposter/clposter.cpp:9: error: within context /home/brett/projects/clposter/clposter-build-desktop/../clposter/clposter.cpp:10: error: no matching function call ‘clposter::setcentralwidget(qwidget&)’ /usr/include/qt4/qtgui/qmainwindow.h:141: candidates are: void qmainwindow::setcentralwidget(qwidget*)
i'm having trouble interpreting error message. says there no matching function call, should inheriting qmainwindow. lack of understanding c++ more qt, first time i've used it, dunno. help.
all qwidget items must allocated in free-store (new
) since have have "parents". in qt parent delete children (with delete
). why function returning, accepting, whatever widget going on pointer widget, not widget itself; need same.
Comments
Post a Comment