[PyQt] QGrahicsView and event issue
dboddie at trolltech.com
dboddie at trolltech.com
Tue Nov 11 16:32:09 GMT 2008
On Tuesday 11 November 2008, Oguz Yarimtepe wrote:
> So here is the latest version of my application but still i am not able
> to detect the keyPressEvents nor the events.
You need to promote the QGraphicsView widget in your form to GraphicsView.
To do this, open the context menu over the widget and select "Promote to ..."
then add a new class to the list of promoted classes.
You can specify either "graphicsview" or "graphicsview.h" for the header
file - pyuic4 will figure out that it needs to refer to a module
called "graphicsview". You will need to move your GraphicsView class
definition into a file called "graphicsview.py" for this to work.
Now your main window should use the correct widget and you should receive key
press events. You don't need the stray GraphicsView() call on line 29 of
main.py.
David
More information about the PyQt
mailing list