EGLFS: OpenGL windows cannot be mixed with others.
-
I am using below code to launch my window application(qml file loading) using PyQt5.QQuickView
@test.py
import os
import sysfrom PyQt5.QtCore import QUrl
from PyQt5.QtGui import QGuiApplication
from PyQt5.QtQuick import QQuickView
from PyQt5.QtWebEngine import QtWebEngineif 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
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.pyProcess 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.0Window{
}
Please let me know how to overcome those errors
-
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.
-
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!" } }