Made tst_QWidget::winIdChangeEvent() pass with Lighthouse.

We need to call setWinId() at appropriate times, and enable creation of
native handles for child widgets when createWinId() is called.
This commit is contained in:
Samuel Rødal 2011-06-03 09:57:57 +02:00
parent 17613b7add
commit ac4276531c
2 changed files with 5 additions and 2 deletions

View File

@ -2474,9 +2474,7 @@ WId QWidget::winId() const
qDebug() << "QWidget::winId: creating native window for" << this;
#endif
QWidget *that = const_cast<QWidget*>(this);
#ifndef Q_WS_QPA
that->setAttribute(Qt::WA_NativeWindow);
#endif
that->d_func()->createWinId();
return that->data->winid;
}

View File

@ -184,6 +184,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
Q_Q(QWidget);
Qt::WindowFlags oldFlags = data.window_flags;
bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
int targetScreen = -1;
// Handle a request to move the widget to a particular screen
@ -196,6 +197,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
newparent = 0;
}
setWinId(0);
if (parent != newparent) {
QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function???
if (q->windowHandle()) {
@ -231,6 +234,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
if (!(f&Qt::Window) && (oldFlags&Qt::Window) && !q->testAttribute(Qt::WA_NativeWindow)) {
//qDebug() << "setParent_sys() change from toplevel";
q->destroy();
} else if (wasCreated) {
q->createWinId();
}
adjustFlags(f, q);