[Kst] branches/work/kst/portto4/kst/src/libkstapp

Peter Kümmel syntheticpp at gmx.net
Thu Sep 2 17:23:37 CEST 2010


SVN commit 1171060 by kuemmel:

add workaround for Qt bug 
http://bugreports.qt.nokia.com/browse/QTBUG-8188

CCBUG:249253
CCBUG:247634


 M  +12 -2     plotrenderitem.cpp  
 M  +3 -3      view.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitem.cpp #1171059:1171060
@@ -19,6 +19,7 @@
 #include "sharedaxisboxitem.h"
 #include "application.h"
 #include "image.h"
+#include "debug.h"
 
 #include <QTime>
 #include <QMenu>
@@ -642,8 +643,17 @@
   setFocus(Qt::MouseFocusReason);
 
   // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-8188
-  // Kst: http://bugs.kde.org/show_bug.cgi?id=247634
-  //bool foc = hasFocus(); // foc is false in the second tab
+  if (!hasFocus()) {
+    QEvent activate(QEvent::WindowActivate);
+    View* view = parentView();
+    if (view) {
+      QApplication::sendEvent(view->scene(), &activate);
+      setFocus(Qt::MouseFocusReason);
+      if (!hasFocus()) {
+        Debug::self()->log("PlotRenderItem::hoverEnterEvent: could not set focus", Debug::Warning);
+      }
+    }
+  }
 
   updateCursor(event->pos());
 
--- branches/work/kst/portto4/kst/src/libkstapp/view.cpp #1171059:1171060
@@ -259,9 +259,9 @@
           continue;
 	
         // Qt bug: http://bugreports.qt.nokia.com/browse/QTBUG-8188
-        // also see PlotRenderItem::hoverEnterEvent
-        if (viewItem                         && viewItem->tryShortcut(e->key())) {
-        //if (viewItem && viewItem->hasFocus() && viewItem->tryShortcut(e->key())) {
+        // also see PlotRenderItem::hoverEnterEvent, there is a workaround.
+        //if (viewItem                         && viewItem->tryShortcut(e->key())) {
+        if (viewItem && viewItem->hasFocus() && viewItem->tryShortcut(e->key())) {
           return true;
         }
       }


More information about the Kst mailing list