QPicture Class Reference
[QtGui module]
该QPicture类是一个绘图设备,记录和重放QPainter的命令。More…
继承QPaintDevice。
Methods
__init__ (self, int formatVersion = -1)
__init__ (self, QPicture)
QRect boundingRect (self)
str data (self)
detach (self)
int devType (self)
bool isDetached (self)
bool isNull (self)
bool load (self, QIODevice dev, str format = None)
bool load (self, QString fileName, str format = None)
int metric (self, QPaintDevice.PaintDeviceMetric m)
QPaintEngine paintEngine (self)
bool play (self, QPainter p)
bool save (self, QIODevice dev, str format = None)
bool save (self, QString fileName, str format = None)
setBoundingRect (self, QRect r)
setData (self, str data)
int size (self)
swap (self, QPicture other)
Static Methods
QStringList inputFormatList ()
list-of-QByteArray inputFormats ()
QStringList outputFormatList ()
list-of-QByteArray outputFormats ()
str pictureFormat (QString fileName)
Detailed Description
该QPicture类是一个绘图设备,记录和重放QPainter的命令。
的图片序列画家命令IO设备在一个平台无关的格式。它们有时被称为元文件。
Qt的图片用一个专有的二进制格式。不像本地图片(元文件)在许多窗口系统格式, Qt的图片有关于他们的内容没有限制。所有可以被画上一个小部件或像素(例如,字体,像素图,区域,变换图形等)也可以被存储在一个图像。
QPicture是与分辨率无关,即QPicture可以显示在不同的设备(例如SVG , PDF,PS ,打印机和屏幕)寻找相同。这是,例如,需要所见即所得的打印预览。 QPicture运行在默认的系统DPI ,并缩放画家,以符合视视窗系统上的分辨率的差异。
如何进行拍摄的例子:
QPicture picture;
[QPainter]($docs-qpainter.html) painter;
painter.begin(&picture); // paint in picture
painter.drawEllipse(10,20, 80,70); // draw an ellipse
painter.end(); // painting done
picture.save("drawing.pic"); // save picture
需要注意的是画家的命令列表被重置在每次调用QPainter.begin()函数。
如何重播图片的例子:
QPicture picture;
picture.load("drawing.pic"); // load picture
[QPainter]($docs-qpainter.html) painter;
painter.begin(&myImage); // paint in myImage
painter.drawPicture(0, 0, picture); // draw the picture at (0,0)
painter.end(); // painting done
图片也可以使用拉伸play( ) 。关于一个图像的一些基本数据是可用的,例如,size( )isNull()和boundingRect( ) 。
Method Documentation
QPicture.__init__ (self, int formatVersion = -1)
构造一个空的图片。
该formatVersion参数可以被用于create一QPicture可以由与Qt的早期版本编译的应用程序可以读取。
请注意,默认formatVersion是-1,表示当前版本,即Qt的4.0 7 formatVersion是一样的为默认值-1 formatVersion 。
是不是在Qt的4.0支持Qt的早期版本生成的读图时代。
QPicture.__init__ (self, QPicture)
构造的副本pic。
这个构造函数是快的感谢implicit sharing。
QRect QPicture.boundingRect (self)
[
返回图片的边界矩形或无效矩形如果图片不包含任何数据。
]($docs-qrect.html)
See also setBoundingRect( ) 。
str QPicture.data (self)
返回一个指向图片数据。指针才有效,直到下一个非const函数被调用的这张图片。返回的指针为0,如果图像不包含任何数据。
See also setData( )size()和isNull( ) 。
QPicture.detach (self)
int QPicture.devType (self)
QStringList QPicture.inputFormatList ()
list-of-QByteArray QPicture.inputFormats ()
bool QPicture.isDetached (self)
bool QPicture.isNull (self)
返回True如果图像不包含任何数据,否则返回False 。
bool QPicture.load (self, QIODevice dev, str format = None)
加载一幅图片从指定的文件fileName如果成功返回True,否则返回False 。
请注意,这个format参数已被取代,不会有任何效果。
See also save( ) 。
bool QPicture.load (self, QString fileName, str format = None)
这是一个重载函数。
dev是该装置用于载入。
int QPicture.metric (self, QPaintDevice.PaintDeviceMetric m)
QStringList QPicture.outputFormatList ()
list-of-QByteArray QPicture.outputFormats ()
QPaintEngine QPicture.paintEngine (self)
[
str QPicture.pictureFormat (QString fileName)
bool QPicture.play (self, QPainter p)
重播的画面使用painter,并成功返回True ,否则返回False 。
]($docs-qpaintengine.html)
这个函数完全一样QPainter.drawPicture( )与(X,Y )=(0 ,0)。
bool QPicture.save (self, QIODevice dev, str format = None)
保存图片到由指定的文件fileName如果成功返回True,否则返回False 。
请注意,这个format参数已被取代,不会有任何效果。
See also load( ) 。
bool QPicture.save (self, QString fileName, str format = None)
这是一个重载函数。
dev是设备用于储蓄。
QPicture.setBoundingRect (self, QRect r)
设置图片的边界矩形r。自动计算的值被复盖。
See also boundingRect( ) 。
QPicture.setData (self, str data)
直接将画面设置数据data和size。此功能将输入数据复制。
int QPicture.size (self)
返回的图片数据的大小。
See also data( ) 。
QPicture.swap (self, QPicture other)
掉期图片other与此图片。这个操作是非常快的,而且永远不会。
此功能被引入Qt的4.8 。