Re: Can't load custm widget
QFormBuilder? Are you trying to run-time load the .ui file instead of generating code via UIC?
Cheers,
_
Re: Can't load custm widget
Hi
Yes, I also verified the problem is not in the widget.
In my project I'm using QUiLoader to dynamically load ui files containing the custom widgets.
My widget is not in the available widgets list.
In other forums they suggest to override QUiLoader::createWidget(const QString &className, QWidget *parent, const QString &name)
But then how can I create an instance of my widget and set its properties contained in the .ui file?
Re: Can't load custm widget
I finally managed to do it
This is the hint I was given in another forum:
If I'm not mistaken, you only need to create the widget in that method. It's a factory (don't forget to call the parent class' implementation first, as noted in the documentation) that will create widgets based on class name. So I believe you only have to create the appropriate widget (with the provided parent) that's corresponding to the class name. (the last parameter is the object name, which you should also set, to be fully compliant).
The properties should be set by the Ui loader if I'm not in error.
Re: Can't load custm widget
Quote:
Originally Posted by
Prisco
Hi
In other forums they suggest to override QUiLoader::createWidget(const QString &className, QWidget *parent, const QString &name)
If you are loading the ui dynamically, then you need to let the UI loader have a way of instantiating your widget, it can't magically create widgets it doesn't know anything about.
So you either do that by reimplementing createWidget() or, I think, by providing a widget plugin.
Cheers,
_