| 548 | } |
| 549 | |
| 550 | qint32 DiffTextWindow::getMaxTextWidth() const |
| 551 | { |
| 552 | /* |
| 553 | mDiff3LineVector is null when qt sends a resize event before init. Default to fixed size in this case. |
| 554 | */ |
| 555 | if(d->mDiff3LineVector == nullptr || d->m_bWordWrap) |
| 556 | { |
| 557 | return getVisibleTextAreaWidth(); |
| 558 | } |
| 559 | else if(d->m_maxTextWidth.loadRelaxed() < 0) |
| 560 | { |
| 561 | //TODO: This appears to be broken in someway. |
| 562 | d->m_maxTextWidth = 0; |
| 563 | QTextLayout textLayout(QString(), font(), this); |
| 564 | for(qint32 i = 0; i < d->m_size; ++i) |
| 565 | { |
| 566 | textLayout.clearLayout(); |
| 567 | textLayout.setText(d->getString(i)); |
| 568 | d->prepareTextLayout(textLayout); |
| 569 | if(textLayout.maximumWidth() > d->m_maxTextWidth.loadRelaxed()) |
| 570 | d->m_maxTextWidth = qCeil(textLayout.maximumWidth()); |
| 571 | } |
| 572 | } |
| 573 | return d->m_maxTextWidth.loadRelaxed(); |
| 574 | } |
| 575 | |
| 576 | LineType DiffTextWindow::getNofLines() const |
| 577 | { |
no test coverage detected