Discussion:
[Qt-creator] Storing plugin data
Davide Coppola
2018-11-22 15:37:01 UTC
Permalink
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

<http://plus.google.com/+DavideCoppola>
<http://www.linkedin.com/in/davidecoppola>
<http://www.twitter.com/vivaladav>
Aleksey Kontsevich
2018-11-22 17:28:31 UTC
Permalink
SettingsDatabase Class: https://doc-snapshots.qt.io/qtcreator-extending/core-settingsdatabase.html ? Use Core::ICore::settingsDatabase() instance then. If not - create your own SQLite DB and store in QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QStringLiteral("/your_path")

-- 
Best regards,
Aleksey
Linked in https://www.linkedin.com/in/alekseykontsevich
Post by Davide Coppola
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
https://lists.qt-project.org/listinfo/qt-creator
Eike Ziller
2018-11-23 08:18:31 UTC
Permalink
Post by Aleksey Kontsevich
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.)
Post by Aleksey Kontsevich
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
Post by Aleksey Kontsevich
--
Best regards,
Aleksey
Linked in https://www.linkedin.com/in/alekseykontsevich
Post by Davide Coppola
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
https://lists.qt-project.org/listinfo/qt-creator
_______________________________________________
Qt-creator mailing list
https://lists.qt-project.org/listinfo/qt-creator
--
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
***@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
Davide Coppola
2018-11-23 11:56:45 UTC
Permalink
Thanks everyone.

It seems Core::ICore::userResourcePath() is what I was looking for.
Post by Aleksey Kontsevich
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.)
Post by Aleksey Kontsevich
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
Post by Aleksey Kontsevich
--
Best regards,
Aleksey
Linked in https://www.linkedin.com/in/alekseykontsevich
Post by Davide Coppola
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.
Post by Aleksey Kontsevich
Post by Davide Coppola
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.
Post by Aleksey Kontsevich
Post by Davide Coppola
Am I supposed to use some data path returned by
QStandardPaths::standardLocations or is there a better/different way for
plugins?
Post by Aleksey Kontsevich
Post by Davide Coppola
Thanks
--
Davide Coppola
website: http://www.davidecoppola.com
blog: http://blog.davidecoppola.com
,
_______________________________________________
Qt-creator mailing list
https://lists.qt-project.org/listinfo/qt-creator
_______________________________________________
Qt-creator mailing list
https://lists.qt-project.org/listinfo/qt-creator
--
Eike Ziller
Principal Software Engineer
The Qt Company GmbH
Rudower Chaussee 13
D-12489 Berlin
http://qt.io
GeschÀftsfÌhrer: Mika PÀlsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht
Charlottenburg, HRB 144331 B
--
*Davide Coppola*

*website:* http://www.davidecoppola.com
*blog:* http://blog.davidecoppola.com

<http://plus.google.com/+DavideCoppola>
<http://www.linkedin.com/in/davidecoppola>
<http://www.twitter.com/vivaladav>
Loading...