Some issues in plugin design...
-
This is how it works:
@define Q_EXPORT_PLUGIN2(PLUGIN, PLUGINCLASS) \
Q_PLUGIN_VERIFICATION_DATA \ Q_EXTERN_C Q_DECL_EXPORT \ const char * Q_STANDARD_CALL qt_plugin_query_verification_data() \ { return qt_plugin_verification_data; } \ Q_EXTERN_C Q_DECL_EXPORT QT_PREPEND_NAMESPACE(QObject) * Q_STANDARD_CALL qt_plugin_instance() \ Q_PLUGIN_INSTANCE(PLUGINCLASS)
@
@define Q_PLUGIN_VERIFICATION_DATA \
static const char qt_plugin_verification_data[] = \ "pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \ "version="QT_VERSION_STR"\n" \ "debug="QPLUGIN_DEBUG_STR"\n" \ "buildkey="QT_BUILD_KEY;
@
@
#define Q_PLUGIN_INSTANCE(IMPLEMENTATION)
{
static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance;
if (!_instance)
_instance = new IMPLEMENTATION;
return _instance;
}
@
So, it's basically just a Singleton of your Plugin. -
Gourmand, please pardon me if I misunderstand your question, but are you basically asking if having the Q_EXPORT_PLUGIN2 macro in a base class for all the plugins is sufficient for doing registration of any child classes that might inherit from it?
If so, I don't believe it is. I think that anyone who would create a subclass of your base class would still have to export their own plugin with its own specific information. Additionally, I'm pretty sure that Q_EXPORT_PLUGIN2 in the base class may cause troubles if it were registered multiple times and/or because it refers to a pure virtual class.
In short, I don't think you can write code which prevents future developers from having to understand some of the Qt nuances. It seems like you're saying "Even though these things are intrinsically Qt plugins, I want to make sure that nobody has to know they're writing Qt plugins."
I may be wrong. (I'm not a huge plugin expert, by any means.) That's just my take on it, though.
-
[quote author="Gourmand" date="1313184854"]Unfortunately no one Qt-inside engineer still did not answered. I have only test it by myself.[/quote]
There's absolutely no sense in complaining that a Qt-inside engineer did not answer your question. We are all volunteers here from all across the Qt community. And from what I've seen, everyone sincerely makes a good attempt to answer your questions to the best of their abilities.
If you truly want an official answer, in a timely manner, from someone who will drop everything to help, then I strongly suggest you visit "Digia":http://qt.digia.com/ and invest in a commercial Qt license or a technical support license.
-
[quote author="Gourmand" date="1313184854"]Unfortunately no one Qt-inside engineer still did not answered. I have only test it by
myself.[/quote]
They probably never will (Both because most of them don't read this forum and they probably have better things to do).Also, I understood your question differently from mlong. He's is right, there can only be one Q_EXPORT_PLUGIN2 per plugin (sorry, If that caused any confusion, I might have misunderstood your intentions)
-
Ok, listen, we're all doing this for free, here and we are trying to help. Nobody guaranteed you that you will get an answer, and nobody is forced to do anything here (again, we are no getting paid for this).
To answer your question: NO, not in all instances!
This will be my last post to this thread.
-
I think you misunderstood the nature of these forums. They are community-driven, supported by people how spend their spare time to help others. This is not an official Qt support forum. If you need definite Qt support you will need to buy a commercial license.
The terms and conditions you signed when creating your account allow you to post any question or discussion topic covered by the posting rules. The same applies for everybody else responding to your questions. They decide if and how to post to this topic, not you.
Receiving an official answer here is not a must nor a right. Receiving any answer here is not a must nor a right. You probably should keep that in mind.
As to your question. I think it already has been answered.
-
[quote author="Gourmand" date="1313185840"]I did not get qualified answer yet. No regarding to Qt-inside engineers. This all was a "speech about nothing". No one of you all answered to my question.
Is this site moderated? Can anybody turn discuss to proper line?
[/quote]
Hi Gourmand, please check your attitude on these forums. Folks are trying to help you and your replies can be interpreted as rude and ungrateful. This forum has people of many cultures and backgrounds so please be extra thorough when expressing yourself.
Yes, this forum is moderated.
Read up on what Lukas Geyer and loladiro writes about this forum above, it's good advice.
Thanks,
-MariusG (admin)