738 } |
742 } |
739 else { |
743 else { |
740 QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); |
744 QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true); |
741 } |
745 } |
742 #endif |
746 #endif |
743 #ifdef Q_WS_S60 |
|
744 symbianCreateMenuBar(q->parentWidget()); |
|
745 if(symbian_menubar) |
|
746 q->hide(); |
|
747 #endif |
|
748 |
|
749 q->setBackgroundRole(QPalette::Button); |
747 q->setBackgroundRole(QPalette::Button); |
750 oldWindow = oldParent = 0; |
748 oldWindow = oldParent = 0; |
751 #ifdef QT3_SUPPORT |
749 #ifdef QT3_SUPPORT |
752 doAutoResize = false; |
750 doAutoResize = false; |
|
751 #endif |
|
752 #ifdef QT_SOFTKEYS_ENABLED |
|
753 menuBarAction = 0; |
753 #endif |
754 #endif |
754 handleReparent(); |
755 handleReparent(); |
755 q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); |
756 q->setMouseTracking(q->style()->styleHint(QStyle::SH_MenuBar_MouseTracking, 0, q)); |
756 |
757 |
757 extension = new QMenuBarExtension(q); |
758 extension = new QMenuBarExtension(q); |
1382 #ifdef Q_WS_WINCE |
1383 #ifdef Q_WS_WINCE |
1383 if (qt_wince_is_mobile() && wce_menubar) |
1384 if (qt_wince_is_mobile() && wce_menubar) |
1384 wce_menubar->rebuild(); |
1385 wce_menubar->rebuild(); |
1385 #endif |
1386 #endif |
1386 #ifdef Q_WS_S60 |
1387 #ifdef Q_WS_S60 |
1387 if (symbian_menubar) |
1388 |
|
1389 // Construct symbian_menubar when this code path is entered first time |
|
1390 // and when newParent != NULL |
|
1391 if (!symbian_menubar) |
|
1392 symbianCreateMenuBar(newParent); |
|
1393 |
|
1394 // Reparent and rebuild menubar when parent is changed |
|
1395 if (symbian_menubar) { |
|
1396 if (oldParent != newParent) |
|
1397 reparentMenuBar(oldParent, newParent); |
|
1398 q->hide(); |
1388 symbian_menubar->rebuild(); |
1399 symbian_menubar->rebuild(); |
1389 #endif |
1400 } |
1390 |
1401 |
|
1402 #ifdef QT_SOFTKEYS_ENABLED |
|
1403 // Constuct menuBarAction when this code path is entered first time |
|
1404 if (!menuBarAction) { |
|
1405 if (newParent) { |
|
1406 menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, newParent); |
|
1407 newParent->addAction(menuBarAction); |
|
1408 } |
|
1409 } else { |
|
1410 // If reparenting i.e. we already have menuBarAction, remove it from old parent |
|
1411 // and add for a new parent |
|
1412 if (oldParent) |
|
1413 oldParent->removeAction(menuBarAction); |
|
1414 if (newParent) |
|
1415 newParent->addAction(menuBarAction); |
|
1416 } |
|
1417 #endif // QT_SOFTKEYS_ENABLED |
|
1418 #endif // Q_WS_S60 |
1391 } |
1419 } |
1392 |
1420 |
1393 #ifdef QT3_SUPPORT |
1421 #ifdef QT3_SUPPORT |
1394 /*! |
1422 /*! |
1395 Sets whether the menu bar should automatically resize itself |
1423 Sets whether the menu bar should automatically resize itself |
1438 d->handleReparent(); |
1466 d->handleReparent(); |
1439 } else if (e->type() == QEvent::FontChange |
1467 } else if (e->type() == QEvent::FontChange |
1440 || e->type() == QEvent::ApplicationFontChange) { |
1468 || e->type() == QEvent::ApplicationFontChange) { |
1441 d->itemsDirty = true; |
1469 d->itemsDirty = true; |
1442 d->updateGeometries(); |
1470 d->updateGeometries(); |
1443 } |
1471 #ifdef QT_SOFTKEYS_ENABLED |
|
1472 } else if (e->type() == QEvent::LanguageChange) { |
|
1473 if (d->menuBarAction) |
|
1474 d->menuBarAction->setText(QSoftKeyManager::standardSoftKeyText(QSoftKeyManager::MenuSoftKey)); |
|
1475 #endif |
|
1476 } |
|
1477 |
1444 QWidget::changeEvent(e); |
1478 QWidget::changeEvent(e); |
1445 } |
1479 } |
1446 |
1480 |
1447 /*! |
1481 /*! |
1448 \reimp |
1482 \reimp |