Usually you want to use Dialog not only to create a new window, but also for its implemented functions and interface ...
The reason Dialog does not inherit Window or ApplicationWindow is obvious: there is no window if it is not open() . But once it is open, there is ApplicationWindow (from QtQuick.Controls 1.4)
Now in the documentation we find this nice property attatched: ApplicationWindow , which is available for each Item , and conveniently it allows us to access the window. Then we just need to find a way to set the correct flags as soon as ApplicationWindow becomes available - for example. when we get the visibleChanged signal.
Since Dialog not equal to Item , we must use its contentItem to access this attached property.
When we put it all together, the result may look like this:
NonModalDialogThatStaysOnTop.qml // I suck the naming convention
import QtQuick 2.3 import QtQuick.Controls 1.4 // You need this, to have access to the `ApplicationWindow`-attatched property import QtQuick.Dialogs 1.2 Dialog { onVisibleChanged: { if (visible) contentItem.ApplicationWindow.window.flags |= Qt.WindowStaysOnTopHint } modality: "NonModal" }
Now you have your favorite Dialog , which remains on top, but is not modal.
source share