[Interest] QWindow::setTransientParent()

John Weeks john at wavemetrics.com
Fri Nov 7 02:05:29 CET 2014


Can anyone tell me about  QWindow::setTransientParent()? When building with Qt 5 I keep seeing warnings:

 void QWindow::setTransientParent(QWindow *) QWidgetWindow(0x118c39a10, name = "QWidgetClassWindow") must be a top level window.

One situation where I see it is on Macintosh:

Our application can make a 3D graph window that uses OpenGL calls to draw. The OpenGL context is implemented via a QGLWidget. The  QGLWidget is contained in a QWidget that is itself contained in a QWidget that is (usually) a top-level window.

I see the warning when calling new QMenu(QGLWidget *). Here's a (truncated) stack trace (GizmoWD is our class, of course):

0	QWindow::setTransientParent(QWindow*)	qwindow.cpp	1131	0x10969ac1a	
1	QWidgetPrivate::setParent_sys(QWidget*, QFlags<Qt::WindowType>)	qwidget.cpp	10516	0x10898b528	
2	QWidget::setParent(QWidget*, QFlags<Qt::WindowType>)	qwidget.cpp	10375	0x108971b07	
3	QWidgetPrivate::init(QWidget*, QFlags<Qt::WindowType>)	qwidget.cpp	1179	0x10896fe3c	
4	QWidget	qwidget.cpp	1026	0x1089701a9	
5	QMenu	qmenu.cpp	1333	0x108b3468f	
6	QMenu	qmenu.cpp	1336	0x108b3460d	
7	GizmoWD::init(char const*, int)	GizmoWD.cpp	90	0x100cb58f9	
8	doNewGizmo(GizmoWD**, char const*, char*, wDataClass*, wdChildInfo::hostRectType, WMRect*, int, int, int)	GizmoBuiltInOps.cpp	279	0x100c81f7a	

In tracing into this, I see that QGLWidget requires a WinID. The QWindow * being passed to setTransientParent() is the QGLWidget. The QWindow whose setTransientParent() method was called is the QMenu.

I haven't seen any obvious problems that I can trace to this, but maybe I'm missing something.


I also see it on Windows in some other situations.


My apologies for a somewhat vague and abstruse question. I'm trying to understand the warning, but I don't have an obvious place to start. Thanks for any light you can shed!

-John




More information about the Interest mailing list