Remove deprecated methods and address some ### Qt 6 comments in gui/text

Change-Id: If1ed58ecbb13df88bdb1d72caccfd01c14d42eac
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Volker Hilsheimer 2020-06-08 16:50:01 +02:00
parent ef236456a4
commit 8cccf0a76b
5 changed files with 2 additions and 86 deletions

View File

@ -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

View File

@ -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;

View File

@ -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<QTextBrowser *>(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<QTextBrowser *>(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"));

View File

@ -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)

View File

@ -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;