QPdfPageRenderer 类

QPdfPageRenderer 类封装 PDF 文档页面的渲染。 更多...

头: #include <QPdfPageRenderer>
Since: Qt 5.11
继承: QObject

该类在 Qt 5.11 引入。

公共类型

enum class RenderMode { MultiThreaded, SingleThreaded }

特性

公共函数

QPdfPageRenderer (QObject * parent = nullptr)
virtual ~QPdfPageRenderer () override
QPdfDocument * document () const
QPdfPageRenderer::RenderMode renderMode () const
quint64 requestPage (int pageNumber , QSize imageSize , QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions())
void setDocument (QPdfDocument * document )
void setRenderMode (QPdfPageRenderer::RenderMode mode )

信号

void documentChanged (QPdfDocument * document )
void renderModeChanged (QPdfPageRenderer::RenderMode renderMode )

详细描述

The QPdfPageRenderer contains a queue that collects all render requests that are invoked through requestPage (). Depending on the configured RenderMode the QPdfPageRenderer processes this queue in the main UI thread on next event loop invocation ( RenderMode::SingleThreaded ) or in a separate worker thread ( RenderMode::MultiThreaded ) and emits the result through the pageRendered() signal for each request once the rendering is done.

另请参阅 QPdfDocument .

成员类型文档编制

enum class QPdfPageRenderer:: RenderMode

此枚举描述如何渲染页面。

常量 描述
QPdfPageRenderer::RenderMode::MultiThreaded 0 All pages are rendered in a separate worker thread.
QPdfPageRenderer::RenderMode::SingleThreaded 1 All pages are rendered in the main UI thread (default).

另请参阅 renderMode () 和 setRenderMode ().

特性文档编制

document : QPdfDocument *

This property holds the document instance this object renders the pages from.

默认情况下,此特性为 nullptr .

访问函数:

QPdfDocument * document () const
void setDocument (QPdfDocument * document )

通知程序信号:

void documentChanged (QPdfDocument * document )

另请参阅 document (), setDocument (),和 QPdfDocument .

renderMode : RenderMode

This property holds the mode the renderer uses to render the pages.

默认情况下,此特性为 RenderMode::SingleThreaded .

访问函数:

QPdfPageRenderer::RenderMode renderMode () const
void setRenderMode (QPdfPageRenderer::RenderMode mode )

通知程序信号:

void renderModeChanged (QPdfPageRenderer::RenderMode renderMode )

另请参阅 setRenderMode () 和 RenderMode .

成员函数文档编制

QPdfPageRenderer:: QPdfPageRenderer ( QObject * parent = nullptr)

Constructs a page renderer object with parent object parent .

[override virtual] QPdfPageRenderer:: ~QPdfPageRenderer ()

Destroys the page renderer object.

QPdfDocument *QPdfPageRenderer:: document () const

Returns the document this objects renders the pages from, or a nullptr if none has been set before.

注意: Getter function for property document.

另请参阅 setDocument () 和 QPdfDocument .

QPdfPageRenderer::RenderMode QPdfPageRenderer:: renderMode () const

Returns the mode of how the pages are rendered.

注意: getter 函数对于特性 renderMode。

另请参阅 setRenderMode () 和 RenderMode .

quint64 QPdfPageRenderer:: requestPage ( int pageNumber , QSize imageSize , QPdfDocumentRenderOptions options = QPdfDocumentRenderOptions())

Requests the renderer to render the page pageNumber QImage 的大小 imageSize according to the provided options .

Once the rendering is done the pageRendered() signal is emitted with the result as parameters.

The return value is an ID that uniquely identifies the render request. If a request with the same parameters is still in the queue, the ID of that queued request is returned.

void QPdfPageRenderer:: setDocument ( QPdfDocument * document )

设置 document this object renders the pages from.

注意: setter 函数对于特性 document .

另请参阅 document () 和 QPdfDocument .

void QPdfPageRenderer:: setRenderMode ( QPdfPageRenderer::RenderMode mode )

Sets the mode of how the pages are rendered to mode .

注意: setter 函数对于特性 renderMode .

另请参阅 renderMode () 和 RenderMode .