summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qwidget.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-05-17 23:11:22 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-05-17 23:11:22 (GMT)
commit2c07b5d2cba8d8e499bd0861eefef12d4e00d99a (patch)
tree3e6b31daecfe217b355fa973f2f122da8468c0ac /src/gui/kernel/qwidget.cpp
parentcb2980a09aefcc207eacb500d5a3c74f064859dd (diff)
parent3773fcb78db02a2577c89f755c07c2c7dbf0de74 (diff)
downloadQt-2c07b5d2cba8d8e499bd0861eefef12d4e00d99a.zip
Qt-2c07b5d2cba8d8e499bd0861eefef12d4e00d99a.tar.gz
Qt-2c07b5d2cba8d8e499bd0861eefef12d4e00d99a.tar.bz2
Merge branch 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration into master-integration
* 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (55 commits) Fix thread safety regression of QNetworkConfigurationManager Fix instability in QNetworkConfigurationManager autotest Support word selection list with predictive text from splitview Fix softkey icon positioning in S60 5.3 QDeclarativeMouseArea: block context menu events ListViews loses items if all visible items are removed. Make TextEdit word selection more natural. Clear confusion between QMainWindow and QMainWindowLayout. Fix for rounded corners bug in QMenu Compile QWidgetPrivate::setParent_sys might be using null pointer Ensure the TextEdit cursor delegate is repositioned on mouse events. Don't crash on an invalid replacementStart from an input method. Fix incorrect hardware address on systems without getifaddrs() Enable multisampling on Symbian if hw supports it Fix QtCoreu.def file error Introduce platform extension to QGraphicsSystem Fix Symbian/WinsCW build break Prevent crash in OpenGL engine when scaling images / pixmaps. emit QNetWorkAccessManager::finished on QNetworkReply::abort() ...
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r--src/gui/kernel/qwidget.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 4c1a6dd..9556169 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -299,6 +299,7 @@ QWidgetPrivate::QWidgetPrivate(int version)
#ifndef QT_NO_IM
, inheritsInputMethodHints(0)
#endif
+ , inSetParent(0)
#if defined(Q_WS_X11)
, picture(0)
#elif defined(Q_WS_WIN)
@@ -2589,6 +2590,22 @@ WId QWidget::effectiveWinId() const
if (id || !testAttribute(Qt::WA_WState_Created))
return id;
QWidget *realParent = nativeParentWidget();
+ if (!realParent && d_func()->inSetParent) {
+ // In transitional state. This is really just a workaround. The real problem
+ // is that QWidgetPrivate::setParent_sys (platform specific code) first sets
+ // the window id to 0 (setWinId(0)) before it sets the Qt::WA_WState_Created
+ // attribute to false. The correct way is to do it the other way around, and
+ // in that case the Qt::WA_WState_Created logic above will kick in and
+ // return 0 whenever the widget is in a transitional state. However, changing
+ // the original logic for all platforms is far more intrusive and might
+ // break existing applications.
+ // Note: The widget can only be in a transitional state when changing its
+ // parent -- everything else is an internal error -- hence explicitly checking
+ // against 'inSetParent' rather than doing an unconditional return whenever
+ // 'realParent' is 0 (which may cause strange artifacts and headache later).
+ return 0;
+ }
+ // This widget *must* have a native parent widget.
Q_ASSERT(realParent);
Q_ASSERT(realParent->internalWinId());
return realParent->internalWinId();
@@ -10101,6 +10118,7 @@ void QWidget::setParent(QWidget *parent)
void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
{
Q_D(QWidget);
+ d->inSetParent = true;
bool resized = testAttribute(Qt::WA_Resized);
bool wasCreated = testAttribute(Qt::WA_WState_Created);
QWidget *oldtlw = window();
@@ -10261,6 +10279,8 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f)
ancestorProxy->d_func()->embedSubWindow(this);
}
#endif
+
+ d->inSetParent = false;
}
/*!