diff options
author | David Boddie <david.boddie@nokia.com> | 2010-10-27 15:05:59 (GMT) |
---|---|---|
committer | David Boddie <david.boddie@nokia.com> | 2010-10-27 15:05:59 (GMT) |
commit | 7ca94a08b9c232aaccb74fa85912515b8f9a6619 (patch) | |
tree | e60229477bc8269cf14904620bf0fc5ad18ef6d0 /src/gui/kernel/qwidget.cpp | |
parent | f8c9314d6224948c28487e291b4cdad0049682c7 (diff) | |
parent | 7285c09ef777569514e73dffa22ecfdb7df6ba8f (diff) | |
download | Qt-7ca94a08b9c232aaccb74fa85912515b8f9a6619.zip Qt-7ca94a08b9c232aaccb74fa85912515b8f9a6619.tar.gz Qt-7ca94a08b9c232aaccb74fa85912515b8f9a6619.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-doc-team into 4.7
Diffstat (limited to 'src/gui/kernel/qwidget.cpp')
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 9b44f15..e22ec55 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -236,6 +236,17 @@ void QWidgetBackingStoreTracker::unregisterWidget(QWidget *w) } } +/*! + \internal + Recursively remove widget and all of its descendents. + */ +void QWidgetBackingStoreTracker::unregisterWidgetSubtree(QWidget *widget) +{ + unregisterWidget(widget); + foreach (QObject *child, widget->children()) + if (QWidget *childWidget = qobject_cast<QWidget *>(child)) + unregisterWidgetSubtree(childWidget); +} QWidgetPrivate::QWidgetPrivate(int version) : QObjectPrivate(version) @@ -326,15 +337,27 @@ QWidgetPrivate::~QWidgetPrivate() #endif //QT_NO_GRAPHICSEFFECT } +class QDummyWindowSurface : public QWindowSurface +{ +public: + QDummyWindowSurface(QWidget *window) : QWindowSurface(window) {} + QPaintDevice *paintDevice() { return window(); } + void flush(QWidget *, const QRegion &, const QPoint &) {} +}; + QWindowSurface *QWidgetPrivate::createDefaultWindowSurface() { Q_Q(QWidget); QWindowSurface *surface; - if (QApplicationPrivate::graphicsSystem()) - surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); - else - surface = createDefaultWindowSurface_sys(); + if (q->property("_q_DummyWindowSurface").toBool()) { + surface = new QDummyWindowSurface(q); + } else { + if (QApplicationPrivate::graphicsSystem()) + surface = QApplicationPrivate::graphicsSystem()->createWindowSurface(q); + else + surface = createDefaultWindowSurface_sys(); + } return surface; } @@ -10031,7 +10054,16 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) if (newParent && isAncestorOf(focusWidget())) focusWidget()->clearFocus(); + QTLWExtra *oldTopExtra = window()->d_func()->maybeTopData(); + QWidgetBackingStoreTracker *oldBsTracker = oldTopExtra ? &oldTopExtra->backingStore : 0; + d->setParent_sys(parent, f); + + QTLWExtra *topExtra = window()->d_func()->maybeTopData(); + QWidgetBackingStoreTracker *bsTracker = topExtra ? &topExtra->backingStore : 0; + if (oldBsTracker && oldBsTracker != bsTracker) + oldBsTracker->unregisterWidgetSubtree(this); + if (desktopWidget) parent = 0; |