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 () 和 Settings .

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.

注意: 此函數是 綫程安全 .

另請參閱 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.

注意: 此函數是 綫程安全 .

另請參閱 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.

注意: 此函數是 綫程安全 .

另請參閱 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 (), 坐標變換 ,和 坐標係 .