[PyQt] Custom Widget for Designer

David Boddie david at boddie.org.uk
Sat Nov 15 02:06:59 GMT 2008


On Thu Nov 6 14:33:24 GMT 2008, Emiliano Mennucci wrote:

> Now I want to change the name of the widget when it's exported on Designer.
> So class name should remain "WidgetFoo" but I want it to be showed as "A
> custom Widget" in the Designer palette. I'm not able to achieve this simple
> goal. I figured that I have to change the string returned by the method
> WidgetFooPlugin.name, but if I try I get a message while loading designer:
> "Designer: A class name mismatch occurred when creating a widget using the
> custom widget factory registered for widgets of class A custom Widget. It
> returned a widget of class WidgetFoo".
> I've checked all examples contained in pyqt sources but it seems that no
> one tryes to accomplish this.

It's also done that way in the Qt examples. From what I can tell, the only
widgets that are able to use a name that is different to their class name
are built-in to Designer, like QLabel and QPushButton.

> Is there a way to tell Qt Designer to show widget on the palette with a
> different string (not the class name)?

Sadly, I don't think it's possible.

David


More information about the PyQt mailing list