How to make the prompt message appear on the top of all windows in qml
Unsolved
General and Desktop
-
I have a function which shows prompt messages to user. I want this pop up window to appear on the top of all windows and it shouldn't goes to background after clicking other windows. It should be close explicitly by the user.
I have defined a function in qml to show the pop up window:-
function openPrompt(promptTitle, message){ // Prompt the user with a dialog var component = Qt.createComponent("showPrompt.qml"); if (component.status === Component.Ready) { var dialog = component.createObject(parent); dialog.message = message dialog.promptTitle = promptTitle // dialog.open() dialog.show() } else { console.error("Error loading component:", component.errorString()) } }
My showPrompt.qml is as follows:-
ApplicationWindow { id: window width: 400 height: 30 visible: true title: promptTitle property string message: "" property string promptTitle: "" Component.onCompleted: { // Open the Popup when the window is loaded popup.open() } Popup { id: popup width: parent.width height: parent.height modal: true focus: true closePolicy: Popup.NoAutoClose Text { text: message anchors.fill: parent } } }
P.S: i'm on windows 10