diff --git a/sources/qetdiagrameditor.cpp b/sources/qetdiagrameditor.cpp index 590650a64..fad6d0e95 100644 --- a/sources/qetdiagrameditor.cpp +++ b/sources/qetdiagrameditor.cpp @@ -1168,6 +1168,18 @@ bool QETDiagramEditor::addProject(QETProject *project, bool update_panel) // cree un ProjectView pour visualiser le projet ProjectView *project_view = new ProjectView(project); + //Highlight the current page + connect(project_view, &ProjectView::diagramActivated, this, [this](DiagramView *dv) { + if (dv && dv->diagram() && pa && pa->elements_panel) { + // 1. Find the item in the tree that corresponds to this diagram + QTreeWidgetItem *item = pa->elements_panel->getItemForDiagram(dv->diagram()); + + // 2. If you find it, select it + if (item) { + pa->elements_panel->setCurrentItem(item); + } + } + }); addProjectView(project_view); undo_group.addStack(project -> undoStack());