[PyQt] QGrahicsView and event issue
dboddie at trolltech.com
dboddie at trolltech.com
Fri Nov 14 15:37:06 GMT 2008
On Friday 14 November 2008, Oguz Yarimtepe wrote:
> Here is the class that i am trying to activate my up and down arrows for
> scrolling: http://rafb.net/p/b0d8J673.html
>
> When i remove the Key_Up and Key_Down parts, at my QGraphicsView,
> pressing them doesn't make scrolling. I tried to write event.ignore()
> after the if event.key() == QtCore.Qt.Key_Down: for ex but it didn't
> help. What am i missing?
OK, I forgot to mention that you need to call the base class's keyPressEvent()
method to handle any key presses that you aren't interested in.
Try adding an "else" clause to your keyPressEvent() implementation:
else:
QGraphicsView.keyPressEvent(self, event)
If you want the up and down arrow keys to do in-page scrolling, you'll need
to call this method instead of checking for those keys and doing something
different. Perhaps you mean to use the Qt.PageUp and Qt.PageDown keys for
navigation between pages?
David
More information about the PyQt
mailing list