Reputation: 2296
I have develop a small application that uses a SQLite database. Now, I want to create and store this database in user space (in terms of hard disk) in the same way I store settings with QSettings.
I can use QDir and similar classes to find where the user home is, but I want to avoid hidden directories creation, I am looking for a transparent solution and operating system independent.
Can I use the Qt Resources System to create the database into the user home (and find it later)?
How can I make it easy?
Upvotes: 2
Views: 261
Reputation: 851
To really answer your question, we need to know a few things. First, how do you want to actually store the DB on disk? Does it need to be in a specific file format? binary? .txt file? .txt/sql file that can be read into another database program (i.e. commands in SQL to rebuild the DBs and tables)?
Qt has an array of objects available to you to store the DB. You can use QFile and QTextStream/QDataStream to create your own custom file. The QDir and QFileDialog classes are excellent supports for this, as far as user interaction goes.
Upvotes: 1