fix vertical scroll
used the wrong font height
This commit is contained in:
15
bigtext.py
15
bigtext.py
@@ -140,12 +140,16 @@ class InnerBigText(QWidget):
|
|||||||
painter.setPen(QColor(0, 0, 0))
|
painter.setPen(QColor(0, 0, 0))
|
||||||
self.update_font_metrics(painter)
|
self.update_font_metrics(painter)
|
||||||
|
|
||||||
lines_to_show = self.height() / (self.fontMetrics().height())
|
lines_to_show = self.height() / float(self.char_height)
|
||||||
|
#print("%s / %s = %s" %(self.height(), float(self.char_height), lines_to_show))
|
||||||
|
|
||||||
self.lines = self.model.data(self._byte_offset, self.scroll_lines, lines_to_show)
|
self.lines = self.model.data(self._byte_offset, self.scroll_lines, lines_to_show)
|
||||||
|
#print("lines_to_show: %d returned: %d" % (lines_to_show, len(self.lines)))
|
||||||
self.scroll_lines=0
|
self.scroll_lines=0
|
||||||
self._byte_offset = self.lines[0].byte_offset()
|
self._byte_offset = self.lines[0].byte_offset()
|
||||||
self.parent.v_scroll_bar.setMaximum(
|
# document length == maximum + pageStep + aFewBytesSoThatTheLastLineIsShown
|
||||||
self.model.byte_count() - 1 - 10) # document length == maximum + pageStep + aFewBytesSoThatTheLastLineIsShown
|
self.parent.v_scroll_bar.setMaximum(self.model.byte_count() - 1 - 10)
|
||||||
|
|
||||||
|
|
||||||
for l in self.lines:
|
for l in self.lines:
|
||||||
self.update_longest_line(len(l.line()))
|
self.update_longest_line(len(l.line()))
|
||||||
@@ -198,8 +202,7 @@ class InnerBigText(QWidget):
|
|||||||
def update_font_metrics(self, painter: QPainter):
|
def update_font_metrics(self, painter: QPainter):
|
||||||
fm: QFontMetrics = painter.fontMetrics()
|
fm: QFontMetrics = painter.fontMetrics()
|
||||||
self.char_height = fm.height()
|
self.char_height = fm.height()
|
||||||
self.char_width = fm.averageCharWidth() # all chars have same with for monospace font
|
self.char_width = fm.averageCharWidth() # all chars have same width for monospace font
|
||||||
text = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
|
text = "012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789"
|
||||||
self.char_width = fm.horizontalAdvance(text) / float(len(text))
|
self.char_width = fm.horizontalAdvance(text) / float(len(text))
|
||||||
# print("bounding rect: %s"%(boundingRect))
|
#print("font width=%s height=%s" % (self.char_width, self.char_height))
|
||||||
# print("font width=%s height=%s" % (self.char_width, self.char_height))
|
|
||||||
|
|||||||
22
example.log
22
example.log
@@ -122,4 +122,24 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|
|
|||||||
2018-09-06T00:00:31.309Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
|
2018-09-06T00:00:31.309Z,2,vapfacbk01,ApplicationLockService.getLocks,AXC_5.14_526,,successful
|
||||||
2018-09-06T00:00:31.311Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
|
2018-09-06T00:00:31.311Z,2,vapfacbk01,ApplicationStateService.getState,AXC_5.14_526,,successful
|
||||||
---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10
|
---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10
|
||||||
---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10
|
---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10---------1---------2---------3---------4---------5---------6---------7---------8---------9--------10
|
||||||
|
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
12
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
16
|
||||||
|
17
|
||||||
|
18
|
||||||
|
19
|
||||||
Reference in New Issue
Block a user