A Beginner’s Question
-
I’m a beginner in Qt and have been learning QML for a while. Recently, I’ve run into some confusion: when writing code in QML, I feel like I can only build relatively polished user interfaces. But when it comes to writing backend code to implement the functionality I want, and making the frontend serve the backend, I don’t know where to start. That’s why I came here—hoping to find an answer.
-
I’m a beginner in Qt and have been learning QML for a while. Recently, I’ve run into some confusion: when writing code in QML, I feel like I can only build relatively polished user interfaces. But when it comes to writing backend code to implement the functionality I want, and making the frontend serve the backend, I don’t know where to start. That’s why I came here—hoping to find an answer.
For simpler applications, the backend can be written directly in JavaScript. I'd recommend writing it in C++, unless you're using Qt for Python, of course. Then, Python is your backend language.
The C++ way can be figured out here: https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html
Qt comes with a lot of example projects and tutorials: https://doc.qt.io/qt-6/qtexamplesandtutorials.html
Pick one that looks interesting / similar to what you want to achieve, and start exploring. -
For simpler applications, the backend can be written directly in JavaScript. I'd recommend writing it in C++, unless you're using Qt for Python, of course. Then, Python is your backend language.
The C++ way can be figured out here: https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html
Qt comes with a lot of example projects and tutorials: https://doc.qt.io/qt-6/qtexamplesandtutorials.html
Pick one that looks interesting / similar to what you want to achieve, and start exploring.@jobor thanks for your answer,Yesterday I looked up some more information. For host-computer programs and similar applications, isn’t the common practice to write methods in C++ classes, register them to QML, and then call these classes during runtime? Qt comes with many sample projects, and from what I’ve seen, quite a few follow this approach. However, what I urgently need right now is a complete project with sufficient backend logic to study.