A document shows its properties in an associated QDockWidget. In a MDI-Application this QDockWidget should be reused from each document. So that the QDockWidget will allways contain the properties of the active document.

The properties of the document are stored in an XML-file. The XML-file is loaded into an object retrieved from class QTreeWidget using QDomDocument::setContent(QIODevice*, ...). Each document (MDI-Child) has now its own QTreeWidget populated with its properties. The parent of this QTreeWidges is the QDockWidget.

To set the QTreeWidget into the QDockWidget the methode setWidget(QWidget*) is used. This works fine when loading several files. The properties of the last loaded file is shown.

But when a previous file is activated (setWidget(...) is called with a QWidget which was previously set), the properties of the last loaded file are always shown on top of the QDockWidget. When enlarging the QDockWidgt the QTreeWidget on top is framed by small line and the QTreeWidget behind is resized as expected (s. screeshot).
DockWidgetReplace.jpg
Occures this behaviour in older versions of Qt too?
Is there a way to remove the previously set QWidget from an QDockWidget?
Should I try another way to find an adequate resolution?

Any help appreciated