Hi all,

I have added the properties to QtTreePropertyBrowser for selected QGraphicsItem objects on QGraphicsScene. But the property order of the browser changes dynamically when I select an item. I couldn’t see the properties as the following.

Added order: ID -> Label -> X -> Y. For example, incorrect order: Label -> X -> Y -> ID. What can the problem be?

Qt Code:
  1. void setPropertiesForManager()
  2. {
  3. QtVariantProperty *pIdentifier = mPropertyManager->addProperty(QVariant::Int, "ID");
  4. pIdentifier->setValue(mID);
  5.  
  6. QtVariantProperty *pLabel = mPropertyManager->addProperty(QVariant::String, "Label");
  7. pLabel->setValue(mItemDef);
  8.  
  9. QtVariantProperty *pXCoord = mPropertyManager->addProperty(QVariant::Int, "X");
  10. pXCoord->setValue(mNodeList[0]->x());
  11.  
  12. QtVariantProperty *pYCoord = mPropertyManager->addProperty(QVariant::Int, "Y");
  13. pYCoord->setValue(mNodeList[0]->y());
  14.  
  15. IController::getInstance()->updatePropertyBrowser(mPropertyManager);
  16. }
  17.  
  18. void updatePropertyBrowser(QtVariantPropertyManager *iPropertyManager)
  19. {
  20. this->clear();
  21.  
  22. this->mPropertyMgr = iPropertyManager;
  23.  
  24. QSet<QtProperty *>::const_iterator i = mPropertyMgr->properties().constBegin();
  25. while (i != mPropertyMgr->properties().constEnd()) {
  26. this->addProperty(*i);
  27. qDebug() << ((QtVariantProperty *)(*i))->value();
  28. ++i;
  29. }
  30.  
  31. this->setFactoryForManager(mPropertyMgr, mFactory);
  32. this->show();
  33. }
To copy to clipboard, switch view to plain text mode 

Thanks a lot for your helps and explanations,
Yasemin