this.setStyleSheet("QMenu::icon {background-color: rgba(0,0,0,0);}")
"QMenu::icon:hover {background-color: rgba(0,0,0,0);}"
"QMenu::icon:hover {background-color: transparent;}"
import sysfrom PySide import QtGui, QtCorefrom qqqq import trayapp = QtGui.QApplication(sys.argv)app.setQuitOnLastWindowClosed(False)ex = tray()ex.show()sys.exit(app.exec_())
from PySide import QtGui, QtCoreimport sysclass tray (QtGui.QSystemTrayIcon): def __init__(self, parent = None): super(tray, self).__init__(parent) self.setIcon (QtGui.QIcon.fromTheme('help-about')) self.right_menu = RightButtonMenu(self) # self.left_menu = LeftButtonMenu(self, parent) self.activated.connect(self.activ) self.setContextMenu(self.right_menu) def activ(self, reason): if reason == QtGui.QSystemTrayIcon.Trigger \ or reason == QtGui.QSystemTrayIcon.DoubleClick: self.showMessage('wwww<b>dfff</b><i>ass</i>', 'wwww<b>dfff</b><i>ass</i>', int = 1000000) def close(self): sys.exit(1) class RightButtonMenu(QtGui.QMenu): def __init__(self, parent): QtGui.QMenu.__init__(self) # Add about program About_icon = QtGui.QIcon.fromTheme('help-about') self.about_action = QtGui.QAction(About_icon, ("About Program"), self) self.addAction(self.about_action) # Add tools tools_icon = QtGui.QIcon.fromTheme('preferences-other') self.tools_action = QtGui.QAction(tools_icon, ('Program settings'), \ self) self.addAction(self.tools_action) exit_icon = QtGui.QIcon.fromTheme('application-exit') self.exit_action = QtGui.QAction(exit_icon, ("Exit program"), \ self, triggered=parent.close) self.addAction(self.exit_action) bg_color_alpha = 'rgba(0,0,0,150)' self.setStyleSheet( self.styleSheet() + \ 'QMenu {'\ 'color: white;'\ 'background-color: %s;' %bg_color_alpha +\ '}'\ 'QMenu::icon:hover {background: transparent;}' \ #rgba(0,0,0,0);}' \ )