diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qapplication_lite.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 18 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_lite.cpp | 44 |
3 files changed, 43 insertions, 25 deletions
diff --git a/src/gui/kernel/qapplication_lite.cpp b/src/gui/kernel/qapplication_lite.cpp index db31abd..9c36ef5 100644 --- a/src/gui/kernel/qapplication_lite.cpp +++ b/src/gui/kernel/qapplication_lite.cpp @@ -479,6 +479,7 @@ void qt_init(QApplicationPrivate *priv, int type) { Q_UNUSED(type); + qApp->setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); char *p; char **argv = priv->argv; int argc = priv->argc; @@ -787,6 +788,11 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterface::KeyEvent *e) void QApplicationPrivate::processGeometryChange(QWidget *tlw, const QRect &newRect) { + if (!tlw->isWindow()) + return; //geo of native child widgets is controlled by lighthouse + //so we already have sent the events; besides this new rect + //is not mapped to parent + QRect cr(tlw->geometry()); bool isResize = cr.size() != newRect.size(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 1df73c2..782cc1d 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1342,6 +1342,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) flags |= Qt::Window; } +#ifndef Q_WS_LITE if (QWidget *parent = parentWidget()) { #ifdef Q_WS_MAC if (testAttribute(Qt::WA_NativeWindow) == false) @@ -1362,6 +1363,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) return; } } +#endif //Q_WS_LITE #ifdef QT3_SUPPORT if (flags & Qt::WStaticContents) @@ -2424,6 +2426,7 @@ void QWidgetPrivate::createWinId(WId winid) #endif const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow); if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) { +#ifndef Q_WS_LITE if (!q->isWindow()) { QWidget *parent = q->parentWidget(); QWidgetPrivate *pd = parent->d_func(); @@ -2451,6 +2454,10 @@ void QWidgetPrivate::createWinId(WId winid) } else { q->create(); } +#else + q->create(); +#endif //Q_WS_LITE + } } @@ -10453,12 +10460,6 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) Q_ASSERT_X(sizeof(d->high_attributes)*8 >= (Qt::WA_AttributeCount - sizeof(uint)*8), "QWidget::setAttribute(WidgetAttribute, bool)", "QWidgetPrivate::high_attributes[] too small to contain all attributes in WidgetAttribute"); -#ifdef Q_WS_LITE - //### we don't have native child widgets, and WinId isn't really there yet - if (attribute == Qt::WA_NativeWindow) - return; -#endif - #ifdef Q_WS_WIN // ### Don't use PaintOnScreen+paintEngine() to do native painting in 5.0 if (attribute == Qt::WA_PaintOnScreen && on && !inherits("QGLWidget")) { @@ -11945,11 +11946,6 @@ QWindowSurface *QWidget::windowSurface() const */ void QWidget::setPlatformWindow(QPlatformWindow *window) { -#ifndef Q_BACKINGSTORE_SUBSURFACES - if (!isTopLevel()) - return; -#endif - Q_D(QWidget); QTLWExtra *topData = d->topData(); diff --git a/src/gui/kernel/qwidget_lite.cpp b/src/gui/kernel/qwidget_lite.cpp index 5380445..f92eb61 100644 --- a/src/gui/kernel/qwidget_lite.cpp +++ b/src/gui/kernel/qwidget_lite.cpp @@ -54,6 +54,23 @@ QT_BEGIN_NAMESPACE static QPlatformScreen *qt_screenForWidget(const QWidget *w); +void setParentForChildrenOfWidget(QPlatformWindow *window, const QWidget *widget) +{ + QObjectList children = widget->children(); + for (int i = 0; i < children.size(); i++) { + if (children.at(i)->isWidgetType()) { + const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i)); + if (childWidget) { // should not be nessesary + if (childWidget->platformWindow()) { + childWidget->platformWindow()->setParent(window); + } else { + setParentForChildrenOfWidget(window,childWidget); + } + } + } + } +} + void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); @@ -65,7 +82,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO Qt::WindowFlags flags = data.window_flags; - if (!(flags & Qt::Window) || q->windowType() == Qt::Desktop) + if ((!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow()) || q->windowType() == Qt::Desktop ) return; // we only care about real toplevels QWindowSurface *surface = q->windowSurface(); @@ -76,8 +93,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO } Q_ASSERT(platformWindow); - // QGLWidget does not need/work with a windowsurface - if (!surface) {// && !q->inherits("QGLWidget")) { + if (!surface) { surface = QApplicationPrivate::platformIntegration()->createWindowSurface(q,platformWindow->winId()); } @@ -85,14 +101,11 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO setWinId(q->platformWindow()->winId()); - QObjectList children = q->children(); - for (int i = 0; i < children.size(); i++) { - if (children.at(i)->isWidgetType()) { - const QWidget *childWidget = qobject_cast<const QWidget *>(children.at(i)); - QPlatformWindow *childWindow = childWidget->platformWindow(); - if (childWindow) { - childWindow->setParent(platformWindow); - } + //first check children. then find who for parent. + setParentForChildrenOfWidget(platformWindow,q); + if (QWidget *nativeParent = q->nativeParentWidget()) { + if (nativeParent->platformWindow()) { + platformWindow->setParent(nativeParent->platformWindow()); } } @@ -132,7 +145,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); - // QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; @@ -560,9 +572,13 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) data.crect = r; if (q->isVisible()) { - if (q->platformWindow()) { - q->platformWindow()->setGeometry(q->frameGeometry()); + if (q->isWindow()) { + q->platformWindow()->setGeometry(q->frameGeometry()); + } else { + QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); + q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); + } const QWidgetBackingStore *bs = maybeBackingStore(); if (bs->windowSurface) { if (isResize) |