Remove unused arguments from QWidgetPrivate::create_sys
The public QWidget::create still has them, but we don't need to propagate them on - that just makes debugging the window creation flow harder. The window argument to QWidget::create is technically used to guard an early exit in the function, but to keep behavior the same we leave it for now. Change-Id: Ic0287575aa25f1272e216adc1b75e34d6f55f6d9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
parent
deac052a40
commit
7d3a55cbd2
@ -1962,7 +1962,7 @@ bool QApplication::event(QEvent *e)
|
||||
*/
|
||||
|
||||
// ### FIXME: topLevelWindows does not contain QWidgets without a parent
|
||||
// until create_sys is called. So we have to override the
|
||||
// until QWidgetPrivate::create is called. So we have to override the
|
||||
// QGuiApplication::notifyLayoutDirectionChange
|
||||
// to do the right thing.
|
||||
void QApplicationPrivate::notifyLayoutDirectionChange()
|
||||
|
@ -1190,7 +1190,7 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
|
||||
q->setAttribute(Qt::WA_ContentsMarginsRespectsSafeArea);
|
||||
q->setAttribute(Qt::WA_WState_Hidden);
|
||||
|
||||
//give potential windows a bigger "pre-initial" size; create_sys() will give them a new size later
|
||||
//give potential windows a bigger "pre-initial" size; create() will give them a new size later
|
||||
data.crect = parentWidget ? QRect(0,0,100,30) : QRect(0,0,640,480);
|
||||
focus_next = focus_prev = q;
|
||||
|
||||
@ -1255,27 +1255,19 @@ void QWidgetPrivate::createRecursively()
|
||||
/*!
|
||||
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
|
||||
initialization is performed. This parameter only makes sense if \a
|
||||
window is a valid window.
|
||||
|
||||
Destroys the old window if \a destroyOldWindow is true. If \a
|
||||
destroyOldWindow is false, you are responsible for destroying the
|
||||
window yourself (using platform native code).
|
||||
|
||||
The QWidget constructor calls create(0,true,true) to create a
|
||||
window for this widget.
|
||||
The parameters \a window, \a initializeWindow, and \a destroyOldWindow
|
||||
are ignored in Qt 5. Please use QWindow::fromWinId() to create a
|
||||
QWindow wrapping a foreign window and pass it to
|
||||
QWidget::createWindowContainer() instead.
|
||||
|
||||
\sa createWindowContainer(), QWindow::fromWinId()
|
||||
*/
|
||||
|
||||
void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
|
||||
{
|
||||
Q_UNUSED(initializeWindow);
|
||||
Q_UNUSED(destroyOldWindow);
|
||||
|
||||
Q_D(QWidget);
|
||||
if (Q_UNLIKELY(window))
|
||||
qWarning("QWidget::create(): Parameter 'window' does not have any effect.");
|
||||
@ -1335,7 +1327,7 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow)
|
||||
d->updateIsOpaque();
|
||||
|
||||
setAttribute(Qt::WA_WState_Created); // set created flag
|
||||
d->create_sys(window, initializeWindow, destroyOldWindow);
|
||||
d->create();
|
||||
|
||||
// a real toplevel window needs a backing store
|
||||
if (isWindow() && windowType() != Qt::Desktop) {
|
||||
@ -1404,14 +1396,10 @@ void q_createNativeChildrenAndSetParent(const QWidget *parentWidget)
|
||||
|
||||
}
|
||||
|
||||
void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow)
|
||||
void QWidgetPrivate::create()
|
||||
{
|
||||
Q_Q(QWidget);
|
||||
|
||||
Q_UNUSED(window);
|
||||
Q_UNUSED(initializeWindow);
|
||||
Q_UNUSED(destroyOldWindow);
|
||||
|
||||
if (!q->testAttribute(Qt::WA_NativeWindow) && !q->isWindow())
|
||||
return; // we only care about real toplevels
|
||||
|
||||
@ -11340,7 +11328,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
|
||||
// windowModality property and then reshown.
|
||||
}
|
||||
if (testAttribute(Qt::WA_WState_Created)) {
|
||||
// don't call setModal_sys() before create_sys()
|
||||
// don't call setModal_sys() before create()
|
||||
d->setModal_sys();
|
||||
}
|
||||
break;
|
||||
|
@ -352,7 +352,7 @@ public:
|
||||
void update(T t);
|
||||
|
||||
void init(QWidget *desktopWidget, Qt::WindowFlags f);
|
||||
void create_sys(WId window, bool initializeWindow, bool destroyOldWindow);
|
||||
void create();
|
||||
void createRecursively();
|
||||
void createWinId();
|
||||
|
||||
|
@ -6139,7 +6139,7 @@ void tst_QWidget::minAndMaxSizeWithX11BypassWindowManagerHint()
|
||||
{
|
||||
if (m_platform != QStringLiteral("xcb"))
|
||||
QSKIP("This test is for X11 only.");
|
||||
// Same size as in QWidget::create_sys().
|
||||
// Same size as in QWidgetPrivate::create.
|
||||
const QSize desktopSize = QApplication::desktop()->size();
|
||||
const QSize originalSize(desktopSize.width() / 2, desktopSize.height() * 4 / 10);
|
||||
|
||||
@ -9415,7 +9415,7 @@ void tst_QWidget::initialPosForDontShowOnScreenWidgets()
|
||||
const QPoint expectedPos(0, 0);
|
||||
QWidget widget;
|
||||
widget.setAttribute(Qt::WA_DontShowOnScreen);
|
||||
widget.winId(); // Make sure create_sys is called.
|
||||
widget.winId(); // Make sure QWidgetPrivate::create is called.
|
||||
QCOMPARE(widget.pos(), expectedPos);
|
||||
QCOMPARE(widget.geometry().topLeft(), expectedPos);
|
||||
}
|
||||
@ -9425,7 +9425,7 @@ void tst_QWidget::initialPosForDontShowOnScreenWidgets()
|
||||
QWidget widget;
|
||||
widget.setAttribute(Qt::WA_DontShowOnScreen);
|
||||
widget.move(expectedPos);
|
||||
widget.winId(); // Make sure create_sys is called.
|
||||
widget.winId(); // Make sure QWidgetPrivate::create is called.
|
||||
QCOMPARE(widget.pos(), expectedPos);
|
||||
QCOMPARE(widget.geometry().topLeft(), expectedPos);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user