72 ui.rendererStack->setCurrentWidget(getRendererForDocument(m_currentDocument)); |
72 ui.rendererStack->setCurrentWidget(getRendererForDocument(m_currentDocument)); |
73 |
73 |
74 connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); |
74 connect (m_tabs, SIGNAL (currentChanged(int)), this, SLOT (tabSelected())); |
75 connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); |
75 connect (m_tabs, SIGNAL (tabCloseRequested (int)), this, SLOT (closeTab (int))); |
76 connect(m_documents, SIGNAL(documentClosed(LDDocument*)), this, SLOT(documentClosed(LDDocument*))); |
76 connect(m_documents, SIGNAL(documentClosed(LDDocument*)), this, SLOT(documentClosed(LDDocument*))); |
77 connect( |
|
78 ui.objectList->selectionModel(), SIGNAL(selectionChanged()), |
|
79 this, SLOT(selectionChanged()) |
|
80 ); |
|
81 |
77 |
82 if (m_primitives->activeScanner()) |
78 if (m_primitives->activeScanner()) |
83 connect (m_primitives->activeScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); |
79 connect (m_primitives->activeScanner(), SIGNAL (workDone()), this, SLOT (updatePrimitives())); |
84 else |
80 else |
85 updatePrimitives(); |
81 updatePrimitives(); |
971 // A ton of stuff needs to be updated |
967 // A ton of stuff needs to be updated |
972 updateDocumentListItem (document); |
968 updateDocumentListItem (document); |
973 updateTitle(); |
969 updateTitle(); |
974 print ("Changed document to %1", document->getDisplayName()); |
970 print ("Changed document to %1", document->getDisplayName()); |
975 ui.objectList->setModel(document); |
971 ui.objectList->setModel(document); |
|
972 QItemSelectionModel* selection = m_selections.value(document); |
|
973 |
|
974 if (selection == nullptr) |
|
975 { |
|
976 m_selections[document] = ui.objectList->selectionModel(); |
|
977 renderer->setSelectionModel(m_selections[document]); |
|
978 } |
|
979 else |
|
980 { |
|
981 ui.objectList->setSelectionModel(selection); |
|
982 } |
976 } |
983 } |
977 } |
984 } |
978 |
985 |
979 /* |
986 /* |
980 * Returns the associated renderer for the given document |
987 * Returns the associated renderer for the given document |
983 { |
990 { |
984 Canvas* renderer = m_renderers.value(document); |
991 Canvas* renderer = m_renderers.value(document); |
985 |
992 |
986 if (not renderer) |
993 if (not renderer) |
987 { |
994 { |
988 print("MainWindow: Couldn't find a renderer for %1, creating one now", document->getDisplayName()); |
|
989 renderer = new Canvas {document, this}; |
995 renderer = new Canvas {document, this}; |
990 print("Created renderer: %1", renderer); |
|
991 m_renderers[document] = renderer; |
996 m_renderers[document] = renderer; |
992 ui.rendererStack->addWidget(renderer); |
997 ui.rendererStack->addWidget(renderer); |
993 connect(m_messageLog, SIGNAL(changed()), renderer, SLOT(update())); |
998 connect(m_messageLog, SIGNAL(changed()), renderer, SLOT(update())); |
994 } |
999 } |
995 |
1000 |