Where can I find documentation for Qt user interface definition files (.ui files in XML)

StackOverflow https://stackoverflow.com/questions/23687511

  •  23-07-2023
  •  | 
  •  

Frage

I am learning Qt for the first time and I prefer to learn how to things the hand-coded way. I prefer learning this route because I am using Eclipse (with no Qt Designer) and I learn better knowing what is going on under the hood. Thus, I would like to know how to hand-code the XML-based user interface definition (.ui) files.

Unfortunately, I cannot seem to find any information on how this XML tree should be structured, and which properties and attributes are allowed. Instead, I find "drag-and-drop" tutorials. Aside from generating the .ui files in Qt Designer and then studying the output XML tree, is there another way to learn how to handcode these .ui files, or any documentation which speaks to the semantics of this XML document?

Thank you!

War es hilfreich?

Lösung

The UI file's sole purpose is to save you from hand-coding things. They're files that are generated by designer:

You create user interface components with Qt Designer and use Qt's integrated build tools, qmake and uic, to generate code for them when the application is built. The generated code contains the form's user interface object. It is a C++ struct that contains:

If you want to improve your knowledge of Qt, learning to write UIs via C++ would be a better option. Still, if you're convinced, there is this XML schema:

http://qt-project.org/doc/qt-4.8/designer-ui-file-format.html

Note that it says:

Be aware that the format may change in future Qt releases.

You might also be interested in the documentation for uic, which operates on the .ui file to create a header file containing the various widgets that make up the UI.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top