mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 22:43:31 +02:00
A couple more QFontMetrics::width
This commit is contained in:
parent
c242528a63
commit
02071f0369
2 changed files with 3 additions and 4 deletions
|
|
@ -61,8 +61,8 @@ def update_line_number_area_width(self, block_count=0):
|
|||
|
||||
def line_number_area_width(self):
|
||||
# get largest width of digits
|
||||
w = self.fontMetrics()
|
||||
self.number_width = max(map(lambda x:w.width(str(x)), range(10)))
|
||||
fm = self.fontMetrics()
|
||||
self.number_width = max(map(lambda x:fm.horizontalAdvance(str(x)), range(10)))
|
||||
digits = 1
|
||||
limit = max(1, self.blockCount())
|
||||
while limit >= 10:
|
||||
|
|
@ -218,4 +218,3 @@ def select_block(block_number, curs):
|
|||
ev.accept()
|
||||
return
|
||||
QPlainTextEdit.keyPressEvent(self, ev)
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ def do_paint(self, painter, option, index):
|
|||
painter.drawText(r, Qt.AlignmentFlag.AlignVCenter|Qt.AlignmentFlag.AlignLeading|Qt.TextFlag.TextSingleLine, text)
|
||||
|
||||
if (system != QFontDatabase.WritingSystem.Any):
|
||||
w = painter.fontMetrics().width(text + " ")
|
||||
w = painter.fontMetrics().horizontalAdvance(text + " ")
|
||||
painter.setFont(font2)
|
||||
sample = QFontDatabase.writingSystemSample(system)
|
||||
if (option.direction == Qt.LayoutDirection.RightToLeft):
|
||||
|
|
|
|||
Loading…
Reference in a new issue