Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Capture and Transform Events to a hidden QWidget/QGraphicaslView/QGraphicsScene

Capture and Transform Events to a hidden QWidget/QGraphicaslView/QGraphicsScene

Scheduled Pinned Locked Moved Game Development
2 Posts 2 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jdoe
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Taamalus
      wrote on last edited by
      #2

      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.

      ... time waits for no one. - Henry

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved