| 185 | |
| 186 | |
| 187 | int CheckSetSelectionListModel::addCheckSetSelection(const QString& name) |
| 188 | { |
| 189 | const int newRow = m_checkSetSelections.count(); |
| 190 | beginInsertRows(QModelIndex(), newRow, newRow); |
| 191 | |
| 192 | CheckSetSelection checkSetSelection; |
| 193 | const QString id = QUuid::createUuid().toString(); |
| 194 | checkSetSelection.setId(id); |
| 195 | checkSetSelection.setName(name); |
| 196 | |
| 197 | const bool isNewDefault = m_checkSetSelections.isEmpty(); |
| 198 | m_checkSetSelections.append(checkSetSelection); |
| 199 | |
| 200 | m_added.append(id); |
| 201 | m_edited.insert(id); |
| 202 | if (isNewDefault) { |
| 203 | m_defaultChanged = true; |
| 204 | m_defaultCheckSetSelectionId = id; |
| 205 | } |
| 206 | |
| 207 | endInsertRows(); |
| 208 | if (isNewDefault) { |
| 209 | emit defaultCheckSetSelectionChanged(m_defaultCheckSetSelectionId); |
| 210 | } |
| 211 | |
| 212 | return newRow; |
| 213 | } |
| 214 | |
| 215 | int CheckSetSelectionListModel::cloneCheckSetSelection(const QString& name, int row) |
| 216 | { |