[Qt-creator] Storing plugin data

Eike Ziller Eike.Ziller at qt.io
Fri Nov 23 09:18:31 CET 2018



> On 22. Nov 2018, at 18:28, Aleksey Kontsevich <tantrido at ya.ru> wrote:
> 
> SettingsDatabase Class: https://doc-snapshots.qt.io/qtcreator-extending/core-settingsdatabase.html ? Use Core::ICore::settingsDatabase() instance then.

I think I would avoid using ICore::settingsDatabase() if you have much plugin specific data, since it makes it hard to remove data that was created by this plugin and this plugin only. (If you have QSettings-like data, but much of it, you can of course consider using the class Core::SettingsDatabase for your separate data file.)

> If not - create your own SQLite DB and store in QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QStringLiteral("/your_path”)

QStandardPaths has the disadvantage that Qt Creator’s “-settingspath” option will not affect that.
We usually use
Core::ICore::userResourcePath() + “/some_path_that_identifies_the_purpose/“ + filename

Br, Eike

> -- 
> Best regards,
> Aleksey
> Linked in  https://www.linkedin.com/in/alekseykontsevich
> 
> 
> 
> 22.11.2018, 19:13, "Davide Coppola" <vivaladav at gmail.com>:
>> Hi,
>> 
>> I need to store some data for a Qt Creator plugin I am working on.
>> Keep in mind that I am not talking about settings, but actual data generated by the plugin.
>> 
>> I am planning to use SQLite to handle the data, but I am not sure where I should keep the file used to save the database.
>> 
>> Am I supposed to use some data path returned by QStandardPaths::standardLocations or is there a better/different way for plugins?
>> 
>> Thanks
>> 
>> --
>> Davide Coppola
>> 
>> website: http://www.davidecoppola.com
>> blog: http://blog.davidecoppola.com
>> 
>> ,
>> 
>> _______________________________________________
>> Qt-creator mailing list
>> Qt-creator at lists.qt-project.org
>> https://lists.qt-project.org/listinfo/qt-creator
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at lists.qt-project.org
> https://lists.qt-project.org/listinfo/qt-creator

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list