From 0587d6a68768aaff4720cd6c50519c411dc54ec8 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 10 Sep 2014 00:36:55 +0200 Subject: [PATCH] Create vstruct node when needed. --HG-- branch : dfighter-tools --- .../georges_editor/browser_ctrl_pvt.cpp | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp index af622633c..723836f67 100644 --- a/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp +++ b/code/studio/src/plugins/georges_editor/browser_ctrl_pvt.cpp @@ -198,16 +198,16 @@ void BrowserCtrlPvt::setupStruct( GeorgesQt::CFormItem *node ) void BrowserCtrlPvt::setupVStruct( GeorgesQt::CFormItem *node ) { NLGEORGES::UFormElm *n = getGeorgesNode( node ); - if( n == NULL ) - return; - - NLGEORGES::CFormElmVirtualStruct *vs = static_cast< NLGEORGES::CFormElmVirtualStruct* >( n ); QtVariantProperty *p = mgr->addProperty( QVariant::String, "Dfn filename" ); - mgr->setValue( p, vs->DfnFilename.c_str() ); m_browser->addProperty( p ); - setupStruct( n ); + if( n != NULL ) + { + NLGEORGES::CFormElmVirtualStruct *vs = static_cast< NLGEORGES::CFormElmVirtualStruct* >( n ); + mgr->setValue( p, vs->DfnFilename.c_str() ); + setupStruct( n ); + } } void BrowserCtrlPvt::setupArray( GeorgesQt::CFormItem *node ) @@ -308,6 +308,25 @@ void BrowserCtrlPvt::onVStructValueChanged( QtProperty *p, const QVariant &value } NLGEORGES::CFormElmVirtualStruct *vs = static_cast< NLGEORGES::CFormElmVirtualStruct* >( getCurrentNode() ); + if( vs == NULL ) + { + const NLGEORGES::CFormDfn *parentDfn; + const NLGEORGES::CFormDfn *nodeDfn; + uint indexDfn; + const NLGEORGES::CType *type; + NLGEORGES::UFormDfn::TEntryType entryType; + NLGEORGES::CFormElm *node; + bool created; + bool isArray; + + m_rootNode->createNodeByName( m_currentNode.name.toUtf8().constData(), &parentDfn, indexDfn, &nodeDfn, &type, &node, entryType, isArray, created ); + + if( !created ) + return; + + vs = static_cast< NLGEORGES::CFormElmVirtualStruct* >( node ); + } + vs->DfnFilename = value.toString().toUtf8().constData(); QString key = m_currentNode.name + "." + p->propertyName();