Fix some QPainter-related deprecation warnings

text/qtextdocument.cpp:2666:48: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations]
text/qtextdocumentfragment.cpp:545:87: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations]
text/qtextdocumentfragment.cpp:546:68: warning: ‘QString QTextCharFormat::anchorName() const’ is deprecated: Use anchorNames() instead [-Wdeprecated-declarations]
painting/qpainterpath.cpp:3321:34: warning: ‘void QPainterPath::addRoundRect(const QRectF&, int, int)’ is deprecated: Use addRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations]
painting/qpainterpath.cpp:3342:48: warning: ‘void QPainterPath::addRoundRect(const QRectF&, int, int)’ is deprecated: Use addRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations]
painting/qpainterpath.cpp:3366:47: warning: ‘void QPainterPath::addRoundRect(const QRectF&, int)’ is deprecated: Use addRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations]
painting/qpainter.cpp:4233:49: warning: ‘void QPainter::drawRoundRect(const QRectF&, int, int)’ is deprecated: Use drawRoundedRect(..., Qt::RelativeSize) instead [-Wdeprecated-declarations]
painting/qpainter.cpp:8349:27: warning: ‘void QPainter::setMatrixEnabled(bool)’ is deprecated: Use setWorldMatrixEnabled() instead [-Wdeprecated-declarations]
painting/qpdf.cpp:1545:28: warning: ‘void QDataStream::unsetDevice()’ is deprecated: Use QDataStream::setDevice(nullptr) instead [-Wdeprecated-declarations]
widgets/qtabbar.cpp:2096:17: warning: ‘void QPainter::initFrom(const QPaintDevice*)’ is deprecated: Use begin(QPaintDevice*) instead [-Wdeprecated-declarations]

Change-Id: I76d98ea8146e7586d3763a5610781c7736d37204
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
This commit is contained in:
Friedemann Kleint 2019-02-06 10:23:20 +01:00
parent c41efe7373
commit 4ce485a2eb
6 changed files with 14 additions and 13 deletions

View File

@ -4219,7 +4219,7 @@ void QPainter::drawRoundRect(const QRectF &r, int xRnd, int yRnd)
*/
void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
{
drawRoundRect(QRectF(rect), xRnd, yRnd);
drawRoundedRect(QRectF(rect), xRnd, yRnd, Qt::RelativeSize);
}
/*!
@ -4233,7 +4233,7 @@ void QPainter::drawRoundRect(const QRect &rect, int xRnd, int yRnd)
*/
void QPainter::drawRoundRect(int x, int y, int w, int h, int xRnd, int yRnd)
{
drawRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
drawRoundedRect(QRectF(x, y, w, h), xRnd, yRnd, Qt::RelativeSize);
}
#endif
@ -8349,7 +8349,7 @@ void QPainter::resetTransform()
d->state->ww = d->state->vw = d->device->metric(QPaintDevice::PdmWidth);
d->state->wh = d->state->vh = d->device->metric(QPaintDevice::PdmHeight);
d->state->worldMatrix = QTransform();
setMatrixEnabled(false);
setWorldMatrixEnabled(false);
setViewTransformEnabled(false);
if (d->extended)
d->extended->transformChanged();

View File

@ -3318,7 +3318,7 @@ void QPainterPath::addRoundRect(const QRectF &rect,
xRnd = int(roundness * rect.height()/rect.width());
else
yRnd = int(roundness * rect.width()/rect.height());
addRoundRect(rect, xRnd, yRnd);
addRoundedRect(rect, xRnd, yRnd, Qt::RelativeSize);
}
/*!
@ -3339,7 +3339,7 @@ void QPainterPath::addRoundRect(const QRectF &rect,
void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
int xRnd, int yRnd)
{
addRoundRect(QRectF(x, y, w, h), xRnd, yRnd);
addRoundedRect(QRectF(x, y, w, h), xRnd, yRnd, Qt::RelativeSize);
}
/*!
@ -3363,7 +3363,7 @@ void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
void QPainterPath::addRoundRect(qreal x, qreal y, qreal w, qreal h,
int roundness)
{
addRoundRect(QRectF(x, y, w, h), roundness);
addRoundedRect(QRectF(x, y, w, h), roundness, Qt::RelativeSize);
}
#endif

View File

@ -1542,7 +1542,7 @@ bool QPdfEngine::end()
Q_D(QPdfEngine);
d->writeTail();
d->stream->unsetDevice();
d->stream->setDevice(nullptr);
qDeleteAll(d->fonts);
d->fonts.clear();

View File

@ -2663,10 +2663,10 @@ void QTextHtmlExporter::emitFragment(const QTextFragment &fragment)
bool closeAnchor = false;
if (format.isAnchor()) {
const QString name = format.anchorName();
if (!name.isEmpty()) {
const auto names = format.anchorNames();
if (!names.isEmpty()) {
html += QLatin1String("<a name=\"");
html += name.toHtmlEscaped();
html += names.constFirst().toHtmlEscaped();
html += QLatin1String("\"></a>");
}
const QString href = format.anchorHref();

View File

@ -542,8 +542,10 @@ void QTextHtmlImporter::import()
}
}
if (currentNode->charFormat.isAnchor() && !currentNode->charFormat.anchorName().isEmpty()) {
namedAnchors.append(currentNode->charFormat.anchorName());
if (currentNode->charFormat.isAnchor()) {
const auto names = currentNode->charFormat.anchorNames();
if (!names.isEmpty())
namedAnchors.append(names.constFirst());
}
if (appendNodeText())

View File

@ -2093,7 +2093,6 @@ void QTabBarPrivate::setupMovableTab()
grabImage.setDevicePixelRatio(q->devicePixelRatioF());
grabImage.fill(Qt::transparent);
QStylePainter p(&grabImage, q);
p.initFrom(q);
QStyleOptionTab tab;
q->initStyleOption(&tab, pressedIndex);