summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu_symbian.cpp
diff options
context:
space:
mode:
authorAlessandro Portale <alessandro.portale@nokia.com>2009-10-07 14:15:30 (GMT)
committerAlessandro Portale <alessandro.portale@nokia.com>2009-10-07 14:16:37 (GMT)
commit5ecccd6a67333066978055604a50973d8fb12748 (patch)
treeb82db8b65ac9f29d98ca80c4ac4dbf4517fcbcd6 /src/gui/widgets/qmenu_symbian.cpp
parent4c4875919de4a46cc40df93f64fe04e3fdad81fb (diff)
downloadQt-5ecccd6a67333066978055604a50973d8fb12748.zip
Qt-5ecccd6a67333066978055604a50973d8fb12748.tar.gz
Qt-5ecccd6a67333066978055604a50973d8fb12748.tar.bz2
Fix: Lazy instantiation of a static QAction
We should not create a QAction instance at program startup, that is before QApplication was initialized. One reason not to do that is that internal fonts are prematurely initialized without QApplication::qt_is_gui_used set to true, which leads to wrong font Dpis in qt_defaultDpiX(). This issue was detected due to the failure in tst_QTextLayout, cases: testDefaultTabs, testTabs, testMultilineTab, testRightTab, testTabsInAlignedParag, testCenteredTab, testDelimiterTab, testMultiTab and tabsForRtl. Fix: create a Q_GLOBAL_STATIC_WITH_ARGS for that QAction instance. Reviewed-by: Liang QI
Diffstat (limited to 'src/gui/widgets/qmenu_symbian.cpp')
-rw-r--r--src/gui/widgets/qmenu_symbian.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp
index c656ef8..d757f98 100644
--- a/src/gui/widgets/qmenu_symbian.cpp
+++ b/src/gui/widgets/qmenu_symbian.cpp
@@ -74,12 +74,13 @@ struct SymbianMenuItem
QAction* action;
};
+Q_GLOBAL_STATIC_WITH_ARGS(QAction, contextAction, (0))
+
static QList<SymbianMenuItem*> symbianMenus;
static QList<QMenuBar*> nativeMenuBars;
static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM;
static QPointer<QWidget> widgetWithContextMenu;
static QList<QAction*> contextMenuActionList;
-static QAction contextAction(0);
static int contexMenuCommand=0;
bool menuExists()
@@ -400,8 +401,8 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild()
contextMenuActionList.clear();
if (widgetWithContextMenu) {
contexMenuCommand = qt_symbian_menu_static_cmd_id; // Increased inside insertNativeMenuItems
- contextAction.setText(QMenuBar::tr("Actions"));
- contextMenuActionList.append(&contextAction);
+ contextAction()->setText(QMenuBar::tr("Actions"));
+ contextMenuActionList.append(contextAction());
insertNativeMenuItems(contextMenuActionList);
}
}