src/toolsets/filetoolset.cpp

changeset 1073
a0a0d581309b
parent 1072
9ce9496427f2
child 1079
67c6e5d32e68
equal deleted inserted replaced
1072:9ce9496427f2 1073:a0a0d581309b
116 QFile file = {filePath}; 116 QFile file = {filePath};
117 117
118 if (file.open(QIODevice::ReadOnly)) 118 if (file.open(QIODevice::ReadOnly))
119 { 119 {
120 // TODO: shouldn't need to go to the document manager to parse a file 120 // TODO: shouldn't need to go to the document manager to parse a file
121 LDObjectList objects = m_documents->loadFileContents(&file, nullptr, nullptr); 121 Model model;
122 m_documents->loadFileContents(&file, model, nullptr, nullptr);
122 123
123 currentDocument()->clearSelection(); 124 currentDocument()->clearSelection();
124 125
125 for (LDObject* object : objects) 126 for (LDObject* object : model.objects())
126 { 127 {
127 currentDocument()->insertObject (position, object); 128 currentDocument()->insertObject (position, object);
128 object->select(); 129 currentDocument()->addToSelection(object);
129 m_window->renderer()->compileObject (object); 130 m_window->renderer()->compileObject (object);
130 position++; 131 position++;
131 } 132 }
132 133
133 m_window->refresh(); 134 m_window->refresh();

mercurial