[Interest] Best way to reuse forms(or ui design) in a project

Lijo Antony lta at one.com
Mon Jun 11 13:53:57 CEST 2012


On 06/11/2012 12:31 PM, Bo Thorsen wrote:
> Hi Lijo,
>
> I would use one of two different approaches:
>
> The first is to add a QWidget as header and footer on all your forms.
> Then you promote the header widget to your header class and the footer
> to your footer class. You can set the extra properties by using dynamic
> properties.
>
> This way has the advantage that you don't have to do anything to make it
> work. Whenever someone checks out the source code of your project, they
> can just build it.
>
> The other approach is to create a designer plugin for your total widget.
> With such a plugin, you can create any amount of properties for your
> header and footers, and you can see how it looks inside designer.
>
> If you choose this one, you have to build the designer plugin in release
> mode *always*, because designer won't load a debug build. (Unless your
> designer is built with debug, then your plugin must be debug.) You
> should create a container plugin for this class.
>
> Choosing between those two is a matter of what kind of maintenance you
> will do on the code over the years and who will do it. While it's much
> more annoying to keep designer plugins, it makes the forms much easier
> to work with. It creates build issues instead of designer issues.
>
> OTOH, doing the widget promotions means the one working on the designer
> files will have to know what they are doing. If you're in a small team,
> this might be okay. But if the project has a lot of different people,
> this is bound to fail.
>

Thanks for the suggestions. I will go ahead with custom widget 
approach(with QtCreator plugin). Integration with QtCreator is very 
useful for me, as I will be doing lot of experiments with design.

-lijo



More information about the Interest mailing list