Multiple UI windows??
-
Hello,
I have a project that has two UI forms (something.ui.qml) that display a certain amount of data. Both of the UI's get their data from a C++ backend. When the project is ran I want each of the UI forms to display their data in seperate windows, so two different windows. I'm wondering the best way to go about this?
-
Found another way of accomplishing this.
Solved here:
https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7 -
hi @texasRanger
I'm not an expert with .ui forms in qml, but have you tried to simply change the root element to
Window
which should make it a modal(separate) window by default -
Have 2 Window objects and put your UI forms in them
-
@GrecKo I tried that as well, but no windows appear when doing that. Is this what you meant?
Item { Window { objectName: "wnd1" visible: true width: 400 height: 400 FirstForm { } } Window { objectName: "wnd2" visible: true width: 400 height: 400 SecondForm { } } }
-
For some reason it does not work when in an
Item
, it works with aQtObject
though:QtObject { property Window win1: Window { objectName: "wnd1" visible: true width: 400 height: 400 } property Window win2: Window { objectName: "wnd2" visible: true width: 400 height: 400 } }
-
@GrecKo When I format it like that the windows pop up, but they are blank. They do not display the actual UI formatting...
//main.qml QtObject { property Window window1: Window { objectName: "wnd1" visible: true width: 700 height: 700 title: qsTr("window1") } property Window window2: Window { objectName: "wnd2" visible: true width: 450 height: 600 title: qsTr("window2") } } //FirstForm window1 { //UI formating } //SecondForm window2 { //UI formating }
-
Found another way of accomplishing this.
Solved here:
https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7 -
@texasRanger said in Multiple UI windows??:
Solved here:
https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7The solution in this post is unnecessarily complicated.
In your question about them being blank I don't understand what you are doing
//main.qml QtObject { property Window window1: Window { visible: true // ... } }
//FirstForm window1 { //UI formating }
How are those two related?
Why not do this?
//main.qml QtObject { property Window window1: Window { visible: true // ... FirstForm { anchors.fill: parent } } }