Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Multiple UI windows??
Forum Updated to NodeBB v4.3 + New Features

Multiple UI windows??

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlc++windowmulti-screenui.qml
9 Posts 3 Posters 2.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    texasRanger
    wrote on 3 Aug 2020, 22:38 last edited by
    #1

    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?

    J 1 Reply Last reply 4 Aug 2020, 07:43
    0
    • T Offline
      T Offline
      texasRanger
      wrote on 6 Aug 2020, 23:08 last edited by
      #8

      Found another way of accomplishing this.

      Solved here:
      https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7

      G 1 Reply Last reply 7 Aug 2020, 08:03
      0
      • T texasRanger
        3 Aug 2020, 22:38

        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?

        J Offline
        J Offline
        J.Hilk
        Moderators
        wrote on 4 Aug 2020, 07:43 last edited by
        #2

        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


        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


        Q: What's that?
        A: It's blue light.
        Q: What does it do?
        A: It turns blue.

        T 1 Reply Last reply 4 Aug 2020, 15:09
        0
        • J J.Hilk
          4 Aug 2020, 07:43

          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

          T Offline
          T Offline
          texasRanger
          wrote on 4 Aug 2020, 15:09 last edited by
          #3

          @J-Hilk Yeah... However, the Window type isn't supported as a root element.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            GrecKo
            Qt Champions 2018
            wrote on 4 Aug 2020, 15:27 last edited by
            #4

            Have 2 Window objects and put your UI forms in them

            T 1 Reply Last reply 4 Aug 2020, 15:52
            0
            • G GrecKo
              4 Aug 2020, 15:27

              Have 2 Window objects and put your UI forms in them

              T Offline
              T Offline
              texasRanger
              wrote on 4 Aug 2020, 15:52 last edited by
              #5

              @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 {
                      }
                  }
              }
              
              1 Reply Last reply
              0
              • G Offline
                G Offline
                GrecKo
                Qt Champions 2018
                wrote on 4 Aug 2020, 16:41 last edited by
                #6

                For some reason it does not work when in an Item, it works with a QtObject 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
                    }
                }
                
                T 1 Reply Last reply 5 Aug 2020, 20:26
                1
                • G GrecKo
                  4 Aug 2020, 16:41

                  For some reason it does not work when in an Item, it works with a QtObject 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
                      }
                  }
                  
                  T Offline
                  T Offline
                  texasRanger
                  wrote on 5 Aug 2020, 20:26 last edited by texasRanger 8 May 2020, 20:30
                  #7

                  @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
                  }
                  
                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    texasRanger
                    wrote on 6 Aug 2020, 23:08 last edited by
                    #8

                    Found another way of accomplishing this.

                    Solved here:
                    https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7

                    G 1 Reply Last reply 7 Aug 2020, 08:03
                    0
                    • T texasRanger
                      6 Aug 2020, 23:08

                      Found another way of accomplishing this.

                      Solved here:
                      https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7

                      G Offline
                      G Offline
                      GrecKo
                      Qt Champions 2018
                      wrote on 7 Aug 2020, 08:03 last edited by GrecKo 8 Jul 2020, 08:05
                      #9

                      @texasRanger said in Multiple UI windows??:

                      Solved here:
                      https://forum.qt.io/topic/99477/multiwindow-in-qml-proof-of-concept/7

                      The 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
                              }
                          }
                      }
                      
                      1 Reply Last reply
                      0

                      3/9

                      4 Aug 2020, 15:09

                      topic:navigator.unread, 6
                      • Login

                      • Login or register to search.
                      3 out of 9
                      • First post
                        3/9
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved