QPdfWriter Class
The QPdfWriter class is a class to generate PDFs that can be used as a paint device. 更多...
头文件: | #include <QPdfWriter> |
qmake: | QT += gui |
基类: | QObject and QPagedPaintDevice |
公有函数
QPdfWriter(const QString &filename) | |
QPdfWriter(QIODevice *device) | |
~QPdfWriter() | |
QString | creator() const |
QPageLayout | pageLayout() const |
int | resolution() const |
void | setCreator(const QString &creator) |
bool | setPageLayout(const QPageLayout &newPageLayout) |
bool | setPageMargins(const QMarginsF &margins) |
bool | setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) |
bool | setPageOrientation(QPageLayout::Orientation orientation) |
bool | setPageSize(const QPageSize &pageSize) |
void | setResolution(int resolution) |
void | setTitle(const QString &title) |
QString | title() const |
重新实现的公有函数
virtual bool | newPage() override |
(obsolete) virtual void | setMargins(const Margins &m) override |
(obsolete) virtual void | setPageSize(PageSize size) override |
(obsolete) virtual void | setPageSizeMM(const QSizeF &size) override |
- 32 个公有函数继承自 QObject
- 13 个公有函数继承自 QPagedPaintDevice
- 14 个公有函数继承自 QPaintDevice
重新实现的受保护函数
virtual QPaintEngine * | paintEngine() const override |
- 9 个受保护的函数继承自 QObject
- 1 个受保护的函数继承自 QPaintDevice
其他继承的成员
- 1 个属性继承自 QObject
- 1 个公有槽函数继承自 QObject
- 2 个信号继承自 QObject
- 1 个公有变量继承自 QObject
- 10 个静态公有成员继承自 QObject
- 9 个受保护的函数继承自 QObject
- 1 个受保护的函数继承自 QPaintDevice
- 2 个受保护的变量继承自 QObject
详细描述
The QPdfWriter class is a class to generate PDFs that can be used as a paint device.
QPdfWriter generates PDF out of a series of drawing commands using QPainter. The newPage() method can be used to create several pages.
成员函数
QPdfWriter::QPdfWriter(const QString &filename)
Constructs a PDF writer that will write the pdf to filename.
QPdfWriter::QPdfWriter(QIODevice *device)
Constructs a PDF writer that will write the pdf to device.
QPdfWriter::~QPdfWriter()
Destroys the pdf writer.
QString QPdfWriter::creator() const
Returns the creator of the document.
参见 setCreator().
[override virtual]
bool QPdfWriter::newPage()
Reimplemented from QPagedPaintDevice::newPage().
QPageLayout QPdfWriter::pageLayout() const
Returns the current page layout. Use this method to access the current QPageSize, QPageLayout::Orientation, QMarginsF, fullRect() and paintRect().
Note that you cannot use the setters on the returned object, you must either call the individual QPdfWriter methods or use setPageLayout().
This function was introduced in Qt 5.3.
参见 setPageLayout(), setPageSize(), setPageOrientation(), and setPageMargins().
[override virtual protected]
QPaintEngine *QPdfWriter::paintEngine() const
Reimplemented from QPaintDevice::paintEngine().
int QPdfWriter::resolution() const
Returns the resolution of the PDF in DPI.
This function was introduced in Qt 5.3.
参见 setResolution().
void QPdfWriter::setCreator(const QString &creator)
Sets the creator of the document to creator.
参见 creator().
bool QPdfWriter::setPageLayout(const QPageLayout &newPageLayout)
Sets the PDF page layout to newPageLayout.
You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new page layout to a new page. You should not call any painting methods between a call to setPageLayout() and newPage() as the wrong paint metrics may be used.
Returns true if the page layout was successfully set to newPageLayout.
This function was introduced in Qt 5.3.
参见 pageLayout().
bool QPdfWriter::setPageMargins(const QMarginsF &margins)
Set the PDF page margins in the current page layout units.
You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new margins to a new page. You should not call any painting methods between a call to setPageMargins() and newPage() as the wrong paint metrics may be used.
To get the current page margins use pageLayout().pageMargins().
Returns true if the page margins were successfully set to margins.
This function was introduced in Qt 5.3.
参见 pageLayout().
bool QPdfWriter::setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)
Set the PDF page margins defined in the given units.
You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new margins to a new page. You should not call any painting methods between a call to setPageMargins() and newPage() as the wrong paint metrics may be used.
To get the current page margins use pageLayout().pageMargins().
Returns true if the page margins were successfully set to margins.
This function was introduced in Qt 5.3.
参见 pageLayout().
bool QPdfWriter::setPageOrientation(QPageLayout::Orientation orientation)
Sets the PDF page orientation.
The page orientation is used to define the orientation of the page size when obtaining the page rect.
You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new orientation to a new page. You should not call any painting methods between a call to setPageOrientation() and newPage() as the wrong paint metrics may be used.
To get the current QPageLayout::Orientation use pageLayout().pageOrientation().
Returns true if the page orientation was successfully set to orientation.
This function was introduced in Qt 5.3.
参见 pageLayout().
bool QPdfWriter::setPageSize(const QPageSize &pageSize)
Sets the PDF page size to pageSize.
To get the current QPageSize use pageLayout().pageSize().
You should call this before calling QPainter::begin(), or immediately before calling newPage() to apply the new page size to a new page. You should not call any painting methods between a call to setPageSize() and newPage() as the wrong paint metrics may be used.
Returns true if the page size was successfully set to pageSize.
This function was introduced in Qt 5.3.
参见 pageLayout().
void QPdfWriter::setResolution(int resolution)
Sets the PDF resolution in DPI.
This setting affects the coordinate system as returned by, for example QPainter::viewport().
This function was introduced in Qt 5.3.
参见 resolution().
void QPdfWriter::setTitle(const QString &title)
Sets the title of the document being created to title.
参见 title().
QString QPdfWriter::title() const
Returns the title of the document.
参见 setTitle().