I have created an application which consists of one MainWindow (containing a text-editor) and optional additional windows (QWidgets, containing additional text-editors).

The MainWindow is provided with a Dock which lists the available documents opened within the project, and highlights in the list the document currently selected.

The only problem is that when I focus an additional window and I then click on the floating dock, the MainWindow gets focused. I would like therefore to be able to focus a floating dock separately, but I have no idea on how to separate the focus of the main window from the focus of the dockWidget.

Also, I guess that when I click on a Dock, the application reacts as if I clicked the MainWindow. I would like then the MainWindow to be unawared whether the Dock is clicked or not (when the dock is undocked).

Does somebody have any idea?