<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2016-06-16 16:32 GMT+02:00 David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.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 class="gmail_extra"><div class="gmail_quote"><span class="">On Thu, Jun 16, 2016 at 7:33 AM, Elvis Stansvik <span dir="ltr"><<a href="mailto:elvis.stansvik@orexplore.com" target="_blank">elvis.stansvik@orexplore.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>So that fix was indeed correct, and from the Qt docs for key():<br><br>"Note that this function does not distinguish between capital and non-capital letters, use the <a href="http://doc.qt.io/qt-5/qkeyevent.html#text" target="_blank">text</a>() function (returning the Unicode text the key generated) for this purpose."<br><br></div><div>So I guess keyReleaseEvent should be changed to also use str(ev.text()). But thinking more about how Qt's key() is used in QVTKRenderWindowInteractor, for example:<br><br>if ev.key() < 256:<br> ...<br><br></div><div>Is it not wrong to make assumptions about the .key() as a number like this? I don't think Qt gives any guarantee that the Qt::Key enum values correspond to ASCII values? (even if they currently do). Shouldn't the code first call .text() and then check that it's a single byte string, instead of making assumptions about the layout of the Qt::Key enum?<br></div></div></div></div></blockquote><div><br></div></span><div>Yes, keyReleaseEvent should match keyPressEvent, the original author of the change must have missed that.</div><div><br></div><div>If .text() returns a single character with a unicode code point < 256, it should be fine to use that as the VTK key code. Otherwise the VTK key code should be set to zero. VTK's key code is meant to correspond to the text produced by the key press.</div></div></div></div></blockquote><div><br></div><div>Alright, yes that makes sense.<br><br></div><div>Elvis<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 class="gmail_extra"><div class="gmail_quote"><span class="HOEnZb"><font color="#888888"><div><br></div><div> - David</div><div><br></div><div><br></div></font></span></div></div></div>
</blockquote></div><br></div></div>