The QPdfPageRenderer class encapsulates the rendering of pages of a PDF document. More...
Header: | #include <QPdfPageRenderer> |
Since: | Qt 5.11 |
Inherits: | QObject |
enum class | RenderMode { MultiThreaded, SingleThreaded } |
QPdfPageRenderer(QObject *parent) | |
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.
See also QPdfDocument.
This enum describes how the pages are rendered.
Constant | Value | Description |
---|---|---|
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). |
See also renderMode() and setRenderMode().
This property holds the document instance this object renders the pages from.
By default, this property is nullptr
.
Access functions:
QPdfDocument * | document() const |
void | setDocument(QPdfDocument *document) |
Notifier signal:
void | documentChanged(QPdfDocument *document) |
See also document(), setDocument(), and QPdfDocument.
This property holds the mode the renderer uses to render the pages.
By default, this property is RenderMode::SingleThreaded
.
Access functions:
QPdfPageRenderer::RenderMode | renderMode() const |
void | setRenderMode(QPdfPageRenderer::RenderMode mode) |
Notifier signal:
void | renderModeChanged(QPdfPageRenderer::RenderMode renderMode) |
See also setRenderMode() and RenderMode.
Constructs a page renderer object with parent object parent.
[override virtual]
QPdfPageRenderer::~QPdfPageRenderer()Destroys the page renderer object.
Returns the document this objects renders the pages from, or a nullptr
if none has been set before.
Note: Getter function for property document.
See also setDocument() and QPdfDocument.
Returns the mode of how the pages are rendered.
Note: Getter function for property renderMode.
See also setRenderMode() and RenderMode.
Requests the renderer to render the page pageNumber into a QImage of size 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.
Sets the document this object renders the pages from.
Note: Setter function for property document.
See also document() and QPdfDocument.
Sets the mode of how the pages are rendered to mode.
Note: Setter function for property renderMode.
See also renderMode() and RenderMode.