Important: Please read the Qt Code of Conduct -

Web-like templating engine for XML/.ui files

  • Just out of curiosity, I'm wondering if anybody has ever tried/thought/dreamed to do some "templating" with the XML (.ui) files created by Qt Designer.

    I mean:

    • Qt Designer creates XML files (that is: text files, very similar to HTML, that can be easily modified by a external program, either at compile-time or at run-time)

    • Qt can load these files from any QUIDevice (that is: stuff coming from the disk, from memory, from the network...) thanks to QUILoader or QFormBuilder

    As a consequence, in principle it is possible to implement this workflow:
    Create one or more XML templates with QT Designer (and, maybe, some manual/automatic tweak)

    • At compile time, use a Ruby, Python or C++ template engine to produce a set of XML/.ui files

    [OR, at run-time, use a C++ template engine like Grantlee, Clearsilver or Wt, or the Qt internal QtXML module, to load a XML template from disk and to create a suitable XML/.ui file]

    • Load the resulting XML/.ui GUI definition files with QUILoader and show the resulting GUI to the user.

    This would be a very near replica of the typical "templating engine" used in most web application (like Smarty, Cheetah and so on).

    Of course, given that it is already possible to dynamically create a GUI at run-time with the regular C++/Qt code, it would be somehow redundant to use such a technique. Nevertheless, It seems to me that it could be useful for some MDD-oriented project.

    Can anybody see any possible/interesting application of such a technique?


Log in to reply