以下成員源於類 QGLWidget 已過時。 提供它們是為使舊源代碼能繼續工作。強烈建議不要在新代碼中使用它們。
(obsolete)
void
|
setContext (QGLContext * context , const QGLContext * shareContext = Q_NULLPTR, bool deleteOldContext = true) |
(obsolete)
void
|
setFormat (const QGLFormat & format ) |
Sets a new context for this widget. The QGLContext context must be created using new . QGLWidget will delete context when another context is set or when the widget is destroyed.
若 context is invalid, QGLContext::create () is performed on it. The initializeGL () function will then be executed for the new context before the first resizeGL () 或 paintGL ().
若 context is invalid, this method will try to keep display list and texture object sharing in effect, or (if shareContext points to a valid context) start display list and texture object sharing with that context, but sharing might be impossible if the two contexts have different formats 。使用 isSharing () to see whether sharing is in effect.
若 deleteOldContext is true (the default), the existing context will be deleted. You may use false here if you have kept a pointer to the old context (as returned by context ()), and want to restore that context later.
注意: This function is obsolete and should no longer be used. If you were using it to recreate the context for a QGLWidget , you should instead create a new QGLWidget 或使用 QOpenGLContext API in conjunction with QWindow . There is currently no officially supported way to substitute QGLWidget 's context with your own implementation of QGLContext .
另請參閱 context () 和 isSharing ().
Sets a new format for this widget.
If the underlying OpenGL/Window system cannot satisfy all the features requested in format , the nearest subset of features will be used. After creation, the format () method will return the actual rendering context format obtained.
The widget will be assigned a new QGLContext ,和 initializeGL () function will be executed for this new context before the first resizeGL () 或 paintGL ().
This method will try to keep display list and texture object sharing in effect with other QGLWidget objects, but changing the format might make sharing impossible. Use isSharing () to see if sharing is still in effect.