Error in Property Browser Project



  • I am using property browser project using variant approach. I have copied a piece of code from the documentation to test it. But it is giving error 4700 uninitialized local variable priority used. My code is:
    @void createVariantManagerbrowser(){

    QtVariantPropertyManager *variantManager = new QtVariantPropertyManager();
    variantManager->addProperty(QVariant::Int, "Priority");
    QtVariantProperty *priority ;

    priority->setToolTip("Task Priority");
    priority->setAttribute("minimum", 1);
    priority->setAttribute("maximum", 5);
    priority->setValue(3);

    QtVariantProperty *reportType = variantManager->addProperty(QtVariantPropertyManager::enumTypeId(), "Report Type");
    QStringList types;
    types << "Bug" << "Suggestion" << "To Do";
    reportType->setAttribute("enumNames", types);
    reportType->setValue(1); // current value will be "Suggestion"

    QtVariantProperty *task1 = variantManager->addProperty(QtVariantPropertyManager::groupTypeId(), "Task 1");

    task1->addSubProperty(priority);
    task1->addSubProperty(reportType);

    QtTreePropertyBrowser *browser = new QtTreePropertyBrowser();

    QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory();
    browser->setFactoryForManager(variantManager, variantFactory);
    //browser->setFactoryForManager(variantManager, variantFactory);

    browser->addProperty(task1);
    browser->show();
    delete variantManager;
    delete variantFactory;
    delete browser;

    }@
    I am unable to understand the problem.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.