Issue
I am using the QStatusBar
to print information for how many items are in a list.
This works well, however when I hover over any of the QMenu
icons it clears all data from the QStatus, leaving it blank.
I'm working in windows, and I believe that it's something native that I need to break the connection of that keeps trying to update the statusbar with new information, as I wasn't having this issue while running my window from Maya.
Any ideas for how I could fix this would be great! I'd rather not create a new widget to hold this information.
Solution
There are different ways to
Simplest way is to add QLabel
to status bar, set it's stretch
to a non-zero value and change Label's text instead.
self.status_label = QtGui.QLabel()
self.ui.statusbar.addPermanentWidget(self.status_label, 100)
self.status_label.setText('wow such label')
Another way is to install event filter on QStatusBar, either via subclassing or monkey patching. Example of the latter:
class MainWindow(QMainWindow):
def __init__(self):
...
self.statusBar().eventFilter = self.event_filter
self.installEventFilter(self.statusBar())
...
@staticmethod
def event_filter(_, event):
if event.type() == QtCore.QEvent.StatusTip:
return True
return False
Answered By - mFoxRU
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.