[PyKDE] Newbie question on QWidget.focusOutEvent
Volker Lenhardt
volker.lenhardt at uni-due.de
Mon Sep 26 07:04:48 BST 2005
Hi Pete,
I thought I'd got the knack of it. But I haven't succeeded yet.
This is the relevant part of my script:
class DlgTourn(QDialog):
def __init__(self, tourn):
QDialog.__init__(self, None, None, True, 1)
self.layout=QVBoxLayout(self)
self.inputLayout=QGridLayout(self.layout, 1, 1, 5)
for i in (4, 5):
for j in (1, 3):
s+=1
cmb=Combo(s, True, self)
cmb.installEventFilter(self)
for p in self.playerList:
cmb.insertItem(p, -1)
self.wCmbList.append(cmb)
self.inputLayout.addWidget(cmb, i, j)
class Combo(QComboBox):
def __init__(self, p, *args):
QComboBox.__init__(self, *args)
self.setFocusPolicy(QWidget.StrongFocus)
self.p=p
def eventFilter(self, o, e):
if e and o:
if e.type()==QEvent.FocusOut:
if o==self:
# if o==self.lineEdit():
QMessageBox.information(self, "Info", str(self.p))
# return True
return False
If I have o==self, no message box appears, but I have to double click
(on my PDA!) to make my choice of item.
If I have o==self.lineEdit() I get 2(!) message boxes when I leave the
lineEdit, and on clicking it away the program crashes with segmentation
fault.
No difference whether return True or False within the if-condition.
Any hint?
Volker
--
Volker Lenhardt
Am Spinnweg 19, 45894 Gelsenkirchen
Tel.: 0209/30213
E-Mail: volker.lenhardt at uni-duisburg-essen.de
More information about the PyQt
mailing list