本文整理汇总了C++中QWindow::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ QWindow::destroy方法的具体用法?C++ QWindow::destroy怎么用?C++ QWindow::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QWindow
的用法示例。
在下文中一共展示了QWindow::destroy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVBoxLayout
void tst_QWidget_window::tst_recreateWindow_QTBUG40817()
{
QTabWidget tab;
QWidget *w = new QWidget;
tab.addTab(w, "Tab1");
QVBoxLayout *vl = new QVBoxLayout(w);
QLabel *lbl = new QLabel("HELLO1");
lbl->setObjectName("label1");
vl->addWidget(lbl);
w = new QWidget;
tab.addTab(w, "Tab2");
vl = new QVBoxLayout(w);
lbl = new QLabel("HELLO2");
lbl->setAttribute(Qt::WA_NativeWindow);
lbl->setObjectName("label2");
vl->addWidget(lbl);
tab.show();
QVERIFY(QTest::qWaitForWindowExposed(&tab));
QWindow *win = tab.windowHandle();
win->destroy();
QWindowPrivate *p = qt_window_private(win);
p->create(true);
win->show();
tab.setCurrentIndex(1);
}
示例2: openGlContext
QString openGlContext()
{
QString result;
QTextStream str(&result);
QOpenGLContext context;
if (context.create()) {
# ifdef QT_OPENGL_DYNAMIC
str << "Dynamic GL ";
# endif
switch (context.openGLModuleType()) {
case QOpenGLContext::LibGL:
str << "LibGL";
break;
case QOpenGLContext::LibGLES:
str << "LibGLES";
break;
}
QWindow window;
if (QGuiApplication::platformName() == QLatin1String("greenisland"))
window.setFlags(Qt::Desktop);
window.setSurfaceType(QSurface::OpenGLSurface);
//window.setScreen(QGuiApplication::primaryScreen());
window.create();
if (context.makeCurrent(&window)) {
QOpenGLFunctions functions(&context);
str << " Vendor: " << reinterpret_cast<const char *>(functions.glGetString(GL_VENDOR))
<< "\nRenderer: " << reinterpret_cast<const char *>(functions.glGetString(GL_RENDERER))
<< "\nVersion: " << reinterpret_cast<const char *>(functions.glGetString(GL_VERSION))
<< "\nGLSL version: " << reinterpret_cast<const char *>(functions.glGetString(GL_SHADING_LANGUAGE_VERSION))
<< "\nFormat: " << context.format();
QList<QByteArray> extensionList = context.extensions().toList();
std::sort(extensionList.begin(), extensionList.end());
QByteArray extensions = extensionList.join(' ');
str << " \nFound " << extensionList.size() << " extensions:\n";
str << wordWrap(extensions, 78);
context.doneCurrent();
}
window.destroy();
} else {
str << "Unable to create an Open GL context.\n";
}
return result;
}