The best way is to use a Loader item.
Olivier
Le Lundi 2 juin 2014 10h58, Filip Piechocki <fpiecho...@gmail.com> a écrit :
So just use Rectangle :) or Item if you just want an empty item, or Component
to load some QML from file.
BR,
Filip Piechocki
On Mon, Jun 2, 2014 at 9:51 AM, Yuchen Deng <loa...@gmail.com> wrote:
Actually, I don't really want an MDI interface. I just want load or open
another qml as child Window show inside the parent.
>like this (using QML's Rectangle):
>http://picpaste.com/sub-window-y43R1Kuf.png
>
>not like this (using QML's Window):
>http://picpaste.com/no-sub-window-Jq7qeOu5.png
>
>
>
>
>
>
>2014-06-02 14:54 GMT+08:00 Rutledge Shawn <shawn.rutle...@digia.com>:
>
>
>What do you mean by sub window? If you mean you are trying to create an MDI
>interface, with a window acting as a desktop and having more windows inside,
>that's not supported in Qt Quick and is unlikely at this point, since the
>widgets implementation turned out to be quite bug-prone, and MDI has anyway
>mostly fallen out of fashion. When you declare a Window inside a Window, it
>becomes "transient for" the outer window: a hint is given to the window
>manager that they are related to each other, so usually it will be shown
>centered over its transient parent.
>>
>>
>>On 1 Jun 2014, at 1:25 PM, Yuchen Deng wrote:
>>
>>> hi, list! I have to ask for help because I can't create an sub window on
>>> Window {...}.
>>> I've tried some days, after Google still can't solved my problem.
>>>
>>> main.qml
>>> import QtQuick 2.2
>>> import QtQuick.Window 2.1
>>> Window {
>>> id: mainWindow
>>> visible: true
>>> width: 760; height: 520
>>> color: "red"
>>> property variant win; // you can hold this as a reference..
>>> Text {
>>> text: "Click here to open sub window 2!"
>>> anchors.centerIn: parent
>>> }
>>> Window {
>>> id: subWindow_1
>>> width: 555
>>> height: 333
>>> visible: true
>>> flags: Qt.SubWindow
>>> }
>>> MouseArea {
>>> anchors.fill: parent
>>> onClicked: {
>>> var component = Qt.createComponent("subwindow2.qml");
>>> win = component.createObject(mainWindow);
>>> win.show();
>>> }
>>> }
>>> }
>>>
>>> subwindow2.qml
>>> import QtQuick 2.2
>>> import QtQuick.Window 2.1
>>> Window {
>>> id: subWindow_2
>>> visible: true
>>> width: 500; height: 300
>>> color: "blue"
>>> flags: Qt.SubWindow
>>> Rectangle {
>>> anchors.fill: parent
>>> color: "lightGrey"
>>> Text {
>>> anchors.centerIn: parent
>>> text: "Sub Window 2"
>>> }
>>> }
>>> }
>>>
>>>
>>> See the code, it's can open two window, But can't open as sub window in
>>> parent.
>>> Any help / tips are very welcome!
>>> Thanks you!
>>> --
>>> Best Regards
>>> Yuchen
>>> _______________________________________________
>>> Interest mailing list
>>> Interest@qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
>
>
>--
>
>Best Regards
>Yuchen
>_______________________________________________
>Interest mailing list
>Interest@qt-project.org
>http://lists.qt-project.org/mailman/listinfo/interest
>
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest