Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to specify Qt plugin constructor?

I wonder if it is possible to specify a constructor in a Qt plugin interface? (extending an app)

I want to force the plugins using the interface to take a parameter in the constructor.

like image 994
Niklas Berglund Avatar asked Feb 26 '10 00:02

Niklas Berglund


1 Answers

I don't think that it's possible to do exactly what you described.

However, you might try to create factory object and then pass parameters to YourFactory::create() method, which returns pointer to YourObject. Another (uglier IMHO) way is to add initialize() method to YourObject. Check interfaces of QFontEnginePlugin and QScriptExtensionPlugin for both approaches.

like image 165
chalup Avatar answered Sep 28 '22 07:09

chalup