How to send mouse events to the embedded flash player in QAxWidget



  • I have a QAxWidget which embeds a flash player and loads a swf. I don't want to use the widget, but instead i want to render the widget into a QImage, and then, use that image as a texture in my OpenSceneGraph node. Everything is ok, so far. But since there is no widget visible, i have to get the mouse move/press/release events from my osgView, calculate the corresponding position to my node, and send the events to the flash player to make actionscript mouse events work. The calculation part is tomorrow's problem. But up to now, i was not able to send any custom mouse event to the player. Does anyone have any opinion?

    Here is the example code,
    @
    BFlashWidget::BFlashWidget(QWidget *parent)
    : QAxWidget(parent)
    {
    QSize imgSize(800,600);
    setMinimumSize(imgSize);

    setMouseTracking(true);
    
    mQtImg = QImage(imgSize, QImage::Format_RGBA8888);
    
    setControl(QString::fromUtf8("{d27cdb6e-ae6d-11cf-96b8-444553540000}"));
    dynamicCall("LoadMovie(long, string)", 0,
                QDir::currentPath() + "//deneme.swf");
    activateWindow();
    

    }

    BFlashWidget::~BFlashWidget()
    {

    }

    QImage BFlashWidget::getImage()
    {
    QPainter painter(&mQtImg);
    render(&painter);

    return mQtImg;
    

    }

    void BFlashWidget::simulateMouseMove(QMouseEvent *e)
    {
    QApplication::sendEvent(this, e);
    QApplication::processEvents();
    }

    void BFlashWidget::simulateMousePress(QMouseEvent *e)
    {
    QApplication::sendEvent(this, e);
    QApplication::processEvents();
    }

    void BFlashWidget::simulateMouseRelease(QMouseEvent *e)
    {
    QApplication::sendEvent(this, e);
    QApplication::processEvents();
    }
    @
    player does nothing when i call those simulateMouseXXXXX methods

    And i call simulateMouseXXXXX methods from a QGLWidget which i embedded the osgViewer::CompositeViewer in, with the QMouseEvent arguments of itself.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.