Neox
Neox

Reputation: 2004

How to identify QEvent sender

I have reimplemented QWidget::event() handler, where I am handling windowStateChange event. I was wondering if there is any way to identify which widget sends this event.

Upvotes: 0

Views: 2259

Answers (2)

No, there's no way to do that, because posting or sending a QEvent does not require a QObject instance. When you post an event, it's done via a static QCoreApplication method, and it doesn't ask who's sending the event. Heck, it'd be counterproductive, because a useful way of interoperation between Qt and other event-driven code is to do event translation and post the events to the Qt side of things. The posting code may be an extern "C" function.

Upvotes: 1

Arnold Spence
Arnold Spence

Reputation: 22272

That event is generated when a window is minimized, maximized or full-screened so you should only see it from within the widget to which it applies.

Upvotes: 0

Related Questions