mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Calculate preferred with with a built toolbar
This commit is contained in:
parent
2577a155c1
commit
394cdedce3
@ -320,7 +320,6 @@ class BaseToolBar(QToolBar): # {{{
|
|||||||
self.setOrientation(Qt.Horizontal)
|
self.setOrientation(Qt.Horizontal)
|
||||||
self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea)
|
self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea)
|
||||||
self.setStyleSheet('QToolButton:checked { font-weight: bold }')
|
self.setStyleSheet('QToolButton:checked { font-weight: bold }')
|
||||||
self.preferred_width = self.sizeHint().width()
|
|
||||||
|
|
||||||
def resizeEvent(self, ev):
|
def resizeEvent(self, ev):
|
||||||
QToolBar.resizeEvent(self, ev)
|
QToolBar.resizeEvent(self, ev)
|
||||||
@ -334,7 +333,7 @@ class BaseToolBar(QToolBar): # {{{
|
|||||||
p = gprefs['toolbar_text']
|
p = gprefs['toolbar_text']
|
||||||
if p == 'never':
|
if p == 'never':
|
||||||
style = Qt.ToolButtonIconOnly
|
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
|
style = Qt.ToolButtonIconOnly
|
||||||
return style
|
return style
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user