Changeset View
Changeset View
Standalone View
Standalone View
kmplot/initialconditionseditor.cpp
Show First 20 Lines • Show All 314 Lines • ▼ Show 20 Line(s) | |||||
315 | { | 315 | { | ||
316 | m_model->insertRows( 0, 1, QModelIndex() ); | 316 | m_model->insertRows( 0, 1, QModelIndex() ); | ||
317 | emit dataChanged(); | 317 | emit dataChanged(); | ||
318 | } | 318 | } | ||
319 | 319 | | |||
320 | 320 | | |||
321 | void InitialConditionsEditor::remove() | 321 | void InitialConditionsEditor::remove() | ||
322 | { | 322 | { | ||
323 | QModelIndexList selected = view->selectionModel()->selectedIndexes(); | 323 | const QModelIndexList selected = view->selectionModel()->selectedIndexes(); | ||
324 | 324 | | |||
325 | QMap< int, void * > sorted; | 325 | QMap< int, void * > sorted; | ||
326 | foreach ( const QModelIndex &index, selected ) | 326 | for ( const QModelIndex &index : selected ) | ||
327 | sorted.insert( -index.row(), 0l ); | 327 | sorted.insert( -index.row(), 0l ); | ||
328 | QList<int> indexes = sorted.keys(); | 328 | const QList<int> indexes = sorted.keys(); | ||
329 | 329 | | |||
330 | foreach ( int row, indexes ) | 330 | for ( int row : indexes ) | ||
331 | m_model->removeRows( -row, 1, QModelIndex() ); | 331 | m_model->removeRows( -row, 1, QModelIndex() ); | ||
332 | 332 | | |||
333 | emit dataChanged(); | 333 | emit dataChanged(); | ||
334 | } | 334 | } | ||
335 | //END class InitialConditionsEditor | 335 | //END class InitialConditionsEditor |