Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkForm Class Reference

Qt widget that renders and manages an interactive mitk::Forms::Form. More...

#include <QmitkForm.h>

Inheritance diagram for QmitkForm:
Collaboration diagram for QmitkForm:

Signals

void Submit ()
 Emitted when the user clicks the submit button and all required questions in the final section are validated. More...
 

Public Member Functions

 QmitkForm (QWidget *parent=nullptr)
 Construct the widget without a form. More...
 
 QmitkForm (mitk::Forms::Form *form, QWidget *parent=nullptr)
 Construct the widget and associate it with the given form. More...
 
 ~QmitkForm () override
 Destructor. More...
 
mitk::Forms::Form * GetForm () const
 Get the currently associated form. More...
 
void SetForm (mitk::Forms::Form *form)
 Set the form to display. More...
 
fs::path GetResponsesPath () const
 Get the path where form responses are saved. More...
 
void SetResponsesPath (const fs::path &csvPath)
 Set the path where form responses will be saved. More...
 

Detailed Description

Qt widget that renders and manages an interactive mitk::Forms::Form.

QmitkForm presents a multi-section form to the user, handles navigation between sections, validates required questions, and submits responses to a CSV file. It creates QmitkQuestionWidget instances for each question via the mitk::Forms::UI::IQuestionWidgetFactory service.

If no responses path is set, the user is prompted with a file dialog on submission.

See also
mitk::Forms::Form, QmitkQuestionWidget, mitk::Forms::UI::IQuestionWidgetFactory

Definition at line 39 of file QmitkForm.h.

Constructor & Destructor Documentation

◆ QmitkForm() [1/2]

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

Construct the widget without a form.

Call SetForm() afterwards to associate a form.

Parameters
[in]parentThe parent widget.

◆ QmitkForm() [2/2]

QmitkForm::QmitkForm ( mitk::Forms::Form *  form,
QWidget *  parent = nullptr 
)
explicit

Construct the widget and associate it with the given form.

Parameters
[in]formA pointer to the Form to display. The widget does not take ownership.
[in]parentThe parent widget.
Precondition
form must not be nullptr.

◆ ~QmitkForm()

QmitkForm::~QmitkForm ( )
override

Destructor.

Member Function Documentation

◆ GetForm()

mitk::Forms::Form* QmitkForm::GetForm ( ) const

Get the currently associated form.

Returns
A pointer to the form, or nullptr if none is set.

◆ GetResponsesPath()

fs::path QmitkForm::GetResponsesPath ( ) const

Get the path where form responses are saved.

Returns
The CSV file path, or an empty path if not set.

◆ SetForm()

void QmitkForm::SetForm ( mitk::Forms::Form *  form)

Set the form to display.

This recreates all question widgets and resets the form state.

Parameters
[in]formA pointer to the Form to display. Must not be nullptr.
Exceptions
mitk::ExceptionIf form is nullptr.

◆ SetResponsesPath()

void QmitkForm::SetResponsesPath ( const fs::path &  csvPath)

Set the path where form responses will be saved.

If this is set before submission, the file dialog is skipped and responses are written directly to this path.

Parameters
[in]csvPathThe file path for CSV output.

◆ Submit

void QmitkForm::Submit ( )
signal

Emitted when the user clicks the submit button and all required questions in the final section are validated.


The documentation for this class was generated from the following file: