0

I'm using PyQt6 and found this instruction how to add plugins to QtDesigner. It worked fine for me and I can see my custom widgets as expected, however, when I use pyuic6 the compilation of the mainpage (which contains such a custom widget) doesn't succeed.

I suspect the reason is that in the Ui-file of the mainpage, there are custom widgets listed but QtDesigner doesn't resolve the path to the definition of these custom widgets. (pyuic states that custom_widget.findtext("header") return None instead of a str)

MainPage.ui:

<ui>
 ...
 <customwidgets>
  <customwidget>
   <class>CustomWidget</class>
  </customwidget>
 </customwidgets>
 ...
</ui>

So how do I tell pyuic6 to use these plugins?

Currently I'm running pyqt6-tools designer -p ./designer_plugins_dir/ from my venv to launch QtDesigner. Is there a way to pass pyuic also a plugins directory or is there a special location in the filesystem where all plugins must be saved to?

  • Did you include the plugin path in the current `$PYTHONPATH` env? – musicamante Aug 25 '23 at 14:14
  • Sorry for the late reply, yes I just tried to do so by running ```export PYTHONPATH=';'``` but it didn't work. I think the env-var isn't even updated because, when I run ```pyqt6-tools designer -p ./designer_plugins_dir/``` again, it doesn't show the added Path at PYTHONPATH in the debug information – Xirraolyphus Aug 28 '23 at 07:20
  • Actually, I was wrong: that env is only important for Designer (the fact that you don't see it is probably caused by other aspects), not when loading the UI from code, since it should work even if Designer is not installed, and the UI really doesn't care about plugins, since they are just used in Designer. – musicamante Aug 28 '23 at 10:55

1 Answers1

0

I found the issue. I simply forgot to overwirte the "includeFile()" method which does exactly return a string containing information how pyuic6 should import custom widget.