Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QMediaContentContext Class Reference
[QtMediaModule]

The QMediaContentContext class allows multiple related player objects to be grouped together. More...

    #include <QMediaContentContext>

Inherits QObject.

Public Functions

Public Slots

Signals

Additional Inherited Members


Detailed Description

The QMediaContentContext class allows multiple related player objects to be grouped together.

The QMediaContentContext is useful when multiple player objects are required to always work with the same media content object. The class allows related player objects to be group together and updated when the shared media content object changes.

Player Objects

By convention player objects are defined by a setMediaContent() slot in the class declaration. The following declaration outlines a simple player object class.

    class PlayerObject : public QObject
    {
        Q_OBJECT
    public:
        PlayerObject( QObject* parent = 0 );

    public slots:
        void setMediaContent( QMediaContent* content );
    };

After creating a context add related player objects to the context. When setMediaContent() is called the context will also call setMediaContent() for all player objects added to the context.

    PlayerObject *a = new PlayerObject( this );
    PlayerObject *b = new PlayerObject( this );

    QMediaContentContext *context = new QMediaContentContext( this );
    context->addObject( a );
    context->addObject( b );

This way all player objects added to the context will always be working with the same media content object.

QMediaContentContext is a player object.

See also QMediaContent.


Member Function Documentation

QMediaContentContext::QMediaContentContext ( QObject * parent = 0 )

Constructs an empty media content context.

The parent argument is passed to the QObject constructor.

QMediaContentContext::~QMediaContentContext ()

Destroys the context.

void QMediaContentContext::addObject ( QObject * object )

Adds object to the context. The object should be a player object.

QMediaContent * QMediaContentContext::content () const

Returns the current media content object for the context.

void QMediaContentContext::contentChanged ( QMediaContent * content )   [signal]

The media content object has changed to content within the context.

See also setMediaContent().

void QMediaContentContext::removeObject ( QObject * object )

Removes object from the context.

void QMediaContentContext::setMediaContent ( QMediaContent * content )   [slot]

Sets content as the media content object for the context as well as all player objects added to the context.

See also contentChanged().


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3