Qt: UI with c++ vs with xml vs with qml

十年热恋 提交于 2019-12-05 20:41:46

问题


I have started learning qt today and have a question. When I create a project, it comes with *.ui file which is XML kind of file but in the book, I am only creating UI with pure c++(classes). I have heard there is another way of creating the UI with qml.

So, What are pros and cons of each UI creating way?

Thanks in advance

EDIT: I am using QT 5.1.0


回答1:


Don't forget that you can also embed a QtWebkit view and use HTML directly as the user interface controls.

A lengthy answer with the specifics of each sub-framework could be provided, but the QT project people have already answered this question with a chart of their own:

http://qt-project.org/doc/qt-5.1/qtdoc/topics-ui.html#comparison




回答2:


The .ui file is generated for/by "visual" design layout tools such as QtDesigner - I would not suggest you generate or edit them by hand; if you choose not to use "visual" or "RAD" GUI design tools then programmatically instantiating widgets in C++ is probably fine.



来源:https://stackoverflow.com/questions/17640887/qt-ui-with-c-vs-with-xml-vs-with-qml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!