I got a problem which is driving me insane. I want to make the QMenuBar only visible when moused-over, else it should be hidden.
So far i got this to "work":
class Hidden_Menubar(QtGui.QMenuBar):
def __init__(self, parent=None):
super(Hidden_Menubar, self).__init__(parent)
self.setMouseTracking(True)
def enterEvent(self,event):
self.show()
def leaveEvent(self,event):
self.hide()
And
class Ui_Template_FullScreen(object):
def setupUi(self, Template_FullScreen):
Template_FullScreen.setObjectName(_fromUtf8("Template_FullScreen"))
Template_FullScreen.showFullScreen()
self.centralwidget = QtGui.QWidget(Template_FullScreen)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
Template_FullScreen.setCentralWidget(self.centralwidget)
self.menubar = Hidden_Menubar(Template_FullScreen)
......
The Problem is, that as soon as the mouse stops hovering the QMenuBar, it disappears (so far so good) but then it won't be visible if i hover the QMenuBar area again! I guess the mouseMoveEvent does not trigger on hidden objects, or is something else the matter? I tried lots of solutions, for instance installing an event filter, however i was not able to implement it correctly. I'm completely new to python and QT, so I can't figure it out myself. I appreciate every help.
Thanks in advance =)
test.py: http://pastebin.com/hmRvYVup (full code)
EDIT: Thank you all for the very helpful answers! Unfortunately I can't upvote your posts, because I'm missing reputation :/