src/gui/widgets/qmenu_symbian.cpp
changeset 19 fcece45ef507
parent 18 2f34d5167611
child 25 e24348a560a6
equal deleted inserted replaced
18:2f34d5167611 19:fcece45ef507
   254 
   254 
   255 void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id)
   255 void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id)
   256 {
   256 {
   257     SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus);
   257     SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus);
   258     if (menu) {
   258     if (menu) {
       
   259         // Normally first AddMenuItemL call for menuPane will create the item array.
       
   260         // However if we don't have any items, we still need the item array. Otherwise
       
   261         // menupane will crash. That's why we create item array here manually, and
       
   262         // AddMenuItemL will then use the existing array.
       
   263         CEikMenuPane::CItemArray* itemArray = q_check_ptr(new CEikMenuPane::CItemArray);
       
   264         menuPane->SetItemArray(itemArray);
       
   265         menuPane->SetItemArrayOwnedExternally(EFalse);
       
   266 
   259         for (int i = 0; i < menu->children.count(); ++i)
   267         for (int i = 0; i < menu->children.count(); ++i)
   260             QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData));
   268             QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData));
   261     }
   269     }
   262 }
   270 }
   263 #endif // Q_WS_S60
   271 #endif // Q_WS_S60
   314     if (symbian_menubar)
   322     if (symbian_menubar)
   315         delete symbian_menubar;
   323         delete symbian_menubar;
   316     symbian_menubar = 0;
   324     symbian_menubar = 0;
   317 }
   325 }
   318 
   326 
       
   327 void QMenuBarPrivate::reparentMenuBar(QWidget *oldParent, QWidget *newParent)
       
   328 {
       
   329     if (menubars()->contains(oldParent)) {
       
   330         QMenuBarPrivate *object = menubars()->take(oldParent);
       
   331         menubars()->insert(newParent, object);
       
   332     }
       
   333 }
       
   334 
   319 QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar)
   335 QMenuBarPrivate::QSymbianMenuBarPrivate::QSymbianMenuBarPrivate(QMenuBarPrivate *menubar)
   320 {
   336 {
   321     d = menubar;
   337     d = menubar;
   322 }
   338 }
   323 
   339