| 116 | } |
| 117 | |
| 118 | void QmitkSimpleBarrierParametersDelegate::setModelData(QWidget* editor, QAbstractItemModel* model |
| 119 | , const QModelIndex& index) const |
| 120 | { |
| 121 | QVariant data = index.data(Qt::EditRole); |
| 122 | |
| 123 | if (data.isValid()) |
| 124 | { |
| 125 | QListWidget* list = qobject_cast<QListWidget*>(editor); |
| 126 | QStringList selectedItems; |
| 127 | |
| 128 | if (list) |
| 129 | { |
| 130 | for (int row = 0; row < list->count(); ++row) |
| 131 | { |
| 132 | QListWidgetItem* item = list->item(row); |
| 133 | |
| 134 | if (item->checkState() == Qt::Checked) |
| 135 | { |
| 136 | selectedItems.append(item->text()); |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | QVariant selectedVariant(selectedItems); |
| 142 | model->setData(index, selectedVariant); |
| 143 | } |
| 144 | else |
| 145 | { |
| 146 | QStyledItemDelegate::setModelData(editor, model, index); |
| 147 | } |
| 148 | } |
nothing calls this directly
no test coverage detected