Fwd: branches/koffice/1.6/koffice/krita/ui
    David Faure 
    faure at kde.org
       
    Mon Sep  4 18:53:06 CEST 2006
    
    
  
Also committed to trunk.
----------  Forwarded Message  ----------
Subject: branches/koffice/1.6/koffice/krita/ui
Date: Monday 04 September 2006 18:46
From: David Faure <faure at kde.org>
To: kde-commits at kde.org
Cc: kde-kimageshop at kde.org
SVN commit 580857 by dfaure:
Don't install event filters on everything from every view - it doesn't scale up when having multiple views,
and it's redundant anyway, when every view is already a qApp event filter (i.e. it gets -all- events).
I left the code in because ideally it would be better to only care about child widgets and remove the
qApp event filter, to leave other views alone; but I guess this approach didn't work, from the comments...
 M  +15 -11    kis_view.cc  
--- branches/koffice/1.6/koffice/krita/ui/kis_view.cc #580856:580857
@@ -3522,24 +3522,28 @@
         }
         break;
     }
-#ifdef EXTENDED_X11_TABLET_SUPPORT
+#if 0
+    // This code is unnecessary now that there's an application event filter
+    // This eventFilter is called for all widgets already, no need to install event filters multiple times
+    // Even worse: with multiple views, they would all install event filters on each other's widgets,
+    // due to the qapp event filter triggering in all views!
     case QEvent::ChildInserted:
     {
         QChildEvent *childEvent = static_cast<QChildEvent *>(e);
         QObject *child = childEvent->child();
+        if ( child->isWidgetType() ) {
 
-        child->installEventFilter(this);
+            child->installEventFilter(this);
 
-        QObjectList *objectList = child->queryList("QWidget");
-        QObjectListIt it(*objectList);
-        QObject *obj;
-
-        while ((obj = it.current()) != 0) {
-           obj->installEventFilter(this);
-           ++it;
+            QObjectList *objectList = child->queryList("QWidget");
+            QObjectListIt it(*objectList);
+            QObject *obj;
+            while ((obj = it.current()) != 0) {
+                obj->installEventFilter(this);
+                ++it;
+            }
+            delete objectList;
         }
-
-        delete objectList;
     }
 #endif
     default:
-------------------------------------------------------
-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
    
    
More information about the kimageshop
mailing list