Changeset 561 for trunk/src/gui/widgets/qmainwindow.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qmainwindow.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 66 66 QT_END_NAMESPACE 67 67 #endif 68 #ifdef QT_SOFTKEYS_ENABLED 69 #include <private/qsoftkeymanager_p.h> 70 #endif 68 71 69 72 QT_BEGIN_NAMESPACE … … 74 77 public: 75 78 inline QMainWindowPrivate() 76 : layout(0), toolButtonStyle(Qt::ToolButtonIconOnly)79 : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly) 77 80 #ifdef Q_WS_MAC 78 81 , useHIToolBar(false) 82 #endif 83 #ifdef QT_SOFTKEYS_ENABLED 84 , menuBarAction(0) 79 85 #endif 80 86 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) … … 89 95 bool useHIToolBar; 90 96 #endif 97 #ifdef QT_SOFTKEYS_ENABLED 98 QAction *menuBarAction; 99 #endif 91 100 void init(); 92 101 QList<int> hoverSeparator; … … 108 117 const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q); 109 118 iconSize = QSize(metric, metric); 110 explicitIconSize = false;111 112 119 q->setAttribute(Qt::WA_Hover); 120 #ifdef QT_SOFTKEYS_ENABLED 121 menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q); 122 menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction")); 123 menuBarAction->setVisible(false); 124 #endif 113 125 } 114 126 … … 149 161 \brief The QMainWindow class provides a main application 150 162 window. 151 \ingroup application152 \mainclass 163 \ingroup mainwindow-classes 164 153 165 154 166 \tableofcontents … … 481 493 oldMenuBar->deleteLater(); 482 494 } 483 #ifdef Q_OS_WINCE484 if (menuBar && menuBar->size().height() > 0)485 #endif486 495 d->layout->setMenuBar(menuBar); 496 497 #ifdef QT_SOFTKEYS_ENABLED 498 if (menuBar) 499 addAction(d->menuBarAction); 500 else 501 removeAction(d->menuBarAction); 502 #endif 487 503 } 488 504 … … 919 935 920 936 #ifndef QT_NO_TABBAR 921 /*! 937 /*! 922 938 \property QMainWindow::documentMode 923 939 \brief whether the tab bar for tabbed dockwidgets is set to document mode. … … 940 956 941 957 #ifndef QT_NO_TABWIDGET 942 /*! 958 /*! 943 959 \property QMainWindow::tabShape 944 960 \brief the tab shape used for tabbed dock widgets. … … 1033 1049 to restoreState(). Returns true if the state was restored; otherwise 1034 1050 returns false. 1051 1052 \sa restoreState(), saveState() 1035 1053 */ 1036 1054 … … 1164 1182 number to restoreState(). 1165 1183 1184 To save the geometry when the window closes, you can 1185 implement a close event like this: 1186 1187 \snippet doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp 0 1188 1166 1189 \sa restoreState(), QWidget::saveGeometry(), QWidget::restoreGeometry() 1167 1190 */ … … 1183 1206 is restored, and this function returns \c true. 1184 1207 1185 \sa saveState(), QWidget::saveGeometry(), QWidget::restoreGeometry() 1208 To restore geometry saved using QSettings, you can use code like 1209 this: 1210 1211 \snippet doc/src/snippets/code/src_gui_widgets_qmainwindow.cpp 1 1212 1213 \sa saveState(), QWidget::saveGeometry(), 1214 QWidget::restoreGeometry(), restoreDockWidget() 1186 1215 */ 1187 1216 bool QMainWindow::restoreState(const QByteArray &state, int version) … … 1373 1402 case QEvent::Show: 1374 1403 if (unifiedTitleAndToolBarOnMac()) 1375 macWindowToolbarShow(this, true); 1404 d->layout->syncUnifiedToolbarVisibility(); 1405 d->layout->blockVisiblityCheck = false; 1376 1406 break; 1377 # ifdef QT_MAC_USE_COCOA1378 1407 case QEvent::WindowStateChange: 1379 1408 { 1409 if (isHidden()) { 1410 // We are coming out of a minimize, leave things as is. 1411 d->layout->blockVisiblityCheck = true; 1412 } 1413 # ifdef QT_MAC_USE_COCOA 1380 1414 // We need to update the HIToolbar status when we go out of or into fullscreen. 1381 1415 QWindowStateChangeEvent *wce = static_cast<QWindowStateChangeEvent *>(event); … … 1383 1417 d->layout->updateHIToolBarStatus(); 1384 1418 } 1419 # endif // Cocoa 1385 1420 } 1386 1421 break; 1387 # endif // Cocoa 1388 #endif 1422 #endif // Q_WS_MAC 1389 1423 #if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR) 1390 1424 case QEvent::CursorChange: … … 1395 1429 break; 1396 1430 #endif 1397 1398 1431 default: 1399 1432 break; … … 1412 1445 This property is false by default and only has any effect on Mac OS X 10.4 or higher. 1413 1446 1414 If set to true, then the top toolbar area is replaced with a Carbon 1415 HIToolbar and all toolbars in the top toolbar area are moved to that. Any1416 toolbars added afterwards will also be added to the Carbon HIToolbar. This1417 m eans a couple of things.1447 If set to true, then the top toolbar area is replaced with a Carbon HIToolbar 1448 or a Cocoa NSToolbar (depending on whether Qt was built with Carbon or Cocoa). 1449 All toolbars in the top toolbar area and any toolbars added afterwards are 1450 moved to that. This means a couple of things. 1418 1451 1419 1452 \list … … 1423 1456 \i Any custom widgets in the toolbar will not be shown if the toolbar 1424 1457 becomes too small (only actions will be shown) 1425 \i If you call showFullScreen() on the main window, the QToolbar will 1426 disappear since it is considered to be part of the title bar. You can 1427 work around this by turning off the unified toolbar before you call 1458 \i Before Qt 4.5, if you called showFullScreen() on the main window, the QToolbar would 1459 disappear since it is considered to be part of the title bar. Qt 4.5 and up will now work around this by pulling 1460 the toolbars out and back into the regular toolbar and vice versa when you swap out. 1461 However, a good practice would be that turning off the unified toolbar before you call 1428 1462 showFullScreen() and restoring it after you call showNormal(). 1429 1463 \endlist
Note:
See TracChangeset
for help on using the changeset viewer.