summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-08 19:13:07 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-08 19:13:07 (GMT)
commit622f3c791b979864ad540e3c4c92b78b226edc08 (patch)
treee4a5a16b659caeea8cf0355dbc39c99f9a4a4381 /src
parent02fcd5e346da13cbb65523de2348880cf7d7a073 (diff)
parentf6f2d03b2d74b236d33a5ca32a49f138bf521c13 (diff)
downloadQt-622f3c791b979864ad540e3c4c92b78b226edc08.zip
Qt-622f3c791b979864ad540e3c4c92b78b226edc08.tar.gz
Qt-622f3c791b979864ad540e3c4c92b78b226edc08.tar.bz2
Merge branch 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-master-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: Cocoa: p1 bug fix: fix auto test regressions Ensure shared network session deleted from correct thread Revert "Remove SIGBUS emission from QNetworkSession destruction." Image w/ PreserveAspectFit has its width changed once more than needed. Cocoa: p1 bug fix: revert use of subWindowStacking
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/global/qnamespace.qdoc8
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp20
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp12
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h14
-rw-r--r--src/gui/kernel/qwidget_mac.mm35
-rw-r--r--src/network/bearer/qnetworksession.cpp2
-rw-r--r--src/network/bearer/qsharednetworksession.cpp7
8 files changed, 63 insertions, 36 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 8a3a04d..f015ed0 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -525,7 +525,6 @@ public:
#endif
WA_X11DoNotAcceptFocus = 132,
- WA_MacNoCocoaChildWindow = 133,
WA_MacNoShadow = 133,
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 903e57e..07a9503 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -929,14 +929,6 @@
the brushed metal style as supported by the windowing system. This
attribute is only applicable to Mac OS X.
- \value WA_MacNoCocoaChildWindow Indicates the widget should not be added
- as a Cocoa child window of it's parent window. This will free the window
- from being moved around together with the parent. However, this
- will also allow it to stack/hide behind it's parent (if they are on
- the same window level, e.g both windows are dialogs). This can cause problems if
- both windows are modal, as the child can then block input to the parent
- while hiding behind it. This attribute is only applicable to Mac OS X.
-
\omitvalue WA_MacMetalStyle
\value WA_Mapped Indicates that the widget is mapped on screen.
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index a62d3d2..b776532 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -136,12 +136,10 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap)
Q_Q(QDeclarativeImage);
pix.setPixmap(pixmap);
- q->setImplicitWidth(pix.width());
- q->setImplicitHeight(pix.height());
+ q->pixmapChange();
status = pix.isNull() ? QDeclarativeImageBase::Null : QDeclarativeImageBase::Ready;
q->update();
- q->pixmapChange();
}
/*!
@@ -390,8 +388,11 @@ void QDeclarativeImage::updatePaintedGeometry()
Q_D(QDeclarativeImage);
if (d->fillMode == PreserveAspectFit) {
- if (!d->pix.width() || !d->pix.height())
+ if (!d->pix.width() || !d->pix.height()) {
+ setImplicitWidth(0);
+ setImplicitHeight(0);
return;
+ }
qreal w = widthValid() ? width() : d->pix.width();
qreal widthScale = w / qreal(d->pix.width());
qreal h = heightValid() ? height() : d->pix.height();
@@ -405,9 +406,13 @@ void QDeclarativeImage::updatePaintedGeometry()
}
if (widthValid() && !heightValid()) {
setImplicitHeight(d->paintedHeight);
+ } else {
+ setImplicitHeight(d->pix.height());
}
if (heightValid() && !widthValid()) {
setImplicitWidth(d->paintedWidth);
+ } else {
+ setImplicitWidth(d->pix.width());
}
} else if (d->fillMode == PreserveAspectCrop) {
if (!d->pix.width() || !d->pix.height())
@@ -566,6 +571,13 @@ void QDeclarativeImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWi
void QDeclarativeImage::pixmapChange()
{
+ Q_D(QDeclarativeImage);
+ // PreserveAspectFit calculates the implicit size differently so we
+ // don't call our superclass pixmapChange(), since that would
+ // result in the implicit size being set incorrectly, then updated
+ // in updatePaintedGeometry()
+ if (d->fillMode != PreserveAspectFit)
+ QDeclarativeImageBase::pixmapChange();
updatePaintedGeometry();
}
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index daebac4..81eac78 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -191,11 +191,9 @@ void QDeclarativeImageBase::load()
d->pix.clear(this);
d->status = Null;
d->progress = 0.0;
- setImplicitWidth(0);
- setImplicitHeight(0);
+ pixmapChange();
emit progressChanged(d->progress);
emit statusChanged(d->status);
- pixmapChange();
update();
} else {
QDeclarativePixmap::Options options;
@@ -246,8 +244,7 @@ void QDeclarativeImageBase::requestFinished()
d->progress = 1.0;
- setImplicitWidth(d->pix.width());
- setImplicitHeight(d->pix.height());
+ pixmapChange();
if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height())
emit sourceSizeChanged();
@@ -256,7 +253,7 @@ void QDeclarativeImageBase::requestFinished()
emit statusChanged(d->status);
if (d->progress != oldProgress)
emit progressChanged(d->progress);
- pixmapChange();
+
update();
}
@@ -279,6 +276,9 @@ void QDeclarativeImageBase::componentComplete()
void QDeclarativeImageBase::pixmapChange()
{
+ Q_D(QDeclarativeImageBase);
+ setImplicitWidth(d->pix.width());
+ setImplicitHeight(d->pix.height());
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 7d41f3d..ee1115b 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -146,6 +146,20 @@ QT_END_NAMESPACE
[NSApp terminate:sender];
}
+- (void)setLevel:(NSInteger)windowLevel
+{
+ // Cocoa will upon activating/deactivating applications level modal
+ // windows up and down, regardsless of any explicit set window level.
+ // To ensure that modal stays-on-top dialogs actually stays on top after
+ // the application is activated (and therefore stacks in front of
+ // other stays-on-top windows), we need to add this little special-case override:
+ QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
+ if (widget && widget->isModal() && (widget->windowFlags() & Qt::WindowStaysOnTopHint))
+ [super setLevel:NSPopUpMenuWindowLevel];
+ else
+ [super setLevel:windowLevel];
+}
+
- (void)sendEvent:(NSEvent *)event
{
[self retain];
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 4c205c8..f5a9e27 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -2849,14 +2849,16 @@ void QWidgetPrivate::transferChildren()
#ifdef QT_MAC_USE_COCOA
void QWidgetPrivate::setSubWindowStacking(bool set)
{
+ // After hitting too many unforeseen bugs trying to put Qt on top of the cocoa child
+ // window API, we have decided to revert this behaviour as much as we can. We
+ // therefore now only allow child windows to exist for children of modal dialogs.
+ static bool use_behaviour_qt473 = !qgetenv("QT_MAC_USE_CHILDWINDOWS").isEmpty();
+
// 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 (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
+ // its parent. 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 (if this is unacceptable, consider
- // using Qt::WA_MacNoCocoaChildWindow). A way tougher side-effect is
+ // moving the parent, which we choose to accept. 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
@@ -2879,14 +2881,15 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
if (QWidget *parent = q->parentWidget()) {
if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) {
if (set) {
- 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];
- }
+ Qt::WindowType ptype = parent->window()->windowType();
+ if ([pwin isVisible]
+ && (ptype == Qt::Window || ptype == Qt::Dialog)
+ && ![qwin parentWindow]
+ && (!use_behaviour_qt473 && parent->windowModality() == Qt::ApplicationModal)) {
+ NSInteger level = [qwin level];
+ [pwin addChildWindow:qwin ordered:NSWindowAbove];
+ if ([qwin level] < level)
+ [qwin setLevel:level];
}
} else {
[pwin removeChildWindow:qwin];
@@ -2894,14 +2897,16 @@ void QWidgetPrivate::setSubWindowStacking(bool set)
}
}
+ // Only set-up child windows for q if q is modal:
+ if (set && !use_behaviour_qt473 && q->windowModality() != Qt::ApplicationModal)
+ return;
+
QObjectList widgets = q->children();
for (int i=0; i<widgets.size(); ++i) {
QWidget *child = qobject_cast<QWidget *>(widgets.at(i));
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/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
index 00ca65c..af60a43 100644
--- a/src/network/bearer/qnetworksession.cpp
+++ b/src/network/bearer/qnetworksession.cpp
@@ -260,7 +260,7 @@ QNetworkSession::QNetworkSession(const QNetworkConfiguration &connectionConfig,
*/
QNetworkSession::~QNetworkSession()
{
- d->deleteLater();
+ delete d;
}
/*!
diff --git a/src/network/bearer/qsharednetworksession.cpp b/src/network/bearer/qsharednetworksession.cpp
index 28ca173..fcb0128 100644
--- a/src/network/bearer/qsharednetworksession.cpp
+++ b/src/network/bearer/qsharednetworksession.cpp
@@ -59,6 +59,11 @@ inline QSharedNetworkSessionManager* sharedNetworkSessionManager()
return rv;
}
+static void doDeleteLater(QObject* obj)
+{
+ obj->deleteLater();
+}
+
QSharedPointer<QNetworkSession> QSharedNetworkSessionManager::getSession(QNetworkConfiguration config)
{
QSharedNetworkSessionManager *m(sharedNetworkSessionManager());
@@ -69,7 +74,7 @@ QSharedPointer<QNetworkSession> QSharedNetworkSessionManager::getSession(QNetwor
return p;
}
//otherwise make one
- QSharedPointer<QNetworkSession> session(new QNetworkSession(config));
+ QSharedPointer<QNetworkSession> session(new QNetworkSession(config), doDeleteLater);
m->sessions[config] = session;
return session;
}