##// END OF EJS Templates
Font width calculation fix for certain Mac OS systems.
epatters -
Show More
@@ -214,10 +214,12 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
214 214 style = self.style()
215 215 splitwidth = style.pixelMetric(QtGui.QStyle.PM_SplitterWidth)
216 216
217 # Despite my best efforts to take the various margins into account, the
218 # width is still coming out a bit too small, so we include a fudge
219 # factor of one character here.
220 width = font_metrics.maxWidth() * 81 + margin
217 # Note 1: Despite my best efforts to take the various margins into
218 # account, the width is still coming out a bit too small, so we include
219 # a fudge factor of one character here.
220 # Note 2: QFontMetrics.maxWidth is not used here or anywhere else due
221 # to a Qt bug on certain Mac OS systems where it returns 0.
222 width = font_metrics.width(' ') * 81 + margin
221 223 width += style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent)
222 224 if self.paging == 'hsplit':
223 225 width = width * 2 + splitwidth
@@ -940,7 +942,7 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
940 942
941 943 # Calculate the number of characters available.
942 944 width = self._control.viewport().width()
943 char_width = QtGui.QFontMetrics(self.font).maxWidth()
945 char_width = QtGui.QFontMetrics(self.font).width(' ')
944 946 displaywidth = max(10, (width / char_width) - 1)
945 947
946 948 # Some degenerate cases.
General Comments 0
You need to be logged in to leave comments. Login now