In QT: I only want to show an icon and some text, so I use QPushButton. But how can I remove the click effect from it?
You can subclass QPushButton and ignore all events but the Paint event:
class IconLabel : public QPushButton {
...
bool IconLabel::event ( QEvent * e ) {
if (e->type() == QEvent::Paint) {
return QPushButton::event(e);
}
return true;
}
Depending on your requirements, it might be necessary to let additional events pass through, like if you want to use a tooltip on your IconLabel:
if (e->type() == QEvent::Paint ||
e->type() == QEvent::ToolTip) {
return QPushButton::event(e);
}