1

The PyQt5 docs says

"New signals defined in this way will be automatically added to the class’s QMetaObject. This means that they will appear in Qt Designer"

How do I make anything appear in QtDesigner if it only knows how to open *.ui files, but not python files?

In my workflow I create ui-file with QtDesigner, then convert it to python using pyuic5. It is thus a one-way conversion (I then subclass it in another file to avoid my code being overwritten).

How do I make QtDesigner "see" my python code?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
Antony Hatchkins
  • 31,947
  • 10
  • 111
  • 111
  • [This page](https://wiki.python.org/moin/PyQt/Using_Python_Custom_Widgets_in_Qt_Designer) explains how to insert custom widgets in Qt Designer – Heike May 08 '19 at 07:17
  • @Heike so you think this is only for custom widgets? The page I quoted says nothing about custom widgets. I was hoping for some kind of "pyunuic" which would convert the generated python file back to .ui file suitable for working with qtdesigner. – Antony Hatchkins May 08 '19 at 07:27
  • I've seen [this](https://stackoverflow.com/questions/15822786/converting-py-to-ui-file) question and don't feel that I need such a tool, but this docs quote seems to imply it exists. – Antony Hatchkins May 08 '19 at 07:33
  • @eyllanesc Thank you. How do I mark this as the accepted answer? – Antony Hatchkins May 08 '19 at 07:54

1 Answers1

2

Qt Designer recognizes 2 types of elements:

  • The .ui that are the product,

  • And the plugins that are the ingredients.

So if you want a widget to be seen in Qt Designer you must create a plugin, if you download the source code in the folder examples/designer/plugins there is an example.

On the other hand there is no converter from .py to .ui since the transformation is not possible in all cases.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241