for ( QValueList<QDS_Datum*>::iterator it = _datumList.begin(); it != _datumList.end(); ++it )
{
QDS_Datum* datum = *it;
- if ( !datum )
+ if ( !datum || !datum->flags( AutoUnits ) )
continue;
bool ok = aComp.IsEmpty();
public:
typedef enum { None = 0x00, Label = 0x01, Control = 0x02, Units = 0x04,
NotFormat = 0x08, NotAccel = 0x10, UnitsWithLabel = 0x20,
- All = Label | Control | Units } DatumFlags;
+ AutoUnits = 0x40, All = Label | Control | Units } DatumFlags;
public:
static bool load( const QString& );
}
}
+void QDS_Datum::updateUnits()
+{
+ Handle(DDS_DicItem) item = dicItem();
+ if ( item.IsNull() )
+ return;
+
+ unitSystemChanged( activeUnitSystem( toQString( item->GetComponent() ) ) );
+}
+
+bool QDS_Datum::flags( const int f ) const
+{
+ return ( myFlags & f ) == f;
+}
+
void QDS_Datum::setValue( const QVariant& val )
{
if ( val.isValid() && val.canCast( QVariant::String ) )
#include "QDS.h"
-#include <qobject.h>
+#include <qwidget.h>
#include <qstring.h>
#include <qvariant.h>
#include <qguardedptr.h>
virtual void reset();
virtual void clear();
+ void updateUnits();
+ bool flags( const int ) const;
+
virtual void setValue( const QVariant& );
virtual void setStringValue( const QString& );