Q:

Notify QMainWindow toolbar about fullscreen mode switch

In QWindow there is a signal windowStateChanged(Qt::WindowState).
I'm looking for similar signal in QMainWindow. Is it available?
I need it to notify toolbar about fullscreen change, as I have a checkable toolbar button which changes window to fullscreen when user clicks it. However when user changes to fullscreen bypassing the button, it shows invalid state.

A:

QMainWindow inherits from QWidget where you find the ::setWindowState(Qt::WindowStates) method. In its docs, it says:

When the window state changes, the widget receives a changeEvent() of type QEvent::WindowStateChange.

So it seems like you have to override changeEvent() to handle this, I don't think there is a signal.

