src/lddocument.cpp

changeset 1272
bf0ac547b934
parent 1269
ec691d9472b3
child 1273
900f1dfae46b
equal deleted inserted replaced
1271:c022fb3855b1 1272:bf0ac547b934
39 this, 39 this,
40 SIGNAL(objectAdded(QModelIndex)), 40 SIGNAL(objectAdded(QModelIndex)),
41 this, 41 this,
42 SLOT(handleNewObject(QModelIndex)) 42 SLOT(handleNewObject(QModelIndex))
43 ); 43 );
44
45 connect(
46 this,
47 &Model::objectsSwapped,
48 [&](const QModelIndex& index_1, const QModelIndex& index_2)
49 {
50 history()->add<SwapHistoryEntry>(index_1, index_2);
51 }
52 );
44 } 53 }
45 54
46 LDDocument::~LDDocument() 55 LDDocument::~LDDocument()
47 { 56 {
48 m_isBeingDestroyed = true; 57 m_isBeingDestroyed = true;
415 static_cast<LDSubfileReference*>(object)->inlineContents(documentManager(), model, deep, renderinline); 424 static_cast<LDSubfileReference*>(object)->inlineContents(documentManager(), model, deep, renderinline);
416 else 425 else
417 model.addFromString(object->asText()); 426 model.addFromString(object->asText());
418 } 427 }
419 } 428 }
420 // =============================================================================
421 //
422 bool LDDocument::swapObjects (LDObject* one, LDObject* other)
423 {
424 if (Model::swapObjects(one, other))
425 {
426 history()->add<SwapHistoryEntry>(one->id(), other->id());
427 return true;
428 }
429 else
430 {
431 return false;
432 }
433 }
434 429
435 // ============================================================================= 430 // =============================================================================
436 // 431 //
437 QString LDDocument::shortenName (QString a) // [static] 432 QString LDDocument::shortenName (QString a) // [static]
438 { 433 {

mercurial