src/gui/widgets/qmenu_symbian.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 25 e24348a560a6
--- a/src/gui/widgets/qmenu_symbian.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/gui/widgets/qmenu_symbian.cpp	Mon May 03 13:17:34 2010 +0300
@@ -256,6 +256,14 @@
 {
     SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus);
     if (menu) {
+        // Normally first AddMenuItemL call for menuPane will create the item array.
+        // However if we don't have any items, we still need the item array. Otherwise
+        // menupane will crash. That's why we create item array here manually, and
+        // AddMenuItemL will then use the existing array.
+        CEikMenuPane::CItemArray* itemArray = q_check_ptr(new CEikMenuPane::CItemArray);
+        menuPane->SetItemArray(itemArray);
+        menuPane->SetItemArrayOwnedExternally(EFalse);
+
         for (int i = 0; i < menu->children.count(); ++i)
             QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData));
     }
@@ -316,6 +324,14 @@
     symbian_menubar = 0;
 }
 
+void QMenuBarPrivate::reparentMenuBar(QWidget *oldParent, QWidget *newParent)
+{
+    if (menubars()->contains(oldParent)) {
+        QMenuBarPrivate *object = menubars()->take(oldParent);
+        menubars()->insert(newParent, object);
+    }
+}
+
 QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar)
 {
     d = menubar;