c++qt

Notify Qt Window when its visibility status has changed


How can I notify a Qt Window when its visibility status has changed?

Example Use Case:

  1. User goes from Window A (hide) to Window B (show)
  2. User returns to Window A (show) from Window B (hide)

I want to invoke a function when Window A changes from (hide) to (show).


Solution

  • Connect to the

    void visibilityChanged(QWindow::Visibility visibility)
    

    signal as stated in the documentation to be notified of a QWindow visibility status change.