[PyKDE] Newbie question on QWidget.focusOutEvent

Hans-Peter Jansen hpj at urpla.net
Mon Sep 26 21:08:23 BST 2005


Am Montag, 26. September 2005 20:01 schrieb Volker Lenhardt:
>
> Pete, I'll have a drink to your health. Thank you, it works.

Glad to hear. Cheers ;-) 

> The central problem was the message box (it would have given me
> direct information with my terminal blocked out of sight).
>
> It's interesting that a print statement instead of the message box in
> my version yields decent results - with one peculiarity: I am bound
> to double click to choose an item. But that is only an academic
> question. I'll stick to your version. It's straightforward. And I
> actually don't need no special class and no GUI function for my
> objective.

Hmm, cannot reproduce here with my "desktop" linux, but it could very 
well be my fault. Try this:

--- focusoutest.py      2005-09-26 17:24:04.743127461 +0200
+++ focusoutest2.py     2005-09-26 22:01:24.099716956 +0200
@@ -38,7 +38,9 @@
                     if o==cmb.lineEdit():
                         print "bingo"
                         #QMessageBox.information(self, "Info", "Bingo")
-        return False
+                        return False
+        return QObject.eventFilter(self, o, e)
+            
 
 if __name__=="__main__":
      app=QApplication(sys.argv)


> Thanks, too, for your hint to QApplication and duplicatesEnabled.

While at it..

Pete




More information about the PyQt mailing list