According to Src/corelib/global.h
Template <typename t>
Class Qglobalstatic
{
Public
T *pointer;
Inline qglobalstatic (T *p): pointer (p) {}
Inline ~qglobalstatic () {pointer = 0;}
};
#define Q_global_static (TYPE, NAME) \
Static TYPE *name () \
{ \
static TYPE this_# #NAME; \
Static Qglobalstatic<type > global_# #NAME (&this_# #NAME); \
return global_# #NAME. Pointer; \
}
The above expands into
Static Qfontdatabaseprivate *privatedb ()
{
Static Qfontdatabaseprivate This_privatedb; Note that the first reference starts with initialization and is no longer generated
Static qglobalstatic<qfontdatabaseprivate> Global_privatedb (&this_privatedb); A pointer to the resulting object is wrapped, as above, only the first time it is generated
return global_privatedb;
}
Qfontdatabase's constructor calls CreateDatabase (which calls the Initializedb), Initializedb calls Privatedb (), and one is the first call, The Qfontdatabaseprivate object is generated
The Qdatastream *stream member in Qfontdatabaseprivate is the font that really handles Qte.
http://zhgw01.blog.163.com/blog/static/1041481220105253491586/
Interpreting Q_global_static (qfontdatabaseprivate, Privatedb)