Unsolved QSystemTrayIcon signals not emitting on mouse click in Ubuntu 19.04
-
@SGaist I am using Gnome on Ubuntu 19.04. The Qt version is 5.12. It is the one provided with the distribution.
-
@anshah
My guess, not based on knowledge, is that there will be an issue with GNOME. Do we knowQSystemTrayIcon
works properly under GNOME? See e.g. https://stackoverflow.com/a/45151259 or https://forum.qt.io/topic/107210/qsystemtrayicon-activated-signal-only-sends-on-double-click-ubuntu-gnome.In Ubuntu 18.04, the signals all emitted and everything was working fine. In Ubuntu 19.04 the signals do not emit.
Hmm, good point, Were you definitely using GNOME under your 18.04, they only changed off Unity at 17.10 I think. Does 19.04 have a different GNOME?
-
@JonB
Ubuntu 19.04 uses Gnome 3.32.1
Ubuntu 18.04 uses Gnome 3.28.2Again I had no issues with QSystemTrayIcon activated signal in 18.04.
-
@anshah
If you also used the Qt version provided with the 18.04 Ubuntu it may well be different? Then it might be Qt version or GNOME version issue.Either way, if you do not get an answer here, you should report, with minimal example, at https://bugreports.qt.io. Maybe someone there can help.
-
I'd check with the Ubuntu folks also since they are responsible for the package they provide.
-
@anshah Ubuntu 18.04 uses Unity by default, not Gnome except you explicitly install and use it.
-
@jsulm
Dear js, that's not right! Do you have a reference for that?* 18.04 had moved over to GNOME. In fact, IIRC, it was at 17.10 that GNOME replaced Unity as the supplied default.- E.g. https://www.omgubuntu.co.uk/2017/04/ubuntu-18-04-ship-gnome-desktop-not-unity
- https://en.wikipedia.org/wiki/Ubuntu:
GNOME 3 has been the default GUI for Ubuntu Desktop since Ubuntu 17.10,[42][43] while Unity is still the default in older versions,[44][45] including all current LTS versions except 18.04 LTS
-
@JonB Oh, you're right!
-
@jsulm @JonB @SGaist
How does support work? Do I call Qt? Ubuntu? GNome?I posted this on an Ubuntu Forum and I literally saw tumbleweed going across. StackOverflow is useless too.
Over the past year you guys are the only ones who respond almost immediately and I'm super appreciative.
I consider you guys family. -
@anshah
I don't think you can call Qt company without a support contract :) And I don't think there's anyone to call for Ubuntu or GNOME :)First, I suggested
Either way, if you do not get an answer here, you should report, with minimal example, at https://bugreports.qt.io. Maybe someone there can help.
Have you done that? That would be my first port of call.
Second, if this is a show-stopper for you, do you compile Qt yourself/are you prepared to? Because if I worked in C++ (I am Python) I would be prepared to get the sources of Qt into the debugger and have a mosey around, hoping I could break in the code at useful places.
-
-
Sorry I haven't posted on this thread for a while since I got pulled off on other issues. So compiling Qt myself is not an option as we use the distribution provided by the repository "apt-get" in Ubuntu. The problematic Ubuntu version is 19.04 which also has an update to Gnome.
The main issue right now is that the QSystemTrayIcon does not send out any signals when receiving mouse clicks and is completely unresponsive.
Do you think it could somehow be sitting behind the system tray and somehow I need to bring it to the front?
QSystemTrayIcon is not a QWidget so it doesn't have any capability to capture QMouseEvents which I was hoping.
Do you guys have any ideas for workarounds to somehow capture mouse clicks?
I did see someone implement a small transparent QWidget window that fits over the QSystemTrayIcon and then it can capture the QMouseEvents and handle them appropriately. The only problem is that in order to get THAT working I need to use the geometry() method and I'm not sure that the QSystemTrayIcon's geometry() method returns anything. The last time I played around with it returned point (0,0). I'll try again.
QRect rect = trayIcon->geometry(); qDebug() << "Tray GEO: " << rect;
This returns:
Tray GEO: QRect(0,0 0x0)
If you guys have any ideas of creative workarounds that would be great. Messing with Qt internals isn't an option unfortunately.