Computer Assited Medical Intervention Tool Kit  version 4.1
Property.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * $CAMITK_LICENCE_BEGIN$
3  *
4  * CamiTK - Computer Assisted Medical Intervention ToolKit
5  * (c) 2001-2018 Univ. Grenoble Alpes, CNRS, TIMC-IMAG UMR 5525 (GMCAO)
6  *
7  * Visit http://camitk.imag.fr for more information
8  *
9  * This file is part of CamiTK.
10  *
11  * CamiTK is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * CamiTK is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Lesser General Public License version 3 for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * version 3 along with CamiTK. If not, see <http://www.gnu.org/licenses/>.
22  *
23  * $CAMITK_LICENCE_END$
24  ****************************************************************************/
25 
26 #ifndef PROPERTY_H
27 #define PROPERTY_H
28 
29 #include <QVariant>
30 #include <QStringList>
31 #include <QIcon>
32 
33 #include "CamiTKAPI.h"
34 
35 namespace camitk {
36 
291 class CAMITK_API Property {
292 
293 public:
302  Property(QString name, const QVariant& variant, QString description, QString unit);
303 
305  virtual ~Property() = default;
306 
308  const QString& getName() const;
309 
311  const QVariant& getInitialValue() const;
312 
314  void setReadOnly(bool);
315 
317  bool getReadOnly() const;
318 
320  void setDescription(QString);
321 
323  const QString& getDescription() const;
324 
339  void setAttribute(const QString& attribute, const QVariant& value);
340 
352  QVariant getAttribute(QString attName);
353 
355  QStringList getAttributeList();
356 
360  void setEnumTypeName(QString);
361 
371  void setEnumTypeName(QString enumTypeName, QObject* objectDeclaringTheEnum);
372 
374  QString getEnumTypeName() const;
375 
383  QString getEnumValueAsString(const QObject* objectDeclaringTheEnum) const;
384 
386  QMap<int, QIcon> getEnumIcons() const;
387 
389  void setEnumIcons(const QMap<int, QIcon>& enumIcons);
390 
395  void setGroupName(QString groupName);
396 
400  QString getGroupName() const;
401 
402 private:
404  QString name;
405 
407  QString groupName;
408 
414  QVariant initialValue;
415 
417  QString description;
418 
420  bool readOnly;
421 
423  QMap<QString, QVariant> attributeValues;
424 
426  QString enumTypeName;
427 
429  QMap<int, QIcon> enumIcons;
430 };
431 
432 }
433 
434 #endif // PROPERTY_H
camitk::Property::Property
Property(QString name, const QVariant &variant, QString description, QString unit)
Constructor.
Definition: Property.cpp:54
camitk::Property::setDescription
void setDescription(QString)
set the description (can be rich text)
Definition: Property.cpp:91
camitk::Property::getEnumIcons
QMap< int, QIcon > getEnumIcons() const
get the enum icons
Definition: Property.cpp:147
camitk::Property::getGroupName
QString getGroupName() const
get this property subgroup's name
Definition: Property.cpp:157
CamiTKAPI.h
camitk::Property::setEnumTypeName
void setEnumTypeName(QString)
if the property's type is an enum, set the name of the registered Qt Enum.
Definition: Property.cpp:107
camitk::Property::enumTypeName
QString enumTypeName
if the property's type is an enum, this is the Qt registered enum name, otherwise it is the null stri...
Definition: Property.h:469
camitk::Property::enumIcons
QMap< int, QIcon > enumIcons
map containing all the icons for the enum
Definition: Property.h:472
camitk::Property::getName
const QString & getName() const
get the name of the property
Definition: Property.cpp:71
camitk::Property::attributeValues
QMap< QString, QVariant > attributeValues
map containing all the attributes and their values
Definition: Property.h:466
Property.h
camitk::Property::setAttribute
void setAttribute(const QString &attribute, const QVariant &value)
Set a given property for this attribute.
Definition: Property.cpp:182
camitk::Property::getReadOnly
bool getReadOnly() const
Definition: Property.cpp:86
description
const char * description
Definition: applications/cepgenerator/main.cpp:37
camitk::Property::name
QString name
name of the property
Definition: Property.h:447
camitk::Property::getAttributeList
QStringList getAttributeList()
returns the list of attribute names that are specific to this property
Definition: Property.cpp:177
camitk::Property::description
QString description
description of the property, can be rich text
Definition: Property.h:460
camitk::Property::getEnumTypeName
QString getEnumTypeName() const
Definition: Property.cpp:102
camitk::Property::getInitialValue
const QVariant & getInitialValue() const
return the initial (default) value
Definition: Property.cpp:76
camitk::Property::initialValue
QVariant initialValue
initial value of the property, Only needed between the time when the property is instantiated and the...
Definition: Property.h:457
camitk::Property::setEnumIcons
void setEnumIcons(const QMap< int, QIcon > &enumIcons)
set the icons for all the enums
Definition: Property.cpp:152
camitk::Property::getAttribute
QVariant getAttribute(QString attName)
get the current value of a given attribute, see setAttribute() if the attribute attName was never set...
Definition: Property.cpp:167
camitk::Property::setReadOnly
void setReadOnly(bool)
set this property as read-only
Definition: Property.cpp:81
camitk::Property::setGroupName
void setGroupName(QString groupName)
Set the group name.
Definition: Property.cpp:162
camitk::Property::getDescription
const QString & getDescription() const
get the description
Definition: Property.cpp:96
camitk::Property::groupName
QString groupName
name of the group in which this property is classified (null if no group name were set)
Definition: Property.h:450
camitk::Property::getEnumValueAsString
QString getEnumValueAsString(const QObject *objectDeclaringTheEnum) const
Utility method to get the current property value as a string.
Definition: Property.cpp:133
camitk::Property::readOnly
bool readOnly
is the property read only
Definition: Property.h:463
CAMITK_API
#define CAMITK_API
Definition: CamiTKAPI.h:48
camitk
Definition: Action.cpp:36