Medical Imaging Interaction Toolkit  2018.4.99-07c45cb1
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
13 
15  : QLineEdit(parent), PropertyEditor(property), m_StringProperty(property)
16 {
18  connect(this, SIGNAL(textChanged(const QString &)), this, SLOT(onTextChanged(const QString &)));
19 }
20 
22 {
23 }
24 
26 {
27  if (m_Property)
28  setText(m_StringProperty->GetValue());
29 }
30 
32 {
33  m_Property = nullptr;
34  m_StringProperty = nullptr;
35  setText("n/a");
36 }
37 
39 {
40  if (m_StringProperty == nullptr)
41  return;
42 
43  BeginModifyProperty(); // deregister from events
44 
45  m_StringProperty->SetValue(text.toStdString());
46 
47  EndModifyProperty(); // again register for events
48 }
mitk::StringProperty * m_StringProperty
virtual const char * GetValue() const
mitk::BaseProperty * m_Property
QmitkStringPropertyEditor(mitk::StringProperty *, QWidget *parent)
virtual void SetValue(const char *_arg)
Property for strings.