# QPainter Class Reference
## [[QtGui](index.htm) module]
QPainter類的控件和其他繪圖設備進行低級別的油畫。[More...](#details)
通過繼承[QStylePainter](qstylepainter.html)。
### Types
* `enum CompositionMode { CompositionMode_SourceOver, CompositionMode_DestinationOver, CompositionMode_Clear, CompositionMode_Source, ..., RasterOp_SourceAndNotDestination }`
* `class **[PixmapFragment](index.htm)**`
* `enum PixmapFragmentHint { OpaqueHint }`
* `class **[PixmapFragmentHints](index.htm)**`
* `enum RenderHint { Antialiasing, TextAntialiasing, SmoothPixmapTransform, HighQualityAntialiasing, NonCosmeticDefaultPen }`
* `class **[RenderHints](index.htm)**`
### Methods
* `__init__ (self)`
* `__init__ (self, QPaintDevice)`
* `QBrush background (self)`
* `Qt.BGMode backgroundMode (self)`
* `bool begin (self, QPaintDevice)`
* `beginNativePainting (self)`
* `QRectF boundingRect (self, QRectF?rect, int?flags, QString?text)`
* `QRect boundingRect (self, QRect?rect, int?flags, QString?text)`
* `QRectF boundingRect (self, QRectF?rectangle, QString?text, QTextOption?option?=?QTextOption())`
* `QRect boundingRect (self, int?x, int?y, int?w, int?h, int?flags, QString?text)`
* `QBrush brush (self)`
* `QPoint brushOrigin (self)`
* `QRectF clipBoundingRect (self)`
* `QPainterPath clipPath (self)`
* `QRegion clipRegion (self)`
* `QMatrix combinedMatrix (self)`
* `QTransform combinedTransform (self)`
* `CompositionMode compositionMode (self)`
* `QPaintDevice device (self)`
* `QMatrix deviceMatrix (self)`
* `QTransform deviceTransform (self)`
* `drawArc (self, QRectF?rect, int?a, int?alen)`
* `drawArc (self, QRect?r, int?a, int?alen)`
* `drawArc (self, int?x, int?y, int?w, int?h, int?a, int?alen)`
* `drawChord (self, QRectF?rect, int?a, int?alen)`
* `drawChord (self, QRect?rect, int?a, int?alen)`
* `drawChord (self, int?x, int?y, int?w, int?h, int?a, int?alen)`
* `drawConvexPolygon (self, QPointF?point, ...)`
* `drawConvexPolygon (self, QPolygonF?poly)`
* `drawConvexPolygon (self, QPoint?point, ...)`
* `drawConvexPolygon (self, QPolygon?poly)`
* `drawEllipse (self, QRectF?r)`
* `drawEllipse (self, QRect?r)`
* `drawEllipse (self, int?x, int?y, int?w, int?h)`
* `drawEllipse (self, QPointF?center, float?rx, float?ry)`
* `drawEllipse (self, QPoint?center, int?rx, int?ry)`
* `drawGlyphRun (self, QPointF?position, QGlyphRun?glyphRun)`
* `drawImage (self, QRectF?targetRect, QImage?image, QRectF?sourceRect, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)`
* `drawImage (self, QRect?targetRect, QImage?image, QRect?sourceRect, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)`
* `drawImage (self, QPointF?p, QImage?image, QRectF?sr, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)`
* `drawImage (self, QPoint?p, QImage?image, QRect?sr, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)`
* `drawImage (self, QRectF?r, QImage?image)`
* `drawImage (self, QRect?r, QImage?image)`
* `drawImage (self, QPointF?p, QImage?image)`
* `drawImage (self, QPoint?p, QImage?image)`
* `drawImage (self, int?x, int?y, QImage?image, int?sx?=?0, int?sy?=?0, int?sw?=?-1, int?sh?=?-1, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)`
* `drawLine (self, QLineF?l)`
* `drawLine (self, QLine?line)`
* `drawLine (self, int?x1, int?y1, int?x2, int?y2)`
* `drawLine (self, QPoint?p1, QPoint?p2)`
* `drawLine (self, QPointF?p1, QPointF?p2)`
* `drawLines (self, QLineF?line, ...)`
* `drawLines (self, list-of-QLineF?lines)`
* `drawLines (self, QPointF?pointPair, ...)`
* `drawLines (self, list-of-QPointF?pointPairs)`
* `drawLines (self, QLine?line, ...)`
* `drawLines (self, list-of-QLine?lines)`
* `drawLines (self, QPoint?pointPair, ...)`
* `drawLines (self, list-of-QPoint?pointPairs)`
* `drawPath (self, QPainterPath?path)`
* `drawPicture (self, QPointF?p, QPicture?picture)`
* `drawPicture (self, int?x, int?y, QPicture?p)`
* `drawPicture (self, QPoint?pt, QPicture?p)`
* `drawPie (self, QRectF?rect, int?a, int?alen)`
* `drawPie (self, QRect?rect, int?a, int?alen)`
* `drawPie (self, int?x, int?y, int?w, int?h, int?a, int?alen)`
* `drawPixmap (self, QRectF?targetRect, QPixmap?pixmap, QRectF?sourceRect)`
* `drawPixmap (self, QRect?targetRect, QPixmap?pixmap, QRect?sourceRect)`
* `drawPixmap (self, QPointF?p, QPixmap?pm)`
* `drawPixmap (self, QPoint?p, QPixmap?pm)`
* `drawPixmap (self, QRect?r, QPixmap?pm)`
* `drawPixmap (self, int?x, int?y, QPixmap?pm)`
* `drawPixmap (self, int?x, int?y, int?w, int?h, QPixmap?pm)`
* `drawPixmap (self, int?x, int?y, int?w, int?h, QPixmap?pm, int?sx, int?sy, int?sw, int?sh)`
* `drawPixmap (self, int?x, int?y, QPixmap?pm, int?sx, int?sy, int?sw, int?sh)`
* `drawPixmap (self, QPointF?p, QPixmap?pm, QRectF?sr)`
* `drawPixmap (self, QPoint?p, QPixmap?pm, QRect?sr)`
* `drawPixmapFragments (self, list-of-QPainter.PixmapFragment?fragments, QPixmap?pixmap, PixmapFragmentHints?hints?=?0)`
* `drawPixmapFragments (self, list-of-QRectF?targetRects, list-of-QRectF?sourceRects, QPixmap?pixmap, PixmapFragmentHints?hints?=?0)`
* `drawPoint (self, QPointF?p)`
* `drawPoint (self, int?x, int?y)`
* `drawPoint (self, QPoint?p)`
* `drawPoints (self, QPointF?point, ...)`
* `drawPoints (self, QPolygonF?points)`
* `drawPoints (self, QPoint?point, ...)`
* `drawPoints (self, QPolygon?points)`
* `drawPolygon (self, QPointF?point, ...)`
* `drawPolygon (self, QPolygonF?points, Qt.FillRule?fillRule?=?Qt.OddEvenFill)`
* `drawPolygon (self, QPoint?point, ...)`
* `drawPolygon (self, QPolygon?points, Qt.FillRule?fillRule?=?Qt.OddEvenFill)`
* `drawPolyline (self, QPointF?point, ...)`
* `drawPolyline (self, QPolygonF?polyline)`
* `drawPolyline (self, QPoint?point, ...)`
* `drawPolyline (self, QPolygon?polyline)`
* `drawRect (self, QRectF?rect)`
* `drawRect (self, int?x, int?y, int?w, int?h)`
* `drawRect (self, QRect?r)`
* `drawRects (self, QRectF?rect, ...)`
* `drawRects (self, list-of-QRectF?rects)`
* `drawRects (self, QRect?rect, ...)`
* `drawRects (self, list-of-QRect?rects)`
* `drawRoundedRect (self, QRectF?rect, float?xRadius, float?yRadius, Qt.SizeMode?mode?=?Qt.AbsoluteSize)`
* `drawRoundedRect (self, int?x, int?y, int?w, int?h, float?xRadius, float?yRadius, Qt.SizeMode?mode?=?Qt.AbsoluteSize)`
* `drawRoundedRect (self, QRect?rect, float?xRadius, float?yRadius, Qt.SizeMode?mode?=?Qt.AbsoluteSize)`
* `drawRoundRect (self, QRectF?r, int?xRound?=?25, int?yRound?=?25)`
* `drawRoundRect (self, int?x, int?y, int?w, int?h, int?xRound?=?25, int?yRound?=?25)`
* `drawRoundRect (self, QRect?r, int?xRound?=?25, int?yRound?=?25)`
* `drawStaticText (self, QPointF?topLeftPosition, QStaticText?staticText)`
* `drawStaticText (self, QPoint?p, QStaticText?staticText)`
* `drawStaticText (self, int?x, int?y, QStaticText?staticText)`
* `drawText (self, QPointF?p, QString?s)`
* `QRectF?boundingRect drawText (self, QRectF?rectangle, int?flags, QString?text)`
* `QRect?boundingRect drawText (self, QRect?rectangle, int?flags, QString?text)`
* `drawText (self, QRectF?rectangle, QString?text, QTextOption?option?=?QTextOption())`
* `drawText (self, QPoint?p, QString?s)`
* `QRect?boundingRect drawText (self, int?x, int?y, int?width, int?height, int?flags, QString?text)`
* `drawText (self, int?x, int?y, QString?s)`
* `drawTiledPixmap (self, QRectF?rectangle, QPixmap?pixmap, QPointF?pos?=?QPointF())`
* `drawTiledPixmap (self, QRect?rectangle, QPixmap?pixmap, QPoint?pos?=?QPoint())`
* `drawTiledPixmap (self, int?x, int?y, int?width, int?height, QPixmap?pixmap, int?sx?=?0, int?sy?=?0)`
* `bool end (self)`
* `endNativePainting (self)`
* `eraseRect (self, QRectF)`
* `eraseRect (self, QRect?rect)`
* `eraseRect (self, int?x, int?y, int?w, int?h)`
* `fillPath (self, QPainterPath?path, QBrush?brush)`
* `fillRect (self, QRectF, QBrush)`
* `fillRect (self, QRect, QBrush)`
* `fillRect (self, int?x, int?y, int?w, int?h, QBrush?b)`
* `fillRect (self, QRectF, QColor?color)`
* `fillRect (self, QRect, QColor?color)`
* `fillRect (self, int?x, int?y, int?w, int?h, QColor?b)`
* `fillRect (self, int?x, int?y, int?w, int?h, Qt.GlobalColor?c)`
* `fillRect (self, QRect?r, Qt.GlobalColor?c)`
* `fillRect (self, QRectF?r, Qt.GlobalColor?c)`
* `fillRect (self, int?x, int?y, int?w, int?h, Qt.BrushStyle?style)`
* `fillRect (self, QRect?r, Qt.BrushStyle?style)`
* `fillRect (self, QRectF?r, Qt.BrushStyle?style)`
* `QFont font (self)`
* `QFontInfo fontInfo (self)`
* `QFontMetrics fontMetrics (self)`
* `bool hasClipping (self)`
* `initFrom (self, QWidget?widget)`
* `bool isActive (self)`
* `Qt.LayoutDirection layoutDirection (self)`
* `QMatrix matrix (self)`
* `bool matrixEnabled (self)`
* `float opacity (self)`
* `QPaintEngine paintEngine (self)`
* `QPen pen (self)`
* `RenderHints renderHints (self)`
* `resetMatrix (self)`
* `resetTransform (self)`
* `restore (self)`
* `rotate (self, float?a)`
* `save (self)`
* `scale (self, float?sx, float?sy)`
* `setBackground (self, QBrush?bg)`
* `setBackgroundMode (self, Qt.BGMode?mode)`
* `setBrush (self, QBrush?brush)`
* `setBrush (self, Qt.BrushStyle?style)`
* `setBrushOrigin (self, QPointF)`
* `setBrushOrigin (self, int?x, int?y)`
* `setBrushOrigin (self, QPoint?p)`
* `setClipPath (self, QPainterPath?path, Qt.ClipOperation?operation?=?Qt.ReplaceClip)`
* `setClipping (self, bool?enable)`
* `setClipRect (self, QRectF?rectangle, Qt.ClipOperation?operation?=?Qt.ReplaceClip)`
* `setClipRect (self, int?x, int?y, int?width, int?height, Qt.ClipOperation?operation?=?Qt.ReplaceClip)`
* `setClipRect (self, QRect?rectangle, Qt.ClipOperation?operation?=?Qt.ReplaceClip)`
* `setClipRegion (self, QRegion?region, Qt.ClipOperation?operation?=?Qt.ReplaceClip)`
* `setCompositionMode (self, CompositionMode?mode)`
* `setFont (self, QFont?f)`
* `setLayoutDirection (self, Qt.LayoutDirection?direction)`
* `setMatrix (self, QMatrix?matrix, bool?combine?=?False)`
* `setMatrixEnabled (self, bool?enabled)`
* `setOpacity (self, float?opacity)`
* `setPen (self, QColor?color)`
* `setPen (self, QPen?pen)`
* `setPen (self, Qt.PenStyle?style)`
* `setRenderHint (self, RenderHint?hint, bool?on?=?True)`
* `setRenderHints (self, RenderHints?hints, bool?on?=?True)`
* `setTransform (self, QTransform?transform, bool?combine?=?False)`
* `setViewport (self, QRect?viewport)`
* `setViewport (self, int?x, int?y, int?w, int?h)`
* `setViewTransformEnabled (self, bool?enable)`
* `setWindow (self, QRect?window)`
* `setWindow (self, int?x, int?y, int?w, int?h)`
* `setWorldMatrix (self, QMatrix?matrix, bool?combine?=?False)`
* `setWorldMatrixEnabled (self, bool?enabled)`
* `setWorldTransform (self, QTransform?matrix, bool?combine?=?False)`
* `shear (self, float?sh, float?sv)`
* `strokePath (self, QPainterPath?path, QPen?pen)`
* `bool testRenderHint (self, RenderHint?hint)`
* `QTransform transform (self)`
* `translate (self, QPointF?offset)`
* `translate (self, float?dx, float?dy)`
* `translate (self, QPoint?offset)`
* `QRect viewport (self)`
* `bool viewTransformEnabled (self)`
* `QRect window (self)`
* `QMatrix worldMatrix (self)`
* `bool worldMatrixEnabled (self)`
* `QTransform worldTransform (self)`
### Static Methods
* `QPaintDevice redirected (QPaintDevice?device, QPoint?offset?=?None)`
* `restoreRedirected (QPaintDevice?device)`
* `setRedirected (QPaintDevice?device, QPaintDevice?replacement, QPoint?offset?=?QPoint())`
### Special Methods
* `object __enter__ (self)`
* `__exit__ (self, object?type, object?value, object?traceback)`
* * *
## Detailed Description
QPainter類的控件和其他繪圖設備進行低級別的油畫。
QPainter提供了高度優化的函數來完成大部分的繪圖GUI程序的要求。由此可以得出一切從簡單的線條到復雜的形狀像餡餅和和弦。它也可以繪制對齊的文本和像素圖。通常情況下,它繪制一個“自然”的坐標系中,但它也可以做視圖和世界的改造。 QPainter可以在繼承的任何對象操作[QPaintDevice](qpaintdevice.html)類。
共同使用的QPainter的是里面的一個小部件的繪制事件:構建和自定義(如設置筆或刷子)的畫家。再畫。記住拉絲后銷毀QPainter的對象。例如:
```
void SimpleExampleWidget.paintEvent([QPaintEvent](qpaintevent.html) *)
{
QPainter painter(this);
painter.setPen([Qt](qt.html).blue);
painter.setFont([QFont](qfont.html)("Arial", 30));
painter.drawText(rect(), [Qt](qt.html).AlignCenter, "Qt");
}
```
QPainter的核心功能是繪圖,但是這個類還提供了幾個函數,允許您自定義的QPainter的設置和它的渲染質量,和其他人,使削波。此外,您可以控制不同的形狀如何通過指定畫家的組成模式合并在一起。
該[isActive](qpainter.html#isActive)()函數表示的畫家是否處于活動狀態。畫家被激活[begin](qpainter.html#begin)( )函數,而這需要一個構造函數[QPaintDevice](qpaintdevice.html)的說法。該[end](qpainter.html#end)( )函數,析構函數,停用它。
連同[QPaintDevice](qpaintdevice.html)和[QPaintEngine](qpaintengine.html)類, QPainter的形成的基礎, Qt的涂料體系。 QPainter的是用于執行繪圖操作的類。[QPaintDevice](qpaintdevice.html)表示可以涂在使用QPainter的一個裝置。[QPaintEngine](qpaintengine.html)規定,畫家用來繪制到不同類型的設備的接口。如果畫家是活動的,[device](qpainter.html#device)( )返回繪制設備上的畫家描繪,和[paintEngine](qpainter.html#paintEngine)( )返回的繪圖引擎,該畫家目前在運行。欲了解更多信息,請參閱[Paint System](index.htm)。
有時候我們需要讓別人漆上不同尋常的[QPaintDevice](qpaintdevice.html)。 QPainter的支持靜態函數來做到這一點,[setRedirected](index.htm#setRedirected)( ) 。
**Warning:**當paintdevice是一個小部件, QPainter的只能內的paintEvent ()函數或在一個稱為的paintEvent (功能)中使用,也就是說,除非[Qt.WA_PaintOutsidePaintEvent](qt.html#WidgetAttribute-enum)插件屬性設置。在Mac OS X和Windows ,你只能在一個的paintEvent ( )函數漆不管這個屬性的設置。
### Settings
有幾個設置,您可以自定義,以使根據您的喜好了QPainter繪制:
* [font](qpainter.html#font)() is the font used for drawing text. If the painter [isActive](qpainter.html#isActive)(), you can retrieve information about the currently set font, and its metrics, using the [fontInfo](qpainter.html#fontInfo)() and [fontMetrics](qpainter.html#fontMetrics)() functions respectively.
* [brush](qpainter.html#brush)() defines the color or pattern that is used for filling shapes.
* [pen](qpainter.html#pen)() defines the color or stipple that is used for drawing lines or boundaries.
* [backgroundMode](qpainter.html#backgroundMode)() defines whether there is a [background](qpainter.html#background)() or not, i.e it is either [Qt.OpaqueMode](qt.html#BGMode-enum) or [Qt.TransparentMode](qt.html#BGMode-enum).
* [background](qpainter.html#background)() only applies when [backgroundMode](qpainter.html#backgroundMode)() is [Qt.OpaqueMode](qt.html#BGMode-enum) and [pen](qpainter.html#pen)() is a stipple. In that case, it describes the color of the background pixels in the stipple.
* [brushOrigin](qpainter.html#brushOrigin)() defines the origin of the tiled brushes, normally the origin of widget's background.
* [viewport](qpainter.html#viewport)(), [window](qpainter.html#window)(), [worldTransform](qpainter.html#worldTransform)() make up the painter's coordinate transformation system. For more information, see the [Coordinate Transformations](#coordinate-transformations) section and the [Coordinate System](index.htm) documentation.
* [hasClipping](qpainter.html#hasClipping)() tells whether the painter clips at all. (The paint device clips, too.) If the painter clips, it clips to [clipRegion](qpainter.html#clipRegion)().
* [layoutDirection](qpainter.html#layoutDirection)() defines the layout direction used by the painter when drawing text.
* [worldMatrixEnabled](qpainter.html#worldMatrixEnabled)() tells whether world transformation is enabled.
* [viewTransformEnabled](qpainter.html#viewTransformEnabled)() tells whether view transformation is enabled.
需要注意的是其中的一些設置反映在一些油漆設備的設置,比如[QWidget.font](qwidget.html#font-prop)( ) 。該[QPainter.begin](qpainter.html#begin)( )函數(或等價的QPainter的構造函數)從繪制設備拷貝這些屬性。
您可以在任何時候保存了QPainter的狀態通過調用[save](qpainter.html#save)( )函數,它節省了內部堆棧中的所有可用的設置。該[restore](qpainter.html#restore)( )函數彈出他們回來。
### Drawing
QPainter提供了許多功能來繪制最原語:[drawPoint](qpainter.html#drawPoint)( )[drawPoints](qpainter.html#drawPoints)( )[drawLine](qpainter.html#drawLine)( )[drawRect](qpainter.html#drawRect)( )[drawRoundedRect](qpainter.html#drawRoundedRect)( )[drawEllipse](qpainter.html#drawEllipse)( )[drawArc](qpainter.html#drawArc)( )[drawPie](qpainter.html#drawPie)( )[drawChord](qpainter.html#drawChord)( )[drawPolyline](qpainter.html#drawPolyline)( )[drawPolygon](qpainter.html#drawPolygon)( )[drawConvexPolygon](qpainter.html#drawConvexPolygon)()和[drawCubicBezier](index.htm#drawCubicBezier)( ) 。這兩個便利的功能,[drawRects](qpainter.html#drawRects)()和[drawLines](qpainter.html#drawLines)( ) ,繪制矩形或線條的給定數組中的給定數量[QRects](qrect.html) or [QLines](qline.html)使用當前畫筆和畫刷。
QPainter類還提供了[fillRect](qpainter.html#fillRect)()函數,其填埋所述給定[QRect](qrect.html)用給定的[QBrush](qbrush.html)和[eraseRect](qpainter.html#eraseRect)( )函數,刪除給定矩形內的區域。
所有這些功能都同時具有整數和浮點版本。
|  | **Basic Drawing Example**該[Basic Drawing](index.htm)示例顯示了如何使用QPainter類在各種不同的風格顯示基本的圖形元素。 |
如果您需要繪制一個形狀復雜,特別是如果你需要重復這樣做,考慮創建一個[QPainterPath](qpainterpath.html)并用它繪制[drawPath](qpainter.html#drawPath)( ) 。
| **Painter Paths example**該[QPainterPath](qpainterpath.html)類提供一個容器,用于繪制操作,從而能夠構造和重用的圖形形狀。該[Painter Paths](index.htm)例子顯示了畫家的路徑如何可以用來構建復雜的形狀進行渲染。 |  |
的QPainter還提供了[fillPath](qpainter.html#fillPath)()函數,其填埋所述給定[QPainterPath](qpainterpath.html)用給定的[QBrush](qbrush.html)和[strokePath](qpainter.html#strokePath)( )函數繪制給定路徑的輪廓(即描邊路徑) 。
另見[Vector Deformation](index.htm)演示展示了如何利用先進的矢量技術,用來繪制文本[QPainterPath](qpainterpath.html)時,[Gradients](index.htm)演示顯示了不同類型的梯度是在Qt中可用的,并且[Path Stroking](index.htm)演示這顯示了Qt內建的虛線樣式,并顯示自定義模式可以如何用來擴展現有模式的范圍。
| [Vector Deformation](index.htm) | [Gradients](index.htm) | [Path Stroking](index.htm) |
| --- | --- | --- |
|  |  |  |
有功能繪制像素圖/圖像,即[drawPixmap](qpainter.html#drawPixmap)( )[drawImage](qpainter.html#drawImage)()和[drawTiledPixmap](qpainter.html#drawTiledPixmap)( ) 。兩[drawPixmap](qpainter.html#drawPixmap)()和[drawImage](qpainter.html#drawImage)()產生相同的結果,不同之處在于[drawPixmap](qpainter.html#drawPixmap)( )更快的屏幕,而[drawImage](qpainter.html#drawImage)( )可能會更快的[QPrinter](qprinter.html)或其他裝置。
使用文本繪制完成時[drawText](qpainter.html#drawText)( ) 。當你需要細粒度的定位,[boundingRect](qpainter.html#boundingRect)( )告訴你在哪里給定的[drawText](qpainter.html#drawText)( )命令將繪制。
有一個[drawPicture](qpainter.html#drawPicture)()函數繪制的整個內容[QPicture](qpicture.html)。該[drawPicture](qpainter.html#drawPicture)( )函數是忽略所有畫家的設置作為唯一功能[QPicture](qpicture.html)有它自己的設置。
### Rendering Quality
要獲得使用QPainter的最佳渲染效果,你應該使用平臺無關[QImage](qimage.html)油漆設備;即使用[QImage](qimage.html)將確保結果具有在任何平臺上相同的像素表示。
QPainter類還提供了通過控制渲染質量的一種手段其[RenderHint](qpainter.html#RenderHint-enum)枚舉和浮點精度支持:繪制原語所有的功能都有一個浮點版本。這些通常以與組合使用[QPainter.Antialiasing](qpainter.html#RenderHint-enum)呈現提示。
|  | **Concentric Circles Example**該[Concentric Circles](index.htm)實例表明,可以繪制自定義部件在使用浮點精度和抗混疊得到改善渲染質量。應用程序的主窗口中顯示其正在使用的精度和抗混疊的各種組合,得出了幾個小部件。 |
該[RenderHint](qpainter.html#RenderHint-enum)枚舉指定標志來QPainter的,可能會或可能不會被任何給定的發動機尊重。[QPainter.Antialiasing](qpainter.html#RenderHint-enum)表明發動機應該反鋸齒原語的邊緣,如果可能的話,[QPainter.TextAntialiasing](qpainter.html#RenderHint-enum)表明發動機應盡可能消除文字鋸齒,而[QPainter.SmoothPixmapTransform](qpainter.html#RenderHint-enum)表明發動機應該使用一個平滑的pixmap變換算法。[HighQualityAntialiasing](qpainter.html#RenderHint-enum)是一個OpenGL的具體呈現提示,指示引擎應使用片斷程序和離屏渲染的抗鋸齒。
該[renderHints](qpainter.html#renderHints)( )函數返回一個標志,指定在這個畫家將呈現提示。使用[setRenderHint](qpainter.html#setRenderHint)( )函數來設置或清除當前設置的[RenderHints](qpainter.html#RenderHint-enum)。
### Coordinate Transformations
通常情況下, QPainter的操作設備自己的坐標系統(通常是像素) ,但QPainter的具有坐標變換良好的支持。
| nop | [rotate](qpainter.html#rotate)() | [scale](qpainter.html#scale)() | [translate](qpainter.html#translate)() |
| --- | --- | --- | --- |
|  |  |  |  |
最常用的變換是縮放,旋轉,平移和剪切。使用[scale](qpainter.html#scale)()函數以一個給定的偏移量來縮放坐標系中,[rotate](qpainter.html#rotate)( )函數則順時針旋轉和[translate](qpainter.html#translate)()把它翻譯出來(即增加一個給定的偏移量點) 。也可以使用捻坐標系原點周圍的[shear](qpainter.html#shear)()函數。請參閱[Affine Transformations](index.htm)演示了剪切坐標系統的可視化。
另見[Transformations](index.htm)例如,顯示轉變如何影響了QPainter的渲染圖元的方式。尤其是,它顯示了如何變換的順序會影響結果。
| **Affine Transformations Demo**該[Affine Transformations](index.htm)演示顯示了Qt的能力畫上執行的操作仿射變換。該演示還允許用戶嘗試使用轉換操作,并立即看到結果。 |  |
所有穿越 - 操作上進行改造工作[worldTransform](qpainter.html#worldTransform)( ) 。矩陣轉換成在平面上的點到另一點。如需變換矩陣的更多信息,請參見[Coordinate System](index.htm)和[QTransform](qtransform.html)文檔。
該[setWorldTransform](qpainter.html#setWorldTransform)( )函數可以更換或添加到當前設置的[worldTransform](qpainter.html#worldTransform)( ) 。該[resetTransform](qpainter.html#resetTransform)( )函數重置的是用做任何轉換[translate](qpainter.html#translate)( )[scale](qpainter.html#scale)( )[shear](qpainter.html#shear)( )[rotate](qpainter.html#rotate)( )[setWorldTransform](qpainter.html#setWorldTransform)( )[setViewport](qpainter.html#setViewport)()和[setWindow](qpainter.html#setWindow)()函數。該[deviceTransform](qpainter.html#deviceTransform)( )返回一個轉換從邏輯坐標到平臺相關的繪圖設備的設備坐標的矩陣。后者的功能是對平臺相關的手柄使用平臺的繪畫命令時,才需要,而平臺沒有做轉換nativly 。
當使用QPainter的繪圖,我們使用它,然后被轉換成漆設備的物理坐標邏輯坐標指定點。邏輯坐標物理坐標的映射由QPainter的的處理[combinedTransform](qpainter.html#combinedTransform)( )的組合[viewport](qpainter.html#viewport)()和[window](qpainter.html#window)()和[worldTransform](qpainter.html#worldTransform)( ) 。該[viewport](qpainter.html#viewport)()表示物理坐標指定一個任意的矩形,則[window](qpainter.html#window)( )描述在邏輯坐標相同的矩形,并且[worldTransform](qpainter.html#worldTransform)()是相同的變換矩陣。
另請參閱[Coordinate System](index.htm)
### Clipping
QPainter的可夾任何拉伸操作到一個矩形,區域,或一個矢量路徑。使用功能的當前片段可[clipRegion](qpainter.html#clipRegion)()和[clipPath](qpainter.html#clipPath)( ) 。無論路徑或地區是首選(快)取決于相關[paintEngine](qpainter.html#paintEngine)( ) 。例如,本[QImage](qimage.html)繪圖引擎更喜歡的路徑,而X11的繪圖引擎更喜歡的區域。設置一個剪輯的畫家邏輯坐標進行。
經過了QPainter的裁剪,繪制設備也可能被裁剪。例如,大多數的部件夾了使用的子控件的像素,并且大多數打印機夾了接近紙張的邊緣區域。這種額外的裁剪不受的返回值反映[clipRegion](qpainter.html#clipRegion)()或[hasClipping](qpainter.html#hasClipping)( ) 。
### Composition Modes
QPainter提供了該[CompositionMode](qpainter.html#CompositionMode-enum)枚舉它定義了數字圖像合成波特 - 達芙的規則,它描述了一個模型,結合在一個圖像,源像素,在另一個圖像中,目標像素。
的組合物中的兩種最常見的形式是[Source](qpainter.html#CompositionMode-enum)和[SourceOver](qpainter.html#CompositionMode-enum)。[Source](qpainter.html#CompositionMode-enum)用于繪制不透明的物體上繪制設備。在這種模式下,在源代碼中的每個像素將替換目的地中的相應像素。在[SourceOver](qpainter.html#CompositionMode-enum)組合模式,源對象是透明的,被描繪在目標之上。
請注意,組成轉變經營pixelwise 。出于這個原因,有使用圖形原語本身和它的邊界矩形之間的差:該邊界矩形中包含與α == 0 (即周圍的原始像素)的像素。這些像素將復蓋其他圖像的像素,情感上清除那些,而原始的只有復蓋其自身的區域。
|  | **Composition Modes Demo**該[Composition Modes](index.htm)演示中,在Qt的demo目錄可用,讓你體驗不同的組合方式,并立即看到結果。 |
### Limitations
如果您使用的坐標與Qt的基于光柵的繪圖引擎,一定要注意這一點很重要,而坐標大于+ / - 215可以使用,超出該范圍的坐標進行任何繪畫不保證顯示;繪圖可能會被裁剪。這是由于使用的`short int`在執行。
通過Qt的撫摩產生的輪廓是只是一個近似值與時曲線形狀處理。它是在不可能代表使用另一個貝塞爾曲線段Bezier曲線段的輪廓大多數情況下,與這樣的Qt近似曲線概述通過使用幾個較小的曲線。出于性能的考慮是有限制的Qt多少曲線使用這些輪廓,從而使用大畫筆的寬度時,或縮放的輪廓誤差增大。以產生輪廓線具有較小的誤差,可以使用[QPainterPathStroker](qpainterpathstroker.html)類,它有它,讓我們的用戶指定的誤差容限的setCurveThreshold成員函數。另一種解決方法是將路徑多邊形先轉換,然后繪制多邊形來代替。
### Performance
QPainter的是一個豐富的框架,它允許開發者做一個偉大的各種圖形操作,如漸變,組成方式和矢量圖形。和QPainter的可以在各種不同的硬件和軟件堆棧做到這一點。當然硬件和軟件的基本組合有一定的影響性能,并確保每一個運算速度快結合的組成模式,畫筆,裁剪,轉換等所有各種組合,是因為接近一個不可能完成的任務排列的號碼。作為一種妥協,我們選擇了QPainter的API和后端,在性能保證是一樣好,我們可以合理地得到它的硬件和軟件的結合給定的一個子集。
我們專注于為高性能引擎的后端是:
* Raster - This backend implements all rendering in pure software and is always used to render into QImages. For optimal performance only use the format types [QImage.Format_ARGB32_Premultiplied](qimage.html#Format-enum), [QImage.Format_RGB32](qimage.html#Format-enum) or [QImage.Format_RGB16](qimage.html#Format-enum). Any other format, including [QImage.Format_ARGB32](qimage.html#Format-enum), has significantly worse performance. This engine is also used by default on Windows and on QWS. It can be used as default graphics system on any OS/hardware/software combination by passing `-graphicssystem raster` on the command line
* OpenGL 2.0 (ES) - This backend is the primary backend for hardware accelerated graphics. It can be run on desktop machines and embedded devices supporting the OpenGL 2.0 or OpenGL/ES 2.0 specification. This includes most graphics chips produced in the last couple of years. The engine can be enabled by using QPainter onto a [QGLWidget](qglwidget.html) or by passing `-graphicssystem opengl` on the command line when the underlying system supports it.
* OpenVG - This backend implements the Khronos standard for 2D and Vector Graphics. It is primarily for embedded devices with hardware support for OpenVG. The engine can be enabled by passing `-graphicssystem openvg` on the command line when the underlying system supports it.
這些操作是:
* Simple transformations, meaning translation and scaling, pluss 0, 90, 180, 270 degree rotations.
* `drawPixmap()` in combination with simple transformations and opacity with non-smooth transformation mode (`QPainter.SmoothPixmapTransform` not enabled as a render hint).
* Rectangle fills with solid color, two-color linear gradients and simple transforms.
* Rectangular clipping with simple transformations and intersect clip.
* Composition Modes `QPainter.CompositionMode_Source` and [QPainter.CompositionMode_SourceOver](qpainter.html#CompositionMode-enum)
* Rounded rectangle filling using solid color and two-color linear gradients fills.
* 3x3 patched pixmaps, via qDrawBorderPixmap.
此列表提供了一個跡象,其中的功能在一個應用程序的性能是至關重要的安全使用。對于某些設置,其他操作可能會快過,但使它們的廣泛使用之前,建議進行基準測試和驗證他們的系統,該軟件將在年底運行。此外,有昂貴的操作是確定使用的情況下,例如當結果被緩存在一個[QPixmap](qpixmap.html)。
* * *
## Type Documentation
```
QPainter.CompositionMode
```
定義了支持數字圖像合成的模式。組合模式用于指定如何在一個圖像中的像素,源,在另一圖像中,目的地合并像素。
請注意,按位光柵操作模式,表示一個RasterOp的前綴,僅本地支持的X11和光柵涂料引擎。這意味著,利用Mac上這些模式的唯一途徑是通過一個[QImage](qimage.html)。文件中的RasterOp表示混合模式_not_支持筆和畫筆與alpha分量。另外,在接通[QPainter.Antialiasing](qpainter.html#RenderHint-enum)渲染暗示將有效地禁用RasterOp的模式。


最常見的類型是SourceOver (通常被稱為只是α混合),其中源像素被混合在目標像素的頂部在這樣一種方式,光源的阿爾法分量定義像素的透明度。
當涂料設備是[QImage](qimage.html)中,圖像的格式必須被設置為[Format_ARGB32Premultiplied](qimage.html#Format-enum) or [Format_ARGB32](qimage.html#Format-enum)對于該組合物的模式有任何效果。對于業績的預乘的版本是首選格式。
當一個組成模式設置適用于所有運營商的繪畫,鋼筆,畫筆,漸變和像素圖/影像圖。
| Constant | Value | Description |
| --- | --- | --- |
| `QPainter.CompositionMode_SourceOver` | `0` | 這是默認模式。源的alpha被用于混合的像素上的目標的上方。 |
| `QPainter.CompositionMode_DestinationOver` | `1` | 目的地的阿爾法用于混在一起的源像素的上方。這個模式是CompositionMode_SourceOver的倒數。 |
| `QPainter.CompositionMode_Clear` | `2` | 在目標的像素被清除(設置為完全透明)來源無關。 |
| `QPainter.CompositionMode_Source` | `3` | 輸出是源像素。 (這意味著一個基本的復印操作,并是相同的SourceOver當源像素是不透明的) 。 |
| `QPainter.CompositionMode_Destination` | `4` | 的輸出是目標像素。這意味著它們的混合沒有任何效果。這個模式是CompositionMode_Source的倒數。 |
| `QPainter.CompositionMode_SourceIn` | `5` | 的輸出是源,其中所述的α是減少了該目的的。 |
| `QPainter.CompositionMode_DestinationIn` | `6` | 輸出目的地,其中所述α是減少了源的。這個模式是CompositionMode_SourceIn的倒數。 |
| `QPainter.CompositionMode_SourceOut` | `7` | 的輸出是源,其中所述的α是減少了目的地的倒數。 |
| `QPainter.CompositionMode_DestinationOut` | `8` | 輸出目的地,其中所述α是減少了源的倒數。這個模式是CompositionMode_SourceOut的倒數。 |
| `QPainter.CompositionMode_SourceAtop` | `9` | 源像素混合在目標的頂部,與源像素減少了目標像素的alpha的alpha 。 |
| `QPainter.CompositionMode_DestinationAtop` | `10` | 目標像素混合的信號源的頂部,與目標像素的alpha是減少了目標像素的alpha 。這個模式是CompositionMode_SourceAtop的倒數。 |
| `QPainter.CompositionMode_Xor` | `11` | 源,其阿爾法減少與目標的α的倒數,被合并與目的地,其阿爾法減小由源的α的倒數。 CompositionMode_Xor是不一樣的按位異或運算。 |
| `QPainter.CompositionMode_Plus` | `12` | 無論是α和在源和目標像素的顏色被加在一起。 |
| `QPainter.CompositionMode_Multiply` | `13` | 的輸出是源顏色乘以目的地。乘用白色的葉子的顏色不變的顏色,而與黑色的顏色相乘,產生黑色。 |
| `QPainter.CompositionMode_Screen` | `14` | 源和目標色彩反相,然后相乘。篩選與白色的顏色會產生白色的,而篩選的顏色與黑色的顏色保持不變。 |
| `QPainter.CompositionMode_Overlay` | `15` | 乘法或屏幕上的顏色取決于目標顏色。目標顏色與光源顏色的混合,以反映目標的亮度或暗度。 |
| `QPainter.CompositionMode_Darken` | `16` | 的源顏色和目標顏色較暗被選中。 |
| `QPainter.CompositionMode_Lighten` | `17` | 的源和目的色彩的打火機被選中。 |
| `QPainter.CompositionMode_ColorDodge` | `18` | 目標顏色變亮以反映源顏色。黑色源色彩會使目標色不變。 |
| `QPainter.CompositionMode_ColorBurn` | `19` | 目標顏色變暗以反映源顏色。白源色彩會使目標色不變。 |
| `QPainter.CompositionMode_HardLight` | `20` | 乘法或屏幕上的顏色取決于源顏色。光源的顏色會變淺目標顏色,而深源顏色會變暗目標顏色。 |
| `QPainter.CompositionMode_SoftLight` | `21` | 變暗或變亮的顏色取決于源顏色。類似CompositionMode_HardLight 。 |
| `QPainter.CompositionMode_Difference` | `22` | 減去的顏色從較輕的更暗。用白色噴漆反轉目標顏色,而畫有黑色會使目標色不變。 |
| `QPainter.CompositionMode_Exclusion` | `23` | 類似CompositionMode_Difference ,但具有較低的對比度。用白色噴漆反轉目標顏色,而畫有黑色會使目標色不變。 |
| `QPainter.RasterOp_SourceOrDestination` | `24` | 是否在源和目標像素( SRC或DST )的按位OR運算。 |
| `QPainter.RasterOp_SourceAndDestination` | `25` | 是否在源和目標像素( SRC與DST )的按位與運算。 |
| `QPainter.RasterOp_SourceXorDestination` | `26` | 是否在源和目標像素( SRC XOR DST)的按位異或運算。 |
| `QPainter.RasterOp_NotSourceAndNotDestination` | `27` | 是否在源和目標像素的按位NOR運算( (不SRC )和(不是DST ) ) 。 |
| `QPainter.RasterOp_NotSourceOrNotDestination` | `28` | 是否在源和目標像素( (不SRC )或(不是DST ) )按位與非操作。 |
| `QPainter.RasterOp_NotSourceXorDestination` | `29` | 是否在源像素被反轉,然后相異或目的地( (不SRC ) XOR dst)的按位運算。 |
| `QPainter.RasterOp_NotSource` | `30` | 是否在源像素反轉(不是SRC)按位運算。 |
| `QPainter.RasterOp_NotSourceAndDestination` | `31` | 請問其中源是倒,然后相與與目標( (不SRC )和DST )按位運算。 |
| `QPainter.RasterOp_SourceAndNotDestination` | `32` | 請問那里的源邏輯與運算倒目的地像素( src和(不是DST ) )按位運算。 |
**See also** [compositionMode](qpainter.html#compositionMode)( )[setCompositionMode](qpainter.html#setCompositionMode)( )[Composition Modes](qpainter.html#composition-modes)和[Image Composition Example](index.htm)。
```
QPainter.PixmapFragmentHint
```
| Constant | Value | Description |
| --- | --- | --- |
| `QPainter.OpaqueHint` | `0x01` | 表示該像素映像的片段要被繪制為不透明。不透明的碎片可能更快得出。 |
這個枚舉被引入或修改的Qt 4.7 。
該PixmapFragmentHints類型是一個typedef為[QFlags](index.htm)\u003cPixmapFragmentHint\u003e 。它存儲PixmapFragmentHint值的或組合。
**See also** [QPainter.drawPixmapFragments](qpainter.html#drawPixmapFragments)()和[QPainter.PixmapFragment](index.htm)。
```
QPainter.RenderHint
```
Renderhints用于指定標志來[QPainter](qpainter.html)可能會或可能不會被任何給定的發動機尊重。
| Constant | Value | Description |
| --- | --- | --- |
| `QPainter.Antialiasing` | `0x01` | 表明發動機應該反鋸齒原語的邊緣,如果可能的。 |
| `QPainter.TextAntialiasing` | `0x02` | 表明發動機應盡可能消除文字鋸齒。強制禁用抗鋸齒文本,不要使用此提示。相反,設置[QFont.NoAntialias](qfont.html#StyleStrategy-enum)你的字體的風格策略。 |
| `QPainter.SmoothPixmapTransform` | `0x04` | 表明發動機應該使用一個平滑的pixmap變換算法(例如,雙線性)而不是最近的鄰居。 |
| `QPainter.HighQualityAntialiasing` | `0x08` | 一個OpenGL的具體呈現提示,指示引擎應使用片斷程序和離屏渲染的抗鋸齒。 |
| `QPainter.NonCosmeticDefaultPen` | `0x10` | 發動機應該解釋鋼筆的寬度為0 (否則使[QPen.isCosmetic](qpen.html#isCosmetic)( ) )作為一種非化妝筆為1的寬度。 |
該RenderHints類型是一個typedef為[QFlags](index.htm)\u003cRenderHint\u003e 。它存儲RenderHint值的或組合。
**See also** [renderHints](qpainter.html#renderHints)( )[setRenderHint](qpainter.html#setRenderHint)( )[Rendering Quality](qpainter.html#rendering-quality)和[Concentric Circles Example](index.htm)。
* * *
## Method Documentation
```
QPainter.__init__ (self)
```
構造一個畫家。
**See also** [begin](qpainter.html#begin)()和[end](qpainter.html#end)( ) 。
```
QPainter.__init__ (self, QPaintDevice)
```
構造一個畫家的畫開始油漆_device_馬上。
此構造方便短命的畫家,如:在[QWidget.paintEvent](qwidget.html#paintEvent)( ),并應只能使用一次。該構造函數調用[begin](qpainter.html#begin)( )為您和[QPainter](qpainter.html)析構函數會自動調用[end](qpainter.html#end)( ) 。
下面是一個使用例子[begin](qpainter.html#begin)()和[end](qpainter.html#end)():
```
void MyWidget.paintEvent([QPaintEvent](qpaintevent.html) *)
{
[QPainter](qpainter.html) p;
p.begin(this);
p.drawLine(...); // drawing code
p.end();
}
```
使用此構造相同的例子:
```
void MyWidget.paintEvent([QPaintEvent](qpaintevent.html) *)
{
[QPainter](qpainter.html) p(this);
p.drawLine(...); // drawing code
}
```
由于構造函數不能提供反饋時,畫家的初始化失敗,你應該寧可使用[begin](qpainter.html#begin)()和[end](qpainter.html#end)( )畫上的外部設備,例如打印機。
**See also** [begin](qpainter.html#begin)()和[end](qpainter.html#end)( ) 。
```
QBrush QPainter.background (self)
```
[
返回當前背景刷。
](qbrush.html)
[**See also**](qbrush.html) [setBackground](qpainter.html#setBackground)()和[Settings](qpainter.html#settings)。
```
Qt.BGMode QPainter.backgroundMode (self)
```
[
返回當前背景模式。
](qt.html#BGMode-enum)
[**See also**](qt.html#BGMode-enum) [setBackgroundMode](qpainter.html#setBackgroundMode)()和[Settings](qpainter.html#settings)。
```
bool QPainter.begin (self, QPaintDevice)
```
開始畫漆_device_如果成功返回True,否則返回False 。
請注意,所有畫家的設置([setPen](qpainter.html#setPen)( )[setBrush](qpainter.html#setBrush)( )等)被重置為默認時開始值( )被調用。
可能發生的錯誤是嚴重的問題,如這些:
```
painter->begin(0); // impossible - paint device cannot be 0
[QPixmap](qpixmap.html) image(0, 0);
painter->begin(&image); // impossible - image.isNull() == true;
painter->begin(myWidget);
painter2->begin(myWidget); // impossible - only one painter at a time
```
請注意,大多數的時候,你可以使用一個構造函數,而不是開始( ) ,而[end](qpainter.html#end)( )會自動在毀滅完成。
**Warning:**一種涂料設備只能由一個畫家在同一時間內繪。
**Warning:**畫上一個[QImage](qimage.html)與格式[QImage.Format_Indexed8](qimage.html#Format-enum)不被支持。
**See also** [end](qpainter.html#end)()和[QPainter](qpainter.html#QPainter)( ) 。
```
QPainter.beginNativePainting (self)
```
刷新繪畫管道,并準備直接與基礎圖形上下文發出命令的用戶。必須后跟調用[endNativePainting](qpainter.html#endNativePainting)( ) 。
請注意,只有國家的基本繪圖引擎的變化將被重置為各自的默認狀態。我們重置狀態可能會改變從發布到解除。以下狀態重置目前在OpenGL的2引擎:
* blending is disabled
* the depth, stencil and scissor tests are disabled
* the active texture unit is reset to 0
* the depth mask, depth function and the clear depth are reset to their default values
* the stencil mask, stencil operation and stencil function are reset to their default values
* the current color is reset to solid white
如果,例如OpenGL的多邊形模式是由內部的beginNativePaint用戶改變()/[endNativePainting](qpainter.html#endNativePainting)()塊,它不會被重置為默認狀態[endNativePainting](qpainter.html#endNativePainting)( ) 。下面是一個例子,顯示了畫家的命令和原OpenGL命令的混雜:
```
[QPainter](qpainter.html) painter(this);
painter.fillRect(0, 0, 128, 128, [Qt](qt.html).green);
painter.beginNativePainting();
glEnable(GL_SCISSOR_TEST);
glScissor(0, 0, 64, 64);
glClearColor(1, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
glDisable(GL_SCISSOR_TEST);
painter.endNativePainting();
```
此功能被引入Qt的4.6 。
**See also** [endNativePainting](qpainter.html#endNativePainting)( ) 。
```
QRectF QPainter.boundingRect (self, QRectF?rect, int?flags, QString?text)
```
[](qrectf.html)
[返回的矩形邊界_text_因為當內給定的繪制它會出現_rectangle_用指定的_flags_使用當前設置的](qrectf.html)[font](qpainter.html#font)();即該函數告訴你在哪里[drawText](qpainter.html#drawText)( )函數將以此給予相同的參數時。
如果_text_在給定的不適合_rectangle_使用指定的_flags_,該函數返回所需要的矩形。
該_flags_參數是下列標志的按位或:
* [Qt.AlignLeft](qt.html#AlignmentFlag-enum)
* [Qt.AlignRight](qt.html#AlignmentFlag-enum)
* [Qt.AlignHCenter](qt.html#AlignmentFlag-enum)
* [Qt.AlignTop](qt.html#AlignmentFlag-enum)
* [Qt.AlignBottom](qt.html#AlignmentFlag-enum)
* [Qt.AlignVCenter](qt.html#AlignmentFlag-enum)
* [Qt.AlignCenter](qt.html#AlignmentFlag-enum)
* [Qt.TextSingleLine](qt.html#TextFlag-enum)
* [Qt.TextExpandTabs](qt.html#TextFlag-enum)
* [Qt.TextShowMnemonic](qt.html#TextFlag-enum)
* [Qt.TextWordWrap](qt.html#TextFlag-enum)
* [Qt.TextIncludeTrailingSpaces](qt.html#TextFlag-enum)
如果多個水平或幾個的垂直對齊的標志被設置,所產生的取向是不確定的。
**See also** [drawText](qpainter.html#drawText)( )[Qt.Alignment](qt.html#AlignmentFlag-enum)和[Qt.TextFlag](qt.html#TextFlag-enum)。
```
QRect QPainter.boundingRect (self, QRect?rect, int?flags, QString?text)
```
[](qrect.html)
```
QRectF QPainter.boundingRect (self, QRectF?rectangle, QString?text, QTextOption?option?=?QTextOption())
```
[](qrectf.html)
```
QRect QPainter.boundingRect (self, int?x, int?y, int?w, int?h, int?flags, QString?text)
```
[
這是一個重載函數。
](qrect.html)
[返回的矩形邊界_text_因為當內給定的繪制它會出現_rectangle_用指定的_flags_使用當前設置的](qrect.html)[font](qpainter.html#font)( ) 。
```
QBrush QPainter.brush (self)
```
[
返回畫家的當前畫筆。
](qbrush.html)
[**See also**](qbrush.html) [QPainter.setBrush](qpainter.html#setBrush)()和[Settings](qpainter.html#settings)。
```
QPoint QPainter.brushOrigin (self)
```
[
返回當前設置的畫刷原點。
](qpoint.html)
[**See also**](qpoint.html) [setBrushOrigin](qpainter.html#setBrushOrigin)()和[Settings](qpainter.html#settings)。
```
QRectF QPainter.clipBoundingRect (self)
```
[
返回如果有一個夾子當前剪輯的邊框,否則返回一個空的矩形。注意裁剪區域是由于在邏輯坐標。
矩形邊界是不能保證是緊張。
此功能被引入Qt的4.8 。
](qrectf.html)
[**See also**](qrectf.html) [setClipRect](qpainter.html#setClipRect)( )[setClipPath](qpainter.html#setClipPath)()和[setClipRegion](qpainter.html#setClipRegion)( ) 。
```
QPainterPath QPainter.clipPath (self)
```
[
返回當前剪輯的路徑。請注意,剪輯路徑,給出了邏輯坐標。
](qpainterpath.html)
[**Warning:**](qpainterpath.html) [QPainter](qpainter.html)沒有明確地存儲該組合的片段,因為這是由底層處理[QPaintEngine](qpaintengine.html)的,所以路徑被重新按要求并轉化到當前的邏輯坐標系統。這是一個潛在的昂貴的操作。
**See also** [setClipPath](qpainter.html#setClipPath)( )[clipRegion](qpainter.html#clipRegion)()和[setClipping](qpainter.html#setClipping)( ) 。
```
QRegion QPainter.clipRegion (self)
```
[
返回當前設置的裁剪區域。注意裁剪區域是由于在邏輯坐標。
](qregion.html)
[**Warning:**](qregion.html) [QPainter](qpainter.html)沒有明確地存儲該組合的片段,因為這是由底層處理[QPaintEngine](qpaintengine.html)的,所以路徑被重新按要求并轉化到當前的邏輯坐標系統。這是一個潛在的昂貴的操作。
**See also** [setClipRegion](qpainter.html#setClipRegion)( )[clipPath](qpainter.html#clipPath)()和[setClipping](qpainter.html#setClipping)( ) 。
```
QMatrix QPainter.combinedMatrix (self)
```
[](qmatrix.html)
```
QTransform QPainter.combinedTransform (self)
```
[
將轉換矩陣結合當前窗口/視口和世界的改造。
](qtransform.html)
[**See also**](qtransform.html) [setWorldTransform](qpainter.html#setWorldTransform)( )[setWindow](qpainter.html#setWindow)()和[setViewport](qpainter.html#setViewport)( ) 。
```
CompositionMode QPainter.compositionMode (self)
```
[
返回當前的組成模式。
](qpainter.html#CompositionMode-enum)
[**See also**](qpainter.html#CompositionMode-enum) [CompositionMode](qpainter.html#CompositionMode-enum)和[setCompositionMode](qpainter.html#setCompositionMode)( ) 。
```
QPaintDevice QPainter.device (self)
```
[
返回漆設備上這個畫家正在畫畫,或者0,如果畫家不活躍。
](qpaintdevice.html)
[**See also**](qpaintdevice.html) [isActive](qpainter.html#isActive)( ) 。
```
QMatrix QPainter.deviceMatrix (self)
```
[](qmatrix.html)
```
QTransform QPainter.deviceTransform (self)
```
[
返回從轉換邏輯坐標到平臺相關的繪圖設備的設備坐標的矩陣。
](qtransform.html)
[這個功能是_only_在平臺相關的句柄(使用平臺的繪畫命令時需要](qtransform.html)[Qt.HANDLE](qt.html#HANDLE-typedef)),以及平臺不nativly做轉換。
該[QPaintEngine.PaintEngineFeature](qpaintengine.html#PaintEngineFeature-enum)枚舉可以被查詢,以確定是否該平臺進行變換與否。
**See also** [worldTransform](qpainter.html#worldTransform)()和[QPaintEngine.hasFeature](qpaintengine.html#hasFeature)( ) 。
```
QPainter.drawArc (self, QRectF?rect, int?a, int?alen)
```
繪制由給定的定義的弧_rectangle_,_startAngle_和_spanAngle_。
該_startAngle_和_spanAngle_必須以一定程度的十六分之一來指定,即一個完整的圓等于5760 ( 16 * 360 ) 。用于角度的正值逆時針意思而負值意味著順時針方向。零度是在3點鐘的位置。
|  |
```
[QRectF](qrectf.html) rectangle(10.0, 20.0, 80.0, 60.0);
int startAngle = 30 * 16;
int spanAngle = 120 * 16;
[QPainter](qpainter.html) painter(this);
painter.drawArc(rectangle, startAngle, spanAngle);
```
|
**See also** [drawPie](qpainter.html#drawPie)( )[drawChord](qpainter.html#drawChord)()和[Coordinate System](index.htm)。
```
QPainter.drawArc (self, QRect?r, int?a, int?alen)
```
這是一個重載函數。
繪制由給定的定義的弧_rectangle_,_startAngle_和_spanAngle_。
```
QPainter.drawArc (self, int?x, int?y, int?w, int?h, int?a, int?alen)
```
這是一個重載函數。
繪制由矩形起點在(定義弧_x_,_y_)用指定的_width_和_height_和給定的_startAngle_和_spanAngle_。
```
QPainter.drawChord (self, QRectF?rect, int?a, int?alen)
```
繪制和弦由給定的定義_rectangle_,_startAngle_和_spanAngle_。和弦填充有電流[brush](qpainter.html#brush)( ) 。
該startAngle和spanAngle必須以一定程度的十六分之一來指定,即一個完整的圓等于5760 ( 16 * 360 ) 。用于角度的正值逆時針意思而負值意味著順時針方向。零度是在3點鐘的位置。
|  |
```
[QRectF](qrectf.html) rectangle(10.0, 20.0, 80.0, 60.0);
int startAngle = 30 * 16;
int spanAngle = 120 * 16;
[QPainter](qpainter.html) painter(this);
painter.drawChord(rect, startAngle, spanAngle);
```
|
**See also** [drawArc](qpainter.html#drawArc)( )[drawPie](qpainter.html#drawPie)()和[Coordinate System](index.htm)。
```
QPainter.drawChord (self, QRect?rect, int?a, int?alen)
```
這是一個重載函數。
繪制和弦由給定的定義_rectangle_,_startAngle_和_spanAngle_。
```
QPainter.drawChord (self, int?x, int?y, int?w, int?h, int?a, int?alen)
```
這是一個重載函數。
繪制由矩形開始在定義的弦(_x_,_y_)用指定的_width_和_height_和給定的_startAngle_和_spanAngle_。
```
QPainter.drawConvexPolygon (self, QPointF?point, ...)
```
繪制由第一定義的凸多邊形_pointCount_陣列中的點_points_使用當前畫筆。
|  |
```
static const [QPointF](qpointf.html) points[4] = {
[QPointF](qpointf.html)(10.0, 80.0),
[QPointF](qpointf.html)(20.0, 10.0),
[QPointF](qpointf.html)(80.0, 30.0),
[QPointF](qpointf.html)(90.0, 70.0)
};
[QPainter](qpainter.html) painter(this);
painter.drawConvexPolygon(points, 4);
```
|
第一點是隱式連接到最后一個點,該多邊形被填充有電流[brush](qpainter.html#brush)( ) 。如果所提供的多邊形不是凸的,也就是說,它至少包含一個角度大于180度大,其結果是不確定的。
在某些平臺上(例如, X11 )時, drawConvexPolygon ()函數可以比快[drawPolygon](qpainter.html#drawPolygon)()函數。
**See also** [drawPolygon](qpainter.html#drawPolygon)( )[drawPolyline](qpainter.html#drawPolyline)()和[Coordinate System](index.htm)。
```
QPainter.drawConvexPolygon (self, QPolygonF?poly)
```
這是一個重載函數。
繪制由第一定義的凸多邊形_pointCount_陣列中的點_points_使用當前畫筆。
```
QPainter.drawConvexPolygon (self, QPoint?point, ...)
```
這是一個重載函數。
繪制由定義的凸多邊形_polygon_使用當前畫筆和畫刷。
```
QPainter.drawConvexPolygon (self, QPolygon?poly)
```
這是一個重載函數。
繪制由定義的凸多邊形_polygon_使用當前畫筆和畫刷。
```
QPainter.drawEllipse (self, QRectF?r)
```
繪制由指定所定義的橢圓_rectangle_。
一個實心橢圓的大小為_rectangle_。[size()](qrect.html#size)。一個描邊橢圓的大小為_rectangle_。[size()](qrect.html#size)加上畫筆的寬度。
|  |
```
[QRectF](qrectf.html) rectangle(10.0, 20.0, 80.0, 60.0);
[QPainter](qpainter.html) painter(this);
painter.drawEllipse(rectangle);
```
|
**See also** [drawPie](qpainter.html#drawPie)()和[Coordinate System](index.htm)。
```
QPainter.drawEllipse (self, QRect?r)
```
這是一個重載函數。
繪制由指定所定義的橢圓_rectangle_。
```
QPainter.drawEllipse (self, int?x, int?y, int?w, int?h)
```
這是一個重載函數。
繪制由矩形開始在所定義的橢圓(_x_,_y_)用給定的_width_和_height_。
```
QPainter.drawEllipse (self, QPointF?center, float?rx, float?ry)
```
這是一個重載函數。
繪制定位在橢圓_center_與半徑_rx_和_ry_。
此功能被引入Qt的4.4 。
```
QPainter.drawEllipse (self, QPoint?center, int?rx, int?ry)
```
這是一個重載函數。
繪制定位在橢圓_center_與半徑_rx_和_ry_。
此功能被引入Qt的4.4 。
```
QPainter.drawGlyphRun (self, QPointF?position, QGlyphRun?glyphRun)
```
繪制指定_glyphs_在給定的_position_。該_position_給出了基線的字形串的邊緣。字形將從所選擇的字體檢索_glyphs_以及在由位置給定偏移_glyphs_。
此功能被引入Qt的4.8 。
**See also** [QGlyphRun.setRawFont](qglyphrun.html#setRawFont)( )[QGlyphRun.setPositions](qglyphrun.html#setPositions)()和[QGlyphRun.setGlyphIndexes](qglyphrun.html#setGlyphIndexes)( ) 。
```
QPainter.drawImage (self, QRectF?targetRect, QImage?image, QRectF?sourceRect, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)
```
繪制矩形部分_source_的給定_image_進入_target_矩形的繪圖設備。
**Note:**圖像縮放以適合該矩形,如果兩個圖像和矩形大小不同意。
如果圖像需要進行修改,以適應在較低分辨率的結果(例如,從32位轉換為8位),使用_flags_指定你將如何喜歡這樣的事情發生。
|
```
[QRectF](qrectf.html) target(10.0, 20.0, 80.0, 60.0);
[QRectF](qrectf.html) source(0.0, 0.0, 70.0, 40.0);
[QImage](qimage.html) image(":/../img/myImage.png");
[QPainter](qpainter.html) painter(this);
painter.drawImage(target, image, source);
```
|
**See also** [drawPixmap](qpainter.html#drawPixmap)( ) 。
```
QPainter.drawImage (self, QRect?targetRect, QImage?image, QRect?sourceRect, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)
```
這是一個重載函數。
繪制矩形部分_source_的給定_image_進入_target_矩形的繪圖設備。
**Note:**圖像縮放以適合該矩形,如果兩個圖像和矩形大小不同意。
```
QPainter.drawImage (self, QPointF?p, QImage?image, QRectF?sr, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)
```
這是一個重載函數。
繪制給定的_image_在給定的_point_。
```
QPainter.drawImage (self, QPoint?p, QImage?image, QRect?sr, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)
```
這是一個重載函數。
繪制給定的_image_在給定的_point_。
```
QPainter.drawImage (self, QRectF?r, QImage?image)
```
這是一個重載函數。
繪制矩形部分_source_的給定_image_其原點在給定的_point_。
```
QPainter.drawImage (self, QRect?r, QImage?image)
```
這是一個重載函數。
繪制矩形部分_source_的給定_image_其原點在給定的_point_。
```
QPainter.drawImage (self, QPointF?p, QImage?image)
```
這是一個重載函數。
繪制給定的_image_在給定的_rectangle_。
**Note:**圖像縮放以適合該矩形,如果兩個圖像和矩形大小不同意。
```
QPainter.drawImage (self, QPoint?p, QImage?image)
```
這是一個重載函數。
繪制給定的_image_在給定的_rectangle_。
**Note:**圖像縮放以適合該矩形,如果兩個圖像和矩形大小不同意。
```
QPainter.drawImage (self, int?x, int?y, QImage?image, int?sx?=?0, int?sy?=?0, int?sw?=?-1, int?sh?=?-1, Qt.ImageConversionFlags?flags?=?Qt.AutoColor)
```
這是一個重載函數。
繪制圖像時(_x_,_y_)通過復制的一部分_image_入漆設備。
(_x_,_y_)指定在繪制設備將要被繪制到左上點。 (_sx_,_sy_)指定左上角點_image_要被繪制。默認值是(0 ,0)。
(_sw_,_sh_)指定將要被繪制的圖像的大小。默認的,(0, 0)(和負)指一路圖像的右下角。
```
QPainter.drawLine (self, QLineF?l)
```
繪制由定義的直線_line_。
|  |
```
[QLineF](qlinef.html) line(10.0, 80.0, 90.0, 20.0);
[QPainter](qpainter.html)(this);
painter.drawLine(line);
```
|
**See also** [drawLines](qpainter.html#drawLines)( )[drawPolyline](qpainter.html#drawPolyline)()和[Coordinate System](index.htm)。
```
QPainter.drawLine (self, QLine?line)
```
這是一個重載函數。
繪制由定義的直線_line_。
```
QPainter.drawLine (self, int?x1, int?y1, int?x2, int?y2)
```
這是一個重載函數。
繪制一條線從_p1_至_p2_。
```
QPainter.drawLine (self, QPoint?p1, QPoint?p2)
```
這是一個重載函數。
繪制一條線從_p1_至_p2_。
```
QPainter.drawLine (self, QPointF?p1, QPointF?p2)
```
這是一個重載函數。
繪制一條線從(_x1_,_y1_)至(_x2_,_y2_),并設置當前畫筆位置為(_x2_,_y2_) 。
```
QPainter.drawLines (self, QLineF?line, ...)
```
繪制第一_lineCount_陣列中的行_lines_使用當前畫筆。
**See also** [drawLine](qpainter.html#drawLine)()和[drawPolyline](qpainter.html#drawPolyline)( ) 。
```
QPainter.drawLines (self, list-of-QLineF?lines)
```
這是一個重載函數。
繪制第一_lineCount_陣列中的行_lines_使用當前畫筆。
```
QPainter.drawLines (self, QPointF?pointPair, ...)
```
這是一個重載函數。
繪制第一_lineCount_陣列中的行_pointPairs_使用當前畫筆。的線被指定為點對這樣的項的數目_pointPairs_必須至少_lineCount_* 2 。
```
QPainter.drawLines (self, list-of-QPointF?pointPairs)
```
這是一個重載函數。
繪制第一_lineCount_陣列中的行_pointPairs_使用當前畫筆。
```
QPainter.drawLines (self, QLine?line, ...)
```
這是一個重載函數。
繪制一條線為每對點的矢量_pointPairs_ using the current pen. If there is an odd number of points in the array, the last point will be ignored.
```
QPainter.drawLines (self, list-of-QLine?lines)
```
這是一個重載函數。
繪制一條線為每對點的矢量_pointPairs_使用當前畫筆。
```
QPainter.drawLines (self, QPoint?pointPair, ...)
```
這是一個重載函數。
繪制集的列表中定義的行_lines_使用當前畫筆和畫刷。
```
QPainter.drawLines (self, list-of-QPoint?pointPairs)
```
這是一個重載函數。
繪制集的列表中定義的行_lines_使用當前畫筆和畫刷。
```
QPainter.drawPath (self, QPainterPath?path)
```
繪制給定的畫家_path_使用當前筆的輪廓和當前畫筆填充。
|  |
```
[QPainterPath](qpainterpath.html) path;
path.moveTo(20, 80);
path.lineTo(20, 30);
path.cubicTo(80, 0, 50, 50, 80, 80);
[QPainter](qpainter.html) painter(this);
painter.drawPath(path);
```
|
**See also** [the Painter Paths example](index.htm)和[the Vector Deformation demo](index.htm)。
```
QPainter.drawPicture (self, QPointF?p, QPicture?picture)
```
重播給定的_picture_在給定的_point_。
該[QPicture](qpicture.html)類是一個繪圖設備,記錄和重放[QPainter](qpainter.html)的命令。的圖片序列畫家命令IO設備在一個平臺無關的格式。可以涂在一個部件或pixmap的一切也可以被存儲在一個圖像。
這個函數完全一樣[QPicture.play](qpicture.html#play)( )調用時使用_point_=[QPoint](qpoint.html)(0 ,0)。
|
```
[QPicture](qpicture.html) picture;
[QPointF](qpointf.html) point(10.0, 20.0)
picture.load("drawing.pic");
[QPainter](qpainter.html) painter(this);
painter.drawPicture(0, 0, picture);
```
|
**See also** [QPicture.play](qpicture.html#play)( ) 。
```
QPainter.drawPicture (self, int?x, int?y, QPicture?p)
```
這是一個重載函數。
重播給定的_picture_在給定的_point_。
```
QPainter.drawPicture (self, QPoint?pt, QPicture?p)
```
這是一個重載函數。
繪制給定的_picture_在點(_x_,_y_) 。
```
QPainter.drawPie (self, QRectF?rect, int?a, int?alen)
```
繪制由指定所定義的扇形_rectangle_,_startAngle_和和_spanAngle_。
餡餅填充有電流[brush](qpainter.html#brush)( ) 。
該startAngle和spanAngle必須以一定程度的十六分之一來指定,即一個完整的圓等于5760 ( 16 * 360 ) 。用于角度的正值逆時針意思而負值意味著順時針方向。零度是在3點鐘的位置。
|  |
```
[QRectF](qrectf.html) rectangle(10.0, 20.0, 80.0, 60.0);
int startAngle = 30 * 16;
int spanAngle = 120 * 16;
[QPainter](qpainter.html) painter(this);
painter.drawPie(rectangle, startAngle, spanAngle);
```
|
**See also** [drawEllipse](qpainter.html#drawEllipse)( )[drawChord](qpainter.html#drawChord)()和[Coordinate System](index.htm)。
```
QPainter.drawPie (self, QRect?rect, int?a, int?alen)
```
這是一個重載函數。
繪制由指定所定義的扇形_rectangle_,_startAngle_和和_spanAngle_。
```
QPainter.drawPie (self, int?x, int?y, int?w, int?h, int?a, int?alen)
```
這是一個重載函數。
繪制由矩形開始在定義的餡餅(_x_,_y_)用指定的_width_和_height_和給定的_startAngle_和_spanAngle_。
```
QPainter.drawPixmap (self, QRectF?targetRect, QPixmap?pixmap, QRectF?sourceRect)
```
繪制矩形部分_source_的給定_pixmap_在給定的_target_在油漆設備。
**Note:**像素圖進行縮放以適合該矩形,如果兩個像素圖和矩形大小不同意。
|
```
[QRectF](qrectf.html) target(10.0, 20.0, 80.0, 60.0);
[QRectF](qrectf.html) source(0.0, 0.0, 70.0, 40.0);
[QPixmap](qpixmap.html) pixmap(":myPixmap.png");
[QPainter](qpainter.html)(this);
painter.drawPixmap(target, image, source);
```
|
If _pixmap_是[QBitmap](qbitmap.html)它被畫成與正在使用的筆的顏色“設置”的位。如果backgroundMode是[Qt.OpaqueMode](qt.html#BGMode-enum)中,“未設置”位所使用的背景畫筆的顏色繪制,如果backgroundMode是[Qt.TransparentMode](qt.html#BGMode-enum)中,“未設置”位是透明的。不支持位圖繪制具有漸變或紋理的顏色。
**See also** [drawImage](qpainter.html#drawImage)( ) 。
```
QPainter.drawPixmap (self, QRect?targetRect, QPixmap?pixmap, QRect?sourceRect)
```
這是一個重載函數。
繪制矩形部分_source_的給定_pixmap_在給定的_target_在油漆設備。
**Note:**像素圖進行縮放以適合該矩形,如果兩個像素圖和矩形大小不同意。
```
QPainter.drawPixmap (self, QPointF?p, QPixmap?pm)
```
這是一個重載函數。
繪制矩形部分_source_的給定_pixmap_其原點在給定的_point_。
```
QPainter.drawPixmap (self, QPoint?p, QPixmap?pm)
```
這是一個重載函數。
繪制矩形部分_source_的給定_pixmap_其原點在給定的_point_。
```
QPainter.drawPixmap (self, QRect?r, QPixmap?pm)
```
這是一個重載函數。
繪制給定的_pixmap_其原點在給定的_point_。
```
QPainter.drawPixmap (self, int?x, int?y, QPixmap?pm)
```
這是一個重載函數。
繪制給定的_pixmap_其原點在給定的_point_。
```
QPainter.drawPixmap (self, int?x, int?y, int?w, int?h, QPixmap?pm)
```
這是一個重載函數。
繪制給定的_pixmap_在位置(_x_,_y_) 。
```
QPainter.drawPixmap (self, int?x, int?y, int?w, int?h, QPixmap?pm, int?sx, int?sy, int?sw, int?sh)
```
這是一個重載函數。
繪制給定的_pixmap_在給定的_rectangle_。
**Note:**像素圖進行縮放以適合該矩形,如果兩個像素圖和矩形大小不同意。
```
QPainter.drawPixmap (self, int?x, int?y, QPixmap?pm, int?sx, int?sy, int?sw, int?sh)
```
這是一個重載函數。
繪制_pixmap_成在位置(矩形_x_,_y_)用給定的_width_和_height_。
```
QPainter.drawPixmap (self, QPointF?p, QPixmap?pm, QRectF?sr)
```
這是一個重載函數。
繪制與原點的矩形部分(_sx_,_sy_) ,寬度_sw_和高度_sh_,的給定_pixmap_,在點(_x_,_y_) ,具有一寬_w_及的高度_h_。如果SW或SH都等于零的像素映像的寬度/高度被使用,并且調整由偏移SX / SY ;
```
QPainter.drawPixmap (self, QPoint?p, QPixmap?pm, QRect?sr)
```
這是一個重載函數。
繪制像素圖在(_x_,_y_)通過復制的特定部分_pixmap_入漆設備。
(_x_,_y_)指定在繪制設備將要被繪制到左上點。 (_sx_,_sy_)指定左上角點_pixmap_要被繪制。默認值是(0 ,0)。
(_sw_,_sh_)指定像素要被繪制的大小。默認的,(0, 0)(和負)是指所有的方式向像素圖的右下角。
```
QPainter.drawPixmapFragments (self, list-of-QPainter.PixmapFragment?fragments, QPixmap?pixmap, PixmapFragmentHints?hints?=?0)
```
此功能是用來繪制_pixmap_,或者一個子矩形_pixmap_,在不同的縮放,旋轉和透明度多個位置。_fragments_是陣列_fragmentCount_元素指定用于繪制每個像素映射片段的參數。該_hints_參數可用于傳遞在繪制提示。
此功能可能比多次調用更快[drawPixmap](qpainter.html#drawPixmap)() ,因為后端可以優化狀態的變化。
此功能被引入Qt的4.7 。
**See also** [QPainter.PixmapFragment](index.htm)和[QPainter.PixmapFragmentHint](qpainter.html#PixmapFragmentHint-enum)。
```
QPainter.drawPixmapFragments (self, list-of-QRectF?targetRects, list-of-QRectF?sourceRects, QPixmap?pixmap, PixmapFragmentHints?hints?=?0)
```
該_sourceRects_參數也可能沒有。
此功能是用來繪制相同_pixmap_由指定多個目標和源矩形_targetRects_。如果_sourceRects_為0 ,整個像素映像將在每個目標矩形的呈現。該_hints_參數可用于傳遞在繪制提示。
此功能可能比多次調用更快[drawPixmap](qpainter.html#drawPixmap)() ,因為后端可以優化狀態的變化。
此功能被引入Qt的4.8 。
**See also** [QPainter.PixmapFragmentHint](qpainter.html#PixmapFragmentHint-enum)。
```
QPainter.drawPoint (self, QPointF?p)
```
繪制一個單點在給定的_position_使用當前畫筆的顏色。
**See also** [Coordinate System](index.htm)。
```
QPainter.drawPoint (self, int?x, int?y)
```
這是一個重載函數。
繪制一個單點在給定的_position_使用當前畫筆的顏色。
```
QPainter.drawPoint (self, QPoint?p)
```
這是一個重載函數。
繪制一個單點位置(_x_,_y_) 。
```
QPainter.drawPoints (self, QPointF?point, ...)
```
繪制第一_pointCount_陣列中的點_points_使用當前畫筆的顏色。
**See also** [Coordinate System](index.htm)。
```
QPainter.drawPoints (self, QPolygonF?points)
```
這是一個重載函數。
繪制第一_pointCount_陣列中的點_points_使用當前畫筆的顏色。
```
QPainter.drawPoints (self, QPoint?point, ...)
```
這是一個重載函數。
繪制點的矢量_points_。
```
QPainter.drawPoints (self, QPolygon?points)
```
這是一個重載函數。
繪制點的矢量_points_。
```
QPainter.drawPolygon (self, QPointF?point, ...)
```
繪制由第一定義的多邊形_pointCount_陣列中的點_points_使用當前畫筆和畫刷。
|  |
```
static const [QPointF](qpointf.html) points[4] = {
[QPointF](qpointf.html)(10.0, 80.0),
[QPointF](qpointf.html)(20.0, 10.0),
[QPointF](qpointf.html)(80.0, 30.0),
[QPointF](qpointf.html)(90.0, 70.0)
};
[QPainter](qpainter.html) painter(this);
painter.drawPolygon(points, 4);
```
|
第一點是隱式連接到最后一個點,該多邊形被填充有電流[brush](qpainter.html#brush)( ) 。
If _fillRule_ is [Qt.WindingFill](qt.html#FillRule-enum)中,多邊形是用繞組填充算法填充。如果_fillRule_ is [Qt.OddEvenFill](qt.html#FillRule-enum)中,多邊形是使用奇偶填充算法填充。看[Qt.FillRule](qt.html#FillRule-enum)對于這些填充規則的更詳細的描述。
**See also** [drawConvexPolygon](qpainter.html#drawConvexPolygon)( )[drawPolyline](qpainter.html#drawPolyline)()和[Coordinate System](index.htm)。
```
QPainter.drawPolygon (self, QPolygonF?points, Qt.FillRule?fillRule?=?Qt.OddEvenFill)
```
這是一個重載函數。
繪制由第一定義的多邊形_pointCount_陣列中的點_points_。
```
QPainter.drawPolygon (self, QPoint?point, ...)
```
```
QPainter.drawPolygon (self, QPolygon?points, Qt.FillRule?fillRule?=?Qt.OddEvenFill)
```
```
QPainter.drawPolyline (self, QPointF?point, ...)
```
繪制由第一定義的折線_pointCount_在點_points_使用當前畫筆。
請注意,與[drawPolygon](qpainter.html#drawPolygon)( )函數的最后一點是_not_連接到第一個,也不是漫天的折線。
|
```
static const [QPointF](qpointf.html) points[3] = {
[QPointF](qpointf.html)(10.0, 80.0),
[QPointF](qpointf.html)(20.0, 10.0),
[QPointF](qpointf.html)(80.0, 30.0),
};
[QPainter](qpainter.html) painter(this);
painter.drawPolyline(points, 3);
```
|
**See also** [drawLines](qpainter.html#drawLines)( )[drawPolygon](qpainter.html#drawPolygon)()和[Coordinate System](index.htm)。
```
QPainter.drawPolyline (self, QPolygonF?polyline)
```
這是一個重載函數。
繪制由第一定義的折線_pointCount_在點_points_使用當前畫筆。
```
QPainter.drawPolyline (self, QPoint?point, ...)
```
```
QPainter.drawPolyline (self, QPolygon?polyline)
```
這是一個重載函數。
繪制由給定的定義的折線_points_使用當前畫筆。
```
QPainter.drawRect (self, QRectF?rect)
```
繪制電流_rectangle_與當前的畫筆和畫刷。
一個填充矩形的大小為_rectangle_。大小( ) 。一個描邊矩形的大小為_rectangle_。大小( ),再加上畫筆的寬度。
|  |
```
[QRectF](qrectf.html) rectangle(10.0, 20.0, 80.0, 60.0);
[QPainter](qpainter.html) painter(this);
painter.drawRect(rectangle);
```
|
**See also** [drawRects](qpainter.html#drawRects)( )[drawPolygon](qpainter.html#drawPolygon)()和[Coordinate System](index.htm)。
```
QPainter.drawRect (self, int?x, int?y, int?w, int?h)
```
這是一個重載函數。
繪制電流_rectangle_與當前的畫筆和畫刷。
```
QPainter.drawRect (self, QRect?r)
```
這是一個重載函數。
與繪制左上角的矩形在(_x_,_y_),并用給定的_width_和_height_。
```
QPainter.drawRects (self, QRectF?rect, ...)
```
繪制第一_rectCount_的給定_rectangles_使用當前畫筆和畫刷。
**See also** [drawRect](qpainter.html#drawRect)( ) 。
```
QPainter.drawRects (self, list-of-QRectF?rects)
```
這是一個重載函數。
繪制第一_rectCount_的給定_rectangles_使用當前畫筆和畫刷。
```
QPainter.drawRects (self, QRect?rect, ...)
```
這是一個重載函數。
繪制給定的_rectangles_使用當前畫筆和畫刷。
```
QPainter.drawRects (self, list-of-QRect?rects)
```
這是一個重載函數。
繪制給定的_rectangles_使用當前畫筆和畫刷。
```
QPainter.drawRoundedRect (self, QRectF?rect, float?xRadius, float?yRadius, Qt.SizeMode?mode?=?Qt.AbsoluteSize)
```
繪制一個矩形_rect_帶有圓角。
該_xRadius_和_yRadius_參數指定限定的圓角矩形的角部的橢圓形的半徑。何時_mode_ is [Qt.RelativeSize](qt.html#SizeMode-enum),_xRadius_和_yRadius_在一半的矩形的寬度和高度的比例分別指定,并應在范圍0.0至100.0 。
填充的矩形具有rect.size (的大小) 。一個描邊矩形具有rect.size的大小( ),再加上畫筆的寬度。
|  |
```
[QRectF](qrectf.html) rectangle(10.0, 20.0, 80.0, 60.0);
[QPainter](qpainter.html) painter(this);
painter.drawRoundedRect(rectangle, 20.0, 15.0);
```
|
此功能被引入Qt的4.4 。
**See also** [drawRect](qpainter.html#drawRect)()和[QPen](qpen.html)。
```
QPainter.drawRoundedRect (self, int?x, int?y, int?w, int?h, float?xRadius, float?yRadius, Qt.SizeMode?mode?=?Qt.AbsoluteSize)
```
這是一個重載函數。
繪制一個矩形_rect_帶有圓角。
此功能被引入Qt的4.4 。
```
QPainter.drawRoundedRect (self, QRect?rect, float?xRadius, float?yRadius, Qt.SizeMode?mode?=?Qt.AbsoluteSize)
```
這是一個重載函數。
繪制一個矩形_x_,_y_,_w_,_h_帶有圓角。
此功能被引入Qt的4.4 。
```
QPainter.drawRoundRect (self, QRectF?r, int?xRound?=?25, int?yRound?=?25)
```
```
QPainter.drawRoundRect (self, int?x, int?y, int?w, int?h, int?xRound?=?25, int?yRound?=?25)
```
```
QPainter.drawRoundRect (self, QRect?r, int?xRound?=?25, int?yRound?=?25)
```
```
QPainter.drawStaticText (self, QPointF?topLeftPosition, QStaticText?staticText)
```
繪制給定的_staticText_在給定的_topLeftPosition_。
該文本將使用的字體和畫家的改造集繪制。如果畫家設置字體和/或轉型是從用來初始化的布局有些出入[QStaticText](qstatictext.html),則布局將不得不被重新計算。使用[QStaticText.prepare](qstatictext.html#prepare)()來初始化_staticText_與字體和轉型與它稍后將繪制。
If _topLeftPosition_是不一樣的,當_staticText_被初始化,或當它被最后繪制,那么就會有翻譯文本到新的位置時,會有輕微的開銷。
**Note:**如果畫家的轉變不仿射,然后_staticText_將使用普通電話要繪制[drawText](qpainter.html#drawText)( ) ,失去對性能改善的潛力。
**Note:**y位置被用作字體的頂部。
此功能被引入Qt的4.7 。
**See also** [QStaticText](qstatictext.html)。
```
QPainter.drawStaticText (self, QPoint?p, QStaticText?staticText)
```
這是一個重載函數。
繪制_staticText_在_topLeftPosition_。
**Note:**y位置被用作字體的頂部。
此功能被引入Qt的4.7 。
```
QPainter.drawStaticText (self, int?x, int?y, QStaticText?staticText)
```
這是一個重載函數。
繪制_staticText_在坐標_left_和_top_。
**Note:**y位置被用作字體的頂部。
此功能被引入Qt的4.7 。
```
QPainter.drawText (self, QPointF?p, QString?s)
```
繪制給定的_text_與當前定義的文字方向,開始在給定的_position_。
此功能不處理換行符( \ n)的,因為它不能將文本分成多行,并且它不能顯示換行符。使用QPainter.drawText ( )重載采用一個矩形,而是如果要繪制與換行符多行文本,或者如果您希望文本換行。
默認情況下,[QPainter](qpainter.html)繪制文本抗鋸齒。
**Note:**y位置被用作字體的基線。
```
QRectF?boundingRect QPainter.drawText (self, QRectF?rectangle, int?flags, QString?text)
```
[](qrectf.html)
```
QRect?boundingRect QPainter.drawText (self, QRect?rectangle, int?flags, QString?text)
```
[
```
QPainter.drawText (self, QRectF?rectangle, QString?text, QTextOption?option?=?QTextOption())
```
```
QPainter.drawText (self, QPoint?p, QString?s)
```
](qrect.html)
```
QRect?boundingRect QPainter.drawText (self, int?x, int?y, int?width, int?height, int?flags, QString?text)
```
[
```
QPainter.drawText (self, int?x, int?y, QString?s)
```
```
QPainter.drawTiledPixmap (self, QRectF?rectangle, QPixmap?pixmap, QPointF?pos?=?QPointF())
```
繪制的瓷磚_pixmap_,里面的定_rectangle_其原點在給定的_position_。
](qrect.html)
[調用drawTiledPixmap ( )類似于調用](qrect.html)[drawPixmap](qpainter.html#drawPixmap)( )多次填寫(瓦)的面積與像素圖,而是取決于不同的底層窗口系統上可能效率更高。
**See also** [drawPixmap](qpainter.html#drawPixmap)( ) 。
```
QPainter.drawTiledPixmap (self, QRect?rectangle, QPixmap?pixmap, QPoint?pos?=?QPoint())
```
這是一個重載函數。
繪制的瓷磚_pixmap_,里面的定_rectangle_其原點在給定的_position_。
```
QPainter.drawTiledPixmap (self, int?x, int?y, int?width, int?height, QPixmap?pixmap, int?sx?=?0, int?sy?=?0)
```
這是一個重載函數。
繪制的瓷磚_pixmap_在指定的矩形。
(_x_,_y_)指定在繪制設備將要被繪制到左上頂點;用給定的_width_和_height_。 (_sx_,_sy_)指定在左上角點_pixmap_要被繪制的,這默認為(0 ,0)。
```
bool QPainter.end (self)
```
完畫。而畫中使用的任何資源被釋放。你通常不需要調用這個,因為它是由所謂的析構函數。
返回True如果畫家不再有效,否則返回False 。
**See also** [begin](qpainter.html#begin)()和[isActive](qpainter.html#isActive)( ) 。
```
QPainter.endNativePainting (self)
```
后手動發布本地繪制命令恢復畫家。讓畫家還原它依賴于調用任何其他畫家的命令之前的任何原生狀態。
此功能被引入Qt的4.6 。
**See also** [beginNativePainting](qpainter.html#beginNativePainting)( ) 。
```
QPainter.eraseRect (self, QRectF)
```
擦除內部給定的區域_rectangle_。相當于調用
```
fillRect(rectangle, background()).
```
**See also** [fillRect](qpainter.html#fillRect)( ) 。
```
QPainter.eraseRect (self, QRect?rect)
```
這是一個重載函數。
擦除內部給定的區域_rectangle_。
```
QPainter.eraseRect (self, int?x, int?y, int?w, int?h)
```
這是一個重載函數。
擦除矩形開始內部的區域處(_x_,_y_)用給定的_width_和_height_。
```
QPainter.fillPath (self, QPainterPath?path, QBrush?brush)
```
充填所給的_path_使用給定的_brush_。大綱中未畫出。
或者,您可以指定一個[QColor](qcolor.html)代替[QBrush](qbrush.html);的[QBrush](qbrush.html)構造函數(服用[QColor](qcolor.html)參數)會自動創建一個堅實的圖案畫筆。
**See also** [drawPath](qpainter.html#drawPath)( ) 。
```
QPainter.fillRect (self, QRectF, QBrush)
```
充填所給的_rectangle_與_brush_規定。
或者,您可以指定一個[QColor](qcolor.html)代替[QBrush](qbrush.html);的[QBrush](qbrush.html)構造函數(服用[QColor](qcolor.html)參數)會自動創建一個堅實的圖案畫筆。
**See also** [drawRect](qpainter.html#drawRect)( ) 。
```
QPainter.fillRect (self, QRect, QBrush)
```
這是一個重載函數。
填充矩形開始時(_x_,_y_)用給定的_width_和_height_使用刷子_style_規定。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, int?x, int?y, int?w, int?h, QBrush?b)
```
這是一個重載函數。
充填所給的_rectangle_與刷_style_規定。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, QRectF, QColor?color)
```
這是一個重載函數。
充填所給的_rectangle_與刷_style_規定。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, QRect, QColor?color)
```
這是一個重載函數。
充填所給的_rectangle_用指定的_brush_。
```
QPainter.fillRect (self, int?x, int?y, int?w, int?h, QColor?b)
```
這是一個重載函數。
充填所給的_rectangle_與_color_規定。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, int?x, int?y, int?w, int?h, Qt.GlobalColor?c)
```
這是一個重載函數。
充填所給的_rectangle_與_color_規定。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, QRect?r, Qt.GlobalColor?c)
```
這是一個重載函數。
填充矩形開始時(_x_,_y_)用給定的_width_和_height_,使用給定的_brush_。
```
QPainter.fillRect (self, QRectF?r, Qt.GlobalColor?c)
```
這是一個重載函數。
填充矩形開始時(_x_,_y_)用給定的_width_和_height_,使用給定的_color_。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, int?x, int?y, int?w, int?h, Qt.BrushStyle?style)
```
這是一個重載函數。
填充矩形開始時(_x_,_y_)用給定的_width_和_height_,使用給定的_color_。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, QRect?r, Qt.BrushStyle?style)
```
這是一個重載函數。
充填所給的_rectangle_用指定的_color_。
此功能被引入Qt的4.5 。
```
QPainter.fillRect (self, QRectF?r, Qt.BrushStyle?style)
```
這是一個重載函數。
充填所給的_rectangle_用指定的_color_。
此功能被引入Qt的4.5 。
```
QFont QPainter.font (self)
```
[
返回用于繪制文本的當前設置的字體。
](qfont.html)
[**See also**](qfont.html) [setFont](qpainter.html#setFont)( )[drawText](qpainter.html#drawText)()和[Settings](qpainter.html#settings)。
```
QFontInfo QPainter.fontInfo (self)
```
[
返回畫家的字體信息,如果畫家是積極的。否則,返回值是不確定的。
](qfontinfo.html)
[**See also**](qfontinfo.html) [font](qpainter.html#font)( )[isActive](qpainter.html#isActive)()和[Settings](qpainter.html#settings)。
```
QFontMetrics QPainter.fontMetrics (self)
```
[
返回的字體規格為畫家當畫家是積極的。否則,返回值是不確定的。
](qfontmetrics.html)
[**See also**](qfontmetrics.html) [font](qpainter.html#font)( )[isActive](qpainter.html#isActive)()和[Settings](qpainter.html#settings)。
```
bool QPainter.hasClipping (self)
```
返回True如果裁剪已經設置,否則返回False 。
**See also** [setClipping](qpainter.html#setClipping)()和[Clipping](qpainter.html#clipping)。
```
QPainter.initFrom (self, QWidget?widget)
```
初始化畫家的筆,背景和字體一樣給出_widget_。當畫家被打開的這個功能是自動調用[QWidget](qwidget.html)。
**See also** [begin](qpainter.html#begin)()和[Settings](qpainter.html#settings)。
```
bool QPainter.isActive (self)
```
返回True如果[begin](qpainter.html#begin)( )被調用,并[end](qpainter.html#end)( )尚未被調用,否則返回False 。
**See also** [begin](qpainter.html#begin)()和[QPaintDevice.paintingActive](qpaintdevice.html#paintingActive)( ) 。
```
Qt.LayoutDirection QPainter.layoutDirection (self)
```
[
返回繪制文本時所使用的畫家布局方向。
](qt.html#LayoutDirection-enum)
[**See also**](qt.html#LayoutDirection-enum) [QTextOption.textDirection](qtextoption.html#textDirection)( )[setLayoutDirection](qpainter.html#setLayoutDirection)( )[drawText](qpainter.html#drawText)()和[Settings](qpainter.html#settings)。
```
QMatrix QPainter.matrix (self)
```
[
```
bool QPainter.matrixEnabled (self)
```
```
float QPainter.opacity (self)
```
返回畫家的不透明度。默認值是1。
這個函數中引入了Qt 4.2中。
](qmatrix.html)
[**See also**](qmatrix.html) [setOpacity](qpainter.html#setOpacity)( ) 。
```
QPaintEngine QPainter.paintEngine (self)
```
[
返回繪圖引擎的畫家是目前,如果畫家是積極的運作,否則為0 。
](qpaintengine.html)
[**See also**](qpaintengine.html) [isActive](qpainter.html#isActive)( ) 。
```
QPen QPainter.pen (self)
```
[
返回畫家的當前畫筆。
](qpen.html)
[**See also**](qpen.html) [setPen](qpainter.html#setPen)()和[Settings](qpainter.html#settings)。
```
QPaintDevice QPainter.redirected (QPaintDevice?device, QPoint?offset?=?None)
```
[](qpaintdevice.html)
```
RenderHints QPainter.renderHints (self)
```
[
返回一個標志,指定在這個畫家將呈現提示。
](index.htm)
[**See also**](index.htm) [setRenderHints](qpainter.html#setRenderHints)( )[testRenderHint](qpainter.html#testRenderHint)()和[Rendering Quality](qpainter.html#rendering-quality)。
```
QPainter.resetMatrix (self)
```
```
QPainter.resetTransform (self)
```
重置過去使用的任何變革[translate](qpainter.html#translate)( )[scale](qpainter.html#scale)( )[shear](qpainter.html#shear)( )[rotate](qpainter.html#rotate)( )[setWorldTransform](qpainter.html#setWorldTransform)( )[setViewport](qpainter.html#setViewport)()和[setWindow](qpainter.html#setWindow)( ) 。
**See also** [Coordinate Transformations](qpainter.html#coordinate-transformations)。
```
QPainter.restore (self)
```
恢復當前的畫家狀態(彈出一個保存的狀態出棧) 。
**See also** [save](qpainter.html#save)( ) 。
```
QPainter.restoreRedirected (QPaintDevice?device)
```
```
QPainter.rotate (self, float?a)
```
旋轉坐標系中給出_angle_順時針方向旋轉。
**See also** [setWorldTransform](qpainter.html#setWorldTransform)()和[Coordinate Transformations](qpainter.html#coordinate-transformations)。
```
QPainter.save (self)
```
保存當前狀態的畫家(推狀態入棧) 。一個save()方法必須遵循的相應的[restore](qpainter.html#restore)();的[end](qpainter.html#end)( )函數展開棧。
**See also** [restore](qpainter.html#restore)( ) 。
```
QPainter.scale (self, float?sx, float?sy)
```
由(縮放坐標系_sx_,_sy_) 。
**See also** [setWorldTransform](qpainter.html#setWorldTransform)()和[Coordinate Transformations](qpainter.html#coordinate-transformations)。
```
QPainter.setBackground (self, QBrush?bg)
```
設定畫家的背景刷到給定_brush_。
背景畫筆是繪制不透明文本,點畫線和位圖填充時,在刷。背景刷沒有效果的透明背景模式(這是默認值) 。
**See also** [background](qpainter.html#background)( )[setBackgroundMode](qpainter.html#setBackgroundMode)()和[Settings](qpainter.html#settings)。
```
QPainter.setBackgroundMode (self, Qt.BGMode?mode)
```
設定畫家的背景模式給定的_mode_
[Qt.TransparentMode](qt.html#BGMode-enum)(默認值)繪制點畫線條和文字沒有設置背景像素。[Qt.OpaqueMode](qt.html#BGMode-enum)填充這些空間與當前的背景色。
需要注意的是,為了繪制位圖或像素透明,則必須使用[QPixmap.setMask](qpixmap.html#setMask)( ) 。
**See also** [backgroundMode](qpainter.html#backgroundMode)( )[setBackground](qpainter.html#setBackground)()和[Settings](qpainter.html#settings)。
```
QPainter.setBrush (self, QBrush?brush)
```
集畫家筆下的給定_brush_。
畫家筆下的定義是如何的形狀填充。
**See also** [brush](qpainter.html#brush)()和[Settings](qpainter.html#settings)。
```
QPainter.setBrush (self, Qt.BrushStyle?style)
```
這是一個重載函數。
集畫家筆下的黑顏色和指定的_style_。
```
QPainter.setBrushOrigin (self, QPointF)
```
設置畫筆原點_position_。
畫刷原點指定( 0 , 0 )畫家筆下的坐標。
請注意,雖然[brushOrigin](qpainter.html#brushOrigin)( )是要采取父母的背景Qt中3小部件,這已不再是如此,因為Qt的4畫家不畫背景,除非你明確告訴它通過設置widget的這樣做[autoFillBackground](qwidget.html#autoFillBackground-prop)屬性設置為True 。
**See also** [brushOrigin](qpainter.html#brushOrigin)()和[Settings](qpainter.html#settings)。
```
QPainter.setBrushOrigin (self, int?x, int?y)
```
這是一個重載函數。
設置畫筆的原點給定的_position_。
```
QPainter.setBrushOrigin (self, QPoint?p)
```
這是一個重載函數。
設置畫筆的原點指向(_x_,_y_) 。
```
QPainter.setClipPath (self, QPainterPath?path, Qt.ClipOperation?operation?=?Qt.ReplaceClip)
```
使裁剪,并設置為給定的剪輯路徑畫家_path_與剪輯_operation_。
請注意,剪輯路徑邏輯(畫家)坐標指定。
**See also** [clipPath](qpainter.html#clipPath)( )[clipRegion](qpainter.html#clipRegion)()和[Clipping](qpainter.html#clipping)。
```
QPainter.setClipping (self, bool?enable)
```
使裁剪,如果_enable_是真的,或禁用裁剪,如果_enable_是假的。
**See also** [hasClipping](qpainter.html#hasClipping)()和[Clipping](qpainter.html#clipping)。
```
QPainter.setClipRect (self, QRectF?rectangle, Qt.ClipOperation?operation?=?Qt.ReplaceClip)
```
使裁剪,并設置裁剪區域為給定的_rectangle_使用給定的夾_operation_。默認操作是替換當前剪輯矩形。
需要注意的是剪輯矩形的邏輯(畫家)坐標指定。
**See also** [clipRegion](qpainter.html#clipRegion)( )[setClipping](qpainter.html#setClipping)()和[Clipping](qpainter.html#clipping)。
```
QPainter.setClipRect (self, int?x, int?y, int?width, int?height, Qt.ClipOperation?operation?=?Qt.ReplaceClip)
```
使裁剪,并設置裁剪區域為矩形開始時(_x_,_y_)用給定的_width_和_height_。
```
QPainter.setClipRect (self, QRect?rectangle, Qt.ClipOperation?operation?=?Qt.ReplaceClip)
```
這是一個重載函數。
使裁剪,并設置裁剪區域為給定的_rectangle_使用給定的夾_operation_。
```
QPainter.setClipRegion (self, QRegion?region, Qt.ClipOperation?operation?=?Qt.ReplaceClip)
```
設置剪輯區域給定的_region_使用指定的剪輯_operation_。默認剪輯操作是替換當前剪輯區域。
注意裁剪區域是由于在邏輯坐標。
**See also** [clipRegion](qpainter.html#clipRegion)( )[setClipRect](qpainter.html#setClipRect)()和[Clipping](qpainter.html#clipping)。
```
QPainter.setCompositionMode (self, CompositionMode?mode)
```
載的組成模式為給定的_mode_。
**Warning:**只有一個[QPainter](qpainter.html)在操作[QImage](qimage.html)完全支持所有的組成模式。如所描述的RasterOp的模式支持在X11[compositionMode](qpainter.html#compositionMode)( ) 。
**See also** [compositionMode](qpainter.html#compositionMode)( ) 。
```
QPainter.setFont (self, QFont?f)
```
集畫家的字體給定的_font_。
此字體用于后續的[drawText](qpainter.html#drawText)()函數。文字顏色是一樣的畫筆顏色。
如果您設置的字體不可用, Qt的發現一場勢均力敵的比賽。[font](qpainter.html#font)( )將返回你所設定使用中的setFont ()和[fontInfo](qpainter.html#fontInfo)()返回的字體實際使用(其可以是相同的) 。
**See also** [font](qpainter.html#font)( )[drawText](qpainter.html#drawText)()和[Settings](qpainter.html#settings)。
```
QPainter.setLayoutDirection (self, Qt.LayoutDirection?direction)
```
設置繪制文本時所使用的畫家布局方向,到指定的_direction_.
默認值是[Qt.LayoutDirectionAuto](qt.html#LayoutDirection-enum),這將隱式地從繪制文本確定方向。
**See also** [QTextOption.setTextDirection](qtextoption.html#setTextDirection)( )[layoutDirection](qpainter.html#layoutDirection)( )[drawText](qpainter.html#drawText)()和[Settings](qpainter.html#settings)。
```
QPainter.setMatrix (self, QMatrix?matrix, bool?combine?=?False)
```
```
QPainter.setMatrixEnabled (self, bool?enabled)
```
```
QPainter.setOpacity (self, float?opacity)
```
設定畫家的不透明度為_opacity_。該值應在范圍0.0到1.0 ,其中0.0表示完全透明和1.0表示完全不透明。
不透明的畫家設置將適用于所有繪圖操作分別。
這個函數中引入了Qt 4.2中。
**See also** [opacity](qpainter.html#opacity)( ) 。
```
QPainter.setPen (self, QColor?color)
```
設定畫家的筆下被定_pen_。
該_pen_定義如何繪制線條和輪廓,而且還定義了文字顏色。
**See also** [pen](qpainter.html#pen)()和[Settings](qpainter.html#settings)。
```
QPainter.setPen (self, QPen?pen)
```
這是一個重載函數。
設定畫家的筆下有風格[Qt.SolidLine](qt.html#PenStyle-enum),寬0和指定的_color_。
```
QPainter.setPen (self, Qt.PenStyle?style)
```
這是一個重載函數。
設定畫家的筆下有定_style_,寬度0和黑色的顏色。
```
QPainter.setRedirected (QPaintDevice?device, QPaintDevice?replacement, QPoint?offset?=?QPoint())
```
```
QPainter.setRenderHint (self, RenderHint?hint, bool?on?=?True)
```
設置給定的渲染_hint_在畫家如果_on_為True,否則清除渲染提示。
**See also** [setRenderHints](qpainter.html#setRenderHints)( )[renderHints](qpainter.html#renderHints)()和[Rendering Quality](qpainter.html#rendering-quality)。
```
QPainter.setRenderHints (self, RenderHints?hints, bool?on?=?True)
```
設置給定的渲染_hints_在畫家如果_on_為True,否則清除渲染提示。
這個函數中引入了Qt 4.2中。
**See also** [setRenderHint](qpainter.html#setRenderHint)( )[renderHints](qpainter.html#renderHints)()和[Rendering Quality](qpainter.html#rendering-quality)。
```
QPainter.setTransform (self, QTransform?transform, bool?combine?=?False)
```
設置世界變換矩陣。如果_combine_為True,則指定_transform_是結合當前矩陣,否則將替換當前矩陣。
此功能被引入Qt的4.3 。
**See also** [transform](qpainter.html#transform)()和[setWorldTransform](qpainter.html#setWorldTransform)( ) 。
```
QPainter.setViewport (self, QRect?viewport)
```
設定畫家的視口矩形到給定_rectangle_,并啟用視圖轉換。
視口矩形是認為轉型的一部分。視口指定設備坐標系統。它的姊妹,在[window](qpainter.html#window)( ) ,指定的邏輯坐標系。
默認的視口矩形是相同的器件的矩形。
**See also** [viewport](qpainter.html#viewport)( )[viewTransformEnabled](qpainter.html#viewTransformEnabled)()和[Window-Viewport Conversion](index.htm#window-viewport-conversion)。
```
QPainter.setViewport (self, int?x, int?y, int?w, int?h)
```
這是一個重載函數。
設定畫家的視口矩形是開始在矩形(_x_,_y_)用給定的_width_和_height_。
```
QPainter.setViewTransformEnabled (self, bool?enable)
```
啟用視圖變換,如果_enable_是真的,或禁用視圖變換,如果_enable_是假的。
**See also** [viewTransformEnabled](qpainter.html#viewTransformEnabled)()和[Window-Viewport Conversion](index.htm#window-viewport-conversion)。
```
QPainter.setWindow (self, QRect?window)
```
集畫家的窗口給定的_rectangle_,并啟用視圖轉換。
窗口矩形認為轉型的一部分。該窗口指定了邏輯坐標系統。它的姊妹,在[viewport](qpainter.html#viewport)( ) ,指定設備坐標系統。
默認窗口矩形是相同的器件的矩形。
**See also** [window](qpainter.html#window)( )[viewTransformEnabled](qpainter.html#viewTransformEnabled)()和[Window-Viewport Conversion](index.htm#window-viewport-conversion)。
```
QPainter.setWindow (self, int?x, int?y, int?w, int?h)
```
這是一個重載函數。
集畫家的窗口,矩形開始時(_x_,_y_)和給定的_width_和_height_。
```
QPainter.setWorldMatrix (self, QMatrix?matrix, bool?combine?=?False)
```
```
QPainter.setWorldMatrixEnabled (self, bool?enabled)
```
使轉換,如果_enable_是真的,或禁用,如果轉換_enable_是假的。世界變換矩陣不被改變。
這個函數中引入了Qt 4.2中。
**See also** [worldMatrixEnabled](qpainter.html#worldMatrixEnabled)( )[worldTransform](qpainter.html#worldTransform)()和[Coordinate Transformations](qpainter.html#coordinate-transformations)。
```
QPainter.setWorldTransform (self, QTransform?matrix, bool?combine?=?False)
```
設置世界變換矩陣。如果_combine_為True,則指定_matrix_是結合當前矩陣,否則將替換當前矩陣。
**See also** [worldTransform](qpainter.html#worldTransform)( )[transform](qpainter.html#transform)()和[setTransform](qpainter.html#setTransform)( ) 。
```
QPainter.shear (self, float?sh, float?sv)
```
由(剪坐標系_sh_,_sv_) 。
**See also** [setWorldTransform](qpainter.html#setWorldTransform)()和[Coordinate Transformations](qpainter.html#coordinate-transformations)。
```
QPainter.strokePath (self, QPainterPath?path, QPen?pen)
```
繪制輪廓(招)的路徑_path_由指定的筆_pen_
**See also** [fillPath](qpainter.html#fillPath)()和[Drawing](qpainter.html#drawing)。
```
bool QPainter.testRenderHint (self, RenderHint?hint)
```
返回True如果_hint_被置位,否則返回False 。
此功能被引入Qt的4.3 。
**See also** [renderHints](qpainter.html#renderHints)()和[setRenderHint](qpainter.html#setRenderHint)( ) 。
```
QTransform QPainter.transform (self)
```
[
返回世界變換矩陣。
](qtransform.html)
[**See also**](qtransform.html) [setTransform](qpainter.html#setTransform)()和[worldTransform](qpainter.html#worldTransform)( ) 。
```
QPainter.translate (self, QPointF?offset)
```
由給定的平移坐標系_offset_,即給定_offset_加入到分。
**See also** [setWorldTransform](qpainter.html#setWorldTransform)()和[Coordinate Transformations](qpainter.html#coordinate-transformations)。
```
QPainter.translate (self, float?dx, float?dy)
```
這是一個重載函數。
由給定的平移坐標系_offset_。
```
QPainter.translate (self, QPoint?offset)
```
這是一個重載函數。
轉換由矢量的坐標系(_dx_,_dy_) 。
```
QRect QPainter.viewport (self)
```
[
返回視口矩形。
](qrect.html)
[**See also**](qrect.html) [setViewport](qpainter.html#setViewport)()和[setViewTransformEnabled](qpainter.html#setViewTransformEnabled)( ) 。
```
bool QPainter.viewTransformEnabled (self)
```
返回True如果視圖轉換被啟用,否則返回False 。
**See also** [setViewTransformEnabled](qpainter.html#setViewTransformEnabled)()和[worldTransform](qpainter.html#worldTransform)( ) 。
```
QRect QPainter.window (self)
```
[
返回窗口的矩形。
](qrect.html)
[**See also**](qrect.html) [setWindow](qpainter.html#setWindow)()和[setViewTransformEnabled](qpainter.html#setViewTransformEnabled)( ) 。
```
QMatrix QPainter.worldMatrix (self)
```
[
```
bool QPainter.worldMatrixEnabled (self)
```
返回True如果世界變換被啟用,否則返回False 。
這個函數中引入了Qt 4.2中。
](qmatrix.html)
[**See also**](qmatrix.html) [setWorldMatrixEnabled](qpainter.html#setWorldMatrixEnabled)( )[worldTransform](qpainter.html#worldTransform)()和[Coordinate System](index.htm)。
```
QTransform QPainter.worldTransform (self)
```
[
返回世界變換矩陣。
](qtransform.html)
[**See also**](qtransform.html) [setWorldTransform](qpainter.html#setWorldTransform)( ) 。
```
object QPainter.__enter__ (self)
```
```
QPainter.__exit__ (self, object?type, object?value, object?traceback)
```
- PyQt4 中文文檔
- PyQt Class Reference
- QAbstractAnimation Class Reference
- QAbstractButton Class Reference
- QAbstractEventDispatcher Class Reference
- QAbstractExtensionFactory Class Reference
- QAbstractExtensionManager Class Reference
- QAbstractFileEngine Class Reference
- QAbstractFileEngineHandler Class Reference
- QAbstractFileEngineIterator Class Reference
- QAbstractFormBuilder Class Reference
- QAbstractGraphicsShapeItem Class Reference
- QAbstractItemDelegate Class Reference
- QAbstractItemModel Class Reference
- QAbstractItemView Class Reference
- QAbstractListModel Class Reference
- QAbstractMessageHandler Class Reference
- QAbstractNetworkCache Class Reference
- QAbstractPrintDialog Class Reference
- QAbstractProxyModel Class Reference
- QAbstractScrollArea Class Reference
- QAbstractSlider Class Reference
- QAbstractSocket Class Reference
- QAbstractSpinBox Class Reference
- QAbstractState Class Reference
- QAbstractTableModel Class Reference
- QAbstractTextDocumentLayout Class Reference
- QAbstractTransition Class Reference
- QAbstractUriResolver Class Reference
- QAbstractVideoBuffer Class Reference
- QAbstractVideoSurface Class Reference
- QAbstractXmlNodeModel Class Reference
- QAbstractXmlReceiver Class Reference
- QAction Class Reference
- QActionEvent Class Reference
- QActionGroup Class Reference
- QAnimationGroup Class Reference
- QApplication Class Reference
- QAssistantClient Class Reference
- QAudio Class Reference
- QAudioDeviceInfo Class Reference
- QAudioFormat Class Reference
- QAudioInput Class Reference
- QAudioOutput Class Reference
- QAuthenticator Class Reference
- QBasicTimer Class Reference
- QBitArray Class Reference
- QBitmap Class Reference
- QBoxLayout Class Reference
- QBrush Class Reference
- QBuffer Class Reference
- QButtonGroup Class Reference
- QByteArray Class Reference
- QByteArrayMatcher Class Reference
- QCalendarWidget Class Reference
- QChar Class Reference
- QCheckBox Class Reference
- QChildEvent Class Reference
- QClipboard Class Reference
- QCloseEvent Class Reference
- QColor Class Reference
- QColorDialog Class Reference
- QColumnView Class Reference
- QComboBox Class Reference
- QCommandLinkButton Class Reference
- QCommonStyle Class Reference
- QCompleter Class Reference
- QConicalGradient Class Reference
- QContextMenuEvent Class Reference
- QCoreApplication Class Reference
- QCryptographicHash Class Reference
- QCursor Class Reference
- QDataStream Class Reference
- QDataWidgetMapper Class Reference
- QDate Class Reference
- QDateEdit Class Reference
- QDateTime Class Reference
- QDateTimeEdit Class Reference
- QDBus Class Reference
- QDBusAbstractAdaptor Class Reference
- QDBusAbstractInterface Class Reference
- QDBusArgument Class Reference
- QDBusConnection Class Reference
- QDBusConnectionInterface Class Reference
- QDBusError Class Reference
- QDBusInterface Class Reference
- QDBusMessage Class Reference
- QDBusObjectPath Class Reference
- QDBusPendingCall Class Reference
- QDBusPendingCallWatcher Class Reference
- QDBusPendingReply Class Reference
- QDBusReply Class Reference
- QDBusServiceWatcher Class Reference
- QDBusSignature Class Reference
- QDBusUnixFileDescriptor Class Reference
- QDBusVariant Class Reference
- QDeclarativeComponent Class Reference
- QDeclarativeContext Class Reference
- QDeclarativeEngine Class Reference
- QDeclarativeError Class Reference
- QDeclarativeExpression Class Reference
- QDeclarativeExtensionPlugin Class Reference
- QDeclarativeImageProvider Class Reference
- QDeclarativeItem Class Reference
- QDeclarativeListReference Class Reference
- QDeclarativeNetworkAccessManagerFactory Class Reference
- QDeclarativeParserStatus Class Reference
- QDeclarativeProperty Class Reference
- QDeclarativePropertyMap Class Reference
- QDeclarativePropertyValueSource Class Reference
- QDeclarativeScriptString Class Reference
- QDeclarativeView Class Reference
- QDesignerActionEditorInterface Class Reference
- QDesignerContainerExtension Class Reference
- QDesignerCustomWidgetCollectionInterface Class Reference
- QDesignerCustomWidgetInterface Class Reference
- QDesignerFormEditorInterface Class Reference
- QDesignerFormWindowCursorInterface Class Reference
- QDesignerFormWindowInterface Class Reference
- QDesignerFormWindowManagerInterface Class Reference
- QDesignerMemberSheetExtension Class Reference
- QDesignerObjectInspectorInterface Class Reference
- QDesignerPropertyEditorInterface Class Reference
- QDesignerPropertySheetExtension Class Reference
- QDesignerTaskMenuExtension Class Reference
- QDesignerWidgetBoxInterface Class Reference
- QDesktopServices Class Reference
- QDesktopWidget Class Reference
- QDial Class Reference
- QDialog Class Reference
- QDialogButtonBox Class Reference
- QDir Class Reference
- QDirIterator Class Reference
- QDirModel Class Reference
- QDockWidget Class Reference
- QDomAttr Class Reference
- QDomCDATASection Class Reference
- QDomCharacterData Class Reference
- QDomComment Class Reference
- QDomDocument Class Reference
- QDomDocumentFragment Class Reference
- QDomDocumentType Class Reference
- QDomElement Class Reference
- QDomEntity Class Reference
- QDomEntityReference Class Reference
- QDomImplementation Class Reference
- QDomNamedNodeMap Class Reference
- QDomNode Class Reference
- QDomNodeList Class Reference
- QDomNotation Class Reference
- QDomProcessingInstruction Class Reference
- QDomText Class Reference
- QDoubleSpinBox Class Reference
- QDoubleValidator Class Reference
- QDrag Class Reference
- QDragEnterEvent Class Reference
- QDragLeaveEvent Class Reference
- QDragMoveEvent Class Reference
- QDropEvent Class Reference
- QDynamicPropertyChangeEvent Class Reference
- QEasingCurve Class Reference
- QElapsedTimer Class Reference
- QErrorMessage Class Reference
- QEvent Class Reference
- QEventLoop Class Reference
- QEventTransition Class Reference
- QExtensionFactory Class Reference
- QExtensionManager Class Reference
- QFile Class Reference
- QFileDialog Class Reference
- QFileIconProvider Class Reference
- QFileInfo Class Reference
- QFileOpenEvent Class Reference
- QFileSystemModel Class Reference
- QFileSystemWatcher Class Reference
- QFinalState Class Reference
- QFocusEvent Class Reference
- QFocusFrame Class Reference
- QFont Class Reference
- QFontComboBox Class Reference
- QFontDatabase Class Reference
- QFontDialog Class Reference
- QFontInfo Class Reference
- QFontMetrics Class Reference
- QFontMetricsF Class Reference
- QFormBuilder Class Reference
- QFormLayout Class Reference
- QFrame Class Reference
- QFSFileEngine Class Reference
- QFtp Class Reference
- QGenericArgument Class Reference
- QGenericReturnArgument Class Reference
- QGesture Class Reference
- QGestureEvent Class Reference
- QGestureRecognizer Class Reference
- QGL Class Reference
- QGLBuffer Class Reference
- QGLColormap Class Reference
- QGLContext Class Reference
- QGLFormat Class Reference
- QGLFramebufferObject Class Reference
- QGLFramebufferObjectFormat Class Reference
- QGLPixelBuffer Class Reference
- QGLShader Class Reference
- QGLShaderProgram Class Reference
- QGLWidget Class Reference
- QGlyphRun Class Reference
- QGradient Class Reference
- QGraphicsAnchor Class Reference
- QGraphicsAnchorLayout Class Reference
- QGraphicsBlurEffect Class Reference
- QGraphicsColorizeEffect Class Reference
- QGraphicsDropShadowEffect Class Reference
- QGraphicsEffect Class Reference
- QGraphicsEllipseItem Class Reference
- QGraphicsGridLayout Class Reference
- QGraphicsItem Class Reference
- QGraphicsItemAnimation Class Reference
- QGraphicsItemGroup Class Reference
- QGraphicsLayout Class Reference
- QGraphicsLayoutItem Class Reference
- QGraphicsLinearLayout Class Reference
- QGraphicsLineItem Class Reference
- QGraphicsObject Class Reference
- QGraphicsOpacityEffect Class Reference
- QGraphicsPathItem Class Reference
- QGraphicsPixmapItem Class Reference
- QGraphicsPolygonItem Class Reference
- QGraphicsProxyWidget Class Reference
- QGraphicsRectItem Class Reference
- QGraphicsRotation Class Reference
- QGraphicsScale Class Reference
- QGraphicsScene Class Reference
- QGraphicsSceneContextMenuEvent Class Reference
- QGraphicsSceneDragDropEvent Class Reference
- QGraphicsSceneEvent Class Reference
- QGraphicsSceneHelpEvent Class Reference
- QGraphicsSceneHoverEvent Class Reference
- QGraphicsSceneMouseEvent Class Reference
- QGraphicsSceneMoveEvent Class Reference
- QGraphicsSceneResizeEvent Class Reference
- QGraphicsSceneWheelEvent Class Reference
- QGraphicsSimpleTextItem Class Reference
- QGraphicsSvgItem Class Reference
- QGraphicsTextItem Class Reference
- QGraphicsTransform Class Reference
- QGraphicsView Class Reference
- QGraphicsWebView Class Reference
- QGraphicsWidget Class Reference
- QGridLayout Class Reference
- QGroupBox Class Reference
- QHBoxLayout Class Reference
- QHeaderView Class Reference
- QHelpContentItem Class Reference
- QHelpContentModel Class Reference
- QHelpContentWidget Class Reference
- QHelpEngine Class Reference
- QHelpEngineCore Class Reference
- QHelpEvent Class Reference
- QHelpIndexModel Class Reference
- QHelpIndexWidget Class Reference
- QHelpSearchEngine Class Reference
- QHelpSearchQuery Class Reference
- QHelpSearchQueryWidget Class Reference
- QHelpSearchResultWidget Class Reference
- QHideEvent Class Reference
- QHistoryState Class Reference
- QHostAddress Class Reference
- QHostInfo Class Reference
- QHoverEvent Class Reference
- QHttp Class Reference
- QHttpHeader Class Reference
- QHttpMultiPart Class Reference
- QHttpPart Class Reference
- QHttpRequestHeader Class Reference
- QHttpResponseHeader Class Reference
- QIcon Class Reference
- QIconDragEvent Class Reference
- QIconEngine Class Reference
- QIconEngineV2 Class Reference
- QIdentityProxyModel Class Reference
- QImage Class Reference
- QImageIOHandler Class Reference
- QImageReader Class Reference
- QImageWriter Class Reference
- QInputContext Class Reference
- QInputContextFactory Class Reference
- QInputDialog Class Reference
- QInputEvent Class Reference
- QInputMethodEvent Class Reference
- QIntValidator Class Reference
- QIODevice Class Reference
- QItemDelegate Class Reference
- QItemEditorCreatorBase Class Reference
- QItemEditorFactory Class Reference
- QItemSelection Class Reference
- QItemSelectionModel Class Reference
- QItemSelectionRange Class Reference
- QKeyEvent Class Reference
- QKeyEventTransition Class Reference
- QKeySequence Class Reference
- QLabel Class Reference
- QLatin1Char Class Reference
- QLatin1String Class Reference
- QLayout Class Reference
- QLayoutItem Class Reference
- QLCDNumber Class Reference
- QLibrary Class Reference
- QLibraryInfo Class Reference
- QLine Class Reference
- QLinearGradient Class Reference
- QLineEdit Class Reference
- QLineF Class Reference
- QListView Class Reference
- QListWidget Class Reference
- QListWidgetItem Class Reference
- QLocale Class Reference
- QLocalServer Class Reference
- QLocalSocket Class Reference
- QMainWindow Class Reference
- QMargins Class Reference
- QMatrix Class Reference
- QMatrix2x2 Class Reference
- QMatrix2x3 Class Reference
- QMatrix2x4 Class Reference
- QMatrix3x2 Class Reference
- QMatrix3x3 Class Reference
- QMatrix3x4 Class Reference
- QMatrix4x2 Class Reference
- QMatrix4x3 Class Reference
- QMatrix4x4 Class Reference
- QMdiArea Class Reference
- QMdiSubWindow Class Reference
- QMenu Class Reference
- QMenuBar Class Reference
- QMessageBox Class Reference
- QMetaClassInfo Class Reference
- QMetaEnum Class Reference
- QMetaMethod Class Reference
- QMetaObject Class Reference
- QMetaProperty Class Reference
- QMetaType Class Reference
- QMimeData Class Reference
- QMimeSource Class Reference
- QModelIndex Class Reference
- QMouseEvent Class Reference
- QMouseEventTransition Class Reference
- QMoveEvent Class Reference
- QMovie Class Reference
- QMutex Class Reference
- QMutexLocker Class Reference
- QNetworkAccessManager Class Reference
- QNetworkAddressEntry Class Reference
- QNetworkCacheMetaData Class Reference
- QNetworkConfiguration Class Reference
- QNetworkConfigurationManager Class Reference
- QNetworkCookie Class Reference
- QNetworkCookieJar Class Reference
- QNetworkDiskCache Class Reference
- QNetworkInterface Class Reference
- QNetworkProxy Class Reference
- QNetworkProxyFactory Class Reference
- QNetworkProxyQuery Class Reference
- QNetworkReply Class Reference
- QNetworkRequest Class Reference
- QNetworkSession Class Reference
- QObject Class Reference
- QObjectCleanupHandler Class Reference
- QPageSetupDialog Class Reference
- QPaintDevice Class Reference
- QPaintEngine Class Reference
- QPaintEngineState Class Reference
- QPainter Class Reference
- QPainterPath Class Reference
- QPainterPathStroker Class Reference
- QPaintEvent Class Reference
- QPalette Class Reference
- QPanGesture Class Reference
- QParallelAnimationGroup Class Reference
- QPauseAnimation Class Reference
- QPen Class Reference
- QPersistentModelIndex Class Reference
- QPicture Class Reference
- QPictureIO Class Reference
- QPinchGesture Class Reference
- QPixmap Class Reference
- QPixmapCache Class Reference
- QPlainTextDocumentLayout Class Reference
- QPlainTextEdit Class Reference
- QPluginLoader Class Reference
- QPoint Class Reference
- QPointF Class Reference
- QPolygon Class Reference
- QPolygonF Class Reference
- QPrintDialog Class Reference
- QPrintEngine Class Reference
- QPrinter Class Reference
- QPrinterInfo Class Reference
- QPrintPreviewDialog Class Reference
- QPrintPreviewWidget Class Reference
- QProcess Class Reference
- QProcessEnvironment Class Reference
- QProgressBar Class Reference
- QProgressDialog Class Reference
- QPropertyAnimation Class Reference
- QProxyModel Class Reference
- QPushButton Class Reference
- QPyDeclarativePropertyValueSource Class Reference
- QPyDesignerContainerExtension Class Reference
- QPyDesignerCustomWidgetCollectionPlugin Class Reference
- QPyDesignerCustomWidgetPlugin Class Reference
- QPyDesignerMemberSheetExtension Class Reference
- QPyDesignerPropertySheetExtension Class Reference
- QPyDesignerTaskMenuExtension Class Reference
- QPyNullVariant Class Reference
- QPyTextObject Class Reference
- QQuaternion Class Reference
- QRadialGradient Class Reference
- QRadioButton Class Reference
- QRawFont Class Reference
- QReadLocker Class Reference
- QReadWriteLock Class Reference
- QRect Class Reference
- QRectF Class Reference
- QRegExp Class Reference
- QRegExpValidator Class Reference
- QRegion Class Reference
- QResizeEvent Class Reference
- QResource Class Reference
- QRubberBand Class Reference
- QRunnable Class Reference
- QScriptClass Class Reference
- QScriptClassPropertyIterator Class Reference
- QScriptContext Class Reference
- QScriptContextInfo Class Reference
- QScriptEngine Class Reference
- QScriptEngineAgent Class Reference
- QScriptEngineDebugger Class Reference
- QScriptString Class Reference
- QScriptSyntaxCheckResult Class Reference
- QScriptValue Class Reference
- QScriptValueIterator Class Reference
- QScrollArea Class Reference
- QScrollBar Class Reference
- QSemaphore Class Reference
- QSequentialAnimationGroup Class Reference
- QSessionManager Class Reference
- QSettings Class Reference
- QSharedMemory Class Reference
- QShortcut Class Reference
- QShortcutEvent Class Reference
- QShowEvent Class Reference
- QSignalMapper Class Reference
- QSignalTransition Class Reference
- QSimpleXmlNodeModel Class Reference
- QSize Class Reference
- QSizeF Class Reference
- QSizeGrip Class Reference
- QSizePolicy Class Reference
- QSlider Class Reference
- QSocketNotifier Class Reference
- QSortFilterProxyModel Class Reference
- QSound Class Reference
- QSourceLocation Class Reference
- QSpacerItem Class Reference
- QSpinBox Class Reference
- QSplashScreen Class Reference
- QSplitter Class Reference
- QSplitterHandle Class Reference
- QSql Class Reference
- QSqlDatabase Class Reference
- QSqlDriver Class Reference
- QSqlDriverCreatorBase Class Reference
- QSqlError Class Reference
- QSqlField Class Reference
- QSqlIndex Class Reference
- QSqlQuery Class Reference
- QSqlQueryModel Class Reference
- QSqlRecord Class Reference
- QSqlRelation Class Reference
- QSqlRelationalDelegate Class Reference
- QSqlRelationalTableModel Class Reference
- QSqlResult Class Reference
- QSqlTableModel Class Reference
- Qt4.7文檔翻譯:Qt樣式單參考,Qt Style Sheets Reference
- QSsl Class Reference
- QSslCertificate Class Reference
- QSslCipher Class Reference
- QSslConfiguration Class Reference
- QSslError Class Reference
- QSslKey Class Reference
- QSslSocket Class Reference
- QStackedLayout Class Reference
- QStackedWidget Class Reference
- QStandardItem Class Reference
- QStandardItemModel Class Reference
- QState Class Reference
- QStateMachine Class Reference
- QStaticText Class Reference
- QStatusBar Class Reference
- QStatusTipEvent Class Reference
- QString Class Reference
- QStringList Class Reference
- QStringListModel Class Reference
- QStringMatcher Class Reference
- QStringRef Class Reference
- QStyle Class Reference
- QStyledItemDelegate Class Reference
- QStyleFactory Class Reference
- QStyleHintReturn Class Reference
- QStyleHintReturnMask Class Reference
- QStyleHintReturnVariant Class Reference
- QStyleOption Class Reference
- QStyleOptionButton Class Reference
- QStyleOptionComboBox Class Reference
- QStyleOptionComplex Class Reference
- QStyleOptionDockWidget Class Reference
- QStyleOptionDockWidgetV2 Class Reference
- QStyleOptionFocusRect Class Reference
- QStyleOptionFrame Class Reference
- QStyleOptionFrameV2 Class Reference
- QStyleOptionFrameV3 Class Reference
- QStyleOptionGraphicsItem Class Reference
- QStyleOptionGroupBox Class Reference
- QStyleOptionHeader Class Reference
- QStyleOptionMenuItem Class Reference
- QStyleOptionProgressBar Class Reference
- QStyleOptionProgressBarV2 Class Reference
- QStyleOptionRubberBand Class Reference
- QStyleOptionSizeGrip Class Reference
- QStyleOptionSlider Class Reference
- QStyleOptionSpinBox Class Reference
- QStyleOptionTab Class Reference
- QStyleOptionTabBarBase Class Reference
- QStyleOptionTabBarBaseV2 Class Reference
- QStyleOptionTabV2 Class Reference
- QStyleOptionTabV3 Class Reference
- QStyleOptionTabWidgetFrame Class Reference
- QStyleOptionTabWidgetFrameV2 Class Reference
- QStyleOptionTitleBar Class Reference
- QStyleOptionToolBar Class Reference
- QStyleOptionToolBox Class Reference
- QStyleOptionToolBoxV2 Class Reference
- QStyleOptionToolButton Class Reference
- QStyleOptionViewItem Class Reference
- QStyleOptionViewItemV2 Class Reference
- QStyleOptionViewItemV3 Class Reference
- QStyleOptionViewItemV4 Class Reference
- QStylePainter Class Reference
- QSvgGenerator Class Reference
- QSvgRenderer Class Reference
- QSvgWidget Class Reference
- QSwipeGesture Class Reference
- QSyntaxHighlighter Class Reference
- QSysInfo Class Reference
- QSystemLocale Class Reference
- QSystemSemaphore Class Reference
- QSystemTrayIcon Class Reference
- Qt Class Reference
- QTabBar Class Reference
- QTabletEvent Class Reference
- QTableView Class Reference
- QTableWidget Class Reference
- QTableWidgetItem Class Reference
- QTableWidgetSelectionRange Class Reference
- QTabWidget Class Reference
- QTapAndHoldGesture Class Reference
- QTapGesture Class Reference
- QTcpServer Class Reference
- QTcpSocket Class Reference
- QTemporaryFile Class Reference
- QTest Class Reference
- QTextBlock Class Reference
- QTextBlockFormat Class Reference
- QTextBlockGroup Class Reference
- QTextBlockUserData Class Reference
- QTextBoundaryFinder Class Reference
- QTextBrowser Class Reference
- QTextCharFormat Class Reference
- QTextCodec Class Reference
- QTextCursor Class Reference
- QTextDecoder Class Reference
- QTextDocument Class Reference
- QTextDocumentFragment Class Reference
- QTextDocumentWriter Class Reference
- QTextEdit Class Reference
- QTextEncoder Class Reference
- QTextFormat Class Reference
- QTextFragment Class Reference
- QTextFrame Class Reference
- QTextFrameFormat Class Reference
- QTextImageFormat Class Reference
- QTextInlineObject Class Reference
- QTextItem Class Reference
- QTextLayout Class Reference
- QTextLength Class Reference
- QTextLine Class Reference
- QTextList Class Reference
- QTextListFormat Class Reference
- QTextObject Class Reference
- QTextObjectInterface Class Reference
- QTextOption Class Reference
- QTextStream Class Reference
- QTextTable Class Reference
- QTextTableCell Class Reference
- QTextTableCellFormat Class Reference
- QTextTableFormat Class Reference
- QThread Class Reference
- QThreadPool Class Reference
- QTime Class Reference
- QTimeEdit Class Reference
- QTimeLine Class Reference
- QTimer Class Reference
- QTimerEvent Class Reference
- QToolBar Class Reference
- QToolBox Class Reference
- QToolButton Class Reference
- QToolTip Class Reference
- QTouchEvent Class Reference
- Reference
- QTransform Class Reference
- QTranslator Class Reference
- QTreeView Class Reference
- QTreeWidget Class Reference
- QTreeWidgetItem Class Reference
- QTreeWidgetItemIterator Class Reference
- QUdpSocket Class Reference
- QUndoCommand Class Reference
- QUndoGroup Class Reference
- QUndoStack Class Reference
- QUndoView Class Reference
- QUrl Class Reference
- QUrlInfo Class Reference
- QUuid Class Reference
- QValidator Class Reference
- QVariant Class Reference
- QVariantAnimation Class Reference
- QVBoxLayout Class Reference
- QVector2D Class Reference
- QVector3D Class Reference
- QVector4D Class Reference
- QVideoFrame Class Reference
- QVideoSurfaceFormat Class Reference
- QWaitCondition Class Reference
- QWebDatabase Class Reference
- QWebElement Class Reference
- QWebElementCollection Class Reference
- QWebFrame Class Reference
- QWebHistory Class Reference
- QWebHistoryInterface Class Reference
- QWebHistoryItem Class Reference
- QWebHitTestResult Class Reference
- QWebInspector Class Reference
- QWebPage Class Reference
- QWebPluginFactory Class Reference
- QWebSecurityOrigin Class Reference
- QWebSettings Class Reference
- QWebView Class Reference
- QWhatsThis Class Reference
- QWhatsThisClickedEvent Class Reference
- QWheelEvent Class Reference
- QWidget Class Reference
- QWidgetAction Class Reference
- QWidgetItem Class Reference
- QWindowStateChangeEvent Class Reference
- QWizard Class Reference
- QWizardPage Class Reference
- QWorkspace Class Reference
- QWriteLocker Class Reference
- QX11EmbedContainer Class Reference
- QX11EmbedWidget Class Reference
- QX11Info Class Reference
- QXmlAttributes Class Reference
- QXmlContentHandler Class Reference
- QXmlDeclHandler Class Reference
- QXmlDefaultHandler Class Reference
- QXmlDTDHandler Class Reference
- QXmlEntityResolver Class Reference
- QXmlErrorHandler Class Reference
- QXmlFormatter Class Reference
- QXmlInputSource Class Reference
- QXmlItem Class Reference
- QXmlLexicalHandler Class Reference
- QXmlLocator Class Reference
- QXmlName Class Reference
- QXmlNamePool Class Reference
- QXmlNamespaceSupport Class Reference
- QXmlNodeModelIndex Class Reference
- QXmlParseException Class Reference
- QXmlQuery Class Reference
- QXmlReader Class Reference
- QXmlResultItems Class Reference
- QXmlSchema Class Reference
- QXmlSchemaValidator Class Reference
- QXmlSerializer Class Reference
- QXmlSimpleReader Class Reference
- QXmlStreamAttribute Class Reference
- QXmlStreamAttributes Class Reference
- QXmlStreamEntityDeclaration Class Reference
- QXmlStreamEntityResolver Class Reference
- QXmlStreamNamespaceDeclaration Class Reference
- QXmlStreamNotationDeclaration Class Reference
- QXmlStreamReader Class Reference
- QXmlStreamWriter Class Reference