[PyQt] QDropEvent.keyboardModifiers() is always Qt.NoModifier. Bug?

Benno Dielmann lists at benno-dielmann.de
Mon Jun 9 19:24:56 BST 2008


Hi all, 

I attached a little program implementing a simple image viewer (~ 170 lines of 
code). It displays any picture file (supported by QImage) dragged and dropped 
from a filemanager on it. Now I'd like to do some special action if the Ctrl 
key is pressed while dropping a file on the window. 

This doesn't work because event.keyboardModifiers() == Qt.ControlModifier is 
always False. Is this a bug or am I doing something wrong?

To see what I mean, please look at line 158 of my attached file (benview.py). 
Run benview.py and Ctrl-Drop any file on the appearing window. On my Kubuntu 
Hardy with Qt 4.4, PyQt 4.3.3, line 158 always prints "False". The same was 
true on Kubuntu Gutsy and Qt 4.3. 

Any hints on this are much appreciated.

Have a nice day, 

Benno. 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: benview.py
Type: application/x-python
Size: 7210 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080609/174f457f/benview.bin


More information about the PyQt mailing list