[PyQt] PyQt5 system tray icon context menu strange behavior

flll at seznam.cz flll at seznam.cz
Mon Jul 3 12:01:24 BST 2017


Hello,
the example Systray.py mostly works, but not exactly as it should. It is 
also affected by some of the strange things I have met in my app. 
Apparently, there are some bugs/limitations for Unity+Qt... :( Since it is 
probably not PyQt related as you said, I will try to collect them and report
on Qt bug tracker and hope it can and will be fixed. Because right now, 
context menu of system tray icon on Ubuntu (Unity) is behaving so messy, 
that it is only useful to display a few static options and nothing else :(
Just for example, some of the bugs on Ubuntu (Unity):
QSystemTrayIcon.activated signal not emitted
QSystemTrayIcon.contextMenu().aboutToHide signal not emitted (funny thing - 
signal aboutToShow is working properly)
QSystemTrayIcon.contextMenu().isVisible() function returns False even if 
menu is displayed
QSystemTrayIcon.contextMenu().show() slot is creating a duplicit ghost menu 
somewhere on the screen
QSystemTrayIcon.contextMenu().hide() slot is not working
QSystemTrayIcon.contextMenu().QAction().hovered signal not emitted
QSystemTrayIcon.contextMenu().move(x, y) function is not working

Thank you for your suggestions anyway!

----------------------------------------"On Fri, Jun 30, 2017 at 03:33:06PM 
+0200, flll at seznam.cz wrote: 
> Ubuntu 16.04 - Unity 
> Qt v5.8.0 
> PyQt v5.8.2 
> However, I also tested "incorrect isHidden()" and "not working move()" in 

> Kubuntu with KDE, Qt 5.8 and it did not work neither. I will gladly 
provide 
> any other info if needed. :) 

On both Unity and Plasma, Qt is using the Status Notifier protocol. 

So most of the issues you described are actually limitations of either that 
protocol or its implementations (indicator-application, Plasma tray), not 
bugs in Qt. 

Regarding updating the menu when the icon is hidden, it should work fine 
on Unity. Can you check if the systray example from qtbase examples works 
for you (it has dynamically enabled/disabled Minimize, Maximize, Close 
actions)? 

In any case, this is definitely not specific to PyQt, so it should be better

discussed in the Qt bug tracker. 

-- 
Dmitry Shachnev "
---------------------------------------- 
"
"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170703/05b5f8a3/attachment.html>


More information about the PyQt mailing list