| 28 | } |
| 29 | |
| 30 | QSize 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 | |
| 59 | void QLineNumberArea::setSyntaxStyle(QSyntaxStyle *style) |
| 60 | { |
no test coverage detected