File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -23,17 +23,14 @@ QSize QLineNumberArea::sizeHint() const
2323 return QWidget::sizeHint ();
2424 }
2525
26- int space = 0 ;
27- int lineCount = m_codeEditParent-> document ()-> blockCount () ;
26+ const int digits = QString::number (m_codeEditParent-> document ()-> blockCount ()). length () ;
27+ int space ;
2828
29- for (int i = 0 ; i <= lineCount; ++i)
30- {
3129#if QT_VERSION >= 0x050B00
32- space = 15 + m_codeEditParent->fontMetrics ().horizontalAdvance (QString::number (i)) ;
30+ space = 15 + m_codeEditParent->fontMetrics ().horizontalAdvance (QLatin1Char ( ' 9 ' )) * digits ;
3331#else
34- space = 15 + m_codeEditParent->fontMetrics ().width (QLatin1Char (QString::number (i))) ;
32+ space = 15 + m_codeEditParent->fontMetrics ().width (QLatin1Char (' 9 ' )) * digits ;
3533#endif
36- }
3734
3835 return {space, 0 };
3936}
You can’t perform that action at this time.
0 commit comments