Qt World Summit: Register Today!

Open child window on same screen as parent

  • How do I center a child window on the same screen as the parent window? I've looked at the Screen object, but that doesn't seem to be a good idea.

    Edit: I originally had posted "How do I open a child window...", but realized that it should be changed to "center". Unfortunately, this forum doesn't allow me to edit the thread title. :(

  • Update: I've done some work and gotten a setup where my QML window is given access to an object from C++ which is the current QScreen. This allows me to set screen: to the same screen as the main window (which is, I should mention, a Qt Widgets-derived window containing a QQuickWidget view), but does not meet my main goal of centering the QML window on the screen.

  • I don't know if I can help You, bat I used this method:

     inputTime *InputF = new inputTime(this);

    where inputTime is a form "inputTime.ui"

  • Thanks, but that's not QML. Furthermore, I'm not using UI files.

  • In QML I use this method

                    var component = Qt.createComponent("DataPathForm.qml")
                    var window    = component.createObject()


  • @sluci That's not actually trying to center the window on a parent window. I need to figure out how to center a child window on a parent window. The child window is QML and the parent window is in C++ with a QQuickWidget containing a lot of QML. I'd like this solution to work on multiple monitors.

Log in to reply