Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkStringPropertyEditor.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
17 
19  : QLineEdit(parent), PropertyEditor(property), m_StringProperty(property)
20 {
22  connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChanged(const QString &)));
23 }
24 
26 {
27 }
28 
30 {
31  if (m_Property)
32  setText(m_StringProperty->GetValue());
33 }
34 
36 {
37  m_Property = nullptr;
38  m_StringProperty = nullptr;
39  setText("n/a");
40 }
41 
43 {
44  if (m_StringProperty == nullptr)
45  return;
46 
47  BeginModifyProperty(); // deregister from events
48 
49  m_StringProperty->SetValue(text.toStdString());
50 
51  EndModifyProperty(); // again register for events
52 }
mitk::StringProperty * m_StringProperty
virtual void PropertyChanged() override
virtual const char * GetValue() const
mitk::BaseProperty * m_Property
QmitkStringPropertyEditor(mitk::StringProperty *, QWidget *parent)
virtual void SetValue(const char *_arg)
Property for strings.
virtual void PropertyRemoved() override