Does Qt have a "XAML-like" markup-based GUI creation?
WPF uses XAML. Gtk has G开发者_如何学CladeXML, and associated tooling.
Does something similar exist for Qt?
Just to clarify: I'm asking about runtime loading of a UI from a markup file. XML/YAML/JSON, etc.
Thank you
QML: http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeintroduction.html
well... .ui files are .xml files
The .ui files created by Qt's Designer application can be loaded at runtime for a dynamic UI. It will allow the UI to be changed, but it doesn't allow state information like QML does. Also, if you want to do much with the UI, you need to know some information about the widgets in the .ui file.
Yes there are .ui files which are in fact XML based. These files are generated by QtDesigner/QtCreator (Form designer delivered by Nokia/Trolltech). Ui files are converted to C++ code at compile time and linked with application.
So it is not possible to load them at runtime.
While .ui files are XML, these are not as declarative as the .qml files of Qt Quick (QtDeclarative Engine). The latter, in contrast is JSON-like, not XML. So the answer to the original question is: yes (functionally) and no (not XML). Personally, I think XML-based creation for humans is inferior.
精彩评论