[Interest] Qml MessageDialog not centered over window

Shawn Rutledge Shawn.Rutledge at qt.io
Mon Sep 25 08:37:05 CEST 2017

> On 24 Sep 2017, at 02:00, Murphy, Sean <smurphy at walbro.com> wrote:
> The documentation states that " A MessageDialog window is automatically transient for its parent window. So whether you declare the dialog inside an Item or inside a Window, the dialog will appear centered over the window containing the item, or over the Window that you declared.”

Yes, it should be automatically transient for its parent.  For me it works on Linux and macOS.  So I wonder if we have a bug about this transient-parenting in general on Windows.  Have you tried any older Qt versions?

import QtQuick 2.6
import QtQuick.Window 2.1
import QtQuick.Dialogs 1.2

Window {
    visible: true
    MessageDialog {
        id: errorDialog
        objectName: "errorDialog"
        title: "Error"
        text: ""
        modality: Qt.NonModal // optional, to make it a separate window on macOS
    Item {
        id: functionItem
        objectName: "item"

        function receivedError(text) {
            console.log("Error received: " + text);
            errorDialog.text = "Error, " + text;
    Timer {
        interval: 5000; running: true
        onTriggered: functionItem.receivedError("timer fired")

More information about the Interest mailing list