c++ - Qt slot, no matching function for call -
c++ - Qt slot, no matching function for call -
i'm quite new qt. wanted create simple application there's triangle generated using opengl , 3 force buttons changing triangle colour.
here's code:
in mainwindow.h declare slots:
public slots: void redbutton(widget w); void greenbutton(widget w); void bluebutton(widget w);
they alter colour using function in widget class:
void mainwindow::redbutton(widget w) { w.setcolor(red); }
in widget.h have:
class widget : public qglwidget { q_object public: widget(qwidget *parent = 0); qsize minimumsizehint() const; qsize sizehint() const; enum color { red, green, bluish }; enum color c; void setcolor(enum color color1); protected: void initializegl(); void paintgl(); void resizegl(int width, int height); };
and function setcolor looks this:
void widget::setcolor(enum color color1) { c = color1; }
unfortunately error saying:
no matching function forr phone call 'widget::setcolor(qpushbutton*&)' w.setcolor(red);
//same goes bluish , greenish don't know i'm doing wrong.
well, function declaration
void widget::setcolor(enum color color1);
obviously doesn't match calls for
void widget::setcolor(qpushbutton*&);
certainly none of qpushbutton
instances, establishes valid instance of enum color
, compiler errors.
c++ qt opengl
Comments
Post a Comment