Trying to use customwidget in the ui file that is loaded using QtUiLoader class
Hi,
I have a situation.
I am using Qt 4.6.2. I am loading ui using QtUiLoader.load() function. It works fine for Qt provided widgets, but when I create a custom dial derived from QDial and use it in the ui file, that part of ui is blank.
Does anyone know the reason.
Is there any other way I can load a custom widget at runtime?
Thanks
Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader
Your custom widget should be in the plugin path.
Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader
What is plugin path?
Do you mean I should put the .cpp and .h file in that path.
When I load the ui regular way (without QtUILoader) I can see the customwidget. I have included the .cpp and .h files of customwidget in the project.
Thanks
Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader
http://doc.qt.nokia.com/4.6/quiloader.html#pluginPaths
Check what the output is of that function, then add your widget to that path. And I guess, it needs to be the object (compiled widget)
Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader
Sorry for the basic questions but, how do I compile the widget? it would be great if you can give me a command to do that.
thanks
Re: Trying to use customwidget in the ui file that is loaded using QtUiLoader
Actually I got a solution to the problem. Its in examples/script/qstetrix example. We have to create a custom QUiLoader class and implement createWidget() function. In that we will have to create our custom widgets differently then the Qt native widgets.