Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I catch Shift + Ctrl key?



  • Hi. I want to catch Shift + Ctrl key in QTabWidget
    @ case Qt::Key_Tab:
    {
    if(modifier & Qt::ControlModifier)
    {
    if(modifier & Qt::ShiftModifier)
    {
    switchToPreviousTab();
    return;
    }
    else
    {
    switchToNextTab();
    return;
    }
    }
    }
    @
    Why this code doesn't work? Ctrl + Shift + Tab is working without my code, but I need to change behaviour. How can I fix that problem?



  • Have you stepped through this and checked the value of 'modifier'; is it possible your switch tab functions are the culprits?

    The docs also mention: "Warning: This function cannot always be trusted. The user can confuse it by pressing both Shift keys simultaneously and releasing one of them, for example."

    update: Also, be sure you accept or ignore the event whether or not you handled it.



  • I think there is lucking code or may be there is something wrong with the system.


Log in to reply