How to add MousePressEvent?
Posted
by
John Son
on Stack Overflow
See other posts from Stack Overflow
or by John Son
Published on 2012-09-30T03:36:16Z
Indexed on
2012/09/30
3:37 UTC
Read the original article
Hit count: 102
In qt: I create a class based on QToolButton to display icon and text. How can I add 'mousePressEvent' to the class? Thank you.
bool IconLabel::event (QEvent* e ) {
if ( e->type() == QEvent::Paint) {
return QToolButton::event(e);
}
return true;
}
The class is:
class IconLabel : public QToolButton
{
Q_OBJECT
public:
explicit IconLabel(QWidget *parent = 0);
bool event (QEvent* e );
signals:
public slots:
};
© Stack Overflow or respective owner