Add a warning when using QOpenGLWidget as a native child

Just like it is done for QQuickWidget.

Task-number: QTBUG-41779
Change-Id: I1b27c2ed34ecb2520edf82843b675dbf6b0eab8e
Reviewed-by: Michael Bruning <michael.bruning@digia.com>
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
This commit is contained in:
Laszlo Agocs 2014-10-09 16:38:38 +02:00
parent 8fc34e42a8
commit 26c104d120

View File

@ -506,6 +506,12 @@ void QOpenGLWidgetPaintDevice::ensureActiveTarget()
GLuint QOpenGLWidgetPrivate::textureId() const
{
Q_Q(const QOpenGLWidget);
if (!q->isWindow() && q->internalWinId()) {
qWarning() << "QOpenGLWidget cannot be used as a native child widget."
<< "Consider setting Qt::AA_DontCreateNativeWidgetAncestors and Siblings.";
return 0;
}
return resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0);
}