QPdfSearchModel Class

QPdfSearchModel 클래스는 PDF 문서에서 문자열을 검색하고 결과를 저장합니다. 더 보기...

Header: #include <QPdfSearchModel>
Inherits: QAbstractListModel

공용 유형

enum class Role { Page, IndexOnPage, Location, ContextBefore, ContextAfter }

속성

공용 함수

QPdfSearchModel(QObject *parent)
virtual ~QPdfSearchModel() override
int count() const
QPdfDocument *document() const
QPdfLink resultAtIndex(int index) const
QList<QPdfLink> resultsOnPage(int page) const
QString searchString() const

재구현된 공용 함수

virtual QVariant data(const QModelIndex &index, int role) const override
virtual QHash<int, QByteArray> roleNames() const override
virtual int rowCount(const QModelIndex &parent) const override

공용 슬롯

void setDocument(QPdfDocument *document)
void setSearchString(const QString &searchString)

신호

상세 설명

모델/보기 프로그래밍 패러다임에서 검색 결과 목록을 표시하고 렌더링된 PDF 페이지에서 강조 표시하며 일반적인 문서 보기 UI에서 볼 수 있는 "앞으로 검색" / "뒤로 검색" 버튼과 단축키를 사용하여 검색 결과를 반복하는 데 사용됩니다:

멤버 유형 문서

enum class QPdfSearchModel::Role

상수설명
QPdfSearchModel::Role::PageQt::UserRole검색 결과를 찾을 수 있는 페이지 번호(int)입니다.
QPdfSearchModel::Role::IndexOnPage257페이지에서 검색 결과의 색인(int)입니다.
QPdfSearchModel::Role::Location258페이지에서 검색 결과의 위치 (QPointF).
QPdfSearchModel::Role::ContextBefore259페이지에서 검색 문자열 앞의 인접 텍스트 (QString).
QPdfSearchModel::Role::ContextAfter260검색 문자열 뒤의 페이지에서 인접한 텍스트 (QString).

QPdfLink참조하세요 .

속성 문서

[read-only, since 6.8] count : const int

이 프로퍼티는 검색된 검색 결과의 수를 저장합니다.

이 프로퍼티는 Qt 6.8에 도입되었습니다.

액세스 함수:

int count() const

알림 신호:

void countChanged()

document : QPdfDocument*

이 속성에는 검색할 문서가 저장됩니다.

액세스 함수를 저장합니다:

QPdfDocument *document() const
void setDocument(QPdfDocument *document)

알림 신호:

void documentChanged()

searchString : QString

이 속성에는 검색할 문자열이 저장됩니다.

액세스 함수를 저장합니다:

QString searchString() const
void setSearchString(const QString &searchString)

알림 신호입니다:

void searchStringChanged()

멤버 함수 문서

[explicit] QPdfSearchModel::QPdfSearchModel(QObject *parent)

부모 객체를 사용하여 새 검색 모델을 구축합니다 parent.

[override virtual noexcept] QPdfSearchModel::~QPdfSearchModel()

모델을 파괴합니다.

[override virtual] QVariant QPdfSearchModel::data(const QModelIndex &index, int role) const

재구현합니다: QAbstractItemModel::data(const QModelIndex &index, int role) const.

QPdfLink QPdfSearchModel::resultAtIndex(int index) const

검색된 페이지에 관계없이 document 에서 index 에서 찾은 결과를 반환합니다. indexrowCount 보다 작아야 합니다.

QList<QPdfLink> QPdfSearchModel::resultsOnPage(int page) const

주어진 page 에서 찾은 모든 결과의 목록을 반환합니다.

[override virtual] QHash<int, QByteArray> QPdfSearchModel::roleNames() const

재구현합니다: QAbstractItemModel::roleNames() const.

[override virtual] int QPdfSearchModel::rowCount(const QModelIndex &parent) const

재구현합니다: QAbstractItemModel::rowCount(const QModelIndex &parent) const.

모델의 행 수는 검색된 검색 결과의 수와 같습니다.

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.