mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-19 05:36:13 +00:00
Mark the typ dialog modified after a modification.
This commit is contained in:
parent
c728b039ab
commit
2d55f4d648
4 changed files with 59 additions and 0 deletions
|
@ -169,12 +169,18 @@ void GeorgesTypDialog::onModified()
|
||||||
Q_EMIT modified();
|
Q_EMIT modified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GeorgesTypDialog::onModified( const QString &k, const QString &v )
|
||||||
|
{
|
||||||
|
onModified();
|
||||||
|
}
|
||||||
|
|
||||||
void GeorgesTypDialog::setupConnections()
|
void GeorgesTypDialog::setupConnections()
|
||||||
{
|
{
|
||||||
connect( m_ui.addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
|
connect( m_ui.addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
|
||||||
connect( m_ui.removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
|
connect( m_ui.removeButton, SIGNAL( clicked( bool ) ), this, SLOT( onRemoveClicked() ) );
|
||||||
|
|
||||||
connect( m_ui.tree, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ), this, SLOT( onItemChanged( QTreeWidgetItem*, int ) ) );
|
connect( m_ui.tree, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ), this, SLOT( onItemChanged( QTreeWidgetItem*, int ) ) );
|
||||||
|
connect( m_pvt->ctrl, SIGNAL( modified( const QString&, const QString& ) ), this, SLOT( onModified( const QString&, const QString& ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeorgesTypDialog::log( const QString &msg )
|
void GeorgesTypDialog::log( const QString &msg )
|
||||||
|
|
|
@ -25,6 +25,7 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void onItemChanged( QTreeWidgetItem *item, int column );
|
void onItemChanged( QTreeWidgetItem *item, int column );
|
||||||
void onModified();
|
void onModified();
|
||||||
|
void onModified( const QString &k, const QString &v );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
|
|
@ -7,6 +7,43 @@
|
||||||
|
|
||||||
#include "nel/georges/type.h"
|
#include "nel/georges/type.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
QString typeToString( int v )
|
||||||
|
{
|
||||||
|
QString s;
|
||||||
|
|
||||||
|
switch( v )
|
||||||
|
{
|
||||||
|
case NLGEORGES::UType::UnsignedInt: s = "UnsignedInt"; break;
|
||||||
|
case NLGEORGES::UType::SignedInt: s = "SignedInt"; break;
|
||||||
|
case NLGEORGES::UType::Double: s = "Double"; break;
|
||||||
|
case NLGEORGES::UType::String: s = "String"; break;
|
||||||
|
case NLGEORGES::UType::Color: s = "Color"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString uitypeToString( int v )
|
||||||
|
{
|
||||||
|
QString s;
|
||||||
|
|
||||||
|
switch( v )
|
||||||
|
{
|
||||||
|
case NLGEORGES::CType::Edit: s = "Edit"; break;
|
||||||
|
case NLGEORGES::CType::EditSpin: s = "EditSpin"; break;
|
||||||
|
case NLGEORGES::CType::NonEditableCombo: s = "NonEditableCombo"; break;
|
||||||
|
case NLGEORGES::CType::FileBrowser: s = "FileBrowser"; break;
|
||||||
|
case NLGEORGES::CType::BigEdit: s = "BigEdit"; break;
|
||||||
|
case NLGEORGES::CType::ColorEdit: s = "ColorEdit"; break;
|
||||||
|
case NLGEORGES::CType::IconWidget: s = "IconWidget"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TypBrowserCtrl::TypBrowserCtrl( QObject *parent ) :
|
TypBrowserCtrl::TypBrowserCtrl( QObject *parent ) :
|
||||||
QObject( parent )
|
QObject( parent )
|
||||||
{
|
{
|
||||||
|
@ -106,20 +143,32 @@ void TypBrowserCtrl::onVariantValueChanged( QtProperty *p, const QVariant &v )
|
||||||
{
|
{
|
||||||
m_typ->Increment = v.toString().toUtf8().constData();
|
m_typ->Increment = v.toString().toUtf8().constData();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_EMIT modified( n, v.toString().toUtf8().constData() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypBrowserCtrl::onEnumValueChanged( QtProperty *p, int v )
|
void TypBrowserCtrl::onEnumValueChanged( QtProperty *p, int v )
|
||||||
{
|
{
|
||||||
QString n = p->propertyName();
|
QString n = p->propertyName();
|
||||||
|
QString value;
|
||||||
|
|
||||||
if( n == "type" )
|
if( n == "type" )
|
||||||
{
|
{
|
||||||
m_typ->Type = NLGEORGES::UType::TType( v );
|
m_typ->Type = NLGEORGES::UType::TType( v );
|
||||||
|
value = typeToString( v );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( n == "uitype" )
|
if( n == "uitype" )
|
||||||
{
|
{
|
||||||
m_typ->UIType = NLGEORGES::CType::TUI( v );
|
m_typ->UIType = NLGEORGES::CType::TUI( v );
|
||||||
|
value = uitypeToString( v );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
Q_EMIT modified( n, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TypBrowserCtrl::enableMgrConnections()
|
void TypBrowserCtrl::enableMgrConnections()
|
||||||
|
|
|
@ -28,6 +28,9 @@ public:
|
||||||
void setTyp( NLGEORGES::CType *typ ){ m_typ = typ; }
|
void setTyp( NLGEORGES::CType *typ ){ m_typ = typ; }
|
||||||
void setBrowser( QtTreePropertyBrowser *browser ){ m_browser = browser; }
|
void setBrowser( QtTreePropertyBrowser *browser ){ m_browser = browser; }
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void modified( const QString &k, const QString &v );
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onVariantValueChanged( QtProperty *p, const QVariant &v );
|
void onVariantValueChanged( QtProperty *p, const QVariant &v );
|
||||||
void onEnumValueChanged( QtProperty *p, int v );
|
void onEnumValueChanged( QtProperty *p, int v );
|
||||||
|
|
Loading…
Reference in a new issue