summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-26 21:44:19 +0100
committerChristian Ehrlicher <ch.ehrlicher@gmx.de>2019-01-28 19:37:33 +0000
commit8f65160c44253ccabfcd4029f0947534c6ba8612 (patch)
tree9ba2079986ab872839e06746aedbee2e02887ecf
parent4ee8f755722bac9ad0b6fa62ddbfed8ee9943094 (diff)
QtGui/Text: mark obsolete functions as deprecated
Mark some long obsolete functions as deprecated so the can be removed with Qt6: - QTextFormat::setAnchorName()/anchorName() - QTextList::isEmpty() Change-Id: Ic1f5317980d116c846def3645d2a6cd61ba8679d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r--src/gui/text/qtextformat.cpp4
-rw-r--r--src/gui/text/qtextformat.h4
-rw-r--r--src/gui/text/qtexthtmlparser.cpp4
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/text/qtextlist.h3
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp2
6 files changed, 16 insertions, 3 deletions
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 136e7dc140..3bae6d4eb7 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -1787,6 +1787,7 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
*/
+#if QT_DEPRECATED_SINCE(5, 13)
/*!
\fn void QTextCharFormat::setAnchorName(const QString &name)
\obsolete
@@ -1797,6 +1798,7 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
hyperlink, the destination must be set with setAnchorHref() and
the anchor must be enabled with setAnchor().
*/
+#endif
/*!
\fn void QTextCharFormat::setAnchorNames(const QStringList &names)
@@ -1807,6 +1809,7 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style)
the anchor must be enabled with setAnchor().
*/
+#if QT_DEPRECATED_SINCE(5, 13)
/*!
\fn QString QTextCharFormat::anchorName() const
\obsolete
@@ -1826,6 +1829,7 @@ QString QTextCharFormat::anchorName() const
return QString();
return prop.toString();
}
+#endif
/*!
\fn QStringList QTextCharFormat::anchorNames() const
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index f292feabe8..80d8e82694 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -552,9 +552,13 @@ public:
inline QString anchorHref() const
{ return stringProperty(AnchorHref); }
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED_X("Use setAnchorNames() instead")
inline void setAnchorName(const QString &name)
{ setAnchorNames(QStringList(name)); }
+ QT_DEPRECATED_X("Use anchorNames() instead")
QString anchorName() const;
+#endif
inline void setAnchorNames(const QStringList &names)
{ setProperty(AnchorName, names); }
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 04300a4d22..adc3b138f7 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -1544,7 +1544,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
if (key == QLatin1String("href"))
node->charFormat.setAnchorHref(value);
else if (key == QLatin1String("name"))
- node->charFormat.setAnchorName(value);
+ node->charFormat.setAnchorNames({value});
break;
case Html_img:
if (key == QLatin1String("src") || key == QLatin1String("source")) {
@@ -1684,7 +1684,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
node->charFormat.setToolTip(value);
} else if (key == QLatin1String("id")) {
node->charFormat.setAnchor(true);
- node->charFormat.setAnchorName(value);
+ node->charFormat.setAnchorNames({value});
}
}
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index bec33d5f4d..5857afa048 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -100,6 +100,7 @@ public:
\sa QTextBlock, QTextListFormat, QTextCursor
*/
+#if QT_DEPRECATED_SINCE(5, 13)
/*!
\fn bool QTextList::isEmpty() const
\obsolete
@@ -111,6 +112,7 @@ public:
\sa count()
*/
+#endif
/*! \internal
*/
diff --git a/src/gui/text/qtextlist.h b/src/gui/text/qtextlist.h
index 3967787f03..cfb9f9456f 100644
--- a/src/gui/text/qtextlist.h
+++ b/src/gui/text/qtextlist.h
@@ -59,8 +59,11 @@ public:
int count() const;
+#if QT_DEPRECATED_SINCE(5, 13)
+ QT_DEPRECATED_X("Use count() instead")
inline bool isEmpty() const
{ return count() == 0; }
+#endif
QTextBlock item(int i) const;
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index 3f602f5aae..97546c34fd 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -1128,7 +1128,7 @@ void tst_QTextDocument::toHtml_data()
QTextCharFormat fmt;
fmt.setAnchor(true);
- fmt.setAnchorName("blub");
+ fmt.setAnchorNames({"blub"});
cursor.insertText("Blah", fmt);
QTest::newRow("named anchor") << QTextDocumentFragment(&doc)