[graphics/krita] libs/ui: Fix SAP appearing as a ghost on the canvas when hidden

Dmitry Kazakov <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 61ac5f62b9401f59f7ec28bba808e29e0b448bd9 by Dmitry Kazakov.
Committed on 26/07/2026 at 10:56.
Pushed by dkazakov into branch 'master'.

Fix SAP appearing as a ghost on the canvas when hidden

KisSelectionActionsPanel::movePanelWidgets() would unconditionally
switch the internal widgets into a "visible" state, even though their
rendering would still be disabled via an internal `d->m_visible`.

M  +14   -4    libs/ui/kis_selection_actions_panel.cpp

https://invent.kde.org/graphics/krita/-/commit/61ac5f62b9401f59f7ec28bba808e29e0b448bd9

diff --git a/libs/ui/kis_selection_actions_panel.cpp b/libs/ui/kis_selection_actions_panel.cpp
index 862a60e0587..ec8ecace909 100644
--- a/libs/ui/kis_selection_actions_panel.cpp
+++ b/libs/ui/kis_selection_actions_panel.cpp
@@ -317,6 +317,10 @@ void KisSelectionActionsPanel::setVisible(bool p_visible)
 
     d->configure_action->setVisible(p_visible && d->m_viewManager->selection());
 
+    // movePanelWidgets() uses d->m_visible to decide whether to make the widgets
+    // visible or not
+    d->m_visible = p_visible;
+
     if (d->m_viewManager->selection() && p_visible) { // Now visible!
         d->m_handleWidget->installEventFilter(this);
         d->m_dragHandle.position = currentTopLeftPosition();
@@ -331,8 +335,6 @@ void KisSelectionActionsPanel::setVisible(bool p_visible)
 
         d->m_pressed = false;
     }
-
-    d->m_visible = p_visible;
 }
 
 void KisSelectionActionsPanel::setEnabled(bool enabled)
@@ -414,11 +416,15 @@ void KisSelectionActionsPanel::canvasWidgetChanged(KisCanvasWidgetBase* canvas)
 
     Q_FOREACH(QWidget* btn, d->m_buttons)  {
         btn->setParent(canvas->widget());
-        btn->show();
+        if (d->m_visible) {
+            btn->show();
+        }
     }
 
     d->m_handleWidget->setParent(canvas->widget());
-    d->m_handleWidget->show();
+    if (d->m_visible) {
+        d->m_handleWidget->show();
+    }
 }
 
 QPoint KisSelectionActionsPanel::clipPositionToCanvasBoundaries(QPoint position, QWidget *canvasWidget) const
@@ -743,6 +749,10 @@ void KisSelectionActionsPanel::movePanelWidgets()
     if (!d->m_handleWidget)
         return;
 
+    // don't show the widgets if the panel is hidden
+    if (!d->m_visible)
+        return;
+
     if (d->orientation == Orientation::Vertical) {
         d->m_handleWidget->move(d->m_dragHandle.position.x(),
                                 d->m_dragHandle.position.y() + d->m_buttons.size() * BUTTON_SIZE);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.