Important: Please read the Qt Code of Conduct -

QML and C++ creating/sharing a database?

  • I need to run an algorithm on data that originates from two different sources:

    1- UART ( raw transducer data)
    2- variables a user inputs into a gui

    The result is then output to the gui for the user to see


    • User inputs variables via a gui (written in qml - i actually have no choice on this)
    • The qml creates a database of all variables, then
    • Invokes C++ routines for collecting raw data over a UART , saves it to a file,
    • the C++ module opens up the database and extracts variables needed , opens the file reads in the data, runs the algorithm using both, calculates the answer and writes it to the database,
    • program then jumps back to QML where, later, the QML will go into the database to extract that answer and display it.

    If you see a flaw already please let me know before I spend hours finding out this wont work. If it is plausible.....

    (1) who should run the UART - C++ or QML? anyone knows pros /cons? The raw data will have to be post processed so i'm thinking it will need file saving (I'm thinking UART is a C++ thing)

    (2) I need to create a database from user input variables from QML - any one have examples of this?

    (3) - the QML must do a Q_INVOKABLE to the C++ routines (to run the algorithm) . I've already run a test program to prove I can do that so not too worried though if anyone has any examples I'd love to see how others do this.

    (4) BOTH the QML and the C++ need to access (read and write) the database created in (2).
    Is this doable? If so...anyone have any examples of QML and C++ sharing the same database, any code, videos, anything? Should I keep opening and closing the database or is there a way to open it and have some pointer or something be passed around. I can't find anything about QML accepting or passing a pointer.


    (using ARM® Cortex™-A9 embedded linux qt)

  • You can do everything and it isn't so hard. It is a typical scenario with an embedded device with a display (qml, uart, sqlite, tcp ..., This is my core businness).

    I suggest you to study each element or ask to someone to write the app for you and, after that, I suggest you to study it (it is more quickly if you are a beginner).
    Wich kind of device have you to manage? Wich kind of implementation is it for?

  • @mrdebug

    Thank you for your response!
    Are you saying my plan seems plausible? Have you done these things before or is it an educated guess ?

    I'm in R&D so I can't tell you exactly what we're doing but I can tell you we're using a NXP imX6 with embedded linux and qt and the rest i have to say generalities - a device that measures something and also has user inputs how/what to measure - it's going to run a gui and a uart with data will be coming in both ways ( not at the same time- the gui will say "go" after variable inputs to start a measurement).

    Then I'll need to do computing on all that data and then write results somewhere that will again, be accessed later and printed out to gui.

    I am brand new to Qt but regardless it's my responsibility to get an accurate game plan and pluck away at the pieces.

    I dont and won't have anyone to write me anything. I have no say in that.. such is life.

    that's why - any literature, tutorials, videos that's what i'm searching for/diving into

    thanks for your time, much appreciated!

Log in to reply