Commit 654e0288 authored by Ludovic Fauvet's avatar Ludovic Fauvet

Add item selection in the timeline (simple, multiple and rubberband)

There's some redrawing issues in rubberband mode, this will be fixed
at a later time.
parent e9838c20
......@@ -30,6 +30,8 @@
GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : m_clip( clip ), m_width( 0 ), m_height( 0 )
{
setFlags( QGraphicsItem::ItemIsSelectable );
QTime length = QTime().addMSecs( clip->getParent()->getLength() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" )
......@@ -61,7 +63,11 @@ void GraphicsMovieItem::paint( QPainter* painter, const QStyleOptionGraphicsItem
gradient.setColorAt( 0, QColor::fromRgb( 32, 52, 142 ) );
gradient.setColorAt( 1, QColor::fromRgb( 43, 69, 181 ) );
painter->setPen( QPen( Qt::NoPen ) );
if ( isSelected() )
painter->setPen( QPen( Qt::yellow ) );
else
painter->setPen( QPen( Qt::NoPen ) );
painter->setBrush( QBrush( gradient ) );
painter->drawRect( boundingRect() );
......
......@@ -362,11 +362,8 @@ void TracksView::mousePressEvent( QMouseEvent* event )
if ( event->modifiers() == Qt::ControlModifier && mediaCollisionList.count() == 0 )
{
setDragMode( QGraphicsView::ScrollHandDrag );
QGraphicsView::mousePressEvent( event );
return;
}
if ( event->modifiers() == Qt::NoModifier &&
else if ( event->modifiers() == Qt::NoModifier &&
event->button() == Qt::LeftButton &&
mediaCollisionList.count() == 1 )
{
......@@ -377,17 +374,22 @@ void TracksView::mousePressEvent( QMouseEvent* event )
m_actionMoveExecuted = false;
m_actionItem = mediaCollisionList.at( 0 );
}
return;
scene()->clearSelection();
item->setSelected( true );
}
/*if ( event->modifiers() & Qt::ShiftModifier && collisionList.count() == 0 )
else if ( event->modifiers() == Qt::ControlModifier &&
event->button() == Qt::LeftButton &&
mediaCollisionList.count() == 1 )
{
AbstractGraphicsMediaItem* item = mediaCollisionList.at( 0 );
item->setSelected( !item->isSelected() );
}
else if ( event->modifiers() & Qt::ShiftModifier && mediaCollisionList.count() == 0 )
{
setDragMode( QGraphicsView::RubberBandDrag );
if ( !event->modifiers() & Qt::ControlModifier )
scene()->clearSelection();
QGraphicsView::mousePressEvent( event );
return;
}*/
}
QGraphicsView::mousePressEvent( event );
}
......
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