Skip to content

Commit

Permalink
Fix deprecated macros
Browse files Browse the repository at this point in the history
The QTextCharFormat::fontFamily  methods are deprecated as of Qt 6.1,
not as of Qt 6.0.

Mark them as obsolete in the documentation and point to the replacement
there as well.

Address API review comment.

Change-Id: Id71ea1ebab6f7a385c8c3f286a35f88ba1177857
Reviewed-by: Andy Shaw <[email protected]>
(cherry picked from commit 42e659b)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
  • Loading branch information
vohi authored and Qt Cherry-pick Bot committed Mar 25, 2021
1 parent 5fc0ebf commit 57c7b37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/gui/text/qtextformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)

/*!
\fn void QTextCharFormat::setFontFamily(const QString &family)
\obsolete Use setFontFamilies() instead.
Sets the text format's font \a family.
Expand All @@ -1466,6 +1467,7 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt)

/*!
\fn QString QTextCharFormat::fontFamily() const
\obsolete Use fontFamilies() instead.
Returns the text format's font family.
Expand Down
6 changes: 3 additions & 3 deletions src/gui/text/qtextformat.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,10 @@ class Q_GUI_EXPORT QTextCharFormat : public QTextFormat
void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior = FontPropertiesAll);
QFont font() const;

#if QT_DEPRECATED_SINCE(6, 0)
QT_DEPRECATED_VERSION_X_6_0("Use setFontFamilies instead") inline void setFontFamily(const QString &family)
#if QT_DEPRECATED_SINCE(6, 1)
QT_DEPRECATED_VERSION_X_6_1("Use setFontFamilies instead") inline void setFontFamily(const QString &family)
{ setProperty(FontFamilies, QVariant(QStringList(family))); }
QT_DEPRECATED_VERSION_X_6_0("Use fontFamilies instead") inline QString fontFamily() const
QT_DEPRECATED_VERSION_X_6_1("Use fontFamilies instead") inline QString fontFamily() const
{ return property(FontFamilies).toStringList().first(); }
#endif

Expand Down

0 comments on commit 57c7b37

Please sign in to comment.