diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2010-12-14 16:15:44 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2011-01-04 14:18:24 (GMT) |
commit | a7fc0e8bad3bd020ece5fa70f0462bcaf59b3d77 (patch) | |
tree | eb49255946f2632e8fe9a96cbbeb3b7cea619be5 /src | |
parent | e90cb6992e35ed4b9c2aae85edb8d787c24a8a6c (diff) | |
download | Qt-a7fc0e8bad3bd020ece5fa70f0462bcaf59b3d77.zip Qt-a7fc0e8bad3bd020ece5fa70f0462bcaf59b3d77.tar.gz Qt-a7fc0e8bad3bd020ece5fa70f0462bcaf59b3d77.tar.bz2 |
Fix nativechild widget position in Lighthouse
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qwidget_qpa.cpp | 16 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestlitewindow.cpp | 11 | ||||
-rw-r--r-- | src/plugins/platforms/testlite/qtestlitewindow.h | 3 |
3 files changed, 12 insertions, 18 deletions
diff --git a/src/gui/kernel/qwidget_qpa.cpp b/src/gui/kernel/qwidget_qpa.cpp index dce23a3..001810e 100644 --- a/src/gui/kernel/qwidget_qpa.cpp +++ b/src/gui/kernel/qwidget_qpa.cpp @@ -162,7 +162,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) { Q_Q(QWidget); - // QWidget *oldParent = q->parentWidget(); Qt::WindowFlags oldFlags = data.window_flags; int targetScreen = -1; @@ -214,13 +213,6 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) data.window_flags = window->setWindowFlags(data.window_flags); } - // Reparenting child to toplevel - if ((f&Qt::Window) && !(oldFlags&Qt::Window)) { - //qDebug() << "setParent_sys() change to toplevel"; - q->create(); //### too early: this ought to happen at show() time - } - - if (q->isWindow() || (!newparent || newparent->isVisible()) || explicitlyHidden) q->setAttribute(Qt::WA_WState_Hidden); q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden); @@ -396,7 +388,11 @@ void QWidgetPrivate::show_sys() QPlatformWindow *window = q->platformWindow(); if (window) { - const QRect geomRect = q->geometry(); + QRect geomRect = q->geometry(); + if (!q->isWindow()) { + QPoint topLeftOfWindow = q->mapTo(q->nativeParentWidget(),QPoint()); + geomRect.moveTopLeft(topLeftOfWindow); + } const QRect windowRect = window->geometry(); if (windowRect != geomRect) { window->setGeometry(geomRect); @@ -591,7 +587,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (q->isVisible()) { if (q->platformWindow()) { if (q->isWindow()) { - q->platformWindow()->setGeometry(q->frameGeometry()); + q->platformWindow()->setGeometry(q->geometry()); } else { QPoint posInNativeParent = q->mapTo(q->nativeParentWidget(),QPoint()); q->platformWindow()->setGeometry(QRect(posInNativeParent,r.size())); diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index f8f4a5f..5446615 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -71,8 +71,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) int h = window->height(); if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate - ::platformIntegration()->hasOpenGL() ) { + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { #ifndef QT_NO_OPENGL XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); @@ -117,6 +116,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) } + QTestLiteWindow::~QTestLiteWindow() { #ifdef MYX11_DEBUG @@ -557,8 +557,8 @@ WId QTestLiteWindow::winId() const void QTestLiteWindow::setParent(const QPlatformWindow *window) { - QPoint point = widget()->mapTo(widget()->nativeParentWidget(),QPoint()); - XReparentWindow(mScreen->display(),x_window,window->winId(),point.x(),point.y()); + QPoint topLeft = geometry().topLeft(); + XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); } void QTestLiteWindow::raise() @@ -624,7 +624,8 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; #endif - QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, e->width, e->height)); + QRect newRect(xpos, ypos, e->width, e->height); + QWindowSystemInterface::handleGeometryChange(widget(), newRect); } void QTestLiteWindow::mousePressEvent(XButtonEvent *e) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 8e9f6fd..7e990ee 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -136,9 +136,6 @@ private: QPlatformGLContext *mGLContext; QTestLiteScreen *mScreen; Qt::WindowFlags window_flags; - - Atom m_mwm_hint_atom; - }; #endif |