mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-30 14:49:59 +02:00
Highlight current page in ProjectView on diagram activation
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user