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
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.
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
http://lists.qt-project.org/mailman/listinfo/interest
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):
Loading Image...
not like this (using QML's Window):
Loading Image...
Post by Rutledge Shawn
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.
Post by Yuchen Deng
hi, list! I have to ask for help because I can't create an sub window on
Window {...}.
Post by Yuchen Deng
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.
Post by Yuchen Deng
Any help / tips are very welcome!
Thanks you!
--
Best Regards
Yuchen
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
--
Best Regards
Yuchen
So just use Rectangle :) or Item if you just want an empty item, or
Component to load some QML from file.
BR,
Filip Piechocki
Post by Yuchen Deng
Actually, I don't really want an MDI interface. I just want load or open
another qml as child Window show inside the parent.
http://picpaste.com/sub-window-y43R1Kuf.png
http://picpaste.com/no-sub-window-Jq7qeOu5.png
What do you mean by sub window? If you mean you are trying to create an
Post by Rutledge Shawn
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.
Post by Yuchen Deng
hi, list! I have to ask for help because I can't create an sub window
on Window {...}.
Post by Yuchen Deng
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.
Post by Yuchen Deng
Any help / tips are very welcome!
Thanks you!
--
Best Regards
Yuchen
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
--
Best Regards
Yuchen
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
The best way is to use a Loader item.
Olivier
Le Lundi 2 juin 2014 10h58, Filip Piechocki <***@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 <***@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
http://picpaste.com/no-sub-window-Jq7qeOu5.png
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.
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
http://lists.qt-project.org/mailman/listinfo/interest
--
Best Regards
Yuchen
_______________________________________________
Interest mailing list
http://lists.qt-project.org/mailman/listinfo/interest
Post by BOUCARD Olivier
The best way is to use a Loader item.
thx. like this?
Post by BOUCARD Olivier
import QtQuick 2.2
Rectangle {
id: root
visible: true
width: 760; height: 520
color: "red"
Loader { id: pageLoader }
MouseArea {
anchors.fill: parent
onClicked: pageLoader.source = "subwindow2.qml"
}
}
--
Best Regards
Yuchen
Yes Yuchen. But you should anchor the Loader like any other item.
Le Lundi 2 juin 2014 12h23, Yuchen Deng <***@gmail.com> a écrit :
2014-06-02 16:59 GMT+08:00 BOUCARD Olivier <***@yahoo.fr>:
The best way is to use a Loader item.
thx. like this?
import QtQuick 2.2
Rectangle {
id: root
visible: true
width: 760; height: 520
color: "red"
Loader { id: pageLoader }
MouseArea {
anchors.fill: parent
onClicked: pageLoader.source = "subwindow2.qml"
}
}
--
Best Regards
Yuchen