Capture and Transform Events to a hidden QWidget/QGraphicaslView/QGraphicsScene
-
I try to put widgets onto object-textures to have dialogs in a 3D-Scene.
I managed render QWidget, QGraphicsScene or QGraphicsView into QImage via QPainter and copy the image into my texture. Everything works fine:
@
mQtDialog = new EmbeddedDialog;
mQtScene = new QGraphicsScene();
mQtScene->addWidget(mQtDialog);
mQtView = new QGraphicsView(mQtScene);@
...
for each 3drender loop:
@
Texture tex;
QImage image(tex->GetWidth(), tex->GetWidth(), QImage::Format_ARGB32);
QPainter imagePainter(&image);
mQtView->render(&imagePainter);
const uchar *imgdata = image.bits();
memcpy(tex.data, imgdata, tex->GetWidth() * tex->GetHeight() * 4);
@But I found no way to address event handling. I can't call the show() method, otherwise the real dialog will shown on my screen.
Any suggestions how, capture events, transform it into texture space, and finally pass it to the Widget, Scene or View?
Calculate the screencoordinates into texture 2D coordinates is not the issue ;-)
Jan
-
Not sure what 'Texture' is in this context. If it's OpenGL, this link might help; or this is what I'm studying myself right now.
http://www.digitalfanatics.org/projects/qt_tutorial/chapter14.html
see chapter six and seven for a simple set up.Also, if you could elaborate a little on what you are trying to show and which events need to take place, someone would be able to help. Right now, the way I understand your code, calling show() would be the first command required to 'see' anything, but you wrote it's already visible.