You should use QMdiArea
.
widget = QWidget()
mdiarea = QMdiArea()
layout = QVBoxLayout(widget)
layout.addWidget(mdiarea)
d = QInputDialog()
d.setLabelText("test2")
d.setInputMode(QInputDialog.TextInput)
w = mdiarea.addSubWindow(d)
w.show()
widget.show()