[SOLVED] Qt5 QMenuBar in QMainWindow does not respond properly to touch on Windows 8



  • I just moved my application from Qt 4.4 to Qt 5.0. On a touch tablet (Samsung Series 7) running Windows 8, using Qt 4.4, I am able to operate the menubar (QMenuBar) in my main window (QMainWindow) via touch without any issues.

    However, after moving to Qt 5.0, using touch to operate the menu is a very frustrating experience. Sub-menus do not stay open unless doing a long-press. Sometimes the sub-menus simply close after pressing a menu item without firing the expected actions. Sometimes the menu item actions fire. A search of the forum doesn't appear to show anyone else with similar issues.

    Is there a property or method I should set/call to make the menu work with touch (as it does with Qt 4.4)?



  • Found a way to fix touch support in Qt menus on Win8:

    @
    ::UnregisterTouchWindow((HWND)menuBar()->winId());
    ...
    // repeat for each menu added to the menubar
    ::UnregisterTouchWindow((HWND)fileMenu->winId());
    @

    By disabling touch, the menu works with touch on Windows 8 (?!?).

    I suppose that unregistering the menu means that I'm circumventing the Qt touch support that was added after 4.4.


Log in to reply
 

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