QdockWidget:: toggleViewAction(), dockwidget’s visibility is toggled on triggered() signal whereas it could/should be toggled() signal as user wants to control the dock visibility with some property, say checked.
If you set action.setChecked(true) or action.toggle(), it does not make any impact on dock’s visibility. Like in qdockWidget.cpp, line no. 679, we have
Like if you try,