I have a K* window, and within it, a widget which needs the events filtered.
For example I do not want the possibility of clicking it...
How can I do that?
Have I to use eventfilters? In this case, what's the best way?
but my problem is that I can't subclass my widget,because it's a TerminalInterface->widget(), not an object like others :\
Besides the setEnabled sledgehammer approach in the first answer, there are two other approaches, one of which is to use eventfilters.
The other is to subclass the widget, and then reimplement, say, the mouse* events. Simply leaving them empty will prevent any mouse interaction. So:
MyWidget : public QSomeWidget { Q_OBJECT public: MyWidget(QWidget *parent);
protected: void mousePressEvent(QMouseEvent *) {} .. etc .. };
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With