Using QtitanMultimedia widgets in the QGraphicsView Print E-mail

Component QtitanMultimedia starting with version 2.0 allows Adobe Flash, Silverlight, Acrobat Reader and any other NPAPI plugins to be added inside QGraphicsView. To work properly NPAPI plugin must have support for windowless protocol. All known modern plug-ins support this feature. The Mac OS X supports it by default. So this protocol ensures transparency and opaque modes. Flash or Silverlgt placed inside QGraphicsView can be further scaled, transformed, overlay shadowed using QGraphicsView/QGraphicsScene API.

The screenshots below shows how looks a built-in Google Maps for Flash in GraphicsView on the three platforms that are supported:

Episode 1 - Windows

Episode 2 - Linux

Episode 3 - Mac OS X

The following code example shows how to get Adobe Flash working within the QGraphicsView in practice:

    ...
    QGraphicsView* view = new QGraphicsView(this);
    QGraphicsScene *scene = new QGraphicsScene(view);
    QGraphicsProxyWidget* proxy = new QGraphicsProxyWidget();
    QGraphicsGridLayout* glayout = new QGraphicsGridLayout();
    glayout->addItem(proxy, 0, 0);
    glayout->setColumnStretchFactor(0, 1);
    glayout->setRowStretchFactor(0, 1);
    
    Qtitan::FlashPlayer* flash = new Qtitan::FlashPlayer();
    flash->setSource("C:/movies/example.swf");

    // Setting this property is required. Property allows to start using windowless mode.
    // In this mode widget will use the window of the GraphicsView for drawing.
    flash->setOpaqueMode(true);

    flash->setActive(true);
    if (!flash->isActive())
    {
        QMessageBox::about(QApplication::activeWindow(), tr("Adobe Flash Plugin"), 
            tr("The <b>Adobe Flash Plugin</b> is not installed at your PC."));
    }

    proxy->setWidget(flash);

    QGraphicsWidget* gw = new QGraphicsWidget(0, Qt::Window);
    gw->setPos(100, 100);
    gw->setPreferredSize(400, 300);
    gw->setLayout(glayout);
    gw->setWindowTitle(QApplication::translate("QtitanMultimedia", "Adobe Flash in the GraphicsView"));
    scene->addItem(gw);

    view->setScene(scene);
    ... 

The component does not violate the hierarchy of the native Qt windows while it embedded into the Qt applicaton or into the QGraphicsView if possible. After the NPAPI plugin was embeded, it begins to live like in the normal Web browser. You can also address to the object model of the loaded plugin using the QtScript engine via mechanism provided by QtitanMultimedia.

Having the opportunity to work within QGraphicsView, makes it possible to use a component inside the QtQuck. Flash or Silverlight technology inside QtQuick, make an application unforgettable for the end-user really.

 

 

 

Developer Machines Newsletter


Register to our Developer Machines newsletter to get informed on all the latest releases of the components for Qt, updates and general Qt knowledge.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

Get in touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

support@devmachines.com ( any questions related to our products or services )
license@devmachines.com ( questions related to licensing )

Copyright © 2009-2012 Developer Machines. All Rights Reserved.

Login to Developer Machines

Welcome to Developer Machines CMS



Developer Machines Registration



*
*
*
*
*

Fields marked with an asterisk (*) are required.