summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qtextformat.h
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-07-19 12:51:46 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2021-07-22 21:21:12 +0200
commit08411a3ddfe2a3a392b1520e1283ce12208ebcb9 (patch)
tree1d3a9b7f9b445076680991dff99d8ccb7dc72919 /src/gui/text/qtextformat.h
parentb5950f6aff9ca646c55e640dd3d67105f56070e1 (diff)
QTextCharFormat: mark a couple of API mistakes to be fixed in Qt 7
The fontFamilies and fontStyleName have an asymmetric getter and setter. The setter takes QStringList, but the getter returns QVariant (?), for no reason whatsoever (the underlying QFont APIs take QStringList, and the docs say that they should return QStringList). It's not entirely obvious that we can fix this without introducing badly-named getters (getX) or somesuch, so for the time being, mark this to be fixed in Qt 7. Change-Id: I49706af00906a2c5d950ada4be3cbc76dbee432c Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/gui/text/qtextformat.h')
-rw-r--r--src/gui/text/qtextformat.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index b297862b6f..45bf458cae 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -465,13 +465,23 @@ public:
inline void setFontFamilies(const QStringList &families)
{ setProperty(FontFamilies, QVariant(families)); }
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
inline QVariant fontFamilies() const
{ return property(FontFamilies); }
+#else
+ inline QStringList fontFamilies() const
+ { return property(FontFamilies).toStringList(); }
+#endif
inline void setFontStyleName(const QString &styleName)
{ setProperty(FontStyleName, styleName); }
+#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
inline QVariant fontStyleName() const
{ return property(FontStyleName); }
+#else
+ inline QStringList fontStyleName() const
+ { return property(FontStyleName).toStringList(); }
+#endif
inline void setFontPointSize(qreal size)
{ setProperty(FontPointSize, size); }