'How to add custom property (with inserted controls) in QtTreePropertyBrowser

I would like to add custom property with inserted controls in QtTreePorpertyBrowser Here is a sample snapshot for my requirement:

enter image description here



Solution 1:[1]

I straight away lifted below piece of code from (not tested).

https://www.codeproject.com/Articles/5256485/QtTreePropertyBrowser-vs-PropertyGrid-Application

The link may break in future, so copied below snippet. The code is bit straight forward.

QtVariantPropertyManager *variantManager = new QtVariantPropertyManager;
QtTreePropertyBrowser browser;
browser.setFactoryForManager(variantManager, new QtVariantEditorFactory);
QtVariantProperty *p = variantManager->addProperty(QVariant::Int, "Property1");
browser.addProperty(p);

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pavan Chandaka