[osg-users] osgQt Coverity Scan reported issue, Qt experts please chip in.
Jan Ciger
jan.ciger at gmail.com
Fri Jun 24 12:46:52 PDT 2016
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
On 24/06/16 20:32, Robert Osfield wrote:
> If you have a github account you should be able to login in with
> this account. Alternatively you can create your own account for
> Coverity.
I have logged in with my Github account, but unless someone adds me to
the OpenSceneGraph project, I don't have access to the reports.
>
> Attach is a screen snaptshot of the source browser. The source I
> also included in my previous post.
>
> I've looked at the relevant code, copy and pasted below for
> reference. The issue looks to be related to mixing an int key value
> with the enum's defined in osgGA::GUIEventAdapter. I presume the
> key value is coming in from a Qt event, though I'm not 100% clear
> on this as I'm not the author of this code, no have Qt expertise.
Yes, the problem is that the key is being passed into the function as
an instead of enum. It is coming from QEvent (line 136 of the same
file). The code is taking the Qt events and passing them to the OSG
event handling system using custom Qt events (a kludge necessary to
work around some Qt issues).
To fix the problem the comparison should be done using the Qt key
codes instead:
Change:
osgGA::GUIEventAdapter::KEY_Shift_L to Qt::Key_Shift
osgGA::GUIEventAdapter::KEY_Shift_R to Qt::Key_Shift as well
osgGA::GUIEventAdapter::KEY_Control_L to Qt::Key_Control
osgGA::GUIEventAdapter::KEY_Control_R to Qt::Key_Control
osgGA::GUIEventAdapter::KEY_Alt_L to Qt::Key_Alt
osgGA::GUIEventAdapter::KEY_Alt_R to Qt::Key_AltGr
osgGA::GUIEventAdapter::KEY_Meta_L to Qt::Key_Meta
osgGA::GUIEventAdapter::KEY_Meta_R to Qt::Key_Meta
I don't think Qt makes distinction between left/right shift, control
and meta (windows) keys unless you use the native scan code, which is
platform-specific.
You can find the full list here:
http://doc.qt.io/qt-5/qt.html#Key-enum
Best regards,
Jan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iD8DBQFXbY4sn11XseNj94gRAsTqAJ9mZ7BWmhrfNKNPSbjlw97UPMVb8QCfVuzK
3exJN3eTbdmqx1pwgwPHeYw=
=Hs+F
-----END PGP SIGNATURE-----
More information about the osg-users
mailing list