[Qt-interest] qmenu and keyboard focus

Petr Vanek petr at scribus.info
Tue Nov 9 21:20:25 CET 2010


hi all,

I have a QMenu handled in QSystemTrayIcon as its contextMenu.
But I want to use this menu as a common popup menu too. I set a global shortcut (action) and connected it to a MyTrayIcon's slot.

There I call:

        clipboardIconMenu->popup(QCursor::pos());

but menu which opens does not have a keyboard focus (cannot be navigated by cursor keys). When is the same menu raised by systray context mouse click all is fine.

I tried to set
         clipboardIconMenu->setFocusPolicy(Qt::StrongFocus);
        clipboardIconMenu->setFocus(Qt::OtherFocusReason);

with no luck.

Am I overlooking something?

thanks,
petr





More information about the Qt-interest-old mailing list