MCPcopy Create free account
hub / github.com/KDE/kdiff3 / getMaxTextWidth

Method getMaxTextWidth

src/difftextwindow.cpp:550–574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550qint32 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
576LineType DiffTextWindow::getNofLines() const
577{

Callers 1

setHScrollBarRangeMethod · 0.45

Calls 3

setTextMethod · 0.80
prepareTextLayoutMethod · 0.80
getStringMethod · 0.45

Tested by

no test coverage detected