[krita] libs/ui: Set focus on the view on mouse-over

Boudewijn Rempt null at kde.org
Fri Apr 10 10:03:20 BST 2020


Git commit 5438445da9651785585ea913c37293737a5ee608 by Boudewijn Rempt.
Committed on 10/04/2020 at 08:59.
Pushed by rempt into branch 'master'.

Set focus on the view on mouse-over

This "should" solve the issues we have when an widget in a docker
has input focus, and people move the cursor back to the canvas
and start to pan or paint.

However, it's a _very_ brute-force method, so we all need to be
aware of this change and check whether stupid things happen, in
which case we might need to do something a bit more subtle, with
timers or so...

CCMAIL:kimageshop at kde.org
BUG:372646

M  +6    -0    libs/ui/KisView.cpp
M  +1    -0    libs/ui/KisView.h

https://invent.kde.org/kde/krita/commit/5438445da9651785585ea913c37293737a5ee608

diff --git a/libs/ui/KisView.cpp b/libs/ui/KisView.cpp
index d5ec37443a..21951d0177 100644
--- a/libs/ui/KisView.cpp
+++ b/libs/ui/KisView.cpp
@@ -707,6 +707,12 @@ void KisView::closeEvent(QCloseEvent *event)
 
 }
 
+void KisView::mouseMoveEvent(QMouseEvent *event)
+{
+    setFocus();
+}
+
+
 bool KisView::queryClose()
 {
     if (!document())
diff --git a/libs/ui/KisView.h b/libs/ui/KisView.h
index 383771b109..eed1a0705a 100644
--- a/libs/ui/KisView.h
+++ b/libs/ui/KisView.h
@@ -276,6 +276,7 @@ protected:
     void dropEvent(QDropEvent *event) override;
     void dragMoveEvent(QDragMoveEvent *event) override;
     void closeEvent(QCloseEvent *event) override;
+    void mouseMoveEvent(QMouseEvent *event) override;
 
     /**
      * Generate a name for this view.


More information about the kimageshop mailing list