WPF uses XAML. Gtk has GladeXML, 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

有帮助吗?

解决方案

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.

其他提示

well... .ui files are .xml files

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top