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で見られるような "search forward" / "search backward "ボタンやショートカットを使ってそれらを反復処理するために使用されます:

メンバー型ドキュメント

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

documentindex で見つかった結果を、見つかったページに関係なく返す。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.