Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is it possible to set the User Interface of a qt GUI Application using XML file?
Forum Update on Monday, May 27th 2025

Is it possible to set the User Interface of a qt GUI Application using XML file?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    junnellogbox.ph
    wrote on 21 Apr 2014, 03:10 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pritamghanghas
      wrote on 21 Apr 2014, 07:34 last edited by
      #2

      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

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JKSH
        Moderators
        wrote on 21 Apr 2014, 15:51 last edited by
        #3

        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.

        Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

        1 Reply Last reply
        0
        • J Offline
          J Offline
          junnellogbox.ph
          wrote on 23 Apr 2014, 02:17 last edited by
          #4

          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?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JKSH
            Moderators
            wrote on 23 Apr 2014, 04:16 last edited by
            #5

            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.

            Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

            1 Reply Last reply
            0
            • J Offline
              J Offline
              junnellogbox.ph
              wrote on 24 Apr 2014, 01:57 last edited by
              #6

              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 Reply Last reply
              0

              1/6

              21 Apr 2014, 03:10

              • Login

              • Login or register to search.
              1 out of 6
              • First post
                1/6
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved