| 78 | } |
| 79 | |
| 80 | void QmitkCheckboxesQuestionWidget::CreateWidgets() |
| 81 | { |
| 82 | this->RemoveWidgets(); |
| 83 | |
| 84 | int row = 0; |
| 85 | |
| 86 | for (const auto& option : m_Question->GetOptions()) |
| 87 | { |
| 88 | auto checkBox = new QCheckBox(QString::fromStdString(option)); |
| 89 | m_Layout->addWidget(checkBox, row, 0, 1, 2); |
| 90 | m_ButtonGroup->addButton(checkBox, row++); |
| 91 | } |
| 92 | |
| 93 | if (m_Question->HasOtherOption()) |
| 94 | { |
| 95 | auto checkBox = new QCheckBox("Other:"); |
| 96 | m_Layout->addWidget(checkBox, row, 0); |
| 97 | m_ButtonGroup->addButton(checkBox, row); |
| 98 | m_OtherId = row; |
| 99 | |
| 100 | m_OtherLineEdit = new QLineEdit; |
| 101 | m_Layout->addWidget(m_OtherLineEdit, row++, 1); |
| 102 | |
| 103 | connect(m_OtherLineEdit, &QLineEdit::textEdited, this, &Self::OnTextEdited); |
| 104 | connect(m_OtherLineEdit, &QLineEdit::editingFinished, this, &Self::OnEditingFinished); |
| 105 | } |
| 106 | else |
| 107 | { |
| 108 | m_OtherId = -1; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | void QmitkCheckboxesQuestionWidget::RemoveWidgets() |
| 113 | { |
no test coverage detected