MCPcopy Create free account
hub / github.com/KDE/kdevelop / sizeHintForHtml

Function sizeHintForHtml

plugins/patchreview/patchhighlighter.cpp:44–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42
43
44QSize sizeHintForHtml( const QString& html, QSize maxSize ) {
45 QTextDocument doc;
46 doc.setHtml( html );
47
48 QSize ret;
49 if( doc.idealWidth() > maxSize.width() ) {
50 doc.setPageSize( QSize( maxSize.width(), 30 ) );
51 ret.setWidth( maxSize.width() );
52 }else{
53 ret.setWidth( doc.idealWidth() );
54 }
55 ret.setHeight( doc.size().height() );
56 if( ret.height() > maxSize.height() )
57 ret.setHeight( maxSize.height() );
58 return ret;
59}
60
61}
62

Callers 1

showToolTipForMarkMethod · 0.85

Calls 2

setHtmlMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected