PDA

View Full Version : MacOS Key_F9 becomes Key_8



JoZCaVaLLo
29th March 2012, 16:17
Hi people!!!

I have a strange behaviour on MacOS X... On my QAction I have set the following


QAction my1Action = new QAction(this);
my1Action->setShortcut(Qt::Key_F9);
my1Action->setText(tr("My 1st action"));
connect(...)

QAction my2Action = new QAction(this);
my2Action->setShortcut(QSequence(Qt::SHIFT + Qt::Key_F9));
my2Action->setText(tr("My 2nd action"));
connect(...)

Now... why in my menu do I see the following???
(in the menu, F9 is replaced by a 8)...
7542

This happens only on Mac, on windows it works pretty well.

Thanks for any hint...

Spitfire
30th March 2012, 12:08
That's odd...
Does it happen for all keys or only F9?

JoZCaVaLLo
30th March 2012, 13:59
Hi Spitfire.

Thank you for taking the time to answer me :D
Only with F9... I saw on Mac documentation that Function keys from F9 to F12 are used by OSX to handle Dashbord and windows behaviour... I'm quite sure it is related...
Anyway, I could not find out why it uses the 8...

Lykurg
30th March 2012, 14:16
Hi,


#include <QtGui>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

QMainWindow w;

QAction* my1Action = new QAction(&w);
my1Action->setShortcut(Qt::Key_F9);
my1Action->setText("My 1st action");

QAction* my2Action = new QAction(&w);
my2Action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F9));
my2Action->setText("My 2nd action");

QMenu m;
m.addAction(my1Action);
m.addAction(my2Action);
m.setTitle("test");
w.menuBar()->addMenu(&m);

w.show();

return a.exec();
}
works just fine on my MacOSX 10.6.8 (MacBook Pro).

JoZCaVaLLo
30th March 2012, 14:54
Ok... that means it's a misconfiguration on my mac...

Thank you very much!

Added after 9 minutes:

I put up a Brand new Mac OS 10.7.3 machine... Installed Xcode and QT and...
there it is... F9 is replaced with an 8...
I'll investigate further, but I think this problem starts with the 10.7.3 update released in march 2012...