MCPcopy Create free account
hub / github.com/MayaPosch/NymphCast / findText

Method findText

player/NymphCastPlayer/qlitehtmlwidget.cpp:455–482  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

453}
454
455bool QLiteHtmlWidget::findText(const QString &text,
456 QTextDocument::FindFlags flags,
457 bool incremental,
458 bool *wrapped)
459{
460 bool success = false;
461 QVector<QRect> oldSelection;
462 QVector<QRect> newSelection;
463 d->documentContainer
464 .findText(text, flags, incremental, wrapped, &success, &oldSelection, &newSelection);
465 // scroll to search result position and/or redraw as necessary
466 QRect newSelectionCombined;
467 for (const QRect &r : newSelection)
468 newSelectionCombined = newSelectionCombined.united(r);
469 QScrollBar *vBar = verticalScrollBar();
470 const int top = newSelectionCombined.top();
471 const int bottom = newSelectionCombined.bottom() - toVirtual(viewport()->size()).height();
472 if (success && top < vBar->value() && vBar->minimum() <= top) {
473 vBar->setValue(top);
474 } else if (success && vBar->value() < bottom && bottom <= vBar->maximum()) {
475 vBar->setValue(bottom);
476 } else {
477 viewport()->update(fromVirtual(newSelectionCombined.translated(-scrollPosition())));
478 for (const QRect &r : oldSelection)
479 viewport()->update(fromVirtual(r.translated(-scrollPosition())));
480 }
481 return success;
482}
483
484void QLiteHtmlWidget::setDefaultFont(const QFont &font)
485{

Callers

nothing calls this directly

Calls 7

valueMethod · 0.80
topMethod · 0.45
bottomMethod · 0.45
heightMethod · 0.45
sizeMethod · 0.45
setValueMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected