QtGui/QPainter: mark obsolete functions as deprecated
Mark some long obsolete functions as deprecated so the can be removed with Qt6: - initFrom() - setMatrix()/matrix()/deviceMatrix()/resetMatrix() - setWorldMatrix()/worldMatrix()/combinedMatrix() - setMatrixEnabled()/matrixEnabled() - drawRoundRect() - setRedirected()/redirected()/restoreRedirected() Change-Id: I0daed72c0ef06c192309f02366a7201154e75ac9 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
parent
daee9af969
commit
e56401818b
@ -858,7 +858,7 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords)
|
||||
break;
|
||||
case QPicturePrivate::PdcSetWXform:
|
||||
s >> i_8;
|
||||
painter->setMatrixEnabled(i_8);
|
||||
painter->setWorldMatrixEnabled(i_8);
|
||||
break;
|
||||
case QPicturePrivate::PdcSetWMatrix:
|
||||
if (d->formatMajor >= 8) {
|
||||
|
@ -1547,6 +1547,7 @@ bool QPainter::isActive() const
|
||||
return d->engine;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
Initializes the painters pen, background and font to the same as
|
||||
the given \a device.
|
||||
@ -1574,7 +1575,7 @@ void QPainter::initFrom(const QPaintDevice *device)
|
||||
d->engine->setDirty(QPaintEngine::DirtyFont);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Saves the current painter state (pushes the state onto a stack). A
|
||||
@ -2885,6 +2886,7 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op)
|
||||
d->updateState(d->state);
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
@ -3048,7 +3050,7 @@ void QPainter::resetMatrix()
|
||||
{
|
||||
resetTransform();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.2
|
||||
@ -3099,6 +3101,7 @@ bool QPainter::worldMatrixEnabled() const
|
||||
return d->state->WxF;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
@ -3124,6 +3127,7 @@ bool QPainter::matrixEnabled() const
|
||||
{
|
||||
return worldMatrixEnabled();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Scales the coordinate system by (\a{sx}, \a{sy}).
|
||||
@ -4182,6 +4186,7 @@ void QPainter::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius,
|
||||
Draws the given rectangle \a x, \a y, \a w, \a h with rounded corners.
|
||||
*/
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
@ -4209,6 +4214,10 @@ void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
|
||||
|
||||
Draws the rectangle \a r with rounded corners.
|
||||
*/
|
||||
void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
|
||||
{
|
||||
drawRoundRect(QRectF(rect), xRnd, yRnd);
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
@ -4219,6 +4228,11 @@ void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
|
||||
|
||||
Draws the rectangle \a x, \a y, \a w, \a h with rounded corners.
|
||||
*/
|
||||
void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
|
||||
{
|
||||
drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void QPainter::drawEllipse(const QRectF &rectangle)
|
||||
@ -7378,6 +7392,7 @@ void QPainter::setViewTransformEnabled(bool enable)
|
||||
d->updateMatrix();
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\threadsafe
|
||||
|
||||
@ -7458,6 +7473,7 @@ QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset)
|
||||
Q_UNUSED(offset)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void qt_format_text(const QFont &fnt, const QRectF &_r,
|
||||
int tf, const QString& str, QRectF *brect,
|
||||
@ -8067,6 +8083,7 @@ QFont QPaintEngineState::font() const
|
||||
return static_cast<const QPainterState *>(this)->font;
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\since 4.2
|
||||
\obsolete
|
||||
@ -8089,6 +8106,7 @@ QMatrix QPaintEngineState::matrix() const
|
||||
|
||||
return st->matrix.toAffine();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\since 4.3
|
||||
|
@ -132,7 +132,10 @@ public:
|
||||
bool end();
|
||||
bool isActive() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use begin(QPaintDevice*) instead")
|
||||
void initFrom(const QPaintDevice *device);
|
||||
#endif
|
||||
|
||||
enum CompositionMode {
|
||||
CompositionMode_SourceOver,
|
||||
@ -232,28 +235,40 @@ public:
|
||||
void restore();
|
||||
|
||||
// XForm functions
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use setTransform() instead")
|
||||
void setMatrix(const QMatrix &matrix, bool combine = false);
|
||||
QT_DEPRECATED_X("Use transform() instead")
|
||||
const QMatrix &matrix() const;
|
||||
QT_DEPRECATED_X("Use deviceTransform() instead")
|
||||
const QMatrix &deviceMatrix() const;
|
||||
QT_DEPRECATED_X("Use resetTransform() instead")
|
||||
void resetMatrix();
|
||||
#endif
|
||||
|
||||
void setTransform(const QTransform &transform, bool combine = false);
|
||||
const QTransform &transform() const;
|
||||
const QTransform &deviceTransform() const;
|
||||
void resetTransform();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use setWorldTransform() instead")
|
||||
void setWorldMatrix(const QMatrix &matrix, bool combine = false);
|
||||
QT_DEPRECATED_X("Use worldTransform() instead")
|
||||
const QMatrix &worldMatrix() const;
|
||||
QT_DEPRECATED_X("Use combinedTransform() instead")
|
||||
QMatrix combinedMatrix() const;
|
||||
QT_DEPRECATED_X("Use setWorldMatrixEnabled() instead")
|
||||
void setMatrixEnabled(bool enabled);
|
||||
QT_DEPRECATED_X("Use worldMatrixEnabled() instead")
|
||||
bool matrixEnabled() const;
|
||||
#endif
|
||||
|
||||
void setWorldTransform(const QTransform &matrix, bool combine = false);
|
||||
const QTransform &worldTransform() const;
|
||||
|
||||
QMatrix combinedMatrix() const;
|
||||
QTransform combinedTransform() const;
|
||||
|
||||
void setMatrixEnabled(bool enabled);
|
||||
bool matrixEnabled() const;
|
||||
|
||||
void setWorldMatrixEnabled(bool enabled);
|
||||
bool worldMatrixEnabled() const;
|
||||
|
||||
@ -355,9 +370,14 @@ public:
|
||||
inline void drawRoundedRect(const QRect &rect, qreal xRadius, qreal yRadius,
|
||||
Qt::SizeMode mode = Qt::AbsoluteSize);
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead")
|
||||
void drawRoundRect(const QRectF &r, int xround = 25, int yround = 25);
|
||||
inline void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25);
|
||||
inline void drawRoundRect(const QRect &r, int xround = 25, int yround = 25);
|
||||
QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead")
|
||||
void drawRoundRect(int x, int y, int w, int h, int = 25, int = 25);
|
||||
QT_DEPRECATED_X("Use drawRoundedRect(..., Qt::RelativeSize) instead")
|
||||
void drawRoundRect(const QRect &r, int xround = 25, int yround = 25);
|
||||
#endif
|
||||
|
||||
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset = QPointF());
|
||||
inline void drawTiledPixmap(int x, int y, int w, int h, const QPixmap &, int sx=0, int sy=0);
|
||||
@ -464,10 +484,15 @@ public:
|
||||
|
||||
QPaintEngine *paintEngine() const;
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QWidget::render() instead")
|
||||
static void setRedirected(const QPaintDevice *device, QPaintDevice *replacement,
|
||||
const QPoint& offset = QPoint());
|
||||
QT_DEPRECATED_X("Use QWidget::render() instead")
|
||||
static QPaintDevice *redirected(const QPaintDevice *device, QPoint *offset = nullptr);
|
||||
QT_DEPRECATED_X("Use QWidget::render() instead")
|
||||
static void restoreRedirected(const QPaintDevice *device);
|
||||
#endif
|
||||
|
||||
void beginNativePainting();
|
||||
void endNativePainting();
|
||||
@ -629,16 +654,6 @@ inline void QPainter::drawPoints(const QPolygon &points)
|
||||
drawPoints(points.constData(), points.size());
|
||||
}
|
||||
|
||||
inline void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
|
||||
{
|
||||
drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
|
||||
}
|
||||
|
||||
inline void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
|
||||
{
|
||||
drawRoundRect(QRectF(rect), xRnd, yRnd);
|
||||
}
|
||||
|
||||
inline void QPainter::drawRoundedRect(int x, int y, int w, int h, qreal xRadius, qreal yRadius,
|
||||
Qt::SizeMode mode)
|
||||
{
|
||||
|
@ -5737,12 +5737,10 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset,
|
||||
QPoint offset = targetOffset;
|
||||
offset -= paintRegion.boundingRect().topLeft();
|
||||
QPoint redirectionOffset;
|
||||
QPaintDevice *redirected = 0;
|
||||
QPaintDevice *redirected = nullptr;
|
||||
|
||||
if (target->devType() == QInternal::Widget)
|
||||
redirected = static_cast<QWidget *>(target)->d_func()->redirected(&redirectionOffset);
|
||||
if (!redirected)
|
||||
redirected = QPainter::redirected(target, &redirectionOffset);
|
||||
|
||||
if (redirected) {
|
||||
target = redirected;
|
||||
|
Loading…
x
Reference in New Issue
Block a user