Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::Forms::CheckboxesQuestion Class Reference

A Question whose possible responses are represented by checkboxes. More...

#include <mitkCheckboxesQuestion.h>

Inheritance diagram for mitk::Forms::CheckboxesQuestion:
Collaboration diagram for mitk::Forms::CheckboxesQuestion:

Public Member Functions

 ~CheckboxesQuestion () override
 Virtual destructor. More...
 
std::string GetType () const override
 Return the type string "Checkboxes". More...
 
Question * CreateAnother () const override
 Create a new default-constructed CheckboxesQuestion instance. More...
 
void FromJSON (const nlohmann::ordered_json &j) override
 Deserialize this CheckboxesQuestion from JSON. More...
 
void ToJSON (nlohmann::ordered_json &j) const override
 Serialize this CheckboxesQuestion to JSON. More...
 
void AddResponse (size_t i)
 Add one of the regular options to the set of selected responses. More...
 
void RemoveResponse (size_t i)
 Remove one of the regular options from the set of selected responses. More...
 
void AddOtherResponse (const std::string &response)
 Add or update the "Other" free text response alongside regular selections. More...
 
void RemoveOtherResponse ()
 Remove the "Other" free text response. More...
 
- Public Member Functions inherited from mitk::Forms::QuestionWithOtherOption
 QuestionWithOtherOption ()
 Constructor. More...
 
 ~QuestionWithOtherOption () override
 Virtual destructor. More...
 
std::vector< std::string > GetResponsesAsStrings () const override
 Return all selected responses as strings, including the "Other" response if set. More...
 
void ClearResponses () override
 Clear all selected responses, including the "Other" response. More...
 
bool IsComplete () const override
 Check whether at least one response (regular or "Other") has been given. More...
 
bool HasOtherOption () const
 Query whether this question actually has an "Other" option. More...
 
void EnableOtherOption ()
 Switch on the "Other" option. More...
 
- Public Member Functions inherited from mitk::Forms::QuestionWithOptions
 ~QuestionWithOptions () override
 Virtual destructor. More...
 
size_t AddOption (const std::string &option)
 Add a non-exclusive option as possible answer to the question. More...
 
std::vector< std::string > GetOptions () const
 Get all available options. More...
 
- Public Member Functions inherited from mitk::Forms::Question
 Question ()
 Default constructor. More...
 
virtual ~Question ()
 Virtual destructor. More...
 
std::string GetQuestionText () const
 Get the literal question text. More...
 
void SetQuestionText (const std::string &question)
 Set the literal question text. More...
 
bool IsRequired () const
 Check whether a response to this question is required to complete a form. More...
 
void SetRequired (bool required=true)
 Set whether a response to this question is required to complete a form. More...
 
virtual std::string GetRequiredText () const
 Get the text that should be displayed to clearly mark a question as required. More...
 
virtual bool HasFileResponses () const
 Query whether the responses given to this question are file paths. More...
 
virtual std::vector< fs::path > SubmitFileResponses (const fs::path &basePath) const
 Attach response files to submission. More...
 

Additional Inherited Members

- Protected Member Functions inherited from mitk::Forms::QuestionWithOtherOption
void SetResponse (size_t i) override
 Set a regular option as the single response and clear any "Other" response. More...
 
void AddOtherResponse (const std::string &response)
 Add the free text given as "Other" option to the list of responses. More...
 
void RemoveOtherResponse ()
 Remove the "Other" response from the list of already given responses. More...
 
void SetOtherResponse (const std::string &response)
 Set the "Other" response as single exclusive response to this question. More...
 
- Protected Member Functions inherited from mitk::Forms::QuestionWithOptions
void AddResponse (size_t i)
 Add one of the possible answer options to the responses. More...
 
void RemoveResponse (size_t i)
 Remove one of the already given responses. More...
 

Detailed Description

A Question whose possible responses are represented by checkboxes.

The question can have multiple responses at once, including an optional free text response.

See also
MultipleChoiceQuestion, DropdownQuestion

Definition at line 27 of file mitkCheckboxesQuestion.h.

Constructor & Destructor Documentation

◆ ~CheckboxesQuestion()

mitk::Forms::CheckboxesQuestion::~CheckboxesQuestion ( )
override

Virtual destructor.

Member Function Documentation

◆ AddOtherResponse()

void mitk::Forms::QuestionWithOtherOption::AddOtherResponse

Add or update the "Other" free text response alongside regular selections.

Exposed from QuestionWithOtherOption.

◆ AddResponse()

void mitk::Forms::QuestionWithOptions::AddResponse

Add one of the regular options to the set of selected responses.

Exposed from QuestionWithOptions. Multiple options may be selected simultaneously.

◆ CreateAnother()

Question* mitk::Forms::CheckboxesQuestion::CreateAnother ( ) const
overridevirtual

Create a new default-constructed CheckboxesQuestion instance.

Returns
A pointer to a new CheckboxesQuestion. The caller takes ownership.

Implements mitk::Forms::Question.

◆ FromJSON()

void mitk::Forms::CheckboxesQuestion::FromJSON ( const nlohmann::ordered_json &  j)
overridevirtual

Deserialize this CheckboxesQuestion from JSON.

Parameters
[in]jThe JSON object to deserialize from.

Implements mitk::Forms::Question.

◆ GetType()

std::string mitk::Forms::CheckboxesQuestion::GetType ( ) const
overridevirtual

Return the type string "Checkboxes".

Returns
The string "Checkboxes".

Implements mitk::Forms::Question.

◆ RemoveOtherResponse()

void mitk::Forms::QuestionWithOtherOption::RemoveOtherResponse

Remove the "Other" free text response.

Exposed from QuestionWithOtherOption.

◆ RemoveResponse()

void mitk::Forms::QuestionWithOptions::RemoveResponse

Remove one of the regular options from the set of selected responses.

Exposed from QuestionWithOptions.

◆ ToJSON()

void mitk::Forms::CheckboxesQuestion::ToJSON ( nlohmann::ordered_json &  j) const
overridevirtual

Serialize this CheckboxesQuestion to JSON.

Parameters
[out]jThe JSON object to serialize into.

Implements mitk::Forms::Question.


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