Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use context menu with QSystemTrayIcon under Windows Mobile/CE?

I created tray icon with context menu and attached its activated signal to slot in my dialog:

trayIconMenu = new QMenu(this);
trayIconMenu->addAction(showAction);
trayIconMenu->addAction(quitAction);

trayIcon = new QSystemTrayIcon(this);
trayIcon->setContextMenu(trayIconMenu);
trayIcon->setIcon(QIcon(":/images/gear.png"));
trayIcon->show();
trayIcon->showMessage(tr("SSTRNL-B"),tr("Message from tray icon!"));

QObject::connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                 this,   SLOT(trayactivated(QSystemTrayIcon::ActivationReason)));

My slot is called when I click on tray icon. So everything is going right except I can not see context menu attached to QSystemTrayIcon.

In desktop systems we can use right-click on tray icon to see its context menu. But what am I supposed to do in Windows mobile/CE to see context menu?

like image 557
igor.sol Avatar asked Dec 04 '25 16:12

igor.sol


1 Answers

Check whether QSystemTrayIcon::ActivationReason==QSystemTrayIcon::Context in your SLOT. May be as you are using mobile App, click pattern for contextmenu might be different from General OS.

Ok if it is QSystemTrayIcon::Trigger, call trayIcon->contextMenu()->popup(QPoint&) in your SLOT, where QPoint is location of trayIcon.That would do.

like image 88
ScarCode Avatar answered Dec 06 '25 07:12

ScarCode