I have an odd case here. I have some domain objects that are maintained in C++ and the QML is a presentation for them. However, up until now, I could just write generic code to present them. But now, I need object-specific presentation.
Since the logic and copious types are in C++, I’d like to create a form to edit these objects from within C++. With this, I actually have no problem:
QQmlComponent GenericNew(
engine,
genericNewQmlUrl
);
auto * parent = GenericNew.create();
for(auto const & field: object) {
// Instantiates a field type-specific QQmlComponent
createSpecificQmlItemForField(field,parent);
}
The problem is that certain fields need to have Layout.fillWidth set to true because the form uses a grid layout. I cannot seem to figure out how to do this in C++ nor how to hook into it on the QML side to set it appropriately.
Any suggestions?
↧