I am developing a custom widget consisting of other widgets (buttons, labels, viewers etc) which is going to be a module in other projects. It is important to have multiple layouts for this custom widget.
The layout is going to change depending on some dynamically determined factors, like the application which is part (e.g. for the X application we want things to be arranged vertically, or we want Z widget next to M widget instead of one under another) and also depending on the features detected (if hardware X is not detected then hide A, B, C widgets).
Until now, I had a single layout in Designer Form which I would modify a little bit programmatically on the fly for small rearrangements.This not viable anymore since in some applications we need a completely different layout.
So, to sum thing up, we have fixed number of widgets but we want different rearrangement and visibility depending on some dynamically determined factors.
What's the proper way to handle this situation?
Solutions I have thought so far:
Create multiple .ui files and load the one I need dynamically using QUiLoader
Create the layouts purely programmatically
Create single .ui file with a stacked widget and each page would be a different layout. When switching a layout, the widgets of the "active" layout will be assigned by pointers.