From 106843ad1afa2f5c0aedaa748088d4ebacd6d73d Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 9 Sep 2013 11:46:50 +0300 Subject: Make QFontEngine not derive from QObject Whilst having the objectName set for each engine is somewhat handy when debugging, deriving from QObject just for that is a wasting of memory in all other cases. This also broke the font engine abstraction by allowing qobject_cast() to access some private data; the only sane way to distinguish engines is querying their Type value. Change-Id: Ib1d195692859eb39089f6d8d9016cb8f9dcc0400 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll --- src/gui/text/qfontengine_p.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/gui/text/qfontengine_p.h') diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 4427000d03..1a6862898d 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -86,9 +86,8 @@ enum HB_Compat_Error { typedef void (*qt_destroy_func_t) (void *user_data); -class Q_GUI_EXPORT QFontEngine : public QObject +class Q_GUI_EXPORT QFontEngine { - Q_OBJECT public: enum Type { Box, @@ -300,9 +299,13 @@ public: QImage currentlyLockedAlphaMap; int m_subPixelPositionCount; // Number of positions within a single pixel for this cache + inline QVariant userData() const { return m_userData; } + protected: QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false); + inline void setUserData(const QVariant &userData) { m_userData = userData; } + private: struct GlyphCacheEntry { const void *context; @@ -311,6 +314,9 @@ private: }; mutable QLinkedList m_glyphCaches; + +private: + QVariant m_userData; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QFontEngine::ShaperFlags) @@ -368,7 +374,6 @@ private: class Q_GUI_EXPORT QFontEngineMulti : public QFontEngine { - Q_OBJECT public: explicit QFontEngineMulti(int engineCount); ~QFontEngineMulti(); -- cgit v1.2.3