Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
QmitkShortAnswerQuestionWidget Class Reference

#include <QmitkShortAnswerQuestionWidget.h>

Inheritance diagram for QmitkShortAnswerQuestionWidget:
Collaboration diagram for QmitkShortAnswerQuestionWidget:

Public Member Functions

 QmitkShortAnswerQuestionWidget (QWidget *parent=nullptr)
 
 ~QmitkShortAnswerQuestionWidget () override
 
QmitkQuestionWidgetCreateAnother (QWidget *parent=nullptr) const override
 Create a new instance of the derived question widget class type. More...
 
mitk::Forms::QuestionGetQuestion () const override
 Get the question associated with this widget. More...
 
void SetQuestion (mitk::Forms::Question *question) override
 Initialize the widget based on the given question. More...
 
void Reset () override
 Reset the state of the GUI as if no interaction would have been happened yet. More...
 
- Public Member Functions inherited from QmitkQuestionWidget
 QmitkQuestionWidget (QWidget *parent=nullptr)
 
 ~QmitkQuestionWidget () override
 
void SetRequirementVisible (bool visible)
 
void ShowRequirement ()
 
void HideRequirement ()
 

Additional Inherited Members

- Protected Member Functions inherited from QmitkQuestionWidget
void InsertLayout (QLayout *layout)
 Insert a layout containing all GUI elements specific to the derived question widget type. More...
 

Detailed Description

Definition at line 21 of file QmitkShortAnswerQuestionWidget.h.

Constructor & Destructor Documentation

◆ QmitkShortAnswerQuestionWidget()

QmitkShortAnswerQuestionWidget::QmitkShortAnswerQuestionWidget ( QWidget *  parent = nullptr)
explicit

◆ ~QmitkShortAnswerQuestionWidget()

QmitkShortAnswerQuestionWidget::~QmitkShortAnswerQuestionWidget ( )
override

Member Function Documentation

◆ CreateAnother()

QmitkQuestionWidget* QmitkShortAnswerQuestionWidget::CreateAnother ( QWidget *  parent = nullptr) const
overridevirtual

Create a new instance of the derived question widget class type.

This method is mainly used by mitk::Forms::UI::IQuestionWidgetFactory to create new instances from registered prototype instances.

QmitkQuestionWidget* QmitkRhetoricalQuestionWidget::CreateAnother(QWidget* parent) const
{
return new RhetoricalQuestionWidget(parent);
}

Implements QmitkQuestionWidget.

◆ GetQuestion()

mitk::Forms::Question* QmitkShortAnswerQuestionWidget::GetQuestion ( ) const
overridevirtual

Get the question associated with this widget.

Question* QmitkRhetoricalQuestionWidget::GetQuestion() const
{
// In class declaration: mitk::Forms::RhetoricalQuestion* m_Question;
return m_Question;
}
See also
SetQuestion()

Implements QmitkQuestionWidget.

◆ Reset()

void QmitkShortAnswerQuestionWidget::Reset ( )
overridevirtual

Reset the state of the GUI as if no interaction would have been happened yet.

Note
It is required to call this base class method at the end of the derived method.
void QmitkRhetoricalQuestionWidget::Reset()
{
// It's a rhetorical question... nothing specific to be reset.
QmitkQuestionWidget::Reset(); // Nevertheless, this is required at the end!
}

Implements QmitkQuestionWidget.

◆ SetQuestion()

void QmitkShortAnswerQuestionWidget::SetQuestion ( mitk::Forms::Question question)
overridevirtual

Initialize the widget based on the given question.

This method is rarely used explicitly since it is automatically called by mitk::Forms::UI::IQuestionWidgetFactory::Create().

You are excepted to throw an mitk::Exception if the Question type does not match the expectations of the widget.

Note
It is required to call this base class method at the beginning of the derived method.
void QmitkRhetoricalQuestionWidget::SetQuestion(Question* question)
{
auto rhetoricalQuestion = dynamic_cast<RhetoricalQuestion*>(question);
if (rhetoricalQuestion == nullptr)
mitkThrow() << "QmitkRhetoricalQuestionWidget only accepts RhetoricalQuestion as question type!";
m_Question = rhetoricalQuestion;
}

Implements QmitkQuestionWidget.


The documentation for this class was generated from the following file:
QmitkQuestionWidget::Reset
virtual void Reset()=0
Reset the state of the GUI as if no interaction would have been happened yet.
QmitkQuestionWidget
Abstract base class for all types of question widgets used in a QmitkForm.
Definition: QmitkQuestionWidget.h:36
QmitkQuestionWidget::SetQuestion
virtual void SetQuestion(mitk::Forms::Question *question)=0
Initialize the widget based on the given question.
mitkThrow
#define mitkThrow()
Definition: mitkExceptionMacro.h:27