MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

QGraphicsVideoItem Class Reference

The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject. More...

 #include <QGraphicsVideoItem>

Inherits: QGraphicsObject and QMediaBindableInterface.

This class was introduced in Qt Mobility 1.0.

Properties

Public Functions

QGraphicsVideoItem ( QGraphicsItem * parent = 0 )
~QGraphicsVideoItem ()
Qt::AspectRatioMode aspectRatioMode () const
QSizeF nativeSize () const
QPointF offset () const
void setAspectRatioMode ( Qt::AspectRatioMode mode )
void setOffset ( const QPointF & offset )
void setSize ( const QSizeF & size )
QSizeF size () const

Reimplemented Public Functions

virtual QRectF boundingRect () const
virtual QMediaObject * mediaObject () const
virtual void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 )

Signals

void nativeSizeChanged ( const QSizeF & size )

Additional Inherited Members

Detailed Description

The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.

Attaching a QGraphicsVideoItem to a QMediaObject allows it to display the video or image output of that media object. A QGraphicsVideoItem is attached to a media object by passing a pointer to the QMediaObject to the setMediaObject() function.

 player = new QMediaPlayer(this);

 QGraphicsVideoItem *item = new QGraphicsVideoItem;
 player->setVideoOutput(item);
 graphicsView->scene()->addItem(item);
 graphicsView->show();

 player->setMedia(video);
 player->play();

Note: Only a single display output can be attached to a media object at one time.

See also QMediaObject, QMediaPlayer, and QVideoWidget.

Property Documentation

aspectRatioMode : Qt::AspectRatioMode

This property holds how a video is scaled to fit the graphics item's size.

This property was introduced in Qt Mobility 1.0.

Access functions:

Qt::AspectRatioMode aspectRatioMode () const
void setAspectRatioMode ( Qt::AspectRatioMode mode )

mediaObject : QMediaObject * const

This property holds the media object which provides the video displayed by a graphics item.

This property was introduced in Qt Mobility 1.0.

Access functions:

virtual QMediaObject * mediaObject () const

nativeSize : const QSizeF

This property holds the native size of the video.

This property was introduced in Qt Mobility 1.0.

Access functions:

QSizeF nativeSize () const

Notifier signal:

void nativeSizeChanged ( const QSizeF & size )

offset : QPointF

This property holds the video item's offset.

QGraphicsVideoItem will draw video using the offset for its top left corner.

This property was introduced in Qt Mobility 1.0.

Access functions:

QPointF offset () const
void setOffset ( const QPointF & offset )

size : QSizeF

This property holds the video item's size.

QGraphicsVideoItem will draw video scaled to fit size according to its fillMode.

This property was introduced in Qt Mobility 1.0.

Access functions:

QSizeF size () const
void setSize ( const QSizeF & size )

Member Function Documentation

QGraphicsVideoItem::QGraphicsVideoItem ( QGraphicsItem * parent = 0 )

Constructs a graphics item that displays video.

The parent is passed to QGraphicsItem.

QGraphicsVideoItem::~QGraphicsVideoItem ()

Destroys a video graphics item.

QRectF QGraphicsVideoItem::boundingRect () const [virtual]

Reimplemented from QGraphicsItem::boundingRect().

This function was introduced in Qt Mobility 1.0.

void QGraphicsVideoItem::nativeSizeChanged ( const QSizeF & size ) [signal]

Signals that the native size of the video has changed.

This function was introduced in Qt Mobility 1.0.

void QGraphicsVideoItem::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ) [virtual]

Reimplemented from QGraphicsItem::paint().

This function was introduced in Qt Mobility 1.0.