void Scene::insertSet(int row) { Q_ASSERT( row <= eventActionsSets.size() ); EventActionsSet *p(new EventActionsSet(row, advancedMode)); eventActionsSets.insert(row, p); addItem(p); connect(p, SIGNAL(contentChanged()), this, SLOT(recompile())); connect(p, SIGNAL(undoCheckpoint()), this, SIGNAL(undoCheckpoint())); rearrangeSets(row+1); relayout(); recompile(); USAGE_LOG(logInsertSet(row)); emit undoCheckpoint(); p->setSoleSelection(); QGraphicsView* view; foreach (view, views()) view->ensureVisible(p); setModified(true); }
//! Makes sure that there is at least one empty event-actions set at the end of the scene void Scene::ensureOneEmptySetAtEnd() { EventActionsSet *newSet(0); if (eventActionsSets.empty()) newSet = createNewEventActionsSet(); else if (!eventActionsSets.last()->isEmpty()) newSet = createNewEventActionsSet(); if (newSet) { relayout(); // make sure the newly set is visible QGraphicsView* view; foreach (view, views()) view->ensureVisible(newSet); } }