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??
QtWS25 Last Chance

Multiple UI windows??

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlc++windowmulti-screenui.qml
9 Posts 3 Posters 1.9k Views
  • 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 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.HilkJ 1 Reply Last reply
    0
    • T Offline
      T Offline
      texasRanger
      wrote on 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

      GrecKoG 1 Reply Last reply
      0
      • T texasRanger

        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.HilkJ Offline
        J.HilkJ Offline
        J.Hilk
        Moderators
        wrote on 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
        0
        • J.HilkJ J.Hilk

          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 last edited by
          #3

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

          1 Reply Last reply
          0
          • GrecKoG Offline
            GrecKoG Offline
            GrecKo
            Qt Champions 2018
            wrote on last edited by
            #4

            Have 2 Window objects and put your UI forms in them

            T 1 Reply Last reply
            0
            • GrecKoG GrecKo

              Have 2 Window objects and put your UI forms in them

              T Offline
              T Offline
              texasRanger
              wrote on 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
              • GrecKoG Offline
                GrecKoG Offline
                GrecKo
                Qt Champions 2018
                wrote on 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
                1
                • GrecKoG GrecKo

                  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 last edited by texasRanger
                  #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 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

                    GrecKoG 1 Reply Last reply
                    0
                    • T texasRanger

                      Found another way of accomplishing this.

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

                      GrecKoG Offline
                      GrecKoG Offline
                      GrecKo
                      Qt Champions 2018
                      wrote on last edited by GrecKo
                      #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

                      • Login

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