[SOLVED]Qt Plugin metadata
-
Hi,
Did you add the Q_PLUGIN_METADATA line in your plugin header ?
-
[quote author="MichelS" date="1372677981"]You could define an int version() call in your interface:
@
abstract int version()=0;
@and override this in your derived Plugin.[/quote]
Actually this is first solution pinged in head but I want to kknow how to get benefit of Plugin Metadata
-
[quote author="SGaist" date="1372680937"]Hi,
Did you add the Q_PLUGIN_METADATA line in your plugin header ?[/quote]
Sure,
@class MyPlugin : public QObject, Interface
{
Q_OBJECT
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "ly.ecs.plugin.0.0.2" FILE "Plugin.json")
Q_INTERFACES(Interface)
#endif // QT_VERSION >= 0x050000public:
MyPlugin(QObject parent = 0);
QPushButton someObject(QWidget *parent=0);
};@ -
[quote author="Buggy" date="1372753860"]Based on my own experience I am kind of skeptical whenever those macros are involved. Have you tried to re-run qmake (Build - run qmake)? For me, this fixed an error I had been chasing for over an hour...[/quote]
sure I did.
I'm asking about the principle not fixing a problem. -
Hi,
Did you dump the content of pluginLoader.metaData() ?
I just tried with a simple plugin and got the value of name using:
@pluginLoader.metaData().value("MetaData").toObject().value("name").toString();@Also don't forget to "touch" the plugin header file before rebuilding to take the json file modifications in account.
-
As AGalst suggested, you forget the key "MetaData" if you want to get access the json file contents passed in the Q_PLUGIN_METADATA. Other information such as IID can be access through the key "IID" etc.
-
You're welcome !
From the ones I searched through, no, this call for an update to the documentation
-
Correction to the doc would have a wider impact. Can you point me to your wiki entries so I can see what would be a good addition to the official documentation ?
-
For the quick road, I have added a doc note
-
Definately much appreciated. I was trying to use the new metadata interface for the same reasons, and found the same lack of details in the docs. I have my own implementation working properly now (thanks to this thread), but it would be nice to have some references in the docs about this metadata and json structure.