diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2015-02-26 16:16:56 +0300 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-03-27 08:00:01 +0000 |
commit | 7baaec17edb06634f1d6235a55c7adbd112cba3e (patch) | |
tree | e6f3418f8422b4081de4dbc737b67765dff9e9f2 /src/widgets | |
parent | c0e4f24336cb0f0c21ad6c79e3da898d974ac1ad (diff) |
Fix use of the window geometry specification
Until now we applied the geometry in QWidget::setVisible() by
calling QWidget::move() and QWidget::resize(). But these
methods are unreliable when the window is created but not
visible yet. For example, specifying the window position by
"-geometry +0+0" will take no effect.
Apply the geometry directly to QWindow in QWindow::setVisible().
QWidget will update its geometry after the response of the window
system. Besides it allows to specify the geometry for QML
applications.
Task-number: QTBUG-44713
Change-Id: I9a0e110e81e569c81da802729707fec104fef887
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index cb2e9e0bec..637afb3888 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8029,28 +8029,13 @@ void QWidget::setVisible(bool visible) && !parentWidget()->testAttribute(Qt::WA_WState_Created)) parentWidget()->window()->d_func()->createRecursively(); - //we have to at least create toplevels before applyX11SpecificCommandLineArguments - //but not children of non-visible parents + //create toplevels but not children of non-visible parents QWidget *pw = parentWidget(); if (!testAttribute(Qt::WA_WState_Created) && (isWindow() || pw->testAttribute(Qt::WA_WState_Created))) { create(); } - // Handling of the -qwindowgeometry, -geometry command line arguments - if (windowType() == Qt::Window && windowHandle()) { - static bool done = false; - if (!done) { - done = true; - const QRect oldGeometry = frameGeometry(); - const QRect geometry = QGuiApplicationPrivate::applyWindowGeometrySpecification(oldGeometry, windowHandle()); - if (oldGeometry.size() != geometry.size()) - resize(geometry.size()); - if (geometry.topLeft() != oldGeometry.topLeft()) - move(geometry.topLeft()); - } // done - } - bool wasResized = testAttribute(Qt::WA_Resized); Qt::WindowStates initialWindowState = windowState(); |