Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/widgets/qmainwindow.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
     
    6666QT_END_NAMESPACE
    6767#endif
     68#ifdef QT_SOFTKEYS_ENABLED
     69#include <private/qsoftkeymanager_p.h>
     70#endif
    6871
    6972QT_BEGIN_NAMESPACE
     
    7477public:
    7578    inline QMainWindowPrivate()
    76         : layout(0), toolButtonStyle(Qt::ToolButtonIconOnly)
     79        : layout(0), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly)
    7780#ifdef Q_WS_MAC
    7881            , useHIToolBar(false)
     82#endif
     83#ifdef QT_SOFTKEYS_ENABLED
     84            , menuBarAction(0)
    7985#endif
    8086#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
     
    8995    bool useHIToolBar;
    9096#endif
     97#ifdef QT_SOFTKEYS_ENABLED
     98    QAction *menuBarAction;
     99#endif
    91100    void init();
    92101    QList<int> hoverSeparator;
     
    108117    const int metric = q->style()->pixelMetric(QStyle::PM_ToolBarIconSize, 0, q);
    109118    iconSize = QSize(metric, metric);
    110     explicitIconSize = false;
    111 
    112119    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
    113125}
    114126
     
    149161    \brief The QMainWindow class provides a main application
    150162           window.
    151     \ingroup application
    152     \mainclass
     163    \ingroup mainwindow-classes
     164
    153165
    154166    \tableofcontents
     
    481493        oldMenuBar->deleteLater();
    482494    }
    483 #ifdef Q_OS_WINCE
    484     if (menuBar && menuBar->size().height() > 0)
    485 #endif
    486495    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
    487503}
    488504
     
    919935
    920936#ifndef QT_NO_TABBAR
    921 /*! 
     937/*!
    922938    \property QMainWindow::documentMode
    923939    \brief whether the tab bar for tabbed dockwidgets is set to document mode.
     
    940956
    941957#ifndef QT_NO_TABWIDGET
    942 /*! 
     958/*!
    943959    \property QMainWindow::tabShape
    944960    \brief the tab shape used for tabbed dock widgets.
     
    10331049    to restoreState(). Returns true if the state was restored; otherwise
    10341050    returns false.
     1051
     1052    \sa restoreState(), saveState()
    10351053*/
    10361054
     
    11641182    number to restoreState().
    11651183
     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
    11661189    \sa restoreState(), QWidget::saveGeometry(), QWidget::restoreGeometry()
    11671190*/
     
    11831206    is restored, and this function returns \c true.
    11841207
    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()
    11861215*/
    11871216bool QMainWindow::restoreState(const QByteArray &state, int version)
     
    13731402        case QEvent::Show:
    13741403            if (unifiedTitleAndToolBarOnMac())
    1375                 macWindowToolbarShow(this, true);
     1404                d->layout->syncUnifiedToolbarVisibility();
     1405            d->layout->blockVisiblityCheck = false;
    13761406            break;
    1377 #  ifdef QT_MAC_USE_COCOA
    13781407       case QEvent::WindowStateChange:
    13791408            {
     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
    13801414                // We need to update the HIToolbar status when we go out of or into fullscreen.
    13811415                QWindowStateChangeEvent *wce = static_cast<QWindowStateChangeEvent *>(event);
     
    13831417                    d->layout->updateHIToolBarStatus();
    13841418                }
     1419#  endif // Cocoa
    13851420            }
    13861421            break;
    1387 #  endif // Cocoa
    1388 #endif
     1422#endif // Q_WS_MAC
    13891423#if !defined(QT_NO_DOCKWIDGET) && !defined(QT_NO_CURSOR)
    13901424       case QEvent::CursorChange:
     
    13951429           break;
    13961430#endif
    1397 
    13981431        default:
    13991432            break;
     
    14121445    This property is false by default and only has any effect on Mac OS X 10.4 or higher.
    14131446
    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. Any
    1416     toolbars added afterwards will also be added to the Carbon HIToolbar. This
    1417     means 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.
    14181451
    14191452    \list
     
    14231456    \i Any custom widgets in the toolbar will not be shown if the toolbar
    14241457        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
    14281462        showFullScreen() and restoring it after you call showNormal().
    14291463    \endlist
Note: See TracChangeset for help on using the changeset viewer.