Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / ModuleBase / ModuleBase_LabelValue.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_LabelValue.h
4 // Created:     30 Nov 2016
5 // Author:      Natalia ERMOLAEVA
6
7 #ifndef ModuleBase_LabelValue_H
8 #define ModuleBase_LabelValue_H
9
10 #include "ModuleBase.h"
11
12 #include <QWidget>
13
14 class QLabel;
15
16 /**
17 * \ingroup GUI
18 * Implementation of model widget for a label control
19 */
20 class MODULEBASE_EXPORT ModuleBase_LabelValue : public QWidget
21 {
22   Q_OBJECT
23 public:
24   /// Constructor
25   /// \param theParent the parent object
26   /// \param theText a text value
27   /// \param theToolTip a tool tip value
28   /// \param theIcon a icon value
29   ModuleBase_LabelValue(QWidget* theParent, const QString& theText,
30                         const QString& theToolTip = "",
31                         const QString& theIcon = "",
32                         int thePrecision = -12);
33
34   virtual ~ModuleBase_LabelValue();
35
36   /// Fills the label value with the given value
37   /// \param theValue a value
38   void setValue(const double theValue);
39
40   /// Returns double value
41   /// \return the value
42   double value() const { return myValue; }
43
44 protected:
45   QLabel* myLabel;  ///< A label information control
46   QLabel* myLabelValue; ///< A label value control
47
48   double myValue; ///< A cashed value to avoid a string conversion
49   int myPrecision; ///< Precision value
50 };
51
52 #endif