This works:
# this will remove minimized status
# and restore window with keeping maximized/normal state
window.setWindowState(window.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
# this will activate the window
window.activateWindow()
Both are required for me on Win7.
setWindowState
restores the minimized window and gives focus. But if the window just lost focus and not minimized, it won't give focus.
activateWindow
gives focus but doesn't restore the minimized state.
Using both has the desired effect.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…