| 45 | } |
| 46 | |
| 47 | int BasicEditor::lineNumberAreaWidth() |
| 48 | { |
| 49 | int digits = 1; |
| 50 | int max = qMax(1, blockCount()); |
| 51 | while (max >= 10) { |
| 52 | max /= 10; |
| 53 | ++digits; |
| 54 | } |
| 55 | |
| 56 | int singlespace; |
| 57 | #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) |
| 58 | singlespace = fontMetrics().horizontalAdvance(QLatin1Char('9')); |
| 59 | #else |
| 60 | singlespace = fontMetrics().width(QLatin1Char('9')); |
| 61 | #endif |
| 62 | |
| 63 | int space = 3 + singlespace * digits; |
| 64 | |
| 65 | return space; |
| 66 | } |
| 67 | |
| 68 | void BasicEditor::updateLineNumberAreaWidth(int /* newBlockCount */) |
| 69 | { |