Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved EGLFS: OpenGL windows cannot be mixed with others.

    QML and Qt Quick
    2
    4
    3747
    Loading More Posts
    • 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.
    • R
      Rohn last edited by

      I am using below code to launch my window application(qml file loading) using PyQt5.QQuickView
      @test.py
      import os
      import sys

      from PyQt5.QtCore import QUrl
      from PyQt5.QtGui import QGuiApplication
      from PyQt5.QtQuick import QQuickView
      from PyQt5.QtWebEngine import QtWebEngine

      if name == 'main':
      sys.argv.extend(['-platform', 'eglfs'])
      app = QGuiApplication(sys.argv)
      app.setApplicationName("Hello World")

      QtWebEngine.initialize()
      view = QQuickView()
      view.setResizeMode(QQuickView.SizeRootObjectToView)
      view.setSource(
          QUrl.fromLocalFile(os.path.join(os.path.dirname(__file__), 'myScrollView.qml'))
      
      )
      
      view.show()
      
      sys.exit(app.exec_())
      

      But I am getting an error as below

      @error


      QQuickView does not support using windows as a root item.

      If you wish to create your root window from QML, consider using QQmlApplicationEngine instead.

      EGLFS: OpenGL windows cannot be mixed with others.
      sh: line 1: 10864 Aborted env "PYTHONUNBUFFERED"="1" "PYTHONPATH"="/home/root/.pycharm_helpers/pycharm_matplotlib_backend:/otis:/otis/protocols/generated" "PYCHARM_HOSTED"="1" "JETBRAINS_REMOTE_RUN"="1" "PYCHARM_MATPLOTLIB_PORT"="64833" "PYTHONIOENCODING"="UTF-8" /usr/bin/python3.5 -u /otis/temp/pyqt_file.py

      Process finished with exit code 134


      How to overcome this issue, please help me to resolve this issue.......I am using following in qml file

      @qml file
      import QtQuick 2.0
      import QtQuick.Window 2.1
      import QtQuick.Controls 2.0

      Window{

      }


      Please let me know how to overcome those errors

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Either follow the suggestion made:
        @Rohn said in EGLFS: OpenGL windows cannot be mixed with others.:

        If you wish to create your root window from QML, consider using QQmlApplicationEngine instead.

        Or take a look at this example. It's C++ but you can translate it pretty easily in Python.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        R 1 Reply Last reply Reply Quote 0
        • R
          Rohn @SGaist last edited by

          @SGaist No , there is nothing related to my issue....please let me know the way to load the QML file(running application) using mentioned @test.py file using PyQt5 binding

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Yes it does since it's showing how to handle a QML file using a Window component.

            Anyway here's how to load properly your Window based QML file:

            engine =  QQmlApplicationEngine()
            engine.load(QUrl.fromLocalFile(os.path.join(os.path.dirname(__file__), 'myScrollView.qml')));
            

            And here's an improved version of your QML object to ensure there's something to show:

             Window{
                 visible: true
                 width: 512
                 height: 300
             
                 Text {
                     anchors.centerIn: parent
                     text: "Hello World!"
                 }
             }
            

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 1
            • First post
              Last post