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

A Question whose possible response is a short single-line free text. More...

#include <mitkShortAnswerQuestion.h>

Inheritance diagram for mitk::Forms::ShortAnswerQuestion:
Collaboration diagram for mitk::Forms::ShortAnswerQuestion:

Public Member Functions

 ~ShortAnswerQuestion () override
 Virtual destructor. More...
 
std::string GetType () const override
 Return the type string "Short answer". More...
 
Question * CreateAnother () const override
 Create a new default-constructed ShortAnswerQuestion instance. More...
 
void FromJSON (const nlohmann::ordered_json &j) override
 Deserialize this ShortAnswerQuestion from JSON. More...
 
void ToJSON (nlohmann::ordered_json &j) const override
 Serialize this ShortAnswerQuestion to JSON. More...
 
- Public Member Functions inherited from mitk::Forms::TextQuestion
 ~TextQuestion () override
 Virtual destructor. More...
 
std::vector< std::string > GetResponsesAsStrings () const override
 Return the text response as a single-element vector. More...
 
void ClearResponses () override
 Clear the text response. More...
 
bool IsComplete () const override
 Check whether the response is non-empty. More...
 
std::string GetResponse () const
 Get the current text response. More...
 
void SetResponse (const std::string &response)
 Set the text response. 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...
 

Detailed Description

A Question whose possible response is a short single-line free text.

ShortAnswerQuestion is intended for brief, single-line text answers. For longer multi-line text, use ParagraphQuestion instead.

See also
ParagraphQuestion, TextQuestion

Definition at line 27 of file mitkShortAnswerQuestion.h.

Constructor & Destructor Documentation

◆ ~ShortAnswerQuestion()

mitk::Forms::ShortAnswerQuestion::~ShortAnswerQuestion ( )
override

Virtual destructor.

Member Function Documentation

◆ CreateAnother()

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

Create a new default-constructed ShortAnswerQuestion instance.

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

Implements mitk::Forms::Question.

◆ FromJSON()

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

Deserialize this ShortAnswerQuestion from JSON.

Parameters
[in]jThe JSON object to deserialize from.

Implements mitk::Forms::Question.

◆ GetType()

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

Return the type string "Short answer".

Returns
The string "Short answer".

Implements mitk::Forms::Question.

◆ ToJSON()

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

Serialize this ShortAnswerQuestion 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: