Obsolete Members for QPainter

以下成员源于类 QPainter 已过时。 提供它们是为使旧源代码能继续工作。强烈建议不要在新代码中使用它们。

公共函数

(obsolete) QMatrix combinedMatrix () const
(obsolete) const QMatrix & deviceMatrix () const
(obsolete) void drawRoundRect (const QRectF & r , int xRnd = 25, int yRnd = 25)
(obsolete) void drawRoundRect (int x , int y , int w , int h , int xRnd = 25, int yRnd = 25)
(obsolete) void drawRoundRect (const QRect & r , int xRnd = 25, int yRnd = 25)
(obsolete) void initFrom (const QPaintDevice * device )
(obsolete) const QMatrix & matrix () const
(obsolete) bool matrixEnabled () const
(obsolete) void resetMatrix ()
(obsolete) void setMatrix (const QMatrix & matrix , bool combine = false)
(obsolete) void setMatrixEnabled (bool enable )
(obsolete) void setWorldMatrix (const QMatrix & matrix , bool combine = false)
(obsolete) const QMatrix & worldMatrix () const

静态公共成员

(obsolete) QPaintDevice * redirected (const QPaintDevice * device , QPoint * offset = Q_NULLPTR)
(obsolete) void restoreRedirected (const QPaintDevice * device )
(obsolete) void setRedirected (const QPaintDevice * device , QPaintDevice * replacement , const QPoint & offset = QPoint())

成员函数文档编制

QMatrix QPainter:: combinedMatrix () const

返回当前窗口/视口及世界变换的组合变换矩阵。

It is advisable to use combinedTransform () instead of this function to preserve the properties of perspective transformations.

该函数在 Qt 4.2 引入。

另请参阅 setWorldTransform (), setWindow (),和 setViewport ().

const QMatrix &QPainter:: deviceMatrix () const

返回从逻辑坐标变换成平台从属描绘设备的设备坐标的矩阵。

注意: It is advisable to use deviceTransform () instead of this function to preserve the properties of perspective transformations.

此函数是 only 需要当使用平台描绘命令对平台从属句柄 ( Qt::HANDLE ),且平台本身不做变换。

The QPaintEngine::PaintEngineFeature 枚举可以查询,以确定平台是否履行变换。

另请参阅 worldMatrix () 和 QPaintEngine::hasFeature ().

void QPainter:: drawRoundRect (const QRectF & r , int xRnd = 25, int yRnd = 25)

Draws a rectangle r 带圆角。

The xRnd and yRnd arguments specify how rounded the corners should be. 0 is angled corners, 99 is maximum roundedness.

A filled rectangle has a size of r.size(). A stroked rectangle has a size of r.size() plus the pen width.

另请参阅 drawRoundedRect ().

void QPainter:: drawRoundRect ( int x , int y , int w , int h , int xRnd = 25, int yRnd = 25)

这是重载函数。

Draws the rectangle x , y , w , h 带圆角。

void QPainter:: drawRoundRect (const QRect & r , int xRnd = 25, int yRnd = 25)

这是重载函数。

Draws the rectangle r 带圆角。

void QPainter:: initFrom (const QPaintDevice * device )

Initializes the painters pen, background and font to the same as the given device .

另请参阅 begin () 和 设置 .

const QMatrix &QPainter:: matrix () const

使用 worldTransform () 代替。

另请参阅 setMatrix () 和 worldTransform ().

bool QPainter:: matrixEnabled () const

使用 worldMatrixEnabled () 代替

另请参阅 setMatrixEnabled () 和 worldMatrixEnabled ().

[static] QPaintDevice *QPainter:: redirected (const QPaintDevice * device , QPoint * offset = Q_NULLPTR)

使用 QWidget::render () obsoletes the use of this function.

Returns the replacement for given device . The optional out parameter offset returns the offset within the replaced device.

警告: Making use of redirections in the QPainter API implies that QPainter::begin () 和 QPaintDevice destructors need to hold a mutex for a short period. This can impact performance. Use of QWidget::render is strongly encouraged.

注意: 此函数是 thread-safe .

另请参阅 setRedirected () 和 restoreRedirected ().

void QPainter:: resetMatrix ()

重置任何变换的做出是使用 translate (), scale (), shear (), rotate (), setWorldMatrix (), setViewport () 和 setWindow ().

It is advisable to use resetTransform () instead of this function to preserve the properties of perspective transformations.

另请参阅 坐标变换 .

[static] void QPainter:: restoreRedirected (const QPaintDevice * device )

使用 QWidget::render () obsoletes the use of this function.

Restores the previous redirection for the given device after a call to setRedirected ().

警告: Making use of redirections in the QPainter API implies that QPainter::begin () 和 QPaintDevice destructors need to hold a mutex for a short period. This can impact performance. Use of QWidget::render is strongly encouraged.

注意: 此函数是 thread-safe .

另请参阅 redirected ().

void QPainter:: setMatrix (const QMatrix & matrix , bool combine = false)

使用 setWorldTransform () 代替。

另请参阅 matrix () 和 setWorldTransform ().

void QPainter:: setMatrixEnabled ( bool enable )

使用 setWorldMatrixEnabled () 代替。

另请参阅 matrixEnabled () 和 setWorldMatrixEnabled ().

[static] void QPainter:: setRedirected (const QPaintDevice * device , QPaintDevice * replacement , const QPoint & offset = QPoint())

Please use QWidget::render () 代替。

Redirects all paint commands for the given paint device ,到 replacement device. The optional point offset defines an offset within the source device.

The redirection will not be effective until the begin () function has been called; make sure to call end () for the given device 's painter (if any) before redirecting. Call restoreRedirected () to restore the previous redirection.

警告: Making use of redirections in the QPainter API implies that QPainter::begin () 和 QPaintDevice destructors need to hold a mutex for a short period. This can impact performance. Use of QWidget::render is strongly encouraged.

注意: 此函数是 thread-safe .

另请参阅 redirected () 和 restoreRedirected ().

void QPainter:: setWorldMatrix (const QMatrix & matrix , bool combine = false)

Sets the transformation matrix to matrix and enables transformations.

注意: It is advisable to use setWorldTransform () instead of this function to preserve the properties of perspective transformations.

combine 为 true,则 matrix is combined with the current transformation matrix; otherwise matrix replaces the current transformation matrix.

matrix is the identity matrix and combine is false, this function calls setWorldMatrixEnabled (false). (The identity matrix is the matrix where QMatrix::m11 () 和 QMatrix::m22 () are 1.0 and the rest are 0.0.)

The following functions can transform the coordinate system without using a QMatrix :

They operate on the painter's worldMatrix () and are implemented like this:

void QPainter::rotate(qreal angle)
{
    QMatrix matrix;
    matrix.rotate(angle);
    setWorldMatrix(matrix, true);
}
					

Note that when using setWorldMatrix() function you should always have combine be true when you are drawing into a QPicture . Otherwise it may not be possible to replay the picture with additional transformations; using the translate (), scale (), etc. convenience functions is safe.

For more information about the coordinate system, transformations and window-viewport conversion, see 坐标系 .

该函数在 Qt 4.2 引入。

另请参阅 worldMatrix (), setWorldTransform (),和 QTransform .

const QMatrix &QPainter:: worldMatrix () const

返回世界变换矩阵。

It is advisable to use worldTransform () because worldMatrix() does not preserve the properties of perspective transformations.

该函数在 Qt 4.2 引入。

另请参阅 setWorldMatrix (), 坐标变换 ,和 坐标系 .