diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2011-02-08 11:57:34 +0100 |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2011-02-08 11:57:34 +0100 |
commit | eb7958c65b09569c2531d2c443a6d0fe0b507d97 (patch) | |
tree | 91544e4a4cf5c65b3acec7c219ebe63176a14994 /src/gui/widgets | |
parent | ef998bca70a799806c5754edfa49ea625881bc3e (diff) | |
parent | 44298c848ac254fe1942eb32eed7651dec5bf0e3 (diff) | |
download | qt4-tools-eb7958c65b09569c2531d2c443a6d0fe0b507d97.tar.gz |
Merge branch 'master-upstream'
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/qcocoamenu_mac.mm | 1 | ||||
-rw-r--r-- | src/gui/widgets/qcombobox.cpp | 16 | ||||
-rw-r--r-- | src/gui/widgets/qfocusframe.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindow.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/qmainwindowlayout_mac.mm | 25 | ||||
-rw-r--r-- | src/gui/widgets/qmenubar.cpp | 5 |
6 files changed, 40 insertions, 15 deletions
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm index d5c8eb89d2..dff37b49ad 100644 --- a/src/gui/widgets/qcocoamenu_mac.mm +++ b/src/gui/widgets/qcocoamenu_mac.mm @@ -48,6 +48,7 @@ #include <private/qt_cocoa_helpers_mac_p.h> #include <private/qapplication_p.h> #include <private/qaction_p.h> +#include <private/qcocoaapplication_mac_p.h> #include <QtGui/QMenu> diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp index 79461377f4..b5dda5a754 100644 --- a/src/gui/widgets/qcombobox.cpp +++ b/src/gui/widgets/qcombobox.cpp @@ -2486,10 +2486,18 @@ void QComboBox::showPopup() listRect.setWidth(listRect.height()); //by default popup is centered on screen in landscape listRect.moveCenter(screen.center()); - if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) { - // landscape without stacon, menu should be at the right - (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) : - listRect.setLeft(screen.left()); + if (staConTopRect.IsEmpty()) { + TRect cbaRect = TRect(); + AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EControlPane, cbaRect); + AknLayoutUtils::TAknCbaLocation cbaLocation = AknLayoutUtils::CbaLocation(); + switch (cbaLocation) { + case AknLayoutUtils::EAknCbaLocationRight: + listRect.setRight(screen.right()); + break; + case AknLayoutUtils::EAknCbaLocationLeft: + listRect.setLeft(screen.left()); + break; + } } } #endif diff --git a/src/gui/widgets/qfocusframe.cpp b/src/gui/widgets/qfocusframe.cpp index c159a1e0c8..6508c31b50 100644 --- a/src/gui/widgets/qfocusframe.cpp +++ b/src/gui/widgets/qfocusframe.cpp @@ -85,6 +85,9 @@ void QFocusFramePrivate::update() void QFocusFramePrivate::updateSize() { Q_Q(QFocusFrame); + if (!widget) + return; + int vmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameVMargin), hmargin = q->style()->pixelMetric(QStyle::PM_FocusFrameHMargin); QPoint pos(widget->x(), widget->y()); diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index a786e2f309..fd6178386f 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1516,11 +1516,6 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) if (!isWindow() || d->useHIToolBar == set || QSysInfo::MacintoshVersion < QSysInfo::MV_10_3) return; - // ### Disable when using alien widgets - if (testAttribute(Qt::WA_NativeWindow) == false) { - return; - } - d->useHIToolBar = set; createWinId(); // We need the hiview for down below. diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index 9a23ca76c2..e428ffcde0 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -355,7 +355,11 @@ void QMainWindowLayout::updateHIToolBarStatus() // Move everything out of the HIToolbar into the main toolbar. while (!qtoolbarsInUnifiedToolbarList.isEmpty()) { // Should shrink the list by one every time. - layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, qtoolbarsInUnifiedToolbarList.first()); + QToolBar *toolbar = qtoolbarsInUnifiedToolbarList.first(); + layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, toolbar); +#if defined(QT_MAC_USE_COCOA) + toolbar->d_func()->isInUnifiedToolbar = false; +#endif } macWindowToolbarSet(qt_mac_window_for(layoutState.mainWindow), 0); } else { @@ -363,7 +367,8 @@ void QMainWindowLayout::updateHIToolBarStatus() for (int i = 0; i < toolbars.size(); ++i) { QToolBar *toolbar = toolbars.at(i); if (toolBarArea(toolbar) == Qt::TopToolBarArea) { - removeWidget(toolbar); // Do this here, because we are in an in-between state. + // Do this here, because we are in an in-between state. + removeWidget(toolbar); layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, toolbar); } } @@ -387,10 +392,20 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar if (toolbar == 0) return; +#if defined(QT_MAC_USE_COCOA) + // toolbar will now become native (if not allready) since we need + // an nsview for it inside the corresponding NSToolbarItem. + // Setting isInUnifiedToolbar will (among other things) stop alien + // siblings from becoming native when this happends since the toolbar + // will not overlap with other children of the QMainWindow. NB: Switching + // unified toolbar off after this stage is not supported, as this means + // that either the menubar must be alien again, or the sibling must + // be backed by an nsview to protect from overlapping issues: + toolbar->d_func()->isInUnifiedToolbar = true; +#endif QToolBarLayout *toolbarLayout = static_cast<QToolBarLayout *>(toolbar->layout()); - toolbarSaveState.insert(toolbar, ToolBarSaveState(toolbar->isMovable(), - toolbar->maximumSize())); + toolbarSaveState.insert(toolbar, ToolBarSaveState(toolbar->isMovable(), toolbar->maximumSize())); if (toolbarLayout->hasExpandFlag() == false) toolbar->setMaximumSize(toolbar->sizeHint()); @@ -399,8 +414,8 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar toolbarLayout->setUsePopupMenu(true); // Make the toolbar a child of the mainwindow to avoid creating a window. toolbar->setParent(layoutState.mainWindow); - toolbar->createWinId(); // Now create the OSViewRef. + toolbar->winId(); // Now create the OSViewRef. layoutState.mainWindow->createWinId(); OSWindowRef window = qt_mac_window_for(layoutState.mainWindow); diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index dda5abacc7..5bfac9a646 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -1073,8 +1073,11 @@ void QMenuBar::paintEvent(QPaintEvent *e) void QMenuBar::setVisible(bool visible) { #if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60) - if (isNativeMenuBar()) + if (isNativeMenuBar()) { + if (!visible) + QWidget::setVisible(false); return; + } #endif QWidget::setVisible(visible); } |