mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-26 17:16:20 +00:00
Added support for manipulating atoms.
--HG-- branch : dfighter-tools
This commit is contained in:
parent
b63f73b1b6
commit
ff0df2bf50
4 changed files with 48 additions and 0 deletions
|
@ -454,6 +454,7 @@ public:
|
||||||
|
|
||||||
// Set the value, the elt been used
|
// Set the value, the elt been used
|
||||||
void setValue (const char *value);
|
void setValue (const char *value);
|
||||||
|
std::string getValue() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The value
|
// The value
|
||||||
|
|
|
@ -3056,6 +3056,13 @@ void CFormElmAtom::setValue (const char *value)
|
||||||
|
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
|
std::string CFormElmAtom::getValue() const
|
||||||
|
{
|
||||||
|
return Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ***************************************************************************
|
||||||
|
|
||||||
void CFormElmAtom::getFormName (std::string &result, const CFormElm *child) const
|
void CFormElmAtom::getFormName (std::string &result, const CFormElm *child) const
|
||||||
{
|
{
|
||||||
// Must be NULL
|
// Must be NULL
|
||||||
|
|
|
@ -146,6 +146,29 @@ void BrowserCtrlPvt::setupArray( GeorgesQt::CFormItem *node )
|
||||||
m_browser->addProperty( p );
|
m_browser->addProperty( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserCtrlPvt::setupAtom( GeorgesQt::CFormItem *node )
|
||||||
|
{
|
||||||
|
NLGEORGES::UFormElm *n = getGeorgesNode( node );
|
||||||
|
|
||||||
|
if( n == NULL )
|
||||||
|
return;
|
||||||
|
|
||||||
|
NLGEORGES::CFormElmAtom *atom = static_cast< NLGEORGES::CFormElmAtom* >( n );
|
||||||
|
std::string v = atom->getValue();
|
||||||
|
|
||||||
|
const NLGEORGES::CType *t = atom->getType();
|
||||||
|
QVariant::Type tt = QVariant::String;
|
||||||
|
if( t != NULL )
|
||||||
|
{
|
||||||
|
tt = getValueType( t );
|
||||||
|
}
|
||||||
|
|
||||||
|
QtVariantProperty *p = mgr->addProperty( tt, "value" );
|
||||||
|
p->setValue( v.c_str() );
|
||||||
|
m_browser->addProperty( p );
|
||||||
|
|
||||||
|
m_currentNode.p = n;
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
||||||
{
|
{
|
||||||
|
@ -159,6 +182,9 @@ void BrowserCtrlPvt::setupNode( GeorgesQt::CFormItem *node )
|
||||||
else
|
else
|
||||||
if( node->isStruct() )
|
if( node->isStruct() )
|
||||||
setupStruct( node );
|
setupStruct( node );
|
||||||
|
else
|
||||||
|
if( node->isAtom() )
|
||||||
|
setupAtom( node );
|
||||||
|
|
||||||
m_browser->setFactoryForManager( mgr, factory );
|
m_browser->setFactoryForManager( mgr, factory );
|
||||||
}
|
}
|
||||||
|
@ -283,6 +309,15 @@ void BrowserCtrlPvt::onArrayValueChanged( QtProperty *p, const QVariant &value )
|
||||||
m_currentNode.p = NULL;
|
m_currentNode.p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BrowserCtrlPvt::onAtomValueChanged( QtProperty *p, const QVariant &value )
|
||||||
|
{
|
||||||
|
NLGEORGES::CFormElmAtom *atom = static_cast< NLGEORGES::CFormElmAtom* >( m_currentNode.p );
|
||||||
|
atom->setValue( value.toString().toUtf8() );
|
||||||
|
|
||||||
|
Q_EMIT modified();
|
||||||
|
Q_EMIT valueChanged( m_currentNode.name, value.toString() );
|
||||||
|
}
|
||||||
|
|
||||||
void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )
|
void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )
|
||||||
{
|
{
|
||||||
if( m_currentNode.p == NULL )
|
if( m_currentNode.p == NULL )
|
||||||
|
@ -299,6 +334,9 @@ void BrowserCtrlPvt::onValueChanged( QtProperty *p, const QVariant &value )
|
||||||
else
|
else
|
||||||
if( m_currentNode.p->isArray() )
|
if( m_currentNode.p->isArray() )
|
||||||
onArrayValueChanged( p, value );
|
onArrayValueChanged( p, value );
|
||||||
|
else
|
||||||
|
if( m_currentNode.p->isAtom() )
|
||||||
|
onAtomValueChanged( p, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -65,9 +65,11 @@ private:
|
||||||
|
|
||||||
void setupStruct( GeorgesQt::CFormItem *node );
|
void setupStruct( GeorgesQt::CFormItem *node );
|
||||||
void setupArray( GeorgesQt::CFormItem *node );
|
void setupArray( GeorgesQt::CFormItem *node );
|
||||||
|
void setupAtom( GeorgesQt::CFormItem *node );
|
||||||
|
|
||||||
void onStructValueChanged( QtProperty *p, const QVariant &value );
|
void onStructValueChanged( QtProperty *p, const QVariant &value );
|
||||||
void onArrayValueChanged( QtProperty *p, const QVariant &value );
|
void onArrayValueChanged( QtProperty *p, const QVariant &value );
|
||||||
|
void onAtomValueChanged( QtProperty *p, const QVariant &value );
|
||||||
void createArray();
|
void createArray();
|
||||||
|
|
||||||
QtVariantPropertyManager *mgr;
|
QtVariantPropertyManager *mgr;
|
||||||
|
|
Loading…
Reference in a new issue