PdfSelection QML Type
PDF ドキュメント内のテキスト選択の表現。詳細...
| Import Statement: | import QtQuick.Pdf |
| Inherits: |
プロパティ
- document : PdfDocument
- from : point
- geometry : list<list<point>>
- hold : bool
- page : int
- renderScale : real
- text : string
- to : point
方法
- void clear()
- void copyToClipboard()
- void selectAll()
詳細な説明
PdfSelection は、テキスト文字列とそのジオメトリを、ある点から別の点までのバウンディングボックス内に提供します。
マウスを使用して選択範囲を変更するには、from とto を入力ハンドラの適切なプロパティにバインドして、それぞれドラッグ ジェスチャの開始位置と終了位置に設定します。また、hold プロパティをバインドして、ドラッグ ジェスチャ中はtrue に設定し、ジェスチャが終了するとfalse に設定します。
PdfSelectionは、iOSなどのプラットフォームでテキスト選択ハンドルを使用できるように、Inputメソッドのクエリも直接処理します。このためには、キーボードフォーカスが必要です。
プロパティのドキュメント
document : PdfDocument
このプロパティは、テキストを選択するPDF文書を保持します。
from : point
ページの左上隅からピクセル単位で、選択されたテキストを見つける開始位置。これはDragHandler のcentroid.pressPosition にバインドすることができ、例えばユーザーがマウスボタンを押してドラッグを開始した位置からテキストの選択を開始することができます。
geometry : list<list<point>>
PathMultiline インスタンスのpaths プロパティにバインドして、選択範囲に含まれるテキスト領域の周囲に一括して矩形をレンダリングできる形式のパスの集合:
PdfDocument {
id: doc
}
PdfSelection {
id: selection
document: doc
from: textSelectionDrag.centroid.pressPosition
to: textSelectionDrag.centroid.position
hold: !textSelectionDrag.active
}
Shape {
ShapePath {
PathMultiline {
paths: selection.geometry
}
}
}
DragHandler {
id: textSelectionDrag
acceptedDevices: PointerDevice.Mouse | PointerDevice.Stylus
target: null
}PathMultilineも参照 。
hold : bool
from とto の変更に関係なく、既存の選択を保持するかどうかを制御する。こ のプ ロ パテ ィ をtrue に設定す る と 、 マウスま たは タ ッ チポ イ ン ト を放した と き に、 ポ イ ン ト バ イ ンデ ィ ン グが変更 さ れて も 選択が失われな く な り ます。
page : int
検索するページ番号。
QtQuick::Image::currentFrameも参照のこと 。
renderScale : real
ページがレンダリングされるポイントからピクセルへの比率。
文書内の位置は常にポイントで与えられるので、これはfrom やto を拡大縮小して、文書内で選択された文字の範囲を見つけるのに使われます。
text : string
from とto の間の矩形領域で見つかったテキスト、またはselectAll() が呼び出された場合はpage 上のすべてのテキスト。
to : point
ページの左上隅からピクセル単位で、選択されたテキストを見つける終了位置。これをDragHandler のcentroid.position にバインドすることで、例えばユーザが現在マウスをドラッグしている位置でテキストの選択を終了させることができます。
メソッド・ドキュメント
void clear()
現在の選択範囲をクリアする。
void copyToClipboard()
text プロパティからシステムのクリップボードにプレーンテキストをコピーします。
void selectAll()
現在のpage 上のすべてのテキストを選択する。
© 2026 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.