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

Method UpdateFormHeader

Modules/FormsUI/src/QmitkForm.cpp:165–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void QmitkForm::UpdateFormHeader()
166{
167 if (m_HasBeenSubmitted || m_Ui->sectionWidget->currentIndex() == -1)
168 {
169 m_Ui->formHeaderFrame->hide();
170 return;
171 }
172
173 bool showTitle = !m_Form->GetTitle().empty();
174
175 m_Ui->formTitleLabel->setVisible(showTitle);
176
177 if (showTitle)
178 m_Ui->formTitleLabel->setText(QString("<h2>%1</h2>").arg(QString::fromStdString(m_Form->GetTitle())));
179
180 int sectionIndex = m_Ui->sectionWidget->currentIndex();
181 bool showDescription = sectionIndex == 0 && !m_Form->GetDescription().empty();
182
183 m_Ui->formDescriptionLabel->setVisible(showDescription);
184
185 if (showDescription)
186 m_Ui->formDescriptionLabel->setText(QString::fromStdString(m_Form->GetDescription()));
187
188 bool hasRequiredQuestion = false;
189
190 for (auto question : m_Form->GetSection(sectionIndex).GetQuestions())
191 {
192 if (question->IsRequired())
193 {
194 hasRequiredQuestion = true;
195 break;
196 }
197 }
198
199 m_Ui->requiredLabel->setVisible(hasRequiredQuestion);
200
201 m_Ui->formHeaderFrame->setVisible(showTitle || showDescription || hasRequiredQuestion);
202}
203
204void QmitkForm::UpdateSubmittedHeader()
205{

Callers 1

UpdateMethod · 0.95

Calls 7

GetQuestionsMethod · 0.80
IsRequiredMethod · 0.80
QStringClass · 0.50
emptyMethod · 0.45
GetTitleMethod · 0.45
setTextMethod · 0.45
GetDescriptionMethod · 0.45

Tested by

no test coverage detected