Method: Ruber::ExceptionDialog::ExceptionBacktraceWidget#sizeHint
- Defined in:
- lib/ruber/exception_widgets.rb
#sizeHint ⇒ Qt::Size
Override of @KDE::TextEdit#sizeHint@
The width is computed as the size (using the fixed width font) of the longest line, while the height is computed as the height of a single line multiplied by the number of lines.
Both width and height are computed using @Qt::FontMetrics@
73 74 75 76 77 78 79 |
# File 'lib/ruber/exception_widgets.rb', line 73 def sizeHint font = Qt::TextCursor.new(document).char_format.font fm = Qt::FontMetrics.new font lines = to_plain_text.split_lines longest = lines.sort_by{|l| l.size}[-1] Qt::Size.new fm.width(longest), fm.height * lines.size end |