Details
-
Bug
-
Resolution: Out of scope
-
Not Evaluated
-
None
-
5.7.0
-
None
-
Windows 8.1, Windows 10, Qt 5.7.0
Description
A transient parent sometimes doesn't change in QWindow (approximately 20% of launches, only in the release version).
QWindow.transientParent() returns correct result, but Spy++ shows what 'Parent Window Handle' and 'Owner Window Handle' are 'None'.
As a result, our window doesn't overlap window which we try to set as transient parent (see screenshot1.png, normal case - screenshot2.png).
There is next code in sources QWindow::setVisible:
if (type() == Qt::Window) { QGuiApplicationPrivate *app_priv = QGuiApplicationPrivate::instance(); QString &firstWindowTitle = app_priv->firstWindowTitle; if (!firstWindowTitle.isEmpty()) { setTitle(firstWindowTitle); firstWindowTitle = QString(); } if (!app_priv->forcedWindowIcon.isNull()) setIcon(app_priv->forcedWindowIcon); // Handling of the -qwindowgeometry, -geometry command line arguments static bool geometryApplied = false; if (!geometryApplied) { geometryApplied = true; QGuiApplicationPrivate::applyWindowGeometrySpecificationTo(this); } }
Possible the issue related with this code, because when we set flag Qt::Tool for QWindow - issue doesn't reproduces.
Steps to reproduce:
1. Replace 'parentWId' to the appropriate WId which you would like to set as transient parent in code which is given below.
2. Build release.
3. Run application. If the issue didn't reproduce - relaunch it.
#include <QApplication> #include <QWindow> int main(int argc, char *argv[]) { QApplication a(argc, argv); auto parentWId = 12345678; //Replace to the appropriate WId auto transientParent = QWindow::fromWinId(static_cast<WId>( parentWId )); QWindow window; window.resize(400, 200); window.setTransientParent( transientParent ); window.show(); return a.exec(); }