Mark the typ dialog modified after a modification.

This commit is contained in:
dfighter1985 2014-09-03 16:26:52 +02:00
parent 4239748047
commit c2738ecf73
4 changed files with 59 additions and 0 deletions

View file

@ -169,12 +169,18 @@ void GeorgesTypDialog::onModified()
Q_EMIT modified();
}
void GeorgesTypDialog::onModified( const QString &k, const QString &v )
{
onModified();
}
void GeorgesTypDialog::setupConnections()
{
connect( m_ui.addButton, SIGNAL( clicked( bool ) ), this, SLOT( onAddClicked() ) );
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_pvt->ctrl, SIGNAL( modified( const QString&, const QString& ) ), this, SLOT( onModified( const QString&, const QString& ) ) );
}
void GeorgesTypDialog::log( const QString &msg )

View file

@ -25,6 +25,7 @@ private Q_SLOTS:
void onItemChanged( QTreeWidgetItem *item, int column );
void onModified();
void onModified( const QString &k, const QString &v );
private:
void setupConnections();

View file

@ -7,6 +7,43 @@
#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 ) :
QObject( parent )
{
@ -106,20 +143,32 @@ void TypBrowserCtrl::onVariantValueChanged( QtProperty *p, const QVariant &v )
{
m_typ->Increment = v.toString().toUtf8().constData();
}
else
return;
Q_EMIT modified( n, v.toString().toUtf8().constData() );
}
void TypBrowserCtrl::onEnumValueChanged( QtProperty *p, int v )
{
QString n = p->propertyName();
QString value;
if( n == "type" )
{
m_typ->Type = NLGEORGES::UType::TType( v );
value = typeToString( v );
}
else
if( n == "uitype" )
{
m_typ->UIType = NLGEORGES::CType::TUI( v );
value = uitypeToString( v );
}
else
return;
Q_EMIT modified( n, value );
}
void TypBrowserCtrl::enableMgrConnections()

View file

@ -28,6 +28,9 @@ public:
void setTyp( NLGEORGES::CType *typ ){ m_typ = typ; }
void setBrowser( QtTreePropertyBrowser *browser ){ m_browser = browser; }
Q_SIGNALS:
void modified( const QString &k, const QString &v );
private Q_SLOTS:
void onVariantValueChanged( QtProperty *p, const QVariant &v );
void onEnumValueChanged( QtProperty *p, int v );