PdfSelection QML Type

PDF ドキュメント内のテキスト選択の表現。詳細...

Import Statement: import QtQuick.Pdf
Inherits:

Item

プロパティ

方法

詳細な説明

PdfSelection は、テキスト文字列とそのジオメトリを、ある点から別の点までのバウンディングボックス内に提供します。

マウスを使用して選択範囲を変更するには、fromto を入力ハンドラの適切なプロパティにバインドして、それぞれドラッグ ジェスチャの開始位置と終了位置に設定します。また、hold プロパティをバインドして、ドラッグ ジェスチャ中はtrue に設定し、ジェスチャが終了するとfalse に設定します。

PdfSelectionは、iOSなどのプラットフォームでテキスト選択ハンドルを使用できるように、Inputメソッドのクエリも直接処理します。このためには、キーボードフォーカスが必要です。

プロパティ Documentation

document : PdfDocument

このプロパティは、テキストを選択するPDF文書を保持します。


from : point

選択されたテキストを見つけるための、ページの左上隅からの開始位置をピクセル単位で指定します。これはDragHandlercentroid.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

fromto への変更にかかわらず既存の選択範囲を保持するかどうかを制御します。こ のプ ロ パテ ィ をtrue に設定す る と 、 マウスま たは タ ッ チポ イ ン ト が放 さ れた と き に、 ポ イ ン ト バ イ ンデ ィ ン グの変更に よ っ て選択が失われ る こ と がない よ う にな り ます。


page : int

検索ページ番号。

QtQuick::Image::currentFrameも参照。


renderScale : real

ページがレンダリングされるポイントからピクセルへの比率。

文書内の位置はつねにポ イ ン ト 単位で与え ら れ る ので、 こ れはfromto を拡大縮小 し て、 文書内の選択キ ャ ラ ク タ の範囲を見つけ る ために用い ら れます。


text : string

fromto の間の矩形領域で見つかったテキス ト、 またはselectAll () が呼び出された場合はpage 上のすべてのテキス ト。


to : point

ページの左上隅か ら ピ ク セル単位で、 選択 し た テ キ ス ト を見つけ る 終了位置。こ れをDragHandlercentroid.position にバ イ ン ド し て、 た と えばユーザーが現在マ ウ ス を ド ラ ッ グ し てい る位置でテ キ ス ト の選択を終了 さ せ る こ と がで き ます。


メソッド ドキュメント

void clear()

現在の選択範囲をクリアします。


void copyToClipboard()

text プロパティからシステムのクリップボードにプレーンテキストをコピーします。


void selectAll()

現在のpage のすべてのテキストを選択します。


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