Qt Creator Pyside6 project QML modules not found
-
I installed Qt6 in my home directory and am trying to use it for PySide6 Qml projects. I am able to create a project and when prompted I let the Ide download and install PySide6 in the project .qtcreator subdirectory, but when I open a Qml file I get these errors/warnings
and the Qml editor autocomplete does not work. The project runs though and the Qml window is shown. Based on the above messages I tried to add my Qt6 installation Qml directory like this
This is my Qt6 installation directory
When I create a C++ Qml project the Qml editor autocomplete works.
-
@Anonimista said in Qt Creator Pyside6 project QML modules not found:
I installed Qt6 in my home directory and am trying to use it for PySide6 Qml projects
Is not going to work - this installation has nothing to do with PySide6. Install PySide packages containing what you need.
For example on Ubuntu there is python3-pyside2.qtqml to get QML in PySide. How to install these packages (and which packages) depends on how you installed PySide6 and on what distribution. -
Thanks that's a step in the right direction.
When I created the project I was prompted that Qt Creator needs to create a Python virtual environment and install PySide6. I clicked Ok and the virtual environment was installed in the .qtcreator subdirectory of the project
The project runs ok and the Qml window is shown. I can add QtQuick controls etc and the only thing that's missing is autocomplete int the Qml editor.
This is the message from the Qml editor
and this is my attempt to appent to QML_IMPORT_PATH in the project environment
This doesn't work sadly. The project still executes but the autocomplete is not there
So after I attempt to add my Qml installation directory to QML_IMPORT_PATH it is not successful and the message still shows QML_IMPORT_PATH without it
-
So after trying all possible suggestions from the yellow popup this is what worked: the untitled9.pyproject file contents
{ "qmlImportPaths": [ "/home/jon/Documents/QtDesignerProjects/untitled9/.qtcreator/Python_3_12_4venv/lib/python3.12/site-packages/PySide6/Qt/qml/" ], "files": [ "main.py", "main.qml" ] }
This is according to the message for Qbs projects, declare and set a qmlImportPaths property...
Now I can import Qml modules and have autocomplete in the Qml editor
-