Commit 4a1e8941 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Timeline: Move a method to the base class.

parent ab8c0dfe
......@@ -146,3 +146,18 @@ void AbstractGraphicsMediaItem::adjustLength()
Q_ASSERT( clip() );
resize( clip()->getLength() );
}
bool AbstractGraphicsMediaItem::resizeZone( const QPointF& position )
{
// Get the current transformation of the view and invert it.
QTransform transform = tracksView()->transform().inverted();
// Map the RESIZE_ZONE distance from the view to the item coordinates.
QLine line = transform.map( QLine( 0, 0, RESIZE_ZONE, 0 ) );
if ( position.x() < line.x2() ||
position.x() > ( boundingRect().width() - line.x2() ) )
{
return true;
}
return false;
}
......@@ -128,6 +128,12 @@ protected slots:
*/
void adjustLength();
/**
* \brief Check if the position given as parameter could be taken as a resize request.
* \return Returns True if the point is in a resize zone.
*/
bool resizeZone( const QPointF& position );
private:
/// This pointer will be set when inserted in the tracksView.
TracksView* m_tracksView;
......
......@@ -224,17 +224,3 @@ void GraphicsMovieItem::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
setCursor( Qt::OpenHandCursor );
}
bool GraphicsMovieItem::resizeZone( const QPointF& position )
{
// Get the current transformation of the view and invert it.
QTransform transform = tracksView()->transform().inverted();
// Map the RESIZE_ZONE distance from the view to the item coordinates.
QLine line = transform.map( QLine( 0, 0, RESIZE_ZONE, 0 ) );
if ( position.x() < line.x2() ||
position.x() > ( boundingRect().width() - line.x2() ) )
{
return true;
}
return false;
}
......@@ -75,11 +75,6 @@ protected:
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
private:
/**
* \brief Check if the position given as parameter could be taken as a resize request.
* \return Returns True if the point is in a resize zone.
*/
bool resizeZone( const QPointF& position );
Clip* m_clip;
signals:
......
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