Nominate our 2022 Qt Champions!

ShortCut doesn't work on MAC OS X

  • I create an action on the tool bar of main window and give it a shortcut given "Shift+F12", like the following:
    QAction* pAction = new Action("MyAction", pToolBar);

    but the shortcut doesn't work. The same code DOES work on Windows. Do somebody know it?

    In addition, I use short cut in another way like the code below. It also doesn't work.
    QShortcut* pShortcut = new QShortcut(QKeySequence("Shift+F12"), this, 0, 0, Qt::ApplicationShortcut);
    connect(pShortcut, SIGNAL(activated()), SLOT(slt_ShortCut()));

  • are the function keys enabled on your keyboard? on mac you can switch between the function keys and the special tasks (like f12 is making sound louder)

    alternativly you can try QKeySequence(Qt::Shift + Qt::Key_F12)

Log in to reply