[英]QtQuick QML SQL C++
I need to run an algorithm in Qt on data that originates from two different sources: 我需要在Qt上对源自两个不同来源的数据运行算法:
1- UART ( raw transducer data) 2- variables a user inputs into a gui 1- UART(原始传感器数据)2-用户输入到gui的变量
The result is then output to the gui for the user to see 然后将结果输出到gui供用户查看
Gameplan: - 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. Gameplan:-用户通过gui输入变量(以qml编写-我实际上对此没有选择)-qml创建所有变量的数据库,然后-调用C ++例程以通过UART收集原始数据,并将其保存到文件中,-C ++模块打开数据库并提取所需的变量,打开文件以读取数据,使用二者运行算法,计算答案并将其写入数据库,-程序然后跳回到QML,稍后, QML将进入数据库以提取该答案并显示出来。
If you see a flaw already please let me know before I spend hours finding out this wont work. 如果您已经发现瑕疵,请在我花数小时找出无法解决的问题之前让我知道。 If it is plausible.....
如果合理的话.....
FOUR QUESTIONS: (1) who should run the UART - C++ or QML? 四个问题:(1)谁应该运行UART-C ++或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)
原始数据将必须进行后期处理,所以我认为它将需要文件保存(我认为UART是C ++的东西)
(2) I need to create a database from user input variables from QML - any one have examples of this? (2)我需要根据QML的用户输入变量创建数据库-有人举过这个例子吗?
(3) - the QML must do a Q_INVOKABLE to the C++ routines (to run the algorithm) . (3)-QML必须对C ++例程执行Q_INVOKABLE(以运行算法)。 I've already run a test program to prove I can do that so not too worried though if anyone has any other 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). (4)QML和C ++都需要访问(读取和写入)在(2)中创建的数据库。
Is this doable? 这可行吗? If so...anyone have any examples of QML and C++ sharing the same database, any code, videos, anything?
如果是这样...有人在共享同一数据库的QML和C ++的任何示例,任何代码,视频等等吗? 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.
我找不到有关QML接受或传递指针的任何信息。
Thanks Dubs 谢谢配音
(using ARM® Cortex™-A9 embedded linux qt) (使用ARM®Cortex™-A9嵌入式linux qt)
对于SQL和QML Q_INVOKABLE
请参考此答案 ;对于UART,请使用C ++并从QML调用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.