Exemple #1
0
void QmitkStringPropertyEditor::onTextChanged(const QString& text)
{
    BeginModifyProperty();  // deregister from events

    m_StringProperty->SetValue(text.toStdString());

    EndModifyProperty();  // again register for events
}
void wxMitkBoolPropertyEditor::onToggle(wxCommandEvent &event)
{
	if (m_BoolProperty)
	{
		BeginModifyProperty();  // deregister from events
		const_cast<mitk::BoolProperty*>(m_BoolProperty)->SetValue(this->GetValue());
		mitk::RenderingManager::GetInstance()->SetNextLOD( 0 );
		mitk::RenderingManager::GetInstance()->RequestUpdateAll();
		EndModifyProperty();  // again register for events
	}
}
void QmitkStringPropertyOnDemandEdit::onToolButtonClicked()
{
  bool ok(false);
  QString newText = QInputDialog::getText(
    this, "Change text", "You can change the displayed text here", QLineEdit::Normal, m_label->text(), &ok);

  if (ok)
  {
    BeginModifyProperty(); // deregister from events

    m_StringProperty->SetValue(newText.toStdString());
    m_label->setText(newText);

    EndModifyProperty(); // again register for events
  }
}
void QmitkNumberPropertySlider::onValueChanged(int value)
{
  if (m_SelfChangeLock) return; // valueChanged is even emitted, when this widget initiates a change to its value
                                // this may be useful some times, but in this use, it would be wrong:
                                //   (A) is an editor with 3 decimal places
                                //   (B) is an editor with 2 decimal places
                                //   User changes A's displayed value to 4.002
                                //   A's onValueChanged gets called, sets the associated Property to 4.002
                                //   B's onPropertyChanged gets called, sets its display to 4.00
                                //   B's onValueChanged gets called and sets the associated Property to 4.00
                                //   A's onPropertyChanged gets called, sets its display to 4.000

  BeginModifyProperty();

  double newValue( value / m_FactorPropertyToSlider );

  switch (m_DataType)
  {
  /*
    case DT_SHORT:
      {
        m_ShortProperty->SetValue(ROUND_SHORT(newValue));
        break;
      }
    */
    case DT_INT:
      {
        m_IntProperty->SetValue(ROUND(newValue));
        break;
      }
    case DT_FLOAT:
      {
        m_FloatProperty->SetValue(newValue);
        break;
      }
    case DT_DOUBLE:
      {
        m_DoubleProperty->SetValue(newValue);
        break;
      }
  }
  mitk::RenderingManager::GetInstance()->RequestUpdateAll();

  EndModifyProperty();
}