Detailed Description
The QPrinter class is a paint device that paints on a printer.
This device represents a series of pages of printed output, and is used in almost exactly the same way as other paint devices such as QWidget and QPixmap. A set of additional functions are provided to manage device-specific features, such as orientation and resolution, and to step through the pages in a document as it is generated.
When printing directly to a printer on Windows or Mac OS X, QPrinter uses the built-in printer drivers. On X11, QPrinter uses the Common Unix Printing System (CUPS) or the standard Unix lpr utility to send PostScript or PDF output to the printer. As an alternative, the printProgram() function can be used to specify the command or utility to use instead of the system default.
QPrinter supports a number of parameters, most of which can be changed by the end user through a print dialog. In general, QPrinter passes these functions onto the underlying QPrintEngine.
The most important parameters are:
setOrientation() tells QPrinter which page orientation to use.
setPageSize() tells QPrinter what page size to expect from the printer.
setResolution() tells QPrinter what resolution you wish the printer to provide, in dots per inch (DPI).
setFullPage() tells QPrinter whether you want to deal with the full page or just with the part the printer can draw on.
setNumCopies() tells QPrinter how many copies of the document it should print.
Many of these functions can only be called before the actual printing begins (i.e., before QPainter::begin() is called). This usually makes sense because, for example, it's not possible to change the number of copies when you are halfway through printing. There are also some settings that the user sets (through the printer dialog) and that applications are expected to obey. See QAbstractPrintDialog's documentation for more details.
When QPainter::begin() is called, the QPrinter it operates on is prepared for a new page, enabling the QPainter to be used immediately to paint the first page in a document. Once the first page has been painted, newPage() can be called to request a new blank page to paint on, or QPainter::end() can be called to finish printing. The second page and all following pages are prepared using a call to newPage() before they are painted.
The first page in a document does not need to be preceded by a call to newPage(). You only need to calling newPage() after QPainter::begin() if you need to insert a blank page at the beginning of a printed document. Similarly, calling newPage() after the last page in a document is painted will result in a trailing blank page appended to the end of the printed document.
If you want to abort the print job, abort() will try its best to stop printing. It may cancel the entire job or just part of it.
Since QPrinter can print to any QPrintEngine subclass, it is possible to extend printing support to cover new types of printing subsystem by subclassing QPrintEngine and reimplementing its interface.
See also QPrintDialog and Printing with Qt.
没有合适的资源?快使用搜索试试~ 我知道了~
QT 编程实例分析.rar
共897个文件
cpp:150个
png:98个
h:90个
3星 · 超过75%的资源 需积分: 50 8 下载量 74 浏览量
2010-02-28
17:05:49
上传
评论
收藏 5.13MB RAR 举报
温馨提示
这是用于qt编程学习的一些实例,可为正在学qt的或打算学qt的人们提供资料
资源推荐
资源详情
资源评论
收起资源包目录
QT 编程实例分析.rar (897个子文件)
128-1.bmp 2KB
127-1.bmp 2KB
butterfly 34KB
combine 60KB
mainwidget.cpp 10KB
cursor.cpp 7KB
mainwidget.cpp 6KB
histogramview.cpp 6KB
imgprocessor.cpp 6KB
palette.cpp 5KB
fileinformation.cpp 5KB
listalign.cpp 5KB
drawer.cpp 4KB
table.cpp 4KB
httpclient.cpp 4KB
eventfilter.cpp 4KB
mapwidget.cpp 4KB
messagebox.cpp 4KB
tcpclient.cpp 4KB
ftpclient.cpp 4KB
fontset.cpp 4KB
stringcodec.cpp 4KB
mainwidget.cpp 4KB
mainwindow.cpp 3KB
inputdialog.cpp 3KB
mainwindow.cpp 3KB
mainwindow.cpp 3KB
layoutdlg.cpp 3KB
geometry.cpp 3KB
mainwidget.cpp 3KB
style.cpp 3KB
baseinfo.cpp 3KB
baseinfo.cpp 3KB
pararw.cpp 3KB
mainwidget.cpp 3KB
extension.cpp 2KB
standarddialogs.cpp 2KB
mainwindow.cpp 2KB
networkinformation.cpp 2KB
keyevent.cpp 2KB
mainwidget.cpp 2KB
main.cpp 2KB
painter.cpp 2KB
progress.cpp 2KB
configdialog.cpp 2KB
stringlistmodel.cpp 2KB
dragwidget.cpp 2KB
settings.cpp 2KB
paintarea.cpp 2KB
mouseevent.cpp 2KB
printimage.cpp 2KB
paintarea.cpp 2KB
fileviewer.cpp 2KB
pictrans.cpp 2KB
contact.cpp 2KB
contact.cpp 2KB
dragwidget.cpp 2KB
butterfly.cpp 2KB
drawwidget.cpp 2KB
udpserver.cpp 1KB
combodelegate.cpp 1KB
mainwindow.cpp 1KB
printtext.cpp 1KB
toolbar.cpp 1KB
datedelegate.cpp 1KB
dockwindows.cpp 1KB
udpclient.cpp 1KB
tcpserver.cpp 1KB
paintarea.cpp 1KB
detail.cpp 1KB
detail.cpp 1KB
digiclock.cpp 1KB
paintarea.cpp 1KB
graphicsitem.cpp 1KB
spindelegate.cpp 1KB
svgwindow.cpp 1KB
main.cpp 1KB
server.cpp 1KB
dragicon.cpp 1KB
content.cpp 1KB
main.cpp 1KB
draglabel.cpp 1002B
stack.cpp 986B
main.cpp 956B
fader.cpp 950B
shapewidget.cpp 935B
rubberband.cpp 879B
main.cpp 857B
mywidget.cpp 791B
items.cpp 750B
mainwindow.cpp 720B
mywidget.cpp 678B
tcpclientsocket.cpp 651B
svgwidget.cpp 609B
main.cpp 561B
main.cpp 455B
main.cpp 437B
main.cpp 437B
main.cpp 416B
main.cpp 412B
共 897 条
- 1
- 2
- 3
- 4
- 5
- 6
- 9
资源评论
- 深圳十八子2012-04-17还可以,就没有有分析,只是一些源码。
Jerry_Lee01
- 粉丝: 309
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功