コード例 #1
0
ファイル: modelrenderer.cpp プロジェクト: osamu-k/QtStudy
void ModelRenderer::windowChanged(QQuickWindow *window)
{
    LOG_ENTER();
    if( window != nullptr && window != m_window ){
        window->setClearBeforeRendering(false);

        connect( window, SIGNAL(afterAnimating()), this, SLOT(afterAnimating()), Qt::DirectConnection );
        connect( window, SIGNAL(afterRendering()), this, SLOT(afterRendering()), Qt::DirectConnection );
        connect( window, SIGNAL(afterSynchronizing()), this, SLOT(afterSynchronizing()), Qt::DirectConnection );
        connect( window, SIGNAL(beforeRendering()), this, SLOT(beforeRendering()), Qt::DirectConnection );
        connect( window, SIGNAL(beforeSynchronizing()), this, SLOT(beforeSynchronizing()), Qt::DirectConnection );
        connect( window, SIGNAL(frameSwapped()), this, SLOT(frameSwapped()), Qt::DirectConnection );
        connect( window, SIGNAL(openglContextCreated(QOpenGLContext*)), this, SLOT(openglContextCreated(QOpenGLContext*)), Qt::DirectConnection );
        connect( window, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)), this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString)), Qt::DirectConnection );
        connect( window, SIGNAL(sceneGraphInitialized()), this, SLOT(sceneGraphInitialized()), Qt::DirectConnection );
        connect( window, SIGNAL(sceneGraphInvalidated()), this, SLOT(sceneGraphInvalidated()),Qt::DirectConnection );
    }
コード例 #2
0
ファイル: quickview2.cpp プロジェクト: 0branch/qtide
// ---------------------------------------------------------------------
QuickView2::QuickView2(string n, string s, int resizemode, string glver) : QQuickView()
{
  QString qn=s2q(n);
  setObjectName(qn);
// enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView }
  setTitle(qn);
  setResizeMode((QQuickView::ResizeMode)(this->resizeMode=resizemode));

  QSurfaceFormat format;
  if (!glver.empty()) {
    int ver1,ver2;
    string::size_type d=glver.find(".",0);
    if (d == string::npos) {
      ver1=atoi(glver.c_str());
      ver2=0;
    } else {
      ver1=atoi(glver.substr(0,d).c_str());
      ver2=atoi(glver.substr(d+1).c_str());
    }
//    qDebug() << QString::number(ver1) << QString::number(ver2);
    format.setVersion(ver1,ver2);
  }
  format.setProfile(QSurfaceFormat::CoreProfile);
  setFormat(format);

  QObject::connect((QObject*)this->engine(), SIGNAL(quit()), this, SLOT(closeview()));
  QString t = s2q(s);
  if (t.contains("://"))
    sourceUrl = QUrl(t);
  else sourceUrl = QUrl::fromLocalFile(t);
  setSource(sourceUrl);
  connect(this, SIGNAL(statusChanged(QQuickView::Status)), this, SLOT(statusChanged(QQuickView::Status)));
#ifdef QT53
  connect(this, SIGNAL(sceneGraphError(QQuickWindow::SceneGraphError,QString)), this, SLOT(sceneGraphError(QQuickWindow::SceneGraphError,QString)));
#endif
}