I haven't had time to look into it, but perhaps you could use QDockWidget::visibilityChanged()?