How can I handle user data using QT Quick?

192 views Asked by At

I am trying to develop an app for Ubuntu Touch. I am using QML integrated with JavaScript.

I know that it is a huge mess to read or write to files in JavaScript when it is embedded in a webpage, but this is not embedded in a webpage so it should be easier right? The Ubuntu documentation is pretty bad right now.

Does anyone know how I can get this done? I want to get it done without using c++ because using QML, JavaScript and c++ seems like just a big mess. If the only way to do it is using c++ then I guess thats what I will have to do, but I would like to find another way.

2

There are 2 answers

0
John On BEST ANSWER

The simplest way to handle data in your Ubuntu Touch app is to actually use SQLite (No surprise there). You can find a really good tutorial on using SQLite with Ubuntu Touch here:

It seems like this is the most efficient way to handle app data in Ubuntu Touch. If you want to be able to write to an actual file, you need to handle it using c++. Check out Kamil's answer for that.

1
Kamil Klimek On

You will have to write a wrapper for QFile class that will be exposed to QML code. Here is an example how to do that. I'm not sure if it's outdated but it looks like it should work just fine.