[SOLVED] Make QWidget Child clickable
-
Hi, its the following way correct as to enable your own widget
to be clickable like a button is. (connectable from outside)override
protected: virtual void mouseReleaseEvent ( QMouseEvent * event );
add signal
signals: void mouseReleased();
in mouseReleaseEvent
emit mouseReleased();
and then in main
connect ( ui->NotiMachineStatus, SIGNAL ( mouseReleased() ), this, SLOT ( StatusClicked() ) )
Or is there a faster way ?
-
That seems to be ok, although if it's suppose to behave like button why not use a QPushButton or derive from it?
If it walks like a duck and quacks like a duck....
You can make it flat if you don't want it to seem too conspicuous. -
@Chris-Kawa
Ok. well it is actually a bit duck like,
but I needed multiple icons and it is more of a status area widget
than a button. But I see the quacks.Thank you
-
but I needed multiple icons and it is more of a status area widget than a button
How about QStatusBar with flat QPushButtons added as permanent widgets then?
-
@Chris-Kawa
Well you kinda sold me the pushbutton idea as I need 4 of them and they all can be clicked.
free signals I and assume it has paint stages so I could make a down effect.