From 394cdedce3889b88c258fcb6ad477fb3a66bf2a2 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 9 Apr 2011 11:46:08 -0400 Subject: [PATCH] Calculate preferred with with a built toolbar --- src/calibre/gui2/layout.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 54f97d1039..092f971862 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -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