summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-04-07 13:13:08 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-04-07 13:14:27 (GMT)
commit7c8980ee041e874a6c430f01b2daff4955517b03 (patch)
treeaa19249a7fb469176fb22adfa9a1b702ae3be6c0 /src/gui/kernel
parent8031eada2f81963865390b4d899631b09d4ca6f3 (diff)
parenta05f73499a187c67a394893e2cc74516ccbc46f5 (diff)
downloadQt-7c8980ee041e874a6c430f01b2daff4955517b03.zip
Qt-7c8980ee041e874a6c430f01b2daff4955517b03.tar.gz
Qt-7c8980ee041e874a6c430f01b2daff4955517b03.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/gui/text/qfontengine_mac.mm tests/auto/qdiriterator/tst_qdiriterator.cpp
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp90
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget.cpp3
-rw-r--r--src/gui/kernel/qwidget_mac.mm23
-rw-r--r--src/gui/kernel/qwidget_s60.cpp33
5 files changed, 76 insertions, 74 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 769b136..0688061 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -142,6 +142,60 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo
// Ensure that control rectangle is updated
static_cast<QSymbianControl *>(QApplication::activeWindow()->winId())->handleClientAreaChange();
}
+
+bool QS60Data::setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState)
+{
+ // Show statusbar:
+ // Topmost parent: Show unless fullscreen/minimized.
+ // Child windows: Follow topmost parent, unless fullscreen, in which case do not show statusbar
+ // Show CBA:
+ // Topmost parent: Show unless fullscreen/minimized.
+ // Exception: Show if fullscreen with Qt::WindowSoftkeysVisibleHint.
+ // Child windows:
+ // Minimized: Unclear if there is an use case for having focused minimized window at all.
+ // Always follow topmost parent just to be safe.
+ // Maximized and normal: follow topmost parent.
+ // Exception: If topmost parent is not showing CBA, show CBA if any softkey actions are
+ // defined.
+ // Fullscreen: Show only if Qt::WindowSoftkeysVisibleHint set.
+
+ Qt::WindowStates comparisonState = newState;
+ QWidget *parentWindow = window->parentWidget();
+ if (parentWindow) {
+ while (parentWindow->parentWidget())
+ parentWindow = parentWindow->parentWidget();
+ comparisonState = parentWindow->windowState();
+ } else {
+ parentWindow = window;
+ }
+
+ bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized));
+ const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen;
+ const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
+ bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
+
+ // Do extra checking for child windows
+ if (window->parentWidget()) {
+ if (newState & Qt::WindowFullScreen) {
+ decorationsVisible = false;
+ if (window->windowFlags() & Qt::WindowSoftkeysVisibleHint)
+ buttonGroupVisibility = true;
+ else
+ buttonGroupVisibility = false;
+ } else if (!(newState & Qt::WindowMinimized) && !buttonGroupVisibility) {
+ for (int i = 0; i < window->actions().size(); ++i) {
+ if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
+ buttonGroupVisibility = true;
+ break;
+ }
+ }
+ }
+ }
+
+ S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility);
+
+ return decorationsVisible;
+}
#endif
void QS60Data::controlVisibilityChanged(CCoeControl *control, bool visible)
@@ -1271,37 +1325,8 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
qwidget->d_func()->setWindowIcon_sys(true);
qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle());
#ifdef Q_WS_S60
- if (qwidget->isWindow()) {
- QWidget *const window = qwidget->window();
- QWidget *parentWindow = window->parentWidget();
- if (parentWindow) {
- while (parentWindow->parentWidget())
- parentWindow = parentWindow->parentWidget();
- } else {
- parentWindow = window;
- }
-
- const bool parentDecorationsVisible = !(parentWindow->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool parentIsFullscreen = parentWindow->windowState() & Qt::WindowFullScreen;
- const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- bool buttonGroupVisibility = (parentDecorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
-
- // For non-toplevel normal and maximized windows, show cba if window has softkey
- // actions even if topmost parent is not showing cba. Do the same for fullscreen
- // windows that request it.
- if (!buttonGroupVisibility
- && window->parentWidget()
- && !(window->windowState() & Qt::WindowMinimized)
- && ((window->windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(window->windowState() & Qt::WindowFullScreen))) {
- for (int i = 0; i < window->actions().size(); ++i) {
- if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
- buttonGroupVisibility = true;
- break;
- }
- }
- }
- S60->setStatusPaneAndButtonGroupVisibility(parentDecorationsVisible, buttonGroupVisibility);
- }
+ if (qwidget->isWindow())
+ S60->setRecursiveDecorationsVisibility(qwidget, qwidget->windowState());
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
bool focusedControlFound = false;
@@ -2182,7 +2207,8 @@ int QApplicationPrivate::symbianProcessWsEvent(const QSymbianEvent *symbianEvent
}
#endif
#ifdef QT_SOFTKEYS_ENABLED
- QSoftKeyManager::updateSoftKeys();
+ if (!CEikonEnv::Static()->EikAppUi()->IsDisplayingMenuOrDialog())
+ QSoftKeyManager::updateSoftKeys();
#endif
break;
case EEventFocusLost:
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index 102c0ca..ee0b862 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -178,6 +178,7 @@ public:
static inline CEikButtonGroupContainer* buttonGroupContainer();
static inline void setButtonGroupContainer(CEikButtonGroupContainer* newCba);
static void setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, bool buttonGroupVisible);
+ static bool setRecursiveDecorationsVisibility(QWidget *window, Qt::WindowStates newState);
#endif
static void controlVisibilityChanged(CCoeControl *control, bool visible);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 3cc3e65..5705214 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -612,8 +612,7 @@ void QWidget::setAutoFillBackground(bool enabled)
\brief The QWidget class is the base class of all user interface objects.
\ingroup basicwidgets
-
-
+
The widget is the atom of the user interface: it receives mouse, keyboard
and other events from the window system, and paints a representation of
itself on the screen. Every widget is rectangular, and they are sorted in a
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 34918e4..4c205c8 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2851,9 +2851,12 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
{
// This will set/remove a visual relationship between parent and child on screen.
// The reason for doing this is to ensure that a child always stacks infront of
- // its parent. Unfortunatly is turns out that [NSWindow addChildWindow] has
+ // its parent (expecially if both windows are modal, and the child blocks input to
+ // the parent while at the same time hiding behind it). Unfortunatly is turns out
+ // that [NSWindow addChildWindow] has
// several unwanted side-effects, one of them being the moving of a child when
- // moving the parent, which we choose to accept. A way tougher side-effect is
+ // moving the parent, which we choose to accept (if this is unacceptable, consider
+ // using Qt::WA_MacNoCocoaChildWindow). A way tougher side-effect is
// that Cocoa will hide the parent if you hide the child. And in the case of
// a tool window, since it will normally hide when you deactivate the
// application, Cocoa will hide the parent upon deactivate as well. The result often
@@ -2876,12 +2879,14 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
if (QWidget *parent = q->parentWidget()) {
if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) {
if (set) {
- Qt::WindowType ptype = parent->window()->windowType();
- if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) {
- NSInteger level = [qwin level];
- [pwin addChildWindow:qwin ordered:NSWindowAbove];
- if ([qwin level] < level)
- [qwin setLevel:level];
+ if (!q->testAttribute(Qt::WA_MacNoCocoaChildWindow)) {
+ Qt::WindowType ptype = parent->window()->windowType();
+ if ([pwin isVisible] && (ptype == Qt::Window || ptype == Qt::Dialog) && ![qwin parentWindow]) {
+ NSInteger level = [qwin level];
+ [pwin addChildWindow:qwin ordered:NSWindowAbove];
+ if ([qwin level] < level)
+ [qwin setLevel:level];
+ }
}
} else {
[pwin removeChildWindow:qwin];
@@ -2895,6 +2900,8 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
if (child && child->isWindow()) {
if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) {
if (set) {
+ if (child->testAttribute(Qt::WA_MacNoCocoaChildWindow))
+ continue;
Qt::WindowType ctype = child->window()->windowType();
if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) {
NSInteger level = [cwin level];
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index c74c7eb..83e46e5 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -1210,41 +1210,10 @@ void QWidget::setWindowState(Qt::WindowStates newstate)
}
#ifdef Q_WS_S60
- // Hide window decoration when switching to fullscreen / minimized otherwise show decoration.
// The window decoration visibility has to be changed before doing actual window state
// change since in that order the availableGeometry will return directly the right size and
// we will avoid unnecessary redraws
- Qt::WindowStates comparisonState = newstate;
- QWidget *parentWindow = parentWidget();
- if (parentWindow) {
- while (parentWindow->parentWidget())
- parentWindow = parentWindow->parentWidget();
- comparisonState = parentWindow->windowState();
- } else {
- parentWindow = this;
- }
-
- const bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized));
- const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen;
- const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint;
- bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint));
-
- // For non-toplevel normal and maximized windows, show cba if window has softkey
- // actions even if topmost parent is not showing cba. Do the same for fullscreen
- // windows that request it.
- if (!buttonGroupVisibility
- && parentWidget()
- && !(newstate & Qt::WindowMinimized)
- && ((windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(newstate & Qt::WindowFullScreen))) {
- for (int i = 0; i < actions().size(); ++i) {
- if (actions().at(i)->softKeyRole() != QAction::NoSoftKey) {
- buttonGroupVisibility = true;
- break;
- }
- }
- }
- S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility);
-
+ bool decorationsVisible = S60->setRecursiveDecorationsVisibility(this, newstate);
#endif // Q_WS_S60
// Ensure the initial size is valid, since we store it as normalGeometry below.