Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Storage Options!

Tagged: , , ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #9597

    Matt

    Got a question regarding storage, I’m working on a game which stores quite a lot of data
    it’s not huge in terms of MB (it’s somewhere between 2MB and 10MB) but it’s text data that needs to be stored and accessed easily/quickly.
    The format is quite simple (key/value pairs) but there are 10’s of thousands of them (maybe even 100’s of thousands).

    I initially had it in QML files as arrays (when it was smaller volume) but now that its getting bigger it is getting slower and is causing the app to crash (or fail to build/run).

    So, any suggestions on what would be the best way to do this?
    JSON files?
    SQL DB? (seems that we have to create and populate this on first use?)
    or should I keep it offline as service calls? (which wouldn’t be great as the app would always need connection, but maybe that’s not such an issue?).

    • This topic was modified 8 years, 9 months ago by  raystlin.
    #9603

    Christian
    Felgo Team

    Hi Matt,

    I’d recommend using JSON files and then parse them with JSON.parse(). You can read a file with the (yet undocumented) fileUtils context property like this:

    var dataString = fileUtils.readFile(Qt.resolvedUrl("../assets/data/yourfile.json"))
    
    var dataJson = JSON.parse(dataString)
    

    If you can split up the files into several ones, this would improve the performance a bit more.

    Cheers, Chris

    #10028

    Alec

    Christian,

     

    Is there a reason the fileUtils remains undocumented. It would be useful for me but if it’s likely to be buggy or not supported across Android and iOS, i’ll find another solution.

    #10029

    Günther
    Felgo Team

    Hi alb,

    we did not yet update the fileUtils to be 100% compatible and tested with our current engine version. So there might be features within fileUtils that won’t work as you would expect.

    I recently used the fileUtils simply for listing the images in the assets directory, which worked fine for me on android phone and iOs tablet. You may try using the fileUtils, but I recommend to especially test what you do first – to make sure everything is ok.

    Cheers,

    GT

     

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

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded