Two UI-definitions for one dialgue?
<p>I have an Qt-application where dialogues make use of standard XML UI-files which are compiled into the code. They have a standard structure where a class name is defined for this UI file and afterwards I can access the members (=GUI elements) via an object which is an instance of this UI-class (code snippets out of .ui file, ui_*.h file and dialogue implementation):</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
 &lt;ui version="4.0"&gt;
  &lt;class&gt;DlgClass&lt;/class&gt;
  ...

namespace Ui {
   class DlgClass : public Ui_DlgClass {};
} // namespace Ui

Ui::DlgClass ui;

ui.heightCaption-&gt;setMinValueTextColor(Qt::black);
</code></pre>

<p>Now my problem: For some dialogues I want to have two or more layouts where the design is different but which contain exactly the same GUI elements (but at an different position). Next I need to access these elements in exactly the same way like before, means by pointer access to an object which is of a type defined by the UI file.</p>

<p>My problem: when I create two UI files which then are compiled, they have different class names I can't map onto each other easily. So: how can this be solved? Is it possible to define a common base class for usage with two different UI files? Or what else could be done here? Loading and interpreting an UI file during runtime is not a solution, this is way too slow.</p>

<p>Thanks!</p>