本文整理汇总了C++中QPlatformWindowFormat::setSharedContext方法的典型用法代码示例。如果您正苦于以下问题:C++ QPlatformWindowFormat::setSharedContext方法的具体用法?C++ QPlatformWindowFormat::setSharedContext怎么用?C++ QPlatformWindowFormat::setSharedContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QPlatformWindowFormat
的用法示例。
在下文中一共展示了QPlatformWindowFormat::setSharedContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: chooseContext
bool QGLContext::chooseContext(const QGLContext* shareContext)
{
Q_D(QGLContext);
if(!d->paintDevice || d->paintDevice->devType() != QInternal::Widget) {
d->valid = false;
}else {
QWidget *widget = static_cast<QWidget *>(d->paintDevice);
if (!widget->platformWindow()){
QGLFormat glformat = format();
QPlatformWindowFormat winFormat = QGLFormat::toPlatformWindowFormat(glformat);
if (shareContext) {
winFormat.setSharedContext(shareContext->d_func()->platformContext);
}
if (widget->testAttribute(Qt::WA_TranslucentBackground))
winFormat.setAlpha(true);
winFormat.setWindowApi(QPlatformWindowFormat::OpenGL);
winFormat.setWindowSurface(false);
widget->setPlatformWindowFormat(winFormat);
widget->winId();//make window
}
d->platformContext = widget->platformWindow()->glContext();
Q_ASSERT(d->platformContext);
d->glFormat = QGLFormat::fromPlatformWindowFormat(d->platformContext->platformWindowFormat());
d->valid =(bool) d->platformContext;
if (d->valid) {
d->platformContext->setQGLContextHandle(this,qDeleteQGLContext);
}
d->setupSharing();
}
return d->valid;
}