pyside6-uic with customwidget
-
Hi,
I have a Qt project created in Qt designer wich use a ressource file myapp.qrc and a customwidget.
I can convert the myapp.ui file to a python script with the following command :
pyside6-uic -o myapp_ui.py myapp.ui
Then I get the following code inside myapp_ui.py :
from custom_widget import pathLineEdit
import myapp_rcI need to deploy my project as a python package, so I would like to use relative imports.
Therefore I added the option --from-imports to pyside6-uic :pyside6-uic --from-imports -o myapp_ui.py myapp.ui
Then I get :
from custom_widget import pathLineEdit
from . import myapp_rcIt seems that the --from-imports options didn't change anything for my custom_widget.
What is the proper way to have relative import for customwidget with pyside6-uic ?
Best regards,
-
From reading the docs the option
--from-imports
is only applicable to resource files.
https://doc.qt.io/qt-6/designer-using-a-ui-file-python.html (UnderResource Imports
).I believe you might have to modify the file manually?