A little refactoring
This commit is contained in:
parent
8add268df1
commit
4a5016c055
2 changed files with 11 additions and 15 deletions
|
@ -227,10 +227,7 @@ void BrowserCtrlPvt::setupAtom( NLGEORGES::CFormElmStruct *st, int idx )
|
||||||
t = getValueTypeFromDfn( st, idx );
|
t = getValueTypeFromDfn( st, idx );
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVariantProperty *p = addProperty( t, key );
|
QtVariantProperty *p = addVariantProperty( t, key, value );
|
||||||
|
|
||||||
p->setValue( value );
|
|
||||||
m_browser->addProperty( p );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserCtrlPvt::setupStruct( NLGEORGES::UFormElm *node )
|
void BrowserCtrlPvt::setupStruct( NLGEORGES::UFormElm *node )
|
||||||
|
@ -256,8 +253,8 @@ void BrowserCtrlPvt::setupVStruct( GeorgesQt::CFormItem *node )
|
||||||
{
|
{
|
||||||
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
||||||
|
|
||||||
QtVariantProperty *p = mgr->addProperty( QVariant::String, "Dfn filename" );
|
QtVariantProperty *p;
|
||||||
m_browser->addProperty( p );
|
p = addVariantProperty( QVariant::String, "Dfn filename", QVariant() );
|
||||||
|
|
||||||
if( n != NULL )
|
if( n != NULL )
|
||||||
{
|
{
|
||||||
|
@ -279,9 +276,7 @@ void BrowserCtrlPvt::setupArray( GeorgesQt::CFormItem *node )
|
||||||
}
|
}
|
||||||
|
|
||||||
QString key = QObject::tr( "Array size" );
|
QString key = QObject::tr( "Array size" );
|
||||||
QtVariantProperty *p = mgr->addProperty( QVariant::Int, key );
|
QtVariantProperty *p = addVariantProperty( QVariant::Int, key, size );
|
||||||
p->setValue( size );
|
|
||||||
m_browser->addProperty( p );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserCtrlPvt::setupAtom( GeorgesQt::CFormItem *node )
|
void BrowserCtrlPvt::setupAtom( GeorgesQt::CFormItem *node )
|
||||||
|
@ -305,9 +300,7 @@ void BrowserCtrlPvt::setupAtom( GeorgesQt::CFormItem *node )
|
||||||
tt = getValueTypeFromDfn( atom );
|
tt = getValueTypeFromDfn( atom );
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVariantProperty *p = addProperty( tt, "value" );
|
QtVariantProperty *p = addVariantProperty( tt, "value", v.c_str() );
|
||||||
p->setValue( v.c_str() );
|
|
||||||
m_browser->addProperty( p );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
||||||
|
@ -515,9 +508,9 @@ void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )
|
||||||
onAtomValueChanged( p, value );
|
onAtomValueChanged( p, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
QtVariantProperty* BrowserCtrlPvt::addProperty( QVariant::Type type, const QString &name )
|
QtVariantProperty* BrowserCtrlPvt::addVariantProperty( QVariant::Type type, const QString &key, const QVariant &value )
|
||||||
{
|
{
|
||||||
QtVariantProperty *p = mgr->addProperty( type, name );
|
QtVariantProperty *p = mgr->addProperty( type, key );
|
||||||
|
|
||||||
// Remove the color sub-properties, so they don't get triggered on value change
|
// Remove the color sub-properties, so they don't get triggered on value change
|
||||||
if( type == QVariant::Color )
|
if( type == QVariant::Color )
|
||||||
|
@ -533,6 +526,9 @@ QtVariantProperty* BrowserCtrlPvt::addProperty( QVariant::Type type, const QStri
|
||||||
sp.clear();
|
sp.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->setValue( value );
|
||||||
|
m_browser->addProperty( p );
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ private:
|
||||||
void onAtomValueChanged( QtProperty *p, const QVariant &value );
|
void onAtomValueChanged( QtProperty *p, const QVariant &value );
|
||||||
void createArray();
|
void createArray();
|
||||||
|
|
||||||
QtVariantProperty* addProperty( QVariant::Type type, const QString &name );
|
QtVariantProperty* addVariantProperty( QVariant::Type type, const QString &key, const QVariant &value );
|
||||||
|
|
||||||
QtVariantPropertyManager *mgr;
|
QtVariantPropertyManager *mgr;
|
||||||
QtVariantEditorFactory *factory;
|
QtVariantEditorFactory *factory;
|
||||||
|
|
Loading…
Reference in a new issue