Fixed video z-order stacking

preferencesAboutTextFull
Craig Watson 8 years ago
parent 43e5298d2d
commit d021abf3b7
  1. 38
      src/domain/UBGraphicsMediaItem.cpp
  2. 5
      src/domain/UBGraphicsMediaItem.h
  3. 8
      src/domain/UBGraphicsProxyWidget.cpp

@ -76,10 +76,11 @@ UBGraphicsMediaItem::UBGraphicsMediaItem(const QUrl& pMediaFileUrl, QGraphicsIte
mDummyVideoWidget->setMinimumSize(320, 240);
mDummyVideoWidget->setWindowOpacity(0.0);
mVideoItem = new QGraphicsVideoItem();
mVideoItem = new QGraphicsVideoItem(this);
// Necessary to allow the video to be displayed on secondary screen
mVideoItem->setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
mVideoItem->setFlag(ItemStacksBehindParent, true);
mMediaObject->setVideoOutput(mVideoItem);
@ -179,13 +180,6 @@ QVariant UBGraphicsMediaItem::itemChange(GraphicsItemChange change, const QVaria
}
}
// Pass on geometry and position changes to the videoItem
else if (mVideoItem && change == QGraphicsItem::ItemTransformChange)
mVideoItem->setTransform(qvariant_cast<QTransform>(value));
else if (mVideoItem && change == QGraphicsItem::ItemPositionChange)
mVideoItem->setPos(qvariant_cast<QPointF>(value));
return UBGraphicsProxyWidget::itemChange(change, value);
}
@ -353,34 +347,6 @@ void UBGraphicsMediaItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
}
void UBGraphicsMediaItem::setPos(const QPointF &pos)
{
QGraphicsItem::setPos(pos);
if (mVideoItem)
mVideoItem->setPos(pos);
}
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)
{
QGraphicsItem::setTransform(matrix, combine);
if (mVideoItem)
mVideoItem->setTransform(matrix, combine);
}
void UBGraphicsMediaItem::resize(const QSizeF & pSize)
{
// Resize the video, then the rest of the Item

@ -108,11 +108,6 @@ public:
void setSelected(bool selected);
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);
public slots:

@ -89,8 +89,12 @@ QVariant UBGraphicsProxyWidget::itemChange(GraphicsItemChange change, const QVar
}
}
QVariant newValue = Delegate()->itemChange(change, value);
return QGraphicsProxyWidget::itemChange(change, newValue);
if (Delegate()) {
QVariant newValue = Delegate()->itemChange(change, value);
return QGraphicsProxyWidget::itemChange(change, newValue);
}
else
return QGraphicsProxyWidget::itemChange(change, value);
}
void UBGraphicsProxyWidget::setUuid(const QUuid &pUuid)

Loading…
Cancel
Save