Changeset 846 for trunk/src/gui/widgets/qmainwindow.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/gui/widgets/qmainwindow.cpp (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/widgets/qmainwindow.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 40 40 ****************************************************************************/ 41 41 42 43 42 44 #include "qmainwindow.h" 43 45 #include "qmainwindowlayout_p.h" … … 77 79 #ifdef Q_WS_MAC 78 80 , useHIToolBar(false) 81 79 82 #endif 80 83 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) … … 88 91 #ifdef Q_WS_MAC 89 92 bool useHIToolBar; 93 90 94 #endif 91 95 void init(); … … 100 104 uint cursorAdjusted : 1; 101 105 #endif 106 107 108 109 110 102 111 }; 103 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 104 155 void QMainWindowPrivate::init() 105 156 { 106 157 Q_Q(QMainWindow); 107 layout = new QMainWindowLayout(q); 158 159 #ifdef QT_EXPERIMENTAL_CLIENT_DECORATIONS 160 QGridLayout *topLayout = new QGridLayout(q); 161 topLayout->setContentsMargins(0, 0, 0, 0); 162 163 layout = new QMainWindowLayout(q, topLayout); 164 165 topLayout->addItem(layout, 1, 1); 166 #else 167 layout = new QMainWindowLayout(q, 0); 168 #endif 169 108 170 const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); 109 171 iconSize = QSize(metric, metric); … … 443 505 QMenuBar *QMainWindow::menuBar() const 444 506 { 445 QMenuBar *menuBar = qobject_cast<QMenuBar *>( d_func()->layout->menuBar());507 QMenuBar *menuBar = qobject_cast<QMenuBar *>(->menuBar()); 446 508 if (!menuBar) { 447 509 QMainWindow *self = const_cast<QMainWindow *>(this); … … 462 524 void QMainWindow::setMenuBar(QMenuBar *menuBar) 463 525 { 464 Q_D(QMainWindow); 465 if (d->layout->menuBar() && d->layout->menuBar() != menuBar) { 526 QLayout *topLayout = layout(); 527 528 if (topLayout->menuBar() && topLayout->menuBar() != menuBar) { 466 529 // Reparent corner widgets before we delete the old menu bar. 467 QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>( d->layout->menuBar());530 QMenuBar *oldMenuBar = qobject_cast<QMenuBar *>(ayout->menuBar()); 468 531 if (menuBar) { 469 532 // TopLeftCorner widget. … … 479 542 oldMenuBar->deleteLater(); 480 543 } 481 d->layout->setMenuBar(menuBar);544 ayout->setMenuBar(menuBar); 482 545 } 483 546 … … 1375 1438 1376 1439 case QEvent::StyleChange: 1440 1441 1442 1377 1443 if (!d->explicitIconSize) 1378 1444 setIconSize(QSize()); … … 1438 1504 disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling 1439 1505 the toolbars out and back into the regular toolbar and vice versa when you swap out. 1440 However, a good practice would be that turning off the unified toolbar before you call1441 showFullScreen() and restoring it after you call showNormal().1442 1506 \endlist 1443 1507 … … 1454 1518 1455 1519 // ### Disable the unified toolbar when using anything but the native graphics system. 1456 if (windowSurface()) 1520 // ### Disable when using alien widgets as well 1521 if (windowSurface() || testAttribute(Qt::WA_NativeWindow) == false) 1457 1522 return; 1458 1523 … … 1536 1601 #ifndef QT_NO_MENU 1537 1602 QMenu *popup = createPopupMenu(); 1538 if (popup && !popup->isEmpty()) { 1539 popup->exec(event->globalPos()); 1540 event->accept(); 1541 } 1542 delete popup; 1603 if (popup) { 1604 if (!popup->isEmpty()) { 1605 popup->setAttribute(Qt::WA_DeleteOnClose); 1606 popup->popup(event->globalPos()); 1607 event->accept(); 1608 } else { 1609 delete popup; 1610 } 1611 } 1543 1612 #endif 1544 1613 }
Note:
See TracChangeset
for help on using the changeset viewer.
