summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@nokia.com>2011-09-15 22:28:07 +0200
committerQt by Nokia <qt-info@nokia.com>2011-09-23 13:04:13 +0200
commitceb3a071d2e5bf4f3c6ea30dec983c3852959ed9 (patch)
tree8ae22ee7e18533b1df9734a25e68c85242f3f2bd /src/widgets
parent0bc19b49975bc82185aa24857f2a921584c9684f (diff)
Remove Q_GLOBAL_STATIC_WITH_INITIALIZER from QtWidgets
Change-Id: Iecad85fbbfabe41c3a332be2ee0ce3a643db7731 Reviewed-on: http://codereview.qt-project.org/5025 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/kernel/qapplication.cpp7
-rw-r--r--src/widgets/kernel/qapplication_p.h5
-rw-r--r--src/widgets/kernel/qicon.cpp14
3 files changed, 22 insertions, 4 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 15ad5ec13e..83a3468ed6 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -499,7 +499,12 @@ PaletteHash *qt_app_palettes_hash()
return app_palettes();
}
-Q_GLOBAL_STATIC_WITH_INITIALIZER(FontHash, app_fonts, { *x = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFonts(); } )
+FontHash::FontHash()
+{
+ QHash<QByteArray, QFont>::operator=(QGuiApplicationPrivate::platformIntegration()->fontDatabase()->defaultFonts());
+}
+
+Q_GLOBAL_STATIC(FontHash, app_fonts)
FontHash *qt_app_fonts_hash()
{
return app_fonts();
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 6efee02195..e466528cfb 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -287,7 +287,10 @@ public:
{ --threadData->loopLevel; }
};
-typedef QHash<QByteArray, QFont> FontHash;
+struct FontHash : public QHash<QByteArray, QFont>
+{
+ FontHash();
+};
FontHash *qt_app_fonts_hash();
typedef QHash<QByteArray, QPalette> PaletteHash;
diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp
index bb9f56b715..73f8a2a360 100644
--- a/src/widgets/kernel/qicon.cpp
+++ b/src/widgets/kernel/qicon.cpp
@@ -107,8 +107,18 @@ QT_BEGIN_NAMESPACE
static QBasicAtomicInt serialNumCounter = Q_BASIC_ATOMIC_INITIALIZER(1);
static void qt_cleanup_icon_cache();
-typedef QCache<QString, QIcon> IconCache;
-Q_GLOBAL_STATIC_WITH_INITIALIZER(IconCache, qtIconCache, qAddPostRoutine(qt_cleanup_icon_cache))
+namespace {
+ struct IconCache : public QCache<QString, QIcon>
+ {
+ IconCache()
+ {
+ // ### note: won't readd if QApplication is re-created!
+ qAddPostRoutine(qt_cleanup_icon_cache);
+ }
+ };
+}
+
+Q_GLOBAL_STATIC(IconCache, qtIconCache)
static void qt_cleanup_icon_cache()
{