NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxProperty.cpp
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 
13 #include "cxProperty.h"
14 
15 namespace cx
16 {
17 
19  QObject(), mEnabled(true), mAdvanced(false), mGroup("")
20 {}
21 
22 
23 PropertyPtr Property::findProperty(std::vector<PropertyPtr> properties, QString id)
24 {
25  for(int i=0; i<properties.size(); ++i)
26  {
27  PropertyPtr adapter = properties[i];
28  if(QString::compare(adapter->getUid(), id) == 0)
29  {
30  return adapter;
31  }
32  }
33  return PropertyPtr();
34 }
35 
37 {
38  return mEnabled;
39 }
40 
42 {
43  return mAdvanced;
44 }
45 
46 QString Property::getGroup() const
47 {
48  return mGroup;
49 }
50 
51 bool Property::setEnabled(bool enabling)
52 {
53 
54  if(mEnabled == enabling)
55  return false;
56 
57  mEnabled = enabling;
58  emit changed();
59 
60  return true;
61 }
62 
63 bool Property::setAdvanced(bool advanced)
64 {
65  if(advanced == mAdvanced)
66  return false;
67 
68  mAdvanced = advanced;
69  emit changed();
70 
71  return true;
72 }
73 
74 bool Property::setGroup(QString name)
75 {
76  if(name == mGroup)
77  return false;
78 
79  mGroup = name;
80  emit changed();
81 
82  return true;
83 }
84 
85 
86 } //namespace cx
cx::Property::mAdvanced
bool mAdvanced
Definition: cxProperty.h:74
cx::Property::getEnabled
virtual bool getEnabled() const
Get the enabled/disabled state of the Property.
Definition: cxProperty.cpp:36
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::Property::mEnabled
bool mEnabled
Definition: cxProperty.h:73
cx::Property::changed
void changed()
emit when the underlying data value is changed: The user interface will be updated.
cx::Property::setAdvanced
virtual bool setAdvanced(bool advanced)
Set the advanced flag of the adapter.
Definition: cxProperty.cpp:63
cx::PropertyPtr
boost::shared_ptr< class Property > PropertyPtr
Definition: cxLocalServerStreamerServer.h:25
cx::Property::setGroup
virtual bool setGroup(QString name)
Flag the adapter as part of a group.
Definition: cxProperty.cpp:74
cx::Property::setEnabled
virtual bool setEnabled(bool enabled)
Set the enabled/disabled state of the Property.
Definition: cxProperty.cpp:51
cxProperty.h
cx::Property::Property
Property()
Definition: cxProperty.cpp:18
cx::Property::mGroup
QString mGroup
Definition: cxProperty.h:75
cx::Property::getAdvanced
virtual bool getAdvanced() const
Get the advanced flag of the adapter.
Definition: cxProperty.cpp:41
cx::Property::findProperty
static PropertyPtr findProperty(std::vector< PropertyPtr > properties, QString id)
Definition: cxProperty.cpp:23
cx::Property::getGroup
virtual QString getGroup() const
Flag the adapter as part of a group.
Definition: cxProperty.cpp:46