Is it possible to set the User Interface of a qt GUI Application using XML file?
-
wrote on 21 Apr 2014, 03:10 last edited by
Is it possible to set the User Interface of a qt GUI Application using XML file?
I want to set the UI of my application upon running the program. The size and position of each element. Can I use xml file to do this? -
wrote on 21 Apr 2014, 07:34 last edited by
Yes,
You can do that. Qt' .ui files are just that xml files to describe ui. They are primarily a compile time feature. but there is a way to load them at runtime also using QUILoader class. If you just want to change dimensions of existing components css may be a good option.
That's all pre QML era, If you are using QML, QML files describing your UI can be loaded anytime you want in your application
-
Hi, and welcome to the Qt Dev Net!
Yes, you can specify your GUI in a .ui (XML) file, as pritamghangh.. said. See http://qt-project.org/doc/qt-5/gettingstartedqt.html for an example.
-
wrote on 23 Apr 2014, 02:17 last edited by
thank you for your Answers.
Please Correct me,as I understand Qt Gui Application is compiled program and noting can be change after compiling it. So how can a xml file change its UI? -
Yes, normally Qt takes the *.ui file, and then converts it into C++ code, and then compiles it. This way, you cannot change the GUI after you compile.
However, "QUiLoader":http://qt-project.org/doc/qt-5/quiloader.html#QUiLoader reads the *.ui file and creates the GUI at run-time. This way, you can change the GUI by changing the XML file.
What is your program for? It might be better to use "QML":http://qt-project.org/doc/qt-5/qml-tutorial.html instead of XML.
-
wrote on 24 Apr 2014, 01:57 last edited by
Ahh now I understand clearly, so QUILoader is one of the option I can use.
the program we are developing is a Qt Gui Application for Attendance Monitoring running in a Mini6410 device. The program download all the Configuration and Parameters in the web including the UI configuration.
Can you suggest a better way to do this.
1/6