mardi 24 février 2015

How to use a pre-populated sqlite database with qwebview?

Is there a way to use a pre-populated sqlite database with a qwebview? I have a javascript application that makes use of that database.


I've enabled offline storage,



QWebSettings::globalSettings()->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, true);


set a confortable size to it



QWebSettings::setOfflineStorageDefaultQuota(20*1024*1024);


and set location:



QWebSettings::globalSettings()->setOfflineStoragePath(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/data/myapp");


Copying the database file from qrc resource file to that location doesn't do the trick;



QFile::copy(":/mydatabase.db" , QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/data/myapp/mydatabase.db");


how to proceed?


Thank you.


Aucun commentaire:

Enregistrer un commentaire