How to connect SIGNAL(clicked()) of QPushButton to inherited class MyPushButton to SLOT -> executeMe().
-
#ifndef MYPUSHBUTTON_H #define MYPUSHBUTTON_H #include <QDebug> #include <QPushButton> class MyPushButton : public QPushButton { public: MyPushButton(); explicit MyPushButton(QString str, QWidget *parent = 0); void mousePressEvent(QMouseEvent *); void myclick(); signals: void clickMe(); private slots: void executeMe(); }; #endif // MYPUSHBUTTON_HMy Requirement to connect
-
Fine,
I forgot to add Q_OBJECT,
class MyPushButton : public QPushButton
{
Q_OBJECT
....
... -
hi, I aleardy got that ,
to connect a Sigal-slot in qt you need add in the constructor :
connect ( this , SIGNAL( clicked() ), this , SLOT( executeMe() ) );