Search code examples
qtwebviewwebkitqt5qtwebkit

QtWebkit, Can't use '@' key


My Qt program (using qt v5.0.2) contains a QWebView in which the user is supposed to login using their email address and a password. Everything works fine on Windows (tried on w7 and server 2008) but on Mac (10.7.5) I have encountered an annoying issue. When pressing alt-2 (key combination for @) nothing happens.

I have spent countless hours testing and trying to find any info on the net about it, but I really can't find anything about it.

Is there any workaround? Fix? Or is this even a known issue?

Edit: As noted in comments below, my keyboard is European/Swedish.


Solution

  • It's a genuine Qt Bug. I reported it as https://bugreports.qt-project.org/browse/QTBUG-34981

    Today we found the code responsible for it in

    ./qtwebkit/Source/WebKit/qt/WebCoreSupport/EditorClientQt.cpp
    

    Around line 480 it says

    #ifndef Q_WS_MAC
        // We need to exclude checking for Alt because it is just a different Shift                                                            
         if (!kevent->altKey())
    #endif
         shouldInsertText = true;
    

    Apparently, Q_WS_MAC isn't defined on Mac Builds at this time - I think it's been deprecated in favor of Q_OS_MAC.S

    Simply changing the statement to

    shouldInsertText = true;
    

    when compiling on Mac fixed the problem for us.