| 392 | } |
| 393 | |
| 394 | int TextEditorLineNumbers::areaWidth() const |
| 395 | { |
| 396 | int digits = 1; |
| 397 | int max = std::max(1, m_editor.blockCount()); |
| 398 | |
| 399 | while (max >= 10) { |
| 400 | max /= 10; |
| 401 | ++digits; |
| 402 | } |
| 403 | |
| 404 | digits = std::max(3, digits); |
| 405 | |
| 406 | int space = 3 + fontMetrics().horizontalAdvance(QLatin1Char('9')) * digits + 3; |
| 407 | |
| 408 | return space; |
| 409 | } |
| 410 | |
| 411 | QColor TextEditorLineNumbers::textColor() const |
| 412 | { |