QStatusBar message disappears on menu hover

I have a very basic QMainWindow application that contains a menubar and a statusbar. When I hover over the menu the status message disappears. More precisely, the status message is cleared. I have no idea what is causing this behavior but it's resulting in a very difficult workaround for what I hoped to be trivial behavior.

This is problematic for the following reason: I can make the message permanent by adding a QLabel widget to the QStatusBar, but then I get the awkward border. I don't want the border. The only way I know how to remove the border is via QStatusBar.setStyleSheet(). I am using a palette for my color scheme as opposed to a stylesheet so modifying the stylesheet messes up other colors. I also can't restore the original statusBar QLabel color when I make a modification via the stylesheet. I'm not the best at using stylesheets.

Is there a way to prevent the menu interaction from clearing the status message? If not, is there a way to remove the border from the StatusBar when adding a QLabel widget while preserving my palette (maybe not via stylesheets)?

#!/usr/bin/env python import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class win(QMainWindow): def __init__(self,parent=None): super(win,self).__init__(parent) self.menubar = QMenuBar(self) self.fileMenu = QMenu("File") self.exitAction = QAction("Exit",self) self.fileMenu.addAction(self.exitAction) self.menubar.addMenu(self.fileMenu) self.statusBar().showMessage("Hello") self.connect(self.exitAction,SIGNAL("triggered()"), self.close) if __name__ == "__main__": app = QApplication(sys.argv) GUI = win() GUI.show() app.exec_()


Basically, each widget you hover over sets the status bar text to their statusTip property even when that property is an empty string.

For QMenu, the text is stored in the menuAction action status tip, so, you can have a text instead of just clearing the status bar with something like this:

self.fileMenu.menuAction().setStatusTip("File Menu is hovered")

To prevent anything to change the status bar, you can probably install an eventFilter on the status bar and filter out all QStatusTipEvent.


I got the same problem, and I found another way which is creating a new QLabel

self.myMessage = QtGui.QLabel() self.myMessage.setText("Hello")

and add it as an widget to the status bar on the left


or on the right



And to answer the portion about removing the border from the statusbar: self.statusbar().setStyleSheet("QStatusBar::item{ border: 0px solid black };") does the trick. It is important to setStyleSheet only on the statusbar object and not the entire application.


  • VBA [EXCEL 2013]: Automation: Open Links in Same Browser Window / Tab
  • PowerShell button click event scriptblock not working
  • cordova plugin installation issue when using node script in hooks folder
  • How to display progress bar when userform is loading in VBA excel
  • How to implement IVsStatusbar when making a Visual Studio Add-In
  • Animated progress bar in NSMenuItem
  • Camera.takePicture throws RunTimeException
  • Using ViewPager with Tabs without actionBar
  • jquery globalcss IE opacity
  • node-sass-middleware not rendering using express
  • How to assign a prop value to a state in react
  • stacking swf files on top of each other
  • Android EditText change focus after validation and showing the error in a Dialog
  • Accessing CSS custom variable with Javascript
  • how to use the same method of jquery scrollTop with css3
  • Magento - FishPig Integration - Not getting correct template for /blog
  • ionic slide menu don't appear when i use state.go in my controller
  • Why isn't my mobile website auto-resizing for mobile devices?
  • Using Recaptcha with EPiServer XForms
  • Catch in Observable stops HTTP Calls from Observable.interval
  • Tracking screen recorder in windows app
  • How to subscribe to an event without preventing garbage collection?
  • Is it possible to disable esc/F11 key during full screen mode of webpage, programmatically?
  • How to protect the mp3 file from read or copy on Android?
  • Chrome breakpoint on radio doesn't fire
  • Negated scanset in fscanf and EOF
  • php show all images in directory and sort by last modified
  • change color of jstree node
  • Is looping through all style sheets and classes a good idea in JavaScript?
  • Changing media screen makes div overlay
  • How can I extend PHP DOMElement?
  • Consuming a WCF service in a Java Client using wsHttpBinding
  • In matplotlib, how do you change the fontsize of a single figure?
  • Clear fused location provider's location for testing
  • Who propagate bugfixes across branches (corporate development)?
  • Bash if statement with multiple conditions
  • xcode don't localize specific strings
  • Tamper-proof configuration files in .NET?
  • ilmerge with a PFX file
  • Running Map reduces the dimensions of the matrices