00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #include "QmitkBoolPropertyEditor.h" 00018 #include <mitkRenderingManager.h> 00019 00020 QmitkBoolPropertyEditor::QmitkBoolPropertyEditor( const mitk::BoolProperty* property, QWidget* parent ) 00021 : QmitkBoolPropertyView( property, parent ) 00022 { 00023 setEnabled( true ); 00024 connect(this, SIGNAL(toggled(bool)), this, SLOT(onToggle(bool))); 00025 } 00026 00027 QmitkBoolPropertyEditor::~QmitkBoolPropertyEditor() 00028 { 00029 } 00030 00031 void QmitkBoolPropertyEditor::PropertyRemoved() 00032 { 00033 QmitkBoolPropertyView::PropertyRemoved(); // inherited function 00034 00035 setEnabled(false); 00036 } 00037 00038 void QmitkBoolPropertyEditor::onToggle(bool on) 00039 { 00040 if (m_BoolProperty) 00041 { 00042 BeginModifyProperty(); // deregister from events 00043 00044 const_cast<mitk::BoolProperty*>(m_BoolProperty)->SetValue(on); 00045 mitk::RenderingManager::GetInstance()->RequestUpdateAll(); 00046 00047 EndModifyProperty(); // again register for events 00048 } 00049 } 00050