MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / sizeHint

Method sizeHint

lib/QCodeEditor/src/internal/QLineNumberArea.cpp:30–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30QSize QLineNumberArea::sizeHint() const
31{
32 if (m_codeEditParent == nullptr)
33 {
34 return QWidget::sizeHint();
35 }
36
37 // Calculating width
38 int digits = 1;
39 int max = qMax(1, m_codeEditParent->document()->blockCount());
40 while (max >= 10)
41 {
42 max /= 10;
43 ++digits;
44 }
45
46#if QT_VERSION >= 0x050B00
47 int space
48 = 13
49 + m_codeEditParent->fontMetrics().horizontalAdvance(QLatin1Char('9'))
50 * digits;
51#else
52 int space
53 = 13 + m_codeEditParent->fontMetrics().width(QLatin1Char('9')) * digits;
54#endif
55
56 return {space, 0};
57}
58
59void QLineNumberArea::setSyntaxStyle(QSyntaxStyle *style)
60{

Callers 15

updateLineGeometryMethod · 0.80
updateLineNumberAreaMethod · 0.80
proceedCompleterEndMethod · 0.80
mousePressEventMethod · 0.80
mouseMoveEventMethod · 0.80
mouseReleaseEventMethod · 0.80
mouseDoubleClickEventMethod · 0.80
mousePressEventMethod · 0.80
mouseMoveEventMethod · 0.80
mouseReleaseEventMethod · 0.80
mouseDoubleClickEventMethod · 0.80

Calls 1

widthMethod · 0.80

Tested by

no test coverage detected