diff options
author | Robin Burchell <robin.burchell@viroteck.net> | 2016-11-15 18:16:50 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2016-11-16 18:13:41 +0000 |
commit | 094b64fb605b39d1ae88d91d2b9a0672b9ff4780 (patch) | |
tree | cf0e5d79af22433aa7b278247f500c4264a0b4f4 | |
parent | e8a41ed8668437eb6ad406ddabf4141fd66a85d2 (diff) | |
download | qtbase-094b64fb605b39d1ae88d91d2b9a0672b9ff4780.tar.gz |
QRawFont: Add a qHash overload
This will be used in QtQuick to avoid costly string manipulation (which in turn
involves memory allocations).
Change-Id: I51a67a4cd97cc576f399483c9c0c13da1e1c6e72
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
-rw-r--r-- | src/gui/text/qrawfont.cpp | 13 | ||||
-rw-r--r-- | src/gui/text/qrawfont.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 886cf5ef39..b2d8bf01af 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -316,6 +316,19 @@ bool QRawFont::operator==(const QRawFont &other) const } /*! + Returns the hash value for \a font. If specified, \a seed is used + to initialize the hash. + + \relates QRawFont + \since 5.8 +*/ +uint qHash(const QRawFont &font, uint seed) Q_DECL_NOTHROW +{ + return qHash(QRawFontPrivate::get(font)->fontEngine, seed); +} + + +/*! \fn bool QRawFont::operator!=(const QRawFont &other) const Returns \c true if this QRawFont is not equal to \a other. Otherwise, returns \c false. diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 0252e62370..470f2694e4 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -158,6 +158,8 @@ Q_DECLARE_SHARED(QRawFont) Q_DECLARE_OPERATORS_FOR_FLAGS(QRawFont::LayoutFlags) +Q_GUI_EXPORT uint qHash(const QRawFont &font, uint seed = 0) Q_DECL_NOTHROW; + inline QVector<QPointF> QRawFont::advancesForGlyphIndexes(const QVector<quint32> &glyphIndexes, QRawFont::LayoutFlags layoutFlags) const { QVector<QPointF> advances(glyphIndexes.size()); |