Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qpdfsearchmodel.h
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4
#
ifndef
QPDFSEARCHMODEL_H
5
#
define
QPDFSEARCHMODEL_H
6
7
#
include
<
QtPdf
/
qtpdfglobal
.
h
>
8
9
#
include
<
QtCore
/
qabstractitemmodel
.
h
>
10
#
include
<
QtPdf
/
qpdfdocument
.
h
>
11
#
include
<
QtPdf
/
qpdflink
.
h
>
12
13
#
include
<
QtCore
/
qhash
.
h
>
14
15
QT_BEGIN_NAMESPACE
16
17
class
QPdfSearchModelPrivate
;
18
19
class
Q_PDF_EXPORT
QPdfSearchModel
:
public
QAbstractListModel
20
{
21
Q_OBJECT
22
Q_PROPERTY(QPdfDocument *document READ document WRITE setDocument NOTIFY documentChanged)
23
Q_PROPERTY(QString searchString READ searchString WRITE setSearchString NOTIFY searchStringChanged)
24
Q_PROPERTY(
int
count READ count NOTIFY countChanged REVISION(6, 8) FINAL)
25
Q_PROPERTY(Status status READ status NOTIFY statusChanged REVISION(6, 12))
26
27
public
:
28
enum
class
Role :
int
{
29
Page = Qt::UserRole,
30
IndexOnPage,
31
Location,
32
ContextBefore,
33
ContextAfter,
34
NRoles
35
};
36
Q_ENUM(Role)
37
38
enum
class
Status :
int
{
39
Null,
40
Searching,
41
Finished,
42
};
43
Q_ENUM(Status)
44
45
QPdfSearchModel() : QPdfSearchModel(
nullptr
) {}
46
explicit
QPdfSearchModel(QObject *parent);
47
~QPdfSearchModel() override;
48
49
QList<QPdfLink> resultsOnPage(
int
page)
const
;
50
QPdfLink resultAtIndex(
int
index)
const
;
51
52
QPdfDocument *document()
const
;
53
QString searchString()
const
;
54
55
QHash<
int
, QByteArray> roleNames()
const
override;
56
int
rowCount(
const
QModelIndex &parent)
const
override;
57
QVariant data(
const
QModelIndex &index,
int
role)
const
override;
58
59
int
count()
const
;
60
61
Status status()
const
;
62
63
public
Q_SLOTS:
64
void
setSearchString(
const
QString &searchString);
65
void
setDocument(QPdfDocument *document);
66
67
Q_SIGNALS:
68
void
documentChanged();
69
void
searchStringChanged();
70
Q_REVISION(6, 8)
void
countChanged();
71
Q_REVISION(6, 12)
void
statusChanged(QPdfSearchModel::Status status);
72
73
protected
:
74
void
updatePage(
int
page);
75
void
timerEvent(QTimerEvent *event) override;
76
77
private
:
78
QHash<
int
, QByteArray> m_roleNames;
79
Q_DECLARE_PRIVATE(QPdfSearchModel)
80
};
81
82
QT_END_NAMESPACE
83
84
#
endif
// QPDFSEARCHMODEL_H
QPdfSearchModelPrivate
Definition
qpdfsearchmodel_p.h:26
QPdfSearchModelPrivate::matchedText
QString matchedText(const PageAndIndex &pi) const
Definition
qpdfsearchmodel.cpp:385
QPdfSearchModelPrivate::doSearch
bool doSearch(int page)
Definition
qpdfsearchmodel.cpp:297
QPdfSearchModelPrivate::rowCountSoFar
int rowCountSoFar
Definition
qpdfsearchmodel_p.h:47
QPdfSearchModelPrivate::clearResults
void clearResults()
Definition
qpdfsearchmodel.cpp:272
QPdfSearchModelPrivate::rowsBeforePage
int rowsBeforePage(int page)
Definition
qpdfsearchmodel.cpp:408
QPdfSearchModelPrivate::setStatus
void setStatus(QPdfSearchModel::Status s)
Definition
qpdfsearchmodel.cpp:416
QPdfSearchModelPrivate::nextPageToUpdate
int nextPageToUpdate
Definition
qpdfsearchmodel_p.h:48
QPdfSearchModelPrivate::pageAndIndexForResult
PageAndIndex pageAndIndexForResult(int resultIndex)
Definition
qpdfsearchmodel.cpp:390
QPdfSearchModel
The QPdfSearchModel class searches for a string in a PDF document and holds the results.
Definition
qpdfsearchmodel.h:20
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
ContextChars
static const int ContextChars
Definition
qpdfsearchmodel.cpp:22
Q_PDF_LOGGING_CATEGORY
#define Q_PDF_LOGGING_CATEGORY(name,...)
Definition
qtpdfglobal_p.h:29
QPdfSearchModelPrivate::PageAndIndex
Definition
qpdfsearchmodel_p.h:34
qtwebengine
src
pdf
qpdfsearchmodel.h
Generated on
for Qt by
1.18.0