This commit is contained in:
Kovid Goyal 2010-07-09 23:24:02 -06:00
parent a073f050ec
commit b5dc2db700

View File

@ -22,6 +22,7 @@ class ToolBar(QToolBar): # {{{
QToolBar.__init__(self, parent) QToolBar.__init__(self, parent)
self.setContextMenuPolicy(Qt.PreventContextMenu) self.setContextMenuPolicy(Qt.PreventContextMenu)
self.setMovable(False) self.setMovable(False)
self.setFloatable(False)
self.setOrientation(Qt.Horizontal) self.setOrientation(Qt.Horizontal)
self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea) self.setAllowedAreas(Qt.TopToolBarArea|Qt.BottomToolBarArea)
self.setIconSize(QSize(48, 48)) self.setIconSize(QSize(48, 48))
@ -348,29 +349,29 @@ class SearchBar(QWidget): # {{{
# }}} # }}}
class LocationBar(QWidget): # {{{ class LocationBar(ToolBar): # {{{
def __init__(self, actions, donate, location_view, parent=None): def __init__(self, actions, donate, location_view, parent=None):
QWidget.__init__(self, parent) ToolBar.__init__(self, parent)
self._layout = QHBoxLayout()
self.setLayout(self._layout)
for ac in actions: for ac in actions:
but = self.button_for_action(ac) self.addAction(ac)
self._layout.addWidget(but)
self._layout.addWidget(donate) self.addWidget(location_view)
self.w = QWidget()
self._layout.insertWidget(3, location_view) self.w.setLayout(QVBoxLayout())
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) self.w.layout().addWidget(donate)
donate.setAutoRaise(True)
donate.setCursor(Qt.PointingHandCursor)
self.addWidget(self.w)
self.setIconSize(QSize(50, 50))
self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
def button_for_action(self, ac): def button_for_action(self, ac):
b = QToolButton(self) b = QToolButton(self)
b.setDefaultAction(ac) b.setDefaultAction(ac)
for x in ('ToolTip', 'StatusTip', 'WhatsThis'): for x in ('ToolTip', 'StatusTip', 'WhatsThis'):
getattr(b, 'set'+x)(b.text()) getattr(b, 'set'+x)(b.text())
b.setIconSize(QSize(50, 50))
b.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
return b return b
# }}} # }}}