本文整理汇总了C++中GLWidget::connect方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWidget::connect方法的具体用法?C++ GLWidget::connect怎么用?C++ GLWidget::connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWidget
的用法示例。
在下文中一共展示了GLWidget::connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
extern "C" int qtmn(int argc, char** argv)
{
#else
int main(int argc, char **argv)
{
#endif
try {
QApplication app(argc, argv);
QSurfaceFormat fmt;
fmt.setDepthBufferSize(24);
if (QCoreApplication::arguments().contains(QStringLiteral("--multisample")))
fmt.setSamples(4);
if (QCoreApplication::arguments().contains(QStringLiteral("--coreprofile"))) {
fmt.setVersion(3, 2);
fmt.setProfile(QSurfaceFormat::CoreProfile);
}
QSurfaceFormat::setDefaultFormat(fmt);
auto logger = gatherer::graphics::Logger::create("preview-qt");
logger->info("Start");
// Should be created in heap, ownership taken by parent widget
GLWidget *glWidget = new GLWidget; // Note: moved creation output of Window for signal connection:
#if defined(__ANDROID__)
const bool synth = true; // Camera not working on Android (yet)
#else
const bool synth = false;
#endif
VideoCapture capture(0, synth);
MainWindow mainWindow(glWidget, capture);
mainWindow.resize(mainWindow.sizeHint());
int desktopArea = QApplication::desktop()->width() * QApplication::desktop()->height();
int widgetArea = mainWindow.width() * mainWindow.height();
if (((float)widgetArea / (float)desktopArea) < 0.75f)
mainWindow.show();
else
mainWindow.showMaximized();
// ((((((((((((((((( bEGIN )))))))))))))))))
QThread captureThread;
captureThread.start();
capture.moveToThread(&captureThread);
qRegisterMetaType< cv::Mat >("cv::Mat");
QObject::connect(&capture, &VideoCapture::started, [](){ qDebug() << "capture started"; });
glWidget->connect(&capture, SIGNAL(matReady(cv::Mat)), SLOT(setImage(cv::Mat)));
// ((((((((((((((((( eND )))))))))))))))))
int rc = app.exec();
captureThread.quit();
captureThread.wait();
return rc;
}
catch (const std::exception& exc) {
std::cerr << "Exception catched: " << exc.what() << std::endl;
return EXIT_FAILURE;
}
catch (...) {
std::cerr << "Unknown exception catched" << std::endl;
return EXIT_FAILURE;
}
}