Fix video loading from file

- Added an overload for setMatrix in UBGraphicsMediaItem, to propagate
  matrix changes to the child videoItem
- Upon loading a video, the child videoItem is now added correctly, and
  set to the right position
preferencesAboutTextFull
Craig Watson 9 years ago
parent c220bf470f
commit 76636f73d7
  1. 5
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 7
      src/domain/UBGraphicsMediaItem.cpp
  3. 1
      src/domain/UBGraphicsMediaItem.h

@ -31,6 +31,7 @@
#include <QtXml>
#include <QGraphicsTextItem>
#include <QDomElement>
#include <QGraphicsVideoItem>
#include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsPixmapItem.h"
@ -652,6 +653,10 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
mScene->addItem(videoItem);
mScene->addItem(videoItem->videoItem());
// Update the child QGraphicsVideoItem's transformation matrix
videoItem->setMatrix(videoItem->matrix());
videoItem->show();

@ -353,6 +353,13 @@ void UBGraphicsMediaItem::setPos(qreal x, qreal y)
setPos(QPointF(x, y));
}
void UBGraphicsMediaItem::setMatrix(const QMatrix &matrix, bool combine)
{
QGraphicsItem::setMatrix(matrix, combine);
if (mVideoItem)
mVideoItem->setMatrix(matrix, combine);
}
void UBGraphicsMediaItem::setTransform(const QTransform &matrix, bool combine)
{

@ -110,6 +110,7 @@ public:
virtual void setPos(const QPointF &pos);
virtual void setPos(qreal x, qreal y);
virtual void setMatrix(const QMatrix &matrix, bool combine = false);
virtual void setTransform(const QTransform &matrix, bool combine = false);
virtual void resize(qreal w, qreal h);
virtual void resize(const QSizeF & pSize);

Loading…
Cancel
Save