yaseminyilmaz
22nd March 2012, 06:56
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?
void setPropertiesForManager()
{
QtVariantProperty *pIdentifier = mPropertyManager->addProperty(QVariant::Int, "ID");
pIdentifier->setValue(mID);
QtVariantProperty *pLabel = mPropertyManager->addProperty(QVariant::String, "Label");
pLabel->setValue(mItemDef);
QtVariantProperty *pXCoord = mPropertyManager->addProperty(QVariant::Int, "X");
pXCoord->setValue(mNodeList[0]->x());
QtVariantProperty *pYCoord = mPropertyManager->addProperty(QVariant::Int, "Y");
pYCoord->setValue(mNodeList[0]->y());
IController::getInstance()->updatePropertyBrowser(mPropertyManager);
}
void updatePropertyBrowser(QtVariantPropertyManager *iPropertyManager)
{
this->clear();
this->mPropertyMgr = iPropertyManager;
QSet<QtProperty *>::const_iterator i = mPropertyMgr->properties().constBegin();
while (i != mPropertyMgr->properties().constEnd()) {
this->addProperty(*i);
qDebug() << ((QtVariantProperty *)(*i))->value();
++i;
}
this->setFactoryForManager(mPropertyMgr, mFactory);
this->show();
}
Thanks a lot for your helps and explanations,
Yasemin
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?
void setPropertiesForManager()
{
QtVariantProperty *pIdentifier = mPropertyManager->addProperty(QVariant::Int, "ID");
pIdentifier->setValue(mID);
QtVariantProperty *pLabel = mPropertyManager->addProperty(QVariant::String, "Label");
pLabel->setValue(mItemDef);
QtVariantProperty *pXCoord = mPropertyManager->addProperty(QVariant::Int, "X");
pXCoord->setValue(mNodeList[0]->x());
QtVariantProperty *pYCoord = mPropertyManager->addProperty(QVariant::Int, "Y");
pYCoord->setValue(mNodeList[0]->y());
IController::getInstance()->updatePropertyBrowser(mPropertyManager);
}
void updatePropertyBrowser(QtVariantPropertyManager *iPropertyManager)
{
this->clear();
this->mPropertyMgr = iPropertyManager;
QSet<QtProperty *>::const_iterator i = mPropertyMgr->properties().constBegin();
while (i != mPropertyMgr->properties().constEnd()) {
this->addProperty(*i);
qDebug() << ((QtVariantProperty *)(*i))->value();
++i;
}
this->setFactoryForManager(mPropertyMgr, mFactory);
this->show();
}
Thanks a lot for your helps and explanations,
Yasemin