Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to combine QML and SQL conveniently?
CoderJeff last edited by
I am working on a desktop program about SQL. But I find it is very inconvenient to interact with QML and SQL while it is much easier to use UI instead of QML. The examples about SQL in Qt Creator 3.3.0 are all written in either only C++ or combination of C++ and UI. I never saw SQL examples in QML and C++.
Is QML not a good way to interact with Database?
Rahul Das last edited by Rahul Das
it is very inconvenient to interact with QML and SQL while it is much easier to use UI instead of QML
Felt the same! may be because, too much used to UI than QML.
Mean while i would like to share few links that was useful to me ..
CoderJeff last edited by CoderJeff
@Rahul-Das Thanks for your sharing. I also spent more time on the last two links.
"Keep in mind that QWidgets were designed for a different type of user interface than QML, so it is not always a good idea to port a QWidget-based application to QML. QWidgets are a better choice if your UI is comprised of a small number of complex and static elements, and QML is a better choice if your UI is comprised of a large number of simple and dynamic elements."
"Warning: While it is possible to use C++ to access and manipulate QML objects deep into the object tree, we recommend that you do not take this approach outside of application testing and prototyping. One strength of QML and C++ integration is the ability to implement the QML user interface separately from the C++ logic and dataset backend, and this strategy breaks if the C++ side reaches deep into the QML components to manipulate them directly. This would make it difficult to, for example, swap a QML view component for another view, if the new component was missing a required objectName. It is better for the C++ implementation to know as little as possible about the QML user interface implementation and the composition of the QML object tree."
qxorm last edited by
QxOrm library provides QxModelView module to interact easily between QML and database through the Qt model/view architecture.
There is an example in the FAQ here : http://www.qxorm.com/qxorm_en/faq.html#faq_300