PdfSearchModel QML Type

PDF 文档中文本搜索结果的表示。更多

Import Statement: import QtQuick.Pdf

属性

方法

详细说明

PdfSearchModel 提供在文档中搜索文本字符串的功能,并获取匹配字符串在每一页上的几何位置。

属性文档

count : int [since 6.8]

搜索结果的数量。

该属性在 Qt 6.8 中引入。


currentPage : int

currentResultBoundingPolygons 应提供过滤搜索结果的页面。


currentPageBoundingPolygons : list<list<point>>

一组表单路径,可绑定到PathMultiline 实例的paths 属性,以在currentPage 上找到搜索结果的所有区域周围渲染一批矩形:

PdfDocument {
    id: doc
}
PdfSearchModel {
    id: searchModel
    document: doc
}
Shape {
    ShapePath {
        PathMultiline {
            paths: searchModel.matchGeometry(view.currentPage)
        }
    }
}

另请参阅 PathMultiline


currentResult : int

整组搜索结果中的结果索引,如果currentPagecurrentResultLink.page 相匹配,currentResultBoundingPolygons 应提供要突出显示的区域。


currentResultBoundingPolygons : list<list<point>>

一组路径的形式可以绑定到PathMultiline 实例的paths 属性,以便在currentPage 上呈现搜索结果currentResult 区域周围的一批矩形。这通常用于在用户界面中一次突出显示一个搜索结果,允许用户逐步浏览搜索结果:

PdfDocument {
    id: doc
}
PdfSearchModel {
    id: searchModel
    document: doc
    currentPage: view.currentPage
    currentResult: ...
}
Shape {
    ShapePath {
        PathMultiline {
            paths: searchModel.currentResultBoundingPolygons
        }
    }
}

每当currentPage != currentResultLink.page 时,它就会变成空的。

另请参见 PathMultiline


currentResultBoundingRect : point

如果currentPage == currentResultLink.page ,则是包含所有currentResultBoundingPolygons 的边界框;否则是无效矩形。


索引currentResult 的结果。


searchString : string

要搜索的字符串。


方法文档

list<list<point>> boundingPolygonsOnPage(int page)

返回一组路径,其形式可绑定到PathMultiline 实例的paths 属性,用于在page 上的所有匹配位置周围渲染一批矩形:

PdfDocument {
    id: doc
}
PdfSearchModel {
    id: searchModel
    document: doc
}
Shape {
    ShapePath {
        PathMultiline {
            paths: searchModel.matchGeometry(view.currentPage)
        }
    }
}

另请参阅 PathMultiline


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