Ejemplo n.º 1
0
def get_text_edit_row_height(editor: QtWidgets.QPlainTextEdit,
                             rows: int) -> int:
    metrics = QtGui.QFontMetrics(editor.document().defaultFont())
    margins = editor.contentsMargins()
    return (metrics.lineSpacing() * rows +
            (editor.document().documentMargin() + editor.frameWidth()) * 2 +
            margins.top() + margins.bottom() + 1)