Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QKeyEvent::isAutoRepeat() not working when cross-compiled (win32)
Qt 6.11 is out! See what's new in the release blog

QKeyEvent::isAutoRepeat() not working when cross-compiled (win32)

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iforce2d
    wrote on last edited by
    #1

    I am using the QKeyEvent::isAutoRepeat() function, and it works nicely when compiled on Windows using the minGW that was installed with the Qt SDK. The executable asks for these dlls:
    mingwm10.dll
    libgcc_s_dw2-1.dll

    However, my build system needs to cross-compile this on Linux, for which I'm using the mingw32 installed by "yum install mingw32*". This executable asks for different dlls:
    libstdc++-6.dll
    libgcc_s_sjlj-1.dll

    All other Qt dlls are the same, so this problem seems to be not with Qt itself, but with the mingw32 cross-compiler. I know it's a long shot, but I thought I would try these forums and see if anyone has a suggestion.

    The problem is that with the cross-compiled mingw32 version, QKeyEvent::isAutoRepeat() simply does not work (it always returns false).

    Additionally, I have an action in my main menu with a shortcut key registered, and while that action is disabled I should get keyPressEvents for that key to my widget (at least this is what happens on Linux, Mac, and with the natively compiled Win32 build). However, with the cross-compiled build the keyPressEvents never arrive, as if the menu action was still enabled.

    If anyone has something to suggest I would be glad to hear it, thanks!

    1 Reply Last reply
    0
    • I Offline
      I Offline
      iforce2d
      wrote on last edited by
      #2

      Well I spent an entire day tracking this down...

      It seems that the mingw32 cross-compiler on Fedora Linux does not deal with bitfields correctly. The problem is caused by the autorepeat member of the QKeyEvent class being declared as:

      uint autor:1;

      I have absolutely no idea why this is necessary - anyone?!? Both of the problems I mention above go away if this member is changed to:

      bool autor;

      Given that this problem was not manifesting on Linux, Mac, or the native minGW compiler, I would conclude that the cross-compiler version of mingw is at fault. For some reason, even with the same compiler and source code, sizeof(QKeyEvent) according to the DLL is 28 bytes, while my program says it's 32 bytes.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved