35 this, |
35 this, |
36 SIGNAL(objectAdded(QModelIndex)), |
36 SIGNAL(objectAdded(QModelIndex)), |
37 this, |
37 this, |
38 SLOT(handleNewObject(QModelIndex)) |
38 SLOT(handleNewObject(QModelIndex)) |
39 ); |
39 ); |
40 |
|
41 connect( |
|
42 this, |
|
43 &Model::rowsMoved, |
|
44 [&](const QModelIndex&, int start, int end, const QModelIndex&, int row) |
|
45 { |
|
46 history()->add<MoveHistoryEntry>(start, end, row); |
|
47 } |
|
48 ); |
|
49 connect( |
40 connect( |
50 this, |
41 this, |
51 SIGNAL(aboutToRemoveObject(QModelIndex)), |
42 SIGNAL(aboutToRemoveObject(QModelIndex)), |
52 this, |
43 this, |
53 SLOT(handleImminentObjectRemoval(QModelIndex)), |
44 SLOT(handleImminentObjectRemoval(QModelIndex)), |
384 m_window->updateDocumentListItem (this); |
375 m_window->updateDocumentListItem (this); |
385 m_window->updateTitle(); |
376 m_window->updateTitle(); |
386 return true; |
377 return true; |
387 } |
378 } |
388 |
379 |
389 void LDDocument::handleNewObject(const QModelIndex& index) |
380 void LDDocument::handleNewObject(const Uuid& index) |
390 { |
381 { |
391 LDObject* object = lookup(index); |
382 LDObject* object = lookup(index); |
392 history()->add<AddHistoryEntry>(index); |
383 history()->add<AddHistoryEntry>(index); |
393 connect( |
384 connect( |
394 object, |
385 object, |
406 { |
397 { |
407 QModelIndex index = this->indexOf(object); |
398 QModelIndex index = this->indexOf(object); |
408 history()->add<EditHistoryEntry>(index, before, after); |
399 history()->add<EditHistoryEntry>(index, before, after); |
409 redoVertices(); |
400 redoVertices(); |
410 emit objectModified(object); |
401 emit objectModified(object); |
411 emit dataChanged(index, index); |
402 } |
412 } |
403 } |
413 } |
404 |
414 |
405 void LDDocument::handleImminentObjectRemoval(const Uuid& index) |
415 void LDDocument::handleImminentObjectRemoval(const QModelIndex& index) |
|
416 { |
406 { |
417 LDObject* object = lookup(index); |
407 LDObject* object = lookup(index); |
418 |
408 |
419 if (not isFrozen() and not m_isBeingDestroyed) |
409 if (not isFrozen() and not m_isBeingDestroyed) |
420 { |
410 { |