[Interest] QML offline storage and Non-QML database sharing
Jason H
jhihn at gmx.com
Wed Mar 9 15:51:13 CET 2016
I have an increasing need for QML aspects of my software to interact and coordinate through a database to the C++ side. Case and point:
I have a C++ class that is exposed to QML that needs to work in the same database as QML.
There is the QQmlEngine::offlineStoragePath(), which returns some variation of app directory + "QML/OfflineStorage". This is close (aside from it just being a guess as to how it is obtained, however I want to say: "MyDb"
Which then should return appDir+"QML/OfflineStorage/Databases"+QCryptograhicHash("myDb", QCryptograhicHash::Md5)+".sqlite" (or whatever is proper. For example, android is "/data/data/com.co.app/files/QML/OfflineStorage" <- see the files part?)
I think there needs to be a formal API for the C++ side to acquire the proper path (no guessing "QML/OfflineStorage").
Als a follow up question, how does the QML side work with the connection "qt_sql_default_connection"?
Is it possible to have only one connection shared with C++ and QML?
Will QML open it's own connection?
Do I have to maintain both connections?
Thanks.
More information about the Interest
mailing list