qt - Pyqt5 & QML2 deploy on debian/mint (dev - ubuntu) -
i have pyqt5 application uses qml2 frontend. while migrating developer's (my) machine (mint qiana, debian sid) stucks on importing qtquick.dialogs 1.1
.
error can reproduced on fresh docker
containers running debian-sid
image.
my test python script:
from pyqt5 import qtwidgets, qtwidgets, qtcore, uic pyqt5.qtcore import pyqtproperty, qcoreapplication, qobject, qurl pyqt5.qtqml import qmlregistertype, qqmlcomponent, qqmlengine class commonqmlwindow(): def __init__(self, qml_file_name): self._engine = qqmlengine() component = qqmlcomponent(self._engine) # stuck here (line below - component.loadurl) component.loadurl(qurl(qml_file_name)) self.qml_window = component.create() if self.qml_window none: error in component.errors(): print(error.tostring()) exit(1) ui import commonqmlwindow
loading:
from pyqt5 import qtwidgets, qtwidgets, qtcore, uic pyqt5.qtcore import pyqtproperty, qcoreapplication, qobject, qurl pyqt5.qtqml import qmlregistertype, qqmlcomponent, qqmlengine class mainwindow(commonqmlwindow.commonqmlwindow): def __init__(self, parent=none): commonqmlwindow.commonqmlwindow.__init__(self, 'ui/test.qml')
qml file:
import qtquick 2.0 import qtquick.dialogs 1.1 import qtgraphicaleffects 1.0 import qtquick.controls 1.1 import qtquick.controls.styles 1.2 import "." controls import "../uihelpers.js" uihelpers textfield { id: rootitem property bool pickdirectory: false property alias pickertitle: picker.title property alias pickerselectmask: picker.namefilters property alias selectedurl: picker.fileurl readonly: true filedialog { id: picker selectfolder: rootitem.pickdirectory ? true : false } }
main.py:
app = qtwidgets.qapplication(sys.argv) main_window = mainwindow.mainwindow() app.exec()
all packages installed (for qml2, python3, pyqt5 , qt5) works this.
this behavior happens on linux mint qiana
, debian sid
. when comment import statment (//import qtquick.dialogs 1.1
) works need filedialog..
versions:
qt version: 5.3.2
pyqt version: 5.3.2
python version: 3.4.2
upd: works on mac os x yosemite not on debian.
here no known reason of behavior @ moment. i've created bugreport , found kinda workaround-solution of problem. problem can avoided using qqmlapplicationengine
instead of qqmlengine
create qml components. seems qqmlengine
buggy because these 2 classes same work.
from pyqt5 import qtqml engine = qtqml.qqmlapplicationengine() engine.load(qtcore.qurl('test.qml')) sys.exit(app.exec())
also i've done attempts reproduce error c++ code seems behavior bad of pyqt5's implementation because works fine c++ backend.
unfortunately can't see bug-tracker of pyqt
project may unfixed long time unless developers see answer.
Comments
Post a Comment