Creating a multitypes generic component
-
wrote on 16 Jul 2018, 10:33 last edited by
Hello,
I would like to make a multitypes component.
What I mean by that is for example an option component which can have multiple value type.
My option can be boolean, it can be a set of value, it can be a string...I would like to make a generic option component.
I thought about making a Option component with an enum that allow to switch between checkbox, combox, textfield or other.
But I don't know how to realize it.
I don't have any idea how can I handle multi type value and give it to the right element.Should I add a property for each type and set the right property when I create an instance of my component ?
-
Hello,
I would like to make a multitypes component.
What I mean by that is for example an option component which can have multiple value type.
My option can be boolean, it can be a set of value, it can be a string...I would like to make a generic option component.
I thought about making a Option component with an enum that allow to switch between checkbox, combox, textfield or other.
But I don't know how to realize it.
I don't have any idea how can I handle multi type value and give it to the right element.Should I add a property for each type and set the right property when I create an instance of my component ?
I'm not sure to be very clear here is an example :
wrote on 16 Jul 2018, 13:07 last edited by@DavidM29 hi, You could have a QML Loader that will load the right control component.
http://doc.qt.io/qt-5/qml-qtquick-loader.html -
wrote on 16 Jul 2018, 13:30 last edited by
Thank you ! I'll have a look at it I have never seen this before.
1/3