Commit 5f168a58 authored by Alexander Semke's avatar Alexander Semke

Avoid the selection change in the project explorer when making plots

invisible.
parent 6a51387c
......@@ -29,6 +29,7 @@
#include "backend/worksheet/WorksheetElementContainer.h"
#include "backend/worksheet/WorksheetElementContainerPrivate.h"
#include "backend/worksheet/plots/cartesian/Axis.h"
#include "backend/worksheet/Worksheet.h"
#include "backend/lib/commandtemplates.h"
#include "backend/lib/macros.h"
#include "backend/lib/trace.h"
......@@ -227,8 +228,16 @@ void WorksheetElementContainerPrivate::hoverLeaveEvent(QGraphicsSceneHoverEvent*
bool WorksheetElementContainerPrivate::swapVisible(bool on) {
bool oldValue = isVisible();
//When making a graphics item invisible, it gets deselected in the scene.
//In this case we don't want to deselect the item in the project explorer.
//We need to supress the deselection in the view.
auto* worksheet = static_cast<Worksheet*>(q->parent(AspectType::Worksheet));
worksheet->suppressSelectionChangedEvent(true);
setVisible(on);
emit q->visibleChanged(on);
worksheet->suppressSelectionChangedEvent(false);
return oldValue;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment