From 8cccf0a76b82726ce987690d783a1b912aa6bba5 Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Mon, 8 Jun 2020 16:50:01 +0200 Subject: [PATCH] Remove deprecated methods and address some ### Qt 6 comments in gui/text Change-Id: If1ed58ecbb13df88bdb1d72caccfd01c14d42eac Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextformat.cpp | 48 ------------------------------ src/gui/text/qtextformat.h | 11 +------ src/gui/text/qtextimagehandler.cpp | 17 ----------- src/gui/text/qtextoption.cpp | 11 +------ src/gui/text/qtextoption.h | 1 - 5 files changed, 2 insertions(+), 86 deletions(-) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 2d771aa2ec..75f8c8fb8b 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1842,20 +1842,6 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) none has been set. */ - -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \fn void QTextCharFormat::setAnchorName(const QString &name) - \obsolete - - This function is deprecated. Use setAnchorNames() instead. - - Sets the text format's anchor \a name. For the anchor to work as a - hyperlink, the destination must be set with setAnchorHref() and - the anchor must be enabled with setAnchor(). -*/ -#endif - /*! \fn void QTextCharFormat::setAnchorNames(const QStringList &names) \since 4.3 @@ -1865,28 +1851,6 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) the anchor must be enabled with setAnchor(). */ -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \fn QString QTextCharFormat::anchorName() const - \obsolete - - This function is deprecated. Use anchorNames() instead. - - Returns the anchor name associated with this text format, or an empty - string if none has been set. If the anchor name is set, text with this - format can be the destination of a hypertext link. -*/ -QString QTextCharFormat::anchorName() const -{ - QVariant prop = property(AnchorName); - if (prop.userType() == QMetaType::QStringList) - return prop.toStringList().value(0); - else if (prop.userType() != QMetaType::QString) - return QString(); - return prop.toString(); -} -#endif - /*! \fn QStringList QTextCharFormat::anchorNames() const \since 4.3 @@ -1991,18 +1955,6 @@ QStringList QTextCharFormat::anchorNames() const \sa setFont() */ -/*! - \overload - - Sets the text format's \a font. - - \sa font() -*/ -void QTextCharFormat::setFont(const QFont &font) -{ - setFont(font, FontPropertiesAll); -} - /*! \since 5.3 diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index b4db18289e..a6d1bf1d57 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -449,8 +449,7 @@ public: FontPropertiesSpecifiedOnly, FontPropertiesAll }; - void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior); - void setFont(const QFont &font); // ### Qt6: Merge with above + void setFont(const QFont &font, FontPropertiesInheritanceBehavior behavior = FontPropertiesAll); QFont font() const; inline void setFontFamily(const QString &family) @@ -580,14 +579,6 @@ 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); } QStringList anchorNames() const; diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp index 0d87a2135d..cae8304438 100644 --- a/src/gui/text/qtextimagehandler.cpp +++ b/src/gui/text/qtextimagehandler.cpp @@ -95,14 +95,6 @@ static QPixmap getPixmap(QTextDocument *doc, const QTextImageFormat &format, con } if (pm.isNull()) { -#if 0 - QString context; - // ### Qt5 - QTextBrowser *browser = qobject_cast(doc->parent()); - if (browser) - context = browser->source().toString(); -#endif - // try direct loading QImage img; if (name.isEmpty() || !img.load(name)) return QPixmap(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png")); @@ -177,15 +169,6 @@ static QImage getImage(QTextDocument *doc, const QTextImageFormat &format, const } if (image.isNull()) { -#if 0 - QString context; - // ### Qt5 - QTextBrowser *browser = qobject_cast(doc->parent()); - if (browser) - context = browser->source().toString(); -#endif - // try direct loading - if (name.isEmpty() || !image.load(name)) return QImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/file-16.png")); diff --git a/src/gui/text/qtextoption.cpp b/src/gui/text/qtextoption.cpp index 2f195599f0..2568d3642b 100644 --- a/src/gui/text/qtextoption.cpp +++ b/src/gui/text/qtextoption.cpp @@ -55,14 +55,7 @@ struct QTextOptionPrivate using of design metrics flag is set to false. */ QTextOption::QTextOption() - : align(Qt::AlignLeft), - wordWrap(QTextOption::WordWrap), - design(false), - unused(0), - unused2(0), - f(0), - tab(-1), - d(nullptr) + : QTextOption(Qt::AlignLeft) { direction = Qt::LayoutDirectionAuto; } @@ -77,7 +70,6 @@ QTextOption::QTextOption(Qt::Alignment alignment) wordWrap(QTextOption::WordWrap), design(false), unused(0), - unused2(0), f(0), tab(-1), d(nullptr) @@ -104,7 +96,6 @@ QTextOption::QTextOption(const QTextOption &o) design(o.design), direction(o.direction), unused(o.unused), - unused2(o.unused2), f(o.f), tab(o.tab), d(nullptr) diff --git a/src/gui/text/qtextoption.h b/src/gui/text/qtextoption.h index 808076603a..52d253af1b 100644 --- a/src/gui/text/qtextoption.h +++ b/src/gui/text/qtextoption.h @@ -138,7 +138,6 @@ private: uint design : 1; uint direction : 2; uint unused : 16; - uint unused2; // ### Qt 6: remove unnecessary, extra 32 bits uint f; qreal tab; QTextOptionPrivate *d;