Using Qt Quick as a base platform
-
Hi,
Currently I'm working on a project that will run on Linux and has a great GUI with lot's of back end functions like reading from serial port and CAN bus.
I'm learning QML now for doing this job.
My question is this: Am I in the right way for this project??
if so, what aspects of Qt should I learn?
like threading and connecting threads to the QML GUI ,I guess.
Thank you. -
Hi @Jamshid,
neither CAN bus nor serial ports require threads if you use Qt signals&slots.
However, a solid C++ background is needed to do the low-level communication, plus Qt core concepts like QObject and signals&slots.
QML/JS should be used for the UI mostly.
Regards
-
-
So you mean I don't need to learn threads or something like these?
You can learn them, but for 99% of tasks you don't need them. And if you use threads, you need to use them right to don't shoot yourself in the foot.
or extending QML with C++?
That seems more interesting for you.
I thought for using serial port or CAN bus I need to have a thread for reading data and managing them.
As said, most likely not.
I'm confused, because I'm new to Qt.
Then you should learn the basics I told you above. You will need them everyday.
Regards
-
That seems more interesting for you.
I thought for using serial port or CAN bus I need to have a thread for reading data and managing them.
https://forum.qt.io/topic/48442/qt-quick-qml-read-data-over-serial-port-and-show-on-gui
I have read this topic and therefore I thought to use threads and extending QML with C++ for using serial port.
May you send me an example? I have no idea.
In fact I'm a C# developer right now.Regards
-
@Jamshid QSerialPort has an asynchronous API as most other Qt classes.
See https://doc.qt.io/qt-5/qserialport.html
Using asynchronous API does not require another thread as they do not block your main thread. -
@Jamshid said in Using Qt Quick as a base platform:
If I had some processing, the UI does not freeze?
I should process my data in UI thread, Am I right?This depends on the amount of processing you need to do. If it's too much for main thread to stay responsive then you need to move the processing to another thread. I suggest to first test with single thread.