gui: PreviewGenerator*: Fallback to partial highlighting if no whole word match

This commit is contained in:
2022-08-28 12:44:42 +02:00
parent 5a47f5949f
commit 2df273dee3
2 changed files with 22 additions and 3 deletions

View File

@@ -49,6 +49,10 @@ QSharedPointer<PreviewResult> PreviewGeneratorPdf::generate(RenderConfig config,
{
QList<QRectF> rects =
pdfPage->search(word, Poppler::Page::SearchFlag::IgnoreCase | Poppler::Page::SearchFlag::WholeWords);
if(rects.empty())
{
rects = pdfPage->search(word, Poppler::Page::SearchFlag::IgnoreCase);
}
for(QRectF &rect : rects)
{
QPainter painter(&img);