[Development] Why does QFactoryLoader and QLibrary cache information in QSettings?
Frans Klaver
fransklaver at gmail.com
Tue Oct 25 21:48:58 CEST 2011
On Tue, 25 Oct 2011 21:38:25 +0200, Chris Meyer <cmeyer1969+qt at gmail.com>
wrote:
> Why does QFactoryLoader and QLibrary cache information in QSettings?
>
> Does this cache information need to be available between application
> launches?
>
> Is there a performance reason?
As I always understood (from the docs), the plug-in information is stored
in QSettings to speed up validation in between runs. So the first run
would take slightly longer to start up than consecutive runs.
> Are the reasons different from platform to platform?
Not likely.
> Could the use of QSettings be replaced with a local QMap object?
I don't think this would add value, unless certain things are queried more
often. I would expect a local variable to be sufficient.
You could probably sneak around this by specifying a custom format
(QSettings::registerFormat()[1]) and provide read/write functions that
don't access disk. Then QSettings::setDefaultFormat()[2] to the resulting
value.
Hope this helps.
Cheers,
Frans
[1] http://doc.trolltech.com/latest/qsettings.html#registerFormat
[2] http://doc.trolltech.com/latest/qsettings.html#setDefaultFormat
More information about the Development
mailing list