Obsolete Members for QPainter

The following members of class QPainter are obsolete. They are provided to keep old source code working. We strongly advise against using them in new code.

Public Functions

(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 = 25, int = 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

Static Public Members

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

Member Function Documentation

QMatrix QPainter::combinedMatrix() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the transformation matrix combining the current window/viewport and world transformation.

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

This function was introduced in Qt 4.2.

See also setWorldTransform(), setWindow(), and setViewport().

const QMatrix &QPainter::deviceMatrix() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the matrix that transforms from logical coordinates to device coordinates of the platform dependent paint device.

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

This function is only needed when using platform painting commands on the platform dependent handle (Qt::HANDLE), and the platform does not do transformations nativly.

The QPaintEngine::PaintEngineFeature enum can be queried to determine whether the platform performs the transformations or not.

See also worldMatrix() and QPaintEngine::hasFeature().

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Draws a rectangle r with rounded corners.

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.

See also drawRoundedRect().

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

Draws the rectangle x, y, w, h with rounded corners.

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

This is an overloaded function.

Draws the rectangle r with rounded corners.

void QPainter::initFrom(const QPaintDevice *device)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

See also begin() and Settings.

const QMatrix &QPainter::matrix() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use worldTransform() instead.

See also setMatrix() and worldTransform().

bool QPainter::matrixEnabled() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use worldMatrixEnabled() instead

See also setMatrixEnabled() and worldMatrixEnabled().

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Using 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.

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

Note: This function is thread-safe.

See also setRedirected() and restoreRedirected().

void QPainter::resetMatrix()

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Resets any transformations that were made using translate(), scale(), shear(), rotate(), setWorldMatrix(), setViewport() and setWindow().

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

See also Coordinate Transformations.

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

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

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

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

Note: This function is thread-safe.

See also redirected().

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use setWorldTransform() instead.

See also matrix() and setWorldTransform().

void QPainter::setMatrixEnabled(bool enable)

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Use setWorldMatrixEnabled() instead.

See also matrixEnabled() and setWorldMatrixEnabled().

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Please use QWidget::render() instead.

Redirects all paint commands for the given paint device, to the 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.

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

Note: This function is thread-safe.

See also redirected() and restoreRedirected().

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

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Sets the transformation matrix to matrix and enables transformations.

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

If combine is true, then matrix is combined with the current transformation matrix; otherwise matrix replaces the current transformation matrix.

If matrix is the identity matrix and combine is false, this function calls setWorldMatrixEnabled(false). (The identity matrix is the matrix where QMatrix::m11() and 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)
{
    QTransform matrix;
    matrix.rotate(angle);
    setWorldTransform(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 Coordinate System.

This function was introduced in Qt 4.2.

See also worldMatrix(), setWorldTransform(), and QTransform.

const QMatrix &QPainter::worldMatrix() const

This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.

Returns the world transformation matrix.

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

This function was introduced in Qt 4.2.

See also setWorldMatrix(), Coordinate Transformations, and Coordinate System.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.