Forums

OverviewFelgo 2 Support (Qt 5) › How to create data offline

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #20340

    Felgo User

    Hi, I am trying to make a dictionary app and all data it store should be stored offline in the PC.

    The dictionary data consists of word, meaning, and statistics of times the word used. Every time the word used in any document, the statistics will change and the data will be updated. I have two problems. First, I can load the data from a json file but how to save it back to that json cause it seems that only online app can do that through XMLHttpRequest. Second, the dictionary have thousands of entry so the loading taken too much resources, even when it was just a AppListView. Moreover, if I stored it to LocalStorage, it back to the key-value structure and it’s too hard to control the thousand words entry in that app LocalStorage. Any idea to these proplem?

    #20359

    Flesh

    Sounds like you want a Database; you can use:

    var db = LocalStorage.openDatabaseSync(“DataBaseName”, “1.0”, “Description”, 1000000);

    then run SQL to get record(s)

    var results = tx.executeSql(“SELECT theField FROM theDataTable WHERE theField=?;”, whatIamLookingFor);

    Its the only way I can think of how to do this efficiently.

    LocalStorage can be used to store single key value pairs; or a Database, I think SQLite is the only option here, this is JavaScript, this support is built in, just import QtQuick.LocalStorage 2.0; you can also do this in in C++ if you need to support more databases; depending on your needs and platforms you need to support; you will need a driver if use QtDatabase

    http://doc.qt.io/qt-5/sql-driver.html#building-the-plugins-manually

    you can see here what Databases it supports; which is most of them.

     

    JavaScript LocalStorage is very powerful; but C++ is more powerful, it all depends on your Comfort zone; there are also Libraries out there like:

    JavaScript

    https://github.com/danielfranca/quickmodel

    C++

    https://github.com/JosephMillsAtWork/QmlSql

     

    I have not used either; but plan on using both. I have to test them on all Platforms before I recommend them; but having looked at the Code; I would say they are well written and easy to use, and should would on all Platforms that Qt supports; but if you link against the C++ library; make sure you compile it for all the Platforms you will support; or just compile it into your app; there are example of how to integrate this with QML; so its a matter of writing your own Library or using one that someone else wrote; either way these two projects will show you the code and how to use it.

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support