| 262 | } |
| 263 | |
| 264 | void ConfigItemDelegate::setModelData(QWidget *editor, |
| 265 | QAbstractItemModel *model, |
| 266 | const QModelIndex &index) const |
| 267 | { |
| 268 | QLineEdit *lineEdit; |
| 269 | ConfigItem *item; |
| 270 | struct symbol *sym; |
| 271 | bool success; |
| 272 | |
| 273 | lineEdit = qobject_cast<QLineEdit *>(editor); |
| 274 | // If this is not a QLineEdit, use the parent's default. |
| 275 | // (does this happen?) |
| 276 | if (!lineEdit) |
| 277 | goto parent; |
| 278 | |
| 279 | item = static_cast<ConfigItem *>(index.internalPointer()); |
| 280 | if (!item || !item->menu) |
| 281 | goto parent; |
| 282 | |
| 283 | sym = item->menu->sym; |
| 284 | if (!sym) |
| 285 | goto parent; |
| 286 | |
| 287 | success = sym_set_string_value(sym, lineEdit->text().toUtf8().data()); |
| 288 | if (success) { |
| 289 | ConfigList::updateListForAll(); |
| 290 | } else { |
| 291 | QMessageBox::information(editor, "qconf", |
| 292 | "Cannot set the data (maybe due to out of range).\n" |
| 293 | "Setting the old value."); |
| 294 | lineEdit->setText(sym_get_string_value(sym)); |
| 295 | } |
| 296 | |
| 297 | parent: |
| 298 | QStyledItemDelegate::setModelData(editor, model, index); |
| 299 | } |
| 300 | |
| 301 | ConfigList::ConfigList(QWidget *parent, const char *name) |
| 302 | : QTreeWidget(parent), |
nothing calls this directly
no test coverage detected