Closed Lishen1 closed 5 years ago
Yes, I can reproduce this.
It's because I'm adding property to property set in QtnPropertyBase constructor. At this time QtnPropertyBool object is not constructed yet so delegate factory looking delegate by QtnPropertyBase type.
In the second case delegate factory is working in the line
centralWidget->setPropertySet(m_propertySet);
and QtnPropertyBool object is fully constructed at this point.
There are two solutions there:
boolProperty = new QtnPropertyBool(m_propertySet);
won't work and you will have to do explicit call:
m_propertySet->addChildProperty(boolProperty);
Both solutions have caveats.
What do you think?
for the first case i get error C2512: 'QtnPropertyBool': no appropriate default constructor available this case didnt work too
_prop = new T(_prop_set);
_prop_set->addChildProperty(_prop);
I meant I should change QtnProperty code to have solution 1 or 2. Now it doesn't work. I know.
I'm refactoring code now and ping you when done.
I have made some changes in the code. Now "new T(_prop_set);" doesn't adds new property to _prop_set. you have to choices: 1.
_prop = new T(_prop_set);
_prop_set->addChildProperty(_prop);
2.
qtnCreateProperty<T>(_prop_set [, "property name"]);
thank you, it works.
if i swap this lines
this problem is gone.