Salome HOME
Merge changes from 'master' branch.
[modules/gui.git] / src / QDS / QDS_Datum.cxx
index ff3ed8aca976a01e49b6db35694a88d853cb4ae8..d9fc86484ea440bdaf60936dff978ea186453531 100644 (file)
@@ -1,21 +1,41 @@
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
 #include "QDS_Datum.h"
 
-#include "QDS_Validator.h"
+#include <QLayout>
+#include <QVariant>
+#include <QTimer>
+#include <QEvent>
+#include <QMessageBox>
+#include <QApplication>
 
+#include "QDS_Validator.h"
 #include <DDS_Dictionary.h>
 
-#include <qtimer.h>
-#include <qlabel.h>
-#include <qwidget.h>
-#include <qlayout.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qvalidator.h>
-#include <qmessagebox.h>
-
 /*!
-  Class: QDS_Datum::Wrapper
-  Descr: Wrapper widget for sub widgets. [internal]
+  \class QDS_Datum::Wrapper
+  \internal
+  \brief Wrapper for sub widgets.
 */
 
 class QDS_Datum::Wrapper : public QWidget
@@ -24,92 +44,168 @@ public:
   Wrapper( QWidget* = 0 );
   virtual ~Wrapper();
 
-  QWidget*      widget() const;
-  void          setWidget( QWidget* );
+  QWidget* widget() const;
+  void     setWidget( QWidget* );
 
-  virtual bool  eventFilter( QObject*, QEvent* );
-
-protected:
-  virtual void  resizeEvent( QResizeEvent* );
+  virtual void  setGeometry( int x, int y, int w, int h );
+  virtual void  setSizePolicy( QSizePolicy );
 
 private:
-  QWidget*      myWid;
+  QWidget* myWid;
 };
 
-
+/*!
+  \brief Constructor.
+  \param parent parent widget
+*/
 QDS_Datum::Wrapper::Wrapper( QWidget* parent )
 : QWidget( parent ),
-myWid( 0 )
+  myWid( 0 )
 {
-  QHBoxLayout* base = new QHBoxLayout( this );
-  base->setAutoAdd( true );
+  setLayout( new QHBoxLayout() );
+  layout()->setSpacing( 0 );
+  layout()->setMargin( 0 );
+  setFocusPolicy( Qt::StrongFocus );
 }
 
+/*!
+  \brief Destructor.
+*/
 QDS_Datum::Wrapper::~Wrapper()
 {
 }
 
+/*!
+  \brief Get widget.
+  \return widget
+*/
 QWidget* QDS_Datum::Wrapper::widget() const
 {
   return myWid;
 }
 
+/*!
+  \brief Set widget.
+  \param wid widget
+*/
 void QDS_Datum::Wrapper::setWidget( QWidget* wid )
 {
-  if ( myWid == wid )
+  if ( myWid == wid || !wid )
     return;
 
-  if ( myWid )
-    myWid->removeEventFilter( this );
-
+  wid->setParent( this );
+  QHBoxLayout* hl = qobject_cast<QHBoxLayout*>( layout() );
+  if( myWid )
+    hl->removeWidget( myWid );
+  hl->addWidget( wid );
   myWid = wid;
 
-  if ( !myWid )
-    return;
-
-  if ( myWid->parent() != this )
-    myWid->reparent( this, QPoint( 0, 0 ) );
-
+  setTabOrder( this, myWid );
   setFocusProxy( myWid );
 
   myWid->updateGeometry();
   updateGeometry();
-
-  myWid->installEventFilter( this );
 }
 
-bool QDS_Datum::Wrapper::eventFilter( QObject* o, QEvent* e )
+/*!
+  \brief Set size policy of the widget.
+  \param sp new size policy
+*/
+void QDS_Datum::Wrapper::setSizePolicy( QSizePolicy sp )
 {
-  if ( e->type() == QEvent::Resize && o == widget() )
-  {
-    QResizeEvent* re = (QResizeEvent*)e;
-    if ( re->size() != size() )
-      resize( re->size() );
-  }
-  return QWidget::eventFilter( o, e );
+  QWidget::setSizePolicy( sp );
+
+  if ( widget() )
+    widget()->setSizePolicy( sp );
 }
 
-void QDS_Datum::Wrapper::resizeEvent( QResizeEvent* e )
+/*!
+  \brief Set widget geometry.
+  \param x horizontal position
+  \param y vertical position
+  \param w widget width
+  \param h widget height
+*/
+void QDS_Datum::Wrapper::setGeometry( int x, int y, int w, int h )
 {
-  QWidget::resizeEvent( e );
+  QWidget::setGeometry( x, y, w, h );
 
   if ( widget() && widget()->size() != size() )
-    widget()->resize( size() );
+    widget()->setGeometry( 0, 0, width(), height() );
 }
 
 /*!
-  Class: QDS_Datum
-  Descr: Base class for control used data dictionary. [public]
+  \class QDS_Datum
+  \brief Base class for all controls using the data dictionary. 
+
+  Datum is successor of QObject (not QWidget). This object can have up to three
+  sub widgets named as QDS::Label, QDS::Control and QDS::Units. 
+  User can prevent creation of any of them by setting corresponding subwidgets IDs
+  in the parameter \a flags of the constructor.
+  QDS::Label widget displays label of datum, QDS::Control widget allows 
+  entering the value and QDS::Units widget displays measure units in the active 
+  units system.
+  
+  These widgets are constructed under the parent widget of the datum. 
+  The sub widgets are layouted in the parent widget in the following order: first widget
+  is QDS::Label, it is followed by QDS::Control, and in the end is QDS::Units.
+  User can add these widgets to layout manually using method addTo().
+  Method widget() can be used to retrieve desired widget and place it into layout.
+
+  When QGroupBox is used as parent widget for datum object, all subwidgets are 
+  arranged automatically by the group box according to the column and orientation
+  properties of the QGroupBox.
+
+  Example:
+  \code
+  QGroupBox* box = new QGroupBox( 3, Qt::Horizontal, "datum box" );
+  QDS_Datum* d1  = new QDS_Datum( "datum_1", box, All );
+  QDS_Datum* d2  = new QDS_Datum( "datum_2", box, All );
+  QDS_Datum* d3  = new QDS_Datum( "datum_3", box, All );
+  \endcode
+
+  In this example we create the QGroupBox with 3 horizontal columns. 
+  All the created datum widgets will be placed automatically in 3 rows.
+  Datums will be placed from top to bottom one by one and aligned in he grid.
+
+  Datum value is stored as string. User can get/set this value:
+  - As string : stringValue()/setStringValue().
+  - As integer : integerValue()/setIntegerValue(). Value is converted to/from SI.
+  - As double : doubleValue()/setDoubleValue(). Value is converted to/from SI.
+  - As variant : value()/setValue().
+
+  User can enable/disable datum subwidgets with setEnabled() method, show/hide them
+  with show()/hide() methods, set input focus to datum with setFocus(), set widgets 
+  alignment with setAlignment(), etc.
 */
 
+/*!
+  \brief Constructor. 
+
+  Create datum object with datum identifier \a id and parent widget \a parent.
+
+  Parameter \a flags defines behaviour of datum and set of created
+  subwidgets. Default value of this parameter is QDS::All.
+
+  Parameter \a comp specifies the component name which will be used
+  when searching the dictionary item.
+
+  Datum is self-registered in the global list by QDS::insertDatum().
+
+  \param id datum identifier
+  \param parent parent widget
+  \param flags datum flags
+  \param comp component
+*/
 QDS_Datum::QDS_Datum( const QString& id, QWidget* parent, const int flags, const QString& comp )
 : QObject( parent ),
-myId( id ),
-myLabel( 0 ),
-myUnits( 0 ),
-myControl( 0 ),
-myFlags( flags ),
-myInitialised( false )
+  myId( id ),
+  myLabel( 0 ),
+  myUnits( 0 ),
+  myControl( 0 ),
+  myFlags( flags ),
+  myInitialised( false ),
+  myTr( false )
 {
   if ( myFlags & Label )
     myWrapper.insert( Label, new Wrapper( parent ) );
@@ -119,7 +215,7 @@ myInitialised( false )
     myWrapper.insert( Units, new Wrapper( parent ) );
 
   for ( QMap<int, Wrapper*>::Iterator it = myWrapper.begin(); it != myWrapper.end(); ++it )
-    connect( it.data(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
+    connect( it.value(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
 
   Handle(DDS_Dictionary) aDict = DDS_Dictionary::Get();
   if ( aDict.IsNull() )
@@ -141,6 +237,12 @@ myInitialised( false )
   insertDatum( this );
 }
 
+/*!
+  \brief Destructor. 
+
+  Destroy all subwidget. Datum is unregistered from the global list
+  by QDS::removeDatum().
+*/
 QDS_Datum::~QDS_Datum()
 {
   removeDatum( this );
@@ -154,6 +256,19 @@ QDS_Datum::~QDS_Datum()
 */
 }
 
+/*!
+  \brief Overloaded operator used to retrieve main subwidget named QDS::Control.
+  \return QDS::Control subwidget
+*/
+QDS_Datum::operator QWidget*() const
+{
+  return widget( Control );
+}
+
+/*!
+  \brief Get the datum ID.
+  \return datum ID
+*/
 QString QDS_Datum::id() const
 {
   initDatum();
@@ -161,6 +276,10 @@ QString QDS_Datum::id() const
   return myId;
 }
 
+/*!
+  \brief Get the datum value type.
+  \return datum value type
+*/
 int QDS_Datum::type() const
 {
   initDatum();
@@ -171,20 +290,74 @@ int QDS_Datum::type() const
   return res;
 }
 
+/*!
+  \brief Return state of custom translation.
+  \return true if custom translation is enabled
+*/
+bool QDS_Datum::isCustomTr() const
+{
+  return myTr;
+}
+
+/*!
+  \brief Change state of custom translation.
+
+  Custom translation means that text labels of datums are translated
+  with help of standard Qt mechanism of internationalization. In this
+  case special records should be placed into *.ts files under context "QDS".
+  For example, if label has name "myLabel", the corresponding translation
+  should be written:
+  <context>
+    <name>QDS</name>
+    <message>
+        <source>myLabel</source>
+        <translation>myLabel translation</translation>
+    </message>
+    ...
+
+  If custom translation mechanism is deactivated, then labels will be shown
+  with text got from xml data dictionary file
+
+  By default, the custom translation is deactivated
+
+  \param on - if it is true, custom translation is activated, otherwise, deactivated 
+*/
+void QDS_Datum::enableCustomTr( const bool on )
+{
+  myTr = on;
+  labelWidget()->setText( label() );
+}
+
+/*!
+  \brief Get the datum label text.
+  \return label text
+*/
 QString QDS_Datum::label() const
 {
   initDatum();
 
   QString labStr;
   if ( !myDicItem.IsNull() )
+  {
     labStr = toQString( myDicItem->GetLabel() );
-
+    if( labStr.isNull() )
+      labStr = toQString( myDicItem->GetId() );
+  }
+  if( myTr && labStr.length()>0 )
+  {
+    QString dest = QApplication::translate( "QDS", labStr.toLatin1().constData() );
+    if( labStr != dest )
+      labStr = dest;
+  }
   if ( flags() & NotAccel )
     labStr = removeAccel( labStr );
-
   return labStr;
 }
 
+/*!
+  \brief Get the datum units text.
+  \return units text
+*/
 QString QDS_Datum::units() const
 {
   initDatum();
@@ -195,6 +368,10 @@ QString QDS_Datum::units() const
   return unitStr;
 }
 
+/*!
+  \brief Get the datum filter string.
+  \return filter string
+*/
 QString QDS_Datum::filter() const
 {
   initDatum();
@@ -205,6 +382,10 @@ QString QDS_Datum::filter() const
   return fltr;
 }
 
+/*!
+  \brief Get the datum format string
+  \return format string
+*/
 QString QDS_Datum::format() const
 {
   initDatum();
@@ -215,6 +396,10 @@ QString QDS_Datum::format() const
   return fmtStr;
 }
 
+/*!
+  \brief Get the datum default value
+  \return default value
+*/
 QString QDS_Datum::defaultValue() const
 {
   initDatum();
@@ -226,7 +411,7 @@ QString QDS_Datum::defaultValue() const
   if ( !myDicItem.IsNull() )
     def = toQString( myDicItem->GetDefaultValue() );
 
-  QString aDef = def.stripWhiteSpace();
+  QString aDef = def.trimmed();
   if ( !pref.isEmpty() && aDef.left( pref.length() ) == pref )
     aDef = aDef.mid( pref.length() );
 
@@ -236,26 +421,38 @@ QString QDS_Datum::defaultValue() const
   return aDef;
 }
 
+/*!
+  \brief Get the datum minimum value.
+  \return minimum value
+*/
 QString QDS_Datum::minimumValue() const
 {
   initDatum();
 
   QString min;
-  if ( !myDicItem.IsNull() )
-    min = format( format(), type(), myDicItem->GetMinValue() );
+  if ( !myDicItem.IsNull() && myDicItem->HasData( DDS_DicItem::MinValue ) )
+      min = format( format(), type(), myDicItem->GetMinValue() );
   return min;
 }
 
+/*!
+  \brief Get the datum maximum value.
+  \return maximum value
+*/
 QString QDS_Datum::maximumValue() const
 {
   initDatum();
 
   QString max;
-  if ( !myDicItem.IsNull() )
+  if ( !myDicItem.IsNull() && myDicItem->HasData( DDS_DicItem::MaxValue ) )
     max = format( format(), type(), myDicItem->GetMaxValue() );
   return max;
 }
 
+/*!
+  \brief Get the datum long description.
+  \return datum long description
+*/
 QString QDS_Datum::longDescription() const
 {
   initDatum();
@@ -266,6 +463,10 @@ QString QDS_Datum::longDescription() const
   return ldStr;
 }
 
+/*!
+  \brief Get the datum short description.
+  \return datum short description
+*/
 QString QDS_Datum::shortDescription() const
 {
   initDatum();
@@ -276,6 +477,110 @@ QString QDS_Datum::shortDescription() const
   return sdStr;
 }
 
+/*!
+  \brief Get the datum options names.
+  \return datum options
+*/
+QStringList QDS_Datum::options() const
+{
+  QStringList res;
+  if ( !dicItem().IsNull() )
+  {
+    TColStd_SequenceOfAsciiString lst;
+    dicItem()->GetOptionNames( lst );
+    for ( int i = 1; i <= lst.Length(); i++ )
+      res.append( toQString( lst.Value( i ) ) );
+  }
+  return res;
+}
+
+/*!
+  \brief Get datum option specified by \a name as QVariant.
+  \return the option value or invalid QVariant if the option does not exist
+*/
+QVariant QDS_Datum::option( const QString& name ) const
+{
+  QVariant res;
+  if ( !dicItem().IsNull() )
+    res = QVariant( toQString( dicItem()->GetOption( toAsciiString( name ) ) ) );
+  return res;
+}
+
+/*!
+  \brief Get datum option specified by \a name as string.
+  \return the option value or null QString if the option does not exist
+*/
+QString QDS_Datum::optionString( const QString& name ) const
+{
+  QString res;
+  if ( !dicItem().IsNull() )
+    res = toQString( dicItem()->GetOption( toAsciiString( name ) ) );
+  return res;
+}
+
+/*!
+  \brief Get datum option specified by \a name as double.
+  \return the option value or 0 if the option does not exist
+*/
+double QDS_Datum::optionDouble( const QString& name ) const
+{
+  double res = 0;
+  QVariant opt = option( name );
+  if ( opt.isValid() && opt.canConvert( QVariant::Double ) )
+    res = opt.toDouble();
+  return res;
+}
+
+/*!
+  \brief Get datum option specified by \a name as integer.
+  \return the option value or 0 if the option does not exist
+*/
+int QDS_Datum::optionInteger( const QString& name ) const
+{
+  int res = 0;
+  QVariant opt = option( name );
+  if ( opt.isValid() && opt.canConvert( QVariant::Int ) )
+    res = opt.toInt();
+  return res;
+}
+
+/*!
+  \brief Get the datum value as QVariant.
+  \return datum value
+*/
+QVariant QDS_Datum::value() const
+{
+  QVariant val;
+  // trying to return QVariant containing value of correct data type
+  if ( dicItem().IsNull() )
+  {
+    if ( !isEmpty() )
+      val = stringValue();
+  }
+  else
+  {
+    switch( type() )
+    {
+      case DDS_DicItem::Float:
+        val = doubleValue();
+        break;
+      case DDS_DicItem::Integer:
+      case DDS_DicItem::List:
+        val = integerValue();
+        break;
+      case DDS_DicItem::String:
+      case DDS_DicItem::Unknown:
+        val = stringValue();
+        break;
+    }
+  }
+  return val;
+}
+
+/*!
+  \brief Get the datum value as string.
+  \return datum value converted to string
+*/
 QString QDS_Datum::stringValue() const
 {
   initDatum();
@@ -286,6 +591,14 @@ QString QDS_Datum::stringValue() const
     return getString();
 }
 
+/*!
+  \brief Get the datum value as double.
+
+  The value is converted according to the measure units in the active units system
+  to measure units in "SI" units system.
+
+  \return datum value converted to double
+*/
 double QDS_Datum::doubleValue() const
 {
   initDatum();
@@ -296,13 +609,21 @@ double QDS_Datum::doubleValue() const
   else
   {
     res = getString().toDouble();
-    if ( !myDicItem.IsNull() )
+    if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
       res = myDicItem->ToSI( res );
   }
 
   return res;
 }
 
+/*!
+  \brief Get the datum value as integer.
+
+  The value is converted according to the measure units in the active units system
+  to measure units in "SI" units system.
+
+  \return datum value converted to integer
+*/
 int QDS_Datum::integerValue() const
 {
   initDatum();
@@ -313,13 +634,20 @@ int QDS_Datum::integerValue() const
   else
   {
     double val = getString().toDouble();
-    if ( !myDicItem.IsNull() )
+    if ( !myDicItem.IsNull() && !( flags() & NotConvert ) )
       res = (int)myDicItem->ToSI( val );
   }
 
   return res;
 }
 
+/*!
+  \brief Get the text data from datum.
+
+  Text consists of label, string value and units.
+
+  \return datum text data
+*/
 QString QDS_Datum::text() const
 {
   initDatum();
@@ -339,11 +667,18 @@ QString QDS_Datum::text() const
   return res;
 }
 
+/*!
+  \brief Check if the datum is empty.
+  \return \c false if datum control has value entered
+*/
 bool QDS_Datum::isEmpty() const
 {
   return stringValue().isEmpty();
 }
 
+/*!
+  \brief Reset datum state and set default value as current.
+*/
 void QDS_Datum::reset()
 {
   initDatum();
@@ -358,6 +693,9 @@ void QDS_Datum::reset()
   emit paramChanged( str );
 }
 
+/*!
+  \brief Clear the control.
+*/
 void QDS_Datum::clear()
 {
   initDatum();
@@ -375,6 +713,55 @@ void QDS_Datum::clear()
   }
 }
 
+/*!
+  \brief Set datum value from QVariant object.
+  \param val new value
+*/
+void QDS_Datum::setValue( const QVariant& val )
+{
+  // trying to extract data of correct type from QVariant
+  if ( !dicItem().IsNull() )
+  {
+    bool isOk = false;
+    switch( type() )
+    {
+      case DDS_DicItem::Float:
+      {
+        double aDblVal = val.toDouble( &isOk );
+        if ( isOk )
+        {
+          setDoubleValue( aDblVal );
+          return;
+        }
+        break;
+      }
+      case DDS_DicItem::Integer:
+      case DDS_DicItem::List:
+      {
+        int anIntVal = val.toInt( &isOk );
+        if ( isOk )
+        {
+          setIntegerValue( anIntVal );
+          return;
+        }
+        break;
+      }
+      case DDS_DicItem::String:
+      case DDS_DicItem::Unknown:
+        break;
+    }
+  }
+
+  if ( val.isValid() && val.canConvert( QVariant::String ) )
+    setStringValue( val.toString() );
+  else
+    clear();
+}
+
+/*!
+  \brief Set datum value from string data.
+  \param txt new value
+*/
 void QDS_Datum::setStringValue( const QString& txt )
 {
   initDatum();
@@ -390,13 +777,22 @@ void QDS_Datum::setStringValue( const QString& txt )
   emit paramChanged( str );
 }
 
+/*!
+  \brief Set datum value from double data.
+
+  The value is converted from measure units in "SI" units system
+  to the measure units in the active units system.
+  Format the value using datum format internal if it is required.
+  
+  \param num new value
+*/
 void QDS_Datum::setDoubleValue( const double num )
 {
   initDatum();
 
   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 );
@@ -409,13 +805,22 @@ void QDS_Datum::setDoubleValue( const double num )
   emit paramChanged( str );
 }
 
+/*!
+  \brief Set datum value from integer data.
+
+  The value is converted from measure units in "SI" units system
+  to the measure units in the active units system.
+  Format the value using datum format if it is required.
+  
+  \param num new value
+*/
 void QDS_Datum::setIntegerValue( const int num )
 {
   initDatum();
 
   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 );
@@ -429,7 +834,10 @@ void QDS_Datum::setIntegerValue( const int num )
 }
 
 /*!
-  Returns true if all subwidgets specified by 'element' enabled.
+  \brief Get 'enabled' state of the specified subwidget.
+  \param element ORed subwidget flags (QDS::DatumFlags)
+  \return \c true if all subwidgets specified by \a element are enabled
+  \sa setEnabled()
 */
 bool QDS_Datum::isEnabled( const int element ) const
 {
@@ -446,8 +854,14 @@ bool QDS_Datum::isEnabled( const int element ) const
 }
 
 /*!
-  Enable/Disable subwidgets specified by 'element'.
-  Values: Label, Control, Units or their combinations.
+  \brief Enable/disable subwidgets specified by \a element.
+
+  Possible values of \a element: QDS::Label, QDS::Control, QDS::Units
+  or their ORed combinations.
+
+  \param on new 'enabled' state
+  \param element ORed subwidget flags (QDS::DatumFlags)
+  \sa isEnabled()
 */
 void QDS_Datum::setEnabled( const bool on, const int element )
 {
@@ -462,56 +876,72 @@ void QDS_Datum::setEnabled( const bool on, const int element )
 }
 
 /*!
-  Enable/Disable control.
+  \brief Enable/disable main control subwidget (QDS::Control).
+  \param on new 'enabled' state
 */
 void QDS_Datum::setEnabled( bool on )
 {
   setEnabled( on, Control );
 }
 
+/*!
+  \brief Show/hide subwidgets specified by \a flags.
+
+  Possible values of \a flags: QDS::Label, QDS::Control, QDS::Units
+  or their ORed combinations.
+
+  \param visible new 'visibility' state
+  \param flags ORed subwidget flags (QDS::DatumFlags)
+  \sa show(), hide()
+*/
 void QDS_Datum::setShown( const bool visible, const int flags )
 {
-  if ( visible )
-    show( flags );
-  else
-    hide( flags );
+  initDatum();
+
+  uint flag = Units;
+  while ( flag )
+  {
+    if ( flags & flag && widget( flag ) )
+      widget( flag )->setVisible( visible );
+    flag = flag >> 1;
+  }
 }
 
 /*!
-  Show subwidgets specified by 'element'.
-  Values: Label, Control, Units or their combinations.
+  \brief Show subwidgets specified by \a element.
+
+  Possible values of \a element: QDS::Label, QDS::Control, QDS::Units
+  or their ORed combinations.
+
+  \param element ORed subwidget flags (QDS::DatumFlags)
+  \sa hide(), setShown()
 */
 void QDS_Datum::show( const int element )
 {
-  initDatum();
-
-  if ( ( element & Label ) && labelWidget() )
-    labelWidget()->show();
-  if ( ( element & Units ) && unitsWidget() )
-    unitsWidget()->show();
-  if ( ( element & Control ) && controlWidget() )
-    controlWidget()->show();
+  setShown( true, element );
 }
 
 /*!
-  Hide subwidgets specified by 'element'.
-  Values: Label, Control, Units or their combinations.
+  \brief Hide subwidgets specified by \a element.
+
+  Possible values of \a element: QDS::Label, QDS::Control, QDS::Units
+  or their ORed combinations.
+
+  \param element ORed subwidget flags (QDS::DatumFlags)
+  \sa show(), setShown()
 */
 void QDS_Datum::hide( const int element )
 {
-  initDatum();
-
-  if ( ( element & Label ) && labelWidget() )
-    labelWidget()->hide();
-  if ( ( element & Units ) && unitsWidget() )
-    unitsWidget()->hide();
-  if ( ( element & Control ) && controlWidget() )
-    controlWidget()->hide();
+  setShown( false, element );
 }
 
 /*!
-  Returns subwidget specified by 'element'.
-  Possible values: Label, Control, Units.
+  \brief Get subwidget specified by \a element.
+
+  Possible values of \a element: QDS::Label, QDS::Control, QDS::Units.
+  
+  \param element subwidget
+  \return widget
 */
 QWidget* QDS_Datum::widget( const int element ) const
 {
@@ -520,7 +950,7 @@ QWidget* QDS_Datum::widget( const int element ) const
 }
 
 /*!
-  Set the input focus on the control widget.
+  \brief Set the input focus to the control widget.
 */
 void QDS_Datum::setFocus()
 {
@@ -531,8 +961,14 @@ void QDS_Datum::setFocus()
 }
 
 /*!
-  Returns true if control contains valid value otherwise returns false
-  and display warning message box if parameter msgBox is set.
+  \brief Check if input data is valid.
+
+  If data is invalid and \a msgBox is \c true, the warning message box is shown.
+
+  \param msgBox if \c true, show warning message box if input is invalid
+  \param extMsg warning message
+  \param extLabel optional name of the variable (if QDS::Label control is not used) 
+  \return \c true if input data is valid
 */
 bool QDS_Datum::isValid( const bool msgBox, const QString& extMsg, const QString& extLabel ) const
 {
@@ -541,10 +977,15 @@ bool QDS_Datum::isValid( const bool msgBox, const QString& extMsg, const QString
   if ( type() == DDS_DicItem::String && isDoubleFormat( format() ) )
     return true;
 
+  QString req;
+  if ( !dicItem().IsNull() )
+    req = toQString( dicItem()->GetRequired() );
+
   bool aState = true;
   QString aStr = getString();
+
   if ( aStr.isEmpty() )
-    aState = false;
+    aState = !( req == QString( "yes" ) || req == QString( "true" ) || req.toInt() );
   else
     aState = validate( aStr );
 
@@ -595,7 +1036,7 @@ bool QDS_Datum::isValid( const bool msgBox, const QString& extMsg, const QString
       info += QString( "\n" ) + extMsg;
 
     QString msg;
-    for ( uint i = 0; i < info.length(); i++ )
+    for ( int i = 0; i < info.length(); i++ )
       if ( info.at( i ) == '\n' )
         msg += QString( "<br>" );
       else
@@ -604,7 +1045,7 @@ bool QDS_Datum::isValid( const bool msgBox, const QString& extMsg, const QString
     info = QString( "<p><nobr>%1</nobr></p>" ).arg( msg );
 
     QMessageBox::critical( controlWidget() ? controlWidget()->topLevelWidget() : 0,
-                           tr( "DATA_ERR_TITLE" ), info, tr( "BUT_OK" ) );
+                           tr( "DATA_ERR_TITLE" ), info, tr( "OK" ) );
     if ( controlWidget() )
       controlWidget()->setFocus();
   }
@@ -612,7 +1053,8 @@ bool QDS_Datum::isValid( const bool msgBox, const QString& extMsg, const QString
 }
 
 /*!
-  Add widgets to the vertical layout.
+  \brief Add widgets to the vertical box layout.
+  \param l layout
 */
 void QDS_Datum::addTo( QVBoxLayout* l )
 {
@@ -630,7 +1072,8 @@ void QDS_Datum::addTo( QVBoxLayout* l )
 }
 
 /*!
-  Add widgets to the horizaontal layout.
+  \brief Add widgets to the horizontal box layout.
+  \param l layout
 */
 void QDS_Datum::addTo( QHBoxLayout* l )
 {
@@ -644,11 +1087,15 @@ void QDS_Datum::addTo( QHBoxLayout* l )
   if ( wrapper( Control ) )
     l->addWidget( wrapper( Control ) );
   if ( wrapper( Units ) )
-    l->addWidget( unitsWidget() );
+    l->addWidget( wrapper( Units ) );
 }
 
 /*!
-  Add widgets to the grid layout.
+  \brief Add widgets to the grid layout.
+  \param theLay layout
+  \param theRow layout row index
+  \param theCol layout column index
+  \param vertical if \c true subwidgets are layouted vertically, otherwise - horizontally
 */
 void QDS_Datum::addTo( QGridLayout* theLay, const int theRow, const int theCol, bool vertical )
 {
@@ -674,38 +1121,49 @@ void QDS_Datum::addTo( QGridLayout* theLay, const int theRow, const int theCol,
 }
 
 /*!
-  Set the aligment of Label or Units. For Control nothing happens.
+  \brief Set the aligment for QDS::Label and/or QDS::Units subwidgets.
+  \param align alignment type (Qt::Alignment)
+  \param type ORed subwidget flags
 */
 void QDS_Datum::setAlignment( const int align, const int type )
 {
   initDatum();
 
   if ( ( type & Label ) && labelWidget() )
-    labelWidget()->setAlignment( align );
+    labelWidget()->setAlignment( Qt::Alignment(align) );
   if ( ( type & Units ) && unitsWidget() )
-    unitsWidget()->setAlignment( align );
+    unitsWidget()->setAlignment( Qt::Alignment(align) );
 }
 
+/*!
+  \brief Event filter.
+
+  Perform delayed initialisation. Reimplemented for internal reasons.
+  
+  \param o event reciever object
+  \param e event
+  \return \c true if event should be filtered
+*/
 bool QDS_Datum::eventFilter( QObject* o, QEvent* e )
 {
   if ( o == parent() )
   {
     if ( e->type() == QEvent::Show || e->type() == QEvent::ShowToParent ||
-         ( e->type() == QEvent::ChildInserted && ((QChildEvent*)e)->child() == this ) )
+         ( e->type() == QEvent::ChildAdded && ((QChildEvent*)e)->child() == this ) )
       initDatum();
   }
   return QObject::eventFilter( o, e );
 }
 
 /*!
-  Notify about parameter changing.
+  \brief Called when datum value is changed.
 */
 void QDS_Datum::onParamChanged()
 {
 }
 
 /*!
-  Delayed initialization.
+  \brief Perform delayed initialization.
 */
 void QDS_Datum::onInitDatum()
 {
@@ -713,7 +1171,11 @@ void QDS_Datum::onInitDatum()
 }
 
 /*!
-  Notify about subwidgets destroying. Allow to avoid repeated deleting in destructor.
+  \brief Called when child subwidget is destroued.
+
+  Allows avoiding crash of extra calling of the child subwidget destructor.
+
+  \param obj object being destroyed
 */
 void QDS_Datum::onDestroyed( QObject* obj )
 {
@@ -721,7 +1183,8 @@ void QDS_Datum::onDestroyed( QObject* obj )
 }
 
 /*!
-  Returns QLabel instance which contains data dictionary label.
+  \brief Get QDS::Label widget.
+  \return label widget
 */
 QLabel* QDS_Datum::labelWidget() const
 {
@@ -730,7 +1193,8 @@ QLabel* QDS_Datum::labelWidget() const
 }
 
 /*!
-  Returns QLabel instance which contains data dictionary units.
+  \brief Get QDS::Units widget.
+  \return units widget
 */
 QLabel* QDS_Datum::unitsWidget() const
 {
@@ -739,7 +1203,8 @@ QLabel* QDS_Datum::unitsWidget() const
 }
 
 /*!
-  Returns QWidget which contains user input data.
+  \brief Get QDS::Control widget.
+  \return control widget
 */
 QWidget* QDS_Datum::controlWidget() const
 {
@@ -748,7 +1213,8 @@ QWidget* QDS_Datum::controlWidget() const
 }
 
 /*!
-  Returns the dictionary item from the datum.
+  \brief Get the dictionary item from the datum.
+  \return handle to data dictionary item
 */
 Handle(DDS_DicItem) QDS_Datum::dicItem() const
 {
@@ -756,7 +1222,8 @@ Handle(DDS_DicItem) QDS_Datum::dicItem() const
 }
 
 /*!
-  Set the dictionary item in to the datum.
+  \brief Set the dictionary item to the datum.
+  \param item handle to data dictionary item
 */
 void QDS_Datum::setDicItem( const Handle(DDS_DicItem)& item )
 {
@@ -764,7 +1231,9 @@ void QDS_Datum::setDicItem( const Handle(DDS_DicItem)& item )
 }
 
 /*!
-  Creates QLabel widget for data label.
+  \brief Create QDS::Label widget.
+  \param parent parent widget
+  \return label widget
 */
 QLabel* QDS_Datum::createLabel( QWidget* parent )
 {
@@ -772,7 +1241,9 @@ QLabel* QDS_Datum::createLabel( QWidget* parent )
 }
 
 /*!
-  Creates QLabel widget for data units.
+  \brief Create QDS::Units widget.
+  \param parent parent widget
+  \return units widget
 */
 QLabel* QDS_Datum::createUnits( QWidget* parent )
 {
@@ -780,7 +1251,37 @@ QLabel* QDS_Datum::createUnits( QWidget* parent )
 }
 
 /*!
-  Returns validator accordance to data type.
+  \fn QWidget* QDS_Datum::createControl( QWidget* parent );
+  \brief Create QDS::Control widget.
+
+  This method should be implemented in the successor classes.
+
+  \param parent parent widget
+  \return control widget
+*/
+
+/*!
+  \fn QString QDS_Datum::getString() const;
+  \brief Get string value from datum.
+  
+  This method should be implemented in the successor classes.
+  
+  \return datum string value
+*/
+
+/*
+  \fn void QDS_Datum::setString( const QString& txt );
+  \brief Set string value to datum.
+  
+  This method should be implemented in the successor classes.
+  
+  \param txt new datum string value
+*/
+
+/*!
+  \brief Create validator according to the datum type of value.
+  \param limits if \c true use minimum and maximum value limits
+  \return validator
 */
 QValidator* QDS_Datum::validator( const bool limits ) const
 {
@@ -794,7 +1295,7 @@ QValidator* QDS_Datum::validator( const bool limits ) const
     QString aFormat = canonicalFormat( format(), aFlags );
 
     int len = -1;
-    int pos = aFormat.find( "." );
+    int pos = aFormat.indexOf( "." );
     if ( pos != -1 )
     {
       QString numStr = aFormat.mid( pos + 1, aFormat.length() - pos - 2 );
@@ -844,12 +1345,14 @@ QValidator* QDS_Datum::validator( const bool limits ) const
 }
 
 /*!
-  Checks the given string are valid or not.
+  \brief Validate the specified string.
+  \param txt string to be validated
+  \return \c true if string contains valid data
 */
 bool QDS_Datum::validate( const QString& txt ) const
 {
   if ( type() == DDS_DicItem::Unknown ||
-       type() == DDS_DicItem::String && isDoubleFormat( format() ) )
+       ( type() == DDS_DicItem::String && isDoubleFormat( format() ) ) )
     return true;
 
   QValidator* aValidator = validator( true );
@@ -867,8 +1370,12 @@ bool QDS_Datum::validate( const QString& txt ) const
 }
 
 /*!
-  Retrieves information from data dictionary and create subwidgets using virtual mechanism.
-  Virtual mechanism doesn't work in constructor and destructor, therefore this method should
+  \brief Initialize datum.
+  
+  Retrieve information from data dictionary and create subwidgets
+  using virtual mechanism.
+
+  Virtual mechanism doesn't work in the constructor, therefore this method should
   be called outside the constructor.
 */
 void QDS_Datum::initialize()
@@ -899,15 +1406,22 @@ void QDS_Datum::initialize()
     QString lDescr = longDescription();
     QString sDescr = shortDescription();
     if ( !sDescr.isEmpty() )
-      QToolTip::add( ctrl, sDescr );
+      ctrl->setToolTip( sDescr );
     if ( !lDescr.isEmpty() )
-      QWhatsThis::add( ctrl, lDescr );
+      ctrl->setWhatsThis( lDescr );
   }
 
   if ( labelWidget() && ctrl && !( flags() & NotAccel ) )
     labelWidget()->setBuddy( ctrl );
 }
 
+/*!
+  \brief Process notification about active units system changing.
+  
+  Update label and units widgets.
+
+  \param unitSystem new active units system
+*/
 void QDS_Datum::unitSystemChanged( const QString& unitSystem )
 {
   QString labText = label();
@@ -919,7 +1433,7 @@ void QDS_Datum::unitSystemChanged( const QString& unitSystem )
       labText = unitText;
     else if ( !unitText.isEmpty() )
       labText = QString( "%1 (%2)" ).arg( labText ).arg( unitText );
-    unitText = QString::null;
+    unitText = QString();
   }
 
   if ( labelWidget() )
@@ -932,13 +1446,15 @@ void QDS_Datum::unitSystemChanged( const QString& unitSystem )
 }
 
 /*!
-  Covert units into text presentation.
+  \brief Convert units into text presentation.
+  \param uni units to be converted
+  \return text presentation of units (rich-text)
 */
 QString QDS_Datum::unitsToText( const QString& uni )
 {
   int pos = -1;
   QString aUnits = uni;
-  while ( ( pos = aUnits.find( "**" ) ) != -1 )
+  while ( ( pos = aUnits.indexOf( "**" ) ) != -1 )
   {
     aUnits = aUnits.mid( 0, pos ) + QString( "<tt><font size=+2><sup>" ) +
              aUnits.mid( pos + 2, 1 ) + QString( "</sup></font></tt>" ) +
@@ -948,24 +1464,30 @@ QString QDS_Datum::unitsToText( const QString& uni )
 }
 
 /*!
-  Covert text presentation into internal units format.
+  \brief Convert text presentation into internal units format.
+  \param txt text presentation of units (rich-text)
+  \return units value
 */
 QString QDS_Datum::textToUnits( const QString& txt )
 {
   int pos = -1;
   QString aUnits = txt;
-  while ( ( pos = aUnits.find( "<sup>" ) ) != -1 )
+  while ( ( pos = aUnits.indexOf( "<sup>" ) ) != -1 )
   {
     aUnits.remove( pos, 5 );
     aUnits.insert( pos, "**" );
   }
-  while ( ( pos = aUnits.find( "</sup>" ) ) != -1 )
+  while ( ( pos = aUnits.indexOf( "</sup>" ) ) != -1 )
     aUnits.remove( pos, 6 );
   return aUnits;
 }
 
 /*!
-  Format the specified integer as data dictionary value.
+  \brief Format the specified integer as dictionary item value.
+  \param num integer value being formatted
+  \param id data dictionary ID
+  \param convert if \c true, perform conversion from "SI" units system
+  \return formatted value
 */
 QString QDS_Datum::format( const int num, const QString& id, const bool convert )
 {
@@ -992,7 +1514,11 @@ QString QDS_Datum::format( const int num, const QString& id, const bool convert
 }
 
 /*!
-  Format the specified double as data dictionary value.
+  \brief Format the specified double as dictionary item value.
+  \param num double value being formatted
+  \param id data dictionary ID
+  \param convert if \c true, perform conversion from "SI" units system
+  \return formatted value
 */
 QString QDS_Datum::format( const double num, const QString& id, const bool convert )
 {
@@ -1019,7 +1545,11 @@ QString QDS_Datum::format( const double num, const QString& id, const bool conve
 }
 
 /*!
-  Format the specified string as data dictionary value.
+  \brief Format the specified string as dictionary item value.
+  \param str string value being formatted
+  \param id data dictionary ID
+  \param convert if \c true, perform conversion from "SI" units system
+  \return formatted value
 */
 QString QDS_Datum::format( const QString& str, const QString& id, const bool convert )
 {
@@ -1046,7 +1576,11 @@ QString QDS_Datum::format( const QString& str, const QString& id, const bool con
 }
 
 /*!
-  Format the given string accordance to data format.
+  \brief Format the given value according to the data dictionary item type.
+  \param aFormat format string
+  \param aType data dictionary item type
+  \param aValue integer value being formatted
+  \return formatted value
 */
 QString QDS_Datum::format( const QString& aFormat, const int aType, const int aValue )
 {
@@ -1058,11 +1592,11 @@ QString QDS_Datum::format( const QString& aFormat, const int aType, const int aV
     {
     case DDS_DicItem::Float:
       txt = sprintf( aFormat, (double)aValue );
-      txt = txt.stripWhiteSpace();
+      txt = txt.trimmed();
       break;
     case DDS_DicItem::Integer:
       txt = sprintf( aFormat, aValue );
-      txt = txt.stripWhiteSpace();
+      txt = txt.trimmed();
       break;
     case DDS_DicItem::String:
     default:
@@ -1077,7 +1611,11 @@ QString QDS_Datum::format( const QString& aFormat, const int aType, const int aV
 }
 
 /*!
-  Format the given string accordance to data format.
+  \brief Format the given value according to the data dictionary item type.
+  \param aFormat format string
+  \param aType data dictionary item type
+  \param aValue double value being formatted
+  \return formatted value
 */
 QString QDS_Datum::format( const QString& aFormat, const int aType, const double aValue )
 {
@@ -1088,16 +1626,16 @@ QString QDS_Datum::format( const QString& aFormat, const int aType, const double
     switch ( aType )
     {
     case DDS_DicItem::Float:
-      txt = QString().sprintf( aFormat, aValue );
-      txt = txt.stripWhiteSpace();
+      txt = QString().sprintf( aFormat.toLatin1().constData(), aValue );
+      txt = txt.trimmed();
       break;
     case DDS_DicItem::Integer:
-      txt = QString().sprintf( aFormat, (int)aValue );
-      txt = txt.stripWhiteSpace();
+      txt = QString().sprintf( aFormat.toLatin1().constData(), (int)aValue );
+      txt = txt.trimmed();
       break;
     case DDS_DicItem::String:
     default:
-      txt = QString().sprintf( aFormat, aValue );
+      txt = QString().sprintf( aFormat.toLatin1().constData(), aValue );
       break;
     }
   }
@@ -1108,14 +1646,18 @@ QString QDS_Datum::format( const QString& aFormat, const int aType, const double
 }
 
 /*!
-  Format the given string accordance to data format.
+  \brief Format the given value according to the data dictionary item type.
+  \param aFormat format string
+  \param aType data dictionary item type
+  \param aValue string value being formatted
+  \return formatted value
 */
 QString QDS_Datum::format( const QString& aFormat, const int aType, const QString& aValue )
 {
   QString txt = aValue;
 
   if ( aType != DDS_DicItem::String )
-    txt = txt.stripWhiteSpace();
+    txt = txt.trimmed();
 
   if ( aFormat.isEmpty() || txt.isEmpty() )
     return txt;
@@ -1125,11 +1667,11 @@ QString QDS_Datum::format( const QString& aFormat, const int aType, const QStrin
   case DDS_DicItem::Float:
     txt = txt.replace( 'd', 'e' ).replace( 'D', 'E' );
     txt = sprintf( aFormat, txt.toDouble() );
-    txt = txt.stripWhiteSpace();
+    txt = txt.trimmed();
     break;
   case DDS_DicItem::Integer:
     txt = sprintf( aFormat, txt.toInt() );
-    txt = txt.stripWhiteSpace();
+    txt = txt.trimmed();
     break;
   case DDS_DicItem::String:
     txt = sprintf( aFormat, txt );
@@ -1140,26 +1682,43 @@ QString QDS_Datum::format( const QString& aFormat, const int aType, const QStrin
 }
 
 /*!
-  Wrapper around the standard sprintf function.
+  \brief Wrapper around the standard sprintf() function.
+
   Process some non standard flags from format string.
+
+  \param fmt string format
+  \param val value
+  \return formatted value
 */
 QString QDS_Datum::sprintf( const QString& fmt, const int val )
 {
-  return QString().sprintf( canonicalFormat( fmt ), val );
+  return QString().sprintf( canonicalFormat( fmt ).toLatin1().constData(), val );
 }
 
 /*!
-  Wrapper around the standard sprintf function.
+  \brief Wrapper around the standard sprintf() function.
+  \overload
+
   Process some non standard flags from format string.
+
+  \param fmt string format
+  \param val value
+  \return formatted value
 */
 QString QDS_Datum::sprintf( const QString& fmt, const double val )
 {
-  return QString().sprintf( canonicalFormat( fmt ), val );
+  return QString().sprintf( canonicalFormat( fmt ).toLatin1().constData(), val );
 }
 
 /*!
-  Wrapper around the standard sprintf function.
+  \brief Wrapper around the standard sprintf() function.
+  \overload
+
   Process some non standard flags from format string.
+
+  \param fmt string format
+  \param val value
+  \return formatted value
 */
 QString QDS_Datum::sprintf( const QString& fmt, const QString& val )
 {
@@ -1169,11 +1728,11 @@ QString QDS_Datum::sprintf( const QString& fmt, const QString& val )
   QString txt = val;
 
   QRegExp rx( "^(%[0-9]*.?[0-9]*s)$" );
-  if ( aFormat.find( rx ) != -1 )
+  if ( aFormat.indexOf( rx ) != -1 )
   {
     // QString().sprintf() always expects string in UTF8 encoding, so we cannot use it here
     char* buf = new char[txt.length() + 1];
-    ::sprintf( buf, aFormat.latin1(), (const char*)(txt.local8Bit()) );
+    ::sprintf( buf, aFormat.toLatin1().constData(), (const char*)(txt.toLocal8Bit()) );
     txt = QString::fromLocal8Bit( buf );
 
     delete[] buf;
@@ -1190,16 +1749,18 @@ QString QDS_Datum::sprintf( const QString& fmt, const QString& val )
     }*/
   }
 
-  if ( aFlags.contains( "u", false ) )
-    txt = txt.upper();
-  if ( aFlags.contains( "l", false ) )
-    txt = txt.lower();
+  if ( aFlags.contains( "u", Qt::CaseInsensitive ) )
+    txt = txt.toUpper();
+  if ( aFlags.contains( "l", Qt::CaseInsensitive ) )
+    txt = txt.toLower();
 
   return txt;
 }
 
 /*!
-  Returns the canonical sprintf format.
+  \brief Get the canonical sprintf() format.
+  \param fmt string format
+  \return canonical sprintf() format
 */
 QString QDS_Datum::canonicalFormat( const QString& fmt )
 {
@@ -1208,15 +1769,18 @@ QString QDS_Datum::canonicalFormat( const QString& fmt )
 }
 
 /*!
-  Returns the canonical sprintf format and non standard flags.
+  \brief Get the canonical sprintf() format and non standard flags.
+  \param fmt string format
+  \param flags format flags
+  \return canonical sprintf() format
 */
 QString QDS_Datum::canonicalFormat( const QString& fmt, QString& flags )
 {
   QString newFmt = fmt;
-  flags = QString::null;
+  flags = QString();
 
   QRegExp rx( "^(%[0-9]*.?[0-9]*)([a-z,A-Z]+)[g|c|d|i|o|u|x|e|f|n|p|s|X|E|G]$" );
-  if ( rx.search( newFmt ) >= 0 )
+  if ( rx.indexIn( newFmt ) >= 0 )
   {
     flags = rx.cap( 2 );
     newFmt.remove( rx.pos( 2 ), flags.length() );
@@ -1225,7 +1789,9 @@ QString QDS_Datum::canonicalFormat( const QString& fmt, QString& flags )
 }
 
 /*!
-  Returns displayable units string for given DD ID
+  \brief Get displayable units string for specified data dictionary item.
+  \param id data dictionary item ID
+  \return units string
 */
 QString QDS_Datum::units( const QString& id )
 {
@@ -1243,30 +1809,33 @@ QString QDS_Datum::units( const QString& id )
 }
 
 /*!
-  Get prefix string from format.
+  \brief Get prefix string from format.
+  \return current implementation returns null string
 */
 QString QDS_Datum::prefix() const
 {
-  return QString::null;
+  return QString();
 }
 
 /*!
-  Get suffix string from format.
+  \brief Get suffix string from format.
+  \return current implementation returns null string
 */
 QString QDS_Datum::suffix() const
 {
-  return QString::null;
+  return QString();
 }
 
 /*!
-  Get min value.
+  \brief Get minimum value.
+  \return minimum value
 */
 QString QDS_Datum::minValue() const
 {
   QString pref = prefix();
   QString suff = suffix();
 
-  QString aMin = minimumValue().stripWhiteSpace();
+  QString aMin = minimumValue().trimmed();
 
   if ( !pref.isEmpty() && aMin.left( pref.length() ) == pref )
     aMin = aMin.mid( pref.length() );
@@ -1278,14 +1847,15 @@ QString QDS_Datum::minValue() const
 }
 
 /*!
-  Get max value.
+  \brief Get maximum value.
+  \return maximum value
 */
 QString QDS_Datum::maxValue() const
 {
   QString pref = prefix();
   QString suff = suffix();
 
-  QString aMax = maximumValue().stripWhiteSpace();
+  QString aMax = maximumValue().trimmed();
 
   if ( !pref.isEmpty() && aMax.left( pref.length() ) == pref )
     aMax = aMax.mid( pref.length() );
@@ -1297,13 +1867,18 @@ QString QDS_Datum::maxValue() const
 }
 
 /*!
-  Reset the numeric value cache.
+  \brief Reset the numeric value cache.
 */
 void QDS_Datum::invalidateCache()
 {
-  myTargetValue = QString::null;
+  myTargetValue = QString();
 }
 
+/*!
+  \brief Remove the acceleartor tags '&' from specified label string \a src.
+  \param src processed string
+  \return string after removing '&' symbols
+*/
 QString QDS_Datum::removeAccel( const QString& src )
 {
   QString trg = src;
@@ -1320,6 +1895,11 @@ QString QDS_Datum::removeAccel( const QString& src )
   return trg;
 }
 
+/*!
+  \brief Check if given format specified doube value.
+  \param theFormat format string 
+  \return \c true if \a theFormat has specificator for double values
+*/
 bool QDS_Datum::isDoubleFormat( const QString& theFormat )
 {
   if ( theFormat.length() > 0 )
@@ -1331,11 +1911,19 @@ bool QDS_Datum::isDoubleFormat( const QString& theFormat )
     return false;
 }
 
+/*!
+  \brief Get datum flags.
+  \return datum flags (QDS::DatumFlags)
+*/
 int QDS_Datum::flags() const
 {
   return myFlags;
 }
 
+/*!
+  \brief Perform initialization if it needed.
+  \internal
+*/
 void QDS_Datum::initDatum() const
 {
   if ( myInitialised )
@@ -1346,9 +1934,15 @@ void QDS_Datum::initDatum() const
   that->initialize();
 
   if ( parent() )
-    parent()->removeEventFilter( this );
+    parent()->removeEventFilter( (QObject*)this );
 }
 
+/*!
+  \brief Get wrapper for specified subwidget.
+  \internal
+  \param wid subwidget
+  \return wrapper
+*/
 QDS_Datum::Wrapper* QDS_Datum::wrapper( QWidget* wid ) const
 {
   if ( !wid )
@@ -1357,12 +1951,18 @@ QDS_Datum::Wrapper* QDS_Datum::wrapper( QWidget* wid ) const
   Wrapper* wrap = 0;
   for ( QMap<int, Wrapper*>::ConstIterator it = myWrapper.begin(); it != myWrapper.end() && !wrap; ++it )
   {
-    if ( it.data() && it.data()->widget() == wid )
-      wrap = it.data();
+    if ( it.value() && it.value()->widget() == wid )
+      wrap = it.value();
   }
   return wrap;
 }
 
+/*!
+  \brief Get wrapper for specified subwidget.
+  \internal
+  \param id subwidget ID
+  \return wrapper
+*/
 QDS_Datum::Wrapper* QDS_Datum::wrapper( const int id ) const
 {
   Wrapper* wrap = 0;
@@ -1371,13 +1971,31 @@ QDS_Datum::Wrapper* QDS_Datum::wrapper( const int id ) const
   return wrap;
 }
 
+/*!
+  \brief Get subwidget type for specified wrapper.
+  \internal
+  \param wrap wrapper
+  \return subwidget ID
+*/
 int QDS_Datum::wrapperType( QDS_Datum::Wrapper* wrap ) const
 {
   int id = -1;
   for ( QMap<int, Wrapper*>::ConstIterator it = myWrapper.begin(); it != myWrapper.end() && id == -1; ++it )
   {
-    if ( it.data() == wrap )
+    if ( it.value() == wrap )
       id = it.key();
   }
   return id;
 }
+
+/*!
+  \fn void QDS_Datum::paramChanged();
+  \brief The signal is emitted when the datum value is changed.
+*/
+
+/*!
+  void QDS_Datum::paramChanged( QString& txt );
+  \brief The signal is emitted when the datum value is changed.
+  \param txt new datum value
+*/
+