<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How to get nativeVirtualKey for arrow keys [SOLVED]]]></title><description><![CDATA[<p dir="auto">Hi.<br />
I need to find a method how to get nativeVirtualKey for arrow keys.<br />
I've tried so: QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier).nativeVirtualKey()<br />
but it's not work.</p>
]]></description><link>https://forum.qt.io/topic/57567/how-to-get-nativevirtualkey-for-arrow-keys-solved</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Apr 2026 12:47:55 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/57567.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Aug 2015 16:43:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Sat, 08 Aug 2015 17:33:37 GMT]]></title><description><![CDATA[<p dir="auto">hi<br />
oh, i thought Qt would send same Qt::Key_xx<br />
regardless of the actual keyboard.</p>
<p dir="auto">Good to know it wont.</p>
]]></description><link>https://forum.qt.io/post/285810</link><guid isPermaLink="true">https://forum.qt.io/post/285810</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sat, 08 Aug 2015 17:33:37 GMT</pubDate></item><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Sat, 08 Aug 2015 17:24:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> With keyboardEvent I store pressed keys.I need to react on English and non-English keyboard the same. So I wanted to use nativeVirtualKey to perform the same reaction on same keys (but in different language). But it hadn't worked for arrow keys: Qt::Key_Up has value 16 777 235. So I needed to do something with that.</p>
]]></description><link>https://forum.qt.io/post/285808</link><guid isPermaLink="true">https://forum.qt.io/post/285808</guid><dc:creator><![CDATA[Dani]]></dc:creator><pubDate>Sat, 08 Aug 2015 17:24:48 GMT</pubDate></item><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Sat, 08 Aug 2015 14:58:16 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dani">@<bdi>Dani</bdi></a><br />
Hi<br />
yes sym = symbol key. bad name. its more like native key value.<br />
The reason its not working is that the native/os/nativeVirtualKey is part of the real os event and added to the<br />
QKeyEvent class when a real OS event happens.<br />
So I do not think creating one will contain the info you want.</p>
<p dir="auto">I have never seen such function but Qt is big so there might be something.<br />
You might be able to borrow some from KDE<br />
<a href="http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kkeyserver__win_8cpp_source.html" target="_blank" rel="noopener noreferrer nofollow ugc">http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kkeyserver__win_8cpp_source.html</a></p>
<p dir="auto">Can I ask why you want native values and cant just use Qt::Key_xx ?</p>
]]></description><link>https://forum.qt.io/post/285799</link><guid isPermaLink="true">https://forum.qt.io/post/285799</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Sat, 08 Aug 2015 14:58:16 GMT</pubDate></item><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Sat, 08 Aug 2015 12:44:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> Thank for reply.<br />
I'm sorry. I meant this in last message: QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier).nativeScanCode(); It had not worked too, and now I almost understand why. Explain please, what is sym key? Symbol key?<br />
I don't know am I right, but I think that it hadn't worked because real event calls this constructor with ready nativeVirtualKey and scanCode:<br />
QKeyEvent::QKeyEvent(Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString &amp; text = QString(), bool autorep = false, ushort count = 1)<br />
I thought, this codes are calculating somewhere In constructor, but as i see - they need to be listed when constructor is called.</p>
<p dir="auto">I get good nativeVirtualKey in keyboardEvent and it also equals 37, 38, 39, 40, but I wanted to get constants anywhere else and not to use Windows constants. Is there any possible way?</p>
]]></description><link>https://forum.qt.io/post/285796</link><guid isPermaLink="true">https://forum.qt.io/post/285796</guid><dc:creator><![CDATA[Dani]]></dc:creator><pubDate>Sat, 08 Aug 2015 12:44:01 GMT</pubDate></item><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Fri, 07 Aug 2015 22:54:24 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> said:<br />
No its another function than native virtualkey.</p>
<pre><code>void keyPressEvent ( QKeyEvent* ke )
    {
        int nativeCode = ke-&gt;nativeScanCode();
        qDebug() &lt;&lt; nativeCode;

   }
</code></pre>
<p dir="auto">lists values for  arrow keys. Not sure sure if it is the one you want.</p>
<p dir="auto">For test I also tried nativeVirtualKey and it returns<br />
37,38,39,40 for arrows which seems to be VK_LEFT etc.</p>
<p dir="auto">From this line I assume you try to use it as lookup call ?QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier).nativeVirtualKey();</p>
<p dir="auto">You are not catching a real key even but try into to convert from qt::key_up to sort of like VK_ARROWUP ?</p>
<p dir="auto">I do not think this can work since the real event provides the sym key and here you just construct a fake one so this info is not there.</p>
]]></description><link>https://forum.qt.io/post/285774</link><guid isPermaLink="true">https://forum.qt.io/post/285774</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Fri, 07 Aug 2015 22:54:24 GMT</pubDate></item><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Fri, 07 Aug 2015 18:22:43 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/mrjj">@<bdi>mrjj</bdi></a> You mean this?<br />
QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier).nativeVirtualKey();<br />
This is not works too - this statement returns 0.</p>
]]></description><link>https://forum.qt.io/post/285758</link><guid isPermaLink="true">https://forum.qt.io/post/285758</guid><dc:creator><![CDATA[Dani]]></dc:creator><pubDate>Fri, 07 Aug 2015 18:22:43 GMT</pubDate></item><item><title><![CDATA[Reply to How to get nativeVirtualKey for arrow keys [SOLVED] on Fri, 07 Aug 2015 18:01:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/dani">@<bdi>Dani</bdi></a> said:<br />
hi and welcome</p>
<p dir="auto">Did you test with quint32 QKeyEvent::nativeScanCode() const ?</p>
]]></description><link>https://forum.qt.io/post/285756</link><guid isPermaLink="true">https://forum.qt.io/post/285756</guid><dc:creator><![CDATA[mrjj]]></dc:creator><pubDate>Fri, 07 Aug 2015 18:01:15 GMT</pubDate></item></channel></rss>