Commit 7a0b775b authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

TracksView: Don't use tracksHeight to set items height.

Instead, ask the item for the height it wants
parent 13b9b7bb
......@@ -72,6 +72,8 @@ class AbstractGraphicsItem : public QObject, public QGraphicsItem
/// The item can be moved by the user.
virtual bool moveable() const = 0;
virtual qint64 itemHeight() const = 0;
/// Return a pointer to the TracksScene
TracksScene* scene();
......
......@@ -300,3 +300,9 @@ AbstractGraphicsMediaItem::triggerResize( TrackWorkflow *tw, Workflow::Helper *h
Commands::trigger( new Commands::Clip::Resize( tw, clipHelper, newBegin,
newEnd, pos ) );
}
qint64
AbstractGraphicsMediaItem::itemHeight() const
{
return 35;
}
......@@ -61,6 +61,7 @@ public:
Workflow::Helper *helper, qint64 pos );
virtual void triggerResize( TrackWorkflow *tw, Workflow::Helper *helper,
qint64 newBegin, qint64 newEnd, qint64 pos );
virtual qint64 itemHeight() const;
protected:
virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent* event );
......
......@@ -86,6 +86,12 @@ GraphicsEffectItem::trackType() const
return Workflow::VideoTrack;
}
qint64
GraphicsEffectItem::itemHeight() const
{
return 15;
}
void
GraphicsEffectItem::paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option )
{
......
......@@ -50,6 +50,7 @@ class GraphicsEffectItem : public AbstractGraphicsItem
Workflow::Helper *helper, qint64 pos);
virtual void triggerResize( TrackWorkflow *tw, Workflow::Helper *helper,
qint64 newBegin, qint64 newEnd, qint64 pos );
virtual qint64 itemHeight() const;
protected:
virtual bool hasResizeBoundaries() const;
/**
......
......@@ -289,7 +289,7 @@ TracksView::addItem( TrackWorkflow *tw, Workflow::Helper *helper, qint64 start )
}
m_itemsLoaded.insert( helper->uuid() );
item->m_tracksView = this;
item->setHeight( tracksHeight() );
item->setHeight( item->itemHeight() );
item->setTrack( getTrack( trackType, track ) );
item->setStartPos( start );
item->m_oldTrack = tw;
......@@ -341,7 +341,7 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
if ( m_dragAudioItem ) delete m_dragAudioItem;
m_dragAudioItem = new GraphicsAudioItem( clip );
m_dragAudioItem->m_tracksView = this;
m_dragAudioItem->setHeight( tracksHeight() );
m_dragAudioItem->setHeight( m_dragAudioItem->itemHeight() );
m_dragAudioItem->setTrack( getTrack( m_dragAudioItem->trackType(), 0 ) );
connect( m_dragAudioItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
......@@ -351,7 +351,7 @@ TracksView::clipDragEnterEvent( QDragEnterEvent *event )
if ( m_dragVideoItem ) delete m_dragVideoItem;
m_dragVideoItem = new GraphicsMovieItem( clip );
m_dragVideoItem->m_tracksView = this;
m_dragVideoItem->setHeight( tracksHeight() );
m_dragVideoItem->setHeight( m_dragVideoItem->itemHeight() );
m_dragVideoItem->setTrack( getTrack( m_dragVideoItem->trackType(), 0 ) );
connect( m_dragVideoItem, SIGNAL( split(AbstractGraphicsMediaItem*,qint64) ),
this, SLOT( split(AbstractGraphicsMediaItem*,qint64) ) );
......@@ -382,7 +382,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
AbstractGraphicsMediaItem *item = itemList.first();
m_dragEffectItem->setWidth( item->clipHelper()->length() );
m_dragEffectItem->setStartPos( item->startPos() );
m_dragEffectItem->setHeight( tracksHeight() / 2 );
m_dragEffectItem->setHeight( m_dragEffectItem->itemHeight() );
m_dragEffectItem->setTrack( getTrack( m_dragEffectItem->trackType(), 0 ) );
m_dragEffectItem->setZValue( 100 );
}
......@@ -396,7 +396,7 @@ TracksView::dragMoveEvent( QDragMoveEvent *event )
{
m_dragEffectItem->setWidth( track->maximumWidth() );
m_dragEffectItem->setStartPos( 0 );
m_dragEffectItem->setHeight( tracksHeight() / 2 );
m_dragEffectItem->setHeight( m_dragEffectItem->itemHeight() );
m_dragEffectItem->setTrack( track );
break ;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment