Issue: Mac OS + International Keyboards



  • Seem to be having an issue with International Keyboards on MacOS and I apologize if there is a more specific forum but as you can see by my post count I am new here (I did do a search and could not find anything related to my issue).

    Specifically, we are attempting to process a QKeyEvent with code that looks something like:

    somefuntion(QKeyEvent* event) {
    int ourKeyCode = mapQTToUs(event->key());
    }

    Where the function mapQTToUs() is just a big switch statement that uses the enum Qt:Key to map QT codes to ours. On Windows (with any keyboard) or with standard keyboards on MacOS everything works fine. However, with some international keyboards (such as PC-German) on MacOS the Qt:Key that we seem to be passed by the QKeyEvent is often Qt::Key_unknown?

    This would seem to indicate to me that Qt does not support that keyboard on MacOS? Is this true? Or is this a configuration issue on our part? I realize this is a very specific question and I have provided little detail but I am hoping this is a common issue that someone might recognize before I go into a ton of detail?


  • Lifetime Qt Champion

    Hi,

    Is it a hardware related problem ? Or any keyboard that you set to German triggers that ?



  • Good question, it is not hardware related but after more investigation it is specific to the keyboard layout. Apparently the user in question has a user defined layout (ie not from Apple) to make braces { [] } work.

    I should have also mentioned, it is not all keys. For the most part, the keyboard works fine. It is certain combinations (like Alt-L for example) that cause the issue.


  • Lifetime Qt Champion

    Can you have more details about how he did that custom layout ? And what keys exactly are misbehaving ?



  • The layout was created using Ukelele version 2.2.8 (Unicode Keyboard Layout Editor). He has said there are several keys that do not work but specifically he says "Alt + l" produces Qt::Key_unknown.

    His pc.keylayout config file (which is found in ~/Library/Keyboard Layouts/) looks like....

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE keyboard PUBLIC "" "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
    <!--Created by Ukelele version 2.2.8 on 2015-05-04 at 11:02 (CEST)-->
    <!--Last edited by Ukelele version 2.2.8 on 2015-05-04 at 11:04 (CEST)-->
    <keyboard group="0" id="4919" name="PC-Tastatur, Deutsch" maxout="1">
        <layouts>
            <layout first="0" last="17" modifiers="12c" mapSet="1a4"/>
            <layout first="18" last="18" modifiers="12c" mapSet="6b8"/>
            <layout first="21" last="23" modifiers="12c" mapSet="6b8"/>
            <layout first="30" last="30" modifiers="12c" mapSet="6b8"/>
            <layout first="33" last="33" modifiers="12c" mapSet="6b8"/>
            <layout first="36" last="36" modifiers="12c" mapSet="6b8"/>
            <layout first="194" last="194" modifiers="12c" mapSet="6b8"/>
            <layout first="197" last="197" modifiers="12c" mapSet="6b8"/>
            <layout first="200" last="201" modifiers="12c" mapSet="6b8"/>
            <layout first="206" last="207" modifiers="12c" mapSet="6b8"/>
        </layouts>
        <modifierMap id="12c" defaultIndex="0">
            <keyMapSelect mapIndex="0">
                <modifier keys="command? control?"/>
                <modifier keys="anyShift caps? option? command? control"/>
                <modifier keys="caps anyOption command? control?"/>
                <modifier keys="shift? caps? anyOption command? control"/>
                <modifier keys="anyShift? anyOption? command"/>
                <modifier keys="anyShift caps rightOption? command"/>
                <modifier keys="rightShift? caps anyOption command"/>
                <modifier keys="anyShift caps option? command control?"/>
                <modifier keys="shift? caps anyOption command control?"/>
                <modifier keys="caps? anyOption? command? control"/>
                <modifier keys="caps? anyOption? command control?"/>
            </keyMapSelect>
            <keyMapSelect mapIndex="1">
                <modifier keys="anyShift caps?"/>
            </keyMapSelect>
            <keyMapSelect mapIndex="2">
                <modifier keys="anyOption"/>
            </keyMapSelect>
            <keyMapSelect mapIndex="3">
                <modifier keys="caps"/>
            </keyMapSelect>
            <keyMapSelect mapIndex="4">
                <modifier keys="anyShift caps? anyOption"/>
            </keyMapSelect>
        </modifierMap>
        <keyMapSet id="1a4">
            <keyMap index="0">
                <key code="0" output="a"/>
                <key code="1" output="s"/>
                <key code="2" output="d"/>
                <key code="3" output="f"/>
                <key code="4" output="h"/>
                <key code="5" output="g"/>
                <key code="6" output="y"/>
                <key code="7" output="x"/>
                <key code="8" output="c"/>
                <key code="9" output="v"/>
                <key code="10" output="^"/>
                <key code="11" output="b"/>
                <key code="12" output="q"/>
                <key code="13" output="w"/>
                <key code="14" output="e"/>
                <key code="15" output="r"/>
                <key code="16" output="z"/>
                <key code="17" output="t"/>
                <key code="18" output="1"/>
                <key code="19" output="2"/>
                <key code="20" output="3"/>
                <key code="21" output="4"/>
                <key code="22" output="6"/>
                <key code="23" output="5"/>
                <key code="24" output="´"/>
                <key code="25" output="9"/>
                <key code="26" output="7"/>
                <key code="27" output="ß"/>
                <key code="28" output="8"/>
                <key code="29" output="0"/>
                <key code="30" output="+"/>
                <key code="31" output="o"/>
                <key code="32" output="u"/>
                <key code="33" output="ü"/>
                <key code="34" output="i"/>
                <key code="35" output="p"/>
                <key code="36" output="&#x000D;"/>
                <key code="37" output="l"/>
                <key code="38" output="j"/>
                <key code="39" output="ä"/>
                <key code="40" output="k"/>
                <key code="41" output="ö"/>
                <key code="42" output="#"/>
                <key code="43" output=","/>
                <key code="44" output="-"/>
                <key code="45" output="n"/>
                <key code="46" output="m"/>
                <key code="47" output="."/>
                <key code="48" output="&#x0009;"/>
                <key code="49" output=" "/>
                <key code="50" output="&#x003C;"/>
                <key code="51" output="&#x0008;"/>
                <key code="52" output="&#x0003;"/>
                <key code="53" output="&#x001B;"/>
                <key code="64" output="&#x0010;"/>
                <key code="65" output=","/>
                <key code="66" output="&#x001D;"/>
                <key code="67" output="*"/>
                <key code="69" output="+"/>
                <key code="70" output="&#x001C;"/>
                <key code="71" output="&#x001B;"/>
                <key code="72" output="&#x001F;"/>
                <key code="75" output="/"/>
                <key code="76" output="&#x0003;"/>
                <key code="77" output="&#x001E;"/>
                <key code="78" output="-"/>
                <key code="79" output="&#x0010;"/>
                <key code="80" output="&#x0010;"/>
                <key code="82" output="0"/>
                <key code="83" output="1"/>
                <key code="84" output="2"/>
                <key code="85" output="3"/>
                <key code="86" output="4"/>
                <key code="87" output="5"/>
                <key code="88" output="6"/>
                <key code="89" output="7"/>
                <key code="91" output="8"/>
                <key code="92" output="9"/>
                <key code="96" output="&#x0010;"/>
                <key code="97" output="&#x0010;"/>
                <key code="98" output="&#x0010;"/>
                <key code="99" output="&#x0010;"/>
                <key code="100" output="&#x0010;"/>
                <key code="101" output="&#x0010;"/>
                <key code="103" output="&#x0010;"/>
                <key code="105" output="&#x0010;"/>
                <key code="106" output="&#x0010;"/>
                <key code="107" output="&#x0010;"/>
                <key code="109" output="&#x0010;"/>
                <key code="111" output="&#x0010;"/>
                <key code="113" output="&#x0010;"/>
                <key code="114" output="&#x0005;"/>
                <key code="115" output="&#x0001;"/>
                <key code="116" output="&#x000B;"/>
                <key code="117" output="&#x007F;"/>
                <key code="118" output="&#x0010;"/>
                <key code="119" output="&#x0004;"/>
                <key code="120" output="&#x0010;"/>
                <key code="121" output="&#x000C;"/>
                <key code="122" output="&#x0010;"/>
                <key code="123" output="&#x001C;"/>
                <key code="124" output="&#x001D;"/>
                <key code="125" output="&#x001F;"/>
                <key code="126" output="&#x001E;"/>
            </keyMap>
            <keyMap index="1">
                <key code="0" output="A"/>
                <key code="1" output="S"/>
                <key code="2" output="D"/>
                <key code="3" output="F"/>
                <key code="4" output="H"/>
                <key code="5" output="G"/>
                <key code="6" output="Y"/>
                <key code="7" output="X"/>
                <key code="8" output="C"/>
                <key code="9" output="V"/>
                <key code="10" output="°"/>
                <key code="11" output="B"/>
                <key code="12" output="Q"/>
                <key code="13" output="W"/>
                <key code="14" output="E"/>
                <key code="15" output="R"/>
                <key code="16" output="Z"/>
                <key code="17" output="T"/>
                <key code="18" output="!"/>
                <key code="19" output="&#x0022;"/>
                <key code="20" output="§"/>
                <key code="21" output="$"/>
                <key code="22" output="&#x0026;"/>
                <key code="23" output="%"/>
                <key code="24" output="`"/>
                <key code="25" output=")"/>
                <key code="26" output="/"/>
                <key code="27" output="?"/>
                <key code="28" output="("/>
                <key code="29" output="="/>
                <key code="30" output="*"/>
                <key code="31" output="O"/>
                <key code="32" output="U"/>
                <key code="33" output="Ü"/>
                <key code="34" output="I"/>
                <key code="35" output="P"/>
                <key code="36" output="&#x000D;"/>
                <key code="37" output="L"/>
                <key code="38" output="J"/>
                <key code="39" output="Ä"/>
                <key code="40" output="K"/>
                <key code="41" output="Ö"/>
                <key code="42" output="&#x0027;"/>
                <key code="43" output=";"/>
                <key code="44" output="_"/>
                <key code="45" output="N"/>
                <key code="46" output="M"/>
                <key code="47" output=":"/>
                <key code="48" output="&#x0009;"/>
                <key code="49" output=" "/>
                <key code="50" output="&#x003E;"/>
                <key code="51" output="&#x0008;"/>
                <key code="52" output="&#x0003;"/>
                <key code="53" output="&#x001B;"/>
                <key code="64" output="&#x0010;"/>
                <key code="66" output="&#x001D;"/>
                <key code="70" output="&#x001C;"/>
                <key code="71" output="&#x001B;"/>
                <key code="72" output="&#x001F;"/>
                <key code="76" output="&#x0003;"/>
                <key code="77" output="&#x001E;"/>
                <key code="79" output="&#x0010;"/>
                <key code="80" output="&#x0010;"/>
                <key code="96" output="&#x0010;"/>
                <key code="97" output="&#x0010;"/>
                <key code="98" output="&#x0010;"/>
                <key code="99" output="&#x0010;"/>
                <key code="100" output="&#x0010;"/>
                <key code="101" output="&#x0010;"/>
                <key code="103" output="&#x0010;"/>
                <key code="105" output="&#x0010;"/>
                <key code="106" output="&#x0010;"/>
                <key code="107" output="&#x0010;"/>
                <key code="109" output="&#x0010;"/>
                <key code="111" output="&#x0010;"/>
                <key code="113" output="&#x0010;"/>
                <key code="114" output="&#x0005;"/>
                <key code="115" output="&#x0001;"/>
                <key code="116" output="&#x000B;"/>
                <key code="117" output="&#x007F;"/>
                <key code="118" output="&#x0010;"/>
                <key code="119" output="&#x0004;"/>
                <key code="120" output="&#x0010;"/>
                <key code="121" output="&#x000C;"/>
                <key code="122" output="&#x0010;"/>
                <key code="123" output="&#x001C;"/>
                <key code="124" output="&#x001D;"/>
                <key code="125" output="&#x001F;"/>
                <key code="126" output="&#x001E;"/>
            </keyMap>
            <keyMap index="2">
                <key code="0" output=""/>
                <key code="8" output="©"/>
                <key code="10" output="|"/>
                <key code="12" output="@"/>
                <key code="14" output="€"/>
                <key code="15" output="®"/>
                <key code="19" output="²"/>
                <key code="20" output="³"/>
                <key code="25" output="]"/>
                <key code="26" output="{"/>
                <key code="27" output="\"/>
                <key code="28" output="["/>
                <key code="29" output="}"/>
                <key code="30" output="~"/>
                <key code="36" output="&#x000D;"/>
                <key code="48" output="&#x0009;"/>
                <key code="50" output="|"/>
                <key code="51" output="&#x0008;"/>
                <key code="52" output="&#x0003;"/>
                <key code="53" output="&#x001B;"/>
                <key code="64" output="&#x0010;"/>
                <key code="66" output="&#x001D;"/>
                <key code="70" output="&#x001C;"/>
                <key code="71" output="&#x001B;"/>
                <key code="72" output="&#x001F;"/>
                <key code="76" output="&#x0003;"/>
                <key code="77" output="&#x001E;"/>
                <key code="79" output="&#x0010;"/>
                <key code="80" output="&#x0010;"/>
                <key code="96" output="&#x0010;"/>
                <key code="97" output="&#x0010;"/>
                <key code="98" output="&#x0010;"/>
                <key code="99" output="&#x0010;"/>
                <key code="100" output="&#x0010;"/>
                <key code="101" output="&#x0010;"/>
                <key code="103" output="&#x0010;"/>
                <key code="105" output="&#x0010;"/>
                <key code="106" output="&#x0010;"/>
                <key code="107" output="&#x0010;"/>
                <key code="109" output="&#x0010;"/>
                <key code="111" output="&#x0010;"/>
                <key code="113" output="&#x0010;"/>
                <key code="114" output="&#x0005;"/>
                <key code="115" output="&#x0001;"/>
                <key code="116" output="&#x000B;"/>
                <key code="117" output="&#x007F;"/>
                <key code="118" output="&#x0010;"/>
                <key code="119" output="&#x0004;"/>
                <key code="120" output="&#x0010;"/>
                <key code="121" output="&#x000C;"/>
                <key code="122" output="&#x0010;"/>
                <key code="123" output="&#x001C;"/>
                <key code="124" output="&#x001D;"/>
                <key code="125" output="&#x001F;"/>
                <key code="126" output="&#x001E;"/>
            </keyMap>
            <keyMap index="3">
                <key code="0" output="A"/>
                <key code="1" output="S"/>
                <key code="2" output="D"/>
                <key code="3" output="F"/>
                <key code="4" output="H"/>
                <key code="5" output="G"/>
                <key code="6" output="Y"/>
                <key code="7" output="X"/>
                <key code="8" output="C"/>
                <key code="9" output="V"/>
                <key code="10" output="&#x003E;"/>
                <key code="11" output="B"/>
                <key code="12" output="Q"/>
                <key code="13" output="W"/>
                <key code="14" output="E"/>
                <key code="15" output="R"/>
                <key code="16" output="Z"/>
                <key code="17" output="T"/>
                <key code="18" output="1"/>
                <key code="19" output="2"/>
                <key code="20" output="3"/>
                <key code="21" output="4"/>
                <key code="22" output="6"/>
                <key code="23" output="5"/>
                <key code="24" output="´"/>
                <key code="25" output="9"/>
                <key code="26" output="7"/>
                <key code="27" output="ß"/>
                <key code="28" output="8"/>
                <key code="29" output="0"/>
                <key code="30" output="+"/>
                <key code="31" output="O"/>
                <key code="32" output="U"/>
                <key code="33" output="Ü"/>
                <key code="34" output="I"/>
                <key code="35" output="P"/>
                <key code="36" output="&#x000D;"/>
                <key code="37" output="L"/>
                <key code="38" output="J"/>
                <key code="39" output="Ä"/>
                <key code="40" output="K"/>
                <key code="41" output="Ö"/>
                <key code="42" output="#"/>
                <key code="43" output=","/>
                <key code="44" output="-"/>
                <key code="45" output="N"/>
                <key code="46" output="M"/>
                <key code="47" output="."/>
                <key code="48" output="&#x0009;"/>
                <key code="49" output=" "/>
                <key code="50" output="^"/>
                <key code="51" output="&#x0008;"/>
                <key code="52" output="&#x0003;"/>
                <key code="53" output="&#x001B;"/>
                <key code="64" output="&#x0010;"/>
                <key code="66" output="&#x001D;"/>
                <key code="70" output="&#x001C;"/>
                <key code="71" output="&#x001B;"/>
                <key code="72" output="&#x001F;"/>
                <key code="76" output="&#x0003;"/>
                <key code="77" output="&#x001E;"/>
                <key code="79" output="&#x0010;"/>
                <key code="80" output="&#x0010;"/>
                <key code="96" output="&#x0010;"/>
                <key code="97" output="&#x0010;"/>
                <key code="98" output="&#x0010;"/>
                <key code="99" output="&#x0010;"/>
                <key code="100" output="&#x0010;"/>
                <key code="101" output="&#x0010;"/>
                <key code="103" output="&#x0010;"/>
                <key code="105" output="&#x0010;"/>
                <key code="106" output="&#x0010;"/>
                <key code="107" output="&#x0010;"/>
                <key code="109" output="&#x0010;"/>
                <key code="111" output="&#x0010;"/>
                <key code="113" output="&#x0010;"/>
                <key code="114" output="&#x0005;"/>
                <key code="115" output="&#x0001;"/>
                <key code="116" output="&#x000B;"/>
                <key code="117" output="&#x007F;"/>
                <key code="118" output="&#x0010;"/>
                <key code="119" output="&#x0004;"/>
                <key code="120" output="&#x0010;"/>
                <key code="121" output="&#x000C;"/>
                <key code="122" output="&#x0010;"/>
                <key code="123" output="&#x001C;"/>
                <key code="124" output="&#x001D;"/>
                <key code="125" output="&#x001F;"/>
                <key code="126" output="&#x001E;"/>
            </keyMap>
            <keyMap index="4">
                <key code="0" output=""/>
                <key code="36" output="&#x000D;"/>
                <key code="48" output="&#x0009;"/>
                <key code="51" output="&#x0008;"/>
                <key code="52" output="&#x0003;"/>
                <key code="53" output="&#x001B;"/>
                <key code="64" output="&#x0010;"/>
                <key code="66" output="&#x001D;"/>
                <key code="70" output="&#x001C;"/>
                <key code="71" output="&#x001B;"/>
                <key code="72" output="&#x001F;"/>
                <key code="76" output="&#x0003;"/>
                <key code="77" output="&#x001E;"/>
                <key code="79" output="&#x0010;"/>
                <key code="80" output="&#x0010;"/>
                <key code="96" output="&#x0010;"/>
                <key code="97" output="&#x0010;"/>
                <key code="98" output="&#x0010;"/>
                <key code="99" output="&#x0010;"/>
                <key code="100" output="&#x0010;"/>
                <key code="101" output="&#x0010;"/>
                <key code="103" output="&#x0010;"/>
                <key code="105" output="&#x0010;"/>
                <key code="106" output="&#x0010;"/>
                <key code="107" output="&#x0010;"/>
                <key code="109" output="&#x0010;"/>
                <key code="111" output="&#x0010;"/>
                <key code="113" output="&#x0010;"/>
                <key code="114" output="&#x0005;"/>
                <key code="115" output="&#x0001;"/>
                <key code="116" output="&#x000B;"/>
                <key code="117" output="&#x007F;"/>
                <key code="118" output="&#x0010;"/>
                <key code="119" output="&#x0004;"/>
                <key code="120" output="&#x0010;"/>
                <key code="121" output="&#x000C;"/>
                <key code="122" output="&#x0010;"/>
                <key code="123" output="&#x001C;"/>
                <key code="124" output="&#x001D;"/>
                <key code="125" output="&#x001F;"/>
                <key code="126" output="&#x001E;"/>
            </keyMap>
        </keyMapSet>
        <keyMapSet id="6b8">
            <keyMap index="0" baseMapSet="1a4" baseIndex="0">
                <key code="512" output=""/>
            </keyMap>
            <keyMap index="1" baseMapSet="1a4" baseIndex="1">
                <key code="512" output=""/>
            </keyMap>
            <keyMap index="2" baseMapSet="1a4" baseIndex="2">
                <key code="512" output=""/>
            </keyMap>
            <keyMap index="3" baseMapSet="1a4" baseIndex="3">
                <key code="512" output=""/>
            </keyMap>
            <keyMap index="4" baseMapSet="1a4" baseIndex="4">
                <key code="512" output=""/>
            </keyMap>
        </keyMapSet>
    </keyboard>
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.