From 1b89c47cc27bff265ba16acab6c1a84bfc9a88b7 Mon Sep 17 00:00:00 2001 From: Ogi Moore Date: Wed, 21 Oct 2020 22:18:36 -0700 Subject: [PATCH] Add fontSize kwarg (taken from PR #129) (#1410) --- pyqtgraph/dockarea/Dock.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pyqtgraph/dockarea/Dock.py b/pyqtgraph/dockarea/Dock.py index 3c3ba39d..f1dd64f3 100644 --- a/pyqtgraph/dockarea/Dock.py +++ b/pyqtgraph/dockarea/Dock.py @@ -10,13 +10,13 @@ class Dock(QtGui.QWidget, DockDrop): sigStretchChanged = QtCore.Signal() sigClosed = QtCore.Signal(object) - def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False): + def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, closable=False, fontSize="12px"): QtGui.QWidget.__init__(self) DockDrop.__init__(self) self._container = None self._name = name self.area = area - self.label = DockLabel(name, self, closable) + self.label = DockLabel(name, self, closable, fontSize) if closable: self.label.sigCloseClicked.connect(self.close) self.labelHidden = False @@ -259,9 +259,10 @@ class DockLabel(VerticalLabel): sigClicked = QtCore.Signal(object, object) sigCloseClicked = QtCore.Signal() - def __init__(self, text, dock, showCloseButton): + def __init__(self, text, dock, showCloseButton, fontSize): self.dim = False self.fixedWidth = False + self.fontSize = fontSize VerticalLabel.__init__(self, text, orientation='horizontal', forceWidth=False) self.setAlignment(QtCore.Qt.AlignTop|QtCore.Qt.AlignHCenter) self.dock = dock @@ -298,7 +299,8 @@ class DockLabel(VerticalLabel): border-right: 2px solid %s; padding-top: 3px; padding-bottom: 3px; - }""" % (bg, fg, r, r, border) + font-size: %s; + }""" % (bg, fg, r, r, border, self.fontSize) self.setStyleSheet(self.vStyle) else: self.hStyle = """DockLabel { @@ -312,7 +314,8 @@ class DockLabel(VerticalLabel): border-bottom: 2px solid %s; padding-left: 3px; padding-right: 3px; - }""" % (bg, fg, r, r, border) + font-size: %s; + }""" % (bg, fg, r, r, border, self.fontSize) self.setStyleSheet(self.hStyle) def setDim(self, d):