简体   繁体   中英

pydev code completition and duck typing in pyqt and qt4

Hello i have just installed pydev because of code completition. my first sketch is some simple qt widget.

i'm ovverriding mouseMoveEvent:

def mouseMoveEvent(self, event):

    mouse = event.pos()

now.. i know that event variable is a QtCore.QPoint type.. but code completition does not work.. ok i understand it: there is no hard typing, there is duck typing, in theory event could be of any possible type..

instead if i have this code:

point = QtCore.QPoint()

when i write point. code completition works fine (of course it knows the type without doubt!)

i want code completition also in overriding mouseMoveEvent.. what else can i do besides change language and shift in c++ or java?

SOLUTION : as gary pointed me in this thread this trick works:

def mouseMoveEvent(self, event):
    assert(isinstance(event, QtGui.QMouseEvent))

    mouse = event.

I'm certain that this is not a problem Python, but rather with how your PyDev is set up.

There are plenty of Python IDE's available that have no problem handling the sort of code-completion you mention - such as eric , for instance.

So if you can't get PyDev to do the right thing, the answer is not to switch languages, but to switch IDE's.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM