Important: Please read the Qt Code of Conduct -

Right click problem in any Qt5 application

  • Hi,

    I encounter the same problem as described in this quite old post: Unable to right click in the Qt Creator

    I discover the problem, after upgrading to virtual box 5.1.18 that use Qt 5.6 framework, and reproduced the same problem on Qtcreator.
    The problem is that right click is not working (i.e. no popup menu when right clicking in QtCreator editor windows).

    After some investigations I noticed that :
    Only Qt5 application have this problem.
    The problem that I reproduced in Qtcreator appears since Qt 5.1.0 framework and still exists in Qt 5.8.0
    Right click is only working as expected if the application (or maybe the window) has not the focus before right click attempt.

    The system on which the problem occurs is Windows 10N Pro version 1607.

    If you have any ideas to solve this problem without reinstalling the whole system, i will be glad to know it.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    IIRC, there was a fix in between. You should check the bug report system.

    In any case, are you experiencing this only on Windows ?

  • Hi,

    there's a lot of right click problem in the bug report system, but I don't find any like the one I experienced. The problem still exists in last official version 5.8.0
    and the problem is that right click is not working at all unless the window you click is not focused.

    Yes I only experienced this problem on my old installed windows 10. I made a test on a fresh windows 10 install and there is no problem.

    I don't know if that could help but I discovered this problem on a linux virtual machine running on my windows.
    To run this virtual machine, I used the latest version of virtualbox that is based on Qt 5.6.2
    In the linux virtual machine, I have made some tests that revealed that mouse right click was received as some keyboard events.

  • @Sasquash

    There is a difference between Qt libraries version 5.8 and Qt creator versions (probably 4.2 at the moment). Qt libraries are updated separately from Qt creator.

    If you are experiencing a bug in Qt creator, you need to check for its version number.

  • @koahnig No, the bug is not in QtCreator, I have the same problem with other Qt5 applications. It is just easy to reproduce the problem with QtCreator as it is included in every Qt installation.

  • Hi, I have made deep investigations to find from where the problem come from and what I discovered is unbelievable.

    Now I can say that the problem is not due to Qt libraries, because I manage to produce an executable that has this "right click" problem but that is not linked dynamically with Qt libraries.

    I just made a small code using only winapi function (CreateWindowEx, RegisterClass, ShowWindow, SetWindowText ), that create a window, register a class to get window message, show the window and display the window message value in its window title.

    If the class name used in RegisterClass call is "Qt5QWindowIcon" then the application has the "right click" problem.

    Qt5 librairies use this class name since version 5.1.0, previous version use "Qt5QWindow".
    This name is build in QWindowsContext::registerWindowClass method in qwindowscontext.cpp.

    I still do not understand why this happens only on my system.

  • Lifetime Qt Champion

    Then it look worth opening a report with your findings. Don't forget to include your test project.

  • Done ! QTBUG-60340

  • Lifetime Qt Champion

    Thanks !

  • Problem is solved, I have installed long time ago, an Android Emulator name Andy (version 41.1010) that use Qt5 librairies. This installation launch an executable named HandyAndy.exe at windows startup. This executable was the cause of the right click problem, it had to catch mouse event using the class name and change it in keyboard event.
    The latest version of this emulator (version 46.16) do not have this problem.

  • Lifetime Qt Champion

    Thanks for sharing your findings !

Log in to reply