<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-06-16 10:55 GMT+02:00 Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>In QVTKRenderWindowInteractor, keyPressEvent and keyReleaseEvent are implemented as follows:<br><br> def keyPressEvent(self, ev):<br> ctrl, shift = self._GetCtrlShift(ev)<br> if ev.key() < 256:<br> key = str(ev.text())<br> else:<br> key = chr(0)<br><br> keySym = _qt_key_to_key_sym(ev.key())<br> if shift and len(keySym) == 1 and keySym.isalpha():<br> keySym = keySym.upper()<br><br> self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY,<br> ctrl, shift, key, 0, keySym)<br> self._Iren.KeyPressEvent()<br> self._Iren.CharEvent()<br></div></div></div></div></div></div></blockquote><div><br></div><div>Also, why deliver both a KeyPressEvent and CharEvent here? Is that a clue to why str(ev.text()) is used perhaps?<br><br></div><div>Elvis<br></div><div><br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><br> def keyReleaseEvent(self, ev):<br> ctrl, shift = self._GetCtrlShift(ev)<br> if ev.key() < 256:<br> key = chr(ev.key())<br> else:<br> key = chr(0)<br><br> self._Iren.SetEventInformationFlipY(self.__saveX, self.__saveY,<br> ctrl, shift, key, 0, None)<br> self._Iren.KeyReleaseEvent()<br><br></div>Notice how in keyPressEvent, key (the keycode passed to SetEventInformationFlipY) is constructed from str(ev.text()), which I find strange. Why use the .text() of the Qt event and not the keycode (.key())? SetEventInformationFlipY seems to expect a char a keycode.<br><br></div>In keyReleaseEvent it is constructed from chr(ev.key()), which I think looks right.<br><br></div>Is there some subtility I'm missing here, or is this just a mistake?<br><br></div>Thanks in advance,<br></div>Elvis<br></div>
</blockquote></div><br></div></div>