[PyKDE] Newbie question on QWidget.focusOutEvent

Volker Lenhardt volker.lenhardt at uni-due.de
Mon Sep 26 19:01:18 BST 2005


Hans-Peter Jansen schrieb:
> 
> Notes:
>  - I removed the Combo class, but it would be pretty straight forward to
>    transform..
>  - You need to install the eventFilter on the lineEdit() in this case, and 
>    I admit, event filtering on Qt container widgets involves a bit of voodoo
>    (but at least it should be consistent across platforms, which is _the_ 
>    horror other toolkits often suffer from..).
>  - If you use focus event impacting GUI functions inthe event handler, don't 
>    wonder about multiple focus events. 
>  - The QComboBox duplicatesEnabled property has the wrong default IMHO.
> 
> I've no idea, where your segfault came from, but it could be a reentrancy 
> problem in QPE. If you cannot use print, how about using a log file, or do
> something focus agnostic or handle the mess..
> 
> Pete
> 

Pete, I'll have a drink to your health. Thank you, it works.

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.

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

Volker




More information about the PyQt mailing list