summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel/qwidget.cpp')
-rw-r--r--src/widgets/kernel/qwidget.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 6fdd5d3d0e..c57ca41815 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1243,11 +1243,14 @@ void QWidgetPrivate::createRecursively()
}
-
+// ### fixme: Qt 6: Remove parameter window from QWidget::create()
/*!
- Creates a new widget window if \a window is 0, otherwise sets the
- widget's window to \a window.
+ Creates a new widget window.
+
+ The parameter \a window is ignored in Qt 5. Please use
+ QWindow::fromWinId() to create a QWindow wrapping a foreign
+ window and pass it to QWidget::createWindowContainer() instead.
Initializes the window (sets the geometry etc.) if \a
initializeWindow is true. If \a initializeWindow is false, no
@@ -1260,11 +1263,15 @@ void QWidgetPrivate::createRecursively()
The QWidget constructor calls create(0,true,true) to create a
window for this widget.
+
+ \sa createWindowContainer(), QWindow::fromWinId()
*/
void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
{
Q_D(QWidget);
+ if (Q_UNLIKELY(window))
+ qWarning("QWidget::create(): Parameter 'window' does not have any effect.");
if (testAttribute(Qt::WA_WState_Created) && window == 0 && internalWinId())
return;
@@ -1288,7 +1295,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
// We're about to create a native child widget that doesn't have a native parent;
// enforce a native handle for the parent unless the Qt::WA_DontCreateNativeAncestors
// attribute is set.
- d->createWinId(window);
+ d->createWinId();
// Nothing more to do.
Q_ASSERT(testAttribute(Qt::WA_WState_Created));
Q_ASSERT(internalWinId());
@@ -2520,13 +2527,12 @@ WId QWidget::winId() const
return data->winid;
}
-
-void QWidgetPrivate::createWinId(WId winid)
+void QWidgetPrivate::createWinId()
{
Q_Q(QWidget);
#ifdef ALIEN_DEBUG
- qDebug() << "QWidgetPrivate::createWinId for" << q << winid;
+ qDebug() << "QWidgetPrivate::createWinId for" << q;
#endif
const bool forceNativeWindow = q->testAttribute(Qt::WA_NativeWindow);
if (!q->testAttribute(Qt::WA_WState_Created) || (forceNativeWindow && !q->internalWinId())) {
@@ -2543,15 +2549,7 @@ void QWidgetPrivate::createWinId(WId winid)
QWidget *w = qobject_cast<QWidget *>(pd->children.at(i));
if (w && !w->isWindow() && (!w->testAttribute(Qt::WA_WState_Created)
|| (!w->internalWinId() && w->testAttribute(Qt::WA_NativeWindow)))) {
- if (w!=q) {
- w->create();
- } else {
- w->create(winid);
- // if the window has already been created, we
- // need to raise it to its proper stacking position
- if (winid)
- w->raise();
- }
+ w->create();
}
}
} else {