Calculate preferred with with a built toolbar

This commit is contained in:
John Schember 2011-04-09 11:46:08 -04:00
parent 2577a155c1
commit 394cdedce3

View File

@ -320,7 +320,6 @@ class BaseToolBar(QToolBar): # {{{
self.setOrientation(Qt.Horizontal)
self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea)
self.setStyleSheet('QToolButton:checked { font-weight: bold }')
self.preferred_width = self.sizeHint().width()
def resizeEvent(self, ev):
QToolBar.resizeEvent(self, ev)
@ -334,7 +333,7 @@ class BaseToolBar(QToolBar): # {{{
p = gprefs['toolbar_text']
if p == 'never':
style = Qt.ToolButtonIconOnly
elif p == 'auto' and self.preferred_width > self.width()+35:
elif p == 'auto' and self.sizeHint().width() > self.width()+35:
style = Qt.ToolButtonIconOnly
return style