Implement statusbar padding.

This commit is contained in:
Florian Bruhin 2015-08-27 22:07:14 +02:00
parent 4891fe9457
commit 8d7249ebc6
4 changed files with 17 additions and 2 deletions

View File

@ -27,6 +27,8 @@ Added
the current item in the completion (for quickmarks/bookmarks). the current item in the completion (for quickmarks/bookmarks).
- New settings `tabs -> padding` and `tabs -> indicator-tabbing` to control the - New settings `tabs -> padding` and `tabs -> indicator-tabbing` to control the
size/padding of the tabbar. size/padding of the tabbar.
- New setting `ui -> statusbar-padding` to control the size/padding of the
status bar.
- New setting `network -> referer-header` to configure when the referer should - New setting `network -> referer-header` to configure when the referer should
be sent (by default it's only sent while on the same domain). be sent (by default it's only sent while on the same domain).
- New setting `tabs -> show` which supersedes the old `tabs -> hide-*` options - New setting `tabs -> show` which supersedes the old `tabs -> hide-*` options

View File

@ -293,6 +293,10 @@ def data(readonly=False):
SettingValue(typ.Bool(), 'false'), SettingValue(typ.Bool(), 'false'),
"Whether to hide the statusbar unless a message is shown."), "Whether to hide the statusbar unless a message is shown."),
('statusbar-padding',
SettingValue(typ.Padding(), '1,1,0,0'),
"Padding for statusbar (top, bottom, left, right)."),
('window-title-format', ('window-title-format',
SettingValue(typ.FormatString(fields=['perc', 'perc_raw', 'title', SettingValue(typ.FormatString(fields=['perc', 'perc_raw', 'title',
'title_sep', 'id']), 'title_sep', 'id']),

View File

@ -190,6 +190,8 @@ class MainWindow(QWidget):
"""Resize the completion if related config options changed.""" """Resize the completion if related config options changed."""
if section == 'completion' and option in ('height', 'shrink'): if section == 'completion' and option in ('height', 'shrink'):
self.resize_completion() self.resize_completion()
elif section == 'ui' and option == 'statusbar-padding':
self.resize_completion()
elif section == 'ui' and option == 'downloads-position': elif section == 'ui' and option == 'downloads-position':
self._add_widgets() self._add_widgets()

View File

@ -180,7 +180,8 @@ class StatusBar(QWidget):
self._stopwatch = QTime() self._stopwatch = QTime()
self._hbox = QHBoxLayout(self) self._hbox = QHBoxLayout(self)
self._hbox.setContentsMargins(0, 0, 0, 0) self.set_hbox_padding()
objreg.get('config').changed.connect(self.set_hbox_padding)
self._hbox.setSpacing(5) self._hbox.setSpacing(5)
self._stack = QStackedLayout() self._stack = QStackedLayout()
@ -246,6 +247,11 @@ class StatusBar(QWidget):
else: else:
self.show() self.show()
@config.change_filter('ui', 'statusbar-padding')
def set_hbox_padding(self):
padding = config.get('ui', 'statusbar-padding')
self._hbox.setContentsMargins(padding.left, 0, padding.right, 0)
@pyqtProperty(str) @pyqtProperty(str)
def severity(self): def severity(self):
"""Getter for self.severity, so it can be used as Qt property. """Getter for self.severity, so it can be used as Qt property.
@ -558,6 +564,7 @@ class StatusBar(QWidget):
def minimumSizeHint(self): def minimumSizeHint(self):
"""Set the minimum height to the text height plus some padding.""" """Set the minimum height to the text height plus some padding."""
padding = config.get('ui', 'statusbar-padding')
width = super().minimumSizeHint().width() width = super().minimumSizeHint().width()
height = self.fontMetrics().height() + 3 height = self.fontMetrics().height() + padding.top + padding.bottom
return QSize(width, height) return QSize(width, height)