changeset 145:c101826ffe2b

Fixed scrollbar width
author Windel Bouwman
date Fri, 22 Feb 2013 10:03:12 +0100
parents 59a9a499e518
children 91af0e40f868
files python/hexedit.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/python/hexedit.py	Sat Feb 09 16:05:36 2013 +0100
+++ b/python/hexedit.py	Fri Feb 22 10:03:12 2013 +0100
@@ -137,13 +137,17 @@
       self.xposAscii = self.xposHex + (BYTES_PER_LINE * 3 - 1) * self.charWidth + GAP
       self.xposEnd = self.xposAscii + self.charWidth * BYTES_PER_LINE + GAP
       self.setMinimumWidth(self.xposEnd)
-      sbw = self.scrollArea.verticalScrollBar().width()
-      self.scrollArea.setMinimumWidth(self.xposEnd + sbw + 5)
+      if self.isVisible():
+         sbw = self.scrollArea.verticalScrollBar().width()
+         self.scrollArea.setMinimumWidth(self.xposEnd + sbw + 5)
       r = len(self.Data) % BYTES_PER_LINE
       r = 1 if r > 0 else 0
       self.setMinimumHeight((int(len(self.Data) / BYTES_PER_LINE) + r) * self.charHeight + 4)
       self.scrollArea.setMinimumHeight(self.charHeight * 8)
       self.update()
+   def showEvent(self, e):
+      self.adjust()
+      super().showEvent(e)
    def setData(self, d):
       self.data = bytearray(d)
       self.originalData = bytearray(d)