Remove a bunch of deprecated members from src/gui/painting classes

Also remove dead code that isn't compiled anymore in Qt 6 builds.

Change-Id: I7a7ae35e61fb2ad9cc21180fb7224357ade1505f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-05-05 21:23:44 +02:00
parent d39fefc0eb
commit 660b38bb2c
8 changed files with 1 additions and 448 deletions

View File

@ -905,13 +905,6 @@ void QRasterPaintEngine::renderHintsChanged()
bool was_bilinear = s->flags.bilinear;
s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing);
#if QT_DEPRECATED_SINCE(5, 14)
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
if (s->renderHints & QPainter::HighQualityAntialiasing)
s->flags.antialiased = true;
QT_WARNING_POP
#endif
s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform);
s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing) && bool(s->renderHints & QPainter::Qt4CompatiblePainting);

View File

@ -1430,12 +1430,6 @@ void QPainterPrivate::updateState(QPainterState *newState)
a smooth pixmap transformation algorithm (such as bilinear) rather
than nearest neighbor.
\value HighQualityAntialiasing This value is obsolete and will be ignored,
use the Antialiasing render hint instead.
\value NonCosmeticDefaultPen This value is obsolete, the default for QPen
is now non-cosmetic.
\value Qt4CompatiblePainting Compatibility hint telling the engine to use the
same X11 based fill rules as in Qt 4, where aliased rendering is offset
by slightly less than half a pixel. Also will treat default constructed pens
@ -1551,23 +1545,6 @@ 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.
\obsolete
\sa begin(), {QPainter#Settings}{Settings}
*/
void QPainter::initFrom(const QPaintDevice *device)
{
Q_ASSERT_X(device, "QPainter::initFrom(const QPaintDevice *device)", "QPaintDevice cannot be 0");
Q_D(QPainter);
d->initFrom(device);
}
#endif
void QPainterPrivate::initFrom(const QPaintDevice *device)
{
if (!engine) {
@ -4001,54 +3978,6 @@ 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
Draws a rectangle \a r with rounded corners.
The \a xRnd and \a 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.
\sa drawRoundedRect()
*/
void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
{
drawRoundedRect(r, xRnd, yRnd, Qt::RelativeSize);
}
/*!
\fn void QPainter::drawRoundRect(const QRect &r, int xRnd = 25, int yRnd = 25)
\overload
\obsolete
Draws the rectangle \a r with rounded corners.
*/
void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
{
drawRoundedRect(QRectF(rect), xRnd, yRnd, Qt::RelativeSize);
}
/*!
\obsolete
\fn QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
\overload
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)
{
drawRoundedRect(QRectF(x, y, w, h), xRnd, yRnd, Qt::RelativeSize);
}
#endif
/*!
\fn void QPainter::drawEllipse(const QRectF &rectangle)
@ -5692,22 +5621,6 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif
if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen)
return;
#if QT_DEPRECATED_SINCE(5, 11) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
if (tf & Qt::TextBypassShaping) {
// Skip complex shaping, shape using glyph advances only
int len = str.length();
int numGlyphs = len;
QVarLengthGlyphLayoutArray glyphs(len);
QFontEngine *fontEngine = d->state->font.d->engineForScript(QChar::Script_Common);
if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, { }))
Q_UNREACHABLE();
QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine);
drawTextItem(p, gf);
return;
}
#endif
QStackTextEngine engine(str, d->state->font);
engine.option.setTextDirection(d->state->layoutDirection);
if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) {
@ -7193,89 +7106,6 @@ void QPainter::setViewTransformEnabled(bool enable)
d->updateMatrix();
}
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\threadsafe
\obsolete
Please use QWidget::render() instead.
Redirects all paint commands for the given paint \a device, to the
\a replacement device. The optional point \a 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 \a
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.
\sa redirected(), restoreRedirected()
*/
void QPainter::setRedirected(const QPaintDevice *device,
QPaintDevice *replacement,
const QPoint &offset)
{
Q_ASSERT(device != nullptr);
Q_UNUSED(device)
Q_UNUSED(replacement)
Q_UNUSED(offset)
qWarning("QPainter::setRedirected(): ignoring call to deprecated function, use QWidget::render() instead");
}
/*!
\threadsafe
\obsolete
Using QWidget::render() obsoletes the use of this function.
Restores the previous redirection for the given \a 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.
\sa redirected()
*/
void QPainter::restoreRedirected(const QPaintDevice *device)
{
Q_UNUSED(device)
qWarning("QPainter::restoreRedirected(): ignoring call to deprecated function, use QWidget::render() instead");
}
/*!
\threadsafe
\obsolete
Using QWidget::render() obsoletes the use of this function.
Returns the replacement for given \a device. The optional out
parameter \a 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.
\sa setRedirected(), restoreRedirected()
*/
QPaintDevice *QPainter::redirected(const QPaintDevice *device, QPoint *offset)
{
Q_UNUSED(device)
Q_UNUSED(offset)
return nullptr;
}
#endif
void qt_format_text(const QFont &fnt, const QRectF &_r,
int tf, const QString& str, QRectF *brect,
int tabstops, int *ta, int tabarraylen,

View File

@ -87,10 +87,6 @@ public:
Antialiasing = 0x01,
TextAntialiasing = 0x02,
SmoothPixmapTransform = 0x04,
#if QT_DEPRECATED_SINCE(5, 14)
HighQualityAntialiasing Q_DECL_ENUMERATOR_DEPRECATED_X("Use Antialiasing instead") = 0x08,
NonCosmeticDefaultPen Q_DECL_ENUMERATOR_DEPRECATED_X("Default pen is non-cosmetic now") = 0x10,
#endif
Qt4CompatiblePainting = 0x20,
LosslessImageRendering = 0x40,
};
@ -132,11 +128,6 @@ 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,
CompositionMode_DestinationOver,
@ -346,15 +337,6 @@ 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);
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);
inline void drawTiledPixmap(const QRect &, const QPixmap &, const QPoint & = QPoint());
@ -460,16 +442,6 @@ 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();

View File

@ -3233,131 +3233,6 @@ void QPainterPath::addRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadi
Adds the given rectangle \a x, \a y, \a w, \a h with rounded corners to the path.
*/
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\obsolete
Adds a rectangle \a r with rounded corners to the path.
The \a xRnd and \a yRnd arguments specify how rounded the corners
should be. 0 is angled corners, 99 is maximum roundedness.
\sa addRoundedRect()
*/
void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd)
{
if(xRnd >= 100) // fix ranges
xRnd = 99;
if(yRnd >= 100)
yRnd = 99;
if(xRnd <= 0 || yRnd <= 0) { // add normal rectangle
addRect(r);
return;
}
QRectF rect = r.normalized();
if (rect.isNull())
return;
qreal x = rect.x();
qreal y = rect.y();
qreal w = rect.width();
qreal h = rect.height();
qreal rxx2 = w*xRnd/100;
qreal ryy2 = h*yRnd/100;
ensureData();
detach();
bool first = d_func()->elements.size() < 2;
arcMoveTo(x, y, rxx2, ryy2, 180);
arcTo(x, y, rxx2, ryy2, 180, -90);
arcTo(x+w-rxx2, y, rxx2, ryy2, 90, -90);
arcTo(x+w-rxx2, y+h-ryy2, rxx2, ryy2, 0, -90);
arcTo(x, y+h-ryy2, rxx2, ryy2, 270, -90);
closeSubpath();
d_func()->require_moveTo = true;
d_func()->convex = first;
}
/*!
\obsolete
\fn bool QPainterPath::addRoundRect(const QRectF &rect, int roundness);
\since 4.3
\overload
Adds a rounded rectangle, \a rect, to the path.
The \a roundness argument specifies uniform roundness for the
rectangle. Vertical and horizontal roundness factors will be
adjusted accordingly to act uniformly around both axes. Use this
method if you want a rectangle equally rounded across both the X and
Y axis.
\sa addRoundedRect()
*/
void QPainterPath::addRoundRect(const QRectF &rect,
int roundness)
{
int xRnd = roundness;
int yRnd = roundness;
if (rect.width() > rect.height())
xRnd = int(roundness * rect.height()/rect.width());
else
yRnd = int(roundness * rect.width()/rect.height());
addRoundedRect(rect, xRnd, yRnd, Qt::RelativeSize);
}
/*!
\obsolete
\fn void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h, int xRnd, int yRnd);
\overload
Adds a rectangle with rounded corners to the path. The rectangle
is constructed from \a x, \a y, and the width and height \a w
and \a h.
The \a xRnd and \a yRnd arguments specify how rounded the corners
should be. 0 is angled corners, 99 is maximum roundedness.
\sa addRoundedRect()
*/
void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
int xRnd, int yRnd)
{
addRoundedRect(QRectF(x, y, w, h), xRnd, yRnd, Qt::RelativeSize);
}
/*!
\obsolete
\fn bool QPainterPath::addRoundRect(qreal x, qreal y, qreal width, qreal height, int roundness);
\since 4.3
\overload
Adds a rounded rectangle to the path, defined by the coordinates \a
x and \a y with the specified \a width and \a height.
The \a roundness argument specifies uniform roundness for the
rectangle. Vertical and horizontal roundness factors will be
adjusted accordingly to act uniformly around both axes. Use this
method if you want a rectangle equally rounded across both the X and
Y axis.
\sa addRoundedRect()
*/
void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
int roundness)
{
addRoundedRect(QRectF(x, y, w, h), roundness, Qt::RelativeSize);
}
#endif
/*!
\since 4.3
@ -3411,21 +3286,6 @@ QPainterPath QPainterPath::subtracted(const QPainterPath &p) const
return clipper.clip(QPathClipper::BoolSub);
}
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\since 4.3
\obsolete
Use subtracted() instead.
\sa subtracted()
*/
QPainterPath QPainterPath::subtractedInverted(const QPainterPath &p) const
{
return p.subtracted(*this);
}
#endif
/*!
\since 4.4

View File

@ -142,19 +142,6 @@ public:
qreal xRadius, qreal yRadius,
Qt::SizeMode mode = Qt::AbsoluteSize);
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
void addRoundRect(const QRectF &rect, int xRnd, int yRnd);
QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
void addRoundRect(qreal x, qreal y, qreal w, qreal h,
int xRnd, int yRnd);
QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
void addRoundRect(const QRectF &rect, int roundness);
QT_DEPRECATED_X("Use addRoundedRect(..., Qt::RelativeSize) instead")
void addRoundRect(qreal x, qreal y, qreal w, qreal h,
int roundness);
#endif
void connectPath(const QPainterPath &path);
bool contains(const QPointF &pt) const;
@ -196,10 +183,6 @@ public:
Q_REQUIRED_RESULT QPainterPath united(const QPainterPath &r) const;
Q_REQUIRED_RESULT QPainterPath intersected(const QPainterPath &r) const;
Q_REQUIRED_RESULT QPainterPath subtracted(const QPainterPath &r) const;
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use r.subtracted() instead")
Q_REQUIRED_RESULT QPainterPath subtractedInverted(const QPainterPath &r) const;
#endif
Q_REQUIRED_RESULT QPainterPath simplified() const;

View File

@ -1475,17 +1475,10 @@ void QOpenGL2PaintEngineEx::renderHintsChanged()
#if !QT_CONFIG(opengles2)
if (!QOpenGLContext::currentContext()->isOpenGLES()) {
Q_D(QOpenGL2PaintEngineEx);
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
if ((state()->renderHints & QPainter::Antialiasing)
#if QT_DEPRECATED_SINCE(5, 14)
|| (state()->renderHints & QPainter::HighQualityAntialiasing)
#endif
)
if (state()->renderHints & QPainter::Antialiasing)
d->funcs.glEnable(GL_MULTISAMPLE);
else
d->funcs.glDisable(GL_MULTISAMPLE);
QT_WARNING_POP
}
#endif // !QT_CONFIG(opengles2)

View File

@ -941,16 +941,10 @@ public:
{
Q_Q(QWindowsDirect2DPaintEngine);
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
// Default path (no optimization)
if (!(path.shape() == QVectorPath::LinesHint || path.shape() == QVectorPath::PolygonHint)
|| !pen.dashBrush
#if QT_DEPRECATED_SINCE(5, 14)
|| q->state()->renderHints.testFlag(QPainter::HighQualityAntialiasing)
#endif
|| q->state()->renderHints.testFlag(QPainter::Antialiasing)) {
QT_WARNING_POP
ComPtr<ID2D1Geometry> geometry = vectorPathToID2D1PathGeometry(path);
if (!geometry) {
qWarning("%s: Could not convert path to d2d geometry", __FUNCTION__);

View File

@ -124,10 +124,6 @@ private slots:
void drawPath2();
void drawPath3();
#if QT_DEPRECATED_SINCE(5, 13)
void drawRoundRect_data() { fillData(); }
void drawRoundRect();
#endif
void drawRoundedRect_data() { fillData(); }
void drawRoundedRect();
@ -135,10 +131,6 @@ private slots:
void qimageFormats();
void textOnTransparentImage();
#if !defined(QT_NO_WIDGETS) && QT_DEPRECATED_SINCE(5, 13)
void initFrom();
#endif
void setWindow();
void combinedTransform();
@ -680,33 +672,6 @@ static QRect getPaintedSize(const QPixmap &pm, const QColor &background)
#ifndef QT_NO_WIDGETS
#if QT_DEPRECATED_SINCE(5, 13)
void tst_QPainter::initFrom()
{
QWidget *widget = new QWidget();
QPalette pal = widget->palette();
pal.setColor(QPalette::WindowText, QColor(255, 0, 0));
pal.setBrush(QPalette::Window, QColor(0, 255, 0));
widget->setPalette(pal);
widget->show();
QFont font = widget->font();
font.setPointSize(26);
font.setItalic(true);
widget->setFont(font);
QPixmap pm(100, 100);
QPainter p(&pm);
p.initFrom(widget);
QCOMPARE(p.font(), font);
QCOMPARE(p.pen().color(), pal.color(QPalette::WindowText));
QCOMPARE(p.background(), pal.window());
delete widget;
}
#endif
void tst_QPainter::drawBorderPixmap()
{
QPixmap src(79,79);
@ -1549,43 +1514,6 @@ void tst_QPainter::drawClippedEllipse()
}
#if QT_DEPRECATED_SINCE(5, 13)
void tst_QPainter::drawRoundRect()
{
QFETCH(QRect, rect);
QFETCH(bool, usePen);
#ifdef Q_OS_MAC
if (QTest::currentDataTag() == QByteArray("rect(6, 12, 3, 14) with pen") ||
QTest::currentDataTag() == QByteArray("rect(6, 17, 3, 25) with pen") ||
QTest::currentDataTag() == QByteArray("rect(10, 6, 10, 3) with pen") ||
QTest::currentDataTag() == QByteArray("rect(10, 12, 10, 14) with pen") ||
QTest::currentDataTag() == QByteArray("rect(13, 45, 17, 80) with pen") ||
QTest::currentDataTag() == QByteArray("rect(13, 50, 17, 91) with pen") ||
QTest::currentDataTag() == QByteArray("rect(17, 6, 24, 3) with pen") ||
QTest::currentDataTag() == QByteArray("rect(24, 12, 38, 14) with pen"))
QSKIP("The Mac paint engine is off-by-one on certain rect sizes");
#endif
QPixmap pixmap(rect.x() + rect.width() + 10,
rect.y() + rect.height() + 10);
{
pixmap.fill(Qt::white);
QPainter p(&pixmap);
p.setRenderHint(QPainter::Qt4CompatiblePainting);
p.setPen(usePen ? QPen(Qt::black) : QPen(Qt::NoPen));
p.setBrush(Qt::black);
p.drawRoundRect(rect);
p.end();
int increment = usePen ? 1 : 0;
const QRect painted = getPaintedSize(pixmap, Qt::white);
QCOMPARE(painted.width(), rect.width() + increment);
QCOMPARE(painted.height(), rect.height() + increment);
}
}
#endif
void tst_QPainter::drawRoundedRect()
{
QFETCH(QRect, rect);