[graphics/krita/release/6.0.3] 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 2128e3402810cd09ea35ed249a1537407f4717fc by Dmitry Kazakov.
Committed on 26/07/2026 at 10:51.
Pushed by dkazakov into branch 'release/6.0.3'.

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/2128e3402810cd09ea35ed249a1537407f4717fc

diff --git a/libs/ui/kis_selection_actions_panel.cpp b/libs/ui/kis_selection_actions_panel.cpp
index cbdc4322731..8f5d41f5478 100644
--- a/libs/ui/kis_selection_actions_panel.cpp
+++ b/libs/ui/kis_selection_actions_panel.cpp
@@ -314,6 +314,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();
@@ -328,8 +332,6 @@ void KisSelectionActionsPanel::setVisible(bool p_visible)
 
         d->m_pressed = false;
     }
-
-    d->m_visible = p_visible;
 }
 
 void KisSelectionActionsPanel::setEnabled(bool enabled)
@@ -411,11 +413,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
@@ -733,6 +739,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.