Solved Qt Frameless Transparent Window in System Tray for Ubuntu 19.04
-
I'm using Ubuntu 19.04 and I have been dealing with figuring out a workaround for the following issue regarding QSystemTrayIcon not responding to mouse clicks by emitting any signals. What makes this more difficult is that QSystemTrayIcon is not a QWidget so it can't capture mouse events.
My workaround is to create a small transparent, frameless QWidget window that fits over the QSystemTrayIcon that will accept and process the mouse clicks. My question is that is it even possible to have access to Ubuntu System Tray in the screen geometry corrdinates. I think it cuts off at zero before the System Tray begins.
The QSystemTRayIcon geometry doesn't work as it returns all zeros:
QRect rect = trayIcon->geometry(); qDebug() << "Tray GEO: " << rect;
This returns:
Tray GEO: QRect(0,0 0x0)
Any ideas about the how I can go about implementing this?
-
@anshah I figured it out guys. I had to install Top Icons Redux and adjusted some settings using the Gnome Tweak Tool. Everything is working fine now.
-
Hi,
What version of Qt are you using ? How did you installed it ?
-
@SGaist I'm using Qt 5.12.2 which is included in the apt-get repo for Ubuntu 19.04.
-
@anshah I figured it out guys. I had to install Top Icons Redux and adjusted some settings using the Gnome Tweak Tool. Everything is working fine now.
-
Glad you found out and thanks for sharing !
Would you mind giving a bit more details about what you did so other people can benefit ?