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. EGLFS : OpenGL error while trying to open a new Window in QML
QtWS25 Last Chance

EGLFS : OpenGL error while trying to open a new Window in QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
11 Posts 2 Posters 1.2k 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.
  • G Offline
    G Offline
    Gunkut
    wrote on last edited by Gunkut
    #1

    Hello, I have an app that consists of multiple plages. And user will be able to switch between these pages by button clicks. When I try to open my second window from the main window using:

    Image
    {
       objectName: "background"
       width: parent.width
      height: parent.height
      source:"Imgs/Images/bckgnd.png"
    
    LeftButtons
    {
       id:buttonKontrol
       x: -20
       y:110 
       buttonName: "kontrol"
    
    Loader { id: kontrolPageLoader}
    
    MultiPointTouchArea
    {
       id:touchArea_kontrol
       anchors.fill:parent
       onPressed:
       {
          kontrolPageLoader.source ="KontrolPage.qml"
    }
    }
    }
    

    In the code above, KontrolPage is a window. Now I have some questions:

    1. Why I am getting EGLFS: OpenGL windows cannot be mixed with others error? And how can I solve it?
    2. Which way is better in order to open a new window, using C++ and QDeclarativeComponent or using QML and Loader?
    3. Why I try to open the new window by using QDeclarativeComponent it didn't let me #include <QDeclarativeEngine> also it gave not found module error when I try to add QT += declarative in my*.pro. Why it gives these errors?

    Edit: After I change the Window { ..... } inside the Kontrolpage.qml to Item {.....} . Now with loader, it tries to open the other qml page. (Well it tries because when I press the button, it keeps opening and closing the other page. But doesn't really opening it completely..)

    raven-worxR 1 Reply Last reply
    0
    • G Gunkut

      @raven-worx I see but in QT5 using just id of the loader as pageLoader.source="KontrolPage.qml" does not really open the page. Nothing really changes I just put Loader in Leftbuttons {} and it works, when I put it in Image{} it does not open anything. Or maybe it opens it but size or coordiantes are really nonsense and I cannot see it on the screen?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #8

      @Gunkut
      i guess your Loader is jsut stacked behind your content?
      change the z-value or move it infront of your content by placing it in the end of the elements code

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      G 2 Replies Last reply
      0
      • G Gunkut

        Hello, I have an app that consists of multiple plages. And user will be able to switch between these pages by button clicks. When I try to open my second window from the main window using:

        Image
        {
           objectName: "background"
           width: parent.width
          height: parent.height
          source:"Imgs/Images/bckgnd.png"
        
        LeftButtons
        {
           id:buttonKontrol
           x: -20
           y:110 
           buttonName: "kontrol"
        
        Loader { id: kontrolPageLoader}
        
        MultiPointTouchArea
        {
           id:touchArea_kontrol
           anchors.fill:parent
           onPressed:
           {
              kontrolPageLoader.source ="KontrolPage.qml"
        }
        }
        }
        

        In the code above, KontrolPage is a window. Now I have some questions:

        1. Why I am getting EGLFS: OpenGL windows cannot be mixed with others error? And how can I solve it?
        2. Which way is better in order to open a new window, using C++ and QDeclarativeComponent or using QML and Loader?
        3. Why I try to open the new window by using QDeclarativeComponent it didn't let me #include <QDeclarativeEngine> also it gave not found module error when I try to add QT += declarative in my*.pro. Why it gives these errors?

        Edit: After I change the Window { ..... } inside the Kontrolpage.qml to Item {.....} . Now with loader, it tries to open the other qml page. (Well it tries because when I press the button, it keeps opening and closing the other page. But doesn't really opening it completely..)

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #2

        @Gunkut said in EGLFS : OpenGL error while trying to open a new Window in QML:

        Why I am getting EGLFS: OpenGL windows cannot be mixed with others error? And how can I solve it?

        EGLFS only supports a single window by design, no way around it.

        Which way is better in order to open a new window, using C++ and QDeclarativeComponent or using QML and Loader?

        There is no "better" per se. Depends on your project i would say.

        Why I try to open the new window by using QDeclarativeComponent it didn't let me #include <QDeclarativeEngine> also it gave not found module error when I try to add QT += declarative in my*.pro. Why it gives these errors?

        QDeclarativeComponent is QML1/Qt4 and not what you expect when you do QT += declarative with Qt5

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        G 1 Reply Last reply
        0
        • raven-worxR raven-worx

          @Gunkut said in EGLFS : OpenGL error while trying to open a new Window in QML:

          Why I am getting EGLFS: OpenGL windows cannot be mixed with others error? And how can I solve it?

          EGLFS only supports a single window by design, no way around it.

          Which way is better in order to open a new window, using C++ and QDeclarativeComponent or using QML and Loader?

          There is no "better" per se. Depends on your project i would say.

          Why I try to open the new window by using QDeclarativeComponent it didn't let me #include <QDeclarativeEngine> also it gave not found module error when I try to add QT += declarative in my*.pro. Why it gives these errors?

          QDeclarativeComponent is QML1/Qt4 and not what you expect when you do QT += declarative with Qt5

          G Offline
          G Offline
          Gunkut
          wrote on last edited by
          #3

          @raven-worx Thanks raven so I put an Item instead of Window in the KontrolPage.qml and error is gone. When I use the above code new window gets the size of LeftButtons but I want to have it the size of Window. So I take Loader out of LeftButtons and put it in window{} as follows:

          
               Window {
                  id:main
                  width:640
                  height:480
                  
                  Loader {
           id: kontrolPageLoader
          anchors.fill:parent
          }
              
                  Image
                  {
                     objectName: "background"
                     width: parent.width
                    height: parent.height
                    source:"Imgs/Images/bckgnd.png"
                  
                  LeftButtons
                  {
                     id:buttonKontrol
                     x: -20
                     y:110 
                     buttonName: "kontrol"
                  
                  
                  
                  MultiPointTouchArea
                  {
                     id:touchArea_kontrol
                     anchors.fill:parent
                     onPressed:
                     {
                        kontrolPageLoader.source ="KontrolPage.qml"
                  }
                  }
                  }
                  }
          

          In this way, loader does not open the new page. How can I find a way around?
          PS: Sorry for bad indentation, code is in linux in virtual machine so I couldn't copy pasted it.

          raven-worxR 1 Reply Last reply
          0
          • G Gunkut

            @raven-worx Thanks raven so I put an Item instead of Window in the KontrolPage.qml and error is gone. When I use the above code new window gets the size of LeftButtons but I want to have it the size of Window. So I take Loader out of LeftButtons and put it in window{} as follows:

            
                 Window {
                    id:main
                    width:640
                    height:480
                    
                    Loader {
             id: kontrolPageLoader
            anchors.fill:parent
            }
                
                    Image
                    {
                       objectName: "background"
                       width: parent.width
                      height: parent.height
                      source:"Imgs/Images/bckgnd.png"
                    
                    LeftButtons
                    {
                       id:buttonKontrol
                       x: -20
                       y:110 
                       buttonName: "kontrol"
                    
                    
                    
                    MultiPointTouchArea
                    {
                       id:touchArea_kontrol
                       anchors.fill:parent
                       onPressed:
                       {
                          kontrolPageLoader.source ="KontrolPage.qml"
                    }
                    }
                    }
                    }
            

            In this way, loader does not open the new page. How can I find a way around?
            PS: Sorry for bad indentation, code is in linux in virtual machine so I couldn't copy pasted it.

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #4

            @Gunkut
            https://doc.qt.io/qt-5/qml-qtquick-loader.html#loader-sizing-behavior

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            G 1 Reply Last reply
            0
            • raven-worxR raven-worx

              @Gunkut
              https://doc.qt.io/qt-5/qml-qtquick-loader.html#loader-sizing-behavior

              G Offline
              G Offline
              Gunkut
              wrote on last edited by
              #5

              @raven-worx Yes I have checked that document. My problem is not really about sizing but using in outside of Leftbuttons. I will have more than 1 page than I can open from the main page. So I need to put that Loader out of Leftbuttons. Otherwise I need to have more than 1 loader in each of the button widget.

              raven-worxR 1 Reply Last reply
              0
              • G Gunkut

                @raven-worx Yes I have checked that document. My problem is not really about sizing but using in outside of Leftbuttons. I will have more than 1 page than I can open from the main page. So I need to put that Loader out of Leftbuttons. Otherwise I need to have more than 1 loader in each of the button widget.

                raven-worxR Offline
                raven-worxR Offline
                raven-worx
                Moderators
                wrote on last edited by
                #6

                @Gunkut
                In Qt5 you can simply access the id of the loader (as long as it is in the same or parent context).
                This should be avoided with Qt6. You can pass the loader as a property by id. (create property with type Loader/Item and pass assign the loader by its id to it. then you have a reference to the loader)

                --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                If you have a question please use the forum so others can benefit from the solution in the future

                G 1 Reply Last reply
                0
                • raven-worxR raven-worx

                  @Gunkut
                  In Qt5 you can simply access the id of the loader (as long as it is in the same or parent context).
                  This should be avoided with Qt6. You can pass the loader as a property by id. (create property with type Loader/Item and pass assign the loader by its id to it. then you have a reference to the loader)

                  G Offline
                  G Offline
                  Gunkut
                  wrote on last edited by
                  #7

                  @raven-worx I see but in QT5 using just id of the loader as pageLoader.source="KontrolPage.qml" does not really open the page. Nothing really changes I just put Loader in Leftbuttons {} and it works, when I put it in Image{} it does not open anything. Or maybe it opens it but size or coordiantes are really nonsense and I cannot see it on the screen?

                  raven-worxR 1 Reply Last reply
                  0
                  • G Gunkut

                    @raven-worx I see but in QT5 using just id of the loader as pageLoader.source="KontrolPage.qml" does not really open the page. Nothing really changes I just put Loader in Leftbuttons {} and it works, when I put it in Image{} it does not open anything. Or maybe it opens it but size or coordiantes are really nonsense and I cannot see it on the screen?

                    raven-worxR Offline
                    raven-worxR Offline
                    raven-worx
                    Moderators
                    wrote on last edited by
                    #8

                    @Gunkut
                    i guess your Loader is jsut stacked behind your content?
                    change the z-value or move it infront of your content by placing it in the end of the elements code

                    --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                    If you have a question please use the forum so others can benefit from the solution in the future

                    G 2 Replies Last reply
                    0
                    • raven-worxR raven-worx

                      @Gunkut
                      i guess your Loader is jsut stacked behind your content?
                      change the z-value or move it infront of your content by placing it in the end of the elements code

                      G Offline
                      G Offline
                      Gunkut
                      wrote on last edited by
                      #9

                      @raven-worx Yes raven thank you. changin z- value worked.

                      1 Reply Last reply
                      0
                      • raven-worxR raven-worx

                        @Gunkut
                        i guess your Loader is jsut stacked behind your content?
                        change the z-value or move it infront of your content by placing it in the end of the elements code

                        G Offline
                        G Offline
                        Gunkut
                        wrote on last edited by
                        #10

                        @raven-worx In order to come back to main page from a page that I opened from loader. Should I use another loader in the new qml page or is there an easy and more appropriate way to come back main page. (like setting source=.). And the last question, can I have a loader in a page that is opened by a loader? Something like nested loaders? Sorry for too much questions but unfortunately QT docs are not really clear and detailed about QML as they are in QWidgets etc.

                        raven-worxR 1 Reply Last reply
                        0
                        • G Gunkut

                          @raven-worx In order to come back to main page from a page that I opened from loader. Should I use another loader in the new qml page or is there an easy and more appropriate way to come back main page. (like setting source=.). And the last question, can I have a loader in a page that is opened by a loader? Something like nested loaders? Sorry for too much questions but unfortunately QT docs are not really clear and detailed about QML as they are in QWidgets etc.

                          raven-worxR Offline
                          raven-worxR Offline
                          raven-worx
                          Moderators
                          wrote on last edited by raven-worx
                          #11

                          @Gunkut
                          i think you are better off by using a StackView element instead of a loader.
                          To push (a new page) into or pop (remove the current page) the StackView in which your current page/window currently is use the provided attached properties (e.g. StackView.view.push() / StackView.view.pop())

                          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                          If you have a question please use the forum so others can benefit from the solution in the future

                          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