Failed to load your qt5 widget plugin? Aha, rookie!!
Just in case anyone else had the same silly problem:
When I use Qt5 to build a widget plugin, after following its official documents, amazingly I didn't find my widget on the widgets window. A day's search and finally I found it was due to the fact that qtcreater is loading plugins from its install dirs, which in my ubuntu12.04 is /opt/Qt5.0.2/Tools/QtCreator/bin/designer, while the interesting thing is that my widget plugin was installed in /opt/Qt5.0.2/5.0.2/gcc/xxxx. So I set the QT_PLUGIN_PATH(which will tell QtDesigner where to load plugins) to that directory , then it worked like a dream.
Now I just think the default plugin install path should be included in the plugin search paths of QtDesigner, isn't it?
Oh, dont modify your custom widget object's default name && dont forget to add INCLUDEPATH & LIBS of your widget to your app's .pro file, like below:
INCLUDEPATH += /path/to/your/plugin's headers
LIBS += /full/pathname/of/your/plugin's lib file
Then off to code :-)
Your approach is not going to work for everybody. The trick is that the widget plugin needs to be built with the Qt version used by Designer and not with the Qt version you are designing UIs for. This is non-obvious, but somewhat logical (once you fell into this trap once), considering that Designer has to load the widget plugin to integrate it into its UI.
So you get away with this since the Qt version you are building your project with and the Qt version used by designer (embedded into Creator in this case) are the same, even though Creator uses its own Qt with its own import paths -- which is why it is looking for the widget plugins in a place you did not expect. But there is no guarantee that this may not change at some point (e.g. due to an update of creator or due to adding/removing Qt versions).