Class name mismatch when creating custom widget from QtDesigner
I am coding a plugin for the Designer to add some widgets I have created. Before adding the code, I created the project through File -> New Project -> Other Project -> Qt Custom Designer Widget.
If I add a custom widget that inherits straight from QWidget, i.e. QWidget -> MyWidget, it shows nicely in the Designer. But most of my widgets does not inherit directly from QWidget. Instead, they inherit from a custom base class that implements some shared functionality, e.g. QWidget -> MyScale -> MyCompass.
When this happens, although MyCompass is shown correctly by the Designer, a dialog appears with the message: "Designer: A class name mismatch occurred when creating a widget using the custom widget factory registered for widgets of class MyCompass. It returned a widget of class MyScale.
If I check the UI file generated by the Designer, it really registers the widget as MyScale, instead of MyCompass.
How can I fix this?