Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

pass data between qtquick controls (slider) and C++ application

$
0
0
yes i have, as follows: void TessellationSceneItem::sync() {     if(!mTessScene)     {         //initialize the tessellation renderer         mTessScene = new TeapotTessellation();           //start tracking the time         mTIme.start();           //make the connection to render the opengl scene before the scene graph rendering         connect(window(),SIGNAL(beforeRendering()),mTessScene,SLOT(paint()),Qt::DirectConnection);           QTimer *timer = new QTimer();         connect(timer,SIGNAL(timeout()),this,SLOT(updateTime()),Qt::DirectConnection);         timer->start();     }         mTessScene->setViewportSize(window()->width() * window()->devicePixelRatio(),                                 window()->height() * window()->devicePixelRatio());       //set  the timer value from the qml to the mTessScene     //in other words, copy the state of the item into the renderer } And the above gets called in the following manner: TessellationSceneItem::TessellationSceneItem()     :mTessScene(0) {     connect(this,SIGNAL(windowChanged(QQuickWindow*)),this,SLOT(handleWindowChanged(QQuickWindow*))); }   void TessellationSceneItem::handleWindowChanged(QQuickWindow *win) {     if(win)     {         connect(win,SIGNAL(beforeSynchronizing()),this,SLOT(sync()),Qt::DirectConnection);         connect(win,SIGNAL(sceneGraphInvalidated()),this,SLOT(cleanup()),Qt::DirectConnection);           //define the opengl surface format         //with the most modern profile         //while retaining the compatibility profile         QSurfaceFormat f = win->format();         f.setMajorVersion(4);         f.setMinorVersion(3);         f.setSamples(4);         f.setStencilBufferSize(8);         f.setProfile(QSurfaceFormat::CompatibilityProfile);           win->setFormat(f);           win->setClearBeforeRendering(false);     } }

Viewing all articles
Browse latest Browse all 4972

Trending Articles