How to use QUiLoader to load cutom widget plugin under QtEmbedded?
-
Dear all,
QUiLoader can load my custom widget plugin under Ununtu 10.10. However, I cross compile the plugin and my app using QUiLoader and deploy them to my target device. My app can not load my custom widget plugin. How can I make it?
Thanks.
Best regards,
Weilly -
Are you able to get it working on your host machine (without cross compiling)? And you need to provide more information about your code or may be you can post your code because there could be any small mistake you must be making like "wrong path of the plugin".
Make sure you get the name of your plugin when you call the method @QUiLoader::availableWidgets@also dont forget to call @addPluginPath@ before you try to load the plugin and UI.
-
Dear Yogesh,
Q1: Are you able to get it working on your host machine (without cross compiling)?
A1: Yes.Q2: Make sure you get the name of your plugin when you call the method
A2: Yes. I am sure the Path is no problem as below.[My App]
QUiLoader loader;qDebug() << loader.pluginPaths();
loader.addPluginPath("/home/test/designer");
qDebug() << loader.pluginPaths();QFile file("test.ui"); //which is generated by Designer including my custom widget
file.open(QFile::ReadOnly);
QWidget *widget = loader.load(&file);
file.close();QStringList availableWidgets = loader.availableWidgets();
qDebug() << availableWidgets;if(availableWidgets.contains("MyTestButton"))
qDebug() << "Has MyTestButton";
else
qDebug() << "No MyTestButton";[MyTestButton]
I just use Creator to create a project.
[Other Project]->[Qt Custome Designer Widget]I put this custom widget plugin to Designer. So, Designer can generate test.ui which includes MyTestButton info.. The error message I got at my target device as below:
"QFormBuilder was unable to create a custom widget of the class 'MyTestButton' ; defaulting to base class 'QWidget'."I am not sure if I make my cross compiling environment by static not shared. Because I will get make error when I use shared.
./configure -prefix /usr/local/test -static -embedded arm -make tools -xplatform qws/linux-arm-g++ -vP.S.
- My host machine is Ubuntu 10.10
- My toolchain
http://www.codesourcery.com/public/gnu_toolchain/arm-none-linux-gnueabi/arm-2007q1-10-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
Best regards,
Weilly