MCPcopy Create free account
hub / github.com/MITK/MITK / CreateQuestionWidgets

Method CreateQuestionWidgets

Modules/FormsUI/src/QmitkForm.cpp:85–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void QmitkForm::CreateQuestionWidgets()
86{
87 while (m_Ui->sectionWidget->count() > 0)
88 {
89 auto sectionWidget = m_Ui->sectionWidget->widget(0);
90 m_Ui->sectionWidget->removeWidget(sectionWidget);
91 sectionWidget->deleteLater();
92 }
93
94 const int numberOfSections = m_Form->GetNumberOfSections();
95
96 for (int sectionIndex = 0; sectionIndex < numberOfSections; ++sectionIndex)
97 {
98 const auto& section = m_Form->GetSection(sectionIndex);
99 auto questions = section.GetQuestions();
100
101 auto sectionWidget = new QWidget;
102 m_Ui->sectionWidget->addWidget(sectionWidget);
103
104 auto sectionLayout = new QVBoxLayout(sectionWidget);
105 sectionLayout->setContentsMargins(0, 0, 0, 0);
106 sectionLayout->setSpacing(8);
107
108 for (auto question : questions)
109 {
110 auto questionWidget = UI::IQuestionWidgetFactory::GetInstance()->Create(question);
111 sectionLayout->addWidget(questionWidget);
112 }
113 }
114}
115
116bool QmitkForm::ValidateCurrentSection()
117{

Callers 1

SetFormMethod · 0.95

Calls 4

countMethod · 0.80
GetNumberOfSectionsMethod · 0.80
GetQuestionsMethod · 0.80
CreateMethod · 0.45

Tested by

no test coverage detected