Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

PyQt5 / QML Library Paths



  • Hello,

    I'm working with a codebase that uses QML for the GUI and python for all backend code. Currently, I am attempting to integrate a 3D model viewer that is capable of viewing STL files. According to the docs I've read and my own experimentation, QtQuick does not support STL viewing, but Qt3D does, so I have tried to install Qt3D, but I still get told that the library is not installed when I try to run my program. It turns out that the library path that I thought was being referenced by all of my QML imports is not actually being referenced at all. I changed and moved folders in there and it didn't affect anything. So my question mostly is where do I need to put my Qt3D library folder to make the import statement recognize that I have it. Is there a way to find out? I'm running this on a windows computer and I'm happy to provide other details and specs as requested.

    Thanks all


  • Lifetime Qt Champion

    Hi,

    Did you try with PySide6 ?



  • I think I've seen a couple references to PySide stuff. Can you explain to me what exactly the difference is between PySide and PyQt5? My current understanding is that I'll need to embed this viewer into the QML code, not the python code, which is why I'm gunning for Qt3D.

    Side note, you'll have to bear with me on all of this stuff. I've been working with the codebase for a decent while, but I haven't had to do anything using packages other than what I inherited with the codebase, so I haven't been through any library management / source code building / etc. for Qt until late last week.



  • @SGaist - I've been looking into pyside some. It looks like PS6 requires PyQt6, which I don't have, so I installed PS2, which is supposed to work with PyQt5. I'm not really sure where that gets me, because I don't see any 3D libraries in the documentation for it. I went back to trying to get the Qt3D library I have to import into my qml code and I was able to get a direct path import going as far as another error message. I now have

    import "../Qt3D/Core"

    with the library folder just copied into my project, and I get the message

    plugin cannot be loaded for module "C:.TouchDev.TouchApp.Qt3D.Core": Module namespace 'Qt3D.Core' does not match import URI 'C:.TouchDev.TouchApp.Qt3D.Core'

    I'm not sure what this means precisely. My gut says it's something to do with the fact that there is a DLL file in the /Core folder and not any QML files, but I don't know what to do about that anyway. I'm going to keep messing around with things, but I figured I would post an update.



  • @Elkelthen said in PyQt5 / QML Library Paths:

    I've been looking into pyside some. It looks like PS6 requires PyQt6, which I don't have, so I installed PS2, which is supposed to work with PyQt5.

    I'm afraid the following does not answer your question, but you need a little clarity in your statement above going forward.

    PySide6 requires Qt6. PySide2 requires Qt5.

    PyQt is an alternative to PySide. You would never use/want both together, only one or the other. PyQt has its own versions PyQt6 and PyQt5 to mirror PySide6 and PySide2.

    Pick either PySide or PyQt and stick with it. PySide is written by The Qt Company and has same LGPL licence as Qt has. PyQt is written by a third-party, Riverbank, and has the more restrictive GPL licence (still OpenSource "free", but requires you to make the source code of your project visible to end users).



  • @JonB Ah, thank you for that. We already use PyQt5 throughout the python side of the program, so it sounds like that's what I'll have to continue using.


Log in to reply