以下成员源于类 QPainter are part of the Qt compatibility layer. We advise against using them in new code.
| const QColor & | backgroundColor () const |
| bool | begin (QPaintDevice * device , const QWidget * init ) |
| QRect | boundingRect (const QRect & rectangle , int flags , const QString & text , int length ) |
| QRect | boundingRect (int x , int y , int width , int height , int flags , const QString & text , int length ) |
| void | drawConvexPolygon (const QPolygonF & polygon , int index , int count = -1) |
| void | drawConvexPolygon (const QPolygon & polygon , int index , int count = -1) |
| void | drawCubicBezier (const QPolygon & controlPoints , int index = 0) |
| void | drawLineSegments (const QPolygon & polygon , int index = 0, int count = -1) |
| void | drawPoints (const QPolygon & polygon , int index , int count = -1) |
| void | drawPolygon (const QPolygonF & polygon , bool winding , int index = 0, int count = -1) |
| void | drawPolygon (const QPolygon & polygon , bool winding , int index = 0, int count = -1) |
| void | drawPolyline (const QPolygon & polygon , int index , int count = -1) |
| void | drawText (int x , int y , const QString & text , int pos , int length ) |
| void | drawText (const QPoint & point , const QString & text , int pos , int length ) |
| void | drawText (int x , int y , const QString & text , int length ) |
| void | drawText (const QPoint & point , const QString & text , int length ) |
| void | drawText (const QRect & rectangle , int flags , const QString & text , int length , QRect * br = 0) |
| void | drawText (int x , int y , int width , int height , int flags , const QString & text , int length , QRect * br = 0) |
| bool | hasViewXForm () const |
| bool | hasWorldXForm () const |
| void | resetXForm () |
| void | setBackgroundColor (const QColor & color ) |
| void | setViewXForm (bool enabled ) |
| void | setWorldXForm (bool enabled ) |
| QPoint | xForm (const QPoint & point ) const |
| QRect | xForm (const QRect & rectangle ) const |
| QPolygon | xForm (const QPolygon & polygon ) const |
| QPolygon | xForm (const QPolygon & polygon , int index , int count ) const |
| void | redirect (QPaintDevice * pdev , QPaintDevice * replacement ) |
| QPaintDevice * | redirect (QPaintDevice * pdev ) |
使用 background () 和 QBrush::color () 代替。
例如,若有代码像
QColor myColor = backgroundColor();
可以把它重写成
QColor myColor = background().color();
Note that the background can be a complex brush such as a texture or a gradient.
另请参阅 setBackgroundColor ().
使用 begin () 代替。
If the paint device 是 QWidget , QPainter is initialized after the widget's settings automatically. Otherwise, you must call the initFrom () function to initialize the painters pen, background and font to the same as any given widget.
例如,若有代码像
QPainter painter(this); painter.begin(device, init);
可以把它重写成
QPainter painter(this); painter.begin(device); painter.initFrom(init);
Returns the bounding rectangle for the given length 的 text constrained by the provided rectangle .
使用 boundingRect () combined with QString::left () 代替。
例如,若有代码像
QRect rectangle = boundingRect(rect, flags, text, length);
可以把它重写成
QRect rectangle = boundingRect(rect, flags, text.left(length));
Returns the bounding rectangle for the given length 的 text constrained by the rectangle that begins at point ( x , y ) 采用给定 width and height .
使用 boundingRect () combined with QString::left () 代替。
例如,若有代码像
QRect rectangle = boundingRect(x, y, width, height, flags, text, length);
可以把它重写成
QRect rectangle = boundingRect(x, y, width, height, flags, text.left(length));
这是重载函数。
使用 drawConvexPolygon () combined with QPolygonF::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawConvexPolygon(polygon, index, count);
可以把它重写成
int pointCount = (count == -1) ? polygon.size() - index : count; QPainter painter(this); painter.drawConvexPolygon(polygon.constData() + index, pointCount);
这是重载函数。
使用 drawConvexPolygon () combined with QPolygon::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawConvexPolygon(polygon, index, count);
可以把它重写成
int pointCount = (count == -1) ? polygon.size() - index : count; QPainter painter(this); painter.drawConvexPolygon(polygon.constData() + index, pointCount);
Draws a cubic Bezier curve defined by the controlPoints , starting at controlPoints [index] ( index defaults to 0). Points after controlPoints [index + 3] are ignored. Nothing happens if there aren't enough control points.
使用 strokePath () 代替。
例如,若有代码像
QPainter painter(this); painter.drawCubicBezier(controlPoints, index)
可以把它重写成
QPainterPath path; path.moveTo(controlPoints.at(index)); path.cubicTo(controlPoints.at(index+1), controlPoints.at(index+2), controlPoints.at(index+3)); QPainter painter(this); painter.strokePath(path, painter.pen());
Draws count separate lines from points defined by the polygon , starting at polygon [index] ( index defaults to 0). If count is -1 (the default) all points until the end of the array are used.
使用 drawLines () combined with QPolygon::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawLineSegments(polygon, index, count);
可以把它重写成
int lineCount = (count == -1) ? (polygon.size() - index) / 2 : count; QPainter painter(this); painter.drawLines(polygon.constData() + index * 2, lineCount);
这是重载函数。
Draws count points in the vector polygon starting on index 使用当前钢笔。
使用 drawPoints () combined with QPolygon::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawPoints(polygon, index, count);
可以把它重写成
int pointCount = (count == -1) ? polygon.size() - index : count; QPainter painter(this); painter.drawPoints(polygon.constData() + index, pointCount);
这是重载函数。
使用 drawPolygon () combined with QPolygonF::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawPolygon(polygon, winding, index, count);
可以把它重写成
int pointCount = (count == -1) ? polygon.size() - index : count; int fillRule = winding ? Qt::WindingFill : Qt::OddEvenFill; QPainter painter(this); painter.drawPolygon( polygon.constData() + index, pointCount, fillRule);
这是重载函数。
使用 drawPolygon () combined with QPolygon::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawPolygon(polygon, winding, index, count);
可以把它重写成
int pointCount = (count == -1) ? polygon.size() - index : count; int fillRule = winding ? Qt::WindingFill : Qt::OddEvenFill; QPainter painter(this); painter.drawPolygon( polygon.constData() + index, pointCount, fillRule);
这是重载函数。
Draws the polyline defined by the count lines of the given polygon starting at index ( index defaults to 0).
使用 drawPolyline () combined with QPolygon::constData () 代替。
例如,若有代码像
QPainter painter(this); painter.drawPolyline(polygon, index, count);
可以把它重写成
int pointCount = (count == -1) ? polygon.size() - index : count; QPainter painter(this); painter.drawPolyline(polygon.constData() + index, pointCount);
使用 drawText () combined with QString::mid () 代替。
例如,若有代码像
QPainter painter(this); painter.drawText(x, y, text, pos, length);
可以把它重写成
QPainter painter(this); painter.drawText(x, y, text.mid(pos, length));
使用 drawText () combined with QString::mid () 代替。
例如,若有代码像
QPainter painter(this); painter.drawText(point, text, pos, length);
可以把它重写成
QPainter painter(this); painter.drawText(point, text.mid(pos, length));
使用 drawText () combined with QString::left () 代替。
例如,若有代码像
QPainter painter(this); painter.drawText(x, y, text, length);
可以把它重写成
QPainter painter(this); painter.drawText(x, y, text.left(length));
使用 drawText () combined with QString::left () 代替。
例如,若有代码像
QPainter painter(this); painter.drawText(point, text, length);
可以把它重写成
QPainter painter(this); painter.drawText(point, text.left(length));
使用 drawText () combined with QString::left () 代替。
例如,若有代码像
QPainter painter(this); painter.drawText(rectangle, flags, text, length, br );
可以把它重写成
QPainter painter(this); painter.drawText(rectangle, flags, text.left(length), br );
使用 drawText () combined with QString::left () 代替。
例如,若有代码像
QPainter painter(this); painter.drawText(x, y, width, height, flags, text, length, br );
可以把它重写成
QPainter painter(this); painter.drawText(x, y, width, height, flags, text.left(length), br );
使用 viewTransformEnabled () 代替。
使用 worldMatrixEnabled () 代替。
[static]
void
QPainter::
redirect
(
QPaintDevice
*
pdev
,
QPaintDevice
*
replacement
)
Use setRedirected() instead.
[static]
QPaintDevice
* QPainter::
redirect
(
QPaintDevice
*
pdev
)
Use redirected() instead.
使用 resetTransform () 代替。
使用 setBackground () 代替。
另请参阅 backgroundColor ().
使用 setViewTransformEnabled () 代替。
另请参阅 hasViewXForm ().
使用 setWorldMatrixEnabled () 代替。
另请参阅 hasWorldXForm ().
使用 combinedTransform () 代替。
这是重载函数。
使用 combinedTransform () instead of this function and call mapRect() on the result to obtain a QRect .
这是重载函数。
使用 combinedTransform () 代替。
这是重载函数。
使用 combinedTransform () combined with QPolygon::mid () 代替。
例如,若有代码像
QPainter painter(this); QPolygon transformed = painter.xForm(polygon, index, count)
可以把它重写成
QPainter painter(this); QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform();