Fraxinus  18.10
An IGT application
cxColorPropertyBase.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #ifndef CXCOLORPROPERTYBASE_H_
13 #define CXCOLORPROPERTYBASE_H_
14 
15 #include "cxResourceExport.h"
16 
17 #include <QColor>
18 #include "cxProperty.h"
19 
20 
21 namespace cx
22 {
23 
31 class cxResource_EXPORT ColorPropertyBase: public Property
32 {
33 Q_OBJECT
34 public:
35  virtual ~ColorPropertyBase() {}
36 
37 public:
38  // basic methods
39  virtual QString getDisplayName() const = 0;
40  virtual bool setValue(QColor value) = 0;
41  virtual QColor getValue() const = 0;
42 
43  virtual QVariant getValueAsVariant() const
44  {
45  return QVariant(this->getValue());
46  }
47 
48  virtual void setValueFromVariant(QVariant value)
49  {
50  this->setValue(value.value<QColor>());
51  }
52 
53 public:
54  // optional methods
55  virtual QString getHelp() const
56  {
57  return QString();
58  }
59 };
60 typedef boost::shared_ptr<ColorPropertyBase> ColorPropertyBasePtr;
61 
62 } // namespace cx
63 
64 #endif // CXCOLORPROPERTYBASE_H_
virtual void setValueFromVariant(QVariant value)
Superclass for all data adapters.
Definition: cxProperty.h:43
virtual QVariant getValueAsVariant() const
virtual QString getHelp() const
return a descriptive help string for the data, used for example as a tool tip.
boost::shared_ptr< class ColorPropertyBase > ColorPropertyBasePtr
Namespace for all CustusX production code.