Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Extending LocalStorage



  • Hey Guys,

    I am pretty new to C++ and QML and this might be a pretty easy question for you to answer. Rummaging through various forums and tutorials however hasn't revealed a solution for my problem so far.

    Okay now to my problem: I want to extend the range of functions for the QtQuick LocalStorage Plugin, namely encrypt the sqlite database. So far I managed to compile a sqlite driver with SQLCIPHER support.

    Now I want to write my own localstorage plugin i.e. Inherit from the QQuickLocalStorage class and extend the openDatabaseSync function with an additional passkey argument.

    The problem is that I cannot find the correct include path to let my class inherit from the QQuickLocalStorage class which is used in the original QtQuick.LocalStorage.

    Any suggestions how to solve this problem?



  • As far as I understand this, there is no benefit to inherit from QQuickLocalStorage, which consists only of one (non-virtual) function anyway. Its also just a .cpp file, no headers (Src\qtdeclarative\src\imports\localstorage\plugin.cpp) and a lot usage of internal/private qml engine stuff.

    I would suggest that you write your own custom plugin, which handles the sql logic in C++.



  • Thx for the quick answer.

    And yes, after spending hours on finding a proper solution this is definitely is the easier way of doing it.


Log in to reply