diff options
| author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-06-11 13:21:32 +0300 |
|---|---|---|
| committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2024-06-11 13:31:01 +0300 |
| commit | 3cd4e0aa7961889eb06374885ed648f5b9bd85bc (patch) | |
| tree | 6a089aedea155b1f1a74b553f4d1b57c70554a8f /src/pdf/qpdfsearchmodel.cpp | |
| parent | 6d029165d1593c514db08c34d6b08a00a4435d5e (diff) | |
| parent | 38063a6332b9f948a0381763271e9a9ac7af0999 (diff) | |
Merge tag 'v6.2.9-lts' into tqtc/lts-6.2-opensource6.2.9
Qt 6.2.9-lts release
Conflicts solved:
dependencies.yaml
examples/webenginewidgets/push-notifications/CMakeLists.txt
Change-Id: I0127c2575369f6939df89f3301659470d481b9bf
Diffstat (limited to 'src/pdf/qpdfsearchmodel.cpp')
| -rw-r--r-- | src/pdf/qpdfsearchmodel.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pdf/qpdfsearchmodel.cpp b/src/pdf/qpdfsearchmodel.cpp index a8946ccfe..3109430f0 100644 --- a/src/pdf/qpdfsearchmodel.cpp +++ b/src/pdf/qpdfsearchmodel.cpp @@ -20,7 +20,6 @@ Q_LOGGING_CATEGORY(qLcS, "qt.pdf.search") static const int UpdateTimerInterval = 100; static const int ContextChars = 64; -static const double CharacterHitTolerance = 6.0; /*! \class QPdfSearchModel @@ -195,11 +194,23 @@ void QPdfSearchModel::setDocument(QPdfDocument *document) if (d->document == document) return; + disconnect(d->documentConnection); + d->documentConnection = connect(document, &QPdfDocument::pageCountChanged, this, + &QPdfSearchModel::onDocumentPageCountChanged); + d->document = document; d->clearResults(); emit documentChanged(); } +void QPdfSearchModel::onDocumentPageCountChanged(int count) +{ + Q_UNUSED(count); + + Q_D(QPdfSearchModel); + d->clearResults(); +} + void QPdfSearchModel::timerEvent(QTimerEvent *event) { Q_D(QPdfSearchModel); @@ -257,6 +268,7 @@ bool QPdfSearchModelPrivate::doSearch(int page) } FPDF_SCHHANDLE sh = FPDFText_FindStart(textPage, searchString.utf16(), 0, 0); QList<QPdfLink> newSearchResults; + constexpr double CharacterHitTolerance = 6.0; while (FPDFText_FindNext(sh)) { int idx = FPDFText_GetSchResultIndex(sh); int count = FPDFText_GetSchCount(sh); |
