LibrePCB Developers Documentation
|
Asynchronously exports graphics to a QPainter. More...
#include <graphicsexport.h>
Inherits QObject.
Classes | |
struct | Result |
struct | RunArgs |
Public Types | |
typedef std::pair< std::shared_ptr< GraphicsPagePainter >, std::shared_ptr< GraphicsExportSettings > > | Page |
typedef QList< Page > | Pages |
Signals | |
void | previewReady (int index, const QSize &pageSize, const QRectF margins, std::shared_ptr< QPicture > picture) |
void | savingFile (const librepcb::FilePath &filePath) |
void | progress (int percent, int completed, int total) |
void | succeeded () |
void | failed (const QString &error) |
void | imageCopiedToClipboard (const QImage &image, QClipboard::Mode mode) |
Public Member Functions | |
GraphicsExport (QObject *parent=nullptr) noexcept | |
GraphicsExport (const GraphicsExport &other)=delete | |
~GraphicsExport () noexcept | |
void | setDocumentName (const QString &name) noexcept |
Set the document name used for printing, PDF and SVG export. More... | |
void | startPreview (const Pages &pages) noexcept |
Start creating previews asynchronously. More... | |
void | startExport (const Pages &pages, const FilePath &filePath) noexcept |
Start exporting to a file or clipboard asynchronously. More... | |
void | startPrint (const Pages &pages, const QString &printerName, QPrinter::DuplexMode duplex, int copies) noexcept |
Start printing to a printer asynchronously. More... | |
Result | waitForFinished () noexcept |
Wait (block) until the preview/export/print is finished. More... | |
void | cancel () noexcept |
Cancel the current job. More... | |
GraphicsExport & | operator= (const GraphicsExport &rhs)=delete |
Static Public Member Functions | |
static QStringList | getSupportedExtensions () noexcept |
Get all supported file extensions for startExport() More... | |
static QStringList | getSupportedImageExtensions () noexcept |
Get all supported image file extensions for startExport() More... | |
Private Member Functions | |
Result | run (RunArgs args) noexcept |
Static Private Member Functions | |
static QTransform | getSourceTransformation (const GraphicsExportSettings &settings) noexcept |
static QRectF | calcSourceRect (const GraphicsPagePainter &page, const GraphicsExportSettings &settings) noexcept |
static QPageLayout::Orientation | getOrientation (const QSizeF &size) noexcept |
Private Attributes | |
QString | mCreator |
QString | mDocumentName |
QFuture< Result > | mFuture |
bool | mAbort |
Asynchronously exports graphics to a QPainter.
Used for graphics printing, PDF export, SVG export etc. without blocking the main thread.
typedef std::pair<std::shared_ptr<GraphicsPagePainter>, std::shared_ptr<GraphicsExportSettings> > Page |
|
noexcept |
|
delete |
|
noexcept |
|
inlinenoexcept |
Set the document name used for printing, PDF and SVG export.
name | Document name. |
|
noexcept |
Start creating previews asynchronously.
The signal previewReady() will be emitted from a worker thread for each processed page.
pages | The pages to create the preview of. |
Start exporting to a file or clipboard asynchronously.
The supported file type will be determined automatically by the file extension. Supported file types are pdf
, svg
and all supported file extensions of QImage. See also getSupportedExtensions().
The signals::savingFile() will be emitted from a worker thread for each file created.
pages | The pages to export. |
filePath | Export file path. If invalid, pixmaps will be copied into the clipboard. If multiple pages are exported, the page number will automatically be appended to the filename. |
|
noexcept |
Start printing to a printer asynchronously.
pages | The pages to export. |
printerName | Name of the printer to use. |
duplex | The duplex mode to use. |
copies | Number of copies to print. |
|
noexcept |
Wait (block) until the preview/export/print is finished.
|
noexcept |
Cancel the current job.
|
delete |
|
staticnoexcept |
Get all supported file extensions for startExport()
|
staticnoexcept |
Get all supported image file extensions for startExport()
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
privatenoexcept |
|
staticprivatenoexcept |
|
staticprivatenoexcept |
|
staticprivatenoexcept |
|
private |
|
private |
|
private |
|
private |