Important: Please read the Qt Code of Conduct -

Child Windows are always under the main window

  • Hey hey

    When I create new standalone windows from QML, using code like this
    var component = Qt.createComponent("Window.qml");
    var win = component.createObject(root);;

    the created windows are always on top of the main window, but child windows itself behave correctly. I wonder what I'm doing wrong :)

  • I've just noticed, that windows are created this way not "true" windows, in that sence OS Windows taskbar doesn't have it (I mean there is only on task for main window). So apparently I have to launch new window from C++ code, like this
    QtQuick2ApplicationViewer viewer2;

    Is it correct (espessially from performance point of view)?

  • Qt Champions 2017

    What is your objective. Both are right code. Do you want to launch seperate window ? If that is the case, you should use the second code piece.

  • Dheerendra, I'm trying to implement something similar to Chrome tabs. I mean user should be able to move tab into another new/existing window.
    The approach with QtQuick2ApplicationViewer is ok for me, but i don't understand how to pass some qml objects to a new window that I would like to move. Btw, I just found why I didn't have tasks for each window in OS taskbar. It's due to this line
    var win = component.createObject(root);

    Root is not needed,
    var win = component.createObject();

    gives me what I need

Log in to reply