diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2019-12-02 17:54:48 +0100 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2020-01-23 16:46:51 +0100 |
commit | 73d1476fb1397948a4d806bd921fce372bd8d63b (patch) | |
tree | a476349c26627027d78c1279da00ef633323311f /src/widgets/widgets/qtextedit.cpp | |
parent | a78d66743171557d79b16c08be775e3ac15bb4ef (diff) |
Replace most use of QVariant::type and occurrences of QVariant::Type
I made a clazy automated check that replaced the use of QVariant::Type
by the equivalent in QMetaType.
This has been deprecated since Qt 5.0, but many uses were not yet removed.
In addition, there was some manual changes to fix the compilation errors.
Adapted the Private API of QDateTimeParser and QMimeDataPrivate
and adjust QDateTimeEdit and QSpinBox.
QVariant(QVariant::Invalid) in qstylesheet made no sense.
But note that in QVariant::save, we actually wanted to use the non-user type.
In the SQL module, many changes were actually reverted because the API
still expects QVarient::Type.
Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/widgets/widgets/qtextedit.cpp')
-rw-r--r-- | src/widgets/widgets/qtextedit.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp index 10de7d0b9e..913ca6ec16 100644 --- a/src/widgets/widgets/qtextedit.cpp +++ b/src/widgets/widgets/qtextedit.cpp @@ -1502,7 +1502,7 @@ void QTextEdit::resizeEvent(QResizeEvent *e) QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); if (!doc->pageSize().isNull() - && alignmentProperty.type() == QVariant::Bool + && alignmentProperty.userType() == QMetaType::Bool && !alignmentProperty.toBool()) { d->_q_adjustScrollbars(); @@ -1547,7 +1547,7 @@ void QTextEditPrivate::relayoutDocument() width = lineWrapColumnOrWidth; else if (lineWrap == QTextEdit::NoWrap) { QVariant alignmentProperty = doc->documentLayout()->property("contentHasAlignment"); - if (alignmentProperty.type() == QVariant::Bool && !alignmentProperty.toBool()) { + if (alignmentProperty.userType() == QMetaType::Bool && !alignmentProperty.toBool()) { width = 0; } @@ -1835,17 +1835,17 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argume } const QPointF offset(-d->horizontalOffset(), -d->verticalOffset()); - switch (argument.type()) { - case QVariant::RectF: + switch (argument.userType()) { + case QMetaType::QRectF: argument = argument.toRectF().translated(-offset); break; - case QVariant::PointF: + case QMetaType::QPointF: argument = argument.toPointF() - offset; break; - case QVariant::Rect: + case QMetaType::QRect: argument = argument.toRect().translated(-offset.toPoint()); break; - case QVariant::Point: + case QMetaType::QPoint: argument = argument.toPoint() - offset; break; default: @@ -1853,14 +1853,14 @@ QVariant QTextEdit::inputMethodQuery(Qt::InputMethodQuery query, QVariant argume } const QVariant v = d->control->inputMethodQuery(query, argument); - switch (v.type()) { - case QVariant::RectF: + switch (v.userType()) { + case QMetaType::QRectF: return v.toRectF().translated(offset); - case QVariant::PointF: + case QMetaType::QPointF: return v.toPointF() + offset; - case QVariant::Rect: + case QMetaType::QRect: return v.toRect().translated(offset.toPoint()); - case QVariant::Point: + case QMetaType::QPoint: return v.toPoint() + offset.toPoint(); default: break; |