diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-04-12 12:23:40 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-04-12 12:23:40 (GMT) |
commit | 0f790634c57400f4ddffd36f5e3443c712d1a1c3 (patch) | |
tree | 2b9f01a1798c5700f3c82e72a3db97dac6a625d5 /src/gui/kernel | |
parent | 67e8e5baeec38d592596f259894e6dda420728ea (diff) | |
parent | 119d7dddc8da189ccd1cbc55ed3292f311c30e0c (diff) | |
download | Qt-0f790634c57400f4ddffd36f5e3443c712d1a1c3.zip Qt-0f790634c57400f4ddffd36f5e3443c712d1a1c3.tar.gz Qt-0f790634c57400f4ddffd36f5e3443c712d1a1c3.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qeventdispatcher_mac.mm | 9 | ||||
-rw-r--r-- | src/gui/kernel/qgridlayout.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qlayoutitem.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_common_p.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qsoftkeymanager_s60.cpp | 13 | ||||
-rw-r--r-- | src/gui/kernel/qstackedlayout.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qstackedlayout.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_p.h | 1 |
12 files changed, 64 insertions, 19 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index be2683d..b0a23d4 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5292,9 +5292,9 @@ QInputContext *QApplication::inputContext() const QApplication *that = const_cast<QApplication *>(this); const QStringList keys = QInputContextFactory::keys(); // Try hbim and coefep first, then try others. - if (keys.contains("hbim")) { + if (keys.contains(QLatin1String("hbim"))) { that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("hbim"), that); - } else if (keys.contains("coefep")) { + } else if (keys.contains(QLatin1String("coefep"))) { that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("coefep"), that); } else { for (int c = 0; c < keys.size() && !d->inputContext; ++c) { diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm index 62e1e81..a7f1224 100644 --- a/src/gui/kernel/qeventdispatcher_mac.mm +++ b/src/gui/kernel/qeventdispatcher_mac.mm @@ -831,7 +831,14 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession() QBoolBlocker block1(blockSendPostedEvents, true); info.nswindow = window; [(NSWindow*) info.nswindow retain]; - info.session = [NSApp beginModalSessionForWindow:window]; + // When creating a modal session cocoa will rearrange the windows. + // In order to avoid windows to be put behind another we need to + // keep the window level. + { + int level = [window level]; + info.session = [NSApp beginModalSessionForWindow:window]; + [window setLevel:level]; + } } currentModalSessionCached = info.session; } diff --git a/src/gui/kernel/qgridlayout.cpp b/src/gui/kernel/qgridlayout.cpp index dbd3c01..81a4d04 100644 --- a/src/gui/kernel/qgridlayout.cpp +++ b/src/gui/kernel/qgridlayout.cpp @@ -1852,7 +1852,7 @@ void QGridLayout::invalidate() /*! \fn int QGridLayout::colSpacing(int col) const - Use columnSpacing() instead. + Use columnMinimumWidth() instead. */ /*! diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp index 6a91d95..e615b2d 100644 --- a/src/gui/kernel/qlayoutitem.cpp +++ b/src/gui/kernel/qlayoutitem.cpp @@ -516,9 +516,7 @@ bool QWidgetItem::hasHeightForWidth() const { if (isEmpty()) return false; - if (wid->layout()) - return wid->layout()->hasHeightForWidth(); - return wid->sizePolicy().hasHeightForWidth(); + return wid->hasHeightForWidth(); } /*! diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 923144a..23f1481 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -242,6 +242,7 @@ bool QSoftKeyManager::handleUpdateSoftKeys() d->requestedSoftKeyActions.clear(); bool recursiveMerging = false; QWidget *source = softkeySource(NULL, recursiveMerging); + d->initialSoftKeySource = source; while (source) { if (appendSoftkeys(*source, level)) ++level; diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h index 460d0dc..04ddf7d 100644 --- a/src/gui/kernel/qsoftkeymanager_common_p.h +++ b/src/gui/kernel/qsoftkeymanager_common_p.h @@ -70,6 +70,7 @@ protected: static QSoftKeyManager *self; QHash<QAction*, Qt::Key> keyedActions; QMultiHash<int, QAction*> requestedSoftKeyActions; + QWidget *initialSoftKeySource; }; @@ -79,4 +80,4 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QSOFTKEYMANAGER_COMMON_P_H
\ No newline at end of file +#endif // QSOFTKEYMANAGER_COMMON_P_H diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index 9812d72..7d643c2 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -312,17 +312,8 @@ bool QSoftKeyManagerPrivateS60::setMiddleSoftkey(CEikButtonGroupContainer &cba) bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba) { if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) { - Qt::WindowType windowType = Qt::Window; - QAction *action = requestedSoftKeyActions.value(0); - if (action) { - QWidget *actionParent = action->parentWidget(); - Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!"); - - QWidget *actionWindow = actionParent->window(); - Q_ASSERT_X(actionWindow, Q_FUNC_INFO, "Softkey action does not have window!"); - windowType = actionWindow->windowType(); - } - + const Qt::WindowType windowType = initialSoftKeySource + ? initialSoftKeySource->window()->windowType() : Qt::Window; if (windowType != Qt::Dialog && windowType != Qt::Popup) { QString text(QSoftKeyManager::tr("Exit")); TPtrC nativeText = qt_QString2TPtrC(text); diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/gui/kernel/qstackedlayout.cpp index 7559066..4b49638 100644 --- a/src/gui/kernel/qstackedlayout.cpp +++ b/src/gui/kernel/qstackedlayout.cpp @@ -475,6 +475,32 @@ void QStackedLayout::setGeometry(const QRect &rect) } } +bool QStackedLayout::hasHeightForWidth() const +{ + const int n = count(); + + for (int i = 0; i < n; ++i) { + if (QLayoutItem *item = itemAt(i)) { + if (item->hasHeightForWidth()) + return true; + } + } + return false; +} + +int QStackedLayout::heightForWidth(int width) const +{ + const int n = count(); + + int hfw = 0; + for (int i = 0; i < n; ++i) { + if (QLayoutItem *item = itemAt(i)) { + hfw = qMax(hfw, item->heightForWidth(width)); + } + } + return hfw; +} + /*! \enum QStackedLayout::StackingMode \since 4.4 diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h index c069149..842b62b 100644 --- a/src/gui/kernel/qstackedlayout.h +++ b/src/gui/kernel/qstackedlayout.h @@ -95,6 +95,8 @@ public: QLayoutItem *itemAt(int) const; QLayoutItem *takeAt(int); void setGeometry(const QRect &rect); + bool hasHeightForWidth() const; + int heightForWidth(int width) const; Q_SIGNALS: void widgetRemoved(int index); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index e88026c..7a8b700 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -3816,6 +3816,11 @@ void QWidget::setMaximumSize(int maxw, int maxh) d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh); } +bool QWidgetPrivate::hasHeightForWidth() const +{ + return layout ? layout->hasHeightForWidth() : size_policy.hasHeightForWidth(); +} + /*! \overload @@ -7961,6 +7966,18 @@ QSize QWidget::minimumSizeHint() const return QSize(-1, -1); } +/*! + \internal + This is a bit hackish, but ideally this would have been a virtual + function so that subclasses could reimplement their own function. + Instead we add a virtual function to QWidgetPrivate. +*/ +bool QWidget::hasHeightForWidth() const +{ + Q_D(const QWidget); + return d->hasHeightForWidth(); +} + /*! \fn QWidget *QWidget::parentWidget() const diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h index e12148b..6e5de7d 100644 --- a/src/gui/kernel/qwidget.h +++ b/src/gui/kernel/qwidget.h @@ -524,6 +524,7 @@ public: virtual QSize sizeHint() const; virtual QSize minimumSizeHint() const; + bool hasHeightForWidth() const; QSizePolicy sizePolicy() const; void setSizePolicy(QSizePolicy); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 89ea256..05a859c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -493,6 +493,7 @@ public: bool setMinimumSize_helper(int &minw, int &minh); bool setMaximumSize_helper(int &maxw, int &maxh); + virtual bool hasHeightForWidth() const; void setConstraints_sys(); QWidget *childAt_helper(const QPoint &, bool) const; void updateGeometry_helper(bool forceUpdate); |