Fixed a crash. Setting a value into a valueless Georges node doesn't assign a type, which leads to a crash when trying to poll the value directly from the node. However if the value is polled indirectly using the node's name the value can be retrieved without a crash.
This commit is contained in:
parent
2cea18eae8
commit
02b2fc5b81
1 changed files with 12 additions and 3 deletions
|
@ -35,6 +35,7 @@ public:
|
||||||
mgr = new QtVariantPropertyManager();
|
mgr = new QtVariantPropertyManager();
|
||||||
factory = new QtVariantEditorFactory();
|
factory = new QtVariantEditorFactory();
|
||||||
m_currentNode = NULL;
|
m_currentNode = NULL;
|
||||||
|
m_rootNode = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
~BrowserCtrlPvt()
|
~BrowserCtrlPvt()
|
||||||
|
@ -56,9 +57,11 @@ public:
|
||||||
{
|
{
|
||||||
t = getValueType( elm.Element->getType() );
|
t = getValueType( elm.Element->getType() );
|
||||||
|
|
||||||
NLGEORGES::CFormElmAtom *atom = static_cast< NLGEORGES::CFormElmAtom* >( elm.Element );
|
std::string formName;
|
||||||
|
elm.Element->getFormName( formName, NULL );
|
||||||
|
|
||||||
std::string v;
|
std::string v;
|
||||||
atom->getValue( v, NLGEORGES::UFormElm::NoEval );
|
m_rootNode->getValueByName( v, formName.c_str(), NLGEORGES::UFormElm::NoEval, NULL, 0 );
|
||||||
value = v.c_str();
|
value = v.c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,17 +101,21 @@ public:
|
||||||
std::string k = p->propertyName().toUtf8().constData();
|
std::string k = p->propertyName().toUtf8().constData();
|
||||||
std::string v = value.toString().toUtf8().constData();
|
std::string v = value.toString().toUtf8().constData();
|
||||||
|
|
||||||
m_currentNode->setValueByName( v.c_str(), k.c_str() );
|
bool created = false;
|
||||||
|
m_currentNode->setValueByName( v.c_str(), k.c_str(), &created );
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVariantPropertyManager* manager() const{ return mgr; }
|
QtVariantPropertyManager* manager() const{ return mgr; }
|
||||||
|
|
||||||
|
void setRootNode( NLGEORGES::CFormElm *root ){ m_rootNode = root; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QtVariantPropertyManager *mgr;
|
QtVariantPropertyManager *mgr;
|
||||||
QtVariantEditorFactory *factory;
|
QtVariantEditorFactory *factory;
|
||||||
QtTreePropertyBrowser *m_browser;
|
QtTreePropertyBrowser *m_browser;
|
||||||
|
|
||||||
NLGEORGES::UFormElm *m_currentNode;
|
NLGEORGES::UFormElm *m_currentNode;
|
||||||
|
NLGEORGES::CFormElm *m_rootNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
BrowserCtrl::BrowserCtrl( QtTreePropertyBrowser *browser ) :
|
BrowserCtrl::BrowserCtrl( QtTreePropertyBrowser *browser ) :
|
||||||
|
@ -131,6 +138,8 @@ void BrowserCtrl::clicked( const QModelIndex &idx )
|
||||||
|
|
||||||
GeorgesQt::CFormItem *item = static_cast< GeorgesQt::CFormItem* >( idx.internalPointer() );
|
GeorgesQt::CFormItem *item = static_cast< GeorgesQt::CFormItem* >( idx.internalPointer() );
|
||||||
NLGEORGES::UFormElm &root = m_form->getRootNode();
|
NLGEORGES::UFormElm &root = m_form->getRootNode();
|
||||||
|
NLGEORGES::CFormElm *rootNode = dynamic_cast< NLGEORGES::CFormElm* >( &root );
|
||||||
|
m_pvt->setRootNode( rootNode );
|
||||||
NLGEORGES::UFormElm *node = NULL;
|
NLGEORGES::UFormElm *node = NULL;
|
||||||
bool b = false;
|
bool b = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue