QPdfPageNavigator Class

PDF文書内のナビゲーション履歴。詳細...

Header: #include <QPdfPageNavigator>
Since: Qt 6.4
Inherits: QObject

プロパティ

パブリック機能

QPdfPageNavigator(QObject *parent)
virtual ~QPdfPageNavigator() override
bool backAvailable() const
QPointF currentLocation() const
int currentPage() const
qreal currentZoom() const
bool forwardAvailable() const

パブリックスロット

void back()
void clear()
void forward()
void jump(QPdfLink destination)
void jump(int page, const QPointF &location, qreal zoom = 0)
void update(int page, const QPointF &location, qreal zoom)

シグナル

void backAvailableChanged(bool available)
void currentLocationChanged(QPointF location)
void currentPageChanged(int page)
void currentZoomChanged(qreal zoom)
void forwardAvailableChanged(bool available)
void jumped(QPdfLink current)

詳しい説明

QPdfPageNavigatorクラスは、ユーザーがPDF文書内でどの目的地を訪れたかを記憶し、前後に移動する機能を提供します。これは、Webブラウザの戻る・進むボタンに似た戻る・進むアクションを実装するために使用されます。

QPdfDocumentも参照してください

プロパティ文書

[read-only] backAvailable : const bool

履歴に戻り先がある場合、つまりpush()またはforward()が呼び出された場合、true

アクセス関数:

bool backAvailable() const

通知シグナル:

void backAvailableChanged(bool available)

[read-only] currentLocation : const QPointF

このプロパティは、表示されているページ上の現在の位置(最後にjump() またはupdate() に与えられた位置)を保持する。デフォルトは0, 0

アクセス関数:

QPointF currentLocation() const

Notifier シグナル:

void currentLocationChanged(QPointF location)

[read-only] currentPage : const int

このプロパティは、現在表示されているページを保持する。デフォルトは0

アクセス関数:

int currentPage() const

通知シグナル:

void currentPageChanged(int page)

[read-only] currentZoom : const qreal

こ のプ ロ パテ ィ は、 表示 さ れてい る ページの倍率 (1 ピ ク セル=1 ポ イ ン ト ) を保持 し ます。デフォルトは1 です。

アクセス関数:

qreal currentZoom() const

通知シグナル:

void currentZoomChanged(qreal zoom)

[read-only] forwardAvailable : const bool

履歴に転送先がある場合、すなわち、back()が以前に呼び出されたことがある場合、true

アクセス関数:

bool forwardAvailable() const

通知シグナル:

void forwardAvailableChanged(bool available)

メンバ関数ドキュメント

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

親オブジェクトparent を持つページナビゲーションスタックを構築する。

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

ページナビゲーションスタックを破棄する。

[slot] void QPdfPageNavigator::back()

スタックをポップアップし、currentPagecurrentLocationcurrentZoom プロパティを最新の表示先に更新し、jumped() シグナルを発する。

[slot] void QPdfPageNavigator::clear()

履歴を消去し、currentPagecurrentLocationcurrentZoom をデフォルト値に戻す。

[slot] void QPdfPageNavigator::forward()

back() が呼ばれる前に表示されていたページ、場所、ズームレベルに戻り、jumped() シグナルを発する。

最後にback()が呼び出されたときから新しい目的地がプッシュされた場合、forward()関数は何もしない。なぜなら、タイムラインに分岐があり、「未来」が失われるからである。

[slot] void QPdfPageNavigator::jump(QPdfLink destination)

与えられたdestination を訪問した場所の履歴に追加する。

この場合、PDFビューは、destination.location をビューポートに配置するのとは対照的に、destination.rectangles をビューポートに配置するようにスクロールすることによって、jumped シグナルに応答します。そのため、QPdfSearchModel から検索結果にジャンプするためにこのメソッドを呼び出すのが適切です(矩形が見つかったテキストの領域をカバーしているため)。ハイパーリンク先にジャンプするには、代わりにjump(page, location, zoom)を呼び出します。この場合、QPdfLink オブジェクトのrectangles は、ハイパーリンク先ではなく、ハイパーリンク元の位置をカバーするからです。

[slot] void QPdfPageNavigator::jump(int page, const QPointF &location, qreal zoom = 0)

pagelocationzoom からなる、指定された目的地を、訪問した場所の履歴に追加する。

引数zoom は倍率を表す(1 はデフォルトの倍率で、1論理ピクセル=1ポイント)。zoom が与えられないか、0 の場合、currentZoom は既存の値を維持し、currentZoomChanged は発行されない。

ユーザーがリンクをたどっている場合、locationQPdfLink::location() と同じであるべきである。また、移動先の左上隅として指定されているため、常にビューポートの左上隅に見える位置をポイント単位で使用することが一貫性のために最適である。

forwardAvailabletrue の場合、この関数を呼び出すとタイムラインの分岐を意味し、「未来」が失われるため、forwardAvailablefalse に変更されます。

[signal] void QPdfPageNavigator::jumped(QPdfLink current)

このシグナルは、current のページインデックス、ページ上の位置、ズームレベルに対して、突然のジャンプが発生したときに発せられるが、ドキュメントを1ページずつスクロールしただけでは発せられない。つまり、jump ()、forward ()、back ()はこのシグナルを発するが、update ()は発しない。

current.rectangles.length > 0 の場合、それらは特定の目的地領域をカバーする矩形、つまり可視化されるべき検索結果である。そうでない場合、current.locationpage 上の目的地位置である(ハイパーリンクの目的地、または前方/後方ナビゲーション中)。

[slot] void QPdfPageNavigator::update(int page, const QPointF &location, qreal zoom)

pagelocationzoom からなる現在の移動先を変更する。

これは、ユーザがドキュメント内を手動で移動している間、定期的に呼び出すことができ、back() が呼び出された後、forward() は、最後に push() で指定された宛先ではなく、最近表示された宛先にジャンプバックする。

currentZoomChangedcurrentPageChangedcurrentLocationChanged シグナルは、それぞれのプロパティが実際に変更された場合に発せられる。jumped シグナルは発せられない。これは、この操作がナビゲーショ ン・ジャンプではなく、スムーズな移動を表しているからである。

© 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.