From 95d84cb0f31d7ef49a8786d63253de2406ba296b Mon Sep 17 00:00:00 2001 From: stv Date: Wed, 2 Nov 2011 12:00:11 +0000 Subject: [PATCH] Added Flag NotConvert. --- src/QDS/QDS.h | 15 ++++++++------- src/QDS/QDS_ComboBox.cxx | 4 ++-- src/QDS/QDS_Datum.cxx | 8 ++++---- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/QDS/QDS.h b/src/QDS/QDS.h index 7a96d6538..dbace4708 100644 --- a/src/QDS/QDS.h +++ b/src/QDS/QDS.h @@ -53,13 +53,14 @@ public: //! Enum describes bit flags of the Qt datum view and behaviour typedef enum { - None = 0x00, //!< Non specified any flags (Default behaviour) - Label = 0x01, //!< Create subwidget for datum label - Control = 0x02, //!< Create subwidget for datum input control - Units = 0x04, //!< Create subwidget for datum units of measure - NotFormat = 0x08, //!< Don't format initial value - NotAccel = 0x10, //!< Not support accelerators in datum label - UnitsWithLabel = 0x20, //!< Display units of measure in label like " () instead separate text" + None = 0x00, //!< Non specified any flags (Default behaviour) + Label = 0x01, //!< Create subwidget for datum label + Control = 0x02, //!< Create subwidget for datum input control + Units = 0x04, //!< Create subwidget for datum units of measure + NotFormat = 0x08, //!< Don't format initial value + NotAccel = 0x10, //!< Not support accelerators in datum label + NotConvert = 0x20, //!< Don't convert numeric value + UnitsWithLabel = 0x40, //!< Display units of measure in label like " () instead separate text" All = Label | Control | Units //!< Create all subwidgets } DatumFlags; diff --git a/src/QDS/QDS_ComboBox.cxx b/src/QDS/QDS_ComboBox.cxx index 89ba77461..3e37b409e 100644 --- a/src/QDS/QDS_ComboBox.cxx +++ b/src/QDS/QDS_ComboBox.cxx @@ -410,11 +410,11 @@ void QDS_ComboBox::setString( const QString& txt ) else if ( txt.isEmpty() ) { if ( !cb->isEditable() ) - cb->setItemText( cb->currentIndex(), txt ); + cb->setCleared( true ); else cb->lineEdit()->setText( txt ); } - if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) ) + if ( isClear != txt.isEmpty() || ( !isClear && old != cb->currentIndex() ) || isClear != cb->isCleared() ) { onParamChanged(); QString str = getString(); diff --git a/src/QDS/QDS_Datum.cxx b/src/QDS/QDS_Datum.cxx index 2a0ab0b13..270480ba4 100644 --- a/src/QDS/QDS_Datum.cxx +++ b/src/QDS/QDS_Datum.cxx @@ -588,7 +588,7 @@ double QDS_Datum::doubleValue() const else { res = getString().toDouble(); - if ( !myDicItem.IsNull() ) + if ( !myDicItem.IsNull() && !( flags() & NotConvert ) ) res = myDicItem->ToSI( res ); } @@ -613,7 +613,7 @@ int QDS_Datum::integerValue() const else { double val = getString().toDouble(); - if ( !myDicItem.IsNull() ) + if ( !myDicItem.IsNull() && !( flags() & NotConvert ) ) res = (int)myDicItem->ToSI( val ); } @@ -738,7 +738,7 @@ void QDS_Datum::setDoubleValue( const double num ) mySourceValue = QString().setNum( num, 'g', 16 ); double val = num; - if ( !myDicItem.IsNull() ) + if ( !myDicItem.IsNull() && !( flags() & NotConvert ) ) val = myDicItem->FromSI( val ); QString aStr = format( ( flags() & NotFormat ) ? (QString) "" : format(), type(), val ); @@ -766,7 +766,7 @@ void QDS_Datum::setIntegerValue( const int num ) mySourceValue = QString().setNum( num ); double val = num; - if ( !myDicItem.IsNull() ) + if ( !myDicItem.IsNull() && !( flags() & NotConvert ) ) val = myDicItem->FromSI( val ); QString aStr = format( ( flags() & NotFormat ) ? (QString) "" : format(), type(), val ); -- 2.39.2