[PyQt] PyQT5, QML and grid layout problems on OS X.
Phil Thompson
phil at riverbankcomputing.com
Wed Jul 20 10:19:14 BST 2016
On 19 Jul 2016, at 10:11 pm, M Jérôme LAURENS <jerome.laurens at u-bourgogne.fr> wrote:
>
> Hi there,
>
> Sorry for being long but that is a very annoying problem.
>
> I started from a basic tutorial on using PyQT quick application available at
>
> http://ceg.developpez.com/tutoriels/pyqt/qt-quick-python/02-interaction-qml-python/
>
> Basically it creates a UI with label and buttons and interface a qml file with python.
> My first problem was that python did not find the qml modules, I had to insert something like
>
> engine = QQmlApplicationEngine()
> engine.addImportPath(".../Qt/5.6/clang_64/qml/")
>
> or use QML2_IMPORT_PATH=".../Qt/5.6/clang_64/qml"
You shouldn't need to do that.
> First questions : is it the expected way of declaring qml module location ?
> What about other platforms ? (my app will target iOS, android…)
> What about deployment ?
>
> Once qml is properly configured from the python side, I can observe that grid layout is not working as expected.
>
> Below is a minimal (non) working example. qmlscene shows 4 labels on a 2x2 grid and this is exactly what I obtain with the cpp version. But the pyqt5 version displays both labels at the same place, one above the other like on a 1x1 grid. I reinstalled pyqt5 from source, no change.
Works fine for me with current snapshots.
Phil
More information about the PyQt
mailing list