Unsolved Can I “instantiate” (parametrize) prepared ui form by placing it in another form in Qt designer?
-
I created a simple form object representing some arbitrary name and value pair:
It's intentionally very simple - any design is to be applied through the CSS styles. Apart from the UI, the form consists of C++ class that handles the data loading and custom property defined in Designer too - the name of the data source (eg. hostname).
So I have two values I need to parametrize:
- the
Name
- the QLabel text - the
datapoint
- some hostname. This will be later loaded by the C++ class and tell it what data should be loaded
I was Imagine I would be able to create "instances" of my form manually in designer and assign parameters to them. Like in this fictional image:
Don't forget
datapoint
is the custom dynamic attribute. I am sure the described design can be easily carried out programatically, but I feel like the designer solution will be prettier - provided there's a legit way to do it. - the
-
Hi,
Do you mean you need something like a widget plugin for designer like described here ?
-
I don't think this is doable currently without modifying Qt sources.
There's very little extensibility of the designer when it comes to custom data. All you can do is provide a fixed set of meta object properties, but even those are quite limited. For example there seems to be no way to make a vector of objects assignable in the designer or even assign actions or toolbars in your custom designer plugins.
You need to remember that all the designer does is generate an xml description of the ui. The tool that does the actual code gen is uic, and you would need to extend it to understand any extra syntax in the xml generated from the designer, yet there is no way to do so beyond modifying the uic itself. -
I think you don't understand yet. All I need to put form from my template UI file to another form, with properties. Like copy and paste. But it is promoted to a class and it must stay that way.
-
hi
Do you mean like this poster?
https://forum.qt.io/topic/61237/how-to-have-multiple-widgets-initialized-from-a-single-form-file-no-aggregation-inheritance