From cf1e4ecd4faedf2384a678d8bde9047e0fd7c588 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 18 Jan 2014 13:37:34 +0100 Subject: [PATCH] + fixes #0001325: PushButtons in TaskPanel too small --- src/Mod/Draft/DraftGui.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index 533076c8a..81e636686 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -506,6 +506,23 @@ class DraftToolBar: self.labelFFile.setText(translate("draft", "Full path to font file:")) self.chooserButton.setToolTip(translate("draft", "Open a FileChooser for font file")) + # Update the maximum width of the push buttons + maxwidth = 66 # that's the default + pb = [] + for i in range(self.layout.count()): + w = self.layout.itemAt(i).widget() + if w != None and w.inherits('QPushButton'): + pb.append(w) + + for i in pb: + fm = QtGui.QFontMetrics(i.font()) + fw = fm.width(i.text()) + fw = max(fw, maxwidth) + + maxwidth = maxwidth + 16 +10 # add icon width and a margin + for i in pb: + i.setMaximumWidth(maxwidth) + if (not self.taskmode) or self.tray: self.wplabel.setToolTip(translate("draft", "Set/unset a working plane")) self.colorButton.setToolTip(translate("draft", "Line Color"))