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.
没有合适的资源?快使用搜索试试~ 我知道了~
Linux窗口程序设计-Qt4精彩实例分析_源代码
共897个文件
cpp:150个
png:98个
h:90个
5星 · 超过95%的资源 需积分: 10 59 下载量 145 浏览量
2009-05-11
12:42:17
上传
评论 1
收藏 5.12MB RAR 举报
温馨提示
实例源代码 第1章:基本对话框; 第2章:布局管理; 第3章:对话框进阶; 第4章:QMainWindow; 第5章:图形与图画; 第6章:Graphics View; 第7章:Model/View; 第8章:网络与通信; 第9章:磁盘文件; 第10章:事件; 第11章:其它。 每个实例源代码目录下包含有: 源文件 工程文件(.pro) Makefile文件(Makefile、Makefile.Release) 可执行文件 ui文件(如需要)
资源推荐
资源详情
资源评论
收起资源包目录
Linux窗口程序设计-Qt4精彩实例分析_源代码 (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
资源评论
- 次哦额2014-02-26很实用,浅显易懂
- j1012122012-01-04例子很详细,代码很容易理解,不错
joojoosue
- 粉丝: 1
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- bdwptqmxgj11.zip
- onnxruntime-win-x86
- onnxruntime-win-x64-gpu-1.20.1.zip
- vs2019 c++20 语法规范 头文件 <ratio> 的源码阅读与注释,处理分数的存储,加减乘除,以及大小比较等运算
- 首次尝试使用 Win,DirectX C++ 中的形状渲染套件.zip
- 预乘混合模式是一种用途广泛的三合一混合模式 它已经存在很长时间了,但似乎每隔几年就会被重新发现 该项目包括使用预乘 alpha 的描述,示例和工具 .zip
- 项目描述 DirectX 引擎支持版本 9、10、11 库 Microsoft SDK 功能相机视图、照明、加载网格、动画、蒙皮、层次结构界面、动画控制器、网格容器、碰撞系统 .zip
- 项目 wiki 文档中使用的代码教程的源代码库.zip
- 面向对象的通用GUI框架.zip
- 基于Java语言的PlayerBase游戏角色设计源码
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功